@dartcom/ui-kit 3.7.0 → 3.7.2
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/components/layers/leaflet/constants.d.ts.map +1 -1
- package/dist/components/layers/leaflet/hooks/useGetLeafletLayer.d.ts.map +1 -1
- package/dist/components/layers/leaflet/layers/index.d.ts +1 -0
- package/dist/components/layers/leaflet/layers/index.d.ts.map +1 -1
- package/dist/components/layers/leaflet/layers/landuse-area/utils.d.ts.map +1 -1
- package/dist/components/layers/leaflet/layers/nature-field/utils.d.ts +2 -2
- package/dist/components/layers/leaflet/layers/nature-field/utils.d.ts.map +1 -1
- package/dist/components/layers/leaflet/layers/nature-forest/index.d.ts +2 -0
- package/dist/components/layers/leaflet/layers/nature-forest/index.d.ts.map +1 -0
- package/dist/components/layers/leaflet/layers/nature-forest/utils.d.ts +3 -0
- package/dist/components/layers/leaflet/layers/nature-forest/utils.d.ts.map +1 -0
- package/dist/components/layers/leaflet/layers/ocean-area/utils.d.ts.map +1 -1
- package/dist/components/layers/leaflet/layers/water-link/utils.d.ts.map +1 -1
- package/dist/components/layers/leaflet/leaflet.d.ts.map +1 -1
- package/dist/components/layers/leaflet/types.d.ts +1 -0
- package/dist/components/layers/leaflet/types.d.ts.map +1 -1
- package/dist/components/layers/leaflet/utils.d.ts +5 -1
- package/dist/components/layers/leaflet/utils.d.ts.map +1 -1
- package/dist/index.cjs +1537 -1356
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -43574,7 +43574,7 @@ const getRoadPolyLayers = (source) => {
|
|
|
43574
43574
|
}`,
|
|
43575
43575
|
draw: {
|
|
43576
43576
|
polygons: {
|
|
43577
|
-
color: '#
|
|
43577
|
+
color: '#BABCC2',
|
|
43578
43578
|
},
|
|
43579
43579
|
},
|
|
43580
43580
|
};
|
|
@@ -43653,7 +43653,29 @@ const getLaneMarkingPolyLayers = (source) => {
|
|
|
43653
43653
|
},
|
|
43654
43654
|
},
|
|
43655
43655
|
};
|
|
43656
|
-
|
|
43656
|
+
const layer__1_14_1 = {
|
|
43657
|
+
id: uuid(),
|
|
43658
|
+
data,
|
|
43659
|
+
filter: `function() {
|
|
43660
|
+
const { poly_number } = feature;
|
|
43661
|
+
|
|
43662
|
+
const isFilter = poly_number === '1.14.1';
|
|
43663
|
+
|
|
43664
|
+
return isFilter;
|
|
43665
|
+
}`,
|
|
43666
|
+
draw: {
|
|
43667
|
+
styles: {
|
|
43668
|
+
zebra_crossing: {
|
|
43669
|
+
attributes: {
|
|
43670
|
+
a_angle: `function() {
|
|
43671
|
+
return feature.angle;
|
|
43672
|
+
}`,
|
|
43673
|
+
},
|
|
43674
|
+
},
|
|
43675
|
+
},
|
|
43676
|
+
},
|
|
43677
|
+
};
|
|
43678
|
+
layers.push(layer__1_26, layer__1_14_1);
|
|
43657
43679
|
return layers;
|
|
43658
43680
|
};
|
|
43659
43681
|
const getLaneMarkingLineLayers = (source) => {
|
|
@@ -43662,6 +43684,8 @@ const getLaneMarkingLineLayers = (source) => {
|
|
|
43662
43684
|
source,
|
|
43663
43685
|
layer: '"LaneMarkingLine"',
|
|
43664
43686
|
};
|
|
43687
|
+
const color = 'white';
|
|
43688
|
+
const width = 0.5;
|
|
43665
43689
|
const layer = {
|
|
43666
43690
|
id: uuid(),
|
|
43667
43691
|
data,
|
|
@@ -43676,8 +43700,43 @@ const getLaneMarkingLineLayers = (source) => {
|
|
|
43676
43700
|
}`,
|
|
43677
43701
|
draw: {
|
|
43678
43702
|
lines: {
|
|
43679
|
-
color
|
|
43680
|
-
width
|
|
43703
|
+
color,
|
|
43704
|
+
width,
|
|
43705
|
+
},
|
|
43706
|
+
},
|
|
43707
|
+
},
|
|
43708
|
+
'1.3': {
|
|
43709
|
+
filter: `function () {
|
|
43710
|
+
const { lane_number } = feature;
|
|
43711
|
+
|
|
43712
|
+
const isFilter = lane_number === '1.3';
|
|
43713
|
+
|
|
43714
|
+
return isFilter;
|
|
43715
|
+
}`,
|
|
43716
|
+
draw: {
|
|
43717
|
+
lines: {
|
|
43718
|
+
color: 'transparent',
|
|
43719
|
+
width: 0.5,
|
|
43720
|
+
outline: {
|
|
43721
|
+
width,
|
|
43722
|
+
color,
|
|
43723
|
+
},
|
|
43724
|
+
},
|
|
43725
|
+
},
|
|
43726
|
+
},
|
|
43727
|
+
'1.5': {
|
|
43728
|
+
filter: `function () {
|
|
43729
|
+
const { lane_number } = feature;
|
|
43730
|
+
|
|
43731
|
+
const isFilter = lane_number === '1.5';
|
|
43732
|
+
|
|
43733
|
+
return isFilter;
|
|
43734
|
+
}`,
|
|
43735
|
+
draw: {
|
|
43736
|
+
lines: {
|
|
43737
|
+
color,
|
|
43738
|
+
width,
|
|
43739
|
+
dash: [4, 10],
|
|
43681
43740
|
},
|
|
43682
43741
|
},
|
|
43683
43742
|
},
|
|
@@ -43691,8 +43750,8 @@ const getLaneMarkingLineLayers = (source) => {
|
|
|
43691
43750
|
}`,
|
|
43692
43751
|
draw: {
|
|
43693
43752
|
lines: {
|
|
43694
|
-
color
|
|
43695
|
-
width
|
|
43753
|
+
color,
|
|
43754
|
+
width,
|
|
43696
43755
|
dash: [5, 5],
|
|
43697
43756
|
},
|
|
43698
43757
|
},
|
|
@@ -43707,8 +43766,8 @@ const getLaneMarkingLineLayers = (source) => {
|
|
|
43707
43766
|
}`,
|
|
43708
43767
|
draw: {
|
|
43709
43768
|
lines: {
|
|
43710
|
-
color
|
|
43711
|
-
width
|
|
43769
|
+
color,
|
|
43770
|
+
width,
|
|
43712
43771
|
dash: [4, 10],
|
|
43713
43772
|
},
|
|
43714
43773
|
},
|
|
@@ -43724,7 +43783,7 @@ const getLaneMarkingLineLayers = (source) => {
|
|
|
43724
43783
|
draw: {
|
|
43725
43784
|
lines: {
|
|
43726
43785
|
color: 'blue',
|
|
43727
|
-
width
|
|
43786
|
+
width,
|
|
43728
43787
|
dash: [4, 10],
|
|
43729
43788
|
},
|
|
43730
43789
|
},
|
|
@@ -43739,9 +43798,9 @@ const getLaneMarkingLineLayers = (source) => {
|
|
|
43739
43798
|
}`,
|
|
43740
43799
|
draw: {
|
|
43741
43800
|
lines: {
|
|
43742
|
-
color
|
|
43743
|
-
width
|
|
43744
|
-
dash: [
|
|
43801
|
+
color,
|
|
43802
|
+
width,
|
|
43803
|
+
dash: [3, 8],
|
|
43745
43804
|
},
|
|
43746
43805
|
},
|
|
43747
43806
|
},
|
|
@@ -43755,8 +43814,8 @@ const getLaneMarkingLineLayers = (source) => {
|
|
|
43755
43814
|
}`,
|
|
43756
43815
|
draw: {
|
|
43757
43816
|
lines: {
|
|
43758
|
-
color
|
|
43759
|
-
width:
|
|
43817
|
+
color,
|
|
43818
|
+
width: 1.5,
|
|
43760
43819
|
},
|
|
43761
43820
|
},
|
|
43762
43821
|
},
|
|
@@ -43811,1593 +43870,1714 @@ const getParkingLineLayers = (source) => {
|
|
|
43811
43870
|
return layers;
|
|
43812
43871
|
};
|
|
43813
43872
|
|
|
43814
|
-
const
|
|
43815
|
-
const
|
|
43816
|
-
|
|
43873
|
+
const getBuiltupAreaLayers = (source) => {
|
|
43874
|
+
const layers = [];
|
|
43875
|
+
const data = {
|
|
43876
|
+
source,
|
|
43877
|
+
layer: '"MapAdminBuiltupArea"',
|
|
43878
|
+
};
|
|
43879
|
+
const layer = {
|
|
43880
|
+
id: uuid(),
|
|
43881
|
+
data,
|
|
43882
|
+
draw: {
|
|
43883
|
+
polygons: {
|
|
43884
|
+
color: '#CFC8C8',
|
|
43885
|
+
},
|
|
43886
|
+
},
|
|
43887
|
+
};
|
|
43888
|
+
layers.push(layer);
|
|
43889
|
+
return layers;
|
|
43817
43890
|
};
|
|
43818
|
-
|
|
43819
|
-
|
|
43820
|
-
const
|
|
43821
|
-
|
|
43822
|
-
|
|
43823
|
-
|
|
43824
|
-
|
|
43825
|
-
|
|
43826
|
-
|
|
43891
|
+
|
|
43892
|
+
const getPointAddressLayers = (source) => {
|
|
43893
|
+
const layer = {
|
|
43894
|
+
id: uuid(),
|
|
43895
|
+
data: {
|
|
43896
|
+
source,
|
|
43897
|
+
layer: '"PointAddress"',
|
|
43898
|
+
minzoom: 15,
|
|
43899
|
+
},
|
|
43900
|
+
draw: {
|
|
43901
|
+
text: {
|
|
43902
|
+
interactive: true,
|
|
43903
|
+
text_source: 'address',
|
|
43904
|
+
font: {
|
|
43905
|
+
fill: 'black',
|
|
43906
|
+
size: '12px',
|
|
43907
|
+
},
|
|
43908
|
+
},
|
|
43909
|
+
},
|
|
43910
|
+
};
|
|
43911
|
+
return [layer];
|
|
43912
|
+
};
|
|
43913
|
+
|
|
43914
|
+
const text_source = `function() {
|
|
43915
|
+
const { poi_name, cat_id } = feature;
|
|
43916
|
+
|
|
43917
|
+
switch (+cat_id) {
|
|
43918
|
+
case 4100: {
|
|
43919
|
+
const text = poi_name.replaceAll(/(Метро-|Станция-|МЦД-)/g, "");
|
|
43920
|
+
|
|
43921
|
+
return text;
|
|
43922
|
+
}
|
|
43923
|
+
|
|
43924
|
+
default: {
|
|
43925
|
+
return poi_name;
|
|
43926
|
+
}
|
|
43927
|
+
}
|
|
43928
|
+
}`;
|
|
43929
|
+
const catIds = [
|
|
43930
|
+
3578, 4013, 4100, 5400, 5511, 5512, 5540, 5541, 5800, 5813, 5999, 6000, 7011,
|
|
43931
|
+
7389, 7832, 7929, 7990, 8060, 8410, 9517, 9530, 9565, 9583, 9718, 9992,
|
|
43932
|
+
];
|
|
43933
|
+
|
|
43934
|
+
const getDefaultPOI = (cat_id) => {
|
|
43935
|
+
const defaultPOI = {};
|
|
43936
|
+
switch (cat_id) {
|
|
43937
|
+
case 4100: {
|
|
43938
|
+
defaultPOI[`_${cat_id}-metro`] = {
|
|
43939
|
+
filter: `function() {
|
|
43940
|
+
const { poi_name, cat_id } = feature;
|
|
43941
|
+
|
|
43942
|
+
const isMetro = poi_name.startsWith('Метро-');
|
|
43943
|
+
const isStation = poi_name.startsWith('Станция-');
|
|
43944
|
+
|
|
43945
|
+
const isCatId = +cat_id === ${cat_id};
|
|
43946
|
+
|
|
43947
|
+
const isFilter = isCatId && (isMetro || isStation);
|
|
43948
|
+
|
|
43949
|
+
return isFilter;
|
|
43950
|
+
}`,
|
|
43951
|
+
draw: {
|
|
43952
|
+
points: getPOITypeLayer(`POI_${cat_id}(metro)`),
|
|
43953
|
+
},
|
|
43827
43954
|
};
|
|
43828
|
-
|
|
43829
|
-
|
|
43830
|
-
|
|
43831
|
-
|
|
43832
|
-
|
|
43955
|
+
defaultPOI[`_${cat_id}-diameter`] = {
|
|
43956
|
+
filter: `function() {
|
|
43957
|
+
const { cat_id, poi_name } = feature;
|
|
43958
|
+
|
|
43959
|
+
const isDiameter = poi_name.startsWith('МЦД-');
|
|
43960
|
+
|
|
43961
|
+
const isCatId = +cat_id === ${cat_id};
|
|
43962
|
+
|
|
43963
|
+
const isFilter = isCatId && isDiameter;
|
|
43964
|
+
|
|
43965
|
+
return isFilter;
|
|
43966
|
+
}`,
|
|
43967
|
+
draw: {
|
|
43968
|
+
points: getPOITypeLayer(`POI_${cat_id}(diameter)`),
|
|
43969
|
+
},
|
|
43833
43970
|
};
|
|
43971
|
+
break;
|
|
43834
43972
|
}
|
|
43835
|
-
|
|
43836
|
-
|
|
43837
|
-
|
|
43838
|
-
|
|
43973
|
+
case 9530: {
|
|
43974
|
+
defaultPOI[`_${cat_id}-mail`] = {
|
|
43975
|
+
filter: `function() {
|
|
43976
|
+
const { cat_id, poi_name = '' } = feature;
|
|
43977
|
+
|
|
43978
|
+
const isCatId = +cat_id === ${cat_id};
|
|
43979
|
+
|
|
43980
|
+
const isMail = poi_name.startsWith('Почта');
|
|
43981
|
+
|
|
43982
|
+
const isFilter = isCatId && isMail;
|
|
43983
|
+
|
|
43984
|
+
return isFilter;
|
|
43985
|
+
}`,
|
|
43986
|
+
draw: {
|
|
43987
|
+
points: getPOITypeLayer(`POI_${cat_id}(Mail)`),
|
|
43988
|
+
},
|
|
43989
|
+
};
|
|
43990
|
+
defaultPOI[`_${cat_id}-delivery`] = {
|
|
43991
|
+
filter: `function() {
|
|
43992
|
+
const { cat_id, poi_name = '' } = feature;
|
|
43993
|
+
|
|
43994
|
+
const isCatId = +cat_id === ${cat_id};
|
|
43995
|
+
|
|
43996
|
+
const isMail = poi_name.startsWith('Почта');
|
|
43997
|
+
|
|
43998
|
+
const isFilter = isCatId && !isMail;
|
|
43999
|
+
|
|
44000
|
+
return isFilter;
|
|
44001
|
+
}`,
|
|
44002
|
+
draw: {
|
|
44003
|
+
points: getPOITypeLayer(`POI_${cat_id}(Delivery)`),
|
|
44004
|
+
},
|
|
43839
44005
|
};
|
|
44006
|
+
break;
|
|
43840
44007
|
}
|
|
43841
|
-
|
|
43842
|
-
|
|
43843
|
-
|
|
43844
|
-
|
|
44008
|
+
case 9992: {
|
|
44009
|
+
const subcat = {
|
|
44010
|
+
mosque: 1,
|
|
44011
|
+
church: 2,
|
|
44012
|
+
temple: 3,
|
|
44013
|
+
davidStar: 4,
|
|
44014
|
+
mortar: 6,
|
|
43845
44015
|
};
|
|
44016
|
+
Object.entries(subcat).forEach(([subcat_name, subcat_id]) => {
|
|
44017
|
+
defaultPOI[`_${cat_id}-${subcat_name}`] = {
|
|
44018
|
+
filter: `function() {
|
|
44019
|
+
const { cat_id, subcat_id } = feature;
|
|
44020
|
+
|
|
44021
|
+
const isCatId = +cat_id === ${cat_id};
|
|
44022
|
+
const isSubcatId = +subcat_id === ${subcat_id};
|
|
44023
|
+
|
|
44024
|
+
const isFilter = isCatId && isSubcatId;
|
|
44025
|
+
|
|
44026
|
+
return isFilter;
|
|
44027
|
+
}`,
|
|
44028
|
+
draw: {
|
|
44029
|
+
points: getPOITypeLayer(`POI_${cat_id}(${subcat_name})`),
|
|
44030
|
+
},
|
|
44031
|
+
};
|
|
44032
|
+
});
|
|
44033
|
+
break;
|
|
43846
44034
|
}
|
|
43847
|
-
|
|
43848
|
-
|
|
43849
|
-
|
|
43850
|
-
|
|
43851
|
-
|
|
43852
|
-
|
|
44035
|
+
default: {
|
|
44036
|
+
defaultPOI[`_${cat_id}`] = {
|
|
44037
|
+
filter: `function {
|
|
44038
|
+
const { cat_id } = feature;
|
|
44039
|
+
|
|
44040
|
+
const isFilter = +cat_id === ${cat_id};
|
|
44041
|
+
|
|
44042
|
+
return isFilter;
|
|
44043
|
+
}`,
|
|
44044
|
+
draw: {
|
|
44045
|
+
points: getPOITypeLayer(`POI_${cat_id}`),
|
|
43853
44046
|
},
|
|
43854
|
-
}
|
|
44047
|
+
};
|
|
43855
44048
|
}
|
|
43856
|
-
cloneLayer.draw = structuredClone(draw);
|
|
43857
44049
|
}
|
|
43858
|
-
|
|
43859
|
-
Object.entries(sublayers).forEach(([name, sublayer]) => {
|
|
43860
|
-
if (sublayer) {
|
|
43861
|
-
const { draw } = sublayer;
|
|
43862
|
-
if (draw) {
|
|
43863
|
-
const { points, lines, polygons } = draw;
|
|
43864
|
-
if (points) {
|
|
43865
|
-
points.order = order;
|
|
43866
|
-
draw.points = points;
|
|
43867
|
-
}
|
|
43868
|
-
if (lines) {
|
|
43869
|
-
lines.order = order;
|
|
43870
|
-
draw.lines = lines;
|
|
43871
|
-
}
|
|
43872
|
-
if (polygons) {
|
|
43873
|
-
polygons.order = order;
|
|
43874
|
-
draw.polygons = polygons;
|
|
43875
|
-
}
|
|
43876
|
-
sublayer.draw = structuredClone(draw);
|
|
43877
|
-
}
|
|
43878
|
-
sublayers[name] = structuredClone(sublayer);
|
|
43879
|
-
}
|
|
43880
|
-
});
|
|
43881
|
-
cloneLayer.sublayers = structuredClone(sublayers);
|
|
43882
|
-
}
|
|
43883
|
-
return cloneLayer;
|
|
44050
|
+
return defaultPOI;
|
|
43884
44051
|
};
|
|
43885
|
-
|
|
43886
|
-
const
|
|
43887
|
-
|
|
43888
|
-
|
|
43889
|
-
|
|
43890
|
-
|
|
43891
|
-
const getLeafletLayer = () => {
|
|
43892
|
-
Promise.resolve().then(function () { return tangram_min; }).then(() => {
|
|
43893
|
-
if (window.Tangram) {
|
|
43894
|
-
const leafletLayer = window.Tangram.leafletLayer({
|
|
43895
|
-
scene: sceneTiles,
|
|
43896
|
-
});
|
|
43897
|
-
const { scene } = leafletLayer;
|
|
43898
|
-
setLayer(leafletLayer);
|
|
43899
|
-
setScene(scene);
|
|
43900
|
-
}
|
|
43901
|
-
});
|
|
44052
|
+
const getPOITypeLayer = (texture) => {
|
|
44053
|
+
const typeLayer = {
|
|
44054
|
+
texture,
|
|
44055
|
+
sprite: 'base',
|
|
44056
|
+
size: '20px',
|
|
44057
|
+
placement: 'midpoint',
|
|
43902
44058
|
};
|
|
43903
|
-
|
|
43904
|
-
|
|
43905
|
-
|
|
43906
|
-
|
|
43907
|
-
|
|
43908
|
-
|
|
43909
|
-
|
|
43910
|
-
|
|
43911
|
-
|
|
43912
|
-
|
|
43913
|
-
|
|
43914
|
-
|
|
43915
|
-
|
|
43916
|
-
|
|
43917
|
-
|
|
43918
|
-
|
|
43919
|
-
|
|
43920
|
-
|
|
43921
|
-
|
|
43922
|
-
|
|
43923
|
-
|
|
43924
|
-
const updateSource = React__namespace.useCallback((sourceName, newUrl) => {
|
|
43925
|
-
if (!scene) {
|
|
43926
|
-
console.warn('Scene не инициализирована');
|
|
43927
|
-
return;
|
|
43928
|
-
}
|
|
43929
|
-
if (!config) {
|
|
43930
|
-
console.warn('Config не инициализирована');
|
|
43931
|
-
return;
|
|
43932
|
-
}
|
|
43933
|
-
config.sources[sourceName].url = newUrl;
|
|
43934
|
-
scene.updateConfig({ rebuild: true });
|
|
43935
|
-
return getSources();
|
|
43936
|
-
}, [config, scene]);
|
|
43937
|
-
const addLayer = React__namespace.useCallback((layer) => {
|
|
43938
|
-
if (!scene) {
|
|
43939
|
-
console.warn('Scene не инициализирован');
|
|
43940
|
-
return;
|
|
43941
|
-
}
|
|
43942
|
-
if (!config) {
|
|
43943
|
-
console.warn('Config не инициализирован');
|
|
43944
|
-
return;
|
|
43945
|
-
}
|
|
43946
|
-
const order = getLayers().length + 1;
|
|
43947
|
-
const layerWithOrder = setLayerOrder({
|
|
43948
|
-
layer,
|
|
43949
|
-
order,
|
|
43950
|
-
});
|
|
43951
|
-
const layerName = getLayerName(layerWithOrder);
|
|
43952
|
-
const { sublayers = {}, draw } = layerWithOrder;
|
|
43953
|
-
if (draw) {
|
|
43954
|
-
const { styles = {} } = draw;
|
|
43955
|
-
if (styles) {
|
|
43956
|
-
layerWithOrder.draw = {
|
|
43957
|
-
...structuredClone(draw),
|
|
43958
|
-
...structuredClone(styles),
|
|
43959
|
-
};
|
|
43960
|
-
}
|
|
43961
|
-
}
|
|
43962
|
-
config.layers[layerName] = {
|
|
43963
|
-
...structuredClone(layerWithOrder),
|
|
43964
|
-
...structuredClone(sublayers),
|
|
43965
|
-
};
|
|
43966
|
-
scene.updateConfig({ rebuild: true });
|
|
43967
|
-
return getLayers();
|
|
43968
|
-
}, [config, scene]);
|
|
43969
|
-
const removeLayer = React__namespace.useCallback((layer) => {
|
|
43970
|
-
if (!scene) {
|
|
43971
|
-
console.warn('Scene не инициализирован');
|
|
43972
|
-
return;
|
|
43973
|
-
}
|
|
43974
|
-
if (!config) {
|
|
43975
|
-
console.warn('Config не инициализирован');
|
|
43976
|
-
return;
|
|
43977
|
-
}
|
|
43978
|
-
const layerName = getLayerName(layer);
|
|
43979
|
-
if (config.layers[layerName]) {
|
|
43980
|
-
delete config.layers[layerName];
|
|
43981
|
-
}
|
|
43982
|
-
scene.updateConfig({ rebuild: true });
|
|
43983
|
-
return getLayers();
|
|
43984
|
-
}, [config, scene]);
|
|
43985
|
-
const addStyle = React__namespace.useCallback(({ name, style }) => {
|
|
43986
|
-
if (!scene) {
|
|
43987
|
-
console.warn('Scene не инициализирована');
|
|
43988
|
-
return;
|
|
43989
|
-
}
|
|
43990
|
-
if (!config) {
|
|
43991
|
-
console.warn('Config не инициализирована');
|
|
43992
|
-
return;
|
|
43993
|
-
}
|
|
43994
|
-
config.styles[name] = structuredClone(style);
|
|
43995
|
-
scene.updateConfig({ rebuild: true });
|
|
43996
|
-
}, [config, scene]);
|
|
43997
|
-
const getLayerVisibility = React__namespace.useCallback((layer) => {
|
|
43998
|
-
if (!config) {
|
|
43999
|
-
console.warn('Config не инициализирована');
|
|
44000
|
-
return;
|
|
44001
|
-
}
|
|
44002
|
-
const layerName = getLayerName(layer);
|
|
44003
|
-
const { visible: layerVisibility } = config.layers[layerName];
|
|
44004
|
-
return layerVisibility;
|
|
44005
|
-
}, [config]);
|
|
44006
|
-
const toggleLayerVisibility = React__namespace.useCallback(({ layer, visible }) => {
|
|
44007
|
-
if (!scene) {
|
|
44008
|
-
console.warn('Scene не инициализирована');
|
|
44009
|
-
return;
|
|
44010
|
-
}
|
|
44011
|
-
if (!config) {
|
|
44012
|
-
console.warn('Config не инициализирована');
|
|
44013
|
-
return;
|
|
44014
|
-
}
|
|
44015
|
-
const layerName = getLayerName(layer);
|
|
44016
|
-
config.layers[layerName].visible = visible;
|
|
44017
|
-
scene.updateConfig();
|
|
44018
|
-
return getLayerVisibility(layer);
|
|
44019
|
-
}, [config, scene]);
|
|
44020
|
-
const getLayers = React__namespace.useCallback(() => {
|
|
44021
|
-
if (!config)
|
|
44022
|
-
return [];
|
|
44023
|
-
const { layers } = config;
|
|
44024
|
-
return Object.keys(layers);
|
|
44025
|
-
}, [config]);
|
|
44026
|
-
const removeLayers = React__namespace.useCallback(() => {
|
|
44027
|
-
if (!config)
|
|
44028
|
-
return [];
|
|
44029
|
-
const { layers } = config;
|
|
44030
|
-
Object.values(layers).forEach(removeLayer);
|
|
44031
|
-
}, [config]);
|
|
44032
|
-
const getSources = React__namespace.useCallback(() => {
|
|
44033
|
-
if (!config)
|
|
44034
|
-
return [];
|
|
44035
|
-
const { sources } = config;
|
|
44036
|
-
return Object.keys(sources);
|
|
44037
|
-
}, [config]);
|
|
44038
|
-
React__namespace.useEffect(() => {
|
|
44039
|
-
if (isValidApiKey) {
|
|
44040
|
-
getLeafletLayer();
|
|
44041
|
-
}
|
|
44042
|
-
return () => {
|
|
44043
|
-
setLayer(null);
|
|
44044
|
-
setScene(null);
|
|
44045
|
-
setConfig(null);
|
|
44046
|
-
};
|
|
44047
|
-
}, [isValidApiKey]);
|
|
44048
|
-
React__namespace.useEffect(() => {
|
|
44049
|
-
if (scene) {
|
|
44050
|
-
scene.subscribe({
|
|
44051
|
-
load: ({ config }) => {
|
|
44052
|
-
setConfig(config);
|
|
44053
|
-
},
|
|
44054
|
-
});
|
|
44055
|
-
}
|
|
44056
|
-
}, [scene]);
|
|
44057
|
-
React__namespace.useEffect(() => {
|
|
44058
|
-
addStyle({
|
|
44059
|
-
name: 'space-tile',
|
|
44060
|
-
style: {
|
|
44061
|
-
shaders: {
|
|
44062
|
-
defines: {
|
|
44063
|
-
TILE_SCALE: 0.0002445,
|
|
44064
|
-
'NORMALIZED_SHORT(x)': '(x * 32767.)',
|
|
44065
|
-
},
|
|
44066
|
-
blocks: {
|
|
44067
|
-
global: `
|
|
44068
|
-
varying vec3 v_pos;
|
|
44069
|
-
vec2 getTileCoords() {
|
|
44070
|
-
return fract(v_pos.xy);
|
|
44071
|
-
}
|
|
44072
|
-
`,
|
|
44073
|
-
position: `
|
|
44074
|
-
v_pos = modelPosition().xyz;
|
|
44075
|
-
`,
|
|
44076
|
-
},
|
|
44077
|
-
},
|
|
44078
|
-
},
|
|
44079
|
-
});
|
|
44080
|
-
addStyle({
|
|
44081
|
-
name: 'tools-aastep',
|
|
44082
|
-
style: {
|
|
44083
|
-
shaders: {
|
|
44084
|
-
extensions: 'OES_standard_derivatives',
|
|
44085
|
-
blocks: {
|
|
44086
|
-
global: `
|
|
44087
|
-
float aastep(float threshold, float value) {
|
|
44088
|
-
#ifdef TANGRAM_FRAGMENT_SHADER
|
|
44089
|
-
#ifdef TANGRAM_EXTENSION_OES_standard_derivatives
|
|
44090
|
-
float afwidth = length(vec2(dFdx(value), dFdy(value))) * 0.70710678118654757;
|
|
44091
|
-
return smoothstep(threshold-afwidth, threshold+afwidth, value);
|
|
44092
|
-
#else
|
|
44093
|
-
return step(threshold, value);
|
|
44094
|
-
#endif
|
|
44095
|
-
#else
|
|
44096
|
-
return step(threshold, value);
|
|
44097
|
-
#endif
|
|
44098
|
-
}
|
|
44099
|
-
`,
|
|
44100
|
-
},
|
|
44101
|
-
},
|
|
44102
|
-
},
|
|
44103
|
-
});
|
|
44104
|
-
addStyle({
|
|
44105
|
-
name: 'pattern-diagonal-grid',
|
|
44106
|
-
style: {
|
|
44107
|
-
mix: ['space-tile', 'tools-aastep'],
|
|
44108
|
-
shaders: {
|
|
44109
|
-
blocks: {
|
|
44110
|
-
global: `
|
|
44111
|
-
float DiagonalGrid(float scale, float lineWidth) {
|
|
44112
|
-
vec2 st = getTileCoords() * scale;
|
|
44113
|
-
|
|
44114
|
-
float d1 = mod(st.x + st.y, 1.0);
|
|
44115
|
-
float line1 = aastep(lineWidth, d1) * aastep(1.0 - lineWidth, d1);
|
|
44116
|
-
|
|
44117
|
-
float d2 = mod(st.x - st.y, 1.0);
|
|
44118
|
-
float line2 = aastep(lineWidth, d2) * aastep(1.0 - lineWidth, d2);
|
|
44119
|
-
|
|
44120
|
-
return max(line1, line2);
|
|
44121
|
-
}
|
|
44122
|
-
`,
|
|
44059
|
+
return typeLayer;
|
|
44060
|
+
};
|
|
44061
|
+
const sublayers = catIds.reduce((acc, catId) => ({
|
|
44062
|
+
...acc,
|
|
44063
|
+
...getDefaultPOI(catId),
|
|
44064
|
+
}), {});
|
|
44065
|
+
const getPOILayers = (source) => {
|
|
44066
|
+
const layers = [];
|
|
44067
|
+
const layer = {
|
|
44068
|
+
id: uuid(),
|
|
44069
|
+
data: {
|
|
44070
|
+
source,
|
|
44071
|
+
layer: '"POI"',
|
|
44072
|
+
},
|
|
44073
|
+
draw: {
|
|
44074
|
+
points: {
|
|
44075
|
+
text: {
|
|
44076
|
+
text_source,
|
|
44077
|
+
font: {
|
|
44078
|
+
fill: '#464544',
|
|
44079
|
+
size: '12px',
|
|
44123
44080
|
},
|
|
44124
44081
|
},
|
|
44125
44082
|
},
|
|
44126
|
-
}
|
|
44127
|
-
|
|
44128
|
-
|
|
44129
|
-
|
|
44130
|
-
|
|
44131
|
-
|
|
44132
|
-
|
|
44133
|
-
|
|
44134
|
-
|
|
44135
|
-
|
|
44136
|
-
|
|
44137
|
-
|
|
44138
|
-
|
|
44139
|
-
|
|
44083
|
+
},
|
|
44084
|
+
sublayers,
|
|
44085
|
+
};
|
|
44086
|
+
layers.push(layer);
|
|
44087
|
+
return layers;
|
|
44088
|
+
};
|
|
44089
|
+
|
|
44090
|
+
const getCityPOILayers = (source) => {
|
|
44091
|
+
const layer = {
|
|
44092
|
+
id: uuid(),
|
|
44093
|
+
data: {
|
|
44094
|
+
source,
|
|
44095
|
+
layer: '"CityPOI"',
|
|
44096
|
+
},
|
|
44097
|
+
filter: `function () {
|
|
44098
|
+
const { capital_order8, capital_order2, capital_order1, poi_name, priority } = feature;
|
|
44099
|
+
|
|
44100
|
+
if ($zoom >= 9 && $zoom < 13) {
|
|
44101
|
+
return priority < 8;
|
|
44102
|
+
}
|
|
44103
|
+
|
|
44104
|
+
if ($zoom <= 11) {
|
|
44105
|
+
return capital_order8 === 'Y';
|
|
44106
|
+
}
|
|
44107
|
+
|
|
44108
|
+
if ($zoom >= 15) {
|
|
44109
|
+
return capital_order2 !== 'Y';
|
|
44110
|
+
}
|
|
44111
|
+
|
|
44112
|
+
return true;
|
|
44113
|
+
}
|
|
44114
|
+
`,
|
|
44115
|
+
draw: {
|
|
44116
|
+
text: {
|
|
44117
|
+
text_source: 'poi_name',
|
|
44118
|
+
priority: `function () {
|
|
44119
|
+
const { priority } = feature;
|
|
44120
|
+
|
|
44121
|
+
if ($zoom <= 15) {
|
|
44122
|
+
return priority;
|
|
44123
|
+
}
|
|
44124
|
+
|
|
44125
|
+
return 1;
|
|
44126
|
+
}
|
|
44127
|
+
`,
|
|
44128
|
+
font: {
|
|
44129
|
+
fill: 'black',
|
|
44130
|
+
size: `function() {
|
|
44131
|
+
const { capital_order8 } = feature;
|
|
44132
|
+
|
|
44133
|
+
if (capital_order8 === 'Y') {
|
|
44134
|
+
return '16px';
|
|
44135
|
+
}
|
|
44136
|
+
|
|
44137
|
+
return '12px';
|
|
44138
|
+
}`,
|
|
44139
|
+
weight: `function() {
|
|
44140
|
+
const { capital_order2 } = feature;
|
|
44141
|
+
|
|
44142
|
+
if (capital_order2 === 'Y') {
|
|
44143
|
+
return 'bold';
|
|
44144
|
+
}
|
|
44145
|
+
|
|
44146
|
+
return 'normal';
|
|
44147
|
+
}`,
|
|
44148
|
+
stroke: {
|
|
44149
|
+
color: 'white',
|
|
44150
|
+
width: '2px',
|
|
44140
44151
|
},
|
|
44141
44152
|
},
|
|
44142
44153
|
},
|
|
44143
|
-
}
|
|
44144
|
-
}
|
|
44145
|
-
|
|
44146
|
-
|
|
44147
|
-
|
|
44148
|
-
|
|
44149
|
-
|
|
44150
|
-
|
|
44151
|
-
|
|
44152
|
-
|
|
44153
|
-
|
|
44154
|
-
}
|
|
44155
|
-
|
|
44156
|
-
|
|
44157
|
-
|
|
44158
|
-
|
|
44159
|
-
|
|
44160
|
-
|
|
44161
|
-
|
|
44162
|
-
|
|
44163
|
-
|
|
44164
|
-
|
|
44165
|
-
|
|
44166
|
-
|
|
44167
|
-
toggleLayerVisibility,
|
|
44168
|
-
getSources,
|
|
44169
|
-
getLayers,
|
|
44170
|
-
removeLayers,
|
|
44154
|
+
},
|
|
44155
|
+
};
|
|
44156
|
+
return [layer];
|
|
44157
|
+
};
|
|
44158
|
+
|
|
44159
|
+
const getOneWayLayers = (source) => {
|
|
44160
|
+
const layer = {
|
|
44161
|
+
id: uuid(),
|
|
44162
|
+
data: {
|
|
44163
|
+
source,
|
|
44164
|
+
layer: '"OneWay"',
|
|
44165
|
+
},
|
|
44166
|
+
draw: {
|
|
44167
|
+
points: {
|
|
44168
|
+
texture: 'arrow',
|
|
44169
|
+
sprite: 'base',
|
|
44170
|
+
angle: `function() {
|
|
44171
|
+
const { bearing } = feature;
|
|
44172
|
+
|
|
44173
|
+
return bearing;
|
|
44174
|
+
}
|
|
44175
|
+
`,
|
|
44176
|
+
},
|
|
44177
|
+
},
|
|
44171
44178
|
};
|
|
44179
|
+
return [layer];
|
|
44172
44180
|
};
|
|
44173
44181
|
|
|
44174
|
-
|
|
44175
|
-
|
|
44176
|
-
|
|
44177
|
-
|
|
44178
|
-
|
|
44179
|
-
|
|
44180
|
-
|
|
44181
|
-
|
|
44182
|
-
|
|
44182
|
+
var ConditionTypes;
|
|
44183
|
+
(function (ConditionTypes) {
|
|
44184
|
+
ConditionTypes["traffic_signal"] = "traffic_signal";
|
|
44185
|
+
ConditionTypes["pedestrian_crossing"] = "pedestrian_crossing";
|
|
44186
|
+
ConditionTypes["physical"] = "physical";
|
|
44187
|
+
ConditionTypes["gate"] = "gate";
|
|
44188
|
+
})(ConditionTypes || (ConditionTypes = {}));
|
|
44189
|
+
|
|
44190
|
+
const getConditionLayers = (source) => {
|
|
44191
|
+
const sublayers = {};
|
|
44192
|
+
const layer = {
|
|
44193
|
+
id: uuid(),
|
|
44194
|
+
data: {
|
|
44195
|
+
source,
|
|
44196
|
+
layer: '"Conditions"',
|
|
44197
|
+
},
|
|
44198
|
+
};
|
|
44199
|
+
Object.values(ConditionTypes).forEach((conditionType) => {
|
|
44200
|
+
sublayers[`_${conditionType}`] = {
|
|
44201
|
+
filter: `function() {
|
|
44202
|
+
const { type } = feature;
|
|
44203
|
+
|
|
44204
|
+
const isShow = type === '${conditionType}';
|
|
44205
|
+
|
|
44206
|
+
return isShow;
|
|
44207
|
+
}`,
|
|
44208
|
+
draw: {
|
|
44209
|
+
points: {
|
|
44210
|
+
texture: conditionType,
|
|
44211
|
+
sprite: 'base',
|
|
44212
|
+
placement: 'midpoint',
|
|
44213
|
+
},
|
|
44214
|
+
},
|
|
44215
|
+
};
|
|
44216
|
+
});
|
|
44217
|
+
layer.sublayers = sublayers;
|
|
44218
|
+
return [layer];
|
|
44183
44219
|
};
|
|
44184
44220
|
|
|
44185
|
-
const
|
|
44221
|
+
const getRailroadLayers = (source) => {
|
|
44222
|
+
const layer = '"MapRailroadLink"';
|
|
44186
44223
|
const layers = [];
|
|
44187
44224
|
const data = {
|
|
44188
44225
|
source,
|
|
44189
|
-
layer
|
|
44226
|
+
layer,
|
|
44190
44227
|
};
|
|
44191
|
-
const
|
|
44228
|
+
const frontLayer = {
|
|
44229
|
+
id: uuid(),
|
|
44230
|
+
data: {
|
|
44231
|
+
source,
|
|
44232
|
+
layer,
|
|
44233
|
+
},
|
|
44234
|
+
draw: {
|
|
44235
|
+
lines: {
|
|
44236
|
+
width: 5,
|
|
44237
|
+
dash: [2, 1],
|
|
44238
|
+
color: '#5C5F5F',
|
|
44239
|
+
cap: 'round',
|
|
44240
|
+
join: 'round',
|
|
44241
|
+
},
|
|
44242
|
+
},
|
|
44243
|
+
};
|
|
44244
|
+
const backLayer = {
|
|
44192
44245
|
id: uuid(),
|
|
44193
44246
|
data,
|
|
44194
44247
|
draw: {
|
|
44195
|
-
|
|
44196
|
-
|
|
44248
|
+
lines: {
|
|
44249
|
+
width: 6,
|
|
44250
|
+
color: '#A3A8A',
|
|
44251
|
+
cap: 'round',
|
|
44252
|
+
join: 'round',
|
|
44197
44253
|
},
|
|
44198
44254
|
},
|
|
44199
44255
|
};
|
|
44200
|
-
layers.push(
|
|
44256
|
+
layers.push(backLayer, frontLayer);
|
|
44201
44257
|
return layers;
|
|
44202
44258
|
};
|
|
44203
44259
|
|
|
44204
|
-
const
|
|
44260
|
+
const getWaterAreaLayers = (source) => {
|
|
44261
|
+
const layers = [];
|
|
44205
44262
|
const layer = {
|
|
44206
44263
|
id: uuid(),
|
|
44207
44264
|
data: {
|
|
44208
44265
|
source,
|
|
44209
|
-
layer: '"
|
|
44210
|
-
minzoom: 15,
|
|
44266
|
+
layer: '"MapWaterArea"',
|
|
44211
44267
|
},
|
|
44212
44268
|
draw: {
|
|
44213
|
-
|
|
44214
|
-
|
|
44215
|
-
|
|
44216
|
-
|
|
44217
|
-
|
|
44218
|
-
|
|
44219
|
-
|
|
44269
|
+
polygons: {
|
|
44270
|
+
color: '#7DBEE4',
|
|
44271
|
+
},
|
|
44272
|
+
lines: {
|
|
44273
|
+
color: '#7DBEE4',
|
|
44274
|
+
width: 20,
|
|
44275
|
+
cap: 'round',
|
|
44276
|
+
join: 'round',
|
|
44220
44277
|
},
|
|
44221
44278
|
},
|
|
44222
44279
|
};
|
|
44223
|
-
|
|
44224
|
-
|
|
44225
|
-
|
|
44226
|
-
|
|
44227
|
-
|
|
44228
|
-
|
|
44229
|
-
|
|
44230
|
-
|
|
44231
|
-
const text = poi_name.replaceAll(/(Метро-|Станция-|МЦД-)/g, "");
|
|
44232
|
-
|
|
44233
|
-
return text;
|
|
44234
|
-
}
|
|
44235
|
-
|
|
44236
|
-
default: {
|
|
44237
|
-
return poi_name;
|
|
44238
|
-
}
|
|
44239
|
-
}
|
|
44240
|
-
}`;
|
|
44241
|
-
const catIds = [
|
|
44242
|
-
3578, 4013, 4100, 5400, 5511, 5512, 5540, 5541, 5800, 5813, 5999, 6000, 7011,
|
|
44243
|
-
7389, 7832, 7929, 7990, 8060, 8410, 9517, 9530, 9565, 9583, 9718, 9992,
|
|
44244
|
-
];
|
|
44245
|
-
|
|
44246
|
-
const getDefaultPOI = (cat_id) => {
|
|
44247
|
-
const defaultPOI = {};
|
|
44248
|
-
switch (cat_id) {
|
|
44249
|
-
case 4100: {
|
|
44250
|
-
defaultPOI[`_${cat_id}-metro`] = {
|
|
44251
|
-
filter: `function() {
|
|
44252
|
-
const { poi_name, cat_id } = feature;
|
|
44253
|
-
|
|
44254
|
-
const isMetro = poi_name.startsWith('Метро-');
|
|
44255
|
-
const isStation = poi_name.startsWith('Станция-');
|
|
44256
|
-
|
|
44257
|
-
const isCatId = +cat_id === ${cat_id};
|
|
44258
|
-
|
|
44259
|
-
const isFilter = isCatId && (isMetro || isStation);
|
|
44260
|
-
|
|
44261
|
-
return isFilter;
|
|
44262
|
-
}`,
|
|
44263
|
-
draw: {
|
|
44264
|
-
points: getPOITypeLayer(`POI_${cat_id}(metro)`),
|
|
44265
|
-
},
|
|
44266
|
-
};
|
|
44267
|
-
defaultPOI[`_${cat_id}-diameter`] = {
|
|
44268
|
-
filter: `function() {
|
|
44269
|
-
const { cat_id, poi_name } = feature;
|
|
44270
|
-
|
|
44271
|
-
const isDiameter = poi_name.startsWith('МЦД-');
|
|
44272
|
-
|
|
44273
|
-
const isCatId = +cat_id === ${cat_id};
|
|
44274
|
-
|
|
44275
|
-
const isFilter = isCatId && isDiameter;
|
|
44276
|
-
|
|
44277
|
-
return isFilter;
|
|
44278
|
-
}`,
|
|
44279
|
-
draw: {
|
|
44280
|
-
points: getPOITypeLayer(`POI_${cat_id}(diameter)`),
|
|
44281
|
-
},
|
|
44282
|
-
};
|
|
44283
|
-
break;
|
|
44284
|
-
}
|
|
44285
|
-
case 9530: {
|
|
44286
|
-
defaultPOI[`_${cat_id}-mail`] = {
|
|
44287
|
-
filter: `function() {
|
|
44288
|
-
const { cat_id, poi_name = '' } = feature;
|
|
44289
|
-
|
|
44290
|
-
const isCatId = +cat_id === ${cat_id};
|
|
44291
|
-
|
|
44292
|
-
const isMail = poi_name.startsWith('Почта');
|
|
44293
|
-
|
|
44294
|
-
const isFilter = isCatId && isMail;
|
|
44295
|
-
|
|
44296
|
-
return isFilter;
|
|
44297
|
-
}`,
|
|
44298
|
-
draw: {
|
|
44299
|
-
points: getPOITypeLayer(`POI_${cat_id}(Mail)`),
|
|
44300
|
-
},
|
|
44301
|
-
};
|
|
44302
|
-
defaultPOI[`_${cat_id}-delivery`] = {
|
|
44303
|
-
filter: `function() {
|
|
44304
|
-
const { cat_id, poi_name = '' } = feature;
|
|
44305
|
-
|
|
44306
|
-
const isCatId = +cat_id === ${cat_id};
|
|
44307
|
-
|
|
44308
|
-
const isMail = poi_name.startsWith('Почта');
|
|
44309
|
-
|
|
44310
|
-
const isFilter = isCatId && !isMail;
|
|
44311
|
-
|
|
44312
|
-
return isFilter;
|
|
44313
|
-
}`,
|
|
44314
|
-
draw: {
|
|
44315
|
-
points: getPOITypeLayer(`POI_${cat_id}(Delivery)`),
|
|
44316
|
-
},
|
|
44317
|
-
};
|
|
44318
|
-
break;
|
|
44319
|
-
}
|
|
44320
|
-
case 9992: {
|
|
44321
|
-
const subcat = {
|
|
44322
|
-
mosque: 1,
|
|
44323
|
-
church: 2,
|
|
44324
|
-
temple: 3,
|
|
44325
|
-
davidStar: 4,
|
|
44326
|
-
mortar: 6,
|
|
44327
|
-
};
|
|
44328
|
-
Object.entries(subcat).forEach(([subcat_name, subcat_id]) => {
|
|
44329
|
-
defaultPOI[`_${cat_id}-${subcat_name}`] = {
|
|
44330
|
-
filter: `function() {
|
|
44331
|
-
const { cat_id, subcat_id } = feature;
|
|
44332
|
-
|
|
44333
|
-
const isCatId = +cat_id === ${cat_id};
|
|
44334
|
-
const isSubcatId = +subcat_id === ${subcat_id};
|
|
44335
|
-
|
|
44336
|
-
const isFilter = isCatId && isSubcatId;
|
|
44337
|
-
|
|
44338
|
-
return isFilter;
|
|
44339
|
-
}`,
|
|
44340
|
-
draw: {
|
|
44341
|
-
points: getPOITypeLayer(`POI_${cat_id}(${subcat_name})`),
|
|
44342
|
-
},
|
|
44343
|
-
};
|
|
44344
|
-
});
|
|
44345
|
-
break;
|
|
44346
|
-
}
|
|
44347
|
-
default: {
|
|
44348
|
-
defaultPOI[`_${cat_id}`] = {
|
|
44349
|
-
filter: `function {
|
|
44350
|
-
const { cat_id } = feature;
|
|
44280
|
+
const waterAreaLabelLayer = {
|
|
44281
|
+
id: uuid(),
|
|
44282
|
+
data: {
|
|
44283
|
+
source,
|
|
44284
|
+
layer: '"MapWaterAreaLabel"',
|
|
44285
|
+
},
|
|
44286
|
+
filter: `function() {
|
|
44287
|
+
const { display_class } = feature;
|
|
44351
44288
|
|
|
44352
|
-
|
|
44289
|
+
if ($zoom >= 14) {
|
|
44290
|
+
return true;
|
|
44291
|
+
} else {
|
|
44292
|
+
return display_class <= 4;
|
|
44293
|
+
}
|
|
44294
|
+
}`,
|
|
44295
|
+
draw: {
|
|
44296
|
+
text: {
|
|
44297
|
+
text_source: 'name',
|
|
44298
|
+
font: {
|
|
44299
|
+
fill: '#0A80C4',
|
|
44300
|
+
size: '14px',
|
|
44301
|
+
stroke: { color: 'white', width: '3px' },
|
|
44302
|
+
},
|
|
44303
|
+
},
|
|
44304
|
+
},
|
|
44305
|
+
};
|
|
44306
|
+
const waterLakeLabelLayer = {
|
|
44307
|
+
id: uuid(),
|
|
44308
|
+
data: {
|
|
44309
|
+
source,
|
|
44310
|
+
layer: '"MapWaterLakeLabel"',
|
|
44311
|
+
},
|
|
44312
|
+
filter: `function() {
|
|
44313
|
+
const { display_class } = feature;
|
|
44353
44314
|
|
|
44354
|
-
|
|
44355
|
-
|
|
44356
|
-
|
|
44357
|
-
|
|
44315
|
+
if ($zoom >= 14) {
|
|
44316
|
+
return true;
|
|
44317
|
+
} else {
|
|
44318
|
+
return display_class <= 4;
|
|
44319
|
+
}
|
|
44320
|
+
}`,
|
|
44321
|
+
draw: {
|
|
44322
|
+
text: {
|
|
44323
|
+
text_source: 'name',
|
|
44324
|
+
font: {
|
|
44325
|
+
fill: '#0A80C4',
|
|
44326
|
+
size: '14px',
|
|
44327
|
+
stroke: { color: 'white', width: '3px' },
|
|
44358
44328
|
},
|
|
44359
|
-
}
|
|
44360
|
-
}
|
|
44361
|
-
}
|
|
44362
|
-
return defaultPOI;
|
|
44363
|
-
};
|
|
44364
|
-
const getPOITypeLayer = (texture) => {
|
|
44365
|
-
const typeLayer = {
|
|
44366
|
-
texture,
|
|
44367
|
-
sprite: 'base',
|
|
44368
|
-
size: '20px',
|
|
44369
|
-
placement: 'midpoint',
|
|
44329
|
+
},
|
|
44330
|
+
},
|
|
44370
44331
|
};
|
|
44371
|
-
|
|
44332
|
+
layers.push(layer, waterAreaLabelLayer, waterLakeLabelLayer);
|
|
44333
|
+
return layers;
|
|
44372
44334
|
};
|
|
44373
|
-
|
|
44374
|
-
|
|
44375
|
-
...getDefaultPOI(catId),
|
|
44376
|
-
}), {});
|
|
44377
|
-
const getPOILayers = (source) => {
|
|
44335
|
+
|
|
44336
|
+
const getWaterLinkLayers = (source) => {
|
|
44378
44337
|
const layers = [];
|
|
44338
|
+
const sublayers = {};
|
|
44339
|
+
const data = {
|
|
44340
|
+
source,
|
|
44341
|
+
layer: '"MapWaterLink"',
|
|
44342
|
+
};
|
|
44379
44343
|
const layer = {
|
|
44380
44344
|
id: uuid(),
|
|
44381
|
-
data
|
|
44382
|
-
|
|
44383
|
-
|
|
44345
|
+
data,
|
|
44346
|
+
};
|
|
44347
|
+
sublayers.geometry = {
|
|
44348
|
+
draw: {
|
|
44349
|
+
lines: {
|
|
44350
|
+
color: '#7DBEE4',
|
|
44351
|
+
width: 5,
|
|
44352
|
+
cap: 'round',
|
|
44353
|
+
join: 'round',
|
|
44354
|
+
},
|
|
44384
44355
|
},
|
|
44356
|
+
};
|
|
44357
|
+
sublayers.text = {
|
|
44358
|
+
filter: `function() {
|
|
44359
|
+
return $zoom >= 10;
|
|
44360
|
+
}`,
|
|
44385
44361
|
draw: {
|
|
44386
|
-
|
|
44387
|
-
|
|
44388
|
-
|
|
44389
|
-
|
|
44390
|
-
|
|
44391
|
-
|
|
44392
|
-
},
|
|
44362
|
+
text: {
|
|
44363
|
+
text_source: 'name',
|
|
44364
|
+
font: {
|
|
44365
|
+
fill: '#0A80C4',
|
|
44366
|
+
size: '14px',
|
|
44367
|
+
stroke: { color: 'white', width: '3px' },
|
|
44393
44368
|
},
|
|
44394
44369
|
},
|
|
44395
44370
|
},
|
|
44396
|
-
sublayers,
|
|
44397
44371
|
};
|
|
44372
|
+
layer.sublayers = sublayers;
|
|
44398
44373
|
layers.push(layer);
|
|
44399
44374
|
return layers;
|
|
44400
44375
|
};
|
|
44401
44376
|
|
|
44402
|
-
const
|
|
44403
|
-
const
|
|
44377
|
+
const getOceanAreaLayers = (source) => {
|
|
44378
|
+
const layers = [];
|
|
44379
|
+
const geometryLayer = {
|
|
44404
44380
|
id: uuid(),
|
|
44405
44381
|
data: {
|
|
44406
44382
|
source,
|
|
44407
|
-
layer: '"
|
|
44383
|
+
layer: '"MapOceanArea"',
|
|
44384
|
+
},
|
|
44385
|
+
draw: {
|
|
44386
|
+
polygons: {
|
|
44387
|
+
color: '#7DBEE4',
|
|
44388
|
+
},
|
|
44389
|
+
},
|
|
44390
|
+
};
|
|
44391
|
+
const textLayer = {
|
|
44392
|
+
id: uuid(),
|
|
44393
|
+
data: {
|
|
44394
|
+
source,
|
|
44395
|
+
layer: '"MapOceanAreaLabel"',
|
|
44408
44396
|
},
|
|
44409
|
-
filter: `function () {
|
|
44410
|
-
const { capital_order8, capital_order2, capital_order1, poi_name, priority } = feature;
|
|
44411
|
-
|
|
44412
|
-
if ($zoom >= 9 && $zoom < 13) {
|
|
44413
|
-
return priority < 8;
|
|
44414
|
-
}
|
|
44415
|
-
|
|
44416
|
-
if ($zoom <= 11) {
|
|
44417
|
-
return capital_order8 === 'Y';
|
|
44418
|
-
}
|
|
44419
|
-
|
|
44420
|
-
if ($zoom >= 15) {
|
|
44421
|
-
return capital_order2 !== 'Y';
|
|
44422
|
-
}
|
|
44423
|
-
|
|
44424
|
-
return true;
|
|
44425
|
-
}
|
|
44426
|
-
`,
|
|
44427
44397
|
draw: {
|
|
44428
44398
|
text: {
|
|
44429
|
-
text_source: '
|
|
44430
|
-
priority: `function () {
|
|
44431
|
-
const { priority } = feature;
|
|
44432
|
-
|
|
44433
|
-
if ($zoom <= 15) {
|
|
44434
|
-
return priority;
|
|
44435
|
-
}
|
|
44436
|
-
|
|
44437
|
-
return 1;
|
|
44438
|
-
}
|
|
44439
|
-
`,
|
|
44399
|
+
text_source: 'name',
|
|
44440
44400
|
font: {
|
|
44441
|
-
fill: '
|
|
44442
|
-
size:
|
|
44443
|
-
|
|
44444
|
-
|
|
44445
|
-
if (capital_order8 === 'Y') {
|
|
44446
|
-
return '16px';
|
|
44447
|
-
}
|
|
44448
|
-
|
|
44449
|
-
return '12px';
|
|
44450
|
-
}`,
|
|
44451
|
-
weight: `function() {
|
|
44452
|
-
const { capital_order2 } = feature;
|
|
44453
|
-
|
|
44454
|
-
if (capital_order2 === 'Y') {
|
|
44455
|
-
return 'bold';
|
|
44456
|
-
}
|
|
44457
|
-
|
|
44458
|
-
return 'normal';
|
|
44459
|
-
}`,
|
|
44460
|
-
stroke: {
|
|
44461
|
-
color: 'white',
|
|
44462
|
-
width: '2px',
|
|
44463
|
-
},
|
|
44401
|
+
fill: '#0A80C4',
|
|
44402
|
+
size: '18px',
|
|
44403
|
+
stroke: { color: 'white', width: '3px' },
|
|
44464
44404
|
},
|
|
44465
44405
|
},
|
|
44466
44406
|
},
|
|
44467
44407
|
};
|
|
44468
|
-
|
|
44408
|
+
layers.push(geometryLayer, textLayer);
|
|
44409
|
+
return layers;
|
|
44469
44410
|
};
|
|
44470
44411
|
|
|
44471
|
-
const
|
|
44472
|
-
const
|
|
44412
|
+
const getLanduseAreaLayers = (source) => {
|
|
44413
|
+
const layers = [];
|
|
44414
|
+
const geometryLayer = {
|
|
44473
44415
|
id: uuid(),
|
|
44474
44416
|
data: {
|
|
44475
44417
|
source,
|
|
44476
|
-
layer: '"
|
|
44418
|
+
layer: '"MapLanduseArea"',
|
|
44477
44419
|
},
|
|
44478
44420
|
draw: {
|
|
44479
|
-
|
|
44480
|
-
|
|
44481
|
-
|
|
44482
|
-
|
|
44483
|
-
|
|
44484
|
-
|
|
44485
|
-
|
|
44486
|
-
|
|
44487
|
-
|
|
44421
|
+
polygons: {
|
|
44422
|
+
interactive: true,
|
|
44423
|
+
color: `function() {
|
|
44424
|
+
const { feature_type } = feature;
|
|
44425
|
+
|
|
44426
|
+
switch (feature_type) {
|
|
44427
|
+
case '509998': {
|
|
44428
|
+
return '#ECD175';
|
|
44429
|
+
}
|
|
44430
|
+
|
|
44431
|
+
case '600102':
|
|
44432
|
+
case '900140': {
|
|
44433
|
+
return '#3E9A8C';
|
|
44434
|
+
}
|
|
44435
|
+
|
|
44436
|
+
case '900202':
|
|
44437
|
+
case '900130':
|
|
44438
|
+
case '900150':
|
|
44439
|
+
case '900103': {
|
|
44440
|
+
return '#96BE7D';
|
|
44441
|
+
}
|
|
44442
|
+
|
|
44443
|
+
case '9997010': {
|
|
44444
|
+
return null;
|
|
44445
|
+
}
|
|
44446
|
+
}
|
|
44447
|
+
}`,
|
|
44448
|
+
order: `function() {
|
|
44449
|
+
const { feature_type } = feature;
|
|
44450
|
+
|
|
44451
|
+
switch(feature_type) {
|
|
44452
|
+
case '900150':
|
|
44453
|
+
case '900130':
|
|
44454
|
+
case '509998': {
|
|
44455
|
+
return 300;
|
|
44456
|
+
}
|
|
44457
|
+
|
|
44458
|
+
default: {
|
|
44459
|
+
return 299;
|
|
44460
|
+
}
|
|
44461
|
+
}
|
|
44462
|
+
}`,
|
|
44488
44463
|
},
|
|
44489
44464
|
},
|
|
44490
44465
|
};
|
|
44491
|
-
|
|
44492
|
-
};
|
|
44493
|
-
|
|
44494
|
-
var ConditionTypes;
|
|
44495
|
-
(function (ConditionTypes) {
|
|
44496
|
-
ConditionTypes["traffic_signal"] = "traffic_signal";
|
|
44497
|
-
ConditionTypes["pedestrian_crossing"] = "pedestrian_crossing";
|
|
44498
|
-
ConditionTypes["physical"] = "physical";
|
|
44499
|
-
ConditionTypes["gate"] = "gate";
|
|
44500
|
-
})(ConditionTypes || (ConditionTypes = {}));
|
|
44501
|
-
|
|
44502
|
-
const getConditionLayers = (source) => {
|
|
44503
|
-
const sublayers = {};
|
|
44504
|
-
const layer = {
|
|
44466
|
+
const labelLayer = {
|
|
44505
44467
|
id: uuid(),
|
|
44506
44468
|
data: {
|
|
44507
44469
|
source,
|
|
44508
|
-
layer: '"
|
|
44470
|
+
layer: '"MapLanduseAreaLabel"',
|
|
44509
44471
|
},
|
|
44510
|
-
|
|
44511
|
-
|
|
44512
|
-
|
|
44513
|
-
|
|
44514
|
-
|
|
44472
|
+
filter: `function() {
|
|
44473
|
+
return $zoom >= 15;
|
|
44474
|
+
}`,
|
|
44475
|
+
draw: {
|
|
44476
|
+
text: {
|
|
44477
|
+
text_source: 'name',
|
|
44478
|
+
font: {
|
|
44479
|
+
size: '13px',
|
|
44480
|
+
fill: `function() {
|
|
44481
|
+
const { feature_type } = feature;
|
|
44515
44482
|
|
|
44516
|
-
|
|
44483
|
+
switch(feature_type) {
|
|
44484
|
+
case '509998': {
|
|
44485
|
+
return '#CD7F32';
|
|
44486
|
+
}
|
|
44517
44487
|
|
|
44518
|
-
|
|
44519
|
-
|
|
44520
|
-
|
|
44521
|
-
|
|
44522
|
-
|
|
44523
|
-
|
|
44524
|
-
placement: 'midpoint',
|
|
44488
|
+
default: {
|
|
44489
|
+
return '#00541F';
|
|
44490
|
+
}
|
|
44491
|
+
}
|
|
44492
|
+
}`,
|
|
44493
|
+
stroke: { color: 'white', width: '3px' },
|
|
44525
44494
|
},
|
|
44526
44495
|
},
|
|
44527
|
-
}
|
|
44528
|
-
}
|
|
44529
|
-
|
|
44530
|
-
return
|
|
44496
|
+
},
|
|
44497
|
+
};
|
|
44498
|
+
layers.push(geometryLayer, labelLayer);
|
|
44499
|
+
return layers;
|
|
44531
44500
|
};
|
|
44532
44501
|
|
|
44533
|
-
const
|
|
44534
|
-
const layer = '"MapRailroadLink"';
|
|
44502
|
+
const getBuildingLayers = (source) => {
|
|
44535
44503
|
const layers = [];
|
|
44536
44504
|
const data = {
|
|
44537
44505
|
source,
|
|
44538
|
-
layer,
|
|
44506
|
+
layer: '"MapBuildingECArea"',
|
|
44507
|
+
minzoom: 15,
|
|
44539
44508
|
};
|
|
44540
|
-
const
|
|
44509
|
+
const layer = {
|
|
44541
44510
|
id: uuid(),
|
|
44542
|
-
data
|
|
44543
|
-
|
|
44544
|
-
|
|
44545
|
-
|
|
44546
|
-
|
|
44547
|
-
|
|
44548
|
-
|
|
44549
|
-
|
|
44550
|
-
|
|
44551
|
-
|
|
44552
|
-
join: 'round',
|
|
44511
|
+
data,
|
|
44512
|
+
extruded: {
|
|
44513
|
+
draw: {
|
|
44514
|
+
polygons: {
|
|
44515
|
+
interactive: true,
|
|
44516
|
+
style: 'buildings',
|
|
44517
|
+
extrude: `function() {
|
|
44518
|
+
return $zoom >= 17;
|
|
44519
|
+
}`,
|
|
44520
|
+
},
|
|
44553
44521
|
},
|
|
44554
44522
|
},
|
|
44555
|
-
};
|
|
44556
|
-
const backLayer = {
|
|
44557
|
-
id: uuid(),
|
|
44558
|
-
data,
|
|
44559
44523
|
draw: {
|
|
44524
|
+
polygons: {
|
|
44525
|
+
color: '#DDB07B',
|
|
44526
|
+
height: { property: 'height' },
|
|
44527
|
+
},
|
|
44560
44528
|
lines: {
|
|
44561
|
-
|
|
44562
|
-
|
|
44529
|
+
color: '#DB933F',
|
|
44530
|
+
width: '2px',
|
|
44563
44531
|
cap: 'round',
|
|
44564
44532
|
join: 'round',
|
|
44565
44533
|
},
|
|
44566
44534
|
},
|
|
44567
44535
|
};
|
|
44568
|
-
layers.push(
|
|
44536
|
+
layers.push(layer);
|
|
44569
44537
|
return layers;
|
|
44570
44538
|
};
|
|
44571
44539
|
|
|
44572
|
-
const
|
|
44540
|
+
const getFacilityAreaLayers = (source) => {
|
|
44573
44541
|
const layers = [];
|
|
44574
|
-
const
|
|
44542
|
+
const geometryLayer = {
|
|
44575
44543
|
id: uuid(),
|
|
44576
44544
|
data: {
|
|
44577
44545
|
source,
|
|
44578
|
-
layer: '"
|
|
44546
|
+
layer: '"MapFacilityArea"',
|
|
44579
44547
|
},
|
|
44580
44548
|
draw: {
|
|
44581
44549
|
polygons: {
|
|
44582
|
-
color:
|
|
44550
|
+
color: `function() {
|
|
44551
|
+
const { feature_type } = feature;
|
|
44552
|
+
|
|
44553
|
+
switch (feature_type) {
|
|
44554
|
+
case '2000408': {
|
|
44555
|
+
return '#DBBAC4';
|
|
44556
|
+
}
|
|
44557
|
+
|
|
44558
|
+
case '1900403': {
|
|
44559
|
+
return '#B6C3C7';
|
|
44560
|
+
}
|
|
44561
|
+
|
|
44562
|
+
case '1907403': {
|
|
44563
|
+
return '#A3B9C0';
|
|
44564
|
+
}
|
|
44565
|
+
|
|
44566
|
+
case '2000123': {
|
|
44567
|
+
return '#E4BA7D';
|
|
44568
|
+
}
|
|
44569
|
+
|
|
44570
|
+
case '2000124': {
|
|
44571
|
+
return '#BFE6E3';
|
|
44572
|
+
}
|
|
44573
|
+
|
|
44574
|
+
case '2000200': {
|
|
44575
|
+
return '#A0A9A8';
|
|
44576
|
+
}
|
|
44577
|
+
|
|
44578
|
+
case '2000403': {
|
|
44579
|
+
return '#AF7136';
|
|
44580
|
+
}
|
|
44581
|
+
|
|
44582
|
+
case '2000420': {
|
|
44583
|
+
return '#89AC76';
|
|
44584
|
+
}
|
|
44585
|
+
|
|
44586
|
+
case '2000457': {
|
|
44587
|
+
return '#9494C0';
|
|
44588
|
+
}
|
|
44589
|
+
|
|
44590
|
+
default: {
|
|
44591
|
+
return '#E1D4D4';
|
|
44592
|
+
}
|
|
44593
|
+
}
|
|
44594
|
+
}`,
|
|
44595
|
+
order: `function() {
|
|
44596
|
+
const { feature_type } = feature;
|
|
44597
|
+
|
|
44598
|
+
switch (feature_type) {
|
|
44599
|
+
case '1907403': {
|
|
44600
|
+
return 301;
|
|
44601
|
+
}
|
|
44602
|
+
|
|
44603
|
+
default: {
|
|
44604
|
+
return 300;
|
|
44605
|
+
}
|
|
44606
|
+
}
|
|
44607
|
+
}`,
|
|
44583
44608
|
},
|
|
44584
44609
|
lines: {
|
|
44585
|
-
color: '#
|
|
44586
|
-
width:
|
|
44610
|
+
color: '#857F7F',
|
|
44611
|
+
width: '2px',
|
|
44587
44612
|
cap: 'round',
|
|
44588
44613
|
join: 'round',
|
|
44589
44614
|
},
|
|
44590
44615
|
},
|
|
44591
44616
|
};
|
|
44592
|
-
const
|
|
44617
|
+
const labelLayer = {
|
|
44593
44618
|
id: uuid(),
|
|
44594
44619
|
data: {
|
|
44595
44620
|
source,
|
|
44596
|
-
layer: '"
|
|
44621
|
+
layer: '"MapFacilityAreaLabel"',
|
|
44597
44622
|
},
|
|
44598
|
-
filter: `function() {
|
|
44599
|
-
const { display_class } = feature;
|
|
44600
|
-
|
|
44601
|
-
if ($zoom >= 14) {
|
|
44602
|
-
return true;
|
|
44603
|
-
} else {
|
|
44604
|
-
return display_class <= 4;
|
|
44605
|
-
}
|
|
44606
|
-
}`,
|
|
44607
44623
|
draw: {
|
|
44608
44624
|
text: {
|
|
44609
44625
|
text_source: 'name',
|
|
44610
44626
|
font: {
|
|
44611
|
-
fill:
|
|
44612
|
-
|
|
44613
|
-
stroke: { color: 'white', width: '3px' },
|
|
44614
|
-
},
|
|
44615
|
-
},
|
|
44616
|
-
},
|
|
44617
|
-
};
|
|
44618
|
-
const waterLakeLabelLayer = {
|
|
44619
|
-
id: uuid(),
|
|
44620
|
-
data: {
|
|
44621
|
-
source,
|
|
44622
|
-
layer: '"MapWaterLakeLabel"',
|
|
44623
|
-
},
|
|
44624
|
-
filter: `function() {
|
|
44625
|
-
const { display_class } = feature;
|
|
44627
|
+
fill: `function() {
|
|
44628
|
+
const { feature_type } = feature;
|
|
44626
44629
|
|
|
44627
|
-
|
|
44628
|
-
|
|
44629
|
-
|
|
44630
|
-
|
|
44631
|
-
|
|
44632
|
-
|
|
44633
|
-
|
|
44634
|
-
|
|
44635
|
-
|
|
44636
|
-
|
|
44637
|
-
|
|
44638
|
-
|
|
44639
|
-
|
|
44630
|
+
switch(feature_type) {
|
|
44631
|
+
case '1900403':
|
|
44632
|
+
case '1907403': {
|
|
44633
|
+
return '#256D7B';
|
|
44634
|
+
}
|
|
44635
|
+
|
|
44636
|
+
case '2000420':
|
|
44637
|
+
case '2000460':
|
|
44638
|
+
case '2000123': {
|
|
44639
|
+
return '#00541F';
|
|
44640
|
+
}
|
|
44641
|
+
|
|
44642
|
+
case '2000408': {
|
|
44643
|
+
return '#5E2129';
|
|
44644
|
+
}
|
|
44645
|
+
|
|
44646
|
+
case '2000124': {
|
|
44647
|
+
return '#3E5F8A';
|
|
44648
|
+
}
|
|
44649
|
+
|
|
44650
|
+
case '2000200': {
|
|
44651
|
+
return '#464451';
|
|
44652
|
+
}
|
|
44653
|
+
|
|
44654
|
+
case '2000403': {
|
|
44655
|
+
return '#B03F35';
|
|
44656
|
+
}
|
|
44657
|
+
|
|
44658
|
+
case '2000457': {
|
|
44659
|
+
return '#6A5ACD';
|
|
44660
|
+
}
|
|
44661
|
+
|
|
44662
|
+
case '1700215':
|
|
44663
|
+
case '900159':
|
|
44664
|
+
case '900158': {
|
|
44665
|
+
return '#474A51';
|
|
44666
|
+
}
|
|
44667
|
+
|
|
44668
|
+
default: {
|
|
44669
|
+
return black;
|
|
44670
|
+
}
|
|
44671
|
+
}
|
|
44672
|
+
}`,
|
|
44673
|
+
size: '12px',
|
|
44674
|
+
stroke: {
|
|
44675
|
+
color: 'white',
|
|
44676
|
+
width: '3px',
|
|
44677
|
+
},
|
|
44640
44678
|
},
|
|
44641
44679
|
},
|
|
44642
44680
|
},
|
|
44643
44681
|
};
|
|
44644
|
-
layers.push(
|
|
44682
|
+
layers.push(geometryLayer, labelLayer);
|
|
44645
44683
|
return layers;
|
|
44646
44684
|
};
|
|
44647
44685
|
|
|
44648
|
-
const
|
|
44649
|
-
|
|
44686
|
+
const adminAreaLayerName = '"MapAdminArea"';
|
|
44687
|
+
|
|
44688
|
+
const getAdminAreaLayers = (source) => {
|
|
44689
|
+
const layers = [];
|
|
44690
|
+
const data = {
|
|
44691
|
+
source,
|
|
44692
|
+
layer: adminAreaLayerName,
|
|
44693
|
+
};
|
|
44650
44694
|
const layer = {
|
|
44651
44695
|
id: uuid(),
|
|
44652
|
-
data
|
|
44653
|
-
|
|
44654
|
-
|
|
44696
|
+
data,
|
|
44697
|
+
draw: {
|
|
44698
|
+
polygons: {
|
|
44699
|
+
color: '#D3D2CF',
|
|
44700
|
+
},
|
|
44655
44701
|
},
|
|
44656
44702
|
};
|
|
44657
|
-
|
|
44703
|
+
const borderRegionLayer = {
|
|
44704
|
+
id: uuid(),
|
|
44705
|
+
data,
|
|
44706
|
+
filter: `function() {
|
|
44707
|
+
const { type } = feature;
|
|
44708
|
+
|
|
44709
|
+
const isFilter = type === 'R';
|
|
44710
|
+
|
|
44711
|
+
return isFilter;
|
|
44712
|
+
}`,
|
|
44658
44713
|
draw: {
|
|
44659
44714
|
lines: {
|
|
44660
|
-
color: '#
|
|
44661
|
-
width:
|
|
44715
|
+
color: '#696969',
|
|
44716
|
+
width: '1px',
|
|
44662
44717
|
cap: 'round',
|
|
44663
44718
|
join: 'round',
|
|
44664
44719
|
},
|
|
44665
44720
|
},
|
|
44666
44721
|
};
|
|
44667
|
-
|
|
44722
|
+
const borderDistrictLayer = {
|
|
44723
|
+
id: uuid(),
|
|
44724
|
+
data,
|
|
44668
44725
|
filter: `function() {
|
|
44669
|
-
|
|
44726
|
+
const { type } = feature;
|
|
44727
|
+
|
|
44728
|
+
const isFilter = type === 'D' && $zoom >= 12;
|
|
44729
|
+
|
|
44730
|
+
return isFilter;
|
|
44670
44731
|
}`,
|
|
44671
44732
|
draw: {
|
|
44672
|
-
|
|
44673
|
-
|
|
44674
|
-
|
|
44675
|
-
|
|
44676
|
-
|
|
44677
|
-
|
|
44678
|
-
},
|
|
44733
|
+
lines: {
|
|
44734
|
+
color: '#696969',
|
|
44735
|
+
dash: [4, 7],
|
|
44736
|
+
width: '1px',
|
|
44737
|
+
cap: 'round',
|
|
44738
|
+
join: 'round',
|
|
44679
44739
|
},
|
|
44680
44740
|
},
|
|
44681
44741
|
};
|
|
44682
|
-
layer
|
|
44683
|
-
return
|
|
44742
|
+
layers.push(layer, borderRegionLayer, borderDistrictLayer);
|
|
44743
|
+
return layers;
|
|
44684
44744
|
};
|
|
44685
44745
|
|
|
44686
|
-
const
|
|
44687
|
-
const
|
|
44688
|
-
|
|
44689
|
-
|
|
44690
|
-
|
|
44691
|
-
layer: '"MapOceanArea"',
|
|
44692
|
-
},
|
|
44693
|
-
draw: {
|
|
44694
|
-
polygons: {
|
|
44695
|
-
color: '#7DBEE4',
|
|
44696
|
-
},
|
|
44697
|
-
},
|
|
44746
|
+
const getNatureFieldLayers = () => {
|
|
44747
|
+
const layers = [];
|
|
44748
|
+
const data = {
|
|
44749
|
+
source: exports.TangramSourceNames.NATURE_TILE,
|
|
44750
|
+
layer: '"MapNatureField"',
|
|
44698
44751
|
};
|
|
44699
|
-
const
|
|
44752
|
+
const layer = {
|
|
44700
44753
|
id: uuid(),
|
|
44701
|
-
data
|
|
44702
|
-
source,
|
|
44703
|
-
layer: '"MapOceanAreaLabel"',
|
|
44704
|
-
},
|
|
44754
|
+
data,
|
|
44705
44755
|
draw: {
|
|
44706
|
-
|
|
44707
|
-
|
|
44708
|
-
|
|
44709
|
-
fill: '#0A80C4',
|
|
44710
|
-
size: '18px',
|
|
44711
|
-
stroke: { color: 'white', width: '3px' },
|
|
44712
|
-
},
|
|
44756
|
+
polygons: {
|
|
44757
|
+
interactive: true,
|
|
44758
|
+
color: '#EBEEC7',
|
|
44713
44759
|
},
|
|
44714
44760
|
},
|
|
44715
44761
|
};
|
|
44716
|
-
|
|
44762
|
+
layers.push(layer);
|
|
44763
|
+
return layers;
|
|
44717
44764
|
};
|
|
44718
44765
|
|
|
44719
|
-
const
|
|
44720
|
-
|
|
44721
|
-
|
|
44722
|
-
|
|
44723
|
-
|
|
44724
|
-
|
|
44725
|
-
|
|
44726
|
-
|
|
44727
|
-
|
|
44728
|
-
|
|
44729
|
-
|
|
44730
|
-
|
|
44731
|
-
|
|
44732
|
-
|
|
44733
|
-
|
|
44766
|
+
const linkLayerName = '"Link"';
|
|
44767
|
+
const zLvlOrders = [
|
|
44768
|
+
'-1.0',
|
|
44769
|
+
'-0.5',
|
|
44770
|
+
'-0.3',
|
|
44771
|
+
'0.0',
|
|
44772
|
+
'0.3',
|
|
44773
|
+
'0.5',
|
|
44774
|
+
'0.7',
|
|
44775
|
+
'1.0',
|
|
44776
|
+
'1.5',
|
|
44777
|
+
'2.0',
|
|
44778
|
+
];
|
|
44779
|
+
const functionInterval = [[5], [3, 4], [1, 2]];
|
|
44780
|
+
const colorFunction = `function() {
|
|
44781
|
+
const { functional_class, tunnel, tollway } = feature;
|
|
44734
44782
|
|
|
44735
|
-
|
|
44736
|
-
case '900202': {
|
|
44737
|
-
return '#96BE7D';
|
|
44738
|
-
}
|
|
44783
|
+
const alpha = tunnel ? 0.89 : 1;
|
|
44739
44784
|
|
|
44740
|
-
|
|
44741
|
-
|
|
44742
|
-
|
|
44743
|
-
|
|
44744
|
-
}`,
|
|
44745
|
-
},
|
|
44746
|
-
},
|
|
44747
|
-
};
|
|
44748
|
-
layers.push(geometryLayer);
|
|
44749
|
-
break;
|
|
44750
|
-
}
|
|
44751
|
-
default: {
|
|
44752
|
-
const geometryLayer = {
|
|
44753
|
-
id: uuid(),
|
|
44754
|
-
data: {
|
|
44755
|
-
source,
|
|
44756
|
-
layer: '"MapLanduseArea"',
|
|
44757
|
-
},
|
|
44758
|
-
draw: {
|
|
44759
|
-
polygons: {
|
|
44760
|
-
interactive: true,
|
|
44761
|
-
color: `function() {
|
|
44762
|
-
const { feature_type } = feature;
|
|
44785
|
+
const getRGB = (hex, alpha) => {
|
|
44786
|
+
const r = +(parseInt(hex.slice(1, 3), 16) / 255).toFixed(2);
|
|
44787
|
+
const g = +(parseInt(hex.slice(3, 5), 16) / 255).toFixed(2);
|
|
44788
|
+
const b = +(parseInt(hex.slice(5, 7), 16) / 255).toFixed(2);
|
|
44763
44789
|
|
|
44764
|
-
|
|
44765
|
-
|
|
44766
|
-
return '#ECD175';
|
|
44767
|
-
}
|
|
44790
|
+
return [r, g, b, alpha];
|
|
44791
|
+
}
|
|
44768
44792
|
|
|
44769
|
-
|
|
44770
|
-
|
|
44771
|
-
|
|
44772
|
-
}
|
|
44793
|
+
if (tollway) {
|
|
44794
|
+
return '#D72740';
|
|
44795
|
+
}
|
|
44773
44796
|
|
|
44774
|
-
|
|
44775
|
-
|
|
44776
|
-
|
|
44777
|
-
|
|
44778
|
-
return '#96BE7D';
|
|
44779
|
-
}
|
|
44797
|
+
switch (functional_class) {
|
|
44798
|
+
case 1:
|
|
44799
|
+
case 2: {
|
|
44800
|
+
const color = getRGB('#D1747F', alpha);
|
|
44780
44801
|
|
|
44781
|
-
|
|
44782
|
-
|
|
44783
|
-
}
|
|
44784
|
-
}
|
|
44785
|
-
}`,
|
|
44786
|
-
order: `function() {
|
|
44787
|
-
const { feature_type } = feature;
|
|
44802
|
+
return color;
|
|
44803
|
+
}
|
|
44788
44804
|
|
|
44789
|
-
|
|
44790
|
-
|
|
44791
|
-
|
|
44792
|
-
case '509998': {
|
|
44793
|
-
return 300;
|
|
44794
|
-
}
|
|
44805
|
+
case 3:
|
|
44806
|
+
case 4: {
|
|
44807
|
+
const color = getRGB('#B1A7AA', alpha);
|
|
44795
44808
|
|
|
44796
|
-
|
|
44797
|
-
|
|
44798
|
-
}
|
|
44799
|
-
}
|
|
44800
|
-
}`,
|
|
44801
|
-
},
|
|
44802
|
-
},
|
|
44803
|
-
};
|
|
44804
|
-
const labelLayer = {
|
|
44805
|
-
id: uuid(),
|
|
44806
|
-
data: {
|
|
44807
|
-
source,
|
|
44808
|
-
layer: '"MapLanduseAreaLabel"',
|
|
44809
|
-
},
|
|
44810
|
-
filter: `function() {
|
|
44811
|
-
return $zoom >= 15;
|
|
44812
|
-
}`,
|
|
44813
|
-
draw: {
|
|
44814
|
-
text: {
|
|
44815
|
-
text_source: 'name',
|
|
44816
|
-
font: {
|
|
44817
|
-
size: '13px',
|
|
44818
|
-
fill: `function() {
|
|
44819
|
-
const { feature_type } = feature;
|
|
44809
|
+
return color;
|
|
44810
|
+
}
|
|
44820
44811
|
|
|
44821
|
-
|
|
44822
|
-
|
|
44823
|
-
return '#CD7F32';
|
|
44824
|
-
}
|
|
44812
|
+
case 5: {
|
|
44813
|
+
const color = getRGB('#D5CEC3', alpha);
|
|
44825
44814
|
|
|
44826
|
-
|
|
44827
|
-
|
|
44828
|
-
|
|
44829
|
-
|
|
44830
|
-
|
|
44831
|
-
|
|
44832
|
-
|
|
44833
|
-
|
|
44834
|
-
|
|
44835
|
-
|
|
44836
|
-
|
|
44815
|
+
return color;
|
|
44816
|
+
}
|
|
44817
|
+
}
|
|
44818
|
+
}`;
|
|
44819
|
+
const widthFunction = `function() {
|
|
44820
|
+
const { functional_class, road_number } = feature;
|
|
44821
|
+
|
|
44822
|
+
const getScale = () => {
|
|
44823
|
+
if ($zoom <= 15 && $zoom >= 14) { return 7; }
|
|
44824
|
+
|
|
44825
|
+
if ($zoom <= 13 && $zoom >= 12) { return 9; }
|
|
44826
|
+
|
|
44827
|
+
if ($zoom <= 5) { return 400; }
|
|
44828
|
+
|
|
44829
|
+
if ($zoom <= 7) { return 200; }
|
|
44830
|
+
|
|
44831
|
+
if ($zoom < 12) { return 50; }
|
|
44832
|
+
|
|
44833
|
+
return 1;
|
|
44834
|
+
}
|
|
44835
|
+
|
|
44836
|
+
const scale = getScale();
|
|
44837
|
+
|
|
44838
|
+
switch(functional_class) {
|
|
44839
|
+
case 1:
|
|
44840
|
+
case 2: {
|
|
44841
|
+
return 8 * scale;
|
|
44842
|
+
}
|
|
44843
|
+
|
|
44844
|
+
case 3:
|
|
44845
|
+
case 4: {
|
|
44846
|
+
return 7 * scale;
|
|
44847
|
+
}
|
|
44848
|
+
|
|
44849
|
+
case 5: {
|
|
44850
|
+
if (Boolean(road_number)) {
|
|
44851
|
+
return 7 * scale;
|
|
44852
|
+
}
|
|
44853
|
+
|
|
44854
|
+
return 6;
|
|
44855
|
+
}
|
|
44856
|
+
}
|
|
44857
|
+
}`;
|
|
44858
|
+
const outlineColorFunction = `function() {
|
|
44859
|
+
const { functional_class, access_id, tollway } = feature;
|
|
44860
|
+
|
|
44861
|
+
if (tollway) {
|
|
44862
|
+
return '#B9263B';
|
|
44863
|
+
}
|
|
44864
|
+
|
|
44865
|
+
switch(functional_class) {
|
|
44866
|
+
case 5: {
|
|
44867
|
+
return '#989898';
|
|
44868
|
+
}
|
|
44869
|
+
|
|
44870
|
+
case 3:
|
|
44871
|
+
case 4: {
|
|
44872
|
+
return '#8F6E78';
|
|
44873
|
+
}
|
|
44874
|
+
|
|
44875
|
+
case 1:
|
|
44876
|
+
case 2: {
|
|
44877
|
+
return '#9A414B';
|
|
44878
|
+
}
|
|
44879
|
+
}
|
|
44880
|
+
}`;
|
|
44881
|
+
const outlineWidthFunction = `function() {
|
|
44882
|
+
const { functional_class, access_id } = feature;
|
|
44883
|
+
|
|
44884
|
+
switch(functional_class) {
|
|
44885
|
+
case 5: {
|
|
44886
|
+
switch (access_id) {
|
|
44887
|
+
case 32: {
|
|
44888
|
+
return 0;
|
|
44889
|
+
}
|
|
44890
|
+
|
|
44891
|
+
default: {
|
|
44892
|
+
return 1;
|
|
44837
44893
|
}
|
|
44894
|
+
}
|
|
44838
44895
|
}
|
|
44839
|
-
return layers;
|
|
44840
|
-
};
|
|
44841
44896
|
|
|
44842
|
-
|
|
44897
|
+
default: {
|
|
44898
|
+
return 1;
|
|
44899
|
+
}
|
|
44900
|
+
}
|
|
44901
|
+
}`;
|
|
44902
|
+
|
|
44903
|
+
const getLinkLayers = (source) => {
|
|
44843
44904
|
const layers = [];
|
|
44844
44905
|
const data = {
|
|
44845
44906
|
source,
|
|
44846
|
-
layer:
|
|
44847
|
-
minzoom: 15,
|
|
44907
|
+
layer: linkLayerName,
|
|
44848
44908
|
};
|
|
44849
|
-
const
|
|
44909
|
+
const roadNumberLayer = {
|
|
44850
44910
|
id: uuid(),
|
|
44851
44911
|
data,
|
|
44852
|
-
extruded: {
|
|
44853
|
-
draw: {
|
|
44854
|
-
polygons: {
|
|
44855
|
-
interactive: true,
|
|
44856
|
-
style: 'buildings',
|
|
44857
|
-
extrude: `function() {
|
|
44858
|
-
return $zoom >= 17;
|
|
44859
|
-
}`,
|
|
44860
|
-
},
|
|
44861
|
-
},
|
|
44862
|
-
},
|
|
44863
44912
|
draw: {
|
|
44864
|
-
|
|
44865
|
-
|
|
44866
|
-
|
|
44867
|
-
|
|
44868
|
-
|
|
44869
|
-
|
|
44870
|
-
|
|
44871
|
-
|
|
44872
|
-
|
|
44913
|
+
text: {
|
|
44914
|
+
text_source: 'road_number',
|
|
44915
|
+
font: {
|
|
44916
|
+
fill: '#181bff',
|
|
44917
|
+
size: '16px',
|
|
44918
|
+
weight: 'bold',
|
|
44919
|
+
underline: true,
|
|
44920
|
+
background: {
|
|
44921
|
+
color: 'black',
|
|
44922
|
+
},
|
|
44923
|
+
},
|
|
44873
44924
|
},
|
|
44874
44925
|
},
|
|
44875
44926
|
};
|
|
44876
|
-
layers.push(
|
|
44877
|
-
|
|
44878
|
-
|
|
44879
|
-
|
|
44880
|
-
|
|
44881
|
-
|
|
44882
|
-
|
|
44883
|
-
id: uuid(),
|
|
44884
|
-
data: {
|
|
44885
|
-
source,
|
|
44886
|
-
layer: '"MapFacilityArea"',
|
|
44927
|
+
layers.push(roadNumberLayer);
|
|
44928
|
+
const text = {
|
|
44929
|
+
text_source: 'street_name',
|
|
44930
|
+
font: {
|
|
44931
|
+
fill: 'black',
|
|
44932
|
+
size: '14px',
|
|
44933
|
+
stroke: { color: 'white', width: '3px' },
|
|
44887
44934
|
},
|
|
44888
|
-
|
|
44889
|
-
|
|
44890
|
-
|
|
44891
|
-
|
|
44892
|
-
|
|
44893
|
-
switch (feature_type) {
|
|
44894
|
-
case '2000408': {
|
|
44895
|
-
return '#DBBAC4';
|
|
44896
|
-
}
|
|
44897
|
-
|
|
44898
|
-
case '1900403': {
|
|
44899
|
-
return '#B6C3C7';
|
|
44900
|
-
}
|
|
44901
|
-
|
|
44902
|
-
case '1907403': {
|
|
44903
|
-
return '#A3B9C0';
|
|
44904
|
-
}
|
|
44905
|
-
|
|
44906
|
-
case '2000123': {
|
|
44907
|
-
return '#E4BA7D';
|
|
44908
|
-
}
|
|
44909
|
-
|
|
44910
|
-
case '2000124': {
|
|
44911
|
-
return '#BFE6E3';
|
|
44912
|
-
}
|
|
44913
|
-
|
|
44914
|
-
case '2000200': {
|
|
44915
|
-
return '#A0A9A8';
|
|
44916
|
-
}
|
|
44917
|
-
|
|
44918
|
-
case '2000403': {
|
|
44919
|
-
return '#AF7136';
|
|
44920
|
-
}
|
|
44921
|
-
|
|
44922
|
-
case '2000420': {
|
|
44923
|
-
return '#89AC76';
|
|
44924
|
-
}
|
|
44925
|
-
|
|
44926
|
-
case '2000457': {
|
|
44927
|
-
return '#9494C0';
|
|
44928
|
-
}
|
|
44929
|
-
|
|
44930
|
-
default: {
|
|
44931
|
-
return '#E1D4D4';
|
|
44932
|
-
}
|
|
44933
|
-
}
|
|
44934
|
-
}`,
|
|
44935
|
-
order: `function() {
|
|
44936
|
-
const { feature_type } = feature;
|
|
44935
|
+
};
|
|
44936
|
+
zLvlOrders.forEach((zLvl) => {
|
|
44937
|
+
const filter = `function() {
|
|
44938
|
+
const { z_lvl = '0.0' } = feature;
|
|
44937
44939
|
|
|
44938
|
-
|
|
44939
|
-
case '1907403': {
|
|
44940
|
-
return 301;
|
|
44941
|
-
}
|
|
44940
|
+
const isFilter = z_lvl === '${zLvl}';
|
|
44942
44941
|
|
|
44943
|
-
|
|
44944
|
-
|
|
44945
|
-
|
|
44946
|
-
|
|
44947
|
-
|
|
44942
|
+
return isFilter;
|
|
44943
|
+
}`;
|
|
44944
|
+
const getBaseLayerDraw = () => ({
|
|
44945
|
+
text,
|
|
44946
|
+
lines: {
|
|
44947
|
+
color: colorFunction,
|
|
44948
|
+
width: widthFunction,
|
|
44949
|
+
cap: 'round',
|
|
44950
|
+
join: 'round',
|
|
44948
44951
|
},
|
|
44952
|
+
});
|
|
44953
|
+
const getBorderLayerDraw = () => ({
|
|
44949
44954
|
lines: {
|
|
44950
|
-
color:
|
|
44951
|
-
width:
|
|
44955
|
+
color: colorFunction,
|
|
44956
|
+
width: widthFunction,
|
|
44952
44957
|
cap: 'round',
|
|
44953
44958
|
join: 'round',
|
|
44959
|
+
outline: {
|
|
44960
|
+
color: outlineColorFunction,
|
|
44961
|
+
width: outlineWidthFunction,
|
|
44962
|
+
},
|
|
44954
44963
|
},
|
|
44955
|
-
}
|
|
44956
|
-
|
|
44957
|
-
|
|
44958
|
-
|
|
44959
|
-
|
|
44960
|
-
|
|
44961
|
-
|
|
44962
|
-
|
|
44963
|
-
|
|
44964
|
-
|
|
44965
|
-
text_source: 'name',
|
|
44966
|
-
font: {
|
|
44967
|
-
fill: `function() {
|
|
44968
|
-
const { feature_type } = feature;
|
|
44969
|
-
|
|
44970
|
-
switch(feature_type) {
|
|
44971
|
-
case '1900403':
|
|
44972
|
-
case '1907403': {
|
|
44973
|
-
return '#256D7B';
|
|
44974
|
-
}
|
|
44975
|
-
|
|
44976
|
-
case '2000420':
|
|
44977
|
-
case '2000460':
|
|
44978
|
-
case '2000123': {
|
|
44979
|
-
return '#00541F';
|
|
44980
|
-
}
|
|
44981
|
-
|
|
44982
|
-
case '2000408': {
|
|
44983
|
-
return '#5E2129';
|
|
44984
|
-
}
|
|
44985
|
-
|
|
44986
|
-
case '2000124': {
|
|
44987
|
-
return '#3E5F8A';
|
|
44988
|
-
}
|
|
44989
|
-
|
|
44990
|
-
case '2000200': {
|
|
44991
|
-
return '#464451';
|
|
44992
|
-
}
|
|
44993
|
-
|
|
44994
|
-
case '2000403': {
|
|
44995
|
-
return '#B03F35';
|
|
44996
|
-
}
|
|
44964
|
+
});
|
|
44965
|
+
switch (zLvl) {
|
|
44966
|
+
case '0.0': {
|
|
44967
|
+
functionInterval.forEach((functionClasses) => {
|
|
44968
|
+
functionClasses.forEach((functionClass) => {
|
|
44969
|
+
const baseLayer = {
|
|
44970
|
+
id: uuid(),
|
|
44971
|
+
data,
|
|
44972
|
+
filter: `function() {
|
|
44973
|
+
const { functional_class, z_lvl = '0.0' } = feature;
|
|
44997
44974
|
|
|
44998
|
-
|
|
44999
|
-
return '#6A5ACD';
|
|
45000
|
-
}
|
|
44975
|
+
const isFilter = z_lvl === '${zLvl}' && functional_class === ${functionClass};
|
|
45001
44976
|
|
|
45002
|
-
|
|
45003
|
-
|
|
45004
|
-
|
|
45005
|
-
|
|
45006
|
-
|
|
44977
|
+
return isFilter;
|
|
44978
|
+
}`,
|
|
44979
|
+
draw: getBaseLayerDraw(),
|
|
44980
|
+
sublayers: {
|
|
44981
|
+
construction: {
|
|
44982
|
+
filter: `function() {
|
|
44983
|
+
return global.links.getIsConstruction(feature);
|
|
44984
|
+
}`,
|
|
44985
|
+
draw: {
|
|
44986
|
+
lines: {
|
|
44987
|
+
width: 3,
|
|
44988
|
+
color: '#9AA096',
|
|
44989
|
+
dash: [2, 1],
|
|
44990
|
+
},
|
|
44991
|
+
},
|
|
44992
|
+
},
|
|
44993
|
+
functionalClassAccessId32: {
|
|
44994
|
+
filter: `function() {
|
|
44995
|
+
return global.links.getIsFunctionalClass(feature);
|
|
44996
|
+
}`,
|
|
44997
|
+
draw: {
|
|
44998
|
+
lines: {
|
|
44999
|
+
width: 2,
|
|
45000
|
+
color: '#9AA096',
|
|
45001
|
+
dash: [2, 1],
|
|
45002
|
+
},
|
|
45003
|
+
},
|
|
45004
|
+
},
|
|
45005
|
+
lowMobility: {
|
|
45006
|
+
filter: `function() {
|
|
45007
|
+
return global.links.getIsLowMobility(feature);
|
|
45008
|
+
}`,
|
|
45009
|
+
draw: {
|
|
45010
|
+
lines: {
|
|
45011
|
+
width: 4,
|
|
45012
|
+
},
|
|
45013
|
+
},
|
|
45014
|
+
},
|
|
45015
|
+
},
|
|
45016
|
+
};
|
|
45017
|
+
const borderLayer = {
|
|
45018
|
+
id: uuid(),
|
|
45019
|
+
data,
|
|
45020
|
+
filter: `function() {
|
|
45021
|
+
const { functional_class, z_lvl = '0.0' } = feature;
|
|
45007
45022
|
|
|
45008
|
-
|
|
45009
|
-
|
|
45010
|
-
|
|
45023
|
+
const isFilter = z_lvl === '${zLvl}' && functional_class === ${functionClass} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);
|
|
45024
|
+
|
|
45025
|
+
return isFilter;
|
|
45026
|
+
}`,
|
|
45027
|
+
draw: getBorderLayerDraw(),
|
|
45028
|
+
sublayers: {
|
|
45029
|
+
lowMobility: {
|
|
45030
|
+
filter: `function() {
|
|
45031
|
+
return global.links.getIsLowMobility(feature);
|
|
45032
|
+
}`,
|
|
45033
|
+
draw: {
|
|
45034
|
+
lines: {
|
|
45035
|
+
width: 4,
|
|
45036
|
+
},
|
|
45037
|
+
},
|
|
45038
|
+
},
|
|
45039
|
+
},
|
|
45040
|
+
};
|
|
45041
|
+
layers.push(baseLayer, borderLayer);
|
|
45042
|
+
});
|
|
45043
|
+
});
|
|
45044
|
+
break;
|
|
45011
45045
|
}
|
|
45012
|
-
|
|
45013
|
-
|
|
45014
|
-
|
|
45015
|
-
|
|
45016
|
-
|
|
45017
|
-
|
|
45018
|
-
}
|
|
45019
|
-
|
|
45020
|
-
|
|
45021
|
-
|
|
45022
|
-
|
|
45046
|
+
default: {
|
|
45047
|
+
const baseLayer = {
|
|
45048
|
+
id: uuid(),
|
|
45049
|
+
data,
|
|
45050
|
+
filter,
|
|
45051
|
+
draw: getBaseLayerDraw(),
|
|
45052
|
+
};
|
|
45053
|
+
const borderLayer = {
|
|
45054
|
+
id: uuid(),
|
|
45055
|
+
data,
|
|
45056
|
+
filter,
|
|
45057
|
+
draw: getBorderLayerDraw(),
|
|
45058
|
+
};
|
|
45059
|
+
layers.push(baseLayer, borderLayer);
|
|
45060
|
+
}
|
|
45061
|
+
}
|
|
45062
|
+
});
|
|
45023
45063
|
return layers;
|
|
45024
45064
|
};
|
|
45025
45065
|
|
|
45026
|
-
const
|
|
45027
|
-
|
|
45028
|
-
const getAdminAreaLayers = (source) => {
|
|
45066
|
+
const getNatureForestLayers = () => {
|
|
45029
45067
|
const layers = [];
|
|
45030
45068
|
const data = {
|
|
45031
|
-
source,
|
|
45032
|
-
layer:
|
|
45069
|
+
source: exports.TangramSourceNames.NATURE_TILE,
|
|
45070
|
+
layer: '"MapNatureForest"',
|
|
45033
45071
|
};
|
|
45034
45072
|
const layer = {
|
|
45035
45073
|
id: uuid(),
|
|
45036
45074
|
data,
|
|
45037
45075
|
draw: {
|
|
45038
45076
|
polygons: {
|
|
45039
|
-
|
|
45040
|
-
|
|
45041
|
-
|
|
45042
|
-
};
|
|
45043
|
-
const borderRegionLayer = {
|
|
45044
|
-
id: uuid(),
|
|
45045
|
-
data,
|
|
45046
|
-
filter: `function() {
|
|
45047
|
-
const { type } = feature;
|
|
45048
|
-
|
|
45049
|
-
const isFilter = type === 'R';
|
|
45050
|
-
|
|
45051
|
-
return isFilter;
|
|
45052
|
-
}`,
|
|
45053
|
-
draw: {
|
|
45054
|
-
lines: {
|
|
45055
|
-
color: '#696969',
|
|
45056
|
-
width: '1px',
|
|
45057
|
-
cap: 'round',
|
|
45058
|
-
join: 'round',
|
|
45059
|
-
},
|
|
45060
|
-
},
|
|
45061
|
-
};
|
|
45062
|
-
const borderDistrictLayer = {
|
|
45063
|
-
id: uuid(),
|
|
45064
|
-
data,
|
|
45065
|
-
filter: `function() {
|
|
45066
|
-
const { type } = feature;
|
|
45077
|
+
interactive: true,
|
|
45078
|
+
color: `function() {
|
|
45079
|
+
const { feature_type } = feature;
|
|
45067
45080
|
|
|
45068
|
-
|
|
45081
|
+
switch (feature_type) {
|
|
45082
|
+
case '900202': {
|
|
45083
|
+
return '#96BE7D';
|
|
45084
|
+
}
|
|
45069
45085
|
|
|
45070
|
-
|
|
45071
|
-
|
|
45072
|
-
|
|
45073
|
-
|
|
45074
|
-
|
|
45075
|
-
dash: [4, 7],
|
|
45076
|
-
width: '1px',
|
|
45077
|
-
cap: 'round',
|
|
45078
|
-
join: 'round',
|
|
45086
|
+
default : {
|
|
45087
|
+
return null;
|
|
45088
|
+
}
|
|
45089
|
+
}
|
|
45090
|
+
}`,
|
|
45079
45091
|
},
|
|
45080
45092
|
},
|
|
45081
45093
|
};
|
|
45082
|
-
layers.push(layer
|
|
45094
|
+
layers.push(layer);
|
|
45083
45095
|
return layers;
|
|
45084
45096
|
};
|
|
45085
45097
|
|
|
45086
|
-
const
|
|
45087
|
-
const
|
|
45088
|
-
|
|
45089
|
-
data: {
|
|
45090
|
-
source,
|
|
45091
|
-
layer: '"MapNatureField"',
|
|
45092
|
-
},
|
|
45093
|
-
draw: {
|
|
45094
|
-
polygons: {
|
|
45095
|
-
interactive: true,
|
|
45096
|
-
color: '#EBEEC7',
|
|
45097
|
-
},
|
|
45098
|
-
},
|
|
45099
|
-
};
|
|
45100
|
-
return [layer];
|
|
45098
|
+
const getLayerName = ({ id, data: { source, layer }, }) => {
|
|
45099
|
+
const layerName = `${id}-${source}-${layer}`;
|
|
45100
|
+
return layerName;
|
|
45101
45101
|
};
|
|
45102
|
-
|
|
45103
|
-
const
|
|
45104
|
-
const
|
|
45105
|
-
|
|
45106
|
-
|
|
45107
|
-
|
|
45108
|
-
|
|
45109
|
-
|
|
45110
|
-
|
|
45111
|
-
|
|
45112
|
-
|
|
45113
|
-
|
|
45114
|
-
|
|
45115
|
-
|
|
45116
|
-
|
|
45117
|
-
|
|
45118
|
-
|
|
45119
|
-
|
|
45120
|
-
|
|
45121
|
-
|
|
45122
|
-
|
|
45123
|
-
|
|
45124
|
-
|
|
45125
|
-
|
|
45126
|
-
|
|
45127
|
-
|
|
45128
|
-
|
|
45129
|
-
|
|
45130
|
-
|
|
45131
|
-
|
|
45132
|
-
|
|
45133
|
-
|
|
45134
|
-
|
|
45135
|
-
|
|
45136
|
-
|
|
45137
|
-
|
|
45138
|
-
|
|
45139
|
-
|
|
45140
|
-
|
|
45141
|
-
|
|
45142
|
-
case 3:
|
|
45143
|
-
case 4: {
|
|
45144
|
-
const color = getRGB('#B1A7AA', alpha);
|
|
45145
|
-
|
|
45146
|
-
return color;
|
|
45147
|
-
}
|
|
45148
|
-
|
|
45149
|
-
case 5: {
|
|
45150
|
-
const color = getRGB('#D5CEC3', alpha);
|
|
45151
|
-
|
|
45152
|
-
return color;
|
|
45153
|
-
}
|
|
45154
|
-
}
|
|
45155
|
-
}`;
|
|
45156
|
-
const widthFunction = `function() {
|
|
45157
|
-
const { functional_class, road_number } = feature;
|
|
45158
|
-
|
|
45159
|
-
const getScale = () => {
|
|
45160
|
-
if ($zoom <= 15 && $zoom >= 14) { return 7; }
|
|
45161
|
-
|
|
45162
|
-
if ($zoom <= 13 && $zoom >= 12) { return 9; }
|
|
45163
|
-
|
|
45164
|
-
if ($zoom <= 5) { return 400; }
|
|
45165
|
-
|
|
45166
|
-
if ($zoom <= 7) { return 200; }
|
|
45167
|
-
|
|
45168
|
-
if ($zoom < 12) { return 50; }
|
|
45169
|
-
|
|
45170
|
-
return 1;
|
|
45171
|
-
}
|
|
45172
|
-
|
|
45173
|
-
const scale = getScale();
|
|
45174
|
-
|
|
45175
|
-
switch(functional_class) {
|
|
45176
|
-
case 1:
|
|
45177
|
-
case 2: {
|
|
45178
|
-
return 8 * scale;
|
|
45179
|
-
}
|
|
45180
|
-
|
|
45181
|
-
case 3:
|
|
45182
|
-
case 4: {
|
|
45183
|
-
return 7 * scale;
|
|
45184
|
-
}
|
|
45185
|
-
|
|
45186
|
-
case 5: {
|
|
45187
|
-
if (Boolean(road_number)) {
|
|
45188
|
-
return 7 * scale;
|
|
45189
|
-
}
|
|
45190
|
-
|
|
45191
|
-
return 6;
|
|
45192
|
-
}
|
|
45193
|
-
}
|
|
45194
|
-
}`;
|
|
45195
|
-
const outlineColorFunction = `function() {
|
|
45196
|
-
const { functional_class, access_id, tollway } = feature;
|
|
45197
|
-
|
|
45198
|
-
if (tollway) {
|
|
45199
|
-
return '#B9263B';
|
|
45200
|
-
}
|
|
45201
|
-
|
|
45202
|
-
switch(functional_class) {
|
|
45203
|
-
case 5: {
|
|
45204
|
-
return '#989898';
|
|
45102
|
+
const setLayerOrder = ({ layer, order, }) => {
|
|
45103
|
+
const cloneLayer = structuredClone(layer);
|
|
45104
|
+
const { draw, sublayers } = cloneLayer;
|
|
45105
|
+
if (draw) {
|
|
45106
|
+
const { points, lines, polygons, text, styles } = draw;
|
|
45107
|
+
if (points) {
|
|
45108
|
+
draw.points = {
|
|
45109
|
+
...structuredClone(points),
|
|
45110
|
+
order,
|
|
45111
|
+
};
|
|
45112
|
+
}
|
|
45113
|
+
if (lines) {
|
|
45114
|
+
draw.lines = {
|
|
45115
|
+
...structuredClone(lines),
|
|
45116
|
+
order,
|
|
45117
|
+
};
|
|
45118
|
+
}
|
|
45119
|
+
if (polygons) {
|
|
45120
|
+
draw.polygons = {
|
|
45121
|
+
...structuredClone(polygons),
|
|
45122
|
+
order,
|
|
45123
|
+
};
|
|
45124
|
+
}
|
|
45125
|
+
if (text) {
|
|
45126
|
+
draw.text = {
|
|
45127
|
+
...structuredClone(text),
|
|
45128
|
+
order,
|
|
45129
|
+
};
|
|
45130
|
+
}
|
|
45131
|
+
if (styles) {
|
|
45132
|
+
draw.styles = Object.entries(styles).reduce((accum, [name, style]) => ({
|
|
45133
|
+
...accum,
|
|
45134
|
+
[name]: {
|
|
45135
|
+
...structuredClone(style),
|
|
45136
|
+
order,
|
|
45137
|
+
},
|
|
45138
|
+
}), {});
|
|
45139
|
+
}
|
|
45140
|
+
cloneLayer.draw = structuredClone(draw);
|
|
45205
45141
|
}
|
|
45206
|
-
|
|
45207
|
-
|
|
45208
|
-
|
|
45209
|
-
|
|
45142
|
+
if (sublayers) {
|
|
45143
|
+
Object.entries(sublayers).forEach(([name, sublayer]) => {
|
|
45144
|
+
if (sublayer) {
|
|
45145
|
+
const { draw } = sublayer;
|
|
45146
|
+
if (draw) {
|
|
45147
|
+
const { points, lines, polygons } = draw;
|
|
45148
|
+
if (points) {
|
|
45149
|
+
points.order = order;
|
|
45150
|
+
draw.points = points;
|
|
45151
|
+
}
|
|
45152
|
+
if (lines) {
|
|
45153
|
+
lines.order = order;
|
|
45154
|
+
draw.lines = lines;
|
|
45155
|
+
}
|
|
45156
|
+
if (polygons) {
|
|
45157
|
+
polygons.order = order;
|
|
45158
|
+
draw.polygons = polygons;
|
|
45159
|
+
}
|
|
45160
|
+
sublayer.draw = structuredClone(draw);
|
|
45161
|
+
}
|
|
45162
|
+
sublayers[name] = structuredClone(sublayer);
|
|
45163
|
+
}
|
|
45164
|
+
});
|
|
45165
|
+
cloneLayer.sublayers = structuredClone(sublayers);
|
|
45210
45166
|
}
|
|
45211
|
-
|
|
45212
|
-
|
|
45213
|
-
|
|
45214
|
-
|
|
45167
|
+
return cloneLayer;
|
|
45168
|
+
};
|
|
45169
|
+
const getAllPolygonLayers = (source) => {
|
|
45170
|
+
const adminAreaLayers = getAdminAreaLayers(source);
|
|
45171
|
+
const natureFieldLayers = getNatureFieldLayers();
|
|
45172
|
+
const natureForestLayers = getNatureForestLayers();
|
|
45173
|
+
const builtupAreaLayers = getBuiltupAreaLayers(source);
|
|
45174
|
+
const facilityAreaLayers = getFacilityAreaLayers(source);
|
|
45175
|
+
const landuseAreaLayers = getLanduseAreaLayers(source);
|
|
45176
|
+
const waterAreaLayers = getWaterAreaLayers(source);
|
|
45177
|
+
const oceanAreaLayers = getOceanAreaLayers(source);
|
|
45178
|
+
const allPolygonLayers = [];
|
|
45179
|
+
switch (source) {
|
|
45180
|
+
case exports.TangramSourceNames.MSK: {
|
|
45181
|
+
allPolygonLayers.push(...adminAreaLayers, ...builtupAreaLayers, ...facilityAreaLayers, ...landuseAreaLayers, ...waterAreaLayers, ...oceanAreaLayers);
|
|
45182
|
+
break;
|
|
45183
|
+
}
|
|
45184
|
+
default: {
|
|
45185
|
+
allPolygonLayers.push(...adminAreaLayers, ...builtupAreaLayers, ...facilityAreaLayers, ...natureFieldLayers, ...natureForestLayers, ...landuseAreaLayers, ...waterAreaLayers, ...oceanAreaLayers);
|
|
45186
|
+
}
|
|
45215
45187
|
}
|
|
45216
|
-
|
|
45217
|
-
}
|
|
45218
|
-
const
|
|
45219
|
-
|
|
45220
|
-
|
|
45221
|
-
|
|
45222
|
-
|
|
45223
|
-
|
|
45224
|
-
|
|
45225
|
-
|
|
45188
|
+
return allPolygonLayers;
|
|
45189
|
+
};
|
|
45190
|
+
const getAllPolylineLayers = (source) => {
|
|
45191
|
+
const linkLayers = getLinkLayers(source);
|
|
45192
|
+
const railroadLayers = getRailroadLayers(source);
|
|
45193
|
+
const waterLinkLayers = getWaterLinkLayers(source);
|
|
45194
|
+
const oneWayLayers = getOneWayLayers(source);
|
|
45195
|
+
const conditionLayers = getConditionLayers(source);
|
|
45196
|
+
const allPolylineLayers = [
|
|
45197
|
+
...waterLinkLayers,
|
|
45198
|
+
...railroadLayers,
|
|
45199
|
+
...linkLayers,
|
|
45200
|
+
];
|
|
45201
|
+
switch (source) {
|
|
45202
|
+
case exports.TangramSourceNames.MSK: {
|
|
45203
|
+
allPolylineLayers.push(...waterLinkLayers, ...railroadLayers, ...linkLayers);
|
|
45204
|
+
break;
|
|
45226
45205
|
}
|
|
45227
|
-
|
|
45228
45206
|
default: {
|
|
45229
|
-
|
|
45207
|
+
allPolylineLayers.push(...waterLinkLayers, ...railroadLayers, ...linkLayers, ...oneWayLayers, ...conditionLayers);
|
|
45230
45208
|
}
|
|
45231
|
-
}
|
|
45232
45209
|
}
|
|
45233
|
-
|
|
45234
|
-
|
|
45235
|
-
|
|
45210
|
+
return allPolylineLayers;
|
|
45211
|
+
};
|
|
45212
|
+
const getAllPointLayers = (source) => {
|
|
45213
|
+
const POILayers = getPOILayers(source);
|
|
45214
|
+
const cityPOILayers = getCityPOILayers(source);
|
|
45215
|
+
const pointAddressLayers = getPointAddressLayers(source);
|
|
45216
|
+
const allPointLayers = [
|
|
45217
|
+
...POILayers,
|
|
45218
|
+
...pointAddressLayers,
|
|
45219
|
+
...cityPOILayers,
|
|
45220
|
+
];
|
|
45221
|
+
return allPointLayers;
|
|
45222
|
+
};
|
|
45223
|
+
const getAllLayers = (source) => {
|
|
45224
|
+
const allLayers = [];
|
|
45225
|
+
const buildingLayers = getBuildingLayers(source);
|
|
45226
|
+
const allPolygonLayers = getAllPolygonLayers(source);
|
|
45227
|
+
const allPolylineLayers = getAllPolylineLayers(source);
|
|
45228
|
+
const allPointLayers = getAllPointLayers(source);
|
|
45229
|
+
const roadPolyLayers = getRoadPolyLayers(source);
|
|
45230
|
+
const laneMarkingPolyLayers = getLaneMarkingPolyLayers(source);
|
|
45231
|
+
const laneMarkingLineLayers = getLaneMarkingLineLayers(source);
|
|
45232
|
+
const laneMarkingPointLayers = getLaneMarkingPointLayers(source);
|
|
45233
|
+
const parkingLineLayers = getParkingLineLayers(source);
|
|
45234
|
+
switch (source) {
|
|
45235
|
+
case exports.TangramSourceNames.MSK: {
|
|
45236
|
+
allLayers.push(...allPolygonLayers, ...allPolylineLayers, ...roadPolyLayers, ...laneMarkingPolyLayers, ...laneMarkingLineLayers, ...laneMarkingPointLayers, ...parkingLineLayers, ...buildingLayers, ...allPointLayers);
|
|
45237
|
+
break;
|
|
45238
|
+
}
|
|
45239
|
+
default: {
|
|
45240
|
+
allLayers.push(...allPolygonLayers, ...allPolylineLayers, ...buildingLayers, ...allPointLayers);
|
|
45241
|
+
}
|
|
45236
45242
|
}
|
|
45237
|
-
|
|
45238
|
-
}
|
|
45243
|
+
return allLayers;
|
|
45244
|
+
};
|
|
45239
45245
|
|
|
45240
|
-
const
|
|
45241
|
-
const
|
|
45242
|
-
const
|
|
45243
|
-
|
|
45244
|
-
|
|
45246
|
+
const useGetLeafletLayer = () => {
|
|
45247
|
+
const { instance: { isValidApiKey }, } = GlobalConfig;
|
|
45248
|
+
const [layer, setLayer] = React__namespace.useState(null);
|
|
45249
|
+
const [scene, setScene] = React__namespace.useState(null);
|
|
45250
|
+
const [config, setConfig] = React__namespace.useState(null);
|
|
45251
|
+
const getLeafletLayer = () => {
|
|
45252
|
+
Promise.resolve().then(function () { return tangram_min; }).then(() => {
|
|
45253
|
+
if (window.Tangram) {
|
|
45254
|
+
const leafletLayer = window.Tangram.leafletLayer({
|
|
45255
|
+
scene: sceneTiles,
|
|
45256
|
+
});
|
|
45257
|
+
const { scene } = leafletLayer;
|
|
45258
|
+
setLayer(leafletLayer);
|
|
45259
|
+
setScene(scene);
|
|
45260
|
+
}
|
|
45261
|
+
});
|
|
45245
45262
|
};
|
|
45246
|
-
const
|
|
45247
|
-
|
|
45248
|
-
|
|
45249
|
-
|
|
45250
|
-
|
|
45251
|
-
|
|
45252
|
-
|
|
45253
|
-
|
|
45254
|
-
|
|
45255
|
-
|
|
45256
|
-
|
|
45257
|
-
|
|
45258
|
-
|
|
45263
|
+
const addSource = React__namespace.useCallback((sourceConfig) => {
|
|
45264
|
+
if (!scene) {
|
|
45265
|
+
console.warn('Scene не инициализирована');
|
|
45266
|
+
return;
|
|
45267
|
+
}
|
|
45268
|
+
if (!config) {
|
|
45269
|
+
console.warn('Config не инициализирована');
|
|
45270
|
+
return;
|
|
45271
|
+
}
|
|
45272
|
+
const { name } = sourceConfig;
|
|
45273
|
+
config.sources[name] = structuredClone(sourceConfig);
|
|
45274
|
+
scene.updateConfig({ rebuild: true });
|
|
45275
|
+
return getSources();
|
|
45276
|
+
}, [scene, config]);
|
|
45277
|
+
const getSource = React__namespace.useCallback((sourceName) => {
|
|
45278
|
+
if (!config) {
|
|
45279
|
+
console.warn('Config не инициализирована');
|
|
45280
|
+
return;
|
|
45281
|
+
}
|
|
45282
|
+
return structuredClone(config.sources[sourceName]);
|
|
45283
|
+
}, [config]);
|
|
45284
|
+
const updateSource = React__namespace.useCallback((sourceName, newUrl) => {
|
|
45285
|
+
if (!scene) {
|
|
45286
|
+
console.warn('Scene не инициализирована');
|
|
45287
|
+
return;
|
|
45288
|
+
}
|
|
45289
|
+
if (!config) {
|
|
45290
|
+
console.warn('Config не инициализирована');
|
|
45291
|
+
return;
|
|
45292
|
+
}
|
|
45293
|
+
config.sources[sourceName].url = newUrl;
|
|
45294
|
+
scene.updateConfig({ rebuild: true });
|
|
45295
|
+
return getSources();
|
|
45296
|
+
}, [config, scene]);
|
|
45297
|
+
const addLayer = React__namespace.useCallback((layer) => {
|
|
45298
|
+
if (!scene) {
|
|
45299
|
+
console.warn('Scene не инициализирован');
|
|
45300
|
+
return;
|
|
45301
|
+
}
|
|
45302
|
+
if (!config) {
|
|
45303
|
+
console.warn('Config не инициализирован');
|
|
45304
|
+
return;
|
|
45305
|
+
}
|
|
45306
|
+
const order = getLayers().length + 1;
|
|
45307
|
+
const layerWithOrder = setLayerOrder({
|
|
45308
|
+
layer,
|
|
45309
|
+
order,
|
|
45310
|
+
});
|
|
45311
|
+
const layerName = getLayerName(layerWithOrder);
|
|
45312
|
+
const { sublayers = {}, draw } = layerWithOrder;
|
|
45313
|
+
if (draw) {
|
|
45314
|
+
const { styles = {} } = draw;
|
|
45315
|
+
if (styles) {
|
|
45316
|
+
layerWithOrder.draw = {
|
|
45317
|
+
...structuredClone(draw),
|
|
45318
|
+
...structuredClone(styles),
|
|
45319
|
+
};
|
|
45320
|
+
}
|
|
45321
|
+
}
|
|
45322
|
+
config.layers[layerName] = {
|
|
45323
|
+
...structuredClone(layerWithOrder),
|
|
45324
|
+
...structuredClone(sublayers),
|
|
45325
|
+
};
|
|
45326
|
+
scene.updateConfig({ rebuild: true });
|
|
45327
|
+
return getLayers();
|
|
45328
|
+
}, [config, scene]);
|
|
45329
|
+
const removeLayer = React__namespace.useCallback((layer) => {
|
|
45330
|
+
if (!scene) {
|
|
45331
|
+
console.warn('Scene не инициализирован');
|
|
45332
|
+
return;
|
|
45333
|
+
}
|
|
45334
|
+
if (!config) {
|
|
45335
|
+
console.warn('Config не инициализирован');
|
|
45336
|
+
return;
|
|
45337
|
+
}
|
|
45338
|
+
const layerName = getLayerName(layer);
|
|
45339
|
+
if (config.layers[layerName]) {
|
|
45340
|
+
delete config.layers[layerName];
|
|
45341
|
+
}
|
|
45342
|
+
scene.updateConfig({ rebuild: true });
|
|
45343
|
+
return getLayers();
|
|
45344
|
+
}, [config, scene]);
|
|
45345
|
+
const addStyle = React__namespace.useCallback(({ name, style }) => {
|
|
45346
|
+
if (!scene) {
|
|
45347
|
+
console.warn('Scene не инициализирована');
|
|
45348
|
+
return;
|
|
45349
|
+
}
|
|
45350
|
+
if (!config) {
|
|
45351
|
+
console.warn('Config не инициализирована');
|
|
45352
|
+
return;
|
|
45353
|
+
}
|
|
45354
|
+
config.styles[name] = structuredClone(style);
|
|
45355
|
+
scene.updateConfig({ rebuild: true });
|
|
45356
|
+
}, [config, scene]);
|
|
45357
|
+
const getLayerVisibility = React__namespace.useCallback((layer) => {
|
|
45358
|
+
if (!config) {
|
|
45359
|
+
console.warn('Config не инициализирована');
|
|
45360
|
+
return;
|
|
45361
|
+
}
|
|
45362
|
+
const layerName = getLayerName(layer);
|
|
45363
|
+
const { visible: layerVisibility } = config.layers[layerName];
|
|
45364
|
+
return layerVisibility;
|
|
45365
|
+
}, [config]);
|
|
45366
|
+
const toggleLayerVisibility = React__namespace.useCallback(({ layer, visible }) => {
|
|
45367
|
+
if (!scene) {
|
|
45368
|
+
console.warn('Scene не инициализирована');
|
|
45369
|
+
return;
|
|
45370
|
+
}
|
|
45371
|
+
if (!config) {
|
|
45372
|
+
console.warn('Config не инициализирована');
|
|
45373
|
+
return;
|
|
45374
|
+
}
|
|
45375
|
+
const layerName = getLayerName(layer);
|
|
45376
|
+
config.layers[layerName].visible = visible;
|
|
45377
|
+
scene.updateConfig();
|
|
45378
|
+
return getLayerVisibility(layer);
|
|
45379
|
+
}, [config, scene]);
|
|
45380
|
+
const getLayers = React__namespace.useCallback(() => {
|
|
45381
|
+
if (!config)
|
|
45382
|
+
return [];
|
|
45383
|
+
const { layers } = config;
|
|
45384
|
+
return Object.keys(layers);
|
|
45385
|
+
}, [config]);
|
|
45386
|
+
const removeLayers = React__namespace.useCallback(() => {
|
|
45387
|
+
if (!config)
|
|
45388
|
+
return [];
|
|
45389
|
+
const { layers } = config;
|
|
45390
|
+
Object.values(layers).forEach(removeLayer);
|
|
45391
|
+
}, [config]);
|
|
45392
|
+
const getSources = React__namespace.useCallback(() => {
|
|
45393
|
+
if (!config)
|
|
45394
|
+
return [];
|
|
45395
|
+
const { sources } = config;
|
|
45396
|
+
return Object.keys(sources);
|
|
45397
|
+
}, [config]);
|
|
45398
|
+
React__namespace.useEffect(() => {
|
|
45399
|
+
if (isValidApiKey) {
|
|
45400
|
+
getLeafletLayer();
|
|
45401
|
+
}
|
|
45402
|
+
return () => {
|
|
45403
|
+
setLayer(null);
|
|
45404
|
+
setScene(null);
|
|
45405
|
+
setConfig(null);
|
|
45406
|
+
};
|
|
45407
|
+
}, [isValidApiKey]);
|
|
45408
|
+
React__namespace.useEffect(() => {
|
|
45409
|
+
if (scene) {
|
|
45410
|
+
scene.subscribe({
|
|
45411
|
+
load: ({ config }) => {
|
|
45412
|
+
setConfig(config);
|
|
45413
|
+
},
|
|
45414
|
+
});
|
|
45415
|
+
}
|
|
45416
|
+
}, [scene]);
|
|
45417
|
+
React__namespace.useEffect(() => {
|
|
45418
|
+
addStyle({
|
|
45419
|
+
name: 'space-tile',
|
|
45420
|
+
style: {
|
|
45421
|
+
shaders: {
|
|
45422
|
+
defines: {
|
|
45423
|
+
TILE_SCALE: 0.0002445,
|
|
45424
|
+
'NORMALIZED_SHORT(x)': '(x * 32767.)',
|
|
45425
|
+
},
|
|
45426
|
+
blocks: {
|
|
45427
|
+
global: `
|
|
45428
|
+
varying vec3 v_pos;
|
|
45429
|
+
vec2 getTileCoords() {
|
|
45430
|
+
return fract(v_pos.xy);
|
|
45431
|
+
}
|
|
45432
|
+
`,
|
|
45433
|
+
position: `
|
|
45434
|
+
v_pos = modelPosition().xyz;
|
|
45435
|
+
`,
|
|
45259
45436
|
},
|
|
45260
45437
|
},
|
|
45261
45438
|
},
|
|
45262
|
-
}
|
|
45263
|
-
|
|
45264
|
-
|
|
45265
|
-
|
|
45266
|
-
|
|
45267
|
-
|
|
45268
|
-
|
|
45269
|
-
|
|
45270
|
-
|
|
45271
|
-
|
|
45272
|
-
|
|
45273
|
-
|
|
45274
|
-
|
|
45275
|
-
|
|
45276
|
-
|
|
45277
|
-
|
|
45278
|
-
|
|
45439
|
+
});
|
|
45440
|
+
addStyle({
|
|
45441
|
+
name: 'tools-aastep',
|
|
45442
|
+
style: {
|
|
45443
|
+
shaders: {
|
|
45444
|
+
extensions: 'OES_standard_derivatives',
|
|
45445
|
+
blocks: {
|
|
45446
|
+
global: `
|
|
45447
|
+
float aastep(float threshold, float value) {
|
|
45448
|
+
#ifdef TANGRAM_FRAGMENT_SHADER
|
|
45449
|
+
#ifdef TANGRAM_EXTENSION_OES_standard_derivatives
|
|
45450
|
+
float afwidth = length(vec2(dFdx(value), dFdy(value))) * 0.70710678118654757;
|
|
45451
|
+
return smoothstep(threshold-afwidth, threshold+afwidth, value);
|
|
45452
|
+
#else
|
|
45453
|
+
return step(threshold, value);
|
|
45454
|
+
#endif
|
|
45455
|
+
#else
|
|
45456
|
+
return step(threshold, value);
|
|
45457
|
+
#endif
|
|
45458
|
+
}
|
|
45459
|
+
`,
|
|
45460
|
+
},
|
|
45461
|
+
},
|
|
45279
45462
|
},
|
|
45280
|
-
};
|
|
45281
|
-
|
|
45282
|
-
|
|
45283
|
-
|
|
45284
|
-
|
|
45285
|
-
|
|
45286
|
-
|
|
45287
|
-
|
|
45463
|
+
});
|
|
45464
|
+
addStyle({
|
|
45465
|
+
name: 'pattern-diagonal-grid',
|
|
45466
|
+
style: {
|
|
45467
|
+
mix: ['space-tile', 'tools-aastep'],
|
|
45468
|
+
shaders: {
|
|
45469
|
+
blocks: {
|
|
45470
|
+
global: `
|
|
45471
|
+
float DiagonalGrid(float scale, float lineWidth) {
|
|
45472
|
+
vec2 st = getTileCoords() * scale;
|
|
45473
|
+
|
|
45474
|
+
float d1 = mod(st.x + st.y, 1.0);
|
|
45475
|
+
float line1 = aastep(lineWidth, d1) * aastep(1.0 - lineWidth, d1);
|
|
45476
|
+
|
|
45477
|
+
float d2 = mod(st.x - st.y, 1.0);
|
|
45478
|
+
float line2 = aastep(lineWidth, d2) * aastep(1.0 - lineWidth, d2);
|
|
45479
|
+
|
|
45480
|
+
return max(line1, line2);
|
|
45481
|
+
}
|
|
45482
|
+
`,
|
|
45483
|
+
},
|
|
45484
|
+
},
|
|
45288
45485
|
},
|
|
45289
45486
|
});
|
|
45290
|
-
|
|
45291
|
-
|
|
45292
|
-
|
|
45293
|
-
|
|
45294
|
-
|
|
45295
|
-
|
|
45296
|
-
|
|
45297
|
-
|
|
45298
|
-
|
|
45487
|
+
addStyle({
|
|
45488
|
+
name: 'diagonal-grid',
|
|
45489
|
+
style: {
|
|
45490
|
+
mix: 'pattern-diagonal-grid',
|
|
45491
|
+
blend: 'overlay',
|
|
45492
|
+
base: 'polygons',
|
|
45493
|
+
shaders: {
|
|
45494
|
+
blocks: {
|
|
45495
|
+
color: `
|
|
45496
|
+
float grid = DiagonalGrid(12.0, 0.08);
|
|
45497
|
+
|
|
45498
|
+
color.a = grid;
|
|
45499
|
+
`,
|
|
45500
|
+
},
|
|
45299
45501
|
},
|
|
45300
45502
|
},
|
|
45301
45503
|
});
|
|
45302
|
-
|
|
45303
|
-
|
|
45304
|
-
|
|
45305
|
-
|
|
45306
|
-
|
|
45307
|
-
|
|
45308
|
-
|
|
45309
|
-
|
|
45310
|
-
|
|
45311
|
-
|
|
45312
|
-
|
|
45313
|
-
|
|
45314
|
-
|
|
45315
|
-
|
|
45316
|
-
|
|
45317
|
-
|
|
45318
|
-
|
|
45319
|
-
|
|
45320
|
-
|
|
45321
|
-
|
|
45322
|
-
|
|
45323
|
-
|
|
45324
|
-
|
|
45325
|
-
|
|
45326
|
-
|
|
45327
|
-
|
|
45328
|
-
|
|
45329
|
-
|
|
45330
|
-
|
|
45331
|
-
|
|
45332
|
-
|
|
45333
|
-
|
|
45334
|
-
|
|
45335
|
-
|
|
45336
|
-
|
|
45337
|
-
|
|
45338
|
-
|
|
45339
|
-
|
|
45340
|
-
|
|
45341
|
-
|
|
45342
|
-
|
|
45343
|
-
|
|
45344
|
-
|
|
45345
|
-
|
|
45346
|
-
|
|
45347
|
-
|
|
45348
|
-
|
|
45349
|
-
|
|
45350
|
-
|
|
45351
|
-
|
|
45352
|
-
|
|
45353
|
-
|
|
45354
|
-
|
|
45355
|
-
|
|
45356
|
-
|
|
45357
|
-
|
|
45358
|
-
|
|
45359
|
-
|
|
45360
|
-
|
|
45504
|
+
addStyle({
|
|
45505
|
+
name: 'zebra_crossing',
|
|
45506
|
+
style: {
|
|
45507
|
+
base: 'polygons',
|
|
45508
|
+
lighting: false,
|
|
45509
|
+
shaders: {
|
|
45510
|
+
attributes: {
|
|
45511
|
+
a_angle: {
|
|
45512
|
+
type: 'float',
|
|
45513
|
+
default: 0.0,
|
|
45514
|
+
},
|
|
45515
|
+
},
|
|
45516
|
+
uniforms: {
|
|
45517
|
+
u_stripe_width: 1,
|
|
45518
|
+
},
|
|
45519
|
+
blocks: {
|
|
45520
|
+
filter: `
|
|
45521
|
+
vec3 pos = worldPosition().xyz;
|
|
45522
|
+
|
|
45523
|
+
float ang = radians(a_angle);
|
|
45524
|
+
|
|
45525
|
+
vec2 dir = vec2(sin(ang), cos(ang));
|
|
45526
|
+
|
|
45527
|
+
float positionAlongLine = dot(pos.xy, dir);
|
|
45528
|
+
|
|
45529
|
+
float stripe = step(1.0, mod(positionAlongLine / u_stripe_width, 2.0));
|
|
45530
|
+
|
|
45531
|
+
color.rgb = mix(vec3(1.0, 1.0, 1.0), vec3(1.0, 0.8, 0.0), stripe);
|
|
45532
|
+
|
|
45533
|
+
color.a = 1.0;
|
|
45534
|
+
`,
|
|
45535
|
+
},
|
|
45536
|
+
},
|
|
45537
|
+
},
|
|
45538
|
+
});
|
|
45539
|
+
}, [addStyle]);
|
|
45540
|
+
React__namespace.useEffect(() => {
|
|
45541
|
+
Object.values(exports.TangramSourceNames).forEach((name) => {
|
|
45542
|
+
const url = sourceUrl[name];
|
|
45543
|
+
addSource({
|
|
45544
|
+
tile_size,
|
|
45545
|
+
name,
|
|
45546
|
+
url,
|
|
45547
|
+
type: 'MVT',
|
|
45548
|
+
});
|
|
45549
|
+
});
|
|
45550
|
+
}, [addSource]);
|
|
45551
|
+
return {
|
|
45552
|
+
layer,
|
|
45553
|
+
scene,
|
|
45554
|
+
config,
|
|
45555
|
+
addSource,
|
|
45556
|
+
getSource,
|
|
45557
|
+
updateSource,
|
|
45558
|
+
addLayer,
|
|
45559
|
+
removeLayer,
|
|
45560
|
+
addStyle,
|
|
45561
|
+
getLayerVisibility,
|
|
45562
|
+
toggleLayerVisibility,
|
|
45563
|
+
getSources,
|
|
45564
|
+
getLayers,
|
|
45565
|
+
removeLayers,
|
|
45566
|
+
};
|
|
45567
|
+
};
|
|
45361
45568
|
|
|
45362
|
-
|
|
45363
|
-
|
|
45364
|
-
|
|
45365
|
-
|
|
45366
|
-
|
|
45367
|
-
|
|
45368
|
-
return global.links.getIsLowMobility(feature);
|
|
45369
|
-
}`,
|
|
45370
|
-
draw: {
|
|
45371
|
-
lines: {
|
|
45372
|
-
width: 4,
|
|
45373
|
-
},
|
|
45374
|
-
},
|
|
45375
|
-
},
|
|
45376
|
-
},
|
|
45377
|
-
};
|
|
45378
|
-
layers.push(baseLayer, borderLayer);
|
|
45379
|
-
});
|
|
45380
|
-
});
|
|
45381
|
-
break;
|
|
45382
|
-
}
|
|
45383
|
-
default: {
|
|
45384
|
-
const baseLayer = {
|
|
45385
|
-
id: uuid(),
|
|
45386
|
-
data,
|
|
45387
|
-
filter,
|
|
45388
|
-
draw: getBaseLayerDraw(),
|
|
45389
|
-
};
|
|
45390
|
-
const borderLayer = {
|
|
45391
|
-
id: uuid(),
|
|
45392
|
-
data,
|
|
45393
|
-
filter,
|
|
45394
|
-
draw: getBorderLayerDraw(),
|
|
45395
|
-
};
|
|
45396
|
-
layers.push(baseLayer, borderLayer);
|
|
45397
|
-
}
|
|
45569
|
+
const LeafletLayer = () => {
|
|
45570
|
+
const { layer, addLayer } = useGetLeafletLayer();
|
|
45571
|
+
const map = useMap();
|
|
45572
|
+
React__namespace.useEffect(() => {
|
|
45573
|
+
if (layer) {
|
|
45574
|
+
map.addLayer(layer);
|
|
45398
45575
|
}
|
|
45399
|
-
});
|
|
45400
|
-
|
|
45576
|
+
}, [layer]);
|
|
45577
|
+
React__namespace.useEffect(() => {
|
|
45578
|
+
getAllLayers(exports.TangramSourceNames.MSK).map(addLayer);
|
|
45579
|
+
}, [addLayer]);
|
|
45580
|
+
return null;
|
|
45401
45581
|
};
|
|
45402
45582
|
|
|
45403
45583
|
// define() gets called for each chunk generated by the first Rollup pass.
|
|
@@ -45481,6 +45661,7 @@ exports.getLaneMarkingPointLayers = getLaneMarkingPointLayers;
|
|
|
45481
45661
|
exports.getLaneMarkingPolyLayers = getLaneMarkingPolyLayers;
|
|
45482
45662
|
exports.getLinkLayers = getLinkLayers;
|
|
45483
45663
|
exports.getNatureFieldLayers = getNatureFieldLayers;
|
|
45664
|
+
exports.getNatureForestLayers = getNatureForestLayers;
|
|
45484
45665
|
exports.getOceanAreaLayers = getOceanAreaLayers;
|
|
45485
45666
|
exports.getOneWayLayers = getOneWayLayers;
|
|
45486
45667
|
exports.getPOILayers = getPOILayers;
|