@openglobus/og 0.16.2 → 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.
Files changed (181) hide show
  1. package/README.md +1 -1
  2. package/css/og.css +24 -2
  3. package/dist/@openglobus/og.css +1 -1
  4. package/dist/@openglobus/og.esm.js +2 -2
  5. package/dist/@openglobus/og.esm.js.map +1 -1
  6. package/dist/@openglobus/og.umd.js +2 -2
  7. package/dist/@openglobus/og.umd.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/og/Clock.js +1 -5
  10. package/src/og/Events.js +0 -4
  11. package/src/og/Extent.js +5 -9
  12. package/src/og/Globe.js +92 -55
  13. package/src/og/ImageCanvas.js +12 -5
  14. package/src/og/Lock.js +44 -48
  15. package/src/og/LonLat.js +0 -4
  16. package/src/og/Object3d.js +1 -1
  17. package/src/og/Stack.js +49 -53
  18. package/src/og/astro/earth.js +112 -116
  19. package/src/og/astro/jd.js +514 -518
  20. package/src/og/astro/orbit.js +119 -123
  21. package/src/og/astro/rotation.js +36 -40
  22. package/src/og/bv/Box.js +77 -81
  23. package/src/og/bv/Sphere.js +57 -61
  24. package/src/og/camera/Camera.js +20 -7
  25. package/src/og/camera/PlanetCamera.js +8 -15
  26. package/src/og/control/Atmosphere.js +0 -4
  27. package/src/og/control/Control.js +9 -8
  28. package/src/og/control/DebugInfo.js +0 -4
  29. package/src/og/control/DrawingSwitcher.js +117 -0
  30. package/src/og/control/EarthCoordinates.js +214 -214
  31. package/src/og/control/GeoImageDragControl.js +0 -4
  32. package/src/og/control/KeyboardNavigation.js +0 -4
  33. package/src/og/control/LayerAnimation.js +0 -4
  34. package/src/og/control/LayerSwitcher.js +2 -4
  35. package/src/og/control/Lighting.js +11 -15
  36. package/src/og/control/MouseNavigation.js +0 -4
  37. package/src/og/control/MouseWheelZoomControl.js +0 -4
  38. package/src/og/control/RulerSwitcher.js +0 -4
  39. package/src/og/control/ScaleControl.js +2 -6
  40. package/src/og/control/ShowFps.js +40 -44
  41. package/src/og/control/SimpleNavigation.js +10 -10
  42. package/src/og/control/SimpleSkyBackground.js +0 -4
  43. package/src/og/control/Sun.js +0 -4
  44. package/src/og/control/ToggleWireframe.js +35 -39
  45. package/src/og/control/ZoomControl.js +0 -4
  46. package/src/og/control/drawing/DrawingControl.js +51 -0
  47. package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
  48. package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
  49. package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
  50. package/src/og/control/index.js +5 -1
  51. package/src/og/control/ruler/Ruler.js +0 -4
  52. package/src/og/control/ruler/RulerScene.js +3 -2
  53. package/src/og/control/selection/Selection.js +0 -4
  54. package/src/og/control/selection/SelectionScene.js +2 -4
  55. package/src/og/control/timeline/TimelineControl.js +4 -4
  56. package/src/og/control/timeline/TimelineModel.js +2 -2
  57. package/src/og/control/timeline/TimelineView.js +1 -0
  58. package/src/og/control/visibleExtent/Segment.js +5 -5
  59. package/src/og/control/visibleExtent/drawnode.js +0 -4
  60. package/src/og/ellipsoid/Ellipsoid.js +205 -275
  61. package/src/og/ellipsoid/wgs84.js +0 -4
  62. package/src/og/entity/BaseBillboard.js +375 -379
  63. package/src/og/entity/Billboard.js +0 -4
  64. package/src/og/entity/BillboardHandler.js +0 -4
  65. package/src/og/entity/Entity.js +22 -22
  66. package/src/og/entity/EntityCollection.js +7 -11
  67. package/src/og/entity/GeoObject.js +0 -4
  68. package/src/og/entity/GeoObjectHandler.js +0 -4
  69. package/src/og/entity/Geometry.js +5 -4
  70. package/src/og/entity/GeometryHandler.js +3 -4
  71. package/src/og/entity/Label.js +0 -4
  72. package/src/og/entity/LabelHandler.js +0 -4
  73. package/src/og/entity/PointCloud.js +0 -4
  74. package/src/og/entity/PointCloudHandler.js +122 -126
  75. package/src/og/entity/Polyline.js +4 -6
  76. package/src/og/entity/PolylineHandler.js +104 -108
  77. package/src/og/entity/Ray.js +29 -29
  78. package/src/og/entity/Strip.js +1 -1
  79. package/src/og/index.js +3 -1
  80. package/src/og/input/KeyboardHandler.js +128 -132
  81. package/src/og/input/MouseHandler.js +94 -98
  82. package/src/og/input/TouchHandler.js +59 -63
  83. package/src/og/input/input.js +44 -48
  84. package/src/og/layer/BaseGeoImage.js +5 -8
  85. package/src/og/layer/CanvasTiles.js +0 -4
  86. package/src/og/layer/GeoImage.js +0 -4
  87. package/src/og/layer/GeoTexture2d.js +0 -4
  88. package/src/og/layer/GeoVideo.js +0 -4
  89. package/src/og/layer/KML.js +2 -3
  90. package/src/og/layer/Layer.js +22 -26
  91. package/src/og/layer/Material.js +0 -4
  92. package/src/og/layer/Vector.js +23 -20
  93. package/src/og/layer/WMS.js +182 -186
  94. package/src/og/layer/XYZ.js +0 -4
  95. package/src/og/light/LightSource.js +0 -4
  96. package/src/og/math/Line2.js +28 -32
  97. package/src/og/math/Mat3.js +152 -156
  98. package/src/og/math/Ray.js +0 -4
  99. package/src/og/math/Vec2.js +0 -4
  100. package/src/og/math/Vec3.js +0 -4
  101. package/src/og/math/Vec4.js +0 -4
  102. package/src/og/math/coder.js +104 -104
  103. package/src/og/math.js +39 -7
  104. package/src/og/proj/EPSG3857.js +13 -13
  105. package/src/og/proj/Proj.js +59 -63
  106. package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
  107. package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
  108. package/src/og/quadTree/EntityCollectionNode.js +12 -16
  109. package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
  110. package/src/og/quadTree/QuadTreeStrategy.js +1 -0
  111. package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
  112. package/src/og/renderer/Renderer.js +109 -22
  113. package/src/og/renderer/RendererEvents.js +0 -4
  114. package/src/og/scene/Axes.js +74 -78
  115. package/src/og/scene/BaseNode.js +0 -4
  116. package/src/og/scene/Planet.js +114 -112
  117. package/src/og/scene/RenderNode.js +11 -3
  118. package/src/og/scene/SkyBox.js +104 -108
  119. package/src/og/segment/Segment.js +8 -4
  120. package/src/og/segment/SegmentLonLat.js +2 -6
  121. package/src/og/segment/segmentHelper.js +229 -225
  122. package/src/og/shaders/billboard.js +0 -4
  123. package/src/og/shaders/drawnode.js +5 -9
  124. package/src/og/shaders/geoObject.js +0 -4
  125. package/src/og/shaders/label.js +0 -4
  126. package/src/og/shaders/pickingMask.js +0 -4
  127. package/src/og/shaders/pointCloud.js +0 -4
  128. package/src/og/shaders/polyline.js +0 -4
  129. package/src/og/shaders/ray.js +0 -4
  130. package/src/og/shaders/skybox.js +0 -4
  131. package/src/og/terrain/EmptyTerrain.js +0 -4
  132. package/src/og/utils/FontAtlas.js +0 -4
  133. package/src/og/utils/GeoImageCreator.js +1 -2
  134. package/src/og/utils/NormalMapCreator.js +8 -9
  135. package/src/og/utils/VectorTileCreator.js +3 -9
  136. package/src/og/utils/shared.js +20 -1
  137. package/src/og/webgl/Framebuffer.js +0 -4
  138. package/src/og/webgl/Handler.js +45 -19
  139. package/src/og/webgl/Multisample.js +0 -4
  140. package/src/og/webgl/Program.js +0 -4
  141. package/src/og/webgl/ProgramController.js +2 -2
  142. package/types/Clock.d.ts +1 -1
  143. package/types/Extent.d.ts +5 -5
  144. package/types/Globe.d.ts +15 -1
  145. package/types/ImageCanvas.d.ts +5 -0
  146. package/types/bv/Box.d.ts +1 -1
  147. package/types/bv/Sphere.d.ts +3 -3
  148. package/types/camera/Camera.d.ts +3 -2
  149. package/types/camera/PlanetCamera.d.ts +4 -4
  150. package/types/control/DrawingSwitcher.d.ts +13 -0
  151. package/types/control/EarthCoordinates.d.ts +1 -1
  152. package/types/control/Lighting.d.ts +8 -8
  153. package/types/control/drawing/DrawingControl.d.ts +14 -0
  154. package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
  155. package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
  156. package/types/control/index.d.ts +3 -1
  157. package/types/control/ruler/RulerScene.d.ts +0 -1
  158. package/types/control/selection/SelectionScene.d.ts +0 -1
  159. package/types/ellipsoid/Ellipsoid.d.ts +50 -63
  160. package/types/entity/Entity.d.ts +3 -2
  161. package/types/entity/Geometry.d.ts +5 -0
  162. package/types/entity/Polyline.d.ts +1 -1
  163. package/types/entity/Ray.d.ts +1 -0
  164. package/types/index.d.ts +1 -0
  165. package/types/layer/BaseGeoImage.d.ts +1 -1
  166. package/types/layer/CanvasTiles.d.ts +1 -1
  167. package/types/layer/Layer.d.ts +1 -1
  168. package/types/layer/Vector.d.ts +1 -0
  169. package/types/math.d.ts +7 -0
  170. package/types/renderer/Renderer.d.ts +7 -1
  171. package/types/scene/Axes.d.ts +0 -1
  172. package/types/scene/Planet.d.ts +26 -24
  173. package/types/scene/RenderNode.d.ts +2 -0
  174. package/types/scene/SkyBox.d.ts +0 -1
  175. package/types/segment/Segment.d.ts +3 -2
  176. package/types/segment/SegmentLonLat.d.ts +0 -1
  177. package/types/utils/GeoImageCreator.d.ts +1 -1
  178. package/types/utils/NormalMapCreator.d.ts +1 -1
  179. package/types/utils/VectorTileCreator.d.ts +2 -2
  180. package/types/utils/shared.d.ts +2 -0
  181. package/types/webgl/Handler.d.ts +6 -4
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/layer/Vector
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Entity } from "../entity/Entity.js";
@@ -198,6 +194,13 @@ class Vector extends Layer {
198
194
  return this;
199
195
  }
