@dartcom/ui-kit 10.5.19 → 10.5.21
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/dist/index.cjs +8 -6
- package/dist/services/map/geo-json/geo-json.types.d.ts +23 -0
- package/dist/services/map/geo-json/geo-json.types.d.ts.map +1 -0
- package/dist/services/map/geo-json/index.d.ts +2 -0
- package/dist/services/map/geo-json/index.d.ts.map +1 -0
- package/dist/services/map/index.d.ts +1 -1
- package/dist/services/map/index.d.ts.map +1 -1
- package/dist/services/map/map.service.d.ts +3 -1
- package/dist/services/map/map.service.d.ts.map +1 -1
- package/dist/services/map/map.service.esm.js +1 -1
- package/dist/services/map/map.types.d.ts +1 -23
- package/dist/services/map/map.types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23881,15 +23881,17 @@ class MapService {
|
|
|
23881
23881
|
switch (geom.type) {
|
|
23882
23882
|
case 'Point':
|
|
23883
23883
|
return this.positionToCoordinate(geom.coordinates);
|
|
23884
|
-
case 'LineString':
|
|
23884
|
+
case 'LineString': {
|
|
23885
23885
|
return geom.coordinates.map((p) => this.positionToCoordinate(p));
|
|
23886
|
-
|
|
23886
|
+
}
|
|
23887
|
+
case 'MultiLineString': {
|
|
23888
|
+
return geom.coordinates.map((ring) => ring.map((p) => this.positionToCoordinate(p)));
|
|
23889
|
+
}
|
|
23890
|
+
case 'Polygon': {
|
|
23887
23891
|
return geom.coordinates.map((ring) => ring.map((p) => this.positionToCoordinate(p)));
|
|
23888
|
-
|
|
23892
|
+
}
|
|
23893
|
+
case 'MultiPolygon': {
|
|
23889
23894
|
return geom.coordinates.map((polygon) => polygon.map((ring) => ring.map((p) => this.positionToCoordinate(p))));
|
|
23890
|
-
default: {
|
|
23891
|
-
const _exhaustiveCheck = geom;
|
|
23892
|
-
throw new Error(`extractCoordinatesFromGeom: unsupported geometry type "${_exhaustiveCheck.type}"`);
|
|
23893
23895
|
}
|
|
23894
23896
|
}
|
|
23895
23897
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GeoJsonPosition } from '../../../lib';
|
|
2
|
+
export interface GeoJsonPoint {
|
|
3
|
+
readonly type: 'Point';
|
|
4
|
+
coordinates: GeoJsonPosition;
|
|
5
|
+
}
|
|
6
|
+
export interface GeoJsonLineString {
|
|
7
|
+
readonly type: 'LineString';
|
|
8
|
+
coordinates: GeoJsonPosition[];
|
|
9
|
+
}
|
|
10
|
+
export interface GeoJsonMultiLineString {
|
|
11
|
+
readonly type: 'MultiLineString';
|
|
12
|
+
coordinates: GeoJsonPosition[][];
|
|
13
|
+
}
|
|
14
|
+
export interface GeoJsonPolygon {
|
|
15
|
+
readonly type: 'Polygon';
|
|
16
|
+
coordinates: GeoJsonPosition[][];
|
|
17
|
+
}
|
|
18
|
+
export interface GeoJsonMultiPolygon {
|
|
19
|
+
readonly type: 'MultiPolygon';
|
|
20
|
+
coordinates: GeoJsonPosition[][][];
|
|
21
|
+
}
|
|
22
|
+
export type GeoJsonGeometry = GeoJsonPoint | GeoJsonLineString | GeoJsonPolygon | GeoJsonMultiPolygon | GeoJsonMultiLineString;
|
|
23
|
+
//# sourceMappingURL=geo-json.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geo-json.types.d.ts","sourceRoot":"","sources":["../../../../src/services/map/geo-json/geo-json.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,eAAe,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,WAAW,EAAE,eAAe,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,WAAW,EAAE,eAAe,EAAE,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,WAAW,EAAE,eAAe,EAAE,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,WAAW,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC;CACpC;AAED,MAAM,MAAM,eAAe,GACvB,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,mBAAmB,GACnB,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/map/geo-json/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/map/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/map/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Coordinate } from '../../lib';
|
|
2
|
-
import {
|
|
2
|
+
import { GeoJsonLineString, GeoJsonMultiLineString, GeoJsonMultiPolygon, GeoJsonPoint, GeoJsonPolygon } from './geo-json';
|
|
3
|
+
import { CoordinateCompareFn, DistanceUnit, SampleLineOptions } from './map.types';
|
|
3
4
|
import { LatLng } from 'leaflet';
|
|
4
5
|
declare class MapService {
|
|
5
6
|
/**
|
|
@@ -270,6 +271,7 @@ declare class MapService {
|
|
|
270
271
|
private positionToCoordinate;
|
|
271
272
|
extractCoordinatesFromGeom(geom: GeoJsonPoint): Coordinate;
|
|
272
273
|
extractCoordinatesFromGeom(geom: GeoJsonLineString): Coordinate[];
|
|
274
|
+
extractCoordinatesFromGeom(geom: GeoJsonMultiLineString): Coordinate[][];
|
|
273
275
|
extractCoordinatesFromGeom(geom: GeoJsonPolygon): Coordinate[][];
|
|
274
276
|
extractCoordinatesFromGeom(geom: GeoJsonMultiPolygon): Coordinate[][][];
|
|
275
277
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.service.d.ts","sourceRoot":"","sources":["../../../src/services/map/map.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"map.service.d.ts","sourceRoot":"","sources":["../../../src/services/map/map.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,OAAO,CAAC;AAEpD,OAAO,EAEL,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,cAAM,UAAU;IACd;;OAEG;IACH,SAAgB,cAAc,WAAa;IAE3C;;OAEG;IACH,SAAgB,mBAAmB,OAAO;IAE1C;;OAEG;IACH,SAAgB,6BAA6B,SAAQ;;IAIrD;;;;;;;OAOG;IACH,IAAW,mBAAmB,WAE7B;IAED;;;;;;OAMG;IACH,IAAW,UAAU,WAEpB;IAED;;;;;;OAMG;IACH,IAAW,UAAU,WAEpB;IAED;;;;;OAKG;IACI,qBAAqB,CAAC,MAAM,EAAE,MAAM;IAW3C;;;;;OAKG;IACI,qBAAqB,CAAC,UAAU,EAAE,UAAU;IAQnD;;;;;;;;;;;;OAYG;IACI,gBAAgB,CAAC,OAAO,EAAE,MAAM;IAOvC;;;;;;;;;OASG;IACI,kBAAkB,CAAC,GAAG,EAAE,MAAM;IAQrC;;;;;;;;;;;;;OAaG;IACI,oBAAo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G;IACI,oBAAoB,CACzB,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,GAAE,iBAAsB;IAwEjC;;;;;;;;;;;;;;OAcG;IACI,iBAAiB,CAAC,WAAW,EAAE,UAAU,EAAE;IAqDlD;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;IASrB,0BAA0B,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU;IAC1D,0BAA0B,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,EAAE;IACjE,0BAA0B,CAC/B,IAAI,EAAE,sBAAsB,GAC3B,UAAU,EAAE,EAAE;IACV,0BAA0B,CAAC,IAAI,EAAE,cAAc,GAAG,UAAU,EAAE,EAAE;IAChE,0BAA0B,CAC/B,IAAI,EAAE,mBAAmB,GACxB,UAAU,EAAE,EAAE,EAAE;CA6BpB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DISTANCE_UNIT_FACTORS as t}from"./map.constants.esm.js";import{a as
|
|
1
|
+
import{DISTANCE_UNIT_FACTORS as t}from"./map.constants.esm.js";import{a as n}from"../../_virtual/leaflet-src.esm.js";const e=new class{EARTH_RADIUS_M=6371e3;FULL_CIRCLE_DEGREES=360;COORDINATE_EQUALITY_EPSILON_M=.002;constructor(){}get HALF_CIRCLE_DEGREES(){return this.FULL_CIRCLE_DEGREES/2}get DEG_TO_RAD(){return Math.PI/this.HALF_CIRCLE_DEGREES}get RAD_TO_DEG(){return this.HALF_CIRCLE_DEGREES/Math.PI}getCoordinateByLatLng(t){const{lat:n,lng:e}=t;return{lat:n,lon:e}}getLatLngByCoordinate(t){const{lat:e,lon:i}=t;return new n.LatLng(e,i)}normalizeBearing(t){return(t%this.FULL_CIRCLE_DEGREES+this.FULL_CIRCLE_DEGREES)%this.FULL_CIRCLE_DEGREES}normalizeLongitude(t){return(t+this.FULL_CIRCLE_DEGREES+this.HALF_CIRCLE_DEGREES)%this.FULL_CIRCLE_DEGREES-this.HALF_CIRCLE_DEGREES}calculateDestination=({coordinate:t,distance:n,azimuth:e,unit:i="meters"})=>{const s=t.lat*this.DEG_TO_RAD,r=t.lon*this.DEG_TO_RAD,a=this.normalizeBearing(e)*this.DEG_TO_RAD,o=this.distanceToMeters(n,i)/this.EARTH_RADIUS_M,l=Math.sin(s),h=Math.cos(s),E=Math.sin(o),c=Math.cos(o),_=Math.sin(a),D=Math.cos(a),u=Math.asin(l*c+h*E*D),R=r+Math.atan2(_*E*h,c-l*Math.sin(u));return{lat:u*this.RAD_TO_DEG,lon:this.normalizeLongitude(R*this.RAD_TO_DEG)}};haversineDistance(t,n,e="meters"){const i=t.lat*this.DEG_TO_RAD,s=n.lat*this.DEG_TO_RAD,r=(n.lat-t.lat)*this.DEG_TO_RAD,a=(n.lon-t.lon)*this.DEG_TO_RAD,o=Math.sin(r/2)**2+Math.cos(i)*Math.cos(s)*Math.sin(a/2)**2,l=2*Math.atan2(Math.sqrt(o),Math.sqrt(1-o)),h=this.EARTH_RADIUS_M*l;return this.convertDistance(h,e)}initialBearing(t,n){const e=t.lat*this.DEG_TO_RAD,i=n.lat*this.DEG_TO_RAD,s=t.lon*this.DEG_TO_RAD,r=n.lon*this.DEG_TO_RAD,a=Math.sin(r-s)*Math.cos(i),o=Math.cos(e)*Math.sin(i)-Math.sin(e)*Math.cos(i)*Math.cos(r-s);return this.normalizeBearing(Math.atan2(a,o)*this.RAD_TO_DEG)}convertDistance(n,e="meters"){return n/t[e]}distanceToMeters(n,e="meters"){return n*t[e]}getPolylineLength(t,n="meters"){const e=t.reduce((t,n,e,i)=>{const s=i[e+1];if(!s)return t;return t+this.haversineDistance(n,s,"meters")},0);return this.convertDistance(e,n)}coordinatesEqual(t,n){return this.haversineDistance(t,n,"meters")<=this.COORDINATE_EQUALITY_EPSILON_M}replaceInFlatRing(t,n,e,i){return t.map(t=>i(t,n)?e:t)}replaceCoordinateInLine(t,n,e,i=this.coordinatesEqual.bind(this)){return this.replaceInFlatRing(t,n,e,i)}replaceCoordinateInPolygon(t,n,e,i=this.coordinatesEqual.bind(this)){return t.map(t=>this.replaceInFlatRing(t,n,e,i))}replaceCoordinateInMultiPolygon(t,n,e,i=this.coordinatesEqual.bind(this)){return t.map(t=>this.replaceCoordinateInPolygon(t,n,e,i))}sampleLineByDistance(t,n={}){const{interval:e=1e3,maxPoints:i,unit:s="meters",includeStart:r=!1}=n;if(t.length<2)return[];const a=this.distanceToMeters(e,s);if(!Number.isFinite(a)||a<=0)return[];const o=[];let l=0,h=t[0];r&&o.push(h);for(let n=1;n<t.length;n++){const e=t[n],s=this.haversineDistance(h,e,"meters");if(Number.isFinite(s)&&0!==s){for(l+=s;l>=a;){const t=(s-(l-a))/s,n=h.lat+t*(e.lat-h.lat),r=h.lon+t*(e.lon-h.lon);if(o.push({lat:n,lon:r}),null!=i&&o.length>=i)return o;l-=a}h=e}else h=e}return null!=i?o.slice(0,i):o}getPolylineCenter(t){if(0===t.length)return null;if(1===t.length)return t[0];const n=this.getPolylineLength(t,"meters");if(0===n)return t[0];const e=n/2;let i=0,s=t[0];for(let n=1;n<t.length;n++){const r=t[n],a=this.haversineDistance(s,r,"meters");if(0!==a){if(i+a>=e){const t=(e-i)/a;return{lat:s.lat+t*(r.lat-s.lat),lon:s.lon+t*(r.lon-s.lon)}}i+=a,s=r}else s=r}return t[t.length-1]}positionToCoordinate([t,n]){return{lat:n,lon:t}}extractCoordinatesFromGeom(t){switch(t.type){case"Point":return this.positionToCoordinate(t.coordinates);case"LineString":return t.coordinates.map(t=>this.positionToCoordinate(t));case"MultiLineString":case"Polygon":return t.coordinates.map(t=>t.map(t=>this.positionToCoordinate(t)));case"MultiPolygon":return t.coordinates.map(t=>t.map(t=>t.map(t=>this.positionToCoordinate(t))))}}};export{e as mapService};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Coordinate
|
|
1
|
+
import { Coordinate } from '../../lib';
|
|
2
2
|
/**
|
|
3
3
|
* Поддерживаемые единицы измерения расстояния.
|
|
4
4
|
*/
|
|
@@ -36,26 +36,4 @@ export interface SampleLineOptions {
|
|
|
36
36
|
*/
|
|
37
37
|
includeStart?: boolean;
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Типизированные интерфейсы GeoJSON-геометрий.
|
|
41
|
-
*
|
|
42
|
-
* В GeoJSON координаты хранятся в порядке [longitude, latitude] (RFC 7946).
|
|
43
|
-
*/
|
|
44
|
-
export interface GeoJsonPoint {
|
|
45
|
-
readonly type: 'Point';
|
|
46
|
-
coordinates: GeoJsonPosition;
|
|
47
|
-
}
|
|
48
|
-
export interface GeoJsonLineString {
|
|
49
|
-
readonly type: 'LineString';
|
|
50
|
-
coordinates: GeoJsonPosition[];
|
|
51
|
-
}
|
|
52
|
-
export interface GeoJsonPolygon {
|
|
53
|
-
readonly type: 'Polygon';
|
|
54
|
-
coordinates: GeoJsonPosition[][];
|
|
55
|
-
}
|
|
56
|
-
export interface GeoJsonMultiPolygon {
|
|
57
|
-
readonly type: 'MultiPolygon';
|
|
58
|
-
coordinates: GeoJsonPosition[][][];
|
|
59
|
-
}
|
|
60
|
-
export type GeoJsonGeometry = GeoJsonPoint | GeoJsonLineString | GeoJsonPolygon | GeoJsonMultiPolygon;
|
|
61
39
|
//# sourceMappingURL=map.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.types.d.ts","sourceRoot":"","sources":["../../../src/services/map/map.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"map.types.d.ts","sourceRoot":"","sources":["../../../src/services/map/map.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,GAAG,eAAe,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,KAAK,OAAO,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB"}
|