Skip to content

Commit b6ad412

Browse files
committed
【杨琨】【颜色修改】
1 parent aa4291b commit b6ad412

File tree

2 files changed

+55
-46
lines changed

2 files changed

+55
-46
lines changed

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

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,65 @@
88
*/
99

1010
import DrawObject from "../../../service/PlotBase/Draw/DrawObject";
11-
import { PrimitiveFactory } from "../Primitive/PrimitiveFactory";
11+
import {PrimitiveFactory} from "../Primitive/PrimitiveFactory";
1212
import {CesiumUtil} from "../Utils/CesiumUtil";
1313

1414
export default class DrawPoint extends DrawObject {
15-
constructor(viewer, symbol, plotLayer) {
16-
super();
17-
this._viewer = viewer;
18-
this._symbol = symbol;
19-
this.m_coords = [];
20-
this._primitive = null;
21-
this._plotLayer = plotLayer;
22-
}
15+
constructor(viewer, symbol, plotLayer) {
16+
super();
17+
this._viewer = viewer;
18+
this._symbol = symbol;
19+
this.m_coords = [];
20+
this._primitive = null;
21+
this._plotLayer = plotLayer;
22+
}
2323

24-
addHooks() {
25-
const viewer = this._viewer;
26-
const symbol = this._symbol;
27-
const handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
28-
let that = this;
29-
handler.setInputAction((event) => {
30-
const worldPos = viewer.scene.globe.pick(
31-
viewer.camera.getPickRay(event.position),
32-
viewer.scene
33-
);
24+
addHooks() {
25+
const viewer = this._viewer;
26+
const symbol = this._symbol;
27+
const handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
28+
let that = this;
29+
handler.setInputAction((event) => {
30+
const worldPos = viewer.scene.globe.pick(
31+
viewer.camera.getPickRay(event.position),
32+
viewer.scene
33+
);
3434

35-
if (!worldPos) return;
35+
if (!worldPos) return;
3636

37-
symbol.getElement().then(function (res) {
38-
const {classificationType} = that._symbol;
39-
res.classificationType = classificationType;
40-
that._primitive = PrimitiveFactory.createInstance(symbol.type, {
41-
positions: that.m_coords,
42-
element: res
43-
});
37+
symbol.getElement().then(function (res) {
38+
const {classificationType} = that._symbol;
39+
res.classificationType = classificationType;
40+
const {style} = that._symbol;
41+
if(style){
42+
res.initNodeStyles(style);
43+
}
4444

45-
const lnglat = CesiumUtil.cartesian3ToDegrees(
46-
viewer.scene.globe.ellipsoid,
47-
worldPos
48-
);
49-
that.m_coords.push(lnglat);
50-
that._plotLayer._primitiveCollection.add(that._primitive);
45+
that._primitive = PrimitiveFactory.createInstance(symbol.type, {
46+
positions: that.m_coords,
47+
element: res
48+
});
5149

52-
that._primitive.positions = that.m_coords;
53-
that.disable();
54-
that.fireFinishEvent({ plotObj3D: that._primitive });
55-
});
56-
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
50+
const lnglat = CesiumUtil.cartesian3ToDegrees(
51+
viewer.scene.globe.ellipsoid,
52+
worldPos
53+
);
54+
that.m_coords.push(lnglat);
55+
that._plotLayer._primitiveCollection.add(that._primitive);
5756

58-
this._handler = handler;
59-
}
57+
that._primitive.positions = that.m_coords;
58+
that.disable();
59+
that.fireFinishEvent({plotObj3D: that._primitive});
60+
});
61+
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
6062

61-
removeHooks() {
62-
const handler = this._handler;
63-
// handler.removeInputAction();
64-
handler.destroy();
65-
this._handler = null;
66-
}
63+
this._handler = handler;
64+
}
65+
66+
removeHooks() {
67+
const handler = this._handler;
68+
// handler.removeInputAction();
69+
handler.destroy();
70+
this._handler = null;
71+
}
6772
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ export default class DrawPolyline extends DrawObject {
6161
if (!that._isAdded) {
6262
const {classificationType} = that._symbol;
6363
res.classificationType = classificationType;
64+
const {style} = that._symbol;
65+
if(style){
66+
res.initNodeStyles(style);
67+
}
6468
that._primitive = PrimitiveFactory.createInstance(symbol.type, {
6569
positions: that.m_coords,
6670
element: res,

0 commit comments

Comments
 (0)