@antv/l7-layers 2.5.33 → 2.5.37-mini
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/lib/core/BaseModel.js +1 -1
- package/lib/core/BaseModel.js.map +1 -1
- package/lib/earth/models/atmosphere.js +1 -0
- package/lib/earth/models/atmosphere.js.map +1 -1
- package/lib/earth/models/base.js +1 -0
- package/lib/earth/models/base.js.map +1 -1
- package/lib/heatmap/models/heatmap.js +12 -17
- package/lib/heatmap/models/heatmap.js.map +1 -1
- package/lib/plugins/LayerStylePlugin.js.map +1 -1
- package/lib/plugins/ShaderUniformPlugin.js +3 -1
- package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
- package/lib/point/models/image.js.map +1 -1
- package/package.json +5 -5
- package/CHANGELOG.md +0 -492
- package/LICENSE.md +0 -21
- package/es/citybuliding/building.d.ts +0 -17
- package/es/citybuliding/building.js +0 -79
- package/es/citybuliding/building.js.map +0 -1
- package/es/citybuliding/models/build.d.ts +0 -13
- package/es/citybuliding/models/build.js +0 -124
- package/es/citybuliding/models/build.js.map +0 -1
- package/es/core/BaseLayer.d.ts +0 -174
- package/es/core/BaseLayer.js +0 -974
- package/es/core/BaseLayer.js.map +0 -1
- package/es/core/BaseModel.d.ts +0 -135
- package/es/core/BaseModel.js +0 -412
- package/es/core/BaseModel.js.map +0 -1
- package/es/core/interface.d.ts +0 -19
- package/es/core/interface.js +0 -7
- package/es/core/interface.js.map +0 -1
- package/es/core/schema.d.ts +0 -27
- package/es/core/schema.js +0 -23
- package/es/core/schema.js.map +0 -1
- package/es/core/shape/Path.d.ts +0 -39
- package/es/core/shape/Path.js +0 -57
- package/es/core/shape/Path.js.map +0 -1
- package/es/core/shape/extrude.d.ts +0 -17
- package/es/core/shape/extrude.js +0 -143
- package/es/core/shape/extrude.js.map +0 -1
- package/es/core/triangulation.d.ts +0 -109
- package/es/core/triangulation.js +0 -328
- package/es/core/triangulation.js.map +0 -1
- package/es/earth/index.d.ts +0 -17
- package/es/earth/index.js +0 -81
- package/es/earth/index.js.map +0 -1
- package/es/earth/models/atmosphere.d.ts +0 -9
- package/es/earth/models/atmosphere.js +0 -124
- package/es/earth/models/atmosphere.js.map +0 -1
- package/es/earth/models/base.d.ts +0 -16
- package/es/earth/models/base.js +0 -192
- package/es/earth/models/base.js.map +0 -1
- package/es/earth/models/bloomsphere.d.ts +0 -9
- package/es/earth/models/bloomsphere.js +0 -125
- package/es/earth/models/bloomsphere.js.map +0 -1
- package/es/earth/utils.d.ts +0 -26
- package/es/earth/utils.js +0 -81
- package/es/earth/utils.js.map +0 -1
- package/es/glsl.d.js +0 -2
- package/es/glsl.d.js.map +0 -1
- package/es/heatmap/index.d.ts +0 -22
- package/es/heatmap/index.js +0 -123
- package/es/heatmap/index.js.map +0 -1
- package/es/heatmap/models/grid.d.ts +0 -8
- package/es/heatmap/models/grid.js +0 -90
- package/es/heatmap/models/grid.js.map +0 -1
- package/es/heatmap/models/grid3d.d.ts +0 -8
- package/es/heatmap/models/grid3d.js +0 -122
- package/es/heatmap/models/grid3d.js.map +0 -1
- package/es/heatmap/models/heatmap.d.ts +0 -24
- package/es/heatmap/models/heatmap.js +0 -399
- package/es/heatmap/models/heatmap.js.map +0 -1
- package/es/heatmap/models/hexagon.d.ts +0 -8
- package/es/heatmap/models/hexagon.js +0 -90
- package/es/heatmap/models/hexagon.js.map +0 -1
- package/es/heatmap/models/index.d.ts +0 -5
- package/es/heatmap/models/index.js +0 -13
- package/es/heatmap/models/index.js.map +0 -1
- package/es/heatmap/triangulation.d.ts +0 -5
- package/es/heatmap/triangulation.js +0 -38
- package/es/heatmap/triangulation.js.map +0 -1
- package/es/image/index.d.ts +0 -22
- package/es/image/index.js +0 -82
- package/es/image/index.js.map +0 -1
- package/es/image/models/image.d.ts +0 -18
- package/es/image/models/image.js +0 -127
- package/es/image/models/image.js.map +0 -1
- package/es/image/models/index.d.ts +0 -5
- package/es/image/models/index.js +0 -6
- package/es/image/models/index.js.map +0 -1
- package/es/index.d.ts +0 -11
- package/es/index.js +0 -39
- package/es/index.js.map +0 -1
- package/es/line/index.d.ts +0 -25
- package/es/line/index.js +0 -95
- package/es/line/index.js.map +0 -1
- package/es/line/models/arc.d.ts +0 -12
- package/es/line/models/arc.js +0 -281
- package/es/line/models/arc.js.map +0 -1
- package/es/line/models/arc_3d.d.ts +0 -12
- package/es/line/models/arc_3d.js +0 -277
- package/es/line/models/arc_3d.js.map +0 -1
- package/es/line/models/great_circle.d.ts +0 -12
- package/es/line/models/great_circle.js +0 -269
- package/es/line/models/great_circle.js.map +0 -1
- package/es/line/models/index.d.ts +0 -5
- package/es/line/models/index.js +0 -12
- package/es/line/models/index.js.map +0 -1
- package/es/line/models/line.d.ts +0 -13
- package/es/line/models/line.js +0 -342
- package/es/line/models/line.js.map +0 -1
- package/es/plugins/DataMappingPlugin.d.ts +0 -13
- package/es/plugins/DataMappingPlugin.js +0 -199
- package/es/plugins/DataMappingPlugin.js.map +0 -1
- package/es/plugins/DataSourcePlugin.d.ts +0 -7
- package/es/plugins/DataSourcePlugin.js +0 -73
- package/es/plugins/DataSourcePlugin.js.map +0 -1
- package/es/plugins/FeatureScalePlugin.d.ts +0 -26
- package/es/plugins/FeatureScalePlugin.js +0 -270
- package/es/plugins/FeatureScalePlugin.js.map +0 -1
- package/es/plugins/LayerAnimateStylePlugin.d.ts +0 -7
- package/es/plugins/LayerAnimateStylePlugin.js +0 -50
- package/es/plugins/LayerAnimateStylePlugin.js.map +0 -1
- package/es/plugins/LayerModelPlugin.d.ts +0 -8
- package/es/plugins/LayerModelPlugin.js +0 -34
- package/es/plugins/LayerModelPlugin.js.map +0 -1
- package/es/plugins/LayerStylePlugin.d.ts +0 -8
- package/es/plugins/LayerStylePlugin.js +0 -35
- package/es/plugins/LayerStylePlugin.js.map +0 -1
- package/es/plugins/LightingPlugin.d.ts +0 -36
- package/es/plugins/LightingPlugin.js +0 -100
- package/es/plugins/LightingPlugin.js.map +0 -1
- package/es/plugins/MultiPassRendererPlugin.d.ts +0 -37
- package/es/plugins/MultiPassRendererPlugin.js +0 -79
- package/es/plugins/MultiPassRendererPlugin.js.map +0 -1
- package/es/plugins/PixelPickingPlugin.d.ts +0 -8
- package/es/plugins/PixelPickingPlugin.js +0 -112
- package/es/plugins/PixelPickingPlugin.js.map +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -11
- package/es/plugins/RegisterStyleAttributePlugin.js +0 -98
- package/es/plugins/RegisterStyleAttributePlugin.js.map +0 -1
- package/es/plugins/ShaderUniformPlugin.d.ts +0 -16
- package/es/plugins/ShaderUniformPlugin.js +0 -78
- package/es/plugins/ShaderUniformPlugin.js.map +0 -1
- package/es/plugins/UpdateModelPlugin.d.ts +0 -8
- package/es/plugins/UpdateModelPlugin.js +0 -27
- package/es/plugins/UpdateModelPlugin.js.map +0 -1
- package/es/plugins/UpdateStyleAttributePlugin.d.ts +0 -12
- package/es/plugins/UpdateStyleAttributePlugin.js +0 -74
- package/es/plugins/UpdateStyleAttributePlugin.js.map +0 -1
- package/es/point/index.d.ts +0 -30
- package/es/point/index.js +0 -130
- package/es/point/index.js.map +0 -1
- package/es/point/models/extrude.d.ts +0 -14
- package/es/point/models/extrude.js +0 -180
- package/es/point/models/extrude.js.map +0 -1
- package/es/point/models/fill.d.ts +0 -17
- package/es/point/models/fill.js +0 -247
- package/es/point/models/fill.js.map +0 -1
- package/es/point/models/icon-font.d.ts +0 -11
- package/es/point/models/icon-font.js +0 -181
- package/es/point/models/icon-font.js.map +0 -1
- package/es/point/models/image.d.ts +0 -11
- package/es/point/models/image.js +0 -207
- package/es/point/models/image.js.map +0 -1
- package/es/point/models/index.d.ts +0 -5
- package/es/point/models/index.js +0 -16
- package/es/point/models/index.js.map +0 -1
- package/es/point/models/normal.d.ts +0 -21
- package/es/point/models/normal.js +0 -155
- package/es/point/models/normal.js.map +0 -1
- package/es/point/models/text.d.ts +0 -56
- package/es/point/models/text.js +0 -522
- package/es/point/models/text.js.map +0 -1
- package/es/point/shape/Path.d.ts +0 -40
- package/es/point/shape/Path.js +0 -57
- package/es/point/shape/Path.js.map +0 -1
- package/es/point/shape/extrude.d.ts +0 -15
- package/es/point/shape/extrude.js +0 -58
- package/es/point/shape/extrude.js.map +0 -1
- package/es/polygon/index.d.ts +0 -22
- package/es/polygon/index.js +0 -124
- package/es/polygon/index.js.map +0 -1
- package/es/polygon/models/extrude.d.ts +0 -13
- package/es/polygon/models/extrude.js +0 -139
- package/es/polygon/models/extrude.js.map +0 -1
- package/es/polygon/models/fill.d.ts +0 -13
- package/es/polygon/models/fill.js +0 -108
- package/es/polygon/models/fill.js.map +0 -1
- package/es/polygon/models/index.d.ts +0 -5
- package/es/polygon/models/index.js +0 -20
- package/es/polygon/models/index.js.map +0 -1
- package/es/raster/buffers/triangulation.d.ts +0 -6
- package/es/raster/buffers/triangulation.js +0 -28
- package/es/raster/buffers/triangulation.js.map +0 -1
- package/es/raster/image.d.ts +0 -0
- package/es/raster/image.js +0 -2
- package/es/raster/image.js.map +0 -1
- package/es/raster/index.d.ts +0 -28
- package/es/raster/index.js +0 -83
- package/es/raster/index.js.map +0 -1
- package/es/raster/models/index.d.ts +0 -5
- package/es/raster/models/index.js +0 -7
- package/es/raster/models/index.js.map +0 -1
- package/es/raster/models/raster.d.ts +0 -19
- package/es/raster/models/raster.js +0 -152
- package/es/raster/models/raster.js.map +0 -1
- package/es/raster/raster.d.ts +0 -30
- package/es/raster/raster.js +0 -178
- package/es/raster/raster.js.map +0 -1
- package/es/raster/raster2d.d.ts +0 -27
- package/es/raster/raster2d.js +0 -158
- package/es/raster/raster2d.js.map +0 -1
- package/es/utils/blend.d.ts +0 -2
- package/es/utils/blend.js +0 -55
- package/es/utils/blend.js.map +0 -1
- package/es/utils/collision-index.d.ts +0 -47
- package/es/utils/collision-index.js +0 -87
- package/es/utils/collision-index.js.map +0 -1
- package/es/utils/dataMappingStyle.d.ts +0 -30
- package/es/utils/dataMappingStyle.js +0 -88
- package/es/utils/dataMappingStyle.js.map +0 -1
- package/es/utils/extrude_polyline.d.ts +0 -48
- package/es/utils/extrude_polyline.js +0 -405
- package/es/utils/extrude_polyline.js.map +0 -1
- package/es/utils/geo.d.ts +0 -3
- package/es/utils/geo.js +0 -24
- package/es/utils/geo.js.map +0 -1
- package/es/utils/grid-index.d.ts +0 -28
- package/es/utils/grid-index.js +0 -193
- package/es/utils/grid-index.js.map +0 -1
- package/es/utils/polylineNormal.d.ts +0 -9
- package/es/utils/polylineNormal.js +0 -171
- package/es/utils/polylineNormal.js.map +0 -1
- package/es/utils/symbol-layout.d.ts +0 -43
- package/es/utils/symbol-layout.js +0 -260
- package/es/utils/symbol-layout.js.map +0 -1
|
@@ -1,124 +0,0 @@
|
|
|
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 { AttributeType, gl } from '@antv/l7-core';
|
|
12
|
-
import { rgb2arr } from '@antv/l7-utils';
|
|
13
|
-
import BaseModel from '../../core/BaseModel';
|
|
14
|
-
import { PolygonExtrudeTriangulation } from '../../core/triangulation';
|
|
15
|
-
var buildFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\nuniform float u_near : 0;\nuniform float u_far : 1;\nvarying vec4 v_Color;\nvarying vec2 v_texCoord;\nuniform float u_Zoom : 1;\nuniform float u_time;\n\n#pragma include \"picking\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n gl_FragColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n gl_FragColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n gl_FragColor = vec4(foggedColor,1.0);\n }\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
16
|
-
var buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvarying vec4 v_Color;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n v_texCoord = a_Uv;\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
17
|
-
|
|
18
|
-
var CityBuildModel = function (_BaseModel) {
|
|
19
|
-
_inherits(CityBuildModel, _BaseModel);
|
|
20
|
-
|
|
21
|
-
var _super = _createSuper(CityBuildModel);
|
|
22
|
-
|
|
23
|
-
function CityBuildModel() {
|
|
24
|
-
_classCallCheck(this, CityBuildModel);
|
|
25
|
-
|
|
26
|
-
return _super.apply(this, arguments);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
_createClass(CityBuildModel, [{
|
|
30
|
-
key: "getUninforms",
|
|
31
|
-
value: function getUninforms() {
|
|
32
|
-
var _ref = this.layer.getLayerConfig(),
|
|
33
|
-
_ref$opacity = _ref.opacity,
|
|
34
|
-
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
35
|
-
_ref$baseColor = _ref.baseColor,
|
|
36
|
-
baseColor = _ref$baseColor === void 0 ? 'rgb(16,16,16)' : _ref$baseColor,
|
|
37
|
-
_ref$brightColor = _ref.brightColor,
|
|
38
|
-
brightColor = _ref$brightColor === void 0 ? 'rgb(255,176,38)' : _ref$brightColor,
|
|
39
|
-
_ref$windowColor = _ref.windowColor,
|
|
40
|
-
windowColor = _ref$windowColor === void 0 ? 'rgb(30,60,89)' : _ref$windowColor,
|
|
41
|
-
_ref$time = _ref.time,
|
|
42
|
-
time = _ref$time === void 0 ? 0 : _ref$time;
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
u_opacity: opacity,
|
|
46
|
-
u_baseColor: rgb2arr(baseColor),
|
|
47
|
-
u_brightColor: rgb2arr(brightColor),
|
|
48
|
-
u_windowColor: rgb2arr(windowColor),
|
|
49
|
-
u_time: this.layer.getLayerAnimateTime() || time
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "initModels",
|
|
54
|
-
value: function initModels() {
|
|
55
|
-
this.startModelAnimate();
|
|
56
|
-
return [this.layer.buildLayerModel({
|
|
57
|
-
moduleName: 'cityBuilding',
|
|
58
|
-
vertexShader: buildVert,
|
|
59
|
-
fragmentShader: buildFrag,
|
|
60
|
-
triangulation: PolygonExtrudeTriangulation
|
|
61
|
-
})];
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "registerBuiltinAttributes",
|
|
65
|
-
value: function registerBuiltinAttributes() {
|
|
66
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
67
|
-
name: 'normal',
|
|
68
|
-
type: AttributeType.Attribute,
|
|
69
|
-
descriptor: {
|
|
70
|
-
name: 'a_Normal',
|
|
71
|
-
buffer: {
|
|
72
|
-
usage: gl.STATIC_DRAW,
|
|
73
|
-
data: [],
|
|
74
|
-
type: gl.FLOAT
|
|
75
|
-
},
|
|
76
|
-
size: 3,
|
|
77
|
-
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
78
|
-
return normal;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
83
|
-
name: 'size',
|
|
84
|
-
type: AttributeType.Attribute,
|
|
85
|
-
descriptor: {
|
|
86
|
-
name: 'a_Size',
|
|
87
|
-
buffer: {
|
|
88
|
-
usage: gl.DYNAMIC_DRAW,
|
|
89
|
-
data: [],
|
|
90
|
-
type: gl.FLOAT
|
|
91
|
-
},
|
|
92
|
-
size: 1,
|
|
93
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
94
|
-
var _feature$size = feature.size,
|
|
95
|
-
size = _feature$size === void 0 ? 10 : _feature$size;
|
|
96
|
-
return Array.isArray(size) ? [size[0]] : [size];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
this.styleAttributeService.registerStyleAttribute({
|
|
101
|
-
name: 'uv',
|
|
102
|
-
type: AttributeType.Attribute,
|
|
103
|
-
descriptor: {
|
|
104
|
-
name: 'a_Uv',
|
|
105
|
-
buffer: {
|
|
106
|
-
usage: gl.DYNAMIC_DRAW,
|
|
107
|
-
data: [],
|
|
108
|
-
type: gl.FLOAT
|
|
109
|
-
},
|
|
110
|
-
size: 2,
|
|
111
|
-
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
112
|
-
var size = feature.size;
|
|
113
|
-
return [vertex[3], vertex[4]];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}]);
|
|
119
|
-
|
|
120
|
-
return CityBuildModel;
|
|
121
|
-
}(BaseModel);
|
|
122
|
-
|
|
123
|
-
export { CityBuildModel as default };
|
|
124
|
-
//# sourceMappingURL=build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/citybuliding/models/build.ts"],"names":["AttributeType","gl","rgb2arr","BaseModel","PolygonExtrudeTriangulation","CityBuildModel","layer","getLayerConfig","opacity","baseColor","brightColor","windowColor","time","u_opacity","u_baseColor","u_brightColor","u_windowColor","u_time","getLayerAnimateTime","startModelAnimate","buildLayerModel","moduleName","vertexShader","buildVert","fragmentShader","buildFrag","triangulation","styleAttributeService","registerStyleAttribute","name","type","Attribute","descriptor","buffer","usage","STATIC_DRAW","data","FLOAT","size","update","feature","featureIdx","vertex","attributeIdx","normal","DYNAMIC_DRAW","Array","isArray"],"mappings":";;;;;;;;;;AAAA,SAASA,aAAT,EAAwBC,EAAxB,QAA0D,eAA1D;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AACA,SAASC,2BAAT,QAA4C,0BAA5C;;;;IAUqBC,c;;;;;;;;;;;;;WACnB,wBAAsB;AACpB,iBAMI,KAAKC,KAAL,CAAWC,cAAX,EANJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,gCAEEC,SAFF;AAAA,UAEEA,SAFF,+BAEc,eAFd;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,iBAHhB;AAAA,kCAIEC,WAJF;AAAA,UAIEA,WAJF,iCAIgB,eAJhB;AAAA,2BAKEC,IALF;AAAA,UAKEA,IALF,0BAKS,CALT;;AAOA,aAAO;AACLC,QAAAA,SAAS,EAAEL,OADN;AAELM,QAAAA,WAAW,EAAEZ,OAAO,CAACO,SAAD,CAFf;AAGLM,QAAAA,aAAa,EAAEb,OAAO,CAACQ,WAAD,CAHjB;AAILM,QAAAA,aAAa,EAAEd,OAAO,CAACS,WAAD,CAJjB;AAKLM,QAAAA,MAAM,EAAE,KAAKX,KAAL,CAAWY,mBAAX,MAAoCN;AALvC,OAAP;AAOD;;;WAED,sBAA8B;AAC5B,WAAKO,iBAAL;AACA,aAAO,CACL,KAAKb,KAAL,CAAWc,eAAX,CAA2B;AACzBC,QAAAA,UAAU,EAAE,cADa;AAEzBC,QAAAA,YAAY,EAAEC,SAFW;AAGzBC,QAAAA,cAAc,EAAEC,SAHS;AAIzBC,QAAAA,aAAa,EAAEtB;AAJU,OAA3B,CADK,CAAP;AAQD;;;WAED,qCAAsC;AAEpC,WAAKuB,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,QAD0C;AAEhDC,QAAAA,IAAI,EAAE9B,aAAa,CAAC+B,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,UADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEjC,EAAE,CAACkC,WAFJ;AAGNC,YAAAA,IAAI,EAAE,EAHA;AAINN,YAAAA,IAAI,EAAE7B,EAAE,CAACoC;AAJH,WAFE;AAQVC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKNC,MALM,EAMH;AACH,mBAAOA,MAAP;AACD;AAjBS;AAHoC,OAAlD;AAwBA,WAAKjB,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,MAD0C;AAEhDC,QAAAA,IAAI,EAAE9B,aAAa,CAAC+B,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,QADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEjC,EAAE,CAAC4C,YAFJ;AAGNT,YAAAA,IAAI,EAAE,EAHA;AAINN,YAAAA,IAAI,EAAE7B,EAAE,CAACoC;AAJH,WAFE;AAQVC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gCAAsBH,OAAtB,CAAQF,IAAR;AAAA,gBAAQA,IAAR,8BAAe,EAAf;AACA,mBAAOQ,KAAK,CAACC,OAAN,CAAcT,IAAd,IAAsB,CAACA,IAAI,CAAC,CAAD,CAAL,CAAtB,GAAkC,CAACA,IAAD,CAAzC;AACD;AAjBS;AAHoC,OAAlD;AAuBA,WAAKX,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,IAD0C;AAEhDC,QAAAA,IAAI,EAAE9B,aAAa,CAAC+B,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,MADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEjC,EAAE,CAAC4C,YAFJ;AAGNT,YAAAA,IAAI,EAAE,EAHA;AAINN,YAAAA,IAAI,EAAE7B,EAAE,CAACoC;AAJH,WAFE;AAQVC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAQL,IAAR,GAAiBE,OAAjB,CAAQF,IAAR;AACA,mBAAO,CAACI,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,CAAP;AACD;AAjBS;AAHoC,OAAlD;AAuBD;;;;EAtGyCvC,S;;SAAvBE,c","sourcesContent":["import { AttributeType, gl, IEncodeFeature, IModel } from '@antv/l7-core';\nimport { rgb2arr } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { PolygonExtrudeTriangulation } from '../../core/triangulation';\nimport buildFrag from '../shaders/build_frag.glsl';\nimport buildVert from '../shaders/build_vert.glsl';\ninterface ICityBuildLayerStyleOptions {\n opacity: number;\n baseColor: string;\n brightColor: string;\n windowColor: string;\n time: number;\n}\nexport default class CityBuildModel extends BaseModel {\n public getUninforms() {\n const {\n opacity = 1,\n baseColor = 'rgb(16,16,16)',\n brightColor = 'rgb(255,176,38)',\n windowColor = 'rgb(30,60,89)',\n time = 0,\n } = this.layer.getLayerConfig() as ICityBuildLayerStyleOptions;\n return {\n u_opacity: opacity,\n u_baseColor: rgb2arr(baseColor),\n u_brightColor: rgb2arr(brightColor),\n u_windowColor: rgb2arr(windowColor),\n u_time: this.layer.getLayerAnimateTime() || time,\n };\n }\n\n public initModels(): IModel[] {\n this.startModelAnimate();\n return [\n this.layer.buildLayerModel({\n moduleName: 'cityBuilding',\n vertexShader: buildVert,\n fragmentShader: buildFrag,\n triangulation: PolygonExtrudeTriangulation,\n }),\n ];\n }\n\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'normal',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Normal',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.STATIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n ) => {\n return normal;\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'size',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Size',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 10 } = feature;\n return Array.isArray(size) ? [size[0]] : [size as number];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size } = feature;\n return [vertex[3], vertex[4]];\n },\n },\n });\n }\n}\n"],"file":"build.js"}
|
package/es/core/BaseLayer.d.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
|
|
2
|
-
import { BlendType, IActiveOption, IAnimateOption, ICameraService, ICoordinateSystemService, IDataState, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, IInteractionService, ILayer, ILayerConfig, ILayerModel, ILayerModelInitializationOptions, ILayerPlugin, ILayerService, IMapService, IModel, IModelInitializationOptions, IMultiPassRenderer, IPass, IPickingService, IPostProcessingPass, IRendererService, IScale, IScaleOptions, IShaderModuleService, ISourceCFG, IStyleAttributeService, IStyleAttributeUpdateOptions, StyleAttributeField, StyleAttributeOption } from '@antv/l7-core';
|
|
3
|
-
import Source from '@antv/l7-source';
|
|
4
|
-
import { EventEmitter } from 'eventemitter3';
|
|
5
|
-
import { Container } from 'inversify';
|
|
6
|
-
export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter implements ILayer {
|
|
7
|
-
id: string;
|
|
8
|
-
name: string;
|
|
9
|
-
type: string;
|
|
10
|
-
visible: boolean;
|
|
11
|
-
zIndex: number;
|
|
12
|
-
minZoom: number;
|
|
13
|
-
maxZoom: number;
|
|
14
|
-
inited: boolean;
|
|
15
|
-
layerModelNeedUpdate: boolean;
|
|
16
|
-
pickedFeatureID: number | null;
|
|
17
|
-
selectedFeatureID: number | null;
|
|
18
|
-
styleNeedUpdate: boolean;
|
|
19
|
-
rendering: boolean;
|
|
20
|
-
dataState: IDataState;
|
|
21
|
-
hooks: {
|
|
22
|
-
init: SyncBailHook;
|
|
23
|
-
afterInit: SyncBailHook;
|
|
24
|
-
beforeRender: SyncBailHook;
|
|
25
|
-
beforeRenderData: SyncWaterfallHook;
|
|
26
|
-
afterRender: SyncHook;
|
|
27
|
-
beforePickingEncode: SyncHook;
|
|
28
|
-
afterPickingEncode: SyncHook;
|
|
29
|
-
beforeHighlight: SyncHook;
|
|
30
|
-
afterHighlight: SyncHook;
|
|
31
|
-
beforeSelect: SyncHook;
|
|
32
|
-
afterSelect: SyncHook;
|
|
33
|
-
beforeDestroy: SyncHook;
|
|
34
|
-
afterDestroy: SyncHook;
|
|
35
|
-
};
|
|
36
|
-
models: IModel[];
|
|
37
|
-
multiPassRenderer: IMultiPassRenderer;
|
|
38
|
-
plugins: ILayerPlugin[];
|
|
39
|
-
sourceOption: {
|
|
40
|
-
data: any;
|
|
41
|
-
options?: ISourceCFG;
|
|
42
|
-
};
|
|
43
|
-
layerModel: ILayerModel;
|
|
44
|
-
protected readonly configService: IGlobalConfigService;
|
|
45
|
-
protected readonly shaderModuleService: IShaderModuleService;
|
|
46
|
-
protected cameraService: ICameraService;
|
|
47
|
-
protected coordinateService: ICoordinateSystemService;
|
|
48
|
-
protected iconService: IIconService;
|
|
49
|
-
protected fontService: IFontService;
|
|
50
|
-
protected pickingService: IPickingService;
|
|
51
|
-
protected rendererService: IRendererService;
|
|
52
|
-
protected layerService: ILayerService;
|
|
53
|
-
protected interactionService: IInteractionService;
|
|
54
|
-
protected mapService: IMapService;
|
|
55
|
-
protected styleAttributeService: IStyleAttributeService;
|
|
56
|
-
protected layerSource: Source;
|
|
57
|
-
protected postProcessingPassFactory: (name: string) => IPostProcessingPass<unknown>;
|
|
58
|
-
protected normalPassFactory: (name: string) => IPass<unknown>;
|
|
59
|
-
protected animateOptions: IAnimateOption;
|
|
60
|
-
/**
|
|
61
|
-
* 图层容器
|
|
62
|
-
*/
|
|
63
|
-
private container;
|
|
64
|
-
private encodedData;
|
|
65
|
-
private configSchema;
|
|
66
|
-
private currentPickId;
|
|
67
|
-
private rawConfig;
|
|
68
|
-
private needUpdateConfig;
|
|
69
|
-
/**
|
|
70
|
-
* 待更新样式属性,在初始化阶段完成注册
|
|
71
|
-
*/
|
|
72
|
-
private pendingStyleAttributes;
|
|
73
|
-
private scaleOptions;
|
|
74
|
-
private animateStartTime;
|
|
75
|
-
private aniamateStatus;
|
|
76
|
-
constructor(config?: Partial<ILayerConfig & ChildLayerStyleOptions>);
|
|
77
|
-
getLayerConfig(): Partial<ILayerConfig & import("@antv/l7-core").ISceneConfig & ChildLayerStyleOptions>;
|
|
78
|
-
updateLayerConfig(configToUpdate: Partial<ILayerConfig | ChildLayerStyleOptions>): void;
|
|
79
|
-
/**
|
|
80
|
-
* 注入图层容器,父容器为场景容器
|
|
81
|
-
* RootContainer 1
|
|
82
|
-
* -> SceneContainer 1.*
|
|
83
|
-
* -> LayerContainer 1.*
|
|
84
|
-
*/
|
|
85
|
-
setContainer(container: Container): void;
|
|
86
|
-
getContainer(): Container;
|
|
87
|
-
addPlugin(plugin: ILayerPlugin): ILayer;
|
|
88
|
-
init(): this;
|
|
89
|
-
/**
|
|
90
|
-
* Model初始化前需要更新Model样式
|
|
91
|
-
*/
|
|
92
|
-
prepareBuildModel(): void;
|
|
93
|
-
color(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): this;
|
|
94
|
-
texture(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): this;
|
|
95
|
-
rotate(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): this;
|
|
96
|
-
size(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): this;
|
|
97
|
-
filter(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): this;
|
|
98
|
-
shape(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): this;
|
|
99
|
-
label(field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): this;
|
|
100
|
-
animate(options: IAnimateOption | boolean): this;
|
|
101
|
-
source(data: any, options?: ISourceCFG): ILayer;
|
|
102
|
-
setData(data: any, options?: ISourceCFG): this;
|
|
103
|
-
style(options: Partial<ChildLayerStyleOptions> & Partial<ILayerConfig>): ILayer;
|
|
104
|
-
scale(field: string | number | IScaleOptions, cfg?: IScale): this;
|
|
105
|
-
/**
|
|
106
|
-
* 渲染所有的图层
|
|
107
|
-
*/
|
|
108
|
-
renderLayers(): void;
|
|
109
|
-
render(): ILayer;
|
|
110
|
-
active(options: IActiveOption | boolean): this;
|
|
111
|
-
setActive(id: number | {
|
|
112
|
-
x: number;
|
|
113
|
-
y: number;
|
|
114
|
-
}, options?: IActiveOption): void;
|
|
115
|
-
select(option: IActiveOption | boolean): ILayer;
|
|
116
|
-
setSelect(id: number | {
|
|
117
|
-
x: number;
|
|
118
|
-
y: number;
|
|
119
|
-
}, options?: IActiveOption): void;
|
|
120
|
-
setBlend(type: keyof typeof BlendType): void;
|
|
121
|
-
show(): ILayer;
|
|
122
|
-
hide(): ILayer;
|
|
123
|
-
setIndex(index: number): ILayer;
|
|
124
|
-
setCurrentPickId(id: number): void;
|
|
125
|
-
getCurrentPickId(): number | null;
|
|
126
|
-
setCurrentSelectedId(id: number): void;
|
|
127
|
-
getCurrentSelectedId(): number | null;
|
|
128
|
-
isVisible(): boolean;
|
|
129
|
-
setMinZoom(minZoom: number): ILayer;
|
|
130
|
-
getMinZoom(): number;
|
|
131
|
-
getMaxZoom(): number;
|
|
132
|
-
get(name: string): any;
|
|
133
|
-
setMaxZoom(maxZoom: number): ILayer;
|
|
134
|
-
/**
|
|
135
|
-
* zoom to layer Bounds
|
|
136
|
-
*/
|
|
137
|
-
fitBounds(fitBoundsOptions?: unknown): ILayer;
|
|
138
|
-
destroy(): void;
|
|
139
|
-
clear(): void;
|
|
140
|
-
clearModels(): void;
|
|
141
|
-
isDirty(): boolean;
|
|
142
|
-
setSource(source: Source): void;
|
|
143
|
-
getSource(): Source;
|
|
144
|
-
getScaleOptions(): IScaleOptions;
|
|
145
|
-
setEncodedData(encodedData: IEncodeFeature[]): void;
|
|
146
|
-
getEncodedData(): IEncodeFeature[];
|
|
147
|
-
getLegendItems(name: string): any;
|
|
148
|
-
pick({ x, y }: {
|
|
149
|
-
x: number;
|
|
150
|
-
y: number;
|
|
151
|
-
}): void;
|
|
152
|
-
boxSelect(box: [number, number, number, number], cb: (...args: any[]) => void): void;
|
|
153
|
-
buildLayerModel(options: ILayerModelInitializationOptions & Partial<IModelInitializationOptions>): IModel;
|
|
154
|
-
getTime(): number;
|
|
155
|
-
setAnimateStartTime(): void;
|
|
156
|
-
stopAnimate(): void;
|
|
157
|
-
getLayerAnimateTime(): number;
|
|
158
|
-
needPick(type: string): boolean;
|
|
159
|
-
buildModels(): void;
|
|
160
|
-
rebuildModels(): void;
|
|
161
|
-
renderModels(): this;
|
|
162
|
-
updateStyleAttribute(type: string, field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): void;
|
|
163
|
-
/**
|
|
164
|
-
* 继承空方法
|
|
165
|
-
* @param time
|
|
166
|
-
*/
|
|
167
|
-
setEarthTime(time: number): void;
|
|
168
|
-
protected getConfigSchema(): void;
|
|
169
|
-
protected getModelType(): unknown;
|
|
170
|
-
protected getDefaultConfig(): {};
|
|
171
|
-
private sourceEvent;
|
|
172
|
-
private reRender;
|
|
173
|
-
private splitValuesAndCallbackInAttribute;
|
|
174
|
-
}
|