@vcmap/core 5.0.0-rc.28 → 5.0.0-rc.29

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 (191) hide show
  1. package/README.md +9 -3
  2. package/build/postinstall.js +13 -2
  3. package/index.d.ts +155 -106
  4. package/package.json +9 -4
  5. package/src/category/category.js +71 -32
  6. package/src/category/categoryCollection.js +27 -18
  7. package/src/cesium/cesiumVcsCameraPrimitive.js +13 -5
  8. package/src/cesium/entity.js +3 -1
  9. package/src/cesium/wallpaperMaterial.js +4 -2
  10. package/src/classRegistry.js +11 -4
  11. package/src/featureProvider/abstractFeatureProvider.js +43 -22
  12. package/src/featureProvider/tileProviderFeatureProvider.js +11 -5
  13. package/src/featureProvider/wmsFeatureProvider.js +37 -15
  14. package/src/interaction/abstractInteraction.js +5 -1
  15. package/src/interaction/coordinateAtPixel.js +34 -12
  16. package/src/interaction/eventHandler.js +63 -23
  17. package/src/interaction/featureAtPixelInteraction.js +96 -32
  18. package/src/interaction/featureProviderInteraction.js +23 -8
  19. package/src/interaction/interactionChain.js +19 -9
  20. package/src/interaction/interactionType.js +23 -26
  21. package/src/layer/cesium/cesiumTilesetCesiumImpl.js +45 -15
  22. package/src/layer/cesium/clusterContext.js +10 -3
  23. package/src/layer/cesium/dataSourceCesiumImpl.js +13 -4
  24. package/src/layer/cesium/openStreetMapCesiumImpl.js +7 -3
  25. package/src/layer/cesium/rasterLayerCesiumImpl.js +6 -2
  26. package/src/layer/cesium/singleImageCesiumImpl.js +14 -3
  27. package/src/layer/cesium/terrainCesiumImpl.js +3 -2
  28. package/src/layer/cesium/tmsCesiumImpl.js +15 -3
  29. package/src/layer/cesium/vectorCesiumImpl.js +69 -25
  30. package/src/layer/cesium/vectorContext.js +25 -5
  31. package/src/layer/cesium/vectorRasterTileCesiumImpl.js +15 -5
  32. package/src/layer/cesium/vectorTileImageryProvider.js +51 -13
  33. package/src/layer/cesium/wmsCesiumImpl.js +15 -3
  34. package/src/layer/cesium/wmtsCesiumImpl.js +18 -6
  35. package/src/layer/cesium/x3dmHelper.js +4 -1
  36. package/src/layer/cesiumTilesetLayer.js +55 -26
  37. package/src/layer/czmlLayer.js +11 -5
  38. package/src/layer/dataSourceLayer.js +25 -17
  39. package/src/layer/featureLayer.js +33 -18
  40. package/src/layer/featureStoreLayer.js +161 -99
  41. package/src/layer/featureStoreLayerChanges.js +57 -17
  42. package/src/layer/featureVisibility.js +89 -59
  43. package/src/layer/geojsonHelpers.js +70 -29
  44. package/src/layer/geojsonLayer.js +17 -11
  45. package/src/layer/globalHider.js +14 -4
  46. package/src/layer/layer.js +77 -44
  47. package/src/layer/layerImplementation.js +12 -4
  48. package/src/layer/oblique/layerObliqueImpl.js +3 -1
  49. package/src/layer/oblique/obliqueHelpers.js +75 -30
  50. package/src/layer/oblique/vectorObliqueImpl.js +175 -69
  51. package/src/layer/openStreetMapLayer.js +34 -20
  52. package/src/layer/openlayers/layerOpenlayersImpl.js +37 -15
  53. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +3 -1
  54. package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +3 -1
  55. package/src/layer/openlayers/singleImageOpenlayersImpl.js +3 -1
  56. package/src/layer/openlayers/tileDebugOpenlayersImpl.js +3 -1
  57. package/src/layer/openlayers/tmsOpenlayersImpl.js +6 -3
  58. package/src/layer/openlayers/vectorOpenlayersImpl.js +14 -4
  59. package/src/layer/openlayers/vectorTileOpenlayersImpl.js +12 -5
  60. package/src/layer/openlayers/wmsOpenlayersImpl.js +3 -1
  61. package/src/layer/openlayers/wmtsOpenlayersImpl.js +12 -5
  62. package/src/layer/pointCloudLayer.js +21 -10
  63. package/src/layer/rasterLayer.js +73 -22
  64. package/src/layer/singleImageLayer.js +10 -7
  65. package/src/layer/terrainHelpers.js +30 -19
  66. package/src/layer/terrainLayer.js +16 -7
  67. package/src/layer/tileLoadedHelper.js +9 -4
  68. package/src/layer/tileProvider/mvtTileProvider.js +10 -4
  69. package/src/layer/tileProvider/staticGeojsonTileProvider.js +10 -4
  70. package/src/layer/tileProvider/tileProvider.js +163 -87
  71. package/src/layer/tileProvider/urlTemplateTileProvider.js +10 -4
  72. package/src/layer/tmsLayer.js +7 -6
  73. package/src/layer/vectorHelpers.js +34 -25
  74. package/src/layer/vectorLayer.js +77 -36
  75. package/src/layer/vectorProperties.js +245 -74
  76. package/src/layer/vectorSymbols.js +3 -1
  77. package/src/layer/vectorTileLayer.js +121 -70
  78. package/src/layer/wfsLayer.js +19 -8
  79. package/src/layer/wmsHelpers.js +11 -6
  80. package/src/layer/wmsLayer.js +36 -14
  81. package/src/layer/wmtsLayer.js +35 -20
  82. package/src/map/baseOLMap.js +57 -31
  83. package/src/map/cameraLimiter.js +67 -18
  84. package/src/map/cesiumMap.js +307 -95
  85. package/src/map/obliqueMap.js +84 -34
  86. package/src/map/openlayersMap.js +40 -19
  87. package/src/map/vcsMap.js +21 -8
  88. package/src/oblique/helpers.js +212 -64
  89. package/src/oblique/obliqueCollection.js +111 -48
  90. package/src/oblique/obliqueDataSet.js +53 -21
  91. package/src/oblique/obliqueImage.js +50 -17
  92. package/src/oblique/obliqueImageMeta.js +7 -6
  93. package/src/oblique/obliqueProvider.js +75 -27
  94. package/src/oblique/obliqueView.js +18 -7
  95. package/src/oblique/obliqueViewDirection.js +3 -2
  96. package/src/oblique/parseImageJson.js +57 -23
  97. package/src/ol/feature.js +8 -3
  98. package/src/ol/geom/circle.js +12 -3
  99. package/src/ol/geom/geometryCollection.js +11 -4
  100. package/src/ol/render/canvas/canvasTileRenderer.js +11 -9
  101. package/src/overrideClassRegistry.js +13 -3
  102. package/src/style/arcStyle.js +129 -36
  103. package/src/style/arrowStyle.js +57 -22
  104. package/src/style/declarativeStyleItem.js +107 -62
  105. package/src/style/shapesCategory.js +8 -6
  106. package/src/style/styleFactory.js +4 -1
  107. package/src/style/styleHelpers.js +17 -8
  108. package/src/style/styleItem.js +28 -10
  109. package/src/style/vectorStyleItem.js +160 -74
  110. package/src/style/writeStyle.js +5 -7
  111. package/src/util/clipping/clippingObject.js +72 -38
  112. package/src/util/clipping/clippingObjectManager.js +53 -19
  113. package/src/util/clipping/clippingPlaneHelper.js +120 -53
  114. package/src/util/collection.js +12 -6
  115. package/src/util/editor/createFeatureSession.js +21 -6
  116. package/src/util/editor/editFeaturesSession.js +41 -15
  117. package/src/util/editor/editGeometrySession.js +55 -30
  118. package/src/util/editor/editorHelpers.js +114 -29
  119. package/src/util/editor/editorSessionHelpers.js +8 -3
  120. package/src/util/editor/interactions/createBBoxInteraction.js +11 -3
  121. package/src/util/editor/interactions/createCircleInteraction.js +7 -2
  122. package/src/util/editor/interactions/createLineStringInteraction.js +7 -2
  123. package/src/util/editor/interactions/createPolygonInteraction.js +7 -2
  124. package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +7 -5
  125. package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -3
  126. package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +4 -2
  127. package/src/util/editor/interactions/insertVertexInteraction.js +17 -6
  128. package/src/util/editor/interactions/mapInteractionController.js +31 -14
  129. package/src/util/editor/interactions/removeVertexInteraction.js +4 -1
  130. package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +19 -10
  131. package/src/util/editor/interactions/selectMultiFeatureInteraction.js +33 -20
  132. package/src/util/editor/interactions/selectSingleFeatureInteraction.js +14 -8
  133. package/src/util/editor/selectFeaturesSession.js +37 -21
  134. package/src/util/editor/transformation/create2DHandlers.js +82 -37
  135. package/src/util/editor/transformation/create3DHandlers.js +187 -84
  136. package/src/util/editor/transformation/extrudeInteraction.js +20 -5
  137. package/src/util/editor/transformation/rotateInteraction.js +29 -16
  138. package/src/util/editor/transformation/scaleInteraction.js +31 -15
  139. package/src/util/editor/transformation/transformationHandler.js +23 -8
  140. package/src/util/editor/transformation/transformationTypes.js +8 -4
  141. package/src/util/editor/transformation/translateInteraction.js +86 -32
  142. package/src/util/editor/validateGeoemetry.js +3 -1
  143. package/src/util/exclusiveManager.js +6 -3
  144. package/src/util/extent.js +20 -10
  145. package/src/util/featureconverter/arcToCesium.js +46 -12
  146. package/src/util/featureconverter/circleToCesium.js +61 -27
  147. package/src/util/featureconverter/convert.js +85 -13
  148. package/src/util/featureconverter/extent3D.js +69 -28
  149. package/src/util/featureconverter/featureconverterHelper.js +232 -79
  150. package/src/util/featureconverter/lineStringToCesium.js +107 -35
  151. package/src/util/featureconverter/pointHelpers.js +117 -45
  152. package/src/util/featureconverter/pointToCesium.js +128 -31
  153. package/src/util/featureconverter/polygonToCesium.js +50 -16
  154. package/src/util/fetch.js +3 -1
  155. package/src/util/geometryHelpers.js +15 -10
  156. package/src/util/indexedCollection.js +7 -3
  157. package/src/util/isMobile.js +8 -2
  158. package/src/util/layerCollection.js +28 -12
  159. package/src/util/mapCollection.js +37 -18
  160. package/src/util/math.js +35 -19
  161. package/src/util/overrideCollection.js +57 -32
  162. package/src/util/projection.js +21 -5
  163. package/src/util/urlHelpers.js +5 -3
  164. package/src/util/viewpoint.js +66 -33
  165. package/src/vcsApp.js +133 -69
  166. package/src/vcsModule.js +3 -2
  167. package/src/vcsModuleHelpers.js +24 -9
  168. package/src/vcsObject.js +3 -2
  169. package/tests/data/dynamicPointCzml.json +24 -35
  170. package/tests/data/oblique/imageData/imagev34.json +56 -272
  171. package/tests/data/oblique/imageData/imagev35.json +272 -19
  172. package/tests/data/oblique/imageData/imagev35PerImageSize.json +299 -19
  173. package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -1
  174. package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -1
  175. package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -1
  176. package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -1
  177. package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -1
  178. package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -1
  179. package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -1
  180. package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -1
  181. package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -1
  182. package/tests/data/oblique/tiledImageData/image.json +70 -1
  183. package/tests/data/terrain/layer.json +121 -130
  184. package/tests/data/testGeoJSON.json +4 -16
  185. package/tests/unit/helpers/cesiumHelpers.js +58 -33
  186. package/tests/unit/helpers/helpers.js +10 -2
  187. package/tests/unit/helpers/imageHelpers.js +8 -4
  188. package/tests/unit/helpers/obliqueData.js +39 -13
  189. package/tests/unit/helpers/obliqueHelpers.js +12 -9
  190. package/tests/unit/helpers/openlayersHelpers.js +4 -1
  191. package/tests/unit/helpers/terrain/terrainData.js +8 -7