200
196
 
197
+ remove() {
198
+ super.remove();
199
+ this._polylineEntityCollection.remove();
200
+ this._stripEntityCollection.remove();
201
+ this._geoObjectEntityCollection.remove();
202
+ }
203
+
201
204
  /**
202
205
  * Returns stored entities.
203
206
  * @public
@@ -300,21 +303,21 @@ class Vector extends Layer {
300
303
  }
301
304
  }
302
305
 
303
- if (entity.billboard || entity.label) {
306
+ if (entity.billboard || entity.label || entity.geoObject) {
304
307
  if (this._planet) {
305
- if (entity._cartesian.isZero() && !entity._lonlat.isZero()) {
308
+ if (entity._cartesian.isZero() && !entity._lonLat.isZero()) {
306
309
  entity._setCartesian3vSilent(
307
- this._planet.ellipsoid.lonLatToCartesian(entity._lonlat)
310
+ this._planet.ellipsoid.lonLatToCartesian(entity._lonLat)
308
311
  );
309
312
  } else {
310
- entity._lonlat = this._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
313
+ entity._lonLat = this._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
311
314
  }
312
315
 
313
316
  // north tree
314
- if (entity._lonlat.lat > mercator.MAX_LAT) {
317
+ if (entity._lonLat.lat > mercator.MAX_LAT) {
315
318
  this._entityCollectionsTreeNorth.__setLonLat__(entity);
316
319
  this._entityCollectionsTreeNorth.insertEntity(entity, rightNow);
317
- } else if (entity._lonlat.lat < mercator.MIN_LAT) {
320
+ } else if (entity._lonLat.lat < mercator.MIN_LAT) {
318
321
  // south tree
319
322
  this._entityCollectionsTreeSouth.__setLonLat__(entity);
320
323
  this._entityCollectionsTreeSouth.insertEntity(entity, rightNow);
@@ -609,9 +612,9 @@ class Vector extends Layer {
609
612
  for (let i = 0, len = entitiesForTree.length; i < len; i++) {
610
613
  let entity = entitiesForTree[i];
611
614
  // north tree
612
- if (entity._lonlat.lat > mercator.MAX_LAT) {
615
+ if (entity._lonLat.lat > mercator.MAX_LAT) {
613
616
  this._entityCollectionsTreeNorth.__setLonLat__(entity);
614
- } else if (entity._lonlat.lat < mercator.MIN_LAT) {
617
+ } else if (entity._lonLat.lat < mercator.MIN_LAT) {
615
618
  // south tree
616
619
  this._entityCollectionsTreeSouth.__setLonLat__(entity);
617
620
  } else {
@@ -845,7 +848,7 @@ class Vector extends Layer {
845
848
  // Merc nodes
846
849
  this._secondPASS = [];
847
850
  this._entityCollectionsTree &&
848
- this._entityCollectionsTree.collectRenderCollectionsPASS1(p._visibleNodes, outArr);
851
+ this._entityCollectionsTree.collectRenderCollectionsPASS1(p._visibleNodes, outArr);
849
852
  var i = this._secondPASS.length;
850
853
  while (i--) {
851
854
  this._secondPASS[i].collectRenderCollectionsPASS2(
@@ -858,9 +861,9 @@ class Vector extends Layer {
858
861
  // North nodes
859
862
  this._secondPASS = [];
860
863
  this._entityCollectionsTreeNorth &&
861
- this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(
862
- p._visibleNodesNorth,
863
- outArr
864
+ this._entityCollectionsTreeNorth.collectRenderCollectionsPASS1(
865
+ p._visibleNodesNorth,
866
+ outArr
864
867
  );
865
868
  i = this._secondPASS.length;
866
869
  while (i--) {
@@ -874,10 +877,10 @@ class Vector extends Layer {
874
877
  // South nodes
875
878
  this._secondPASS = [];
876
879
  this._entityCollectionsTreeSouth &&
877
- this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(
878
- p._visibleNodesSouth,
879
- outArr
880
- );
880
+ this._entityCollectionsTreeSouth.collectRenderCollectionsPASS1(
881
+ p._visibleNodesSouth,
882
+ outArr
883
+ );
881
884
  i = this._secondPASS.length;
882
885
  while (i--) {
883
886
  this._secondPASS[i].collectRenderCollectionsPASS2(
@@ -1,186 +1,182 @@
1
- /**
2
- * @module og/layer/WMS
3
- */
4
-
5
- "use strict";
6
-
7
- import { Extent } from "../Extent.js";
8
- import { LonLat } from "../LonLat.js";
9
- import * as mercator from "../mercator.js";
10
- import { XYZ } from "./XYZ.js";
11
-
12
- /**
13
- * Used to display WMS services as tile layers on the globe.
14
- * @class
15
- * @extends {XYZ}
16
- * //TODO: WMS version, format, and custom srs cpecification.
17
- * @param {string} name - Layer name.
18
- * @param {Object} options - Options:
19
- * @param {number} [options.opacity=1.0] - Layer opacity.
20
- * @param {number} [options.minZoom=0] - Minimal visibility zoom level.
21
- * @param {number} [options.maxZoom=0] - Maximal visibility zoom level.
22
- * @param {string} [options.attribution] - Layer attribution that displayed in the attribution area on the screen.
23
- * @param {boolean} [options.isBaseLayer=false] - Base layer flag.
24
- * @param {boolean} [options.visibility=true] - Layer visibility.
25
- * @param {string} options.url - WMS url source.
26
- * @param {number} [options.width=256] - Tile width.
27
- * @param {number} [options.height=256] - Tile height.
28
- * @param {string} options.layers - WMS layers string.
29
- * @param {string} [options.version="1.1.1"] - WMS version.
30
- * @param {Object} extra - Extra parameters (by WMS rreference or by WMS service vendors) to pass to WMS service.
31
- * @example:
32
- * new og.layer.WMS("USA States", {
33
- * isBaseLayer: false,
34
- * url: "http://openglobus.org/geoserver/",
35
- * layers: "topp:states",
36
- * opacity: 0.5,
37
- * zIndex: 50,
38
- * attribution: 'USA states - geoserver WMS example',
39
- * version: "1.1.1",
40
- * visibility: false }, {
41
- * transparent: true,
42
- * sld: "style.sld"}
43
- * );
44
- *
45
- * @fires og.layer.XYZ#load
46
- * @fires og.layer.XYZ#loadend
47
- */
48
- class WMS extends XYZ {
49
-
50
-
51
- constructor(name, options, extra) {
52
- super(name, options);
53
-
54
- this._extra = new URLSearchParams(extra).toString();
55
-
56
-
57
- if (!options.extent) {
58
- this.setExtent(new Extent(new LonLat(-180.0, -90), new LonLat(180.0, 90)));
59
- }
60
-
61
- /**
62
- * WMS layers string.
63
- * @public
64
- * @type {string}
65
- */
66
- this.layers = options.layers;
67
-
68
- /**
69
- * WMS tile width.
70
- * @public
71
- * @type {number}
72
- */
73
- this.imageWidth = options.imageWidth || 256;
74
-
75
- /**
76
- * WMS tile height.
77
- * @public
78
- * @type {number}
79
- */
80
- this.imageHeight = options.imageHeight || 256;
81
-
82
- this._getBbox = WMS.get_bbox_v1_1_1;
83
-
84
- this.setVersion(options.version);
85
- }
86
-
87
- static createRequestUrl(
88
- url,
89
- layers,
90
- format = "image/png",
91
- version = "1.1.1",
92
- request = "GetMap",
93
- srs,
94
- bbox,
95
- width = 256,
96
- height = 256,
97
- extra
98
-
99
- ) {
100
- return `${url}/?LAYERS=${layers}&FORMAT=${format}&SERVICE=WMS&VERSION=${version}&REQUEST=${request}&SRS=${srs}&BBOX=${bbox}&WIDTH=${width}&HEIGHT=${height}` +
101
- (extra ? `&${extra}` : "");
102
- }
103
-
104
- static get_bbox_v1_1_1(extent) {
105
- return (
106
- extent.getWest() +
107
- "," +
108
- extent.getSouth() +
109
- "," +
110
- extent.getEast() +
111
- "," +
112
- extent.getNorth()
113
- );
114
- }
115
-
116
- static get_bbox_v1_3_0(extent) {
117
- return (
118
- extent.getSouth() +
119
- "," +
120
- extent.getWest() +
121
- "," +
122
- extent.getNorth() +
123
- "," +
124
- extent.getEast()
125
- );
126
- }
127
-
128
- _checkSegment(segment) {
129
- return true;
130
- }
131
-
132
- get instanceName() {
133
- return "WMS";
134
- }
135
-
136
- _createUrl(segment) {
137
- return WMS.createRequestUrl(
138
- this.url,
139
- this.layers,
140
- "image/png",
141
- this._version,
142
- "GetMap",
143
- segment._projection.code,
144
- this._getBbox(segment.getExtent()),
145
- this.imageWidth,
146
- this.imageHeight,
147
- this._extra
148
- );
149
- }
150
-
151
- setVersion(version) {
152
- if (version) {
153
- this._version = version;
154
- } else {
155
- this._version = "1.1.1";
156
- }
157
-
158
- if (this._version === "1.1.1") {
159
- this._getBbox = WMS.get_bbox_v1_1_1;
160
- } else if (version === "1.3.0") {
161
- this._getBbox = WMS.get_bbox_v1_3_0;
162
- }
163
- }
164
-
165
- _correctFullExtent() {
166
- var e = this._extent,
167
- em = this._extentMerc;
168
- var ENLARGE_MERCATOR_LON = mercator.POLE + 50000;
169
- var ENLARGE_MERCATOR_LAT = mercator.POLE + 50000;
170
- if (e.northEast.lat === 90.0) {
171
- em.northEast.lat = ENLARGE_MERCATOR_LAT;
172
- }
173
- if (e.northEast.lon === 180.0) {
174
- em.northEast.lon = ENLARGE_MERCATOR_LON;
175
- }
176
- if (e.southWest.lat === -90.0) {
177
- em.southWest.lat = -ENLARGE_MERCATOR_LAT;
178
- }
179
- if (e.southWest.lon === -180.0) {
180
- em.southWest.lon = -ENLARGE_MERCATOR_LON;
181
- }
182
- }
183
- }
184
-
185
- export { WMS };
186
-
1
+ "use strict";
2
+
3
+ import { Extent } from "../Extent.js";
4
+ import { LonLat } from "../LonLat.js";
5
+ import * as mercator from "../mercator.js";
6
+ import { XYZ } from "./XYZ.js";
7
+
8
+ /**
9
+ * Used to display WMS services as tile layers on the globe.
10
+ * @class
11
+ * @extends {XYZ}
12
+ * //TODO: WMS version, format, and custom srs cpecification.
13
+ * @param {string} name - Layer name.
14
+ * @param {Object} options - Options:
15
+ * @param {number} [options.opacity=1.0] - Layer opacity.
16
+ * @param {number} [options.minZoom=0] - Minimal visibility zoom level.
17
+ * @param {number} [options.maxZoom=0] - Maximal visibility zoom level.
18
+ * @param {string} [options.attribution] - Layer attribution that displayed in the attribution area on the screen.
19
+ * @param {boolean} [options.isBaseLayer=false] - Base layer flag.
20
+ * @param {boolean} [options.visibility=true] - Layer visibility.
21
+ * @param {string} options.url - WMS url source.
22
+ * @param {number} [options.width=256] - Tile width.
23
+ * @param {number} [options.height=256] - Tile height.
24
+ * @param {string} options.layers - WMS layers string.
25
+ * @param {string} [options.version="1.1.1"] - WMS version.
26
+ * @param {Object} extra - Extra parameters (by WMS rreference or by WMS service vendors) to pass to WMS service.
27
+ * @example:
28
+ * new og.layer.WMS("USA States", {
29
+ * isBaseLayer: false,
30
+ * url: "http://openglobus.org/geoserver/",
31
+ * layers: "topp:states",
32
+ * opacity: 0.5,
33
+ * zIndex: 50,
34
+ * attribution: 'USA states - geoserver WMS example',
35
+ * version: "1.1.1",
36
+ * visibility: false }, {
37
+ * transparent: true,
38
+ * sld: "style.sld"}
39
+ * );
40
+ *
41
+ * @fires og.layer.XYZ#load
42
+ * @fires og.layer.XYZ#loadend
43
+ */
44
+ class WMS extends XYZ {
45
+
46
+
47
+ constructor(name, options, extra) {
48
+ super(name, options);
49
+
50
+ this._extra = new URLSearchParams(extra).toString();
51
+
52
+
53
+ if (!options.extent) {
54
+ this.setExtent(new Extent(new LonLat(-180.0, -90), new LonLat(180.0, 90)));
55
+ }
56
+
57
+ /**
58
+ * WMS layers string.
59
+ * @public
60
+ * @type {string}
61
+ */
62
+ this.layers = options.layers;
63
+
64
+ /**
65
+ * WMS tile width.
66
+ * @public
67
+ * @type {number}
68
+ */
69
+ this.imageWidth = options.imageWidth || 256;
70
+
71
+ /**
72
+ * WMS tile height.
73
+ * @public
74
+ * @type {number}
75
+ */
76
+ this.imageHeight = options.imageHeight || 256;
77
+
78
+ this._getBbox = WMS.get_bbox_v1_1_1;
79
+
80
+ this.setVersion(options.version);
81
+ }
82
+
83
+ static createRequestUrl(
84
+ url,
85
+ layers,
86
+ format = "image/png",
87
+ version = "1.1.1",
88
+ request = "GetMap",
89
+ srs,
90
+ bbox,
91
+ width = 256,
92
+ height = 256,
93
+ extra
94
+
95
+ ) {
96
+ return `${url}/?LAYERS=${layers}&FORMAT=${format}&SERVICE=WMS&VERSION=${version}&REQUEST=${request}&SRS=${srs}&BBOX=${bbox}&WIDTH=${width}&HEIGHT=${height}` +
97
+ (extra ? `&${extra}` : "");
98
+ }
99
+
100
+ static get_bbox_v1_1_1(extent) {
101
+ return (
102
+ extent.getWest() +
103
+ "," +
104
+ extent.getSouth() +
105
+ "," +
106
+ extent.getEast() +
107
+ "," +
108
+ extent.getNorth()
109
+ );
110
+ }
111
+
112
+ static get_bbox_v1_3_0(extent) {
113
+ return (
114
+ extent.getSouth() +
115
+ "," +
116
+ extent.getWest() +
117
+ "," +
118
+ extent.getNorth() +
119
+ "," +
120
+ extent.getEast()
121
+ );
122
+ }
123
+
124
+ _checkSegment(segment) {
125
+ return true;
126
+ }
127
+
128
+ get instanceName() {
129
+ return "WMS";
130
+ }
131
+
132
+ _createUrl(segment) {
133
+ return WMS.createRequestUrl(
134
+ this.url,
135
+ this.layers,
136
+ "image/png",
137
+ this._version,
138
+ "GetMap",
139
+ segment._projection.code,
140
+ this._getBbox(segment.getExtent()),
141
+ this.imageWidth,
142
+ this.imageHeight,
143
+ this._extra
144
+ );
145
+ }
146
+
147
+ setVersion(version) {
148
+ if (version) {
149
+ this._version = version;
150
+ } else {
151
+ this._version = "1.1.1";
152
+ }
153
+
154
+ if (this._version === "1.1.1") {
155
+ this._getBbox = WMS.get_bbox_v1_1_1;
156
+ } else if (version === "1.3.0") {
157
+ this._getBbox = WMS.get_bbox_v1_3_0;
158
+ }
159
+ }
160
+
161
+ _correctFullExtent() {
162
+ var e = this._extent,
163
+ em = this._extentMerc;
164
+ var ENLARGE_MERCATOR_LON = mercator.POLE + 50000;
165
+ var ENLARGE_MERCATOR_LAT = mercator.POLE + 50000;
166
+ if (e.northEast.lat === 90.0) {
167
+ em.northEast.lat = ENLARGE_MERCATOR_LAT;
168
+ }
169
+ if (e.northEast.lon === 180.0) {
170
+ em.northEast.lon = ENLARGE_MERCATOR_LON;
171
+ }
172
+ if (e.southWest.lat === -90.0) {
173
+ em.southWest.lat = -ENLARGE_MERCATOR_LAT;
174
+ }
175
+ if (e.southWest.lon === -180.0) {
176
+ em.southWest.lon = -ENLARGE_MERCATOR_LON;
177
+ }
178
+ }
179
+ }
180
+
181
+ export { WMS };
182
+
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/layer/XYZ
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import * as mercator from "../mercator.js";
@@ -1,7 +1,3 @@
1
- /**
2
- * @module og/light/LightSource
3
- */
4
-
5
1
  "use strict";
