@dartcom/ui-kit 10.2.9 → 10.2.10

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.
@@ -1,7 +1,17 @@
1
- export declare const zLvlOrders: number[];
1
+ import { TangramLayerDraw } from '../../lib';
2
+ import { SublayerConfig } from './types';
3
+ export declare const zLvlOrders: string[];
2
4
  export declare const functionInterval: number[][];
5
+ export declare const generalizationZoom = 16;
3
6
  export declare const colorFunction = "function() {\n const { functional_class, tunnel, tollway } = feature;\n\n const alpha = tunnel ? 0.89 : 1;\n\n const getRGB = (hex, alpha) => {\n const r = +(parseInt(hex.slice(1, 3), 16) / 255).toFixed(2);\n const g = +(parseInt(hex.slice(3, 5), 16) / 255).toFixed(2);\n const b = +(parseInt(hex.slice(5, 7), 16) / 255).toFixed(2);\n\n return [r, g, b, alpha];\n }\n\n if (tollway) {\n return '#D72740';\n }\n\n switch (functional_class) {\n case 1:\n case 2: {\n const color = getRGB('#D1747F', alpha);\n\n return color;\n }\n\n case 3:\n case 4: {\n const color = getRGB('#B1A7AA', alpha);\n\n return color;\n }\n\n case 5: {\n const color = getRGB('#D5CEC3', alpha);\n\n return color;\n }\n }\n}";
4
7
  export declare const widthFunction = "function() {\n const { functional_class, road_number } = feature;\n\n const getScale = () => {\n if ($zoom <= 15 && $zoom >= 14) { return 7; }\n\n if ($zoom <= 13 && $zoom >= 12) { return 9; }\n\n if ($zoom <= 5) { return 400; }\n\n if ($zoom <= 7) { return 200; }\n\n if ($zoom < 12) { return 50; }\n\n return 1;\n }\n\n const scale = getScale();\n\n switch(functional_class) {\n case 1:\n case 2: {\n return 8 * scale;\n }\n\n case 3:\n case 4: {\n return 7 * scale;\n }\n\n case 5: {\n if (Boolean(road_number)) {\n return 7 * scale;\n }\n\n return 6;\n }\n }\n}";
5
8
  export declare const outlineColorFunction = "function() {\n const { functional_class, access_id, tollway } = feature;\n\n if (tollway) {\n return '#B9263B';\n }\n\n switch(functional_class) {\n case 5: {\n return '#989898';\n }\n\n case 3:\n case 4: {\n return '#8F6E78';\n }\n\n case 1:\n case 2: {\n return '#9A414B';\n }\n }\n}";
6
9
  export declare const outlineWidthFunction = "function() {\n const { functional_class, access_id } = feature;\n\n switch(functional_class) {\n case 5: {\n switch (access_id) {\n case 32: {\n return 0;\n }\n\n default: {\n return 1;\n }\n }\n }\n\n default: {\n return 1;\n }\n }\n}";
10
+ export declare const roadNumberLayerDraw: TangramLayerDraw;
11
+ export declare const baseLayerDraw: TangramLayerDraw;
12
+ export declare const borderLayerDraw: TangramLayerDraw;
13
+ export declare const generalizationBaseLayerDraw: TangramLayerDraw;
14
+ export declare const lowMobilityConfig: SublayerConfig;
15
+ export declare const constructionConfig: SublayerConfig;
16
+ export declare const functionalClassAccessId32Config: SublayerConfig;
7
17
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/layers/link/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,UAAwD,CAAC;AAEhF,eAAO,MAAM,gBAAgB,YAAwB,CAAC;AAEtD,eAAO,MAAM,aAAa,6wBAsCxB,CAAC;AAEH,eAAO,MAAM,aAAa,0oBAsCxB,CAAC;AAEH,eAAO,MAAM,oBAAoB,iVAsB/B,CAAC;AAEH,eAAO,MAAM,oBAAoB,4TAoB/B,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/layers/link/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,UAAU,UAWtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAAwB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,eAAO,MAAM,aAAa,6wBAsCxB,CAAC;AAEH,eAAO,MAAM,aAAa,0oBAsCxB,CAAC;AAEH,eAAO,MAAM,oBAAoB,iVAsB/B,CAAC;AAEH,eAAO,MAAM,oBAAoB,4TAoB/B,CAAC;AAcH,eAAO,MAAM,mBAAmB,EAAE,gBAejC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,gBAU3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,gBAU7B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,gBASzC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cAU/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,cAYhC,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,cAY7C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { TangramLayerDraw } from '../../lib';
2
+ export type SublayerConfig = {
3
+ filter: string;
4
+ draw: TangramLayerDraw;
5
+ };
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/layers/link/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,gBAAgB,CAAC;CACxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/layers/link/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,kBAAkB,EAElB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AAWnB,eAAO,MAAM,aAAa,GAAI,QAAQ,kBAAkB,yBAgOvD,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/layers/leaflet/layers/link/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,WAAW,CAAC;AA2BnB,eAAO,MAAM,aAAa,GAAI,QAAQ,kBAAkB,yBAqKvD,CAAC"}
package/dist/index.cjs CHANGED
@@ -25877,8 +25877,20 @@ const getLanduseAreaLayers = (source) => {
25877
25877
  return layers;
25878
25878
  };
