@mapsight/lib-ol 4.0.2 → 4.1.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 (61) hide show
  1. package/README.md +20 -13
  2. package/dist/feature/getGeoJsonFeatureSortAnchor.d.ts +21 -0
  3. package/dist/feature/getGeoJsonFeatureSortAnchor.d.ts.map +1 -0
  4. package/dist/feature/getGeoJsonFeatureSortAnchor.js +76 -0
  5. package/dist/feature/getGeoJsonFeatureSortAnchor.js.map +1 -0
  6. package/dist/style/createCachedStyleFunction.d.ts +3 -1
  7. package/dist/style/createCachedStyleFunction.d.ts.map +1 -1
  8. package/dist/style/createCachedStyleFunction.js +32 -17
  9. package/dist/style/createCachedStyleFunction.js.map +1 -1
  10. package/dist/style/styleFeatureScope.d.ts +10 -0
  11. package/dist/style/styleFeatureScope.d.ts.map +1 -0
  12. package/dist/style/styleFeatureScope.js +16 -0
  13. package/dist/style/styleFeatureScope.js.map +1 -0
  14. package/package.json +5 -2
  15. package/src/js/coordinate/add.ts +0 -13
  16. package/src/js/coordinate/addPixelPadding.ts +0 -21
  17. package/src/js/coordinate/fromPixel.ts +0 -10
  18. package/src/js/coordinate/scale.ts +0 -7
  19. package/src/js/coordinate/toPixel.ts +0 -13
  20. package/src/js/coordinates/equals.ts +0 -6
  21. package/src/js/coordinates/middleCoordinate.ts +0 -7
  22. package/src/js/events/condition/clickOnFeature.ts +0 -13
  23. package/src/js/extent/getCentroid.ts +0 -14
  24. package/src/js/extent/isFiniteExtent.ts +0 -7
  25. package/src/js/extents/combineExtents.ts +0 -11
  26. package/src/js/feature/animator.ts +0 -91
  27. package/src/js/feature/cluster.ts +0 -86
  28. package/src/js/feature/detectFeatureHits.ts +0 -57
  29. package/src/js/feature/ensureId.ts +0 -9
  30. package/src/js/feature/getCentroid.ts +0 -18
  31. package/src/js/feature/getExtent.ts +0 -10
  32. package/src/js/feature/getLayer.ts +0 -39
  33. package/src/js/feature/getUid.ts +0 -6
  34. package/src/js/features/getCentroidForFeatures.ts +0 -10
  35. package/src/js/features/getExtentForFeatures.ts +0 -10
  36. package/src/js/geometry/deriveGeometriesFromBase.ts +0 -122
  37. package/src/js/geometry/getDominantGeometryType.ts +0 -40
  38. package/src/js/geometry/getLineStringSegmentVerticesWithRotation.ts +0 -48
  39. package/src/js/geometry/getPolygonRingSegmentVerticesWithRotation.ts +0 -90
  40. package/src/js/index.ts +0 -62
  41. package/src/js/map/animateDuringTransition.ts +0 -58
  42. package/src/js/map/canvasSizeFixer.ts +0 -46
  43. package/src/js/map/containsExtentWithPadding.ts +0 -17
  44. package/src/js/map/fitToExtent.ts +0 -45
  45. package/src/js/map/fitToFeature.ts +0 -29
  46. package/src/js/map/fitToFeatures.ts +0 -21
  47. package/src/js/map/getPaddedViewExtent.ts +0 -42
  48. package/src/js/map/getVisibleLayersFromFramestate.ts +0 -14
  49. package/src/js/map/updateSizeDuringTransition.ts +0 -9
  50. package/src/js/map/updateSizeOnTransitionEnd.ts +0 -28
  51. package/src/js/points/findClosestPoint.ts +0 -51
  52. package/src/js/points/spreadPointClusterInRadius.ts +0 -84
  53. package/src/js/style/bindStyleToGeometry.ts +0 -11
  54. package/src/js/style/createCachedStyleFunction.ts +0 -344
  55. package/src/js/style/declarationToGeometry.ts +0 -7
  56. package/src/js/style/declarationToStyle.ts +0 -277
  57. package/src/js/style/styleFunction.ts +0 -42
  58. package/src/js/tileGrid/getTileUrlsForExtent.ts +0 -41
  59. package/src/js/view/centerOnFeature.ts +0 -23
  60. package/src/js/view/centerOnFeatures.ts +0 -30
  61. package/src/js/view/getMinZoomFittingContentInView.ts +0 -50
