Skip to content

Commit 0b4dc8d

Browse files
committed
【feature】1) 移除setSymbolProperty方法
1 parent a6945d2 commit 0b4dc8d

File tree

10 files changed

+11
-168
lines changed

10 files changed

+11
-168
lines changed

dist/mapboxgl/iclient-mapboxgl-es6.js

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -64907,48 +64907,11 @@ const LayerType = {
6490764907
}
6490864908
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
6490964909
var lodash = __webpack_require__(96486);
64910-
;// CONCATENATED MODULE: ./src/symbol/SymbolTransformUtil.js
64911-
const isPaintKey = (key) => {
64912-
return [
64913-
'icon-color',
64914-
'icon-opacity',
64915-
'icon-translate',
64916-
'line-opacity',
64917-
'line-blur',
64918-
'line-translate',
64919-
'line-color',
64920-
'line-width',
64921-
'line-offset',
64922-
'line-dasharray',
64923-
'line-pattern',
64924-
'fill-color',
64925-
'fill-opacity',
64926-
'fill-pattern',
64927-
'fill-outline-color',
64928-
'text-color',
64929-
'text-halo-blur',
64930-
'text-halo-color',
64931-
'text-halo-width',
64932-
'text-opacity',
64933-
'text-translate',
64934-
'text-translate-anchor',
64935-
'circle-blur',
64936-
'circle-color',
64937-
'circle-opacity',
64938-
'circle-translate',
64939-
'circle-radius',
64940-
'circle-stroke-color',
64941-
'circle-stroke-opacity',
64942-
'circle-stroke-width'
64943-
].includes(key);
64944-
}
64945-
6494664910
;// CONCATENATED MODULE: ./src/symbol/MapboxSymbolLayerManager.js
6494764911

6494864912

6494964913

6495064914