25879
25879
 
25880
- const zLvlOrders = [-1, -0.5, -0.3, 0.0, 0.3, 0.5, 0.7, 1.0, 1.5, 2.0];
25880
+ const zLvlOrders = [
25881
+ '-1.0',
25882
+ '-0.5',
25883
+ '-0.3',
25884
+ '0.0',
25885
+ '0.3',
25886
+ '0.5',
25887
+ '0.7',
25888
+ '1.0',
25889
+ '1.5',
25890
+ '2.0',
25891
+ ];
25881
25892
  const functionInterval = [[5], [4, 3], [2, 1]];
25893
+ const generalizationZoom = 16;
25882
25894
  const colorFunction = `function() {
25883
25895
  const { functional_class, tunnel, tollway } = feature;
25884
25896
 
@@ -26001,7 +26013,101 @@ const outlineWidthFunction = `function() {
26001
26013
  }
26002
26014
  }
26003
26015
  }`;
26016
+ const text = {
26017
+ text_source: 'street_name',
26018
+ font: {
26019
+ fill: 'black',
26020
+ size: '14px',
26021
+ stroke: { color: 'white', width: '3px' },
26022
+ },
26023
+ };
26024
+ const roadNumberLayerDraw = {
26025
+ text: {
26026
+ text_source: 'road_number',
26027
+ font: {
26028
+ fill: '#181bff',
26029
+ size: '16px',
26030
+ weight: 'bold',
26031
+ underline: true,
26032
+ background: {
26033
+ color: 'black',
26034
+ },
26035
+ },
26036
+ },
26037
+ };
26038
+ const baseLayerDraw = {
26039
+ text,
26040
+ lines: {
26041
+ color: colorFunction,
26042
+ width: widthFunction,
26043
+ cap: 'round',
26044
+ join: 'round',
26045
+ },
26046
+ };
26047
+ const borderLayerDraw = {
26048
+ lines: {
26049
+ color: colorFunction,
26050
+ width: widthFunction,
26051
+ outline: {
26052
+ color: outlineColorFunction,
26053
+ width: outlineWidthFunction,
26054
+ },
26055
+ },
26056
+ };
26057
+ const generalizationBaseLayerDraw = {
26058
+ text,
26059
+ lines: {
26060
+ color: '#BABCC2',
26061
+ width: 30,
26062
+ cap: 'round',
26063
+ join: 'round',
26064
+ },
26065
+ };
26066
+ const lowMobilityConfig = {
26067
+ filter: `function() {
26068
+ return global.links.getIsLowMobility(feature);
26069
+ }`,
26070
+ draw: {
26071
+ lines: {
26072
+ width: 4,
26073
+ },
26074
+ },
26075
+ };
26076
+ const constructionConfig = {
26077
+ filter: `function() {
26078
+ return global.links.getIsConstruction(feature);
26079
+ }`,
26080
+ draw: {
26081
+ lines: {
26082
+ width: 3,
26083
+ color: '#9AA096',
26084
+ dash: [2, 1],
26085
+ },
26086
+ },
26087
+ };
26088
+ const functionalClassAccessId32Config = {
26089
+ filter: `function() {
26090
+ return global.links.getIsFunctionalClass(feature);
26091
+ }`,
26092
+ draw: {
26093
+ lines: {
26094
+ width: 2,
26095
+ color: '#9AA096',
26096
+ dash: [2, 1],
26097
+ },
26098
+ },
26099
+ };
26004
26100
 
26101
+ const getFilter = (zLvl) => {
26102
+ const filter = `function() {
26103
+ const { z_lvl = '0.0' } = feature;
26104
+
26105
+ const isFilter = z_lvl === '${zLvl}' && $zoom > ${generalizationZoom};
26106
+
26107
+ return isFilter;
26108
+ }`;
26109
+ return filter;
26110
+ };
26005
26111
  const getLinkLayers = (source) => {
26006
26112
  const layers = [];
26007
26113
  const data = {
@@ -26011,64 +26117,14 @@ const getLinkLayers = (source) => {
26011
26117
  const roadNumberLayer = {
26012
26118
  id: getUniqueKey(),
26013
26119
  data,
26014
- draw: {
26015
- text: {
26016
- text_source: 'road_number',
26017
- font: {
26018
- fill: '#181bff',
26019
- size: '16px',
26020
- weight: 'bold',
26021
- underline: true,
26022
- background: {
26023
- color: 'black',
26024
- },
26025
- },
26026
- },
26027
- },
26120
+ draw: roadNumberLayerDraw,
26028
26121
  };
26029
26122
  layers.push(roadNumberLayer);
26030
- const text = {
26031
- text_source: 'street_name',
26032
- font: {
26033
- fill: 'black',
26034
- size: '14px',
26035
- stroke: { color: 'white', width: '3px' },
26036
- },
26037
- };
26038
- const getBaseLayerDraw = () => ({
26039
- text,
26040
- lines: {
26041
- color: colorFunction,
26042
- width: widthFunction,
26043
- cap: 'round',
26044
- join: 'round',
26045
- },
26046
- });
26047
- const getBorderLayerDraw = () => ({
26048
- lines: {
26049
- color: colorFunction,
26050
- width: widthFunction,
26051
- outline: {
26052
- color: outlineColorFunction,
26053
- width: outlineWidthFunction,
26054
- },
26055
- },
26056
- });
26057
- const getFilter = (zLvl) => {
26058
- const filter = `function() {
26059
- const { z_lvl = 0.0 } = feature;
26060
-
26061
- const isFilter = +z_lvl === ${zLvl};
26062
-
26063
- return isFilter;
26064
- }`;
26065
- return filter;
26066
- };
26067
26123
  zLvlOrders.forEach((zLvl) => {
26068
26124
  const baseLayers = [];
26069
26125
  const borderLayers = [];
26070
26126
  switch (zLvl) {
26071
- case 0.0: {
26127
+ case '0.0': {
26072
26128
  functionInterval.forEach((functionClasses) => {
26073
26129
  const classBaseLayers = [];
26074
26130
  const classBorderLayers = [];
@@ -26077,47 +26133,39 @@ const getLinkLayers = (source) => {
26077
26133
  id: getUniqueKey(),
26078
26134
  data,
26079
26135
  filter: `function() {
26080
- const { functional_class, z_lvl = 0.0 } = feature;
26136
+ const { functional_class, z_lvl = '0.0' } = feature;
26081
26137
 
26082
- const isFilter = +z_lvl === ${zLvl} && +functional_class === ${functionClass};
26138
+ const isFilter = z_lvl === '${zLvl}' && +functional_class === ${functionClass} && $zoom > ${generalizationZoom};
26083
26139
 
26084
26140
  return isFilter;
26085
26141
  }`,
26086
- draw: getBaseLayerDraw(),
26142
+ draw: baseLayerDraw,
26087
26143
  sublayers: {
26088
26144
  construction: {
26089
- filter: `function() {
26090
- return global.links.getIsConstruction(feature);
26091
- }`,
26092
- draw: {
26093
- lines: {
26094
- width: 3,
26095
- color: '#9AA096',
26096
- dash: [2, 1],
26097
- },
26098
- },
26145
+ ...constructionConfig,
26099
26146
  },
26100
26147
  functionalClassAccessId32: {
26101
- filter: `function() {
26102
- return global.links.getIsFunctionalClass(feature);
26103
- }`,
26104
- draw: {
26105
- lines: {
26106
- width: 2,
26107
- color: '#9AA096',
26108
- dash: [2, 1],
26109
- },
26110
- },
26148
+ ...functionalClassAccessId32Config,
26111
26149
  },
26112
26150
  lowMobility: {
26113
- filter: `function() {
26114
- return global.links.getIsLowMobility(feature);
26115
- }`,
26116
- draw: {
26117
- lines: {
26118
- width: 4,
26119
- },
26120
- },
26151
+ ...lowMobilityConfig,
26152
+ },
26153
+ },
26154
+ };
26155
+ const generalizationLayer = {
26156
+ id: getUniqueKey(),
26157
+ data,
26158
+ filter: `function() {
26159
+ const { functional_class, z_lvl = '0.0' } = feature;
26160
+
26161
+ const isFilter = z_lvl === '${zLvl}' && +functional_class === ${functionClass} && $zoom <= ${generalizationZoom};
26162
+
26163
+ return isFilter;
26164
+ }`,
26165
+ draw: generalizationBaseLayerDraw,
26166
+ sublayers: {
26167
+ functionalClassAccessId32: {
26168
+ ...functionalClassAccessId32Config,
26121
26169
  },
26122
26170
  },
26123
26171
  };
@@ -26125,27 +26173,21 @@ const getLinkLayers = (source) => {
26125
26173
  id: getUniqueKey(),
26126
26174
  data,
26127
26175
  filter: `function() {
26128
- const { functional_class, z_lvl = 0.0 } = feature;
26176
+ const { functional_class, z_lvl = '0.0' } = feature;
26129
26177
 
26130
- const isFilter = +z_lvl === ${zLvl} && +functional_class === ${functionClass} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature);
26178
+ const isFilter = z_lvl === '${zLvl}' && +functional_class === ${functionClass} && !global.links.getIsConstruction(feature) && !global.links.getIsFunctionalClass(feature) && $zoom > ${generalizationZoom};
26131
26179
 
