Skip to content

Commit 0787409

Browse files
author
zhaokai
committed
Merge branch 'webclient_plot' of github.com:MapGIS/WebClient-JavaScript into webclient_plot
2 parents eeb5ebf + 495ee60 commit 0787409

File tree

11 files changed

+280
-131
lines changed

11 files changed

+280
-131
lines changed

src/service/3DPlot/Draw/DrawPolyline.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default class DrawPolyline extends DrawObject {
4747
const viewer = this._viewer;
4848
const symbol = this._symbol;
4949
const handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
50+
const {classificationType} = symbol;
5051
let that = this;
5152

5253
handler.setInputAction((event) => {
@@ -62,6 +63,7 @@ export default class DrawPolyline extends DrawObject {
6263
that._primitive = PrimitiveFactory.createInstance(symbol.type, {
6364
positions: that.m_coords,
6465
element: res,
66+
classificationType: classificationType
6567
});
6668
that._isAdded = true;
6769
that._plotLayer._primitiveCollection.add(that._primitive);

src/service/3DPlot/PlotLayer3D.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -271,20 +271,6 @@ class PlotLayer3D extends Observable {
271271
}
272272
return plots;
273273
}
274-
275-
_mercatorTolonlat(mercator) {
276-
let lonlat = {lon: 0, lat: 0};
277-
278-
let x = mercator.x / 20037508.34 * 180;
279-
let y = mercator.y / 20037508.34 * 180;
280-
281-
y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
282-
283-
lonlat.lon = x;
284-
lonlat.lat = y;
285-
286-
return lonlat;
287-
};
288274
}
289275

290276
Object.defineProperties(PlotLayer3D.prototype, {

src/service/3DPlot/Primitive/ElementInstance/KidneyAreaElementInstance.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ import RegularLine1ElementInstance from "./RegularLine1ElementInstance";
1010
import {CesiumGeomUtil} from "../../Utils/CesiumUtil";
1111
export default class KidneyAreaElementInstance extends RegularLine1ElementInstance {
1212
transfromGeoCesium(elem, cesgeo, options) {
13+
let {dimModHeight} = options;
14+
if(typeof this._classificationType === 'number' && this._classificationType >= 0){
15+
dimModHeight = 0;
16+
}
17+
1318
CesiumGeomUtil.degreesWithHeightToWorldCoords(
1419
cesgeo,
15-
options.dimModHeight
20+
dimModHeight
1621
);
1722
this._rotatePart(elem, cesgeo, options);
1823
}

src/service/3DPlot/Primitive/ElementInstance/RegularLine1ElementInstance.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import MainElement from "../../../../service/PlotBase/SvgLoader/element/extend/M
1212
import RegularLineElementInstance from "./RegularLineElementInstance";
1313

1414
export default class RegularLine1ElementInstance extends RegularLineElementInstance {
15-
pathElemToWallGeomInstance(pathElem, options) {
15+
pathElemToWallGeomInstance(pathElem, options, sampleHeights) {
1616
if (!(pathElem instanceof MainElement)) return undefined;
17-
return super.pathElemToWallGeomInstance(pathElem, options);
17+
return super.pathElemToWallGeomInstance(pathElem, options, sampleHeights);
1818
}
1919

2020
transfromGeoCesium(elem, cesgeo, options) {
@@ -26,7 +26,7 @@ export default class RegularLine1ElementInstance extends RegularLineElementInsta
2626
}
2727

2828
_rotatePart(ele, cesGeom, options) {
29-
const { dimModHeight } = options;
29+
let { dimModHeight } = options;
3030
if (ele instanceof MainElement) return;
3131

3232
if (!ele._dimModal.is3DTran()) return;
@@ -42,6 +42,10 @@ export default class RegularLine1ElementInstance extends RegularLineElementInsta
4242
translatePoint.y
4343
);
4444

45+
//这个地方控制抬起高度,贴地或贴模型时抬高高度为0
46+
if(typeof this._classificationType === 'number' && this._classificationType >= 0){
47+
dimModHeight = 0;
48+
}
4549
const originPnt = Cesium.Cartesian3.fromDegreesArrayHeights([
4650
t.x,
4751
t.y,

src/service/3DPlot/Primitive/ElementInstance/RegularLineElementInstance.js

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ import MainElement from "../../../../service/PlotBase/SvgLoader/element/extend/M
1212
import { defined } from "../../../PlotUtilBase/Check";
1313

1414
export default class RegularLineElementInstance extends SvgElementInstance {
15-
svgToGeomInstances(elem, options) {
16-
const instances = super.svgToGeomInstances(elem, options);
17-
const wallGeomInstances = this.generateWallGeometryInstances(elem, options);
18-
return { instances, wallGeomInstances };
15+
svgToGeomInstances(elem, options, callback) {
16+
let that = this;
17+
super.svgToGeomInstances(elem, options, function (instances, sampleHeights) {
18+
const wallGeomInstances = that.generateWallGeometryInstances(elem, options);
19+
callback({ instances, wallGeomInstances });
20+
});
1921
}
2022

2123
/**
@@ -85,7 +87,7 @@ export default class RegularLineElementInstance extends SvgElementInstance {
8587
return instances;
8688
}
8789

88-
pathElemToGeomInstance(pathElem, options) {
90+
pathElemToGeomInstance(pathElem, options, sampleHeights) {
8991
const instances = [];
9092
const style=pathElem.getContextStyle()
9193
const fill =style.fillStyle;
@@ -102,10 +104,21 @@ export default class RegularLineElementInstance extends SvgElementInstance {
102104

103105
for (let i = 0; i < parts.length; i += 1) {
104106
const coords = parts[i];
105-
const geometry = this._generateStrokeGeometry(
106-
coords,
107-
isMainElement ? strokeWidthSize - 5 : strokeWidthSize
108-
);
107+
let heights, geometry;
108+
if(sampleHeights) {
109+
heights = sampleHeights[i];
110+
geometry = this._generateStrokeGeometry(
111+
coords,
112+
isMainElement ? strokeWidthSize - 5 : strokeWidthSize,
113+
heights
114+
);
115+
}else {
116+
geometry = this._generateStrokeGeometry(
117+
coords,
118+
isMainElement ? strokeWidthSize - 5 : strokeWidthSize
119+
);
120+
}
121+
109122
const instance = this._generateCesiumGeometryInstance(
110123
pathElem,
111124
geometry,
@@ -155,9 +168,14 @@ export default class RegularLineElementInstance extends SvgElementInstance {
155168
}
156169

157170
transfromGeoCesium(elem,cesGeom, options) {
171+
let {dimModHeight} = options;
172+
//这个地方控制抬起高度,贴地或贴模型时抬高高度为0
173+
if(typeof this._classificationType === 'number' && this._classificationType >= 0){
174+
dimModHeight = 0;
175+
}
158176
CesiumGeomUtil.degreesWithHeightToWorldCoords(
159177
cesGeom,
160-
options.dimModHeight
178+
dimModHeight
161179
);
162180
}
163181
}

src/service/3DPlot/Primitive/ElementInstance/RegularSurfaceElementInstance.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {CesiumUtil} from "../../Utils/CesiumUtil";
1111
import SvgElementInstance from "./SvgElementInstance";
1212

1313
export default class RegularSurfaceElementInstance extends SvgElementInstance {
14-
svgToGeomInstances(elem,options) {
14+
svgToGeomInstances(elem,options,callback) {
1515
const { surfaceBorderWidth }=options
1616
this.polylineOutInstance = null;
1717
this.polygonRect = new Bounds();
@@ -44,12 +44,12 @@ export default class RegularSurfaceElementInstance extends SvgElementInstance {
4444
});
4545

4646
const exportInstance = instances.flat();
47-
return {
47+
callback({
4848
instances: exportInstance,
4949
polylineOutInstance: this.polylineOutInstance,
5050
polygonRect:this.polygonRect,
5151
borderColor:this._borderColor
52-
};
52+
});
5353
}
5454

5555
pathElemToGeomInstance(elem) {

0 commit comments

Comments
 (0)