64951-
6495264915
// 判断符号类型
6495364916
const GET_TYPE_RULE = [{
6495464917
prefix: 'line-',
@@ -65175,22 +65138,6 @@ const MapboxSymbolLayerManager = (m) => {
6517565138
}
6517665139
},
6517765140

65178-
/**
65179-
* 更新图层上的symbol属性
65180-
* @param layerId
65181-
* @param name mapbox key
65182-
* @param value 样式值
65183-
* @returns {undefined}
65184-
*/
65185-
setSymbolProperty(layerId, name, value) {
65186-
const type = isPaintKey(name) ? 'paint' : 'layout';
65187-
const rule = {
65188-
paint: 'setPaintProperty',
65189-
layout: 'setLayoutProperty'
65190-
}
65191-
map[rule[type]](layerId, name, value);
65192-
},
65193-
6519465141
/**
6519565142
* 设置单个符号
6519665143
* @param layerId
@@ -65501,10 +65448,6 @@ var MapExtend = (function () {
6550165448
this.symbolLayerManager(this).setSymbol(layerId, symbol);
6550265449
};
6550365450

65504-
MapExtend_mapboxgl.Map.prototype.setSymbolProperty = function (layerId, name, value) {
65505-
this.symbolLayerManager(this).setSymbolProperty(layerId, name, value);
65506-
};
65507-
6550865451
if(!(MapExtend_mapboxgl.Map.prototype).setStyleBak) {
6550965452
(MapExtend_mapboxgl.Map.prototype).setStyleBak = MapExtend_mapboxgl.Map.prototype.setStyle;
6551065453
MapExtend_mapboxgl.Map.prototype.setStyle = function (style, options) {

dist/mapboxgl/iclient-mapboxgl-es6.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mapboxgl/iclient-mapboxgl.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57165,10 +57165,6 @@ var LayerType = {
5716557165
};
5716657166
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
5716757167
var lodash = __webpack_require__(61824);
57168-
;// CONCATENATED MODULE: ./src/symbol/SymbolTransformUtil.js
57169-
var isPaintKey = function isPaintKey(key) {
57170-
return ['icon-color', 'icon-opacity', 'icon-translate', 'line-opacity', 'line-blur', 'line-translate', 'line-color', 'line-width', 'line-offset', 'line-dasharray', 'line-pattern', 'fill-color', 'fill-opacity', 'fill-pattern', 'fill-outline-color', 'text-color', 'text-halo-blur', 'text-halo-color', 'text-halo-width', 'text-opacity', 'text-translate', 'text-translate-anchor', 'circle-blur', 'circle-color', 'circle-opacity', 'circle-translate', 'circle-radius', 'circle-stroke-color', 'circle-stroke-opacity', 'circle-stroke-width'].includes(key);
57171-
};
5717257168
;// CONCATENATED MODULE: ./src/symbol/MapboxSymbolLayerManager.js
5717357169
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
5717457170
function MapboxSymbolLayerManager_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -57184,7 +57180,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5718457180

5718557181

5718657182

57187-
5718857183
// 判断符号类型
5718957184
var GET_TYPE_RULE = [{
5719057185
prefix: 'line-',
@@ -57434,21 +57429,6 @@ var MapboxSymbolLayerManager = function MapboxSymbolLayerManager(m) {
5743457429
});
5743557430
}
5743657431
},
57437-
/**
57438-
* 更新图层上的symbol属性
57439-
* @param layerId
57440-
* @param name mapbox key
57441-
* @param value 样式值
57442-
* @returns {undefined}
57443-
*/
57444-
setSymbolProperty: function setSymbolProperty(layerId, name, value) {
57445-
var type = isPaintKey(name) ? 'paint' : 'layout';
57446-
var rule = {
57447-
paint: 'setPaintProperty',
57448-
layout: 'setLayoutProperty'
57449-
};
57450-
map[rule[type]](layerId, name, value);
57451-
},
5745257432
/**
5745357433
* 设置单个符号
5745457434
* @param layerId
@@ -57774,9 +57754,6 @@ var MapExtend = function () {
5777457754
MapExtend_mapboxgl.Map.prototype.setSymbol = function (layerId, symbol) {
5777557755
this.symbolLayerManager(this).setSymbol(layerId, symbol);
5777657756
};
57777-
MapExtend_mapboxgl.Map.prototype.setSymbolProperty = function (layerId, name, value) {
57778-
this.symbolLayerManager(this).setSymbolProperty(layerId, name, value);
57779-
};
5778057757
if (!MapExtend_mapboxgl.Map.prototype.setStyleBak) {
5778157758
MapExtend_mapboxgl.Map.prototype.setStyleBak = MapExtend_mapboxgl.Map.prototype.setStyle;
5778257759
MapExtend_mapboxgl.Map.prototype.setStyle = function (style, options) {

dist/mapboxgl/iclient-mapboxgl.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/mapboxgl-v2/libs/mapboxgl/iclient-mapboxgl.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57165,10 +57165,6 @@ var LayerType = {
5716557165
};
5716657166
// EXTERNAL MODULE: ./node_modules/lodash/lodash.js
5716757167
var lodash = __webpack_require__(61824);
57168-
;// CONCATENATED MODULE: ./src/symbol/SymbolTransformUtil.js
57169-
var isPaintKey = function isPaintKey(key) {
57170-
return ['icon-color', 'icon-opacity', 'icon-translate', 'line-opacity', 'line-blur', 'line-translate', 'line-color', 'line-width', 'line-offset', 'line-dasharray', 'line-pattern', 'fill-color', 'fill-opacity', 'fill-pattern', 'fill-outline-color', 'text-color', 'text-halo-blur', 'text-halo-color', 'text-halo-width', 'text-opacity', 'text-translate', 'text-translate-anchor', 'circle-blur', 'circle-color', 'circle-opacity', 'circle-translate', 'circle-radius', 'circle-stroke-color', 'circle-stroke-opacity', 'circle-stroke-width'].includes(key);
57171-
};
5717257168
;// CONCATENATED MODULE: ./src/symbol/MapboxSymbolLayerManager.js
5717357169
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
5717457170
function MapboxSymbolLayerManager_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -57184,7 +57180,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5718457180

5718557181

5718657182

57187-
5718857183
// 判断符号类型
5718957184
var GET_TYPE_RULE = [{
5719057185
prefix: 'line-',
@@ -57434,21 +57429,6 @@ var MapboxSymbolLayerManager = function MapboxSymbolLayerManager(m) {
5743457429
});
5743557430
}
5743657431
},
57437-
/**
57438-
* 更新图层上的symbol属性
57439-
* @param layerId
57440-
* @param name mapbox key
57441-
* @param value 样式值
57442-
* @returns {undefined}
57443-
*/
57444-
setSymbolProperty: function setSymbolProperty(layerId, name, value) {
57445-
var type = isPaintKey(name) ? 'paint' : 'layout';
57446-
var rule = {
57447-
paint: 'setPaintProperty',
57448-
layout: 'setLayoutProperty'
57449-
};
57450-
map[rule[type]](layerId, name, value);
57451-
},
5745257432
/**
5745357433
* 设置单个符号
5745457434
* @param layerId
@@ -57774,9 +57754,6 @@ var MapExtend = function () {
5777457754
MapExtend_mapboxgl.Map.prototype.setSymbol = function (layerId, symbol) {
5777557755
this.symbolLayerManager(this).setSymbol(layerId, symbol);
5777657756
};
57777-
MapExtend_mapboxgl.Map.prototype.setSymbolProperty = function (layerId, name, value) {
57778-
this.symbolLayerManager(this).setSymbolProperty(layerId, name, value);
57779-
};
5778057757
if (!MapExtend_mapboxgl.Map.prototype.setStyleBak) {
5778157758
MapExtend_mapboxgl.Map.prototype.setStyleBak = MapExtend_mapboxgl.Map.prototype.setStyle;
5778257759
MapExtend_mapboxgl.Map.prototype.setStyle = function (style, options) {

examples/mapboxgl-v2/src/application/App.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { cloneDeep, uniqueId } from 'lodash';
55
import { getMapboxKey, isPaintKey } from '../utils/StyleSettingUtil';
66
// import '../../../../src/mapboxgl/core/MapExtend';
77

8+
const SET_PROPERTY_RULE = {
9+
paint: 'setPaintProperty',
10+
layout: 'setLayoutProperty'
11+
}
812
const App = () => {
913
const [map, setMap] = useState<any>();
1014
const [layersInfo, setLayersInfo] = useState<any[]>([]);
@@ -260,23 +264,24 @@ const App = () => {
260264
const type = getLayerType(compositeLayerId ?? layerId);
261265
const layer = getLayer(layerId);
262266
const mapboxKey = type && getMapboxKey[type](key);
267+
const paintOrLayout = isPaintKey(mapboxKey) ? 'paint' : 'layout';
263268

264269
if (type === 'point' && key === 'color') {
265270
const ImageId: string = layer?.layout?.['icon-image'];
266271
if (ImageId && !ImageId.startsWith('sdf_')) {
267272
const sdfImageId = uniqueId('sdf_');
268273
const image = map.symbolManager.getImageInfo(ImageId);
269274
map.addImage(sdfImageId, image, { sdf: true });
270-
map.setSymbolProperty(layerId, 'icon-image', sdfImageId);
275+
map.setLayoutProperty(layerId, 'icon-image', sdfImageId);
271276
}
272277
} else if (type === 'line' && key === 'visibility') {
273278
const layerIds = map.compositeLayersManager.getLayers(layerId) ?? [layerId];
274279
layerIds.forEach((layerId) => {
275-
map.setSymbolProperty(layerId, mapboxKey, value);
280+
map[SET_PROPERTY_RULE[paintOrLayout]](layerId, mapboxKey, value);
276281
});
277282
return;
278283
}
279-
map.setSymbolProperty(layerId, mapboxKey, value);
284+
map[SET_PROPERTY_RULE[paintOrLayout]](layerId, mapboxKey, value);
280285
};
281286

282287
const getCompositeLayersIds = (layerId: string): string[] => {

src/mapboxgl/core/MapExtend.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ export var MapExtend = (function () {
134134
this.symbolLayerManager(this).setSymbol(layerId, symbol);
135135
};
136136

137-
mapboxgl.Map.prototype.setSymbolProperty = function (layerId, name, value) {
138-
this.symbolLayerManager(this).setSymbolProperty(layerId, name, value);
139-
};
140-
141137
if(!(mapboxgl.Map.prototype).setStyleBak) {
142138
(mapboxgl.Map.prototype).setStyleBak = mapboxgl.Map.prototype.setStyle;
143139
mapboxgl.Map.prototype.setStyle = function (style, options) {

src/maplibregl/core/MapExtend.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ export var MapExtend = (function () {
4646
this.symbolLayerManager('mapbox', this).setSymbol(layerId, symbol);
4747
};
4848

49-
maplibregl.Map.prototype.setSymbolProperty = function (layerId, name, value) {
50-
this.symbolLayerManager('mapbox', this).setSymbolProperty(layerId, name, value);
51-
};
52-
5349
if(!(maplibregl.Map.prototype).setStyleBak) {
5450
(maplibregl.Map.prototype).setStyleBak = maplibregl.Map.prototype.setStyle;
5551
maplibregl.Map.prototype.setStyle = function (style, options) {

src/symbol/MapboxSymbolLayerManager.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {LayerType} from "./DefaultValue";
22
import { Util } from "@supermap/iclient-common/commontypes/Util";
33
import {isArray} from "lodash";
4-
import { isPaintKey } from "./SymbolTransformUtil";
54

65
// 判断符号类型
76
const GET_TYPE_RULE = [{
@@ -229,22 +228,6 @@ const MapboxSymbolLayerManager = (m) => {
229228
}
230229
},
231230

232-
/**
233-
* 更新图层上的symbol属性
234-
* @param layerId
235-
* @param name mapbox key
236-
* @param value 样式值
237-
* @returns {undefined}
238-
*/
239-
setSymbolProperty(layerId, name, value) {
240-
const type = isPaintKey(name) ? 'paint' : 'layout';
241-
const rule = {
242-
paint: 'setPaintProperty',
243-
layout: 'setLayoutProperty'
244-
}
245-
map[rule[type]](layerId, name, value);
246-
},
247-
248231
/**
249232
* 设置单个符号
250233
* @param layerId

src/symbol/SymbolTransformUtil.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy