@antv/l7-layers 2.9.33 → 2.9.35
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/es/core/BaseLayer.js +8 -2
- package/es/core/interface.d.ts +1 -0
- package/es/mask/index.js +7 -0
- package/es/mask/models/index.d.ts +1 -1
- package/es/mask/models/index.js +3 -1
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/tileFactory/base.js +8 -6
- package/es/tile/tileFactory/index.d.ts +1 -1
- package/es/tile/tileFactory/index.js +4 -0
- package/es/tile/tileFactory/line.d.ts +1 -1
- package/es/tile/tileFactory/line.js +8 -8
- package/es/tile/tileFactory/mask.d.ts +12 -0
- package/es/tile/tileFactory/mask.js +63 -0
- package/es/tile/tileFactory/point.d.ts +1 -1
- package/es/tile/tileFactory/point.js +8 -8
- package/es/tile/tileFactory/vectorLayer.d.ts +6 -3
- package/es/tile/tileFactory/vectorLayer.js +4 -0
- package/es/utils/layerData.js +9 -6
- package/lib/core/BaseLayer.js +8 -2
- package/lib/mask/index.js +8 -0
- package/lib/mask/models/index.js +4 -1
- package/lib/tile/tileFactory/base.js +8 -7
- package/lib/tile/tileFactory/index.js +5 -0
- package/lib/tile/tileFactory/line.js +8 -8
- package/lib/tile/tileFactory/mask.js +74 -0
- package/lib/tile/tileFactory/point.js +8 -8
- package/lib/tile/tileFactory/vectorLayer.js +5 -0
- package/lib/utils/layerData.js +12 -8
- package/package.json +6 -6
package/es/core/BaseLayer.js
CHANGED
|
@@ -1390,14 +1390,20 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1390
1390
|
}, {
|
|
1391
1391
|
key: "dispatchModelLoad",
|
|
1392
1392
|
value: function dispatchModelLoad(models) {
|
|
1393
|
+
var _this11 = this;
|
|
1394
|
+
|
|
1393
1395
|
this.models.forEach(function (model) {
|
|
1394
1396
|
return model.destroy();
|
|
1395
1397
|
});
|
|
1396
1398
|
this.models = [];
|
|
1397
1399
|
this.models = models;
|
|
1398
1400
|
this.emit('modelLoaded', null);
|
|
1399
|
-
this.modelLoaded = true;
|
|
1400
|
-
|
|
1401
|
+
this.modelLoaded = true; // Tip: setTimeout 用于延迟绘制,可以让拖动图层时连续的 setData 更加平滑 - L7Draw
|
|
1402
|
+
|
|
1403
|
+
setTimeout(function () {
|
|
1404
|
+
// Tip: 使用 renderLayers 而不是 throttleRenderLayers,让图层之间的 setData 更新绘制不存在延迟
|
|
1405
|
+
_this11.layerService.renderLayers();
|
|
1406
|
+
}, 32);
|
|
1401
1407
|
}
|
|
1402
1408
|
}, {
|
|
1403
1409
|
key: "reRender",
|
package/es/core/interface.d.ts
CHANGED
|
@@ -120,6 +120,7 @@ export interface IRasterTileLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
|
120
120
|
export interface IMaskLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
121
121
|
opacity: number;
|
|
122
122
|
color: string;
|
|
123
|
+
sourceLayer?: string;
|
|
123
124
|
}
|
|
124
125
|
export interface IWindLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
125
126
|
uMin?: number;
|
package/es/mask/index.js
CHANGED
|
@@ -19,6 +19,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
19
19
|
|
|
20
20
|
import BaseLayer from "../core/BaseLayer";
|
|
21
21
|
import MaskModels from "./models";
|
|
22
|
+
import { isVectorTile } from "../tile/utils";
|
|
22
23
|
import { TYPES } from '@antv/l7-core';
|
|
23
24
|
|
|
24
25
|
var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
@@ -143,6 +144,12 @@ var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
143
144
|
}, {
|
|
144
145
|
key: "getModelType",
|
|
145
146
|
value: function getModelType() {
|
|
147
|
+
var parserType = this.layerSource.getParserType();
|
|
148
|
+
|
|
149
|
+
if (isVectorTile(parserType)) {
|
|
150
|
+
return 'vectorMask';
|
|
151
|
+
}
|
|
152
|
+
|
|
146
153
|
return 'fill';
|
|
147
154
|
}
|
|
148
155
|
}]);
|
package/es/mask/models/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export default class TileFactory implements ITileFactory {
|
|
|
30
30
|
};
|
|
31
31
|
createLayer(tileLayerOption: ILayerTileConfig): any;
|
|
32
32
|
updateStyle(styles: ITileStyles): string;
|
|
33
|
-
|
|
33
|
+
getDefaultStyleAttributeField(layer: ILayer, type: string): string | string[] | 1;
|
|
34
34
|
setStyleAttributeField(layer: ILayer, type: ScaleAttributeType, value: IScaleValue | undefined | string | string[]): ILayer | undefined;
|
|
35
35
|
protected parseScaleValue(value: IScaleValue | string, type: string): (string | number | unknown[])[] | (import("@antv/l7-core").StyleAttributeField | ((...args: any[]) => [] | undefined))[];
|
|
36
36
|
protected getTile(lng: number, lat: number): Tile;
|
|
@@ -5,7 +5,6 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
import Source from '@antv/l7-source';
|
|
7
7
|
import { osmLonLat2TileXY } from '@antv/l7-utils';
|
|
8
|
-
import MaskLayer from "../../mask";
|
|
9
8
|
import { getLayerShape, readRasterValue, registerLayers } from "../utils";
|
|
10
9
|
import VectorLayer from "./vectorLayer";
|
|
11
10
|
import * as turf from '@turf/helpers';
|
|
@@ -170,7 +169,9 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
170
169
|
var layers = [layer];
|
|
171
170
|
|
|
172
171
|
if (mask && layer.isVector) {
|
|
173
|
-
var masklayer = new
|
|
172
|
+
var masklayer = new VectorLayer({
|
|
173
|
+
layerType: "MaskLayer"
|
|
174
|
+
}).source({
|
|
174
175
|
type: 'FeatureCollection',
|
|
175
176
|
features: [tile.bboxPolygon]
|
|
176
177
|
}, {
|
|
@@ -187,15 +188,16 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
187
188
|
registerLayers(this.parentLayer, layers);
|
|
188
189
|
this.layers = [layer];
|
|
189
190
|
return layer;
|
|
190
|
-
}
|
|
191
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
192
|
+
|
|
191
193
|
}, {
|
|
192
194
|
key: "updateStyle",
|
|
193
195
|
value: function updateStyle(styles) {
|
|
194
196
|
return '';
|
|
195
197
|
}
|
|
196
198
|
}, {
|
|
197
|
-
key: "
|
|
198
|
-
value: function
|
|
199
|
+
key: "getDefaultStyleAttributeField",
|
|
200
|
+
value: function getDefaultStyleAttributeField(layer, type) {
|
|
199
201
|
switch (type) {
|
|
200
202
|
case 'size':
|
|
201
203
|
return 1;
|
|
@@ -224,7 +226,7 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
224
226
|
return;
|
|
225
227
|
}
|
|
226
228
|
|
|
227
|
-
var defaultValue = this.
|
|
229
|
+
var defaultValue = this.getDefaultStyleAttributeField(layer, type);
|
|
228
230
|
|
|
229
231
|
if (!value) {
|
|
230
232
|
layer[type](defaultValue);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IParserCfg } from '@antv/l7-core';
|
|
2
2
|
import VectorLineTile from './line';
|
|
3
|
-
export declare type TileType = 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'TileDebugLayer';
|
|
3
|
+
export declare type TileType = 'PolygonLayer' | 'PointLayer' | 'LineLayer' | 'RasterLayer' | 'MaskLayer' | 'TileDebugLayer';
|
|
4
4
|
export declare function getTileFactory(tileType: TileType, parser: IParserCfg): typeof VectorLineTile;
|
|
5
5
|
export * from '../interface';
|
|
@@ -2,6 +2,7 @@ import { rasterDataTypes } from '@antv/l7-source';
|
|
|
2
2
|
import VectorLineTile from "./line";
|
|
3
3
|
import VectorPointLayer from "./point";
|
|
4
4
|
import VectorPolygonTile from "./polygon";
|
|
5
|
+
import VectorMask from "./mask";
|
|
5
6
|
import RasterTileFactory from "./raster";
|
|
6
7
|
import RasterDataFactory from "./rasterData";
|
|
7
8
|
import TestTile from "./test";
|
|
@@ -16,6 +17,9 @@ export function getTileFactory(tileType, parser) {
|
|
|
16
17
|
case 'PointLayer':
|
|
17
18
|
return VectorPointLayer;
|
|
18
19
|
|
|
20
|
+
case 'MaskLayer':
|
|
21
|
+
return VectorMask;
|
|
22
|
+
|
|
19
23
|
case 'TileDebugLayer':
|
|
20
24
|
return TestTile;
|
|
21
25
|
|
|
@@ -2,7 +2,7 @@ import { ILayer, ISubLayerInitOptions } from '@antv/l7-core';
|
|
|
2
2
|
import { Tile } from '@antv/l7-utils';
|
|
3
3
|
import { ITileFactoryOptions } from '../interface';
|
|
4
4
|
import TileFactory from './base';
|
|
5
|
-
export default class
|
|
5
|
+
export default class VectorLineTile extends TileFactory {
|
|
6
6
|
parentLayer: ILayer;
|
|
7
7
|
constructor(option: ITileFactoryOptions);
|
|
8
8
|
createTile(tile: Tile, initOptions: ISubLayerInitOptions): {
|
|
@@ -10,22 +10,22 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
10
10
|
|
|
11
11
|
import TileFactory from "./base";
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
_inherits(
|
|
13
|
+
var VectorLineTile = /*#__PURE__*/function (_TileFactory) {
|
|
14
|
+
_inherits(VectorLineTile, _TileFactory);
|
|
15
15
|
|
|
16
|
-
var _super = _createSuper(
|
|
16
|
+
var _super = _createSuper(VectorLineTile);
|
|
17
17
|
|
|
18
|
-
function
|
|
18
|
+
function VectorLineTile(option) {
|
|
19
19
|
var _this;
|
|
20
20
|
|
|
21
|
-
_classCallCheck(this,
|
|
21
|
+
_classCallCheck(this, VectorLineTile);
|
|
22
22
|
|
|
23
23
|
_this = _super.call(this, option);
|
|
24
24
|
_this.parentLayer = option.parent;
|
|
25
25
|
return _this;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
_createClass(
|
|
28
|
+
_createClass(VectorLineTile, [{
|
|
29
29
|
key: "createTile",
|
|
30
30
|
value: function createTile(tile, initOptions) {
|
|
31
31
|
var _this$getFeatureData = this.getFeatureData(tile, initOptions),
|
|
@@ -56,7 +56,7 @@ var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
56
56
|
}
|
|
57
57
|
}]);
|
|
58
58
|
|
|
59
|
-
return
|
|
59
|
+
return VectorLineTile;
|
|
60
60
|
}(TileFactory);
|
|
61
61
|
|
|
62
|
-
export {
|
|
62
|
+
export { VectorLineTile as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ILayer, ISubLayerInitOptions } from '@antv/l7-core';
|
|
2
|
+
import { Tile } from '@antv/l7-utils';
|
|
3
|
+
import { ITileFactoryOptions } from '../interface';
|
|
4
|
+
import TileFactory from './base';
|
|
5
|
+
export default class VectorMaskTile extends TileFactory {
|
|
6
|
+
parentLayer: ILayer;
|
|
7
|
+
constructor(option: ITileFactoryOptions);
|
|
8
|
+
createTile(tile: Tile, initOptions: ISubLayerInitOptions): {
|
|
9
|
+
layers: any[];
|
|
10
|
+
layerIDList: any[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
|
|
11
|
+
import TileFactory from "./base";
|
|
12
|
+
|
|
13
|
+
var VectorMaskTile = /*#__PURE__*/function (_TileFactory) {
|
|
14
|
+
_inherits(VectorMaskTile, _TileFactory);
|
|
15
|
+
|
|
16
|
+
var _super = _createSuper(VectorMaskTile);
|
|
17
|
+
|
|
18
|
+
function VectorMaskTile(option) {
|
|
19
|
+
var _this;
|
|
20
|
+
|
|
21
|
+
_classCallCheck(this, VectorMaskTile);
|
|
22
|
+
|
|
23
|
+
_this = _super.call(this, option);
|
|
24
|
+
_this.parentLayer = option.parent;
|
|
25
|
+
return _this;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_createClass(VectorMaskTile, [{
|
|
29
|
+
key: "createTile",
|
|
30
|
+
value: function createTile(tile, initOptions) {
|
|
31
|
+
var _this$getFeatureData = this.getFeatureData(tile, initOptions),
|
|
32
|
+
features = _this$getFeatureData.features,
|
|
33
|
+
vectorTileLayer = _this$getFeatureData.vectorTileLayer,
|
|
34
|
+
source = _this$getFeatureData.source;
|
|
35
|
+
|
|
36
|
+
if (features.length === 0) {
|
|
37
|
+
return {
|
|
38
|
+
layers: [],
|
|
39
|
+
layerIDList: []
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var layer = this.createLayer({
|
|
44
|
+
tile: tile,
|
|
45
|
+
initOptions: initOptions,
|
|
46
|
+
vectorTileLayer: vectorTileLayer,
|
|
47
|
+
source: source,
|
|
48
|
+
needListen: false
|
|
49
|
+
});
|
|
50
|
+
layer.once('modelLoaded', function () {
|
|
51
|
+
tile.layerLoad();
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
layers: [layer],
|
|
55
|
+
layerIDList: [layer.id]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}]);
|
|
59
|
+
|
|
60
|
+
return VectorMaskTile;
|
|
61
|
+
}(TileFactory);
|
|
62
|
+
|
|
63
|
+
export { VectorMaskTile as default };
|
|
@@ -2,7 +2,7 @@ import { ILayer, ISubLayerInitOptions } from '@antv/l7-core';
|
|
|
2
2
|
import { Tile } from '@antv/l7-utils';
|
|
3
3
|
import { ITileFactoryOptions } from '../interface';
|
|
4
4
|
import TileFactory from './base';
|
|
5
|
-
export default class
|
|
5
|
+
export default class VectorPointTile extends TileFactory {
|
|
6
6
|
parentLayer: ILayer;
|
|
7
7
|
constructor(option: ITileFactoryOptions);
|
|
8
8
|
createTile(tile: Tile, initOptions: ISubLayerInitOptions): {
|
|
@@ -10,22 +10,22 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
10
10
|
|
|
11
11
|
import TileFactory from "./base";
|
|
12
12
|
|
|
13
|
-
var
|
|
14
|
-
_inherits(
|
|
13
|
+
var VectorPointTile = /*#__PURE__*/function (_TileFactory) {
|
|
14
|
+
_inherits(VectorPointTile, _TileFactory);
|
|
15
15
|
|
|
16
|
-
var _super = _createSuper(
|
|
16
|
+
var _super = _createSuper(VectorPointTile);
|
|
17
17
|
|
|
18
|
-
function
|
|
18
|
+
function VectorPointTile(option) {
|
|
19
19
|
var _this;
|
|
20
20
|
|
|
21
|
-
_classCallCheck(this,
|
|
21
|
+
_classCallCheck(this, VectorPointTile);
|
|
22
22
|
|
|
23
23
|
_this = _super.call(this, option);
|
|
24
24
|
_this.parentLayer = option.parent;
|
|
25
25
|
return _this;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
_createClass(
|
|
28
|
+
_createClass(VectorPointTile, [{
|
|
29
29
|
key: "createTile",
|
|
30
30
|
value: function createTile(tile, initOptions) {
|
|
31
31
|
var _this$getFeatureData = this.getFeatureData(tile, initOptions),
|
|
@@ -57,7 +57,7 @@ var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
57
57
|
}
|
|
58
58
|
}]);
|
|
59
59
|
|
|
60
|
-
return
|
|
60
|
+
return VectorPointTile;
|
|
61
61
|
}(TileFactory);
|
|
62
62
|
|
|
63
|
-
export {
|
|
63
|
+
export { VectorPointTile as default };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import BaseLayer from '../../core/BaseLayer';
|
|
2
|
-
import { ILineLayerStyleOptions, IPointLayerStyleOptions, IPolygonLayerStyleOptions } from '../../core/interface';
|
|
2
|
+
import { ILineLayerStyleOptions, IPointLayerStyleOptions, IPolygonLayerStyleOptions, IMaskLayerStyleOptions } from '../../core/interface';
|
|
3
3
|
import lineFillModel from '../../line/models/tile';
|
|
4
4
|
import lineSimpleModel from '../../line/models/simpleTileLine';
|
|
5
5
|
import pointTextModel from '../../point/models/tileText';
|
|
6
6
|
import pointFillModel from '../../point/models/tile';
|
|
7
7
|
import polygonFillModel from '../../polygon/models/tile';
|
|
8
|
-
|
|
8
|
+
import maskModel from '../../mask/models/fill';
|
|
9
|
+
declare type ILayerStyleOptions = IPolygonLayerStyleOptions & ILineLayerStyleOptions & IPointLayerStyleOptions & IMaskLayerStyleOptions;
|
|
10
|
+
export default class VectorLayer extends BaseLayer<Partial<ILayerStyleOptions & {
|
|
9
11
|
needListen: boolean;
|
|
10
12
|
}>> {
|
|
11
13
|
needListen: boolean;
|
|
@@ -19,7 +21,7 @@ export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOpt
|
|
|
19
21
|
setPickID(): number | null;
|
|
20
22
|
buildModels(): void;
|
|
21
23
|
rebuildModels(): void;
|
|
22
|
-
protected getModelType(): typeof lineFillModel | typeof lineSimpleModel | typeof pointTextModel | typeof pointFillModel | typeof polygonFillModel;
|
|
24
|
+
protected getModelType(): typeof lineFillModel | typeof lineSimpleModel | typeof pointTextModel | typeof pointFillModel | typeof polygonFillModel | typeof maskModel;
|
|
23
25
|
protected getLineModel(): typeof lineFillModel | typeof lineSimpleModel;
|
|
24
26
|
protected getPointModel(): typeof pointTextModel | typeof pointFillModel;
|
|
25
27
|
protected getConfigSchema(): {
|
|
@@ -33,3 +35,4 @@ export default class VectorLayer extends BaseLayer<Partial<IPolygonLayerStyleOpt
|
|
|
33
35
|
};
|
|
34
36
|
protected getDefaultConfig(): {};
|
|
35
37
|
}
|
|
38
|
+
export {};
|
|
@@ -24,6 +24,7 @@ import lineSimpleModel from "../../line/models/simpleTileLine";
|
|
|
24
24
|
import pointTextModel from "../../point/models/tileText";
|
|
25
25
|
import pointFillModel from "../../point/models/tile";
|
|
26
26
|
import polygonFillModel from "../../polygon/models/tile";
|
|
27
|
+
import maskModel from "../../mask/models/fill";
|
|
27
28
|
|
|
28
29
|
var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
29
30
|
_inherits(VectorLayer, _BaseLayer);
|
|
@@ -186,6 +187,9 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
186
187
|
case 'PointLayer':
|
|
187
188
|
return this.getPointModel();
|
|
188
189
|
|
|
190
|
+
case 'MaskLayer':
|
|
191
|
+
return maskModel;
|
|
192
|
+
|
|
189
193
|
default:
|
|
190
194
|
return pointFillModel;
|
|
191
195
|
}
|
package/es/utils/layerData.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Version } from '@antv/l7-maps';
|
|
2
2
|
import Source from '@antv/l7-source';
|
|
3
3
|
import { isColor, normalize, rgb2arr } from '@antv/l7-utils';
|
|
4
|
+
import { cloneDeep } from 'lodash';
|
|
4
5
|
|
|
5
6
|
function getArrowPoints(p1, p2) {
|
|
6
7
|
var dir = [p2[0] - p1[0], p2[1] - p1[1]];
|
|
@@ -9,11 +10,11 @@ function getArrowPoints(p1, p2) {
|
|
|
9
10
|
return arrowPoint;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
function adjustData2Amap2Coordinates(mappedData, mapService) {
|
|
13
|
-
var _this = this;
|
|
14
|
-
|
|
13
|
+
function adjustData2Amap2Coordinates(mappedData, mapService, layer) {
|
|
15
14
|
// 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
|
|
16
15
|
if (mappedData.length > 0 && mapService.version === Version['GAODE2.x']) {
|
|
16
|
+
var layerCenter = layer.coordCenter;
|
|
17
|
+
|
|
17
18
|
if (typeof mappedData[0].coordinates[0] === 'number') {
|
|
18
19
|
// 单个的点数据
|
|
19
20
|
// @ts-ignore
|
|
@@ -25,8 +26,9 @@ function adjustData2Amap2Coordinates(mappedData, mapService) {
|
|
|
25
26
|
|
|
26
27
|
d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
27
28
|
// @ts-ignore
|
|
29
|
+
// d.coordinates = mapService.lngLatToCoord(d.coordinates);
|
|
28
30
|
|
|
29
|
-
d.coordinates =
|
|
31
|
+
d.coordinates = mapService.lngLatToCoordByLayer(d.coordinates, layerCenter);
|
|
30
32
|
});
|
|
31
33
|
} else {
|
|
32
34
|
// 连续的线、面数据
|
|
@@ -39,8 +41,9 @@ function adjustData2Amap2Coordinates(mappedData, mapService) {
|
|
|
39
41
|
|
|
40
42
|
d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
41
43
|
// @ts-ignore
|
|
44
|
+
// d.coordinates = mapService.lngLatToCoords(d.coordinates);
|
|
42
45
|
|
|
43
|
-
d.coordinates =
|
|
46
|
+
d.coordinates = mapService.lngLatToCoordsByLayer(d.coordinates, layerCenter);
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
49
|
}
|
|
@@ -158,7 +161,7 @@ function mapping(attributes, data, fontService, mapService, minimumColor, layer)
|
|
|
158
161
|
return encodeRecord;
|
|
159
162
|
}); // 调整数据兼容 Amap2.0
|
|
160
163
|
|
|
161
|
-
adjustData2Amap2Coordinates(mappedData, mapService); // 调整数据兼容 SimpleCoordinates
|
|
164
|
+
adjustData2Amap2Coordinates(mappedData, mapService, layer); // 调整数据兼容 SimpleCoordinates
|
|
162
165
|
|
|
163
166
|
adjustData2SimpleCoordinates(mappedData, mapService);
|
|
164
167
|
return mappedData;
|
package/lib/core/BaseLayer.js
CHANGED
|
@@ -1386,14 +1386,20 @@ var BaseLayer = (_dec = (0, _l7Core.lazyInject)(_l7Core.TYPES.IGlobalConfigServi
|
|
|
1386
1386
|
}, {
|
|
1387
1387
|
key: "dispatchModelLoad",
|
|
1388
1388
|
value: function dispatchModelLoad(models) {
|
|
1389
|
+
var _this11 = this;
|
|
1390
|
+
|
|
1389
1391
|
this.models.forEach(function (model) {
|
|
1390
1392
|
return model.destroy();
|
|
1391
1393
|
});
|
|
1392
1394
|
this.models = [];
|
|
1393
1395
|
this.models = models;
|
|
1394
1396
|
this.emit('modelLoaded', null);
|
|
1395
|
-
this.modelLoaded = true;
|
|
1396
|
-
|
|
1397
|
+
this.modelLoaded = true; // Tip: setTimeout 用于延迟绘制,可以让拖动图层时连续的 setData 更加平滑 - L7Draw
|
|
1398
|
+
|
|
1399
|
+
setTimeout(function () {
|
|
1400
|
+
// Tip: 使用 renderLayers 而不是 throttleRenderLayers,让图层之间的 setData 更新绘制不存在延迟
|
|
1401
|
+
_this11.layerService.renderLayers();
|
|
1402
|
+
}, 32);
|
|
1397
1403
|
}
|
|
1398
1404
|
}, {
|
|
1399
1405
|
key: "reRender",
|
package/lib/mask/index.js
CHANGED
|
@@ -27,6 +27,8 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
|
27
27
|
|
|
28
28
|
var _models = _interopRequireDefault(require("./models"));
|
|
29
29
|
|
|
30
|
+
var _utils = require("../tile/utils");
|
|
31
|
+
|
|
30
32
|
var _l7Core = require("@antv/l7-core");
|
|
31
33
|
|
|
32
34
|
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; } } }; }
|
|
@@ -159,6 +161,12 @@ var MaskLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
159
161
|
}, {
|
|
160
162
|
key: "getModelType",
|
|
161
163
|
value: function getModelType() {
|
|
164
|
+
var parserType = this.layerSource.getParserType();
|
|
165
|
+
|
|
166
|
+
if ((0, _utils.isVectorTile)(parserType)) {
|
|
167
|
+
return 'vectorMask';
|
|
168
|
+
}
|
|
169
|
+
|
|
162
170
|
return 'fill';
|
|
163
171
|
}
|
|
164
172
|
}]);
|
package/lib/mask/models/index.js
CHANGED
|
@@ -7,10 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _tileModel = _interopRequireDefault(require("../../tile/models/tileModel"));
|
|
11
|
+
|
|
10
12
|
var _fill = _interopRequireDefault(require("./fill"));
|
|
11
13
|
|
|
12
14
|
var MaskModels = {
|
|
13
|
-
fill: _fill.default
|
|
15
|
+
fill: _fill.default,
|
|
16
|
+
vectorMask: _tileModel.default
|
|
14
17
|
};
|
|
15
18
|
var _default = MaskModels;
|
|
16
19
|
exports.default = _default;
|
|
@@ -23,8 +23,6 @@ var _l7Source = _interopRequireDefault(require("@antv/l7-source"));
|
|
|
23
23
|
|
|
24
24
|
var _l7Utils = require("@antv/l7-utils");
|
|
25
25
|
|
|
26
|
-
var _mask = _interopRequireDefault(require("../../mask"));
|
|
27
|
-
|
|
28
26
|
var _utils = require("../utils");
|
|
29
27
|
|
|
30
28
|
var _vectorLayer = _interopRequireDefault(require("./vectorLayer"));
|
|
@@ -196,7 +194,9 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
196
194
|
var layers = [layer];
|
|
197
195
|
|
|
198
196
|
if (mask && layer.isVector) {
|
|
199
|
-
var masklayer = new
|
|
197
|
+
var masklayer = new _vectorLayer.default({
|
|
198
|
+
layerType: "MaskLayer"
|
|
199
|
+
}).source({
|
|
200
200
|
type: 'FeatureCollection',
|
|
201
201
|
features: [tile.bboxPolygon]
|
|
202
202
|
}, {
|
|
@@ -213,15 +213,16 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
213
213
|
(0, _utils.registerLayers)(this.parentLayer, layers);
|
|
214
214
|
this.layers = [layer];
|
|
215
215
|
return layer;
|
|
216
|
-
}
|
|
216
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
217
|
+
|
|
217
218
|
}, {
|
|
218
219
|
key: "updateStyle",
|
|
219
220
|
value: function updateStyle(styles) {
|
|
220
221
|
return '';
|
|
221
222
|
}
|
|
222
223
|
}, {
|
|
223
|
-
key: "
|
|
224
|
-
value: function
|
|
224
|
+
key: "getDefaultStyleAttributeField",
|
|
225
|
+
value: function getDefaultStyleAttributeField(layer, type) {
|
|
225
226
|
switch (type) {
|
|
226
227
|
case 'size':
|
|
227
228
|
return 1;
|
|
@@ -250,7 +251,7 @@ var TileFactory = /*#__PURE__*/function () {
|
|
|
250
251
|
return;
|
|
251
252
|
}
|
|
252
253
|
|
|
253
|
-
var defaultValue = this.
|
|
254
|
+
var defaultValue = this.getDefaultStyleAttributeField(layer, type);
|
|
254
255
|
|
|
255
256
|
if (!value) {
|
|
256
257
|
layer[type](defaultValue);
|
|
@@ -18,6 +18,8 @@ var _point = _interopRequireDefault(require("./point"));
|
|
|
18
18
|
|
|
19
19
|
var _polygon = _interopRequireDefault(require("./polygon"));
|
|
20
20
|
|
|
21
|
+
var _mask = _interopRequireDefault(require("./mask"));
|
|
22
|
+
|
|
21
23
|
var _raster = _interopRequireDefault(require("./raster"));
|
|
22
24
|
|
|
23
25
|
var _rasterData = _interopRequireDefault(require("./rasterData"));
|
|
@@ -49,6 +51,9 @@ function getTileFactory(tileType, parser) {
|
|
|
49
51
|
case 'PointLayer':
|
|
50
52
|
return _point.default;
|
|
51
53
|
|
|
54
|
+
case 'MaskLayer':
|
|
55
|
+
return _mask.default;
|
|
56
|
+
|
|
52
57
|
case 'TileDebugLayer':
|
|
53
58
|
return _test.default;
|
|
54
59
|
|
|
@@ -23,21 +23,21 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
23
23
|
|
|
24
24
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
25
|
|
|
26
|
-
var
|
|
27
|
-
(0, _inherits2.default)(
|
|
26
|
+
var VectorLineTile = /*#__PURE__*/function (_TileFactory) {
|
|
27
|
+
(0, _inherits2.default)(VectorLineTile, _TileFactory);
|
|
28
28
|
|
|
29
|
-
var _super = _createSuper(
|
|
29
|
+
var _super = _createSuper(VectorLineTile);
|
|
30
30
|
|
|
31
|
-
function
|
|
31
|
+
function VectorLineTile(option) {
|
|
32
32
|
var _this;
|
|
33
33
|
|
|
34
|
-
(0, _classCallCheck2.default)(this,
|
|
34
|
+
(0, _classCallCheck2.default)(this, VectorLineTile);
|
|
35
35
|
_this = _super.call(this, option);
|
|
36
36
|
_this.parentLayer = option.parent;
|
|
37
37
|
return _this;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
(0, _createClass2.default)(
|
|
40
|
+
(0, _createClass2.default)(VectorLineTile, [{
|
|
41
41
|
key: "createTile",
|
|
42
42
|
value: function createTile(tile, initOptions) {
|
|
43
43
|
var _this$getFeatureData = this.getFeatureData(tile, initOptions),
|
|
@@ -67,7 +67,7 @@ var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
}]);
|
|
70
|
-
return
|
|
70
|
+
return VectorLineTile;
|
|
71
71
|
}(_base.default);
|
|
72
72
|
|
|
73
|
-
exports.default =
|
|
73
|
+
exports.default = VectorLineTile;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
|
|
16
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
+
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
+
|
|
20
|
+
var _base = _interopRequireDefault(require("./base"));
|
|
21
|
+
|
|
22
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
|
+
|
|
24
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
|
+
|
|
26
|
+
var VectorMaskTile = /*#__PURE__*/function (_TileFactory) {
|
|
27
|
+
(0, _inherits2.default)(VectorMaskTile, _TileFactory);
|
|
28
|
+
|
|
29
|
+
var _super = _createSuper(VectorMaskTile);
|
|
30
|
+
|
|
31
|
+
function VectorMaskTile(option) {
|
|
32
|
+
var _this;
|
|
33
|
+
|
|
34
|
+
(0, _classCallCheck2.default)(this, VectorMaskTile);
|
|
35
|
+
_this = _super.call(this, option);
|
|
36
|
+
_this.parentLayer = option.parent;
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
(0, _createClass2.default)(VectorMaskTile, [{
|
|
41
|
+
key: "createTile",
|
|
42
|
+
value: function createTile(tile, initOptions) {
|
|
43
|
+
var _this$getFeatureData = this.getFeatureData(tile, initOptions),
|
|
44
|
+
features = _this$getFeatureData.features,
|
|
45
|
+
vectorTileLayer = _this$getFeatureData.vectorTileLayer,
|
|
46
|
+
source = _this$getFeatureData.source;
|
|
47
|
+
|
|
48
|
+
if (features.length === 0) {
|
|
49
|
+
return {
|
|
50
|
+
layers: [],
|
|
51
|
+
layerIDList: []
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var layer = this.createLayer({
|
|
56
|
+
tile: tile,
|
|
57
|
+
initOptions: initOptions,
|
|
58
|
+
vectorTileLayer: vectorTileLayer,
|
|
59
|
+
source: source,
|
|
60
|
+
needListen: false
|
|
61
|
+
});
|
|
62
|
+
layer.once('modelLoaded', function () {
|
|
63
|
+
tile.layerLoad();
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
layers: [layer],
|
|
67
|
+
layerIDList: [layer.id]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}]);
|
|
71
|
+
return VectorMaskTile;
|
|
72
|
+
}(_base.default);
|
|
73
|
+
|
|
74
|
+
exports.default = VectorMaskTile;
|
|
@@ -23,21 +23,21 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
23
23
|
|
|
24
24
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
25
25
|
|
|
26
|
-
var
|
|
27
|
-
(0, _inherits2.default)(
|
|
26
|
+
var VectorPointTile = /*#__PURE__*/function (_TileFactory) {
|
|
27
|
+
(0, _inherits2.default)(VectorPointTile, _TileFactory);
|
|
28
28
|
|
|
29
|
-
var _super = _createSuper(
|
|
29
|
+
var _super = _createSuper(VectorPointTile);
|
|
30
30
|
|
|
31
|
-
function
|
|
31
|
+
function VectorPointTile(option) {
|
|
32
32
|
var _this;
|
|
33
33
|
|
|
34
|
-
(0, _classCallCheck2.default)(this,
|
|
34
|
+
(0, _classCallCheck2.default)(this, VectorPointTile);
|
|
35
35
|
_this = _super.call(this, option);
|
|
36
36
|
_this.parentLayer = option.parent;
|
|
37
37
|
return _this;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
(0, _createClass2.default)(
|
|
40
|
+
(0, _createClass2.default)(VectorPointTile, [{
|
|
41
41
|
key: "createTile",
|
|
42
42
|
value: function createTile(tile, initOptions) {
|
|
43
43
|
var _this$getFeatureData = this.getFeatureData(tile, initOptions),
|
|
@@ -68,7 +68,7 @@ var VectorPolygonTile = /*#__PURE__*/function (_TileFactory) {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
}]);
|
|
71
|
-
return
|
|
71
|
+
return VectorPointTile;
|
|
72
72
|
}(_base.default);
|
|
73
73
|
|
|
74
|
-
exports.default =
|
|
74
|
+
exports.default = VectorPointTile;
|
|
@@ -37,6 +37,8 @@ var _tile2 = _interopRequireDefault(require("../../point/models/tile"));
|
|
|
37
37
|
|
|
38
38
|
var _tile3 = _interopRequireDefault(require("../../polygon/models/tile"));
|
|
39
39
|
|
|
40
|
+
var _fill = _interopRequireDefault(require("../../mask/models/fill"));
|
|
41
|
+
|
|
40
42
|
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; } } }; }
|
|
41
43
|
|
|
42
44
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -202,6 +204,9 @@ var VectorLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
202
204
|
case 'PointLayer':
|
|
203
205
|
return this.getPointModel();
|
|
204
206
|
|
|
207
|
+
case 'MaskLayer':
|
|
208
|
+
return _fill.default;
|
|
209
|
+
|
|
205
210
|
default:
|
|
206
211
|
return _tile2.default;
|
|
207
212
|
}
|
package/lib/utils/layerData.js
CHANGED
|
@@ -13,6 +13,8 @@ var _l7Source = _interopRequireDefault(require("@antv/l7-source"));
|
|
|
13
13
|
|
|
14
14
|
var _l7Utils = require("@antv/l7-utils");
|
|
15
15
|
|
|
16
|
+
var _lodash = require("lodash");
|
|
17
|
+
|
|
16
18
|
function getArrowPoints(p1, p2) {
|
|
17
19
|
var dir = [p2[0] - p1[0], p2[1] - p1[1]];
|
|
18
20
|
var normalizeDir = (0, _l7Utils.normalize)(dir);
|
|
@@ -20,11 +22,11 @@ function getArrowPoints(p1, p2) {
|
|
|
20
22
|
return arrowPoint;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
function adjustData2Amap2Coordinates(mappedData, mapService) {
|
|
24
|
-
var _this = this;
|
|
25
|
-
|
|
25
|
+
function adjustData2Amap2Coordinates(mappedData, mapService, layer) {
|
|
26
26
|
// 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
|
|
27
27
|
if (mappedData.length > 0 && mapService.version === _l7Maps.Version['GAODE2.x']) {
|
|
28
|
+
var layerCenter = layer.coordCenter;
|
|
29
|
+
|
|
28
30
|
if (typeof mappedData[0].coordinates[0] === 'number') {
|
|
29
31
|
// 单个的点数据
|
|
30
32
|
// @ts-ignore
|
|
@@ -34,10 +36,11 @@ function adjustData2Amap2Coordinates(mappedData, mapService) {
|
|
|
34
36
|
}).map(function (d) {
|
|
35
37
|
d.version = _l7Maps.Version['GAODE2.x']; // @ts-ignore
|
|
36
38
|
|
|
37
|
-
d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
39
|
+
d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
38
40
|
// @ts-ignore
|
|
41
|
+
// d.coordinates = mapService.lngLatToCoord(d.coordinates);
|
|
39
42
|
|
|
40
|
-
d.coordinates =
|
|
43
|
+
d.coordinates = mapService.lngLatToCoordByLayer(d.coordinates, layerCenter);
|
|
41
44
|
});
|
|
42
45
|
} else {
|
|
43
46
|
// 连续的线、面数据
|
|
@@ -48,10 +51,11 @@ function adjustData2Amap2Coordinates(mappedData, mapService) {
|
|
|
48
51
|
}).map(function (d) {
|
|
49
52
|
d.version = _l7Maps.Version['GAODE2.x']; // @ts-ignore
|
|
50
53
|
|
|
51
|
-
d.originCoordinates = cloneDeep(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
54
|
+
d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
52
55
|
// @ts-ignore
|
|
56
|
+
// d.coordinates = mapService.lngLatToCoords(d.coordinates);
|
|
53
57
|
|
|
54
|
-
d.coordinates =
|
|
58
|
+
d.coordinates = mapService.lngLatToCoordsByLayer(d.coordinates, layerCenter);
|
|
55
59
|
});
|
|
56
60
|
}
|
|
57
61
|
}
|
|
@@ -169,7 +173,7 @@ function mapping(attributes, data, fontService, mapService, minimumColor, layer)
|
|
|
169
173
|
return encodeRecord;
|
|
170
174
|
}); // 调整数据兼容 Amap2.0
|
|
171
175
|
|
|
172
|
-
adjustData2Amap2Coordinates(mappedData, mapService); // 调整数据兼容 SimpleCoordinates
|
|
176
|
+
adjustData2Amap2Coordinates(mappedData, mapService, layer); // 调整数据兼容 SimpleCoordinates
|
|
173
177
|
|
|
174
178
|
adjustData2SimpleCoordinates(mappedData, mapService);
|
|
175
179
|
return mappedData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.35",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@antv/async-hook": "^2.2.2",
|
|
30
|
-
"@antv/l7-core": "2.9.
|
|
31
|
-
"@antv/l7-maps": "2.9.
|
|
32
|
-
"@antv/l7-source": "2.9.
|
|
33
|
-
"@antv/l7-utils": "2.9.
|
|
30
|
+
"@antv/l7-core": "2.9.35",
|
|
31
|
+
"@antv/l7-maps": "2.9.35",
|
|
32
|
+
"@antv/l7-source": "2.9.35",
|
|
33
|
+
"@antv/l7-utils": "2.9.35",
|
|
34
34
|
"@babel/runtime": "^7.7.7",
|
|
35
35
|
"@mapbox/martini": "^0.2.0",
|
|
36
36
|
"@turf/clone": "^6.5.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@types/gl-matrix": "^2.4.5",
|
|
62
62
|
"@types/lodash": "^4.14.138"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "b61714e6b9e5e2179a1ac86b757a4ec6277f545a",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|