@antv/l7-layers 2.9.23 → 2.9.25
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/Geometry/models/plane.d.ts +1 -0
- package/es/citybuliding/building.js +1 -1
- package/es/core/BaseLayer.js +10 -3
- package/es/core/interface.d.ts +26 -48
- package/es/core/interface.js +3 -0
- package/es/core/schema.d.ts +3 -3
- package/es/core/triangulation.d.ts +4 -3
- package/es/core/triangulation.js +54 -39
- package/es/heatmap/models/heatmap.js +1 -1
- package/es/image/models/image.js +7 -1
- package/es/line/index.js +4 -1
- package/es/line/models/arc.js +1 -1
- package/es/line/models/simpleLine.js +1 -1
- package/es/line/shaders/line_arc_vert.glsl +5 -3
- package/es/line/shaders/simple/simpleline_vert.glsl +1 -0
- package/es/plugins/FeatureScalePlugin.js +0 -1
- package/es/point/index.js +3 -1
- package/es/point/models/fill.js +5 -2
- package/es/point/models/fillmage.js +9 -3
- package/es/point/models/image.js +8 -2
- package/es/point/models/radar.js +2 -3
- package/es/point/models/tile.js +1 -1
- package/es/point/shaders/fill_vert.glsl +13 -6
- package/es/point/shaders/image/fillImage_vert.glsl +13 -5
- package/es/point/shaders/image_vert.glsl +17 -8
- package/es/polygon/index.js +4 -1
- package/es/raster/index.js +3 -1
- package/es/tile/manager/tileLayerManager.d.ts +3 -2
- package/es/tile/manager/tileLayerManager.js +5 -2
- package/es/tile/models/tileModel.js +4 -3
- package/es/tile/tileFactory/base.d.ts +1 -1
- package/es/tile/tileFactory/base.js +32 -5
- package/es/tile/tileFactory/vectorLayer.d.ts +3 -1
- package/es/tile/tileFactory/vectorLayer.js +22 -1
- package/es/tile/tileLayer/baseTileLayer.d.ts +1 -1
- package/es/tile/tileLayer/baseTileLayer.js +3 -2
- package/es/tile/utils.d.ts +2 -0
- package/es/tile/utils.js +5 -1
- package/lib/Geometry/index.js +114 -77
- package/lib/Geometry/models/billboard.js +232 -181
- package/lib/Geometry/models/index.js +18 -34
- package/lib/Geometry/models/plane.js +407 -278
- package/lib/Geometry/models/sprite.js +291 -189
- package/lib/canvas/index.js +101 -66
- package/lib/canvas/models/canvas.js +207 -140
- package/lib/canvas/models/index.js +12 -30
- package/lib/citybuliding/building.js +98 -63
- package/lib/citybuliding/models/build.js +192 -146
- package/lib/core/BaseLayer.js +1331 -809
- package/lib/core/BaseModel.js +457 -279
- package/lib/core/interface.js +40 -53
- package/lib/core/schema.js +21 -39
- package/lib/core/shape/Path.js +67 -79
- package/lib/core/shape/extrude.js +132 -91
- package/lib/core/triangulation.js +412 -213
- package/lib/earth/index.js +100 -62
- package/lib/earth/models/atmosphere.js +146 -112
- package/lib/earth/models/base.js +210 -150
- package/lib/earth/models/bloomsphere.js +146 -112
- package/lib/earth/utils.js +111 -91
- package/lib/heatmap/index.js +149 -92
- package/lib/heatmap/models/grid.js +118 -91
- package/lib/heatmap/models/grid3d.js +155 -123
- package/lib/heatmap/models/heatmap.js +475 -338
- package/lib/heatmap/models/hexagon.js +121 -92
- package/lib/heatmap/models/index.js +22 -37
- package/lib/heatmap/triangulation.js +31 -47
- package/lib/image/index.js +111 -74
- package/lib/image/models/dataImage.js +232 -174
- package/lib/image/models/image.js +175 -123
- package/lib/image/models/index.js +15 -32
- package/lib/index.js +263 -97
- package/lib/line/index.js +131 -83
- package/lib/line/models/arc.js +352 -237
- package/lib/line/models/arc_3d.js +334 -228
- package/lib/line/models/earthArc_3d.js +336 -228
- package/lib/line/models/great_circle.js +291 -200
- package/lib/line/models/half.js +286 -201
- package/lib/line/models/index.js +42 -50
- package/lib/line/models/line.js +428 -299
- package/lib/line/models/linearline.js +277 -203
- package/lib/line/models/simpleLine.js +239 -175
- package/lib/line/models/tile.js +348 -237
- package/lib/line/models/wall.js +327 -235
- package/lib/line/shaders/line_arc_vert.glsl +5 -3
- package/lib/line/shaders/simple/simpleline_vert.glsl +1 -0
- package/lib/mask/index.js +92 -59
- package/lib/mask/models/fill.js +134 -82
- package/lib/mask/models/index.js +12 -30
- package/lib/plugins/DataMappingPlugin.js +342 -224
- package/lib/plugins/DataSourcePlugin.js +102 -87
- package/lib/plugins/FeatureScalePlugin.js +330 -241
- package/lib/plugins/LayerAnimateStylePlugin.js +61 -55
- package/lib/plugins/LayerModelPlugin.js +80 -73
- package/lib/plugins/LayerStylePlugin.js +48 -51
- package/lib/plugins/LightingPlugin.js +80 -68
- package/lib/plugins/MultiPassRendererPlugin.js +91 -65
- package/lib/plugins/PixelPickingPlugin.js +150 -109
- package/lib/plugins/RegisterStyleAttributePlugin.js +110 -110
- package/lib/plugins/ShaderUniformPlugin.js +118 -99
- package/lib/plugins/UpdateModelPlugin.js +40 -47
- package/lib/plugins/UpdateStyleAttributePlugin.js +93 -75
- package/lib/point/index.js +226 -148
- package/lib/point/models/earthExtrude.js +279 -201
- package/lib/point/models/earthFill.js +287 -202
- package/lib/point/models/extrude.js +299 -203
- package/lib/point/models/fill.js +406 -273
- package/lib/point/models/fillmage.js +365 -252
- package/lib/point/models/image.js +241 -164
- package/lib/point/models/index.js +46 -52
- package/lib/point/models/normal.js +183 -134
- package/lib/point/models/radar.js +304 -212
- package/lib/point/models/simplePoint.js +194 -142
- package/lib/point/models/text.js +608 -385
- package/lib/point/models/tile.js +314 -223
- package/lib/point/shaders/fill_vert.glsl +13 -6
- package/lib/point/shaders/image/fillImage_vert.glsl +13 -5
- package/lib/point/shaders/image_vert.glsl +17 -8
- package/lib/point/shape/extrude.js +56 -52
- package/lib/polygon/index.js +154 -100
- package/lib/polygon/models/extrude.js +311 -223
- package/lib/polygon/models/fill.js +215 -153
- package/lib/polygon/models/index.js +46 -52
- package/lib/polygon/models/ocean.js +244 -173
- package/lib/polygon/models/tile.js +144 -100
- package/lib/polygon/models/water.js +222 -153
- package/lib/raster/buffers/triangulation.js +27 -40
- package/lib/raster/index.js +115 -74
- package/lib/raster/models/index.js +16 -33
- package/lib/raster/models/raster.js +178 -135
- package/lib/raster/raster.js +187 -132
- package/lib/tile/interface.js +4 -16
- package/lib/tile/manager/tileConfigManager.js +125 -86
- package/lib/tile/manager/tileLayerManager.js +314 -227
- package/lib/tile/manager/tilePickerManager.js +192 -123
- package/lib/tile/models/tileModel.js +71 -51
- package/lib/tile/tileFactory/base.js +433 -292
- package/lib/tile/tileFactory/index.js +51 -49
- package/lib/tile/tileFactory/line.js +65 -50
- package/lib/tile/tileFactory/point.js +65 -50
- package/lib/tile/tileFactory/polygon.js +65 -50
- package/lib/tile/tileFactory/raster.js +66 -54
- package/lib/tile/tileFactory/rasterData.js +88 -76
- package/lib/tile/tileFactory/rasterDataLayer.js +97 -62
- package/lib/tile/tileFactory/vectorLayer.js +169 -95
- package/lib/tile/tileLayer/baseTileLayer.js +420 -220
- package/lib/tile/tmsTileLayer.js +110 -67
- package/lib/tile/utils.js +113 -87
- package/lib/utils/blend.js +59 -79
- package/lib/utils/collision-index.js +107 -64
- package/lib/utils/dataMappingStyle.js +105 -60
- package/lib/utils/extrude_polyline.js +600 -398
- package/lib/utils/grid-index.js +163 -111
- package/lib/utils/layerData.js +130 -99
- package/lib/utils/multiPassRender.js +49 -41
- package/lib/utils/polylineNormal.js +148 -96
- package/lib/utils/simpleLine.js +100 -85
- package/lib/utils/symbol-layout.js +219 -116
- package/lib/utils/updateShape.js +15 -41
- package/lib/wind/index.js +109 -71
- package/lib/wind/models/index.js +12 -30
- package/lib/wind/models/utils.js +144 -105
- package/lib/wind/models/wind.js +333 -224
- package/lib/wind/models/windRender.js +329 -218
- package/lib/wind/models/windShader.js +23 -181
- package/package.json +7 -6
|
@@ -23,6 +23,7 @@ export default class PlaneModel extends BaseModel {
|
|
|
23
23
|
[attributeName: string]: import("@antv/l7-core").IAttribute;
|
|
24
24
|
};
|
|
25
25
|
elements: import("@antv/l7-core").IElements;
|
|
26
|
+
count: number | null;
|
|
26
27
|
};
|
|
27
28
|
updateTexture(mapTexture: string | undefined): void;
|
|
28
29
|
protected getImageData(img: HTMLImageElement): ImageData;
|
|
@@ -29,7 +29,7 @@ var CityBuildingLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
29
29
|
|
|
30
30
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
31
|
|
|
32
|
-
_defineProperty(_assertThisInitialized(_this), "type", '
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "type", 'CityBuildingLayer');
|
|
33
33
|
|
|
34
34
|
return _this;
|
|
35
35
|
}
|
package/es/core/BaseLayer.js
CHANGED
|
@@ -1181,16 +1181,23 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1181
1181
|
} else {
|
|
1182
1182
|
var _this9$styleAttribute = _this9.styleAttributeService.createAttributesAndIndices(_this9.encodedData, triangulation, segmentNumber),
|
|
1183
1183
|
attributes = _this9$styleAttribute.attributes,
|
|
1184
|
-
elements = _this9$styleAttribute.elements
|
|
1184
|
+
elements = _this9$styleAttribute.elements,
|
|
1185
|
+
count = _this9$styleAttribute.count;
|
|
1185
1186
|
|
|
1186
|
-
var
|
|
1187
|
+
var modeloptions = _objectSpread({
|
|
1187
1188
|
attributes: attributes,
|
|
1188
1189
|
uniforms: uniforms,
|
|
1189
1190
|
fs: fs,
|
|
1190
1191
|
vs: vs,
|
|
1191
1192
|
elements: elements,
|
|
1192
1193
|
blend: BlendTypes[BlendType.normal]
|
|
1193
|
-
}, rest)
|
|
1194
|
+
}, rest);
|
|
1195
|
+
|
|
1196
|
+
if (count) {
|
|
1197
|
+
modeloptions.count = count;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
var m = createModel(modeloptions);
|
|
1194
1201
|
resolve(m);
|
|
1195
1202
|
}
|
|
1196
1203
|
});
|
package/es/core/interface.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAnimateOption, IMapService } from '@antv/l7-core';
|
|
2
2
|
import { IColorRamp, IImagedata } from '@antv/l7-utils';
|
|
3
|
-
import { styleOffset
|
|
3
|
+
import { styleOffset } from '../core/BaseModel';
|
|
4
4
|
import { anchorType } from '../utils/symbol-layout';
|
|
5
5
|
export declare enum lineStyleType {
|
|
6
6
|
'solid' = 0,
|
|
@@ -20,14 +20,25 @@ export declare enum TextureBlend {
|
|
|
20
20
|
NORMAL = "normal",
|
|
21
21
|
REPLACE = "replace"
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* 基础图层类型定义
|
|
25
|
+
*/
|
|
26
|
+
export interface IBaseLayerStyleOptions {
|
|
27
|
+
opacity?: number;
|
|
28
|
+
depth?: boolean;
|
|
29
|
+
blend?: string;
|
|
30
|
+
raisingHeight?: number;
|
|
31
|
+
heightfixed?: boolean;
|
|
32
|
+
zIndex?: number;
|
|
33
|
+
mask?: boolean;
|
|
34
|
+
maskInside?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface ILineLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
24
37
|
tileOrigin?: number[];
|
|
25
38
|
coord?: string;
|
|
26
|
-
opacity: styleSingle;
|
|
27
39
|
lineType?: keyof typeof lineStyleType;
|
|
28
40
|
dashArray?: [number, number];
|
|
29
41
|
segmentNumber?: number;
|
|
30
|
-
depth?: boolean;
|
|
31
42
|
forward?: boolean;
|
|
32
43
|
lineTexture?: boolean;
|
|
33
44
|
iconStep?: number;
|
|
@@ -41,10 +52,6 @@ export interface ILineLayerStyleOptions {
|
|
|
41
52
|
vertexHeightScale?: number;
|
|
42
53
|
borderWidth?: number;
|
|
43
54
|
borderColor?: string;
|
|
44
|
-
heightfixed?: boolean;
|
|
45
|
-
raisingHeight?: number;
|
|
46
|
-
mask?: boolean;
|
|
47
|
-
maskInside?: boolean;
|
|
48
55
|
blur?: [number, number, number];
|
|
49
56
|
arrow?: ILineArrow;
|
|
50
57
|
rampColors?: IColorRamp;
|
|
@@ -53,10 +60,9 @@ export interface ILineLayerStyleOptions {
|
|
|
53
60
|
enablePicking?: boolean;
|
|
54
61
|
workerEnabled?: boolean;
|
|
55
62
|
}
|
|
56
|
-
export interface IPointLayerStyleOptions {
|
|
63
|
+
export interface IPointLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
57
64
|
tileOrigin?: number[];
|
|
58
65
|
coord?: string;
|
|
59
|
-
opacity: number;
|
|
60
66
|
strokeOpacity: number;
|
|
61
67
|
strokeWidth: number;
|
|
62
68
|
stroke: string;
|
|
@@ -70,9 +76,7 @@ export interface IPointLayerStyleOptions {
|
|
|
70
76
|
fontWeight?: string;
|
|
71
77
|
fontFamily?: string;
|
|
72
78
|
textAllowOverlap?: boolean;
|
|
73
|
-
raisingHeight?: number;
|
|
74
79
|
pickLight?: boolean;
|
|
75
|
-
depth?: boolean;
|
|
76
80
|
sourceColor?: string;
|
|
77
81
|
targetColor?: string;
|
|
78
82
|
opacityLinear?: {
|
|
@@ -80,21 +84,16 @@ export interface IPointLayerStyleOptions {
|
|
|
80
84
|
dir: string;
|
|
81
85
|
};
|
|
82
86
|
lightEnable: boolean;
|
|
83
|
-
heightfixed?: boolean;
|
|
84
87
|
offsets?: styleOffset;
|
|
85
|
-
blend?: string;
|
|
86
88
|
unit?: string;
|
|
87
|
-
mask?: boolean;
|
|
88
|
-
maskInside?: boolean;
|
|
89
89
|
rotation?: number;
|
|
90
90
|
speed?: number;
|
|
91
91
|
featureId?: string;
|
|
92
92
|
sourceLayer?: string;
|
|
93
93
|
}
|
|
94
|
-
export interface IPolygonLayerStyleOptions {
|
|
94
|
+
export interface IPolygonLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
95
95
|
tileOrigin?: number[];
|
|
96
96
|
coord?: string;
|
|
97
|
-
opacity?: number;
|
|
98
97
|
opacityLinear?: {
|
|
99
98
|
enable: boolean;
|
|
100
99
|
dir: string;
|
|
@@ -102,13 +101,9 @@ export interface IPolygonLayerStyleOptions {
|
|
|
102
101
|
topsurface?: boolean;
|
|
103
102
|
sidesurface?: boolean;
|
|
104
103
|
mapTexture?: string;
|
|
105
|
-
raisingHeight?: number;
|
|
106
104
|
sourceColor?: string;
|
|
107
105
|
targetColor?: string;
|
|
108
|
-
heightfixed?: boolean;
|
|
109
106
|
pickLight: boolean;
|
|
110
|
-
mask?: boolean;
|
|
111
|
-
maskInside?: boolean;
|
|
112
107
|
waterTexture?: string;
|
|
113
108
|
speed?: number;
|
|
114
109
|
watercolor?: string;
|
|
@@ -116,14 +111,13 @@ export interface IPolygonLayerStyleOptions {
|
|
|
116
111
|
featureId?: string;
|
|
117
112
|
sourceLayer?: string;
|
|
118
113
|
}
|
|
119
|
-
export interface IRasterTileLayerStyleOptions {
|
|
120
|
-
|
|
121
|
-
opacity?: number;
|
|
114
|
+
export interface IRasterTileLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
115
|
+
opacity: number;
|
|
122
116
|
}
|
|
123
|
-
export interface IMaskLayerStyleOptions {
|
|
124
|
-
opacity:
|
|
117
|
+
export interface IMaskLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
118
|
+
opacity: number;
|
|
125
119
|
}
|
|
126
|
-
export interface IWindLayerStyleOptions {
|
|
120
|
+
export interface IWindLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
127
121
|
uMin?: number;
|
|
128
122
|
uMax?: number;
|
|
129
123
|
vMin?: number;
|
|
@@ -132,19 +126,13 @@ export interface IWindLayerStyleOptions {
|
|
|
132
126
|
speedFactor?: number;
|
|
133
127
|
dropRate?: number;
|
|
134
128
|
dropRateBump?: number;
|
|
135
|
-
opacity?: number;
|
|
136
129
|
numParticles?: number;
|
|
137
130
|
rampColors?: {
|
|
138
131
|
[key: number]: string;
|
|
139
132
|
};
|
|
140
133
|
sizeScale?: number;
|
|
141
|
-
mask?: boolean;
|
|
142
|
-
maskInside?: boolean;
|
|
143
134
|
}
|
|
144
|
-
export interface IImageLayerStyleOptions {
|
|
145
|
-
opacity: number;
|
|
146
|
-
mask?: boolean;
|
|
147
|
-
maskInside?: boolean;
|
|
135
|
+
export interface IImageLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
148
136
|
domain?: [number, number];
|
|
149
137
|
noDataValue?: number;
|
|
150
138
|
clampLow?: boolean;
|
|
@@ -157,10 +145,7 @@ export interface IImageLayerStyleOptions {
|
|
|
157
145
|
pixelConstantB?: number;
|
|
158
146
|
pixelConstantRGB?: number;
|
|
159
147
|
}
|
|
160
|
-
export interface IGeometryLayerStyleOptions {
|
|
161
|
-
opacity: number;
|
|
162
|
-
mask?: boolean;
|
|
163
|
-
maskInside?: boolean;
|
|
148
|
+
export interface IGeometryLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
164
149
|
mapTexture?: string;
|
|
165
150
|
terrainTexture?: string;
|
|
166
151
|
center?: [number, number];
|
|
@@ -170,7 +155,6 @@ export interface IGeometryLayerStyleOptions {
|
|
|
170
155
|
heightSegments?: number;
|
|
171
156
|
terrainClipHeight?: number;
|
|
172
157
|
rgb2height?: (r: number, g: number, b: number) => number;
|
|
173
|
-
raisingHeight?: number;
|
|
174
158
|
canvasWidth?: number;
|
|
175
159
|
canvasHeight?: number;
|
|
176
160
|
drawCanvas?: (canvas: HTMLCanvasElement) => void;
|
|
@@ -199,25 +183,19 @@ export interface ICanvasLayerStyleOptions {
|
|
|
199
183
|
update: CanvasUpdateType | string;
|
|
200
184
|
drawingOnCanvas: (option: IDrawingOnCanvas) => void;
|
|
201
185
|
}
|
|
202
|
-
export interface IHeatMapLayerStyleOptions {
|
|
203
|
-
opacity: number;
|
|
186
|
+
export interface IHeatMapLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
204
187
|
intensity: number;
|
|
205
188
|
radius: number;
|
|
206
189
|
angle: number;
|
|
207
190
|
rampColors: IColorRamp;
|
|
208
|
-
mask?: boolean;
|
|
209
|
-
maskInside?: boolean;
|
|
210
191
|
coverage?: number;
|
|
211
192
|
}
|
|
212
|
-
export interface IRasterLayerStyleOptions {
|
|
213
|
-
opacity: number;
|
|
193
|
+
export interface IRasterLayerStyleOptions extends IBaseLayerStyleOptions {
|
|
214
194
|
domain: [number, number];
|
|
215
195
|
noDataValue: number;
|
|
216
196
|
clampLow: boolean;
|
|
217
197
|
clampHigh: boolean;
|
|
218
198
|
rampColors: IColorRamp;
|
|
219
|
-
mask?: boolean;
|
|
220
|
-
maskInside?: boolean;
|
|
221
199
|
rampColorsData?: ImageData | IImagedata;
|
|
222
200
|
}
|
|
223
201
|
export {};
|
package/es/core/interface.js
CHANGED
package/es/core/schema.d.ts
CHANGED
|
@@ -48,10 +48,11 @@ export declare function LineTriangulation(feature: IEncodeFeature): {
|
|
|
48
48
|
size: number;
|
|
49
49
|
};
|
|
50
50
|
export declare function SimpleLineTriangulation(feature: IEncodeFeature): {
|
|
51
|
-
vertices:
|
|
52
|
-
indices:
|
|
53
|
-
normals:
|
|
51
|
+
vertices: any[];
|
|
52
|
+
indices: never[];
|
|
53
|
+
normals: never[];
|
|
54
54
|
size: number;
|
|
55
|
+
count: number;
|
|
55
56
|
};
|
|
56
57
|
export declare function polygonTriangulation(feature: IEncodeFeature): {
|
|
57
58
|
indices: number[];
|
package/es/core/triangulation.js
CHANGED
|
@@ -131,56 +131,71 @@ export function LineTriangulation(feature) {
|
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
export function SimpleLineTriangulation(feature) {
|
|
134
|
-
var coordinates = feature.coordinates
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
var coordinates = feature.coordinates;
|
|
135
|
+
var pos = [];
|
|
136
|
+
|
|
137
|
+
var _getSimpleLineVertice = getSimpleLineVertices(coordinates),
|
|
138
|
+
results = _getSimpleLineVertice.results,
|
|
139
|
+
totalDistance = _getSimpleLineVertice.totalDistance;
|
|
140
|
+
|
|
141
|
+
results.map(function (point) {
|
|
142
|
+
pos.push(point[0], point[1], point[2], point[3], 0, totalDistance);
|
|
140
143
|
});
|
|
144
|
+
return {
|
|
145
|
+
vertices: pos,
|
|
146
|
+
indices: [],
|
|
147
|
+
normals: [],
|
|
148
|
+
size: 6,
|
|
149
|
+
count: results.length
|
|
150
|
+
};
|
|
151
|
+
}
|
|
141
152
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
153
|
+
function lineSegmentDistance(b1, a1) {
|
|
154
|
+
var dx = a1[0] - b1[0];
|
|
155
|
+
var dy = a1[1] - b1[1];
|
|
156
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
157
|
+
}
|
|
145
158
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
159
|
+
function pushDis(point, n) {
|
|
160
|
+
if (point.length < 3) {
|
|
161
|
+
point.push(0);
|
|
162
|
+
}
|
|
149
163
|
|
|
150
|
-
|
|
164
|
+
point.push(n);
|
|
165
|
+
return point;
|
|
166
|
+
}
|
|
151
167
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
168
|
+
function getSimpleLineVertices(points) {
|
|
169
|
+
var distance = 0;
|
|
155
170
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
171
|
+
if (points.length < 2) {
|
|
172
|
+
return {
|
|
173
|
+
results: points,
|
|
174
|
+
totalDistance: 0
|
|
175
|
+
};
|
|
162
176
|
} else {
|
|
163
|
-
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
177
|
+
var results = [];
|
|
178
|
+
var point = pushDis(points[0], distance);
|
|
179
|
+
results.push(point);
|
|
180
|
+
|
|
181
|
+
for (var i = 1; i < points.length - 1; i++) {
|
|
182
|
+
var subDistance = lineSegmentDistance(points[i - 1], points[i]);
|
|
183
|
+
distance += subDistance;
|
|
184
|
+
var mulPoint = pushDis(points[i], distance);
|
|
185
|
+
results.push(mulPoint);
|
|
186
|
+
results.push(mulPoint);
|
|
168
187
|
}
|
|
169
188
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
189
|
+
var pointDistance = lineSegmentDistance(points[points.length - 2], points[points.length - 1]);
|
|
190
|
+
distance += pointDistance;
|
|
191
|
+
results.push(pushDis(points[points.length - 1], distance));
|
|
192
|
+
return {
|
|
193
|
+
results: results,
|
|
194
|
+
totalDistance: distance
|
|
195
|
+
};
|
|
173
196
|
}
|
|
174
|
-
|
|
175
|
-
var linebuffer = line.complex;
|
|
176
|
-
return {
|
|
177
|
-
vertices: linebuffer.positions,
|
|
178
|
-
// [ x,y,z, distance, miter, total ]
|
|
179
|
-
indices: linebuffer.indices,
|
|
180
|
-
normals: linebuffer.normals,
|
|
181
|
-
size: 6
|
|
182
|
-
};
|
|
183
197
|
}
|
|
198
|
+
|
|
184
199
|
export function polygonTriangulation(feature) {
|
|
185
200
|
var coordinates = feature.coordinates;
|
|
186
201
|
var flattengeo = earcut.flatten(coordinates);
|
|
@@ -284,7 +284,7 @@ var HeatMapModel = (_dec = injectable(), _dec(_class = /*#__PURE__*/function (_B
|
|
|
284
284
|
enable: false
|
|
285
285
|
},
|
|
286
286
|
blend: this.getBlend(),
|
|
287
|
-
count: 6,
|
|
287
|
+
// count: 6,
|
|
288
288
|
elements: createElements({
|
|
289
289
|
data: [0, 2, 1, 2, 3, 1],
|
|
290
290
|
type: gl.UNSIGNED_INT,
|
package/es/image/models/image.js
CHANGED
|
@@ -82,7 +82,9 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
82
82
|
_this.texture = createTexture2D({
|
|
83
83
|
data: imageData[0],
|
|
84
84
|
width: imageData[0].width,
|
|
85
|
-
height: imageData[0].height
|
|
85
|
+
height: imageData[0].height,
|
|
86
|
+
mag: gl.LINEAR,
|
|
87
|
+
min: gl.LINEAR
|
|
86
88
|
});
|
|
87
89
|
|
|
88
90
|
_this.layerService.updateLayerRenderList();
|
|
@@ -97,6 +99,10 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
97
99
|
fragmentShader: ImageFrag,
|
|
98
100
|
triangulation: RasterImageTriangulation,
|
|
99
101
|
primitive: gl.TRIANGLES,
|
|
102
|
+
blend: {
|
|
103
|
+
// Tip: 优化显示效果
|
|
104
|
+
enable: false
|
|
105
|
+
},
|
|
100
106
|
depth: {
|
|
101
107
|
enable: false
|
|
102
108
|
},
|
package/es/line/index.js
CHANGED
|
@@ -12,6 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
12
12
|
|
|
13
13
|
import BaseLayer from "../core/BaseLayer";
|
|
14
14
|
import LineModels from "./models";
|
|
15
|
+
import { isVectorTile } from "../tile/utils";
|
|
15
16
|
|
|
16
17
|
var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
17
18
|
_inherits(LineLayer, _BaseLayer);
|
|
@@ -103,7 +104,9 @@ var LineLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
103
104
|
return this.layerType;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
var parserType = this.layerSource.getParserType();
|
|
108
|
+
|
|
109
|
+
if (isVectorTile(parserType)) {
|
|
107
110
|
return 'vectorline';
|
|
108
111
|
}
|
|
109
112
|
|
package/es/line/models/arc.js
CHANGED
|
@@ -26,7 +26,7 @@ var arc_dash_vert = "\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattr
|
|
|
26
26
|
var arc_line_frag = "\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n float d_distance_ratio = styleMappingMat[3].b; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u6BD4\u4F8B\n\n gl_FragColor = v_color;\n \n gl_FragColor.a *= opacity;\n\n if(u_aimate.x == Animate && u_line_texture != LineTexture) {\n animateSpeed = u_time / u_aimate.y;\n float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_aimate.z)* (1.0/ u_aimate.z) + u_time / u_aimate.y);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n // alpha = smoothstep(0., 1., alpha);\n alpha = clamp(alpha, 0.0, 1.0);\n gl_FragColor.a *= alpha;\n }\n\n // \u5F53\u5B58\u5728\u8D34\u56FE\u65F6\u5728\u5E95\u8272\u4E0A\u8D34\u4E0A\u8D34\u56FE\n if(u_line_texture == LineTexture) { // while load texture\n float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / segmentNumber));\n // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);\n\n float count = styleMappingMat[3].g; // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n\n float time = 0.0;\n if(u_aimate.x == Animate) {\n time = u_time / u_aimate.y;\n }\n float redioCount = arcRadio * count;\n\n float u = fract(redioCount - time);\n float v = styleMappingMat[3].a; // \u6A2A\u5411 v\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_aimate.x == Animate) {\n float currentPlane = floor(redioCount - time);\n float textureStep = floor(count * u_aimate.z);\n float a = mod(currentPlane, textureStep);\n if(a < textureStep - 1.0) {\n pattern = vec4(0.0);\n }\n }\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n gl_FragColor = filterColor(gl_FragColor + pattern);\n } else { // replace\n pattern.a *= opacity;\n if(gl_FragColor.a <= 0.0) {\n pattern.a = 0.0;\n }\n gl_FragColor = filterColor(pattern);\n }\n \n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n // gl_FragColor = filterColor(gl_FragColor);\n}";
|
|
27
27
|
|
|
28
28
|
/* babel-plugin-inline-import '../shaders/line_arc_vert.glsl' */
|
|
29
|
-
var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // dataset \u6570\u636E\u96C6\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke -> thetaOffset... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n \n if(u_aimate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n styleMappingMat[3].b = d_distance_ratio;\n\n // styleMappingMat[0][1] - arcThetaOffset\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio,
|
|
29
|
+
var arc_line_vert = "#define Animate 0.0\n#define LineTexture 1.0\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec4 a_Instance;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float segmentNumber;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nvarying vec4 v_color;\n\nuniform float u_lineDir: 1.0;\n\nuniform float u_thetaOffset: 0.314;\nuniform float u_icon_step: 100;\nuniform float u_line_texture: 0.0;\nattribute vec2 a_iconMapUV;\nvarying vec2 v_iconMapUV;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalThetaOffset\"\n\n#pragma include \"projection\"\n#pragma include \"project\"\n#pragma include \"picking\"\n\nfloat bezier3(vec3 arr, float t) {\n float ut = 1. - t;\n return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;\n}\nvec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {\n vec2 center = target - source;\n float r = length(center);\n float theta = atan(center.y, center.x);\n float thetaOffset = arcThetaOffset;\n float r2 = r / 2.0 / cos(thetaOffset);\n float theta2 = theta + thetaOffset;\n vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y);\n if(u_lineDir == 1.0) { // \u6B63\u5411\n return mid;\n } else { // \u9006\u5411\n // (mid + vmin)/2 = (s + t)/2\n vec2 vmid = source + target - mid;\n return vmid;\n }\n // return mid;\n}\nfloat getSegmentRatio(float index) {\n // return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));\n return index / (segmentNumber - 1.);\n}\nvec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {\n // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation\n vec2 mid = midPoint(source, target, arcThetaOffset);\n vec3 x = vec3(source.x, mid.x, target.x);\n vec3 y = vec3(source.y, mid.y, target.y);\n return vec2(bezier3(x ,t), bezier3(y,t));\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;\n return offset;\n}\nvec2 getNormal(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction);\n}\n\nvoid main() {\n v_color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // dataset \u6570\u636E\u96C6\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke -> thetaOffset... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 thetaOffsetAndOffset = calThetaOffsetAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = thetaOffsetAndOffset.r;\n textureOffset = thetaOffsetAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n vec2 source = a_Instance.rg; // \u8D77\u59CB\u70B9\n vec2 target = a_Instance.ba; // \u7EC8\u70B9\n float segmentIndex = a_Position.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);\n float d_distance_ratio;\n \n if(u_aimate.x == Animate) {\n d_distance_ratio = segmentIndex / segmentNumber;\n if(u_lineDir != 1.0) {\n d_distance_ratio = 1.0 - d_distance_ratio;\n }\n }\n\n styleMappingMat[3].b = d_distance_ratio;\n\n // styleMappingMat[0][1] - arcThetaOffset\n float arcThetaOffset = styleMappingMat[0][1];\n vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, arcThetaOffset), 0.0, 1.0));\n vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, arcThetaOffset), 0.0, 1.0));\n // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);\n //unProjCustomCoord\n \n vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));\n\n\n float d_segmentIndex = a_Position.x + 1.0; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n styleMappingMat[3].r = d_segmentIndex;\n\n if(LineTexture == u_line_texture) { // \u5F00\u542F\u8D34\u56FE\u6A21\u5F0F\n\n float arcDistrance = length(source - target); // \u8D77\u59CB\u70B9\u548C\u7EC8\u70B9\u7684\u8DDD\u79BB\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20) { // amap\n arcDistrance *= 1000000.0;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { // mapbox\n // arcDistrance *= 8.0;\n arcDistrance = project_pixel_allmap(arcDistrance);\n }\n v_iconMapUV = a_iconMapUV;\n\n float pixelLen = project_pixel_texture(u_icon_step); // \u8D34\u56FE\u6CBF\u5F27\u7EBF\u65B9\u5411\u7684\u957F\u5EA6 - \u968F\u5730\u56FE\u7F29\u653E\u6539\u53D8\n float texCount = floor(arcDistrance/pixelLen); // \u8D34\u56FE\u5728\u5F27\u7EBF\u4E0A\u91CD\u590D\u7684\u6570\u91CF\n styleMappingMat[3].g = texCount;\n\n float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\n float linePixelSize = project_pixel(a_Size); // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\n styleMappingMat[3].a = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n }\n \n\n // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n gl_Position = u_Mvp * (vec4(curr.xy + offset, 0, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));\n }\n setPickingColor(a_PickingColor);\n}\n"; // arc linear line
|
|
30
30
|
|
|
31
31
|
/* babel-plugin-inline-import '../shaders/linear/arc_linear_frag.glsl' */
|
|
32
32
|
var arc_linear_frag = "#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity;\nuniform float u_textureBlend;\nuniform float u_blur : 0.9;\nuniform float u_line_type: 0.0;\n// varying vec2 v_normal;\nvarying vec4 v_dash_array;\nvarying vec4 v_color;\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nuniform float segmentNumber;\nvarying vec2 v_iconMapUV;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_segmentIndex = styleMappingMat[3].r; // \u5F53\u524D\u9876\u70B9\u5728\u5F27\u7EBF\u4E2D\u6240\u5904\u7684\u5206\u6BB5\u4F4D\u7F6E\n\n // \u8BBE\u7F6E\u5F27\u7EBF\u7684\u5E95\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}";
|
|
@@ -21,7 +21,7 @@ var simple_line_frag = "\nvarying vec4 v_color;\nvarying mat4 styleMappingMat;\n
|
|
|
21
21
|
var simle_linear_frag = "uniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nvarying mat4 styleMappingMat;\nvoid main() {\n float opacity = styleMappingMat[0][0];\n\n // styleMappingMat[3][0] \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = mix(u_sourceColor, u_targetColor, styleMappingMat[3][0]);\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n}\n";
|
|
22
22
|
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/simple/simpleline_vert.glsl' */
|
|
24
|
-
var simple_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Position;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n v_color = a_Color; \n styleMappingMat[3][0] = a_Distance / a_Total_Distance;\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_Size.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n }\n}\n";
|
|
24
|
+
var simple_line_vert = "attribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Position;\n\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_opacity: 1.0;\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n\nvarying vec4 v_color;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // distance_ratio/distance/pixelLen/texV\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n \n v_color = a_Color; \n styleMappingMat[3][0] = a_Distance / a_Total_Distance;\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, project_pixel(a_Size.y) + h * 0.2, 1.0));\n } else {\n float lineHeight = a_Size.y;\n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n h *= 2.0/pow(2.0, 20.0 - u_Zoom);\n }\n\n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));\n gl_PointSize = 10.0;\n }\n}\n";
|
|
25
25
|
|
|
26
26
|
var SimpleLineModel = /*#__PURE__*/function (_BaseModel) {
|
|
27
27
|
_inherits(SimpleLineModel, _BaseModel);
|
|
@@ -52,7 +52,8 @@ vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
|
|
|
52
52
|
// return mid;
|
|
53
53
|
}
|
|
54
54
|
float getSegmentRatio(float index) {
|
|
55
|
-
return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
|
|
55
|
+
// return smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
|
|
56
|
+
return index / (segmentNumber - 1.);
|
|
56
57
|
}
|
|
57
58
|
vec2 interpolate (vec2 source, vec2 target, float t, float arcThetaOffset) {
|
|
58
59
|
// if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation
|
|
@@ -130,8 +131,9 @@ void main() {
|
|
|
130
131
|
styleMappingMat[3].b = d_distance_ratio;
|
|
131
132
|
|
|
132
133
|
// styleMappingMat[0][1] - arcThetaOffset
|
|
133
|
-
|
|
134
|
-
vec4
|
|
134
|
+
float arcThetaOffset = styleMappingMat[0][1];
|
|
135
|
+
vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio, arcThetaOffset), 0.0, 1.0));
|
|
136
|
+
vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio, arcThetaOffset), 0.0, 1.0));
|
|
135
137
|
// v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
|
|
136
138
|
//unProjCustomCoord
|
|
137
139
|
|
|
@@ -100,7 +100,6 @@ var FeatureScalePlugin = (_dec = injectable(), _dec2 = inject(TYPES.IGlobalConfi
|
|
|
100
100
|
if (attribute.scale) {
|
|
101
101
|
// 创建Scale
|
|
102
102
|
var attributeScale = attribute.scale;
|
|
103
|
-
var type = attribute.name;
|
|
104
103
|
attributeScale.names = _this2.parseFields(attribute.scale.field || []);
|
|
105
104
|
var scales = []; // 为每个字段创建 Scale
|
|
106
105
|
|
package/es/point/index.js
CHANGED
|
@@ -18,6 +18,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
18
18
|
|
|
19
19
|
import BaseLayer from "../core/BaseLayer";
|
|
20
20
|
import PointModels from "./models/index";
|
|
21
|
+
import { isVectorTile } from "../tile/utils";
|
|
21
22
|
|
|
22
23
|
var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
23
24
|
_inherits(PointLayer, _BaseLayer);
|
|
@@ -152,8 +153,9 @@ var PointLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
152
153
|
key: "getModelType",
|
|
153
154
|
value: function getModelType() {
|
|
154
155
|
var PointTypes = ['fillImage', 'fill', 'radar', 'image', 'normal', 'simplePoint', 'extrude', 'text', 'vectorpoint', 'tile', 'earthFill', 'earthExtrude'];
|
|
156
|
+
var parserType = this.layerSource.getParserType();
|
|
155
157
|
|
|
156
|
-
if (
|
|
158
|
+
if (isVectorTile(parserType)) {
|
|
157
159
|
return 'vectorpoint';
|
|
158
160
|
} // pointlayer
|
|
159
161
|
// 2D、 3d、 shape、image、text、normal、
|