6
2
 
7
3
  import { Vec3 } from "../math/Vec3.js";
@@ -1,32 +1,28 @@
1
- /**
2
- * @module og/math/Line2
3
- */
4
-
5
- 'use strict';
6
-
7
- import { Vec2 } from './Vec2.js';
8
-
9
- export class Line2 {
10
- constructor(a = 0, b = 0, c = 0) {
11
- this.a = a;
12
- this.b = b;
13
- this.c = c;
14
- }
15
-
16
- static get(p0, p1) {
17
- return new Line2(p1.y - p0.y, p0.x - p1.x, p1.x * p0.y - p0.x * p1.y);
18
- }
19
-
20
- static getParallel(l, p) {
21
- return new Line2(l.a, l.b, -l.a * p.x - l.b * p.y);
22
- }
23
-
24
- static getIntersection(L0, L1) {
25
- var x = (L1.b * L0.c - L0.b * L1.c) / (L0.b * L1.a - L1.b * L0.a);
26
- return new Vec2(x, -(L0.c + L0.a * x) / L0.b);
27
- }
28
-
29
- intersects(l) {
30
- return Line2.getIntersection(this, l);
31
- }
32
- }
1
+ 'use strict';
2
+
3
+ import { Vec2 } from './Vec2.js';
4
+
5
+ export class Line2 {
6
+ constructor(a = 0, b = 0, c = 0) {
7
+ this.a = a;
8
+ this.b = b;
9
+ this.c = c;
10
+ }
11
+
12
+ static get(p0, p1) {
13
+ return new Line2(p1.y - p0.y, p0.x - p1.x, p1.x * p0.y - p0.x * p1.y);
14
+ }
15
+
16
+ static getParallel(l, p) {
17
+ return new Line2(l.a, l.b, -l.a * p.x - l.b * p.y);
18
+ }
19
+
20
+ static getIntersection(L0, L1) {
21
+ var x = (L1.b * L0.c - L0.b * L1.c) / (L0.b * L1.a - L1.b * L0.a);
22
+ return new Vec2(x, -(L0.c + L0.a * x) / L0.b);
23
+ }
24
+
25
+ intersects(l) {
26
+ return Line2.getIntersection(this, l);
27
+ }
28
+ }