26132
26180
 
26133
26181
  return isFilter;
26134
26182
  }`,
26135
- draw: getBorderLayerDraw(),
26183
+ draw: borderLayerDraw,
26136
26184
  sublayers: {
26137
26185
  lowMobility: {
26138
- filter: `function() {
26139
- return global.links.getIsLowMobility(feature);
26140
- }`,
26141
- draw: {
26142
- lines: {
26143
- width: 4,
26144
- },
26145
- },
26186
+ ...lowMobilityConfig,
26146
26187
  },
26147
26188
  },
26148
26189
  };
26190
+ classBaseLayers.push(generalizationLayer);
26149
26191
  classBaseLayers.push(baseLayer);
26150
26192
  classBorderLayers.push(borderLayer);
26151
26193
  });
@@ -26160,16 +26202,29 @@ const getLinkLayers = (source) => {
26160
26202
  id: getUniqueKey(),
26161
26203
  data,
26162
26204
  filter,
26163
- draw: getBaseLayerDraw(),
26205
+ draw: baseLayerDraw,
26206
+ };
26207
+ const generalizationLayer = {
26208
+ id: getUniqueKey(),
26209
+ data,
26210
+ filter: `function() {
26211
+ const { z_lvl = '0.0' } = feature;
26212
+
26213
+ const isFilter = z_lvl === '${zLvl}' && $zoom <= ${generalizationZoom};
26214
+
26215
+ return isFilter;
26216
+ }`,
26217
+ draw: generalizationBaseLayerDraw,
26164
26218
  };
26165
26219
  const borderLayer = {
26166
26220
  id: getUniqueKey(),
26167
26221
  data,
26168
26222
  filter,
26169
- draw: getBorderLayerDraw(),
26223
+ draw: borderLayerDraw,
26170
26224
  };
26171
26225
  baseLayers.push(baseLayer);
26172
26226
  borderLayers.push(borderLayer);
26227
+ baseLayers.push(generalizationLayer);
26173
26228
  }
26174
26229
  }
26175
26230
  layers.push(...borderLayers, ...baseLayers);