@@ -1,23 +0,0 @@
1
- import type Feature from "ol/Feature";
2
- import type View from "ol/View";
3
- import * as olExtent from "ol/extent";
4
-
5
- export type CenterOnFeatureOptions = {
6
- duration?: number;
7
- };
8
-
9
- export const DEFAULT_OPTIONS = {
10
- duration: 300, // TODO: MAGIC NUMBER!
11
- };
12
-
13
- export default function centerOnFeature(
14
- view: View,
15
- feature: Feature,
16
- options: CenterOnFeatureOptions = DEFAULT_OPTIONS,
17
- ) {
18
- const featureExtent = feature.getGeometry()?.getExtent();
19
- if (featureExtent) {
20
- const center = olExtent.getCenter(featureExtent);
21
- view.animate({center: center, ...options});
22
- }
23
- }
@@ -1,30 +0,0 @@
1
- import type Feature from "ol/Feature";
2
- import type View from "ol/View";
3
- import * as olExtent from "ol/extent";
4
-
5
- import type {CenterOnFeatureOptions} from "./centerOnFeature";
6
- import {DEFAULT_OPTIONS as SINGLE_FEATURE_DEFAULT_OPTIONS} from "./centerOnFeature";
7
-
8
- export const DEFAULT_OPTIONS = {...SINGLE_FEATURE_DEFAULT_OPTIONS};
9
-
10
- export default function centerOnFeatures(
11
- view: View,
12
- features: Array<Feature>,
13
- options: CenterOnFeatureOptions = DEFAULT_OPTIONS,
14
- ) {
15
- if (!features || !features.length) {
16
- return;
17
- }
18
-
19
- // combine extents
20
- const featuresExtent = olExtent.createEmpty();
21
- features.forEach((feature) => {
22
- const extent = feature.getGeometry()?.getExtent();
23
- if (extent) {
24
- olExtent.extend(featuresExtent, extent);
25
- }
26
- });
27
-
28
- const center = olExtent.getCenter(featuresExtent);
29
- view.animate({center: center, ...options});
30
- }
@@ -1,50 +0,0 @@
1
- import {getHeight, getWidth} from "ol/extent";
2
- import {get as projGet} from "ol/proj";
3
-
4
- function getBaseLog(x: number, base: number) {
5
- return Math.log(x) / Math.log(base);
6
- }
7
-
8
- /**
9
- * @param contentExtentWidth contentExtentWidth
10
- * @param contentExtentHeight contentExtentHeight
11
- * @param viewWidth viewWidth
12
- * @param viewHeight viewHeight
13
- * @param options options
14
- * @returns zoom
15
- */
16
- export default function getMinZoomFittingContentInView(
17
- contentExtentWidth: number,
18
- contentExtentHeight: number,
19
- viewWidth: number,
20
- viewHeight: number,
21
- {
22
- zoomFactor = 2,
23
- projectionCode = "EPSG:3857",
24
- tileSize = 256,
25
- minZoom = 0,
26
- } = {},
27
- ) {
28
- const maxResolutionX = contentExtentWidth / viewWidth;
29
- const maxResolutionY = contentExtentHeight / viewHeight;
30
- const maxResolution = Math.max(maxResolutionX, maxResolutionY);
31
-
32
- const projection = projGet(projectionCode);
33
- if (!projection) {
34
- throw Error("projection missing");
35
- }
36
-
37
- const projectionExtent = projection.getExtent();
38
- const projectionExtentSizeMax = Math.max(
39
- getWidth(projectionExtent),
40
- getHeight(projectionExtent),
41
- );
42
-
43
- return getBaseLog(
44
- projectionExtentSizeMax /
45
- tileSize /
46
- Math.pow(zoomFactor, minZoom) /
47
- maxResolution,
48
- zoomFactor,
49
- );
50
- }