@openglobus/og 0.16.3 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/css/og.css +24 -2
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Clock.js +1 -5
- package/src/og/Events.js +0 -4
- package/src/og/Extent.js +5 -9
- package/src/og/Globe.js +92 -55
- package/src/og/ImageCanvas.js +12 -5
- package/src/og/Lock.js +44 -48
- package/src/og/LonLat.js +0 -4
- package/src/og/Object3d.js +1 -1
- package/src/og/Stack.js +49 -53
- package/src/og/astro/earth.js +112 -116
- package/src/og/astro/jd.js +514 -518
- package/src/og/astro/orbit.js +119 -123
- package/src/og/astro/rotation.js +36 -40
- package/src/og/bv/Box.js +77 -81
- package/src/og/bv/Sphere.js +57 -61
- package/src/og/camera/Camera.js +20 -7
- package/src/og/camera/PlanetCamera.js +8 -15
- package/src/og/control/Atmosphere.js +0 -4
- package/src/og/control/Control.js +9 -8
- package/src/og/control/DebugInfo.js +0 -4
- package/src/og/control/DrawingSwitcher.js +117 -0
- package/src/og/control/EarthCoordinates.js +214 -214
- package/src/og/control/GeoImageDragControl.js +0 -4
- package/src/og/control/KeyboardNavigation.js +0 -4
- package/src/og/control/LayerAnimation.js +0 -4
- package/src/og/control/LayerSwitcher.js +2 -4
- package/src/og/control/Lighting.js +11 -15
- package/src/og/control/MouseNavigation.js +0 -4
- package/src/og/control/MouseWheelZoomControl.js +0 -4
- package/src/og/control/RulerSwitcher.js +0 -4
- package/src/og/control/ScaleControl.js +2 -6
- package/src/og/control/ShowFps.js +40 -44
- package/src/og/control/SimpleNavigation.js +10 -10
- package/src/og/control/SimpleSkyBackground.js +0 -4
- package/src/og/control/Sun.js +0 -4
- package/src/og/control/ToggleWireframe.js +35 -39
- package/src/og/control/ZoomControl.js +0 -4
- package/src/og/control/drawing/DrawingControl.js +51 -0
- package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
- package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
- package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
- package/src/og/control/index.js +5 -1
- package/src/og/control/ruler/Ruler.js +0 -4
- package/src/og/control/ruler/RulerScene.js +3 -2
- package/src/og/control/selection/Selection.js +0 -4
- package/src/og/control/selection/SelectionScene.js +2 -4
- package/src/og/control/timeline/TimelineControl.js +4 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +1 -0
- package/src/og/control/visibleExtent/Segment.js +5 -5
- package/src/og/control/visibleExtent/drawnode.js +0 -4
- package/src/og/ellipsoid/Ellipsoid.js +205 -275
- package/src/og/ellipsoid/wgs84.js +0 -4
- package/src/og/entity/BaseBillboard.js +375 -379
- package/src/og/entity/Billboard.js +0 -4
- package/src/og/entity/BillboardHandler.js +0 -4
- package/src/og/entity/Entity.js +22 -22
- package/src/og/entity/EntityCollection.js +7 -11
- package/src/og/entity/GeoObject.js +0 -4
- package/src/og/entity/GeoObjectHandler.js +0 -4
- package/src/og/entity/Geometry.js +5 -4
- package/src/og/entity/GeometryHandler.js +3 -4
- package/src/og/entity/Label.js +0 -4
- package/src/og/entity/LabelHandler.js +0 -4
- package/src/og/entity/PointCloud.js +0 -4
- package/src/og/entity/PointCloudHandler.js +122 -126
- package/src/og/entity/Polyline.js +4 -6
- package/src/og/entity/PolylineHandler.js +104 -108
- package/src/og/entity/Ray.js +29 -29
- package/src/og/entity/Strip.js +1 -1
- package/src/og/index.js +3 -1
- package/src/og/input/KeyboardHandler.js +128 -132
- package/src/og/input/MouseHandler.js +94 -98
- package/src/og/input/TouchHandler.js +59 -63
- package/src/og/input/input.js +44 -48
- package/src/og/layer/BaseGeoImage.js +5 -8
- package/src/og/layer/CanvasTiles.js +0 -4
- package/src/og/layer/GeoImage.js +0 -4
- package/src/og/layer/GeoTexture2d.js +0 -4
- package/src/og/layer/GeoVideo.js +0 -4
- package/src/og/layer/KML.js +1 -0
- package/src/og/layer/Layer.js +22 -26
- package/src/og/layer/Material.js +0 -4
- package/src/og/layer/Vector.js +23 -20
- package/src/og/layer/WMS.js +182 -186
- package/src/og/layer/XYZ.js +0 -4
- package/src/og/light/LightSource.js +0 -4
- package/src/og/math/Line2.js +28 -32
- package/src/og/math/Mat3.js +152 -156
- package/src/og/math/Ray.js +0 -4
- package/src/og/math/Vec2.js +0 -4
- package/src/og/math/Vec3.js +0 -4
- package/src/og/math/Vec4.js +0 -4
- package/src/og/math/coder.js +104 -104
- package/src/og/math.js +39 -7
- package/src/og/proj/EPSG3857.js +13 -13
- package/src/og/proj/Proj.js +59 -63
- package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EntityCollectionNode.js +12 -16
- package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
- package/src/og/renderer/Renderer.js +109 -22
- package/src/og/renderer/RendererEvents.js +0 -4
- package/src/og/scene/Axes.js +74 -78
- package/src/og/scene/BaseNode.js +0 -4
- package/src/og/scene/Planet.js +114 -112
- package/src/og/scene/RenderNode.js +11 -3
- package/src/og/scene/SkyBox.js +104 -108
- package/src/og/segment/Segment.js +8 -4
- package/src/og/segment/SegmentLonLat.js +2 -6
- package/src/og/segment/segmentHelper.js +229 -225
- package/src/og/shaders/billboard.js +0 -4
- package/src/og/shaders/drawnode.js +5 -9
- package/src/og/shaders/geoObject.js +0 -4
- package/src/og/shaders/label.js +0 -4
- package/src/og/shaders/pickingMask.js +0 -4
- package/src/og/shaders/pointCloud.js +0 -4
- package/src/og/shaders/polyline.js +0 -4
- package/src/og/shaders/ray.js +0 -4
- package/src/og/shaders/skybox.js +0 -4
- package/src/og/terrain/EmptyTerrain.js +0 -4
- package/src/og/utils/FontAtlas.js +0 -4
- package/src/og/utils/GeoImageCreator.js +1 -2
- package/src/og/utils/NormalMapCreator.js +8 -9
- package/src/og/utils/VectorTileCreator.js +3 -9
- package/src/og/utils/shared.js +20 -1
- package/src/og/webgl/Framebuffer.js +0 -4
- package/src/og/webgl/Handler.js +45 -19
- package/src/og/webgl/Multisample.js +0 -4
- package/src/og/webgl/Program.js +0 -4
- package/src/og/webgl/ProgramController.js +2 -2
- package/types/Clock.d.ts +1 -1
- package/types/Extent.d.ts +5 -5
- package/types/Globe.d.ts +15 -1
- package/types/ImageCanvas.d.ts +5 -0
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +3 -3
- package/types/camera/Camera.d.ts +3 -2
- package/types/camera/PlanetCamera.d.ts +4 -4
- package/types/control/DrawingSwitcher.d.ts +13 -0
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Lighting.d.ts +8 -8
- package/types/control/drawing/DrawingControl.d.ts +14 -0
- package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
- package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
- package/types/control/index.d.ts +3 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/SelectionScene.d.ts +0 -1
- package/types/ellipsoid/Ellipsoid.d.ts +50 -63
- package/types/entity/Entity.d.ts +3 -2
- package/types/entity/Geometry.d.ts +5 -0
- package/types/entity/Polyline.d.ts +1 -1
- package/types/entity/Ray.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/layer/BaseGeoImage.d.ts +1 -1
- package/types/layer/CanvasTiles.d.ts +1 -1
- package/types/layer/Layer.d.ts +1 -1
- package/types/layer/Vector.d.ts +1 -0
- package/types/math.d.ts +7 -0
- package/types/renderer/Renderer.d.ts +7 -1
- package/types/scene/Axes.d.ts +0 -1
- package/types/scene/Planet.d.ts +26 -24
- package/types/scene/RenderNode.d.ts +2 -0
- package/types/scene/SkyBox.d.ts +0 -1
- package/types/segment/Segment.d.ts +3 -2
- package/types/segment/SegmentLonLat.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +1 -1
- package/types/utils/NormalMapCreator.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +2 -2
- package/types/utils/shared.d.ts +2 -0
- package/types/webgl/Handler.d.ts +6 -4
package/src/og/camera/Camera.js
CHANGED
|
@@ -49,7 +49,7 @@ class Camera {
|
|
|
49
49
|
* @public
|
|
50
50
|
* @type {Vec3}
|
|
51
51
|
*/
|
|
52
|
-
this.eye = new Vec3();
|
|
52
|
+
this.eye = options.eye || new Vec3();
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Camera RTE high position
|
|
@@ -70,7 +70,7 @@ class Camera {
|
|
|
70
70
|
* @protected
|
|
71
71
|
* @type {Number}
|
|
72
72
|
*/
|
|
73
|
-
this._aspect = options.aspect ||
|
|
73
|
+
this._aspect = options.aspect || 1.0;
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Camera view angle in degrees
|
|
@@ -143,7 +143,6 @@ class Camera {
|
|
|
143
143
|
|
|
144
144
|
fr._cameraFrustumIndex = this.frustums.length;
|
|
145
145
|
this.frustums.push(fr);
|
|
146
|
-
this.renderer.assignPickingColor(fr);
|
|
147
146
|
this.nearFarArr.push.apply(this.nearFarArr, [fi[0], fi[1]]);
|
|
148
147
|
this.frustumColors.push.apply(this.frustumColors, fr._pickingColorU);
|
|
149
148
|
}
|
|
@@ -160,7 +159,6 @@ class Camera {
|
|
|
160
159
|
|
|
161
160
|
fr._cameraFrustumIndex = this.frustums.length;
|
|
162
161
|
this.frustums.push(fr);
|
|
163
|
-
this.renderer.assignPickingColor(fr);
|
|
164
162
|
this.nearFarArr = new Array([near, far]);
|
|
165
163
|
this.frustumColors.push.apply(this.frustumColors, fr._pickingColorU);
|
|
166
164
|
}
|
|
@@ -171,7 +169,11 @@ class Camera {
|
|
|
171
169
|
|
|
172
170
|
this.isFirstPass = false;
|
|
173
171
|
|
|
174
|
-
|
|
172
|
+
this.set(
|
|
173
|
+
options.eye || new Vec3(0.0, 0.0, 1.0),
|
|
174
|
+
options.look || new Vec3(),
|
|
175
|
+
options.up || new Vec3(0.0, 1.0, 0.0)
|
|
176
|
+
);
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
checkMoveEnd() {
|
|
@@ -195,6 +197,16 @@ class Camera {
|
|
|
195
197
|
this._peye.copy(eye);
|
|
196
198
|
}
|
|
197
199
|
|
|
200
|
+
bindRenderer(renderer) {
|
|
201
|
+
this.renderer = renderer;
|
|
202
|
+
for (let i = 0; i < this.frustums.length; i++) {
|
|
203
|
+
this.renderer.assignPickingColor(this.frustums[i]);
|
|
204
|
+
}
|
|
205
|
+
this._aspect = this.renderer.handler.getClientAspect();
|
|
206
|
+
|
|
207
|
+
this._setProj(this._viewAngle, this._aspect);
|
|
208
|
+
}
|
|
209
|
+
|
|
198
210
|
/**
|
|
199
211
|
* Camera initialization.
|
|
200
212
|
* @public
|
|
@@ -208,6 +220,7 @@ class Camera {
|
|
|
208
220
|
* @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
|
|
209
221
|
*/
|
|
210
222
|
_init(options) {
|
|
223
|
+
|
|
211
224
|
this._setProj(this._viewAngle, this._aspect);
|
|
212
225
|
|
|
213
226
|
this.set(
|
|
@@ -478,9 +491,9 @@ class Camera {
|
|
|
478
491
|
}
|
|
479
492
|
|
|
480
493
|
/**
|
|
481
|
-
* Gets projected 3d point to the 2d screen
|
|
494
|
+
* Gets projected 3d point to the 2d screen coordinates
|
|
482
495
|
* @public
|
|
483
|
-
* @param {Vec3} v - Cartesian 3d
|
|
496
|
+
* @param {Vec3} v - Cartesian 3d coordinates
|
|
484
497
|
* @returns {Vec2} - Screen point coordinates
|
|
485
498
|
*/
|
|
486
499
|
project(v) {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/camera/PlanetCamera
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
"use strict";
|
|
6
2
|
|
|
7
3
|
import { Key } from "../Lock.js";
|
|
@@ -24,9 +20,9 @@ import { Ellipsoid } from "../ellipsoid/index.js";
|
|
|
24
20
|
* @param {Object} [options.name] - Camera name.
|
|
25
21
|
* @param {number} [options.viewAngle] - Camera angle of view.
|
|
26
22
|
* @param {number} [options.near] - Camera near plane distance. Default is 1.0
|
|
27
|
-
* @param {number} [options.far] - Camera far plane distance.
|
|
28
|
-
* @param {number} [options.minAltitude] - Minimal altitude for the camera.
|
|
29
|
-
* @param {number} [options.maxAltitude] - Maximal altitude for the camera.
|
|
23
|
+
* @param {number} [options.far] - Camera far plane distance. Default is og.math.MAX
|
|
24
|
+
* @param {number} [options.minAltitude] - Minimal altitude for the camera. Default is 5
|
|
25
|
+
* @param {number} [options.maxAltitude] - Maximal altitude for the camera. Default is 20000000
|
|
30
26
|
* @param {Vec3} [options.eye] - Camera eye position. Default (0,0,0)
|
|
31
27
|
* @param {Vec3} [options.look] - Camera look position. Default (0,0,0)
|
|
32
28
|
* @param {Vec3} [options.up] - Camera eye position. Default (0,1,0)
|
|
@@ -39,10 +35,7 @@ class PlanetCamera extends Camera {
|
|
|
39
35
|
constructor(planet, options) {
|
|
40
36
|
super(planet.renderer, {
|
|
41
37
|
frustums: [
|
|
42
|
-
[1, 100 + 0.
|
|
43
|
-
[100, 1000 + 0.075],
|
|
44
|
-
[1000, 1e6 + 10000],
|
|
45
|
-
[1e6, 1e9]
|
|
38
|
+
[[1, 100], [100, 1000 + 7.0], [1000 - 7.0, 1e6 + 17], [1e6 - 17, 1e9]]
|
|
46
39
|
], //[[1, 1e3 + 100], [1e3, 1e6 + 10000], [1e6, 1e9]]*/
|
|
47
40
|
...options
|
|
48
41
|
}
|
|
@@ -461,7 +454,7 @@ class PlanetCamera extends Camera {
|
|
|
461
454
|
}
|
|
462
455
|
|
|
463
456
|
/**
|
|
464
|
-
* Flies to the geo
|
|
457
|
+
* Flies to the geo coordinates.
|
|
465
458
|
* @public
|
|
466
459
|
* @param {LonLat} lonlat - Finish coordinates.
|
|
467
460
|
* @param {Vec3} [look] - Camera LOOK in the end of flying. Default - (0,0,0)
|
|
@@ -471,9 +464,9 @@ class PlanetCamera extends Camera {
|
|
|
471
464
|
* @param {cameraCallback} [startCallback] - Callback that calls befor the flying begins.
|
|
472
465
|
*/
|
|
473
466
|
flyLonLat(lonlat, look, up, ampl, completeCallback, startCallback) {
|
|
474
|
-
var
|
|
467
|
+
var _lonLat = new LonLat(lonlat.lon, lonlat.lat, lonlat.height || this._lonLat.height);
|
|
475
468
|
this.flyCartesian(
|
|
476
|
-
this.planet.ellipsoid.lonLatToCartesian(
|
|
469
|
+
this.planet.ellipsoid.lonLatToCartesian(_lonLat),
|
|
477
470
|
look,
|
|
478
471
|
up,
|
|
479
472
|
ampl,
|
|
@@ -626,7 +619,7 @@ class PlanetCamera extends Camera {
|
|
|
626
619
|
if (this._insideSegment && this._insideSegment.planet) {
|
|
627
620
|
this._terrainAltitude = this._insideSegment.getTerrainPoint(
|
|
628
621
|
this.eye,
|
|
629
|
-
this.
|
|
622
|
+
this._insideSegment.getInsideLonLat(this),
|
|
630
623
|
this._terrainPoint
|
|
631
624
|
);
|
|
632
625
|
if (this._terrainAltitude < this.minAltitude && this._checkTerrainCollision) {
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/control/Control
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
"use strict";
|
|
6
2
|
|
|
7
3
|
/**
|
|
@@ -121,10 +117,12 @@ class Control {
|
|
|
121
117
|
this.renderer = renderer;
|
|
122
118
|
renderer.controls[this.name] = this;
|
|
123
119
|
this.onadd && this.onadd();
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.
|
|
120
|
+
if (renderer.isInitialized()) {
|
|
121
|
+
this._initialized = true;
|
|
122
|
+
this.oninit && this.oninit();
|
|
123
|
+
if (this.autoActivate) {
|
|
124
|
+
this.activate();
|
|
125
|
+
}
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
128
|
}
|
|
@@ -134,6 +132,9 @@ class Control {
|
|
|
134
132
|
* @public
|
|
135
133
|
*/
|
|
136
134
|
remove() {
|
|
135
|
+
|
|
136
|
+
this.deactivate();
|
|
137
|
+
|
|
137
138
|
this.onremove && this.onremove();
|
|
138
139
|
|
|
139
140
|
let r = this.renderer,
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { ToggleButton } from "../ui/ToggleButton.js";
|
|
4
|
+
import { Control } from "./Control.js";
|
|
5
|
+
import { DrawingControl } from "./drawing/DrawingControl.js";
|
|
6
|
+
import { ButtonGroup } from "../ui/ButtonGroup.js";
|
|
7
|
+
|
|
8
|
+
const ICON_POLYGON_SVG = `<?xml version="1.0" encoding="utf-8"?>
|
|
9
|
+
<!-- Generator: Adobe Illustrator 24.1.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
10
|
+
<svg version="1.1" id="Layer_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
11
|
+
\t viewBox="0 0 1024 1024" style="enable-background:new 0 0 1024 1024;" xml:space="preserve">
|
|
12
|
+
<g>
|
|
13
|
+
\t<path d="M926.03,321.16c-16.02,0-31.11,3.94-44.48,10.79l-263.43-191.4c2.69-8.94,4.18-18.4,4.18-28.2
|
|
14
|
+
\t\tc0-54.02-43.95-97.97-97.97-97.97c-54.03,0-97.98,43.95-97.98,97.97c0,9.81,1.49,19.27,4.18,28.21L155.75,340.18
|
|
15
|
+
\t\tc-16.22-11.91-36.16-19.03-57.78-19.03C43.95,321.16,0,365.11,0,419.13c0,52.58,41.67,95.5,93.71,97.75l102.63,315.86
|
|
16
|
+
\t\tc-24.28,17.85-40.13,46.52-40.13,78.9c0,54.02,43.95,97.98,97.98,97.98c37.54,0,70.18-21.25,86.62-52.34h367.26
|
|
17
|
+
\t\tc16.44,31.08,49.08,52.34,86.63,52.34c54.03,0,97.98-43.95,97.98-97.98c0-32.46-15.94-61.21-40.33-79.05l104.11-320.4
|
|
18
|
+
\t\tc39.15-12.84,67.54-49.68,67.54-93.07C1024,365.11,980.05,321.16,926.03,321.16z M828.05,911.65c0,8.5-3.3,16.19-8.55,22.09
|
|
19
|
+
\t\tc-6.11,6.85-14.9,11.26-24.79,11.26c-13.65,0-25.37-8.26-30.52-20.02c-1.79-4.09-2.82-8.58-2.82-13.33
|
|
20
|
+
\t\tc0-18.39,14.95-33.35,33.34-33.35c2.93,0,5.72,0.5,8.43,1.21c13.27,3.49,23.21,14.91,24.59,28.9
|
|
21
|
+
\t\tC827.83,909.5,828.05,910.54,828.05,911.65z M790.48,813.89c-45.63,1.96-83.27,35.16-91.87,78.77H350.28
|
|
22
|
+
\t\tc-8.62-43.69-46.38-76.93-92.11-78.79L155.59,498.19c24.41-17.84,40.36-46.59,40.36-79.06c0-8.9-1.3-17.49-3.53-25.7L468.57,192.8
|
|
23
|
+
\t\tc15.84,11.01,35.05,17.52,55.76,17.52c20.71,0,39.92-6.5,55.76-17.52l256.56,186.4c-5.48,12.21-8.59,25.7-8.59,39.93
|
|
24
|
+
\t\tc0,41.02,25.36,76.17,61.21,90.75L790.48,813.89z M254.19,945c-10.11,0-19.07-4.62-25.19-11.75c-5.01-5.84-8.15-13.32-8.15-21.6
|
|
25
|
+
\t\tc0-0.91,0.2-1.76,0.27-2.66c1.14-14.18,11.08-25.8,24.43-29.41c2.78-0.75,5.64-1.28,8.65-1.28c18.38,0,33.33,14.96,33.33,33.35
|
|
26
|
+
\t\tc0,4.74-1.03,9.24-2.82,13.33C279.55,936.74,267.83,945,254.19,945z M64.88,421.49c-0.06-0.79-0.24-1.55-0.24-2.35
|
|
27
|
+
\t\tc0-16.41,11.93-30.01,27.55-32.76c1.89-0.33,3.8-0.58,5.78-0.58c11.94,0,22.35,6.36,28.24,15.81c3.18,5.11,5.11,11.09,5.11,17.53
|
|
28
|
+
\t\tc0,15.47-10.63,28.39-24.94,32.14c-2.7,0.71-5.48,1.2-8.4,1.2C80.4,452.47,66.11,438.76,64.88,421.49z M549.41,90.62
|
|
29
|
+
\t\tc5.07,5.85,8.25,13.39,8.25,21.72c0,7.32-2.44,14.03-6.45,19.54c-6.07,8.33-15.82,13.81-26.88,13.81
|
|
30
|
+
\t\tc-11.07,0-20.83-5.48-26.89-13.81c-4.01-5.51-6.45-12.22-6.45-19.54c0-8.33,3.17-15.86,8.24-21.71
|
|
31
|
+
\t\tc6.12-7.07,15.04-11.64,25.1-11.64C534.38,79,543.29,83.57,549.41,90.62z M959.36,419.13c0,11.94-6.36,22.35-15.82,28.24
|
|
32
|
+
\t\tc-5.1,3.18-11.07,5.1-17.52,5.1c-6.08,0-11.71-1.76-16.62-4.61c-9.71-5.64-16.33-15.94-16.64-27.89c-0.01-0.29-0.09-0.56-0.09-0.85
|
|
33
|
+
\t\tc0-11.75,6.14-22.05,15.36-28c5.2-3.35,11.35-5.35,17.99-5.35C944.41,385.78,959.36,400.75,959.36,419.13z"/>
|
|
34
|
+
</g>
|
|
35
|
+
</svg>`;
|
|
36
|
+
|
|
37
|
+
const ICON_LINESTRING_SVG = `<?xml version="1.0" encoding="utf-8"?><!-- License: MIT. Made by Esri: https://github.com/Esri/calcite-ui-icons -->
|
|
38
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21 6h.046l-5.25 9h-.944L10 9.455V7H7v2.926L1.862 18H0v3h3v-2.926L8.138 10h1.01L14 15.545V18h3v-3h-.046l5.25-9H24V3h-3zM8 8h1v1H8zM2 20H1v-1h1zm14-3h-1v-1h1zm7-13v1h-1V4z"/></svg>`;
|
|
39
|
+
|
|
40
|
+
const ICON_DEFAULT_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M4 0l16 12.279-6.951 1.17 4.325 8.817-3.596 1.734-4.35-8.879-5.428 4.702z"/></svg>`;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Activate drawing control
|
|
44
|
+
* @class
|
|
45
|
+
* @extends {Control}
|
|
46
|
+
* @param {Object} [options] - Control options.
|
|
47
|
+
*/
|
|
48
|
+
class DrawingSwitcher extends Control {
|
|
49
|
+
constructor(options = {}) {
|
|
50
|
+
super({
|
|
51
|
+
name: "DrawingSwitcher",
|
|
52
|
+
...options
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
this.drawingControl = new DrawingControl();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
oninit() {
|
|
59
|
+
this.planet.addControl(this.drawingControl);
|
|
60
|
+
this._createMenu();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
onactivate() {
|
|
64
|
+
this.drawingControl.activate();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ondeactivate() {
|
|
68
|
+
this.drawingControl.deactivate();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_createMenu() {
|
|
72
|
+
|
|
73
|
+
let defaultBtn = new ToggleButton({
|
|
74
|
+
classList: ["og-map-button", "og-drawing-default_button"],
|
|
75
|
+
icon: ICON_DEFAULT_SVG,
|
|
76
|
+
name: "default",
|
|
77
|
+
isActive: true
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
let polyBtn = new ToggleButton({
|
|
81
|
+
classList: ["og-map-button", "og-drawing-polygon_button"],
|
|
82
|
+
icon: ICON_POLYGON_SVG,
|
|
83
|
+
name: "polygon"
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
let lineBtn = new ToggleButton({
|
|
87
|
+
classList: ["og-map-button", "og-drawing-linestring_button"],
|
|
88
|
+
icon: ICON_LINESTRING_SVG,
|
|
89
|
+
name: "linestring"
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
let buttons = new ButtonGroup({
|
|
93
|
+
buttons: [
|
|
94
|
+
defaultBtn, polyBtn, lineBtn
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
buttons.on("change", (btn) => {
|
|
99
|
+
this.drawingControl.deactivate();
|
|
100
|
+
switch (btn.name) {
|
|
101
|
+
case "polygon":
|
|
102
|
+
this.drawingControl.activatePolygonDrawing();
|
|
103
|
+
break;
|
|
104
|
+
case "linestring":
|
|
105
|
+
this.drawingControl.activateLineStringDrawing();
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
defaultBtn.appendTo(this.renderer.div)
|
|
111
|
+
polyBtn.appendTo(this.renderer.div);
|
|
112
|
+
lineBtn.appendTo(this.renderer.div);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export { DrawingSwitcher };
|
|
117
|
+
|