@antv/l7-layers 2.25.9 → 2.28.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/citybuilding/models/build.d.ts +3 -2
- package/es/core/BaseModel.js +32 -6
- package/es/core/CommonStyleAttribute.d.ts +2 -1
- package/es/core/CommonStyleAttribute.js +23 -1
- package/es/core/constant.js +4 -2
- package/es/core/interface.d.ts +1 -0
- package/es/earth/models/atmosphere.d.ts +3 -2
- package/es/earth/models/base.d.ts +3 -2
- package/es/earth/models/bloomsphere.d.ts +3 -2
- package/es/geometry/models/billboard.d.ts +3 -2
- package/es/geometry/models/plane.d.ts +3 -2
- package/es/heatmap/models/grid.d.ts +3 -2
- package/es/heatmap/models/grid3d.d.ts +3 -2
- package/es/heatmap/models/heatmap.d.ts +3 -2
- package/es/heatmap/models/hexagon.d.ts +3 -2
- package/es/image/models/image.d.ts +3 -2
- package/es/line/models/arc.d.ts +3 -2
- package/es/line/models/arc_3d.d.ts +3 -2
- package/es/line/models/flow.d.ts +3 -2
- package/es/line/models/great_circle.d.ts +3 -2
- package/es/line/models/line.d.ts +3 -2
- package/es/line/models/simple_line.d.ts +3 -2
- package/es/line/models/wall.d.ts +3 -2
- package/es/plugins/index.d.ts +1 -1
- package/es/point/index.js +2 -2
- package/es/point/models/billboard_point.d.ts +3 -2
- package/es/point/models/earthExtrude.d.ts +3 -2
- package/es/point/models/earthFill.d.ts +3 -2
- package/es/point/models/extrude.d.ts +3 -2
- package/es/point/models/fill.d.ts +3 -2
- package/es/point/models/fillImage.d.ts +3 -2
- package/es/point/models/image.d.ts +3 -2
- package/es/point/models/normal.d.ts +3 -2
- package/es/point/models/radar.d.ts +3 -2
- package/es/point/models/text.d.ts +3 -2
- package/es/point/shaders/billboard/billboard_point_vert.glsl +33 -1
- package/es/point/shaders/earthFill/earthFill_vert.glsl +37 -3
- package/es/point/shaders/fill/fill_vert.glsl +38 -3
- package/es/point/shaders/fillImage/fillImage_vert.glsl +34 -1
- package/es/point/shaders/image/image_vert.glsl +31 -0
- package/es/point/shaders/normal/normal_vert.glsl +30 -0
- package/es/point/shaders/radar/radar_vert.glsl +34 -3
- package/es/polygon/models/extrude.d.ts +3 -2
- package/es/polygon/models/extrusion.d.ts +3 -2
- package/es/polygon/models/fill.d.ts +3 -2
- package/es/polygon/models/ocean.d.ts +3 -2
- package/es/polygon/models/water.d.ts +3 -2
- package/es/raster/models/raster.d.ts +3 -2
- package/es/raster/models/rasterRgb.d.ts +3 -2
- package/es/raster/models/rasterTerrainRgb.d.ts +3 -2
- package/es/tile/tile/Tile.d.ts +2 -2
- package/es/tile/tile/index.d.ts +1 -1
- package/es/tile/tile/util.d.ts +1 -1
- package/es/utils/symbol-layout.d.ts +1 -1
- package/es/utils/symbol-layout.js +19 -9
- package/es/wind/models/wind.d.ts +3 -2
- package/lib/citybuilding/models/build.d.ts +3 -2
- package/lib/core/BaseModel.js +32 -6
- package/lib/core/CommonStyleAttribute.d.ts +2 -1
- package/lib/core/CommonStyleAttribute.js +23 -1
- package/lib/core/constant.js +4 -2
- package/lib/core/interface.d.ts +1 -0
- package/lib/earth/models/atmosphere.d.ts +3 -2
- package/lib/earth/models/base.d.ts +3 -2
- package/lib/earth/models/bloomsphere.d.ts +3 -2
- package/lib/geometry/models/billboard.d.ts +3 -2
- package/lib/geometry/models/plane.d.ts +3 -2
- package/lib/heatmap/models/grid.d.ts +3 -2
- package/lib/heatmap/models/grid3d.d.ts +3 -2
- package/lib/heatmap/models/heatmap.d.ts +3 -2
- package/lib/heatmap/models/hexagon.d.ts +3 -2
- package/lib/image/models/image.d.ts +3 -2
- package/lib/line/models/arc.d.ts +3 -2
- package/lib/line/models/arc_3d.d.ts +3 -2
- package/lib/line/models/flow.d.ts +3 -2
- package/lib/line/models/great_circle.d.ts +3 -2
- package/lib/line/models/line.d.ts +3 -2
- package/lib/line/models/simple_line.d.ts +3 -2
- package/lib/line/models/wall.d.ts +3 -2
- package/lib/plugins/index.d.ts +1 -1
- package/lib/point/index.js +2 -2
- package/lib/point/models/billboard_point.d.ts +3 -2
- package/lib/point/models/earthExtrude.d.ts +3 -2
- package/lib/point/models/earthFill.d.ts +3 -2
- package/lib/point/models/extrude.d.ts +3 -2
- package/lib/point/models/fill.d.ts +3 -2
- package/lib/point/models/fillImage.d.ts +3 -2
- package/lib/point/models/image.d.ts +3 -2
- package/lib/point/models/normal.d.ts +3 -2
- package/lib/point/models/radar.d.ts +3 -2
- package/lib/point/models/text.d.ts +3 -2
- package/lib/point/shaders/billboard/billboard_point_vert.glsl +33 -1
- package/lib/point/shaders/earthFill/earthFill_vert.glsl +37 -3
- package/lib/point/shaders/fill/fill_vert.glsl +38 -3
- package/lib/point/shaders/fillImage/fillImage_vert.glsl +34 -1
- package/lib/point/shaders/image/image_vert.glsl +31 -0
- package/lib/point/shaders/normal/normal_vert.glsl +30 -0
- package/lib/point/shaders/radar/radar_vert.glsl +34 -3
- package/lib/polygon/models/extrude.d.ts +3 -2
- package/lib/polygon/models/extrusion.d.ts +3 -2
- package/lib/polygon/models/fill.d.ts +3 -2
- package/lib/polygon/models/ocean.d.ts +3 -2
- package/lib/polygon/models/water.d.ts +3 -2
- package/lib/raster/models/raster.d.ts +3 -2
- package/lib/raster/models/rasterRgb.d.ts +3 -2
- package/lib/raster/models/rasterTerrainRgb.d.ts +3 -2
- package/lib/tile/tile/Tile.d.ts +2 -2
- package/lib/tile/tile/index.d.ts +1 -1
- package/lib/tile/tile/util.d.ts +1 -1
- package/lib/utils/symbol-layout.d.ts +1 -1
- package/lib/utils/symbol-layout.js +19 -9
- package/lib/wind/models/wind.d.ts +3 -2
- package/package.json +6 -6
|
@@ -21,8 +21,9 @@ const COMMON_ATTRIBUTE_LOCATION = exports.COMMON_ATTRIBUTE_LOCATION = {
|
|
|
21
21
|
OPACITY: 5,
|
|
22
22
|
OFFSETS: 6,
|
|
23
23
|
ROTATION: 7,
|
|
24
|
+
ANCHOR: 8,
|
|
24
25
|
// last index
|
|
25
|
-
MAX:
|
|
26
|
+
MAX: 9
|
|
26
27
|
};
|
|
27
28
|
function getCommonStyleAttributeOptions(name) {
|
|
28
29
|
switch (name) {
|
|
@@ -114,6 +115,27 @@ function getCommonStyleAttributeOptions(name) {
|
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
};
|
|
118
|
+
case 'anchor':
|
|
119
|
+
return {
|
|
120
|
+
name: 'anchor',
|
|
121
|
+
type: _l7Core.AttributeType.Attribute,
|
|
122
|
+
descriptor: {
|
|
123
|
+
name: 'a_Anchor',
|
|
124
|
+
shaderLocation: COMMON_ATTRIBUTE_LOCATION.ANCHOR,
|
|
125
|
+
buffer: {
|
|
126
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
127
|
+
data: [],
|
|
128
|
+
type: _l7Core.gl.FLOAT
|
|
129
|
+
},
|
|
130
|
+
size: 1,
|
|
131
|
+
update: feature => {
|
|
132
|
+
const {
|
|
133
|
+
anchor = 0
|
|
134
|
+
} = feature;
|
|
135
|
+
return [anchor];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
117
139
|
default:
|
|
118
140
|
return undefined;
|
|
119
141
|
}
|
package/lib/core/constant.js
CHANGED
|
@@ -11,7 +11,8 @@ const DefaultUniformStyleValue = exports.DefaultUniformStyleValue = {
|
|
|
11
11
|
rotation: 0,
|
|
12
12
|
extrusionBase: 0,
|
|
13
13
|
strokeOpacity: 1,
|
|
14
|
-
thetaOffset: 0.314
|
|
14
|
+
thetaOffset: 0.314,
|
|
15
|
+
anchor: 0
|
|
15
16
|
};
|
|
16
17
|
const DefaultUniformStyleType = exports.DefaultUniformStyleType = {
|
|
17
18
|
opacity: 'float',
|
|
@@ -21,5 +22,6 @@ const DefaultUniformStyleType = exports.DefaultUniformStyleType = {
|
|
|
21
22
|
rotation: 'float',
|
|
22
23
|
extrusionBase: 'float',
|
|
23
24
|
strokeOpacity: 'float',
|
|
24
|
-
thetaOffset: 'float'
|
|
25
|
+
thetaOffset: 'float',
|
|
26
|
+
anchor: 'float'
|
|
25
27
|
};
|
package/lib/core/interface.d.ts
CHANGED
|
@@ -10,9 +10,10 @@ export default class EarthAtomSphereModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
NORMAL: number;
|
|
17
18
|
UV: number;
|
|
18
19
|
};
|
|
@@ -10,9 +10,10 @@ export default class BaseEarthModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
NORMAL: number;
|
|
17
18
|
UV: number;
|
|
18
19
|
};
|
|
@@ -10,9 +10,10 @@ export default class EarthBloomSphereModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
NORMAL: number;
|
|
17
18
|
UV: number;
|
|
18
19
|
};
|
|
@@ -10,9 +10,10 @@ export default class BillBoardModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
EXTRUDE: number;
|
|
17
18
|
UV: number;
|
|
18
19
|
};
|
|
@@ -10,9 +10,10 @@ export default class PlaneModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
UV: number;
|
|
17
18
|
};
|
|
18
19
|
protected texture: ITexture2D;
|
|
@@ -10,9 +10,10 @@ export default class GridModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
POS: number;
|
|
17
18
|
};
|
|
18
19
|
getUninforms(): IModelUniform;
|
|
@@ -10,9 +10,10 @@ export default class Grid3DModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
POS: number;
|
|
18
19
|
NORMAL: number;
|
|
@@ -10,9 +10,10 @@ export default class HeatMapModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
UV: number;
|
|
18
19
|
DIR: number;
|
|
@@ -10,9 +10,10 @@ export default class HexagonModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
POS: number;
|
|
17
18
|
};
|
|
18
19
|
getUninforms(): IModelUniform;
|
|
@@ -11,9 +11,10 @@ export default class ImageModel extends BaseModel {
|
|
|
11
11
|
readonly OPACITY: 5;
|
|
12
12
|
readonly OFFSETS: 6;
|
|
13
13
|
readonly ROTATION: 7;
|
|
14
|
-
readonly
|
|
14
|
+
readonly ANCHOR: 8;
|
|
15
|
+
readonly MAX: 9;
|
|
15
16
|
} & Record<string, number> & {
|
|
16
|
-
MAX:
|
|
17
|
+
MAX: 9;
|
|
17
18
|
UV: number;
|
|
18
19
|
};
|
|
19
20
|
protected getCommonUniformsInfo(): {
|
package/lib/line/models/arc.d.ts
CHANGED
|
@@ -10,9 +10,10 @@ export default class ArcModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
INSTANCE: number;
|
|
18
19
|
INSTANCE_64LOW: number;
|
|
@@ -10,9 +10,10 @@ export default class Arc3DModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
INSTANCE: number;
|
|
18
19
|
INSTANCE_64LOW: number;
|
|
@@ -10,9 +10,10 @@ export default class FlowLineModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
INSTANCE: number;
|
|
18
19
|
INSTANCE_64LOW: number;
|
|
@@ -10,9 +10,10 @@ export default class GreatCircleModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
INSTANCE: number;
|
|
18
19
|
INSTANCE_64LOW: number;
|
|
@@ -10,9 +10,10 @@ export default class LineModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
DISTANCE_INDEX: number;
|
|
18
19
|
NORMAL: number;
|
|
@@ -10,9 +10,10 @@ export default class SimpleLineModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
};
|
|
18
19
|
protected getCommonUniformsInfo(): {
|
|
@@ -10,9 +10,10 @@ export default class LineWallModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
NORMAL: number;
|
|
18
19
|
UV: number;
|
package/lib/plugins/index.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ import RegisterStyleAttributePlugin from './RegisterStyleAttributePlugin';
|
|
|
12
12
|
import ShaderUniformPlugin from './ShaderUniformPlugin';
|
|
13
13
|
import UpdateModelPlugin from './UpdateModelPlugin';
|
|
14
14
|
import UpdateStyleAttributePlugin from './UpdateStyleAttributePlugin';
|
|
15
|
-
export declare function createPlugins(): (
|
|
15
|
+
export declare function createPlugins(): (DataSourcePlugin | RegisterStyleAttributePlugin | FeatureScalePlugin | DataMappingPlugin | LayerStylePlugin | LayerMaskPlugin | UpdateStyleAttributePlugin | UpdateModelPlugin | MultiPassRendererPlugin | ShaderUniformPlugin | LayerAnimateStylePlugin | LightingPlugin | PixelPickingPlugin | LayerModelPlugin)[];
|
package/lib/point/index.js
CHANGED
|
@@ -13,8 +13,8 @@ class PointLayer extends _BaseLayer.default {
|
|
|
13
13
|
constructor(...args) {
|
|
14
14
|
super(...args);
|
|
15
15
|
(0, _defineProperty2.default)(this, "type", 'PointLayer');
|
|
16
|
-
(0, _defineProperty2.default)(this, "enableShaderEncodeStyles", ['stroke', 'offsets', 'opacity', 'rotation']);
|
|
17
|
-
//4+2+1+1
|
|
16
|
+
(0, _defineProperty2.default)(this, "enableShaderEncodeStyles", ['stroke', 'offsets', 'opacity', 'rotation', 'anchor']);
|
|
17
|
+
//4+2+1+1+1
|
|
18
18
|
(0, _defineProperty2.default)(this, "enableDataEncodeStyles", ['textOffset', 'textAnchor']);
|
|
19
19
|
(0, _defineProperty2.default)(this, "defaultSourceConfig", {
|
|
20
20
|
data: [],
|
|
@@ -16,9 +16,10 @@ export default class SimplePointModel extends BaseModel {
|
|
|
16
16
|
readonly OPACITY: 5;
|
|
17
17
|
readonly OFFSETS: 6;
|
|
18
18
|
readonly ROTATION: 7;
|
|
19
|
-
readonly
|
|
19
|
+
readonly ANCHOR: 8;
|
|
20
|
+
readonly MAX: 9;
|
|
20
21
|
} & Record<string, number> & {
|
|
21
|
-
MAX:
|
|
22
|
+
MAX: 9;
|
|
22
23
|
SIZE: number;
|
|
23
24
|
};
|
|
24
25
|
getDefaultStyle(): Partial<IPointLayerStyleOptions>;
|
|
@@ -10,9 +10,10 @@ export default class ExtrudeModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
POS: number;
|
|
18
19
|
NORMAL: number;
|
|
@@ -10,9 +10,10 @@ export default class FillModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
SHAPE: number;
|
|
18
19
|
EXTRUDE: number;
|
|
@@ -10,9 +10,10 @@ export default class ExtrudeModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
EXTRUDE: number;
|
|
18
19
|
NORMAL: number;
|
|
@@ -10,9 +10,10 @@ export default class FillModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
SHAPE: number;
|
|
18
19
|
EXTRUDE: number;
|
|
@@ -10,9 +10,10 @@ export default class FillImageModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
EXTRUDE: number;
|
|
18
19
|
UV: number;
|
|
@@ -10,9 +10,10 @@ export default class ImageModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
UV: number;
|
|
18
19
|
};
|
|
@@ -16,9 +16,10 @@ export default class NormalModel extends BaseModel {
|
|
|
16
16
|
readonly OPACITY: 5;
|
|
17
17
|
readonly OFFSETS: 6;
|
|
18
18
|
readonly ROTATION: 7;
|
|
19
|
-
readonly
|
|
19
|
+
readonly ANCHOR: 8;
|
|
20
|
+
readonly MAX: 9;
|
|
20
21
|
} & Record<string, number> & {
|
|
21
|
-
MAX:
|
|
22
|
+
MAX: 9;
|
|
22
23
|
SIZE: number;
|
|
23
24
|
};
|
|
24
25
|
getDefaultStyle(): Partial<IPointLayerStyleOptions>;
|
|
@@ -10,9 +10,10 @@ export default class RadarModel extends BaseModel {
|
|
|
10
10
|
readonly OPACITY: 5;
|
|
11
11
|
readonly OFFSETS: 6;
|
|
12
12
|
readonly ROTATION: 7;
|
|
13
|
-
readonly
|
|
13
|
+
readonly ANCHOR: 8;
|
|
14
|
+
readonly MAX: 9;
|
|
14
15
|
} & Record<string, number> & {
|
|
15
|
-
MAX:
|
|
16
|
+
MAX: 9;
|
|
16
17
|
SIZE: number;
|
|
17
18
|
EXTRUDE: number;
|
|
18
19
|
};
|
|
@@ -16,9 +16,10 @@ export default class TextModel extends BaseModel {
|
|
|
16
16
|
readonly OPACITY: 5;
|
|
17
17
|
readonly OFFSETS: 6;
|
|
18
18
|
readonly ROTATION: 7;
|
|
19
|
-
readonly
|
|
19
|
+
readonly ANCHOR: 8;
|
|
20
|
+
readonly MAX: 9;
|
|
20
21
|
} & Record<string, number> & {
|
|
21
|
-
MAX:
|
|
22
|
+
MAX: 9;
|
|
22
23
|
SIZE: number;
|
|
23
24
|
TEXT_OFFSETS: number;
|
|
24
25
|
UV: number;
|
|
@@ -18,16 +18,48 @@ out float v_innerRadius;
|
|
|
18
18
|
#pragma include "projection"
|
|
19
19
|
#pragma include "picking"
|
|
20
20
|
#pragma include "project"
|
|
21
|
+
|
|
22
|
+
// 根据 anchor 值计算点精灵的像素偏移
|
|
23
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
24
|
+
vec2 applyAnchorPoint(float anchor, float pointSize) {
|
|
25
|
+
if (anchor < 0.5) {
|
|
26
|
+
return vec2(0.0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
vec2 offset = vec2(0.0);
|
|
30
|
+
|
|
31
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
32
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
33
|
+
offset.x = -pointSize * 0.5;
|
|
34
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
35
|
+
offset.x = pointSize * 0.5;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
39
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
40
|
+
offset.y = -pointSize * 0.5;
|
|
41
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
42
|
+
offset.y = pointSize * 0.5;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return offset;
|
|
46
|
+
}
|
|
47
|
+
|
|
21
48
|
void main() {
|
|
22
49
|
v_color = vec4(a_Color.xyz, a_Color.w * opacity);
|
|
23
50
|
v_blur = 1.0 - max(2.0 / a_Size, 0.05);
|
|
24
51
|
v_innerRadius = max((a_Size - u_stroke_width) / a_Size, 0.0);
|
|
25
52
|
|
|
26
|
-
vec2 offset = project_pixel(
|
|
53
|
+
vec2 offset = project_pixel(offsets);
|
|
27
54
|
|
|
28
55
|
vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
|
|
29
56
|
gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w));
|
|
30
57
|
|
|
31
58
|
gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
|
|
59
|
+
|
|
60
|
+
// apply anchor offset in screen space
|
|
61
|
+
vec2 anchorOffset = applyAnchorPoint(anchor, gl_PointSize);
|
|
62
|
+
gl_Position.xy += anchorOffset / u_ViewportSize * 2.0 * gl_Position.w;
|
|
63
|
+
|
|
32
64
|
setPickingColor(a_PickingColor);
|
|
33
65
|
}
|
|
@@ -17,6 +17,35 @@ out float v_radius;
|
|
|
17
17
|
#pragma include "projection"
|
|
18
18
|
#pragma include "picking"
|
|
19
19
|
|
|
20
|
+
// 根据 anchor 值计算 extrude 偏移
|
|
21
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
22
|
+
vec2 applyAnchor(vec2 extrude, float anchor) {
|
|
23
|
+
if (anchor < 0.5) {
|
|
24
|
+
return extrude;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
vec2 offset = vec2(0.0);
|
|
28
|
+
|
|
29
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
30
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
31
|
+
// top-right, right, bottom-right -> shift left
|
|
32
|
+
offset.x = -1.0;
|
|
33
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
34
|
+
// bottom-left, left, top-left -> shift right
|
|
35
|
+
offset.x = 1.0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
39
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
40
|
+
// top, top-right, top-left -> shift down
|
|
41
|
+
offset.y = -1.0;
|
|
42
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
43
|
+
// bottom-right, bottom, bottom-left, bottom-center -> shift up
|
|
44
|
+
offset.y = 1.0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return extrude + offset;
|
|
48
|
+
}
|
|
20
49
|
|
|
21
50
|
void main() {
|
|
22
51
|
vec3 extrude = a_Extrude;
|
|
@@ -37,10 +66,15 @@ void main() {
|
|
|
37
66
|
// float antialiased_blur = -max(u_blur, antialiasblur);
|
|
38
67
|
float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);
|
|
39
68
|
|
|
40
|
-
//
|
|
41
|
-
|
|
69
|
+
// apply anchor to extrude direction
|
|
70
|
+
vec2 anchoredExtrude = applyAnchor(extrude.xy, anchor);
|
|
71
|
+
|
|
72
|
+
// TODP: sign() 是为了兼容地球模式,同时避免 anchor 偏移后为 0 时除以零产生 NaN
|
|
73
|
+
// 注意:v_data 必须使用原始 extrude 而非 anchoredExtrude,因为 SDF 形状计算需要基于原始形状坐标系
|
|
74
|
+
// anchoredExtrude 只用于位置偏移,不改变形状本身的 SDF 采样
|
|
75
|
+
v_data = vec4(sign(extrude.x), sign(extrude.y), antialiasblur,shape_type);
|
|
42
76
|
|
|
43
|
-
gl_Position = u_ViewProjectionMatrix * vec4(a_Position +
|
|
77
|
+
gl_Position = u_ViewProjectionMatrix * vec4(a_Position + anchoredExtrude * newSize * 0.1 + vec3(offsets,0.0), 1.0);
|
|
44
78
|
|
|
45
79
|
setPickingColor(a_PickingColor);
|
|
46
80
|
}
|
|
@@ -24,6 +24,36 @@ out float v_radius;
|
|
|
24
24
|
#pragma include "picking"
|
|
25
25
|
#pragma include "rotation_2d"
|
|
26
26
|
|
|
27
|
+
// 根据 anchor 值计算 extrude 偏移
|
|
28
|
+
// anchor: 0=center, 1=top, 2=top-right, 3=right, 4=bottom-right, 5=bottom, 6=bottom-left, 7=left, 8=top-left, 9=bottom-center
|
|
29
|
+
vec2 applyAnchor(vec2 extrude, float anchor) {
|
|
30
|
+
if (anchor < 0.5) {
|
|
31
|
+
return extrude;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
vec2 offset = vec2(0.0);
|
|
35
|
+
|
|
36
|
+
// horizontal alignment: 左边缘对准坐标 -> 向右移; 右边缘对准坐标 -> 向左移
|
|
37
|
+
if (anchor == 2.0 || anchor == 3.0 || anchor == 4.0) {
|
|
38
|
+
// top-right, right, bottom-right -> shift left
|
|
39
|
+
offset.x = -1.0;
|
|
40
|
+
} else if (anchor == 6.0 || anchor == 7.0 || anchor == 8.0) {
|
|
41
|
+
// bottom-left, left, top-left -> shift right
|
|
42
|
+
offset.x = 1.0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// vertical alignment: 上边缘对准坐标 -> 向下移(图形在坐标下方); 下边缘对准坐标 -> 向上移(图形在坐标上方)
|
|
46
|
+
if (anchor == 1.0 || anchor == 2.0 || anchor == 8.0) {
|
|
47
|
+
// top, top-right, top-left -> shift down
|
|
48
|
+
offset.y = -1.0;
|
|
49
|
+
} else if (anchor == 4.0 || anchor == 5.0 || anchor == 6.0 || anchor == 9.0) {
|
|
50
|
+
// bottom-right, bottom, bottom-left, bottom-center -> shift up
|
|
51
|
+
offset.y = 1.0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return extrude + offset;
|
|
55
|
+
}
|
|
56
|
+
|
|
27
57
|
void main() {
|
|
28
58
|
// 透明度计算
|
|
29
59
|
v_stroke = stroke;
|
|
@@ -51,13 +81,18 @@ void main() {
|
|
|
51
81
|
// float antialiased_blur = -max(u_blur, antialiasblur);
|
|
52
82
|
float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);
|
|
53
83
|
|
|
54
|
-
|
|
84
|
+
// apply anchor to extrude direction
|
|
85
|
+
vec2 anchoredExtrude = applyAnchor(extrude.xy, anchor);
|
|
86
|
+
|
|
87
|
+
vec2 offset = (anchoredExtrude * (newSize + u_stroke_width) + offsets);
|
|
55
88
|
|
|
56
89
|
offset = project_pixel(offset);
|
|
57
90
|
offset = rotate_matrix(offset,rotation);
|
|
58
91
|
|
|
59
|
-
// TODP:
|
|
60
|
-
v_data
|
|
92
|
+
// TODP: sign() 是为了兼容地球模式,同时避免 anchor 偏移后为 0 时除以零产生 NaN
|
|
93
|
+
// 注意:v_data 必须使用原始 extrude 而非 anchoredExtrude,因为 SDF 形状计算需要基于原始形状坐标系
|
|
94
|
+
// anchoredExtrude 只用于位置偏移,不改变形状本身的 SDF 采样
|
|
95
|
+
v_data = vec4(sign(extrude.x), sign(extrude.y), antialiasblur,shape_type);
|
|
61
96
|
|
|
62
97
|
vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
|
|
63
98
|
// gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
|