| | |
| | | class DrawTool { |
| | | constructor() { |
| | | this._viewer = undefined |
| | | this._anchorLayer = undefined |
| | | this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('tool-three-draw-anchor-layer') |
| | | this._floatingAnchor = undefined |
| | | this._options = {} |
| | | this._plotEvent = new PlotEvent() |
| | |
| | | image: isCenter ? this._options.icon_center : this._options.icon_anchor, |
| | | width: this._options.icon_size[0], |
| | | height: this._options.icon_size[1], |
| | | eyeOffset: new global.DC.Namespace.Cesium.Cartesian3(0, 0, -4), |
| | | eyeOffset: new global.DC.Namespace.Cesium.Cartesian3(0, 0, 0), |
| | | heightReference: |
| | | this._viewer.scene.mode === global.DC.Namespace.Cesium.SceneMode.SCENE3D && |
| | | !this._options.clampToModel |
| | |
| | | * @returns {DrawTool} |
| | | */ |
| | | activate (options = {}) { |
| | | this._anchorLayer = new global.DC.Namespace.Cesium.CustomDataSource('draw-anchor-layer') |
| | | this._viewer.dataSources.add(this._anchorLayer) |
| | | |
| | | this._viewer.tooltip.enable = true |
| | | this._options = { ...DEF_OPTS, ...options } |
| | | this._unbindEvent() |
| | |
| | | this._viewer.tooltip.enable = false |
| | | this._anchorLayer.entities.removeAll() |
| | | this._floatingAnchor = undefined |
| | | this._viewer.dataSources.remove(this._anchorLayer) |
| | | return this |
| | | } |
| | | |
| | |
| | | */ |
| | | install (viewer) { |
| | | this._viewer = viewer |
| | | this._viewer.dataSources.add(this._anchorLayer) |
| | | Object.defineProperty(this._viewer, 'curDrawTool', { |
| | | value: this, |
| | | writable: true, |