@@ -1,6 +1,12 @@
1
1
  /* eslint no-underscore-dangle: ["error", { "allow": ["_listeners", "_scopes", "_toRemove"] }] */
2
2
  /* eslint-disable no-continue */
3
- import { boundingExtent, getBottomLeft, getBottomRight, getTopLeft, getTopRight } from 'ol/extent.js';
3
+ import {
4
+ boundingExtent,
5
+ getBottomLeft,
6
+ getBottomRight,
7
+ getTopLeft,
8
+ getTopRight,
9
+ } from 'ol/extent.js';
4
10
  import { transform } from 'ol/proj.js';
5
11
  import { Cartesian2 } from '@vcmap-cesium/engine';
6
12
  import { ObliqueViewDirection } from './obliqueViewDirection.js';
@@ -32,7 +38,10 @@ let scratchCartesian2B = new Cartesian2();
32
38
  * @param {(ObliqueViewDirection|boolean)=} [sortDirection=false]
33
39
  * @returns {Array<import("ol/coordinate").Coordinate>}
34
40
  */
35
- export function sortRealWordEdgeCoordinates(inputCornerPoints, sortDirection = false) {
41
+ export function sortRealWordEdgeCoordinates(
42
+ inputCornerPoints,
43
+ sortDirection = false,
44
+ ) {
36
45
  const cornerPoints = inputCornerPoints.slice();
37
46
  const extent = boundingExtent(cornerPoints);
38
47
  const extentPoints = [
@@ -70,8 +79,16 @@ export function sortRealWordEdgeCoordinates(inputCornerPoints, sortDirection = f
70
79
  * @returns {number|null}
71
80
  */
72
81
  function angleBetweenTwo2DVectors(v1, v2) {
73
- scratchCartesian2A = Cartesian2.fromElements(v1[0], v1[1], scratchCartesian2A);
74
- scratchCartesian2B = Cartesian2.fromElements(v2[0], v2[1], scratchCartesian2B);
82
+ scratchCartesian2A = Cartesian2.fromElements(
83
+ v1[0],
84
+ v1[1],
85
+ scratchCartesian2A,
86
+ );
87
+ scratchCartesian2B = Cartesian2.fromElements(
88
+ v2[0],
89
+ v2[1],
90
+ scratchCartesian2B,
91
+ );
75
92
  return Cartesian2.angleBetween(scratchCartesian2A, scratchCartesian2B);
76
93
  }
77
94
 
@@ -96,22 +113,24 @@ export function checkLineIntersection(segment1, segment2) {
96
113
  };
97
114
 
98
115
  const denominator =
99
- ((line2EndY - line2StartY) * (line1EndX - line1StartX)) -
100
- ((line2EndX - line2StartX) * (line1EndY - line1StartY));
116
+ (line2EndY - line2StartY) * (line1EndX - line1StartX) -
117
+ (line2EndX - line2StartX) * (line1EndY - line1StartY);
101
118
 
102
119
  if (denominator === 0) {
103
120
  return result;
104
121
  }
105
122
  a = line1StartY - line2StartY;
106
123
  b = line1StartX - line2StartX;
107
- const numerator1 = ((line2EndX - line2StartX) * a) - ((line2EndY - line2StartY) * b);
108
- const numerator2 = ((line1EndX - line1StartX) * a) - ((line1EndY - line1StartY) * b);
124
+ const numerator1 =
125
+ (line2EndX - line2StartX) * a - (line2EndY - line2StartY) * b;
126
+ const numerator2 =
127
+ (line1EndX - line1StartX) * a - (line1EndY - line1StartY) * b;
109
128
  a = numerator1 / denominator;
110
129
  b = numerator2 / denominator;
111
130
 
112
131
  // if we cast these lines infinitely in both directions, they intersect here:
113
- result.x = line1StartX + (a * (line1EndX - line1StartX));
114
- result.y = line1StartY + (a * (line1EndY - line1StartY));
132
+ result.x = line1StartX + a * (line1EndX - line1StartX);
133
+ result.y = line1StartY + a * (line1EndY - line1StartY);
115
134
  /*
116
135
  // it is worth noting that this should be the same as:
117
136
  x = line2StartX + (b * (line2EndX - line2StartX));
@@ -138,9 +157,21 @@ export function checkLineIntersection(segment1, segment2) {
138
157
  * @param {ObliqueViewDirection} viewDirection
139
158
  * @returns {{x: (number|null), y:(number|null), onLine1: boolean, onLine2: boolean}|null}
140
159
  */
141
- export function transformCWIFC(inputOrigin, inputTarget, originIsImage, coordinate2Transform, viewDirection) {
142
- const origin = sortRealWordEdgeCoordinates(inputOrigin, originIsImage ? false : viewDirection);
143
- const target = sortRealWordEdgeCoordinates(inputTarget, originIsImage ? viewDirection : false);
160
+ export function transformCWIFC(
161
+ inputOrigin,
162
+ inputTarget,
163
+ originIsImage,
164
+ coordinate2Transform,
165
+ viewDirection,
166
+ ) {
167
+ const origin = sortRealWordEdgeCoordinates(
168
+ inputOrigin,
169
+ originIsImage ? false : viewDirection,
170
+ );
171
+ const target = sortRealWordEdgeCoordinates(
172
+ inputTarget,
173
+ originIsImage ? viewDirection : false,
174
+ );
144
175
 
145
176
  // test intersections from all corner points over coordinate to all non neighbouring borders
146
177
  // and non side borders too - so actually remains only upper and lower border
@@ -152,58 +183,110 @@ export function transformCWIFC(inputOrigin, inputTarget, originIsImage, coordina
152
183
  // - distance ratio while negative means negative direction
153
184
  // to be able to recreate the situation in the target system
154
185
  const intersections = [];
155
- for (let cp = 0; cp < origin.length; ++cp) { // TODO write into a proper map and function
186
+ for (let cp = 0; cp < origin.length; ++cp) {
187
+ // TODO write into a proper map and function
156
188
  const intrCurrCP = [];
157
189
 
158
190
  for (let sp = 0; sp < origin.length; ++sp) {
159
191
  const ep = sp === origin.length - 1 ? 0 : sp + 1; // end point of edge
160
192
 
161
193
  // skip if cp is sp or ep - neighbouring edge
162
- if (cp === sp || cp === ep) { continue; }
194
+ if (cp === sp || cp === ep) {
195
+ continue;
196
+ }
163
197
 
164
198
  // skip also if sp is 3 and ep is 0 and also skip sp is 1 and ep is 2 since does only work over the upper and lower boundary
165
- if ((sp === 3 && ep === 0) || (sp === 1 && ep === 2)) { continue; }
199
+ if ((sp === 3 && ep === 0) || (sp === 1 && ep === 2)) {
200
+ continue;
201
+ }
166
202
 
167
203
  // get intersection from cp over coordinate2Transform to current border edge
168
- const currIntr = checkLineIntersection([origin[cp], coordinate2Transform], [origin[sp], origin[ep]]);
169
- if (currIntr.x == null || currIntr.y == null) { continue; }
204
+ const currIntr = checkLineIntersection(
205
+ [origin[cp], coordinate2Transform],
206
+ [origin[sp], origin[ep]],
207
+ );
208
+ if (currIntr.x == null || currIntr.y == null) {
209
+ continue;
210
+ }
170
211
 
171
212
  // get vector from current cp to coordinate2Transform to be able to determine if the intersection is in same direction
172
213
  // might be in different direction when point is outside - then we dont need this data
173
- const vectorCP2Coordinate = [coordinate2Transform[0] - origin[cp][0], coordinate2Transform[1] - origin[cp][1]];
174
- const vectorCP2Intr = [currIntr.x - origin[cp][0], currIntr.y - origin[cp][1]];
175
- const angleDirectionCheck = angleBetweenTwo2DVectors(vectorCP2Coordinate, vectorCP2Intr);
176
- if (angleDirectionCheck == null) { continue; }
214
+ const vectorCP2Coordinate = [
215
+ coordinate2Transform[0] - origin[cp][0],
216
+ coordinate2Transform[1] - origin[cp][1],
217
+ ];
218
+ const vectorCP2Intr = [
219
+ currIntr.x - origin[cp][0],
220
+ currIntr.y - origin[cp][1],
221
+ ];
222
+ const angleDirectionCheck = angleBetweenTwo2DVectors(
223
+ vectorCP2Coordinate,
224
+ vectorCP2Intr,
225
+ );
226
+ if (angleDirectionCheck == null) {
227
+ continue;
228
+ }
177
229
 
178
- if (angleDirectionCheck / (Math.PI * 180.0) > 5) { continue; }
230
+ if (angleDirectionCheck / (Math.PI * 180.0) > 5) {
231
+ continue;
232
+ }
179
233
 
180
- const sp2ep = [origin[sp][0] - origin[ep][0], origin[sp][1] - origin[ep][1]];
181
- const ep2sp = [origin[ep][0] - origin[sp][0], origin[ep][1] - origin[sp][1]];
234
+ const sp2ep = [
235
+ origin[sp][0] - origin[ep][0],
236
+ origin[sp][1] - origin[ep][1],
237
+ ];
238
+ const ep2sp = [
239
+ origin[ep][0] - origin[sp][0],
240
+ origin[ep][1] - origin[sp][1],
241
+ ];
182
242
  // regarding the angle find the smallest
183
- const angleStart2End = angleBetweenTwo2DVectors(vectorCP2Coordinate, sp2ep);
184
- if (angleStart2End == null) { continue; }
243
+ const angleStart2End = angleBetweenTwo2DVectors(
244
+ vectorCP2Coordinate,
245
+ sp2ep,
246
+ );
247
+ if (angleStart2End == null) {
248
+ continue;
249
+ }
185
250
 
186
- const angleEnd2Start = angleBetweenTwo2DVectors(vectorCP2Coordinate, ep2sp);
187
- if (angleEnd2Start == null) { continue; }
251
+ const angleEnd2Start = angleBetweenTwo2DVectors(
252
+ vectorCP2Coordinate,
253
+ ep2sp,
254
+ );
255
+ if (angleEnd2Start == null) {
256
+ continue;
257
+ }
188
258
 
189
259
  // regarding ratioStart2End get ratio and then direction
190
260
  const distStartEnd = cartesian2DDistance(origin[sp], origin[ep]);
191
- if (distStartEnd === 0) { continue; }
192
- const tempRatioStartEnd = cartesian2DDistance(origin[sp], [currIntr.x, currIntr.y]) / distStartEnd;
261
+ if (distStartEnd === 0) {
262
+ continue;
263
+ }
264
+ const tempRatioStartEnd =
265
+ cartesian2DDistance(origin[sp], [currIntr.x, currIntr.y]) /
266
+ distStartEnd;
193
267
  let angleEdge2Intr = 0;
194
268
  if (tempRatioStartEnd !== 0) {
195
- angleEdge2Intr = angleBetweenTwo2DVectors(ep2sp, [currIntr.x - origin[sp][0], currIntr.y - origin[sp][1]]);
196
- if (angleEdge2Intr == null) { continue; }
269
+ angleEdge2Intr = angleBetweenTwo2DVectors(ep2sp, [
270
+ currIntr.x - origin[sp][0],
271
+ currIntr.y - origin[sp][1],
272
+ ]);
273
+ if (angleEdge2Intr == null) {
274
+ continue;
275
+ }
197
276
  }
198
277
 
199
278
  intrCurrCP.push({
200
279
  cornerPoint: cp,
201
280
  intrX: currIntr.x,
202
281
  intrY: currIntr.y,
203
- angle: angleStart2End <= angleEnd2Start ? angleStart2End : angleEnd2Start,
282
+ angle:
283
+ angleStart2End <= angleEnd2Start ? angleStart2End : angleEnd2Start,
204
284
  edgeStart: sp,
205
285
  edgeEnd: ep,
206
- ratioStart2End: (angleEdge2Intr / Math.PI) * 180.0 > 5 ? tempRatioStartEnd * (-1) : tempRatioStartEnd,
286
+ ratioStart2End:
287
+ (angleEdge2Intr / Math.PI) * 180.0 > 5
288
+ ? tempRatioStartEnd * -1
289
+ : tempRatioStartEnd,
207
290
  });
208
291
  }
209
292
 
@@ -216,11 +299,15 @@ export function transformCWIFC(inputOrigin, inputTarget, originIsImage, coordina
216
299
  indLargestAngle = i;
217
300
  }
218
301
  }
219
- if (indLargestAngle !== -1) { intersections.push(intrCurrCP[indLargestAngle]); }
302
+ if (indLargestAngle !== -1) {
303
+ intersections.push(intrCurrCP[indLargestAngle]);
304
+ }
220
305
  }
221
306
 
222
307
  // if we don not have enough data to recreate the situation in target system stop
223
- if (intersections.length < 2) { return null; }
308
+ if (intersections.length < 2) {
309
+ return null;
310
+ }
224
311
 
225
312
  // make list with intersection combinations and sort after strength (add angles together)
226
313
  const intrCombis = []; // will contain [addedAngle, intersectionsIndex_i, intersectionsIndex_j]
@@ -235,7 +322,10 @@ export function transformCWIFC(inputOrigin, inputTarget, originIsImage, coordina
235
322
  .sort()
236
323
  .reverse()
237
324
  .find((intersection) => {
238
- const intersectionsSorted = [intersections[intersection[1]], intersections[intersection[2]]];
325
+ const intersectionsSorted = [
326
+ intersections[intersection[1]],
327
+ intersections[intersection[2]],
328
+ ];
239
329
 
240
330
  const targetEdgeEnd0 = target[intersectionsSorted[0].edgeEnd];
241
331
  const targetEdgeStart0 = target[intersectionsSorted[0].edgeStart];
@@ -246,17 +336,24 @@ export function transformCWIFC(inputOrigin, inputTarget, originIsImage, coordina
246
336
  ];
247
337
 
248
338
  const intrFor0InTarget = [
249
- targetEdgeStart0[0] + (targetEdgeVectorFor0[0] * intersectionsSorted[0].ratioStart2End),
250
- targetEdgeStart0[1] + (targetEdgeVectorFor0[1] * intersectionsSorted[0].ratioStart2End),
339
+ targetEdgeStart0[0] +
340
+ targetEdgeVectorFor0[0] * intersectionsSorted[0].ratioStart2End,
341
+ targetEdgeStart0[1] +
342
+ targetEdgeVectorFor0[1] * intersectionsSorted[0].ratioStart2End,
251
343
  ];
252
344
 
253
345
  const targetEdgeEnd1 = target[intersectionsSorted[1].edgeEnd];
254
346
  const targetEdgeStart1 = target[intersectionsSorted[1].edgeStart];
255
347
 
256
- const targetEdgeVectorFor1 = [targetEdgeEnd1[0] - targetEdgeStart1[0], targetEdgeEnd1[1] - targetEdgeStart1[1]];
348
+ const targetEdgeVectorFor1 = [
349
+ targetEdgeEnd1[0] - targetEdgeStart1[0],
350
+ targetEdgeEnd1[1] - targetEdgeStart1[1],
351
+ ];
257
352
  const intrFor1InTarget = [
258
- targetEdgeStart1[0] + (targetEdgeVectorFor1[0] * intersectionsSorted[1].ratioStart2End),
259
- targetEdgeStart1[1] + (targetEdgeVectorFor1[1] * intersectionsSorted[1].ratioStart2End),
353
+ targetEdgeStart1[0] +
354
+ targetEdgeVectorFor1[0] * intersectionsSorted[1].ratioStart2End,
355
+ targetEdgeStart1[1] +
356
+ targetEdgeVectorFor1[1] * intersectionsSorted[1].ratioStart2End,
260
357
  ];
261
358
 
262
359
  const vecCP0ToIntr0 = [
@@ -269,7 +366,9 @@ export function transformCWIFC(inputOrigin, inputTarget, originIsImage, coordina
269
366
  ];
270
367
 
271
368
  const angleCross = angleBetweenTwo2DVectors(vecCP0ToIntr0, vecCP1ToIntr1);
272
- if (angleCross == null) { return false; }
369
+ if (angleCross == null) {
370
+ return false;
371
+ }
273
372
  /* var thresholdInDegree = 3;
274
373
  if (angleCross/Math.PI*180.0 < thresholdInDegree || angleCross/Math.PI*180.0 > 180-thresholdInDegree)
275
374
  continue; */
@@ -308,12 +407,23 @@ export function transformCWIFC(inputOrigin, inputTarget, originIsImage, coordina
308
407
  */
309
408
  export function transformToImage(image, worldCoordinate, options = {}) {
310
409
  let gpInternalCoordinates;
311
- if (options.dataProjection && options.dataProjection === image.meta.projection) {
410
+ if (
411
+ options.dataProjection &&
412
+ options.dataProjection === image.meta.projection
413
+ ) {
312
414
  gpInternalCoordinates = worldCoordinate;
313
415
  } else {
314
- gpInternalCoordinates = options.dataProjection ?
315
- transform(worldCoordinate, options.dataProjection.proj, image.meta.projection.proj) :
316
- transform(worldCoordinate, mercatorProjection.proj, image.meta.projection.proj);
416
+ gpInternalCoordinates = options.dataProjection
417
+ ? transform(
418
+ worldCoordinate,
419
+ options.dataProjection.proj,
420
+ image.meta.projection.proj,
421
+ )
422
+ : transform(
423
+ worldCoordinate,
424
+ mercatorProjection.proj,
425
+ image.meta.projection.proj,
426
+ );
317
427
  }
318
428
 
319
429
  function useAverageHeight() {
@@ -322,19 +432,39 @@ export function transformToImage(image, worldCoordinate, options = {}) {
322
432
  }
323
433
 
324
434
  if (worldCoordinate[2]) {
325
- const coords = image.transformRealWorld2Image(gpInternalCoordinates, worldCoordinate[2]);
326
- return Promise.resolve({ coords, height: worldCoordinate[2], estimate: false });
435
+ const coords = image.transformRealWorld2Image(
436
+ gpInternalCoordinates,
437
+ worldCoordinate[2],
438
+ );
439
+ return Promise.resolve({
440
+ coords,
441
+ height: worldCoordinate[2],
442
+ estimate: false,
443
+ });
327
444
  }
328
445
 
329
446
  if (!options.dontUseTerrain && image.meta.terrainProvider) {
330
- return getHeightFromTerrainProvider(image.meta.terrainProvider, [gpInternalCoordinates], image.meta.projection)
447
+ return getHeightFromTerrainProvider(
448
+ image.meta.terrainProvider,
449
+ [gpInternalCoordinates],
450
+ image.meta.projection,
451
+ )
331
452
  .then(([gpWithHeight]) => {
332
453
  if (gpWithHeight[2]) {
333
- const imageCoordinates = image.transformRealWorld2Image(gpInternalCoordinates, gpWithHeight[2]);
334
- return { coords: imageCoordinates, height: gpInternalCoordinates[2], estimate: false };
454
+ const imageCoordinates = image.transformRealWorld2Image(
455
+ gpInternalCoordinates,
456
+ gpWithHeight[2],
457
+ );
458
+ return {
459
+ coords: imageCoordinates,
460
+ height: gpInternalCoordinates[2],
461
+ estimate: false,
462
+ };
335
463
  }
336
464
  // eslint-disable-next-line no-console
337
- console.warn('The configured terrain on the oblique layer could not be queried, position might be inaccurate');
465
+ console.warn(
466
+ 'The configured terrain on the oblique layer could not be queried, position might be inaccurate',
467
+ );
338
468
  return useAverageHeight();
339
469
  })
340
470
  .catch(() => useAverageHeight());
@@ -369,18 +499,24 @@ function pickTerrain(pickTerrainOptions) {
369
499
  height,
370
500
  } = pickTerrainOptions;
371
501
 
372
- return getHeightFromTerrainProvider(image.meta.terrainProvider, [worldCoordinate])
502
+ return getHeightFromTerrainProvider(image.meta.terrainProvider, [
503
+ worldCoordinate,
504
+ ])
373
505
  .then(([worldCoordinateWithHeights]) => {
374
506
  if (worldCoordinateWithHeights[2] != null) {
375
507
  const newWorldCoords = transform(
376
- image.transformImage2RealWorld(imageCoordinate, worldCoordinateWithHeights[2]),
508
+ image.transformImage2RealWorld(
509
+ imageCoordinate,
510
+ worldCoordinateWithHeights[2],
511
+ ),
377
512
  image.meta.projection.proj,
378
513
  wgs84Projection.proj,
379
514
  );
380
515
  newWorldCoords[2] = worldCoordinateWithHeights[2];
381
516
  if (
382
- Math.abs(height - worldCoordinateWithHeights[2]) < terrainErrorThreshold ||
383
- (count > terrainErrorCountThreshold)
517
+ Math.abs(height - worldCoordinateWithHeights[2]) <
518
+ terrainErrorThreshold ||
519
+ count > terrainErrorCountThreshold
384
520
  ) {
385
521
  return { coords: newWorldCoords, estimate: false };
386
522
  }
@@ -389,7 +525,9 @@ function pickTerrain(pickTerrainOptions) {
389
525
  return pickTerrain(pickTerrainOptions);
390
526
  }
391
527
  // eslint-disable-next-line no-console
392
- console.log('The configured terrain on the oblique layer could not be queried, position might be inaccurate');
528
+ console.log(
529
+ 'The configured terrain on the oblique layer could not be queried, position might be inaccurate',
530
+ );
393
531
  return { coords: worldCoordinateWithHeights, estimate: true };
394
532
  })
395
533
  .catch(() => ({ coords: worldCoordinate, estimate: true }));
@@ -426,9 +564,17 @@ export async function transformFromImage(image, imageCoordinate, options = {}) {
426
564
  });
427
565
  }
428
566
 
429
- coordsObj.coords = options.dataProjection ?
430
- transform(coordsObj.coords, wgs84Projection.proj, options.dataProjection.proj) :
431
- transform(coordsObj.coords, wgs84Projection.proj, mercatorProjection.proj);
567
+ coordsObj.coords = options.dataProjection
568
+ ? transform(
569
+ coordsObj.coords,
570
+ wgs84Projection.proj,
571
+ options.dataProjection.proj,
572
+ )
573
+ : transform(
574
+ coordsObj.coords,
575
+ wgs84Projection.proj,
576
+ mercatorProjection.proj,
577
+ );
432
578
  return coordsObj;
433
579
  }
434
580
 
@@ -444,7 +590,9 @@ export function hasSameOrigin(url) {
444
590
  return true;
445
591
  }
446
592
 
447
- return windowUrl.origin === parsedUrl.origin &&
593
+ return (
594
+ windowUrl.origin === parsedUrl.origin &&
448
595
  windowUrl.port === parsedUrl.port &&
449
- windowUrl.protocol === parsedUrl.protocol;
596
+ windowUrl.protocol === parsedUrl.protocol
597
+ );
450
598
  }