@antv/l7-layers 2.6.30 → 2.6.31
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/citybuliding/models/build.js +3 -2
- package/es/citybuliding/models/build.js.map +1 -1
- package/es/core/interface.d.ts +2 -0
- package/es/core/interface.js.map +1 -1
- package/es/line/index.d.ts +1 -1
- package/es/line/index.js +1 -0
- package/es/line/index.js.map +1 -1
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +2 -0
- package/es/line/models/index.js.map +1 -1
- package/es/line/models/wall.d.ts +12 -0
- package/es/line/models/wall.js +311 -0
- package/es/line/models/wall.js.map +1 -0
- package/lib/citybuliding/models/build.js +3 -2
- package/lib/citybuliding/models/build.js.map +1 -1
- package/lib/core/interface.js.map +1 -1
- package/lib/line/index.js +1 -0
- package/lib/line/index.js.map +1 -1
- package/lib/line/models/index.js +3 -0
- package/lib/line/models/index.js.map +1 -1
- package/lib/line/models/wall.js +327 -0
- package/lib/line/models/wall.js.map +1 -0
- package/package.json +5 -5
|
@@ -60,11 +60,12 @@ var CityBuildModel = function (_BaseModel) {
|
|
|
60
60
|
enable: false,
|
|
61
61
|
sweepRadius: 1,
|
|
62
62
|
sweepColor: 'rgb(255, 255, 255)',
|
|
63
|
-
sweepSpeed: 0.4
|
|
63
|
+
sweepSpeed: 0.4,
|
|
64
|
+
sweepCenter: this.cityCenter
|
|
64
65
|
} : _ref$sweep;
|
|
65
66
|
|
|
66
67
|
return {
|
|
67
|
-
u_cityCenter: this.cityCenter,
|
|
68
|
+
u_cityCenter: sweep.sweepCenter || this.cityCenter,
|
|
68
69
|
u_cityMinSize: this.cityMinSize * sweep.sweepRadius,
|
|
69
70
|
u_circleSweep: sweep.enable ? 1.0 : 0.0,
|
|
70
71
|
u_circleSweepColor: rgb2arr(sweep.sweepColor).slice(0, 3),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/citybuliding/models/build.ts"],"names":["AttributeType","gl","rgb2arr","BaseModel","PolygonExtrudeTriangulation","CityBuildModel","layer","getLayerConfig","opacity","baseColor","brightColor","windowColor","time","sweep","enable","sweepRadius","sweepColor","sweepSpeed","u_cityCenter","cityCenter","u_cityMinSize","cityMinSize","u_circleSweep","u_circleSweepColor","slice","u_circleSweepSpeed","u_opacity","u_baseColor","u_brightColor","u_windowColor","u_time","getLayerAnimateTime","getSource","extent","minLng","minLat","maxLng","maxLat","mapService","version","lngLatToCoord","l1","l2","Math","sqrt","pow","w","h","calCityGeo","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;;;;IAgBqBC,c;;;;;;;;;;;;;;;;;;;;;;;;;WAInB,wBAAsB;AACpB,iBAYI,KAAKC,KAAL,CAAWC,cAAX,EAZJ;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;AAAA,4BAMEC,KANF;AAAA,UAMEA,KANF,2BAMU;AACNC,QAAAA,MAAM,EAAE,KADF;AAENC,QAAAA,WAAW,EAAE,CAFP;AAGNC,QAAAA,UAAU,EAAE,oBAHN;AAINC,QAAAA,UAAU,EAAE;AAJN,O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AINN,YAAAA,IAAI,EAAE3D,EAAE,CAACkE;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;;;;EA9IyCrE,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 sweep: {\n enable: boolean;\n sweepRadius: number;\n sweepColor: string;\n sweepSpeed: number;\n };\n}\nexport default class CityBuildModel extends BaseModel {\n private cityCenter: [number, number];\n private cityMinSize: number;\n\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 sweep = {\n enable: false,\n sweepRadius: 1,\n sweepColor: 'rgb(255, 255, 255)',\n sweepSpeed: 0.4,\n },\n } = this.layer.getLayerConfig() as ICityBuildLayerStyleOptions;\n return {\n u_cityCenter: this.cityCenter,\n u_cityMinSize: this.cityMinSize * sweep.sweepRadius,\n u_circleSweep: sweep.enable ? 1.0 : 0.0,\n u_circleSweepColor: rgb2arr(sweep.sweepColor).slice(0, 3),\n u_circleSweepSpeed: sweep.sweepSpeed,\n\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 calCityGeo() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n if (this.mapService.version === 'GAODE2.x') {\n // @ts-ignore\n this.cityCenter = this.mapService.lngLatToCoord([\n (maxLng + minLng) / 2,\n (maxLat + minLat) / 2,\n ]);\n // @ts-ignore\n const l1 = this.mapService.lngLatToCoord([maxLng, maxLat]);\n // @ts-ignore\n const l2 = this.mapService.lngLatToCoord([minLng, minLat]);\n this.cityMinSize =\n Math.sqrt(Math.pow(l1[0] - l2[0], 2) + Math.pow(l1[1] - l2[1], 2)) / 4;\n } else {\n const w = maxLng - minLng;\n const h = maxLat - minLat;\n this.cityCenter = [(maxLng + minLng) / 2, (maxLat + minLat) / 2];\n this.cityMinSize = Math.sqrt(Math.pow(w, 2) + Math.pow(h, 2)) / 4;\n }\n }\n\n public initModels(): IModel[] {\n this.calCityGeo();\n\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"}
|
|
1
|
+
{"version":3,"sources":["../../../src/citybuliding/models/build.ts"],"names":["AttributeType","gl","rgb2arr","BaseModel","PolygonExtrudeTriangulation","CityBuildModel","layer","getLayerConfig","opacity","baseColor","brightColor","windowColor","time","sweep","enable","sweepRadius","sweepColor","sweepSpeed","sweepCenter","cityCenter","u_cityCenter","u_cityMinSize","cityMinSize","u_circleSweep","u_circleSweepColor","slice","u_circleSweepSpeed","u_opacity","u_baseColor","u_brightColor","u_windowColor","u_time","getLayerAnimateTime","getSource","extent","minLng","minLat","maxLng","maxLat","mapService","version","lngLatToCoord","l1","l2","Math","sqrt","pow","w","h","calCityGeo","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;;;;IAiBqBC,c;;;;;;;;;;;;;;;;;;;;;;;;;WAInB,wBAAsB;AACpB,iBAaI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C,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,EAAE7D,aAAa,CAAC8D,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,MADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEhE,EAAE,CAAC2E,YAFJ;AAGNT,YAAAA,IAAI,EAAE,EAHA;AAINN,YAAAA,IAAI,EAAE5D,EAAE,CAACmE;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;;;;EA/IyCtE,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 sweep: {\n enable: boolean;\n sweepRadius: number;\n sweepColor: string;\n sweepSpeed: number;\n sweepCenter?: [number, number];\n };\n}\nexport default class CityBuildModel extends BaseModel {\n private cityCenter: [number, number];\n private cityMinSize: number;\n\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 sweep = {\n enable: false,\n sweepRadius: 1,\n sweepColor: 'rgb(255, 255, 255)',\n sweepSpeed: 0.4,\n sweepCenter: this.cityCenter,\n },\n } = this.layer.getLayerConfig() as ICityBuildLayerStyleOptions;\n return {\n u_cityCenter: sweep.sweepCenter || this.cityCenter,\n u_cityMinSize: this.cityMinSize * sweep.sweepRadius,\n u_circleSweep: sweep.enable ? 1.0 : 0.0,\n u_circleSweepColor: rgb2arr(sweep.sweepColor).slice(0, 3),\n u_circleSweepSpeed: sweep.sweepSpeed,\n\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 calCityGeo() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n if (this.mapService.version === 'GAODE2.x') {\n // @ts-ignore\n this.cityCenter = this.mapService.lngLatToCoord([\n (maxLng + minLng) / 2,\n (maxLat + minLat) / 2,\n ]);\n // @ts-ignore\n const l1 = this.mapService.lngLatToCoord([maxLng, maxLat]);\n // @ts-ignore\n const l2 = this.mapService.lngLatToCoord([minLng, minLat]);\n this.cityMinSize =\n Math.sqrt(Math.pow(l1[0] - l2[0], 2) + Math.pow(l1[1] - l2[1], 2)) / 4;\n } else {\n const w = maxLng - minLng;\n const h = maxLat - minLat;\n this.cityCenter = [(maxLng + minLng) / 2, (maxLat + minLat) / 2];\n this.cityMinSize = Math.sqrt(Math.pow(w, 2) + Math.pow(h, 2)) / 4;\n }\n }\n\n public initModels(): IModel[] {\n this.calCityGeo();\n\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/interface.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface ILineLayerStyleOptions {
|
|
|
11
11
|
forward?: boolean;
|
|
12
12
|
lineTexture?: boolean;
|
|
13
13
|
iconStep?: number;
|
|
14
|
+
iconStepCount?: number;
|
|
14
15
|
textureBlend?: string;
|
|
15
16
|
sourceColor?: string;
|
|
16
17
|
targetColor?: string;
|
|
@@ -19,4 +20,5 @@ export interface ILineLayerStyleOptions {
|
|
|
19
20
|
vertexHeightScale?: number;
|
|
20
21
|
borderWidth?: number;
|
|
21
22
|
borderColor?: string;
|
|
23
|
+
heightfixed?: boolean;
|
|
22
24
|
}
|
package/es/core/interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType"],"mappings":"AACA,WAAYA,aAAZ;;WAAYA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a","sourcesContent":["import { styleSingle } from '../core/BaseModel';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\nexport interface ILineLayerStyleOptions {\n opacity: styleSingle;\n lineType?: keyof typeof lineStyleType; // 可选参数、线类型(all - dash/solid)\n dashArray?: [number, number]; // 可选参数、虚线间隔\n segmentNumber?: number;\n\n forward?: boolean; // 可选参数、是否反向(arcLine)\n lineTexture?: boolean; // 可选参数、是否开启纹理贴图功能(all)\n iconStep?: number; // 可选参数、纹理贴图步长(all)\n textureBlend?: string; // 可选参数、供给纹理贴图使用(all)\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n thetaOffset?: number; // 可选参数、设置弧线的偏移量\n\n globalArcHeight?: number; // 可选参数、地球模式下 3D 弧线的高度\n vertexHeightScale?: number; // 可选参数、lineLayer vertex height scale\n\n borderWidth?: number; // 可选参数 线边框宽度\n borderColor?: string; // 可选参数 线边框颜色\n}\n"],"file":"interface.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType"],"mappings":"AACA,WAAYA,aAAZ;;WAAYA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a","sourcesContent":["import { styleSingle } from '../core/BaseModel';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\nexport interface ILineLayerStyleOptions {\n opacity: styleSingle;\n lineType?: keyof typeof lineStyleType; // 可选参数、线类型(all - dash/solid)\n dashArray?: [number, number]; // 可选参数、虚线间隔\n segmentNumber?: number;\n\n forward?: boolean; // 可选参数、是否反向(arcLine)\n lineTexture?: boolean; // 可选参数、是否开启纹理贴图功能(all)\n iconStep?: number; // 可选参数、纹理贴图步长(all)\n iconStepCount?: number; // 可选参数、纹理贴图间隔\n textureBlend?: string; // 可选参数、供给纹理贴图使用(all)\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n thetaOffset?: number; // 可选参数、设置弧线的偏移量\n\n globalArcHeight?: number; // 可选参数、地球模式下 3D 弧线的高度\n vertexHeightScale?: number; // 可选参数、lineLayer vertex height scale\n\n borderWidth?: number; // 可选参数 线边框宽度\n borderColor?: string; // 可选参数 线边框颜色\n\n heightfixed?: boolean; // 可选参数 高度是否固定\n}\n"],"file":"interface.js"}
|
package/es/line/index.d.ts
CHANGED
package/es/line/index.js
CHANGED
package/es/line/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/line/index.ts"],"names":["BaseLayer","LineModels","LineLayer","shape","getModelType","layerModel","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","line","arc3d","blend","arc","arcmini","greatcircle","shapeAttribute","styleAttributeService","getLayerStyleAttribute","scale","field"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,mBAAtB;AAEA,OAAOC,UAAP,MAA0C,UAA1C;;IAEqBC,S;;;;;;;;;;;;;;;;2DACG,W;;;;;;;WAEtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIJ,UAAU,CAACE,KAAD,CAAd,CAAsB,IAAtB,CAAlB;AACA,WAAKG,MAAL,GAAc,KAAKD,UAAL,CAAgBE,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKD,UAAL,CAAgBG,WAAhB,EAAd;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKP,YAAL,EAAb;AACA,UAAMU,aAAa,GAAG;AACpBC,QAAAA,IAAI,EAAE,EADc;AAEpBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,
|
|
1
|
+
{"version":3,"sources":["../../src/line/index.ts"],"names":["BaseLayer","LineModels","LineLayer","shape","getModelType","layerModel","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","line","wall","arc3d","blend","arc","arcmini","greatcircle","shapeAttribute","styleAttributeService","getLayerStyleAttribute","scale","field"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,mBAAtB;AAEA,OAAOC,UAAP,MAA0C,UAA1C;;IAEqBC,S;;;;;;;;;;;;;;;;2DACG,W;;;;;;;WAEtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIJ,UAAU,CAACE,KAAD,CAAd,CAAsB,IAAtB,CAAlB;AACA,WAAKG,MAAL,GAAc,KAAKD,UAAL,CAAgBE,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKD,UAAL,CAAgBG,WAAhB,EAAd;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKP,YAAL,EAAb;AACA,UAAMU,aAAa,GAAG;AACpBC,QAAAA,IAAI,EAAE,EADc;AAEpBC,QAAAA,IAAI,EAAE,EAFc;AAGpBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,SAHa;AAIpBC,QAAAA,GAAG,EAAE;AAAED,UAAAA,KAAK,EAAE;AAAT,SAJe;AAKpBE,QAAAA,OAAO,EAAE;AAAEF,UAAAA,KAAK,EAAE;AAAT,SALW;AAMpBG,QAAAA,WAAW,EAAE;AAAEH,UAAAA,KAAK,EAAE;AAAT;AANO,OAAtB;AAQA,aAAOJ,aAAa,CAACH,IAAD,CAApB;AACD;;;WACD,wBAAwC;AAAA;;AACtC,UAAMW,cAAc,GAAG,KAAKC,qBAAL,CAA2BC,sBAA3B,CACrB,OADqB,CAAvB;AAGA,UAAMrB,KAAK,GAAGmB,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEG,KAAnB,0DAAG,sBAAuBC,KAArC;AACA,aAAOvB,KAAK,IAAI,MAAhB;AACD;;;;EAzCoCH,S;;SAAlBE,S","sourcesContent":["import BaseLayer from '../core/BaseLayer';\nimport { ILineLayerStyleOptions } from '../core/interface';\nimport LineModels, { LineModelType } from './models';\n\nexport default class LineLayer extends BaseLayer<ILineLayerStyleOptions> {\n public type: string = 'LineLayer';\n\n public buildModels() {\n const shape = this.getModelType();\n this.layerModel = new LineModels[shape](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n protected getDefaultConfig() {\n const type = this.getModelType();\n const defaultConfig = {\n line: {},\n wall: {},\n arc3d: { blend: 'additive' },\n arc: { blend: 'additive' },\n arcmini: { blend: 'additive' },\n greatcircle: { blend: 'additive' },\n };\n return defaultConfig[type];\n }\n protected getModelType(): LineModelType {\n const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute(\n 'shape',\n );\n const shape = shapeAttribute?.scale?.field as LineModelType;\n return shape || 'line';\n }\n}\n"],"file":"index.js"}
|
package/es/line/models/index.js
CHANGED
|
@@ -3,11 +3,13 @@ import Arc3DModel from './arc_3d';
|
|
|
3
3
|
import ArcMiniModel from './arcmini';
|
|
4
4
|
import GreatCircleModel from './great_circle';
|
|
5
5
|
import LineModel from './line';
|
|
6
|
+
import LineWallModel from './wall';
|
|
6
7
|
var LineModels = {
|
|
7
8
|
arc: ArcModel,
|
|
8
9
|
arcmini: ArcMiniModel,
|
|
9
10
|
arc3d: Arc3DModel,
|
|
10
11
|
greatcircle: GreatCircleModel,
|
|
12
|
+
wall: LineWallModel,
|
|
11
13
|
line: LineModel
|
|
12
14
|
};
|
|
13
15
|
export default LineModels;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/index.ts"],"names":["ArcModel","Arc3DModel","ArcMiniModel","GreatCircleModel","LineModel","LineModels","arc","arcmini","arc3d","greatcircle","line"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,SAAP,MAAsB,QAAtB;
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/index.ts"],"names":["ArcModel","Arc3DModel","ArcMiniModel","GreatCircleModel","LineModel","LineWallModel","LineModels","arc","arcmini","arc3d","greatcircle","wall","line"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,aAAP,MAA0B,QAA1B;AAUA,IAAMC,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEP,QAD6C;AAElDQ,EAAAA,OAAO,EAAEN,YAFyC;AAGlDO,EAAAA,KAAK,EAAER,UAH2C;AAIlDS,EAAAA,WAAW,EAAEP,gBAJqC;AAKlDQ,EAAAA,IAAI,EAAEN,aAL4C;AAMlDO,EAAAA,IAAI,EAAER;AAN4C,CAApD;AASA,eAAeE,UAAf","sourcesContent":["import ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport GreatCircleModel from './great_circle';\nimport LineModel from './line';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'line';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
|
|
2
|
+
import BaseModel from '../../core/BaseModel';
|
|
3
|
+
export default class LineWallModel extends BaseModel {
|
|
4
|
+
protected texture: ITexture2D;
|
|
5
|
+
getUninforms(): IModelUniform;
|
|
6
|
+
getAnimateUniforms(): IModelUniform;
|
|
7
|
+
initModels(): IModel[];
|
|
8
|
+
clearModels(): void;
|
|
9
|
+
buildModels(): IModel[];
|
|
10
|
+
protected registerBuiltinAttributes(): void;
|
|
11
|
+
private updateTexture;
|
|
12
|
+
}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
+
import _isNumber from "lodash/isNumber";
|
|
9
|
+
|
|
10
|
+
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); }; }
|
|
11
|
+
|
|
12
|
+
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; } }
|
|
13
|
+
|
|
14
|
+
import { AttributeType, gl } from '@antv/l7-core';
|
|
15
|
+
import { rgb2arr } from '@antv/l7-utils';
|
|
16
|
+
import BaseModel from '../../core/BaseModel';
|
|
17
|
+
import { LineTriangulation } from '../../core/triangulation';
|
|
18
|
+
var line_frag = "#define LineTypeSolid 0.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\n\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\n// dash\nuniform float u_dash_offset : 0.0;\nuniform float u_dash_ratio : 0.1;\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = styleMappingMat[3].a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\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) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\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 \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n\n \n \n \n}\n";
|
|
19
|
+
var line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying float v_blur;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\n\nuniform float u_linearColor: 0;\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 \"light\"\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 float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_aimate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_pixel(2.0) / originSize, 0.05);\n\n // v_lightWeight = lightWeight;\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n // v_color = a_Color;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
20
|
+
|
|
21
|
+
var LineWallModel = function (_BaseModel) {
|
|
22
|
+
_inherits(LineWallModel, _BaseModel);
|
|
23
|
+
|
|
24
|
+
var _super = _createSuper(LineWallModel);
|
|
25
|
+
|
|
26
|
+
function LineWallModel() {
|
|
27
|
+
var _this;
|
|
28
|
+
|
|
29
|
+
_classCallCheck(this, LineWallModel);
|
|
30
|
+
|
|
31
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
|
+
args[_key] = arguments[_key];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
36
|
+
|
|
37
|
+
_defineProperty(_assertThisInitialized(_this), "texture", void 0);
|
|
38
|
+
|
|
39
|
+
_defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
|
|
40
|
+
var createTexture2D = _this.rendererService.createTexture2D;
|
|
41
|
+
|
|
42
|
+
if (_this.texture) {
|
|
43
|
+
_this.texture.update({
|
|
44
|
+
data: _this.iconService.getCanvas()
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
_this.layer.render();
|
|
48
|
+
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_this.texture = createTexture2D({
|
|
53
|
+
data: _this.iconService.getCanvas(),
|
|
54
|
+
mag: gl.NEAREST,
|
|
55
|
+
min: gl.NEAREST,
|
|
56
|
+
premultiplyAlpha: false,
|
|
57
|
+
width: 1024,
|
|
58
|
+
height: _this.iconService.canvasHeight || 128
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_createClass(LineWallModel, [{
|
|
66
|
+
key: "getUninforms",
|
|
67
|
+
value: function getUninforms() {
|
|
68
|
+
var _ref = this.layer.getLayerConfig(),
|
|
69
|
+
opacity = _ref.opacity,
|
|
70
|
+
sourceColor = _ref.sourceColor,
|
|
71
|
+
targetColor = _ref.targetColor,
|
|
72
|
+
_ref$textureBlend = _ref.textureBlend,
|
|
73
|
+
textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
|
|
74
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
75
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
76
|
+
_ref$lineTexture = _ref.lineTexture,
|
|
77
|
+
lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
|
|
78
|
+
_ref$iconStep = _ref.iconStep,
|
|
79
|
+
iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
|
|
80
|
+
_ref$iconStepCount = _ref.iconStepCount,
|
|
81
|
+
iconStepCount = _ref$iconStepCount === void 0 ? 1 : _ref$iconStepCount;
|
|
82
|
+
|
|
83
|
+
if (this.rendererService.getDirty()) {
|
|
84
|
+
this.texture.bind();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var useLinearColor = 0;
|
|
88
|
+
var sourceColorArr = [0, 0, 0, 0];
|
|
89
|
+
var targetColorArr = [0, 0, 0, 0];
|
|
90
|
+
|
|
91
|
+
if (sourceColor && targetColor) {
|
|
92
|
+
sourceColorArr = rgb2arr(sourceColor);
|
|
93
|
+
targetColorArr = rgb2arr(targetColor);
|
|
94
|
+
useLinearColor = 1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
98
|
+
opacity: opacity
|
|
99
|
+
})) {
|
|
100
|
+
this.judgeStyleAttributes({
|
|
101
|
+
opacity: opacity
|
|
102
|
+
});
|
|
103
|
+
var encodeData = this.layer.getEncodedData();
|
|
104
|
+
|
|
105
|
+
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
106
|
+
data = _this$calDataFrame.data,
|
|
107
|
+
width = _this$calDataFrame.width,
|
|
108
|
+
height = _this$calDataFrame.height;
|
|
109
|
+
|
|
110
|
+
this.rowCount = height;
|
|
111
|
+
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
112
|
+
flipY: true,
|
|
113
|
+
data: data,
|
|
114
|
+
format: gl.LUMINANCE,
|
|
115
|
+
type: gl.FLOAT,
|
|
116
|
+
width: width,
|
|
117
|
+
height: height
|
|
118
|
+
}) : this.createTexture2D({
|
|
119
|
+
flipY: true,
|
|
120
|
+
data: [1],
|
|
121
|
+
format: gl.LUMINANCE,
|
|
122
|
+
type: gl.FLOAT,
|
|
123
|
+
width: 1,
|
|
124
|
+
height: 1
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
u_heightfixed: Number(heightfixed),
|
|
130
|
+
u_dataTexture: this.dataTexture,
|
|
131
|
+
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
132
|
+
u_opacity: _isNumber(opacity) ? opacity : 1.0,
|
|
133
|
+
u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
|
|
134
|
+
u_texture: this.texture,
|
|
135
|
+
u_line_texture: lineTexture ? 1.0 : 0.0,
|
|
136
|
+
u_iconStepCount: iconStepCount,
|
|
137
|
+
u_icon_step: iconStep,
|
|
138
|
+
u_textSize: [1024, this.iconService.canvasHeight || 128],
|
|
139
|
+
u_linearColor: useLinearColor,
|
|
140
|
+
u_sourceColor: sourceColorArr,
|
|
141
|
+
u_targetColor: targetColorArr
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}, {
|
|
145
|
+
key: "getAnimateUniforms",
|
|
146
|
+
value: function getAnimateUniforms() {
|
|
147
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
148
|
+
animateOption = _ref2.animateOption;
|
|
149
|
+
|
|
150
|
+
return {
|
|
151
|
+
u_aimate: this.animateOption2Array(animateOption),
|
|
152
|
+
u_time: this.layer.getLayerAnimateTime()
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "initModels",
|
|
157
|
+
value: function initModels() {
|
|
158
|
+
this.updateTexture();
|
|
159
|
+
this.iconService.on('imageUpdate', this.updateTexture);
|
|
160
|
+
return this.buildModels();
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "clearModels",
|
|
164
|
+
value: function clearModels() {
|
|
165
|
+
var _this$texture, _this$dataTexture;
|
|
166
|
+
|
|
167
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
168
|
+
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
169
|
+
this.iconService.off('imageUpdate', this.updateTexture);
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
key: "buildModels",
|
|
173
|
+
value: function buildModels() {
|
|
174
|
+
return [this.layer.buildLayerModel({
|
|
175
|
+
moduleName: 'linewall',
|
|
176
|
+
vertexShader: line_vert,
|
|
177
|
+
fragmentShader: line_frag,
|
|
178
|
+
triangulation: LineTriangulation,
|
|
179
|
+
primitive: gl.TRIANGLES,
|
|
180
|
+
blend: this.getBlend(),
|
|
181
|
+
depth: {
|
|
182
|
+
enable: false
|
|
183
|
+
}
|
|
184
|
+
})];
|
|
185
|
+
}
|
|
186
|
+
}, {
|
|
187
|
+
key: "registerBuiltinAttributes",
|
|
188
|
+
value: function registerBuiltinAttributes() {
|
|
189
|
+
var _this2 = this;
|
|
190
|
+
|
|
191
|
+
var _ref3 = this.layer.getLayerConfig(),
|
|
192
|
+
_ref3$lineType = _ref3.lineType,
|
|
193
|
+
lineType = _ref3$lineType === void 0 ? 'solid' : _ref3$lineType;
|
|
194
|
+
|
|
195
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
196
|
+
name: 'distance',
|
|
197
|
+
type: AttributeType.Attribute,
|
|
198
|
+
descriptor: {
|
|
199
|
+
name: 'a_Distance',
|
|
200
|
+
buffer: {
|
|
201
|
+
usage: gl.STATIC_DRAW,
|
|
202
|
+
data: [],
|
|
203
|
+
type: gl.FLOAT
|
|
204
|
+
},
|
|
205
|
+
size: 1,
|
|
206
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
207
|
+
return [vertex[3]];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
212
|
+
name: 'total_distance',
|
|
213
|
+
type: AttributeType.Attribute,
|
|
214
|
+
descriptor: {
|
|
215
|
+
name: 'a_Total_Distance',
|
|
216
|
+
buffer: {
|
|
217
|
+
usage: gl.STATIC_DRAW,
|
|
218
|
+
data: [],
|
|
219
|
+
type: gl.FLOAT
|
|
220
|
+
},
|
|
221
|
+
size: 1,
|
|
222
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
223
|
+
return [vertex[5]];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
228
|
+
name: 'size',
|
|
229
|
+
type: AttributeType.Attribute,
|
|
230
|
+
descriptor: {
|
|
231
|
+
name: 'a_Size',
|
|
232
|
+
buffer: {
|
|
233
|
+
usage: gl.DYNAMIC_DRAW,
|
|
234
|
+
data: [],
|
|
235
|
+
type: gl.FLOAT
|
|
236
|
+
},
|
|
237
|
+
size: 2,
|
|
238
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
239
|
+
var _feature$size = feature.size,
|
|
240
|
+
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
241
|
+
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
246
|
+
name: 'normal',
|
|
247
|
+
type: AttributeType.Attribute,
|
|
248
|
+
descriptor: {
|
|
249
|
+
name: 'a_Normal',
|
|
250
|
+
buffer: {
|
|
251
|
+
usage: gl.STATIC_DRAW,
|
|
252
|
+
data: [],
|
|
253
|
+
type: gl.FLOAT
|
|
254
|
+
},
|
|
255
|
+
size: 3,
|
|
256
|
+
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
257
|
+
return normal;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
262
|
+
name: 'miter',
|
|
263
|
+
type: AttributeType.Attribute,
|
|
264
|
+
descriptor: {
|
|
265
|
+
name: 'a_Miter',
|
|
266
|
+
buffer: {
|
|
267
|
+
usage: gl.STATIC_DRAW,
|
|
268
|
+
data: [],
|
|
269
|
+
type: gl.FLOAT
|
|
270
|
+
},
|
|
271
|
+
size: 1,
|
|
272
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
273
|
+
return [vertex[4]];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
278
|
+
name: 'uv',
|
|
279
|
+
type: AttributeType.Attribute,
|
|
280
|
+
descriptor: {
|
|
281
|
+
name: 'a_iconMapUV',
|
|
282
|
+
buffer: {
|
|
283
|
+
usage: gl.DYNAMIC_DRAW,
|
|
284
|
+
data: [],
|
|
285
|
+
type: gl.FLOAT
|
|
286
|
+
},
|
|
287
|
+
size: 2,
|
|
288
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
289
|
+
var iconMap = _this2.iconService.getIconMap();
|
|
290
|
+
|
|
291
|
+
var texture = feature.texture;
|
|
292
|
+
|
|
293
|
+
var _ref4 = iconMap[texture] || {
|
|
294
|
+
x: 0,
|
|
295
|
+
y: 0
|
|
296
|
+
},
|
|
297
|
+
x = _ref4.x,
|
|
298
|
+
y = _ref4.y;
|
|
299
|
+
|
|
300
|
+
return [x, y];
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}]);
|
|
306
|
+
|
|
307
|
+
return LineWallModel;
|
|
308
|
+
}(BaseModel);
|
|
309
|
+
|
|
310
|
+
export { LineWallModel as default };
|
|
311
|
+
//# sourceMappingURL=wall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/wall.ts"],"names":["AttributeType","gl","rgb2arr","BaseModel","LineTriangulation","LineWallModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","heightfixed","lineTexture","iconStep","iconStepCount","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_heightfixed","Number","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_texture","u_line_texture","u_iconStepCount","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","buildLayerModel","moduleName","vertexShader","line_vert","fragmentShader","line_frag","triangulation","primitive","TRIANGLES","blend","getBlend","depth","enable","lineType","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray","normal","iconMap","getIconMap","x","y"],"mappings":";;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAYA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,iBAAT,QAAkC,0BAAlC;;;;IAIqBC,a;;;;;;;;;;;;;;;;;;oEAwQK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAoB;AAClBC,UAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB;AADY,SAApB;;AAGA,cAAKC,KAAL,CAAWC,MAAX;;AACA;AACD;;AACD,YAAKN,OAAL,GAAeF,eAAe,CAAC;AAC7BI,QAAAA,IAAI,EAAE,MAAKC,WAAL,CAAiBC,SAAjB,EADuB;AAE7BG,QAAAA,GAAG,EAAEd,EAAE,CAACe,OAFqB;AAG7BC,QAAAA,GAAG,EAAEhB,EAAE,CAACe,OAHqB;AAI7BE,QAAAA,gBAAgB,EAAE,KAJW;AAK7BC,QAAAA,KAAK,EAAE,IALsB;AAM7BC,QAAAA,MAAM,EAAE,MAAKT,WAAL,CAAiBU,YAAjB,IAAiC;AANZ,OAAD,CAA9B;AAQD,K;;;;;;;WAvRD,wBAAqC;AACnC,iBASI,KAAKR,KAAL,CAAWS,cAAX,EATJ;AAAA,UACEC,OADF,QACEA,OADF;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,mCAIEC,YAJF;AAAA,UAIEA,YAJF,kCAIiB,QAJjB;AAAA,kCAKEC,WALF;AAAA,UAKEA,WALF,iCAKgB,KALhB;AAAA,kCAMEC,WANF;AAAA,UAMEA,WANF,iCAMgB,KANhB;AAAA,+BAOEC,QAPF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;AAQVgD,UAAAA,IAAI,EAAE,CARI;AASV1F,UAAAA,MAAM,EAAE,gBACN2F,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAuBA,WAAKX,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,IAD0C;AAEhD3C,QAAAA,IAAI,EAAElD,aAAa,CAAC8F,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,aADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEhG,EAAE,CAACuG,YAFJ;AAGN9F,YAAAA,IAAI,EAAE,EAHA;AAINwC,YAAAA,IAAI,EAAEjD,EAAE,CAACkD;AAJH,WAFE;AAQVgD,UAAAA,IAAI,EAAE,CARI;AASV1F,UAAAA,MAAM,EAAE,gBACN2F,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMK,OAAO,GAAG,MAAI,CAACjG,WAAL,CAAiBkG,UAAjB,EAAhB;;AACA,gBAAQrG,OAAR,GAAoB4F,OAApB,CAAQ5F,OAAR;;AACA,wBAAiBoG,OAAO,CAACpG,OAAD,CAAP,IAA8B;AAAEsG,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EAvQwC5G,S;;SAAtBE,a","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n IImage,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions, lineStyleType } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_frag from '../shaders/wall_frag.glsl';\nimport line_vert from '../shaders/wall_vert.glsl';\n\nexport default class LineWallModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n heightfixed = false,\n lineTexture = false,\n iconStep = 100,\n iconStepCount = 1,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_heightfixed: Number(heightfixed),\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n // u_opacity: opacity === undefined ? 1 : opacity,\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_iconStepCount: iconStepCount,\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n return [\n this.layer.buildLayerModel({\n moduleName: 'linewall',\n vertexShader: line_vert,\n fragmentShader: line_frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: false },\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n // const lineType = this\n // point layer size;\n const {\n lineType = 'solid',\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n // if (lineType === 'dash') {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\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: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\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 // @ts-ignore\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: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\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 iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"wall.js"}
|
|
@@ -77,11 +77,12 @@ var CityBuildModel = function (_BaseModel) {
|
|
|
77
77
|
enable: false,
|
|
78
78
|
sweepRadius: 1,
|
|
79
79
|
sweepColor: 'rgb(255, 255, 255)',
|
|
80
|
-
sweepSpeed: 0.4
|
|
80
|
+
sweepSpeed: 0.4,
|
|
81
|
+
sweepCenter: this.cityCenter
|
|
81
82
|
} : _ref$sweep;
|
|
82
83
|
|
|
83
84
|
return {
|
|
84
|
-
u_cityCenter: this.cityCenter,
|
|
85
|
+
u_cityCenter: sweep.sweepCenter || this.cityCenter,
|
|
85
86
|
u_cityMinSize: this.cityMinSize * sweep.sweepRadius,
|
|
86
87
|
u_circleSweep: sweep.enable ? 1.0 : 0.0,
|
|
87
88
|
u_circleSweepColor: (0, _l7Utils.rgb2arr)(sweep.sweepColor).slice(0, 3),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/citybuliding/models/build.ts"],"names":["CityBuildModel","layer","getLayerConfig","opacity","baseColor","brightColor","windowColor","time","sweep","enable","sweepRadius","sweepColor","sweepSpeed","
|
|
1
|
+
{"version":3,"sources":["../../../src/citybuliding/models/build.ts"],"names":["CityBuildModel","layer","getLayerConfig","opacity","baseColor","brightColor","windowColor","time","sweep","enable","sweepRadius","sweepColor","sweepSpeed","sweepCenter","cityCenter","u_cityCenter","u_cityMinSize","cityMinSize","u_circleSweep","u_circleSweepColor","slice","u_circleSweepSpeed","u_opacity","u_baseColor","u_brightColor","u_windowColor","u_time","getLayerAnimateTime","getSource","extent","minLng","minLat","maxLng","maxLat","mapService","version","lngLatToCoord","l1","l2","Math","sqrt","pow","w","h","calCityGeo","startModelAnimate","buildLayerModel","moduleName","vertexShader","buildVert","fragmentShader","buildFrag","triangulation","PolygonExtrudeTriangulation","styleAttributeService","registerStyleAttribute","name","type","AttributeType","Attribute","descriptor","buffer","usage","gl","STATIC_DRAW","data","FLOAT","size","update","feature","featureIdx","vertex","attributeIdx","normal","DYNAMIC_DRAW","Array","isArray","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;IAiBqBA,c;;;;;;;;;;;;;;;;;;;;;;WAInB,wBAAsB;AACpB,iBAaI,KAAKC,KAAL,CAAWC,cAAX,EAbJ;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;AAAA,4BAMEC,KANF;AAAA,UAMEA,KANF,2BAMU;AACNC,QAAAA,MAAM,EAAE,KADF;AAENC,QAAAA,WAAW,EAAE,CAFP;AAGNC,QAAAA,UAAU,EAAE,oBAHN;AAINC,QAAAA,UAAU,EAAE,GAJN;AAKNC,QAAAA,WAAW,EAAE,KAAKC;AALZ,OANV;;AAcA,aAAO;AACLC,QAAAA,YAAY,EAAEP,KAAK,CAACK,WAAN,IAAqB,KAAKC,UADnC;AAELE,QAAAA,aAAa,EAAE,KAAKC,WAAL,GAAmBT,KAAK,CAACE,WAFnC;AAGLQ,QAAAA,aAAa,EAAEV,KAAK,CAACC,MAAN,GAAe,GAAf,GAAqB,GAH/B;AAILU,QAAAA,kBAAkB,EAAE,sB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;AAuBD;;;EA/IyCM,mB","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 sweep: {\n enable: boolean;\n sweepRadius: number;\n sweepColor: string;\n sweepSpeed: number;\n sweepCenter?: [number, number];\n };\n}\nexport default class CityBuildModel extends BaseModel {\n private cityCenter: [number, number];\n private cityMinSize: number;\n\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 sweep = {\n enable: false,\n sweepRadius: 1,\n sweepColor: 'rgb(255, 255, 255)',\n sweepSpeed: 0.4,\n sweepCenter: this.cityCenter,\n },\n } = this.layer.getLayerConfig() as ICityBuildLayerStyleOptions;\n return {\n u_cityCenter: sweep.sweepCenter || this.cityCenter,\n u_cityMinSize: this.cityMinSize * sweep.sweepRadius,\n u_circleSweep: sweep.enable ? 1.0 : 0.0,\n u_circleSweepColor: rgb2arr(sweep.sweepColor).slice(0, 3),\n u_circleSweepSpeed: sweep.sweepSpeed,\n\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 calCityGeo() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n if (this.mapService.version === 'GAODE2.x') {\n // @ts-ignore\n this.cityCenter = this.mapService.lngLatToCoord([\n (maxLng + minLng) / 2,\n (maxLat + minLat) / 2,\n ]);\n // @ts-ignore\n const l1 = this.mapService.lngLatToCoord([maxLng, maxLat]);\n // @ts-ignore\n const l2 = this.mapService.lngLatToCoord([minLng, minLat]);\n this.cityMinSize =\n Math.sqrt(Math.pow(l1[0] - l2[0], 2) + Math.pow(l1[1] - l2[1], 2)) / 4;\n } else {\n const w = maxLng - minLng;\n const h = maxLat - minLat;\n this.cityCenter = [(maxLng + minLng) / 2, (maxLat + minLat) / 2];\n this.cityMinSize = Math.sqrt(Math.pow(w, 2) + Math.pow(h, 2)) / 4;\n }\n }\n\n public initModels(): IModel[] {\n this.calCityGeo();\n\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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType"],"mappings":";;;;;;IACYA,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["import { styleSingle } from '../core/BaseModel';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\nexport interface ILineLayerStyleOptions {\n opacity: styleSingle;\n lineType?: keyof typeof lineStyleType; // 可选参数、线类型(all - dash/solid)\n dashArray?: [number, number]; // 可选参数、虚线间隔\n segmentNumber?: number;\n\n forward?: boolean; // 可选参数、是否反向(arcLine)\n lineTexture?: boolean; // 可选参数、是否开启纹理贴图功能(all)\n iconStep?: number; // 可选参数、纹理贴图步长(all)\n textureBlend?: string; // 可选参数、供给纹理贴图使用(all)\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n thetaOffset?: number; // 可选参数、设置弧线的偏移量\n\n globalArcHeight?: number; // 可选参数、地球模式下 3D 弧线的高度\n vertexHeightScale?: number; // 可选参数、lineLayer vertex height scale\n\n borderWidth?: number; // 可选参数 线边框宽度\n borderColor?: string; // 可选参数 线边框颜色\n}\n"],"file":"interface.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType"],"mappings":";;;;;;IACYA,a;;;WAAAA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,6BAAAA,a","sourcesContent":["import { styleSingle } from '../core/BaseModel';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\nexport interface ILineLayerStyleOptions {\n opacity: styleSingle;\n lineType?: keyof typeof lineStyleType; // 可选参数、线类型(all - dash/solid)\n dashArray?: [number, number]; // 可选参数、虚线间隔\n segmentNumber?: number;\n\n forward?: boolean; // 可选参数、是否反向(arcLine)\n lineTexture?: boolean; // 可选参数、是否开启纹理贴图功能(all)\n iconStep?: number; // 可选参数、纹理贴图步长(all)\n iconStepCount?: number; // 可选参数、纹理贴图间隔\n textureBlend?: string; // 可选参数、供给纹理贴图使用(all)\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n thetaOffset?: number; // 可选参数、设置弧线的偏移量\n\n globalArcHeight?: number; // 可选参数、地球模式下 3D 弧线的高度\n vertexHeightScale?: number; // 可选参数、lineLayer vertex height scale\n\n borderWidth?: number; // 可选参数 线边框宽度\n borderColor?: string; // 可选参数 线边框颜色\n\n heightfixed?: boolean; // 可选参数 高度是否固定\n}\n"],"file":"interface.js"}
|
package/lib/line/index.js
CHANGED
package/lib/line/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/line/index.ts"],"names":["LineLayer","shape","getModelType","layerModel","LineModels","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","line","arc3d","blend","arc","arcmini","greatcircle","shapeAttribute","styleAttributeService","getLayerStyleAttribute","scale","field","BaseLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;IAEqBA,S;;;;;;;;;;;;;;;uFACG,W;;;;;;WAEtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIC,gBAAWH,KAAX,CAAJ,CAAsB,IAAtB,CAAlB;AACA,WAAKI,MAAL,GAAc,KAAKF,UAAL,CAAgBG,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKF,UAAL,CAAgBI,WAAhB,EAAd;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKR,YAAL,EAAb;AACA,UAAMW,aAAa,GAAG;AACpBC,QAAAA,IAAI,EAAE,EADc;AAEpBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,
|
|
1
|
+
{"version":3,"sources":["../../src/line/index.ts"],"names":["LineLayer","shape","getModelType","layerModel","LineModels","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","line","wall","arc3d","blend","arc","arcmini","greatcircle","shapeAttribute","styleAttributeService","getLayerStyleAttribute","scale","field","BaseLayer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;IAEqBA,S;;;;;;;;;;;;;;;uFACG,W;;;;;;WAEtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIC,gBAAWH,KAAX,CAAJ,CAAsB,IAAtB,CAAlB;AACA,WAAKI,MAAL,GAAc,KAAKF,UAAL,CAAgBG,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKF,UAAL,CAAgBI,WAAhB,EAAd;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKR,YAAL,EAAb;AACA,UAAMW,aAAa,GAAG;AACpBC,QAAAA,IAAI,EAAE,EADc;AAEpBC,QAAAA,IAAI,EAAE,EAFc;AAGpBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,SAHa;AAIpBC,QAAAA,GAAG,EAAE;AAAED,UAAAA,KAAK,EAAE;AAAT,SAJe;AAKpBE,QAAAA,OAAO,EAAE;AAAEF,UAAAA,KAAK,EAAE;AAAT,SALW;AAMpBG,QAAAA,WAAW,EAAE;AAAEH,UAAAA,KAAK,EAAE;AAAT;AANO,OAAtB;AAQA,aAAOJ,aAAa,CAACH,IAAD,CAApB;AACD;;;WACD,wBAAwC;AAAA;;AACtC,UAAMW,cAAc,GAAG,KAAKC,qBAAL,CAA2BC,sBAA3B,CACrB,OADqB,CAAvB;AAGA,UAAMtB,KAAK,GAAGoB,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEG,KAAnB,0DAAG,sBAAuBC,KAArC;AACA,aAAOxB,KAAK,IAAI,MAAhB;AACD;;;EAzCoCyB,mB","sourcesContent":["import BaseLayer from '../core/BaseLayer';\nimport { ILineLayerStyleOptions } from '../core/interface';\nimport LineModels, { LineModelType } from './models';\n\nexport default class LineLayer extends BaseLayer<ILineLayerStyleOptions> {\n public type: string = 'LineLayer';\n\n public buildModels() {\n const shape = this.getModelType();\n this.layerModel = new LineModels[shape](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n protected getDefaultConfig() {\n const type = this.getModelType();\n const defaultConfig = {\n line: {},\n wall: {},\n arc3d: { blend: 'additive' },\n arc: { blend: 'additive' },\n arcmini: { blend: 'additive' },\n greatcircle: { blend: 'additive' },\n };\n return defaultConfig[type];\n }\n protected getModelType(): LineModelType {\n const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute(\n 'shape',\n );\n const shape = shapeAttribute?.scale?.field as LineModelType;\n return shape || 'line';\n }\n}\n"],"file":"index.js"}
|
package/lib/line/models/index.js
CHANGED
|
@@ -17,11 +17,14 @@ var _great_circle = _interopRequireDefault(require("./great_circle"));
|
|
|
17
17
|
|
|
18
18
|
var _line = _interopRequireDefault(require("./line"));
|
|
19
19
|
|
|
20
|
+
var _wall = _interopRequireDefault(require("./wall"));
|
|
21
|
+
|
|
20
22
|
var LineModels = {
|
|
21
23
|
arc: _arc.default,
|
|
22
24
|
arcmini: _arcmini.default,
|
|
23
25
|
arc3d: _arc_3d.default,
|
|
24
26
|
greatcircle: _great_circle.default,
|
|
27
|
+
wall: _wall.default,
|
|
25
28
|
line: _line.default
|
|
26
29
|
};
|
|
27
30
|
var _default = LineModels;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineModels","arc","ArcModel","arcmini","ArcMiniModel","arc3d","Arc3DModel","greatcircle","GreatCircleModel","line","LineModel"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineModels","arc","ArcModel","arcmini","ArcMiniModel","arc3d","Arc3DModel","greatcircle","GreatCircleModel","wall","LineWallModel","line","LineModel"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAUA,IAAMA,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEC,YAD6C;AAElDC,EAAAA,OAAO,EAAEC,gBAFyC;AAGlDC,EAAAA,KAAK,EAAEC,eAH2C;AAIlDC,EAAAA,WAAW,EAAEC,qBAJqC;AAKlDC,EAAAA,IAAI,EAAEC,aAL4C;AAMlDC,EAAAA,IAAI,EAAEC;AAN4C,CAApD;eASeZ,U","sourcesContent":["import ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport GreatCircleModel from './great_circle';\nimport LineModel from './line';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'line';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
+
|
|
24
|
+
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
|
25
|
+
|
|
26
|
+
var _l7Core = require("@antv/l7-core");
|
|
27
|
+
|
|
28
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
29
|
+
|
|
30
|
+
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
31
|
+
|
|
32
|
+
var _triangulation = require("../../core/triangulation");
|
|
33
|
+
|
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
35
|
+
|
|
36
|
+
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; } }
|
|
37
|
+
|
|
38
|
+
var line_frag = "#define LineTypeSolid 0.0\n#define Animate 0.0\n#define LineTexture 1.0\n\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\nuniform float u_iconStepCount;\n\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\n// dash\nuniform float u_dash_offset : 0.0;\nuniform float u_dash_ratio : 0.1;\n\nvarying vec2 v_iconMapUV;\nvarying float v_blur;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ]; // \u63A7\u5236\u8FD0\u52A8\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float animateSpeed = 0.0; // \u8FD0\u52A8\u901F\u5EA6\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float v = styleMappingMat[3].a;\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, v);\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n gl_FragColor = v_color;\n }\n\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n if(u_aimate.x == Animate) {\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) + animateSpeed);\n alpha = (alpha + u_aimate.w -1.0) / u_aimate.w;\n alpha = smoothstep(0., 1., alpha);\n gl_FragColor.a *= alpha;\n }\n\n if(u_line_texture == LineTexture) { // while load texture\n float aDistance = styleMappingMat[3].g; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n float d_texPixelLen = styleMappingMat[3].b; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);\n float v = styleMappingMat[3].a; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 start\n float flag = 0.0;\n if(u > 1.0/u_iconStepCount) {\n flag = 1.0;\n }\n u = fract(u*u_iconStepCount);\n // \u8BA1\u7B97\u7EB9\u7406\u95F4\u9694 end\n\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n vec4 pattern = texture2D(u_texture, uv);\n\n // Tip: \u5224\u65AD\u7EB9\u7406\u95F4\u9694\n if(flag > 0.0) {\n pattern = vec4(0.0);\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 \n\n // blur - AA\n if(v < v_blur) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/v_blur);\n } else if(v > 1.0 - v_blur) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n\n \n \n \n}\n";
|
|
39
|
+
var line_vert = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n\nattribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute float a_Distance;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\nuniform float u_icon_step: 100;\nuniform float u_heightfixed;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying float v_blur;\n\n// texV \u7EBF\u56FE\u5C42 - \u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\uFF08\u7EBF\u7684\u5BBD\u5EA6\u65B9\u5411\uFF09\nvarying vec2 v_iconMapUV;\n\n\nuniform float u_linearColor: 0;\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 \"light\"\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 float d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n float d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n d_texPixelLen = project_pixel(u_icon_step);\n } else {\n d_texPixelLen = u_icon_step;\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n if(u_aimate.x == Animate || u_linearColor == 1.0) {\n d_distance_ratio = a_Distance / a_Total_Distance;\n }\n\n float miter = (a_Miter + 1.0)/2.0;\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = d_distance_ratio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_Distance; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n styleMappingMat[3][2] = d_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n styleMappingMat[3][3] = miter; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C 0 - 1\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n float originSize = a_Size.x; // \u56FA\u5B9A\u9AD8\u5EA6\n if(u_heightfixed < 1.0) { // \u9AD8\u5EA6\u968F zoom \u8C03\u6574\n originSize = project_pixel(a_Size.x);\n }\n\n float wallHeight = originSize * miter;\n float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));\n\n v_blur = min(project_pixel(2.0) / originSize, 0.05);\n\n // v_lightWeight = lightWeight;\n v_color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n // v_color = a_Color;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy, wallHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
40
|
+
|
|
41
|
+
var LineWallModel = function (_BaseModel) {
|
|
42
|
+
(0, _inherits2.default)(LineWallModel, _BaseModel);
|
|
43
|
+
|
|
44
|
+
var _super = _createSuper(LineWallModel);
|
|
45
|
+
|
|
46
|
+
function LineWallModel() {
|
|
47
|
+
var _this;
|
|
48
|
+
|
|
49
|
+
(0, _classCallCheck2.default)(this, LineWallModel);
|
|
50
|
+
|
|
51
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
52
|
+
args[_key] = arguments[_key];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
56
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "texture", void 0);
|
|
57
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateTexture", function () {
|
|
58
|
+
var createTexture2D = _this.rendererService.createTexture2D;
|
|
59
|
+
|
|
60
|
+
if (_this.texture) {
|
|
61
|
+
_this.texture.update({
|
|
62
|
+
data: _this.iconService.getCanvas()
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
_this.layer.render();
|
|
66
|
+
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_this.texture = createTexture2D({
|
|
71
|
+
data: _this.iconService.getCanvas(),
|
|
72
|
+
mag: _l7Core.gl.NEAREST,
|
|
73
|
+
min: _l7Core.gl.NEAREST,
|
|
74
|
+
premultiplyAlpha: false,
|
|
75
|
+
width: 1024,
|
|
76
|
+
height: _this.iconService.canvasHeight || 128
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
(0, _createClass2.default)(LineWallModel, [{
|
|
83
|
+
key: "getUninforms",
|
|
84
|
+
value: function getUninforms() {
|
|
85
|
+
var _ref = this.layer.getLayerConfig(),
|
|
86
|
+
opacity = _ref.opacity,
|
|
87
|
+
sourceColor = _ref.sourceColor,
|
|
88
|
+
targetColor = _ref.targetColor,
|
|
89
|
+
_ref$textureBlend = _ref.textureBlend,
|
|
90
|
+
textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
|
|
91
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
92
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
93
|
+
_ref$lineTexture = _ref.lineTexture,
|
|
94
|
+
lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
|
|
95
|
+
_ref$iconStep = _ref.iconStep,
|
|
96
|
+
iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
|
|
97
|
+
_ref$iconStepCount = _ref.iconStepCount,
|
|
98
|
+
iconStepCount = _ref$iconStepCount === void 0 ? 1 : _ref$iconStepCount;
|
|
99
|
+
|
|
100
|
+
if (this.rendererService.getDirty()) {
|
|
101
|
+
this.texture.bind();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
var useLinearColor = 0;
|
|
105
|
+
var sourceColorArr = [0, 0, 0, 0];
|
|
106
|
+
var targetColorArr = [0, 0, 0, 0];
|
|
107
|
+
|
|
108
|
+
if (sourceColor && targetColor) {
|
|
109
|
+
sourceColorArr = (0, _l7Utils.rgb2arr)(sourceColor);
|
|
110
|
+
targetColorArr = (0, _l7Utils.rgb2arr)(targetColor);
|
|
111
|
+
useLinearColor = 1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
115
|
+
opacity: opacity
|
|
116
|
+
})) {
|
|
117
|
+
this.judgeStyleAttributes({
|
|
118
|
+
opacity: opacity
|
|
119
|
+
});
|
|
120
|
+
var encodeData = this.layer.getEncodedData();
|
|
121
|
+
|
|
122
|
+
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
123
|
+
data = _this$calDataFrame.data,
|
|
124
|
+
width = _this$calDataFrame.width,
|
|
125
|
+
height = _this$calDataFrame.height;
|
|
126
|
+
|
|
127
|
+
this.rowCount = height;
|
|
128
|
+
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
129
|
+
flipY: true,
|
|
130
|
+
data: data,
|
|
131
|
+
format: _l7Core.gl.LUMINANCE,
|
|
132
|
+
type: _l7Core.gl.FLOAT,
|
|
133
|
+
width: width,
|
|
134
|
+
height: height
|
|
135
|
+
}) : this.createTexture2D({
|
|
136
|
+
flipY: true,
|
|
137
|
+
data: [1],
|
|
138
|
+
format: _l7Core.gl.LUMINANCE,
|
|
139
|
+
type: _l7Core.gl.FLOAT,
|
|
140
|
+
width: 1,
|
|
141
|
+
height: 1
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
u_heightfixed: Number(heightfixed),
|
|
147
|
+
u_dataTexture: this.dataTexture,
|
|
148
|
+
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
149
|
+
u_opacity: (0, _isNumber2.default)(opacity) ? opacity : 1.0,
|
|
150
|
+
u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
|
|
151
|
+
u_texture: this.texture,
|
|
152
|
+
u_line_texture: lineTexture ? 1.0 : 0.0,
|
|
153
|
+
u_iconStepCount: iconStepCount,
|
|
154
|
+
u_icon_step: iconStep,
|
|
155
|
+
u_textSize: [1024, this.iconService.canvasHeight || 128],
|
|
156
|
+
u_linearColor: useLinearColor,
|
|
157
|
+
u_sourceColor: sourceColorArr,
|
|
158
|
+
u_targetColor: targetColorArr
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
key: "getAnimateUniforms",
|
|
163
|
+
value: function getAnimateUniforms() {
|
|
164
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
165
|
+
animateOption = _ref2.animateOption;
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
u_aimate: this.animateOption2Array(animateOption),
|
|
169
|
+
u_time: this.layer.getLayerAnimateTime()
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
}, {
|
|
173
|
+
key: "initModels",
|
|
174
|
+
value: function initModels() {
|
|
175
|
+
this.updateTexture();
|
|
176
|
+
this.iconService.on('imageUpdate', this.updateTexture);
|
|
177
|
+
return this.buildModels();
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: "clearModels",
|
|
181
|
+
value: function clearModels() {
|
|
182
|
+
var _this$texture, _this$dataTexture;
|
|
183
|
+
|
|
184
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
185
|
+
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
186
|
+
this.iconService.off('imageUpdate', this.updateTexture);
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "buildModels",
|
|
190
|
+
value: function buildModels() {
|
|
191
|
+
return [this.layer.buildLayerModel({
|
|
192
|
+
moduleName: 'linewall',
|
|
193
|
+
vertexShader: line_vert,
|
|
194
|
+
fragmentShader: line_frag,
|
|
195
|
+
triangulation: _triangulation.LineTriangulation,
|
|
196
|
+
primitive: _l7Core.gl.TRIANGLES,
|
|
197
|
+
blend: this.getBlend(),
|
|
198
|
+
depth: {
|
|
199
|
+
enable: false
|
|
200
|
+
}
|
|
201
|
+
})];
|
|
202
|
+
}
|
|
203
|
+
}, {
|
|
204
|
+
key: "registerBuiltinAttributes",
|
|
205
|
+
value: function registerBuiltinAttributes() {
|
|
206
|
+
var _this2 = this;
|
|
207
|
+
|
|
208
|
+
var _ref3 = this.layer.getLayerConfig(),
|
|
209
|
+
_ref3$lineType = _ref3.lineType,
|
|
210
|
+
lineType = _ref3$lineType === void 0 ? 'solid' : _ref3$lineType;
|
|
211
|
+
|
|
212
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
213
|
+
name: 'distance',
|
|
214
|
+
type: _l7Core.AttributeType.Attribute,
|
|
215
|
+
descriptor: {
|
|
216
|
+
name: 'a_Distance',
|
|
217
|
+
buffer: {
|
|
218
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
219
|
+
data: [],
|
|
220
|
+
type: _l7Core.gl.FLOAT
|
|
221
|
+
},
|
|
222
|
+
size: 1,
|
|
223
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
224
|
+
return [vertex[3]];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
229
|
+
name: 'total_distance',
|
|
230
|
+
type: _l7Core.AttributeType.Attribute,
|
|
231
|
+
descriptor: {
|
|
232
|
+
name: 'a_Total_Distance',
|
|
233
|
+
buffer: {
|
|
234
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
235
|
+
data: [],
|
|
236
|
+
type: _l7Core.gl.FLOAT
|
|
237
|
+
},
|
|
238
|
+
size: 1,
|
|
239
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
240
|
+
return [vertex[5]];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
245
|
+
name: 'size',
|
|
246
|
+
type: _l7Core.AttributeType.Attribute,
|
|
247
|
+
descriptor: {
|
|
248
|
+
name: 'a_Size',
|
|
249
|
+
buffer: {
|
|
250
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
251
|
+
data: [],
|
|
252
|
+
type: _l7Core.gl.FLOAT
|
|
253
|
+
},
|
|
254
|
+
size: 2,
|
|
255
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
256
|
+
var _feature$size = feature.size,
|
|
257
|
+
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
258
|
+
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
263
|
+
name: 'normal',
|
|
264
|
+
type: _l7Core.AttributeType.Attribute,
|
|
265
|
+
descriptor: {
|
|
266
|
+
name: 'a_Normal',
|
|
267
|
+
buffer: {
|
|
268
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
269
|
+
data: [],
|
|
270
|
+
type: _l7Core.gl.FLOAT
|
|
271
|
+
},
|
|
272
|
+
size: 3,
|
|
273
|
+
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
274
|
+
return normal;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
279
|
+
name: 'miter',
|
|
280
|
+
type: _l7Core.AttributeType.Attribute,
|
|
281
|
+
descriptor: {
|
|
282
|
+
name: 'a_Miter',
|
|
283
|
+
buffer: {
|
|
284
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
285
|
+
data: [],
|
|
286
|
+
type: _l7Core.gl.FLOAT
|
|
287
|
+
},
|
|
288
|
+
size: 1,
|
|
289
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
290
|
+
return [vertex[4]];
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
295
|
+
name: 'uv',
|
|
296
|
+
type: _l7Core.AttributeType.Attribute,
|
|
297
|
+
descriptor: {
|
|
298
|
+
name: 'a_iconMapUV',
|
|
299
|
+
buffer: {
|
|
300
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
301
|
+
data: [],
|
|
302
|
+
type: _l7Core.gl.FLOAT
|
|
303
|
+
},
|
|
304
|
+
size: 2,
|
|
305
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
306
|
+
var iconMap = _this2.iconService.getIconMap();
|
|
307
|
+
|
|
308
|
+
var texture = feature.texture;
|
|
309
|
+
|
|
310
|
+
var _ref4 = iconMap[texture] || {
|
|
311
|
+
x: 0,
|
|
312
|
+
y: 0
|
|
313
|
+
},
|
|
314
|
+
x = _ref4.x,
|
|
315
|
+
y = _ref4.y;
|
|
316
|
+
|
|
317
|
+
return [x, y];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}]);
|
|
323
|
+
return LineWallModel;
|
|
324
|
+
}(_BaseModel2.default);
|
|
325
|
+
|
|
326
|
+
exports.default = LineWallModel;
|
|
327
|
+
//# sourceMappingURL=wall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/wall.ts"],"names":["LineWallModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","gl","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","sourceColor","targetColor","textureBlend","heightfixed","lineTexture","iconStep","iconStepCount","getDirty","bind","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_heightfixed","Number","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_textureBlend","u_texture","u_line_texture","u_iconStepCount","u_icon_step","u_textSize","u_linearColor","u_sourceColor","u_targetColor","animateOption","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","updateTexture","on","buildModels","destroy","off","buildLayerModel","moduleName","vertexShader","line_vert","fragmentShader","line_frag","triangulation","LineTriangulation","primitive","TRIANGLES","blend","getBlend","depth","enable","lineType","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","DYNAMIC_DRAW","Array","isArray","normal","iconMap","getIconMap","x","y","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;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QAAAA,UAAU,EAAE;AACVH,UAAAA,IAAI,EAAE,aADI;AAEVI,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEpF,WAAG2F,YAFJ;AAGNjG,YAAAA,IAAI,EAAE,EAHA;AAINyC,YAAAA,IAAI,EAAEnC,WAAGoC;AAJH,WAFE;AAQVkD,UAAAA,IAAI,EAAE,CARI;AASV7F,UAAAA,MAAM,EAAE,gBACN8F,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,gBAAMK,OAAO,GAAG,MAAI,CAACpG,WAAL,CAAiBqG,UAAjB,EAAhB;;AACA,gBAAQxG,OAAR,GAAoB+F,OAApB,CAAQ/F,OAAR;;AACA,wBAAiBuG,OAAO,CAACvG,OAAD,CAAP,IAA8B;AAAEyG,cAAAA,CAAC,EAAE,CAAL;AAAQC,cAAAA,CAAC,EAAE;AAAX,aAA/C;AAAA,gBAAQD,CAAR,SAAQA,CAAR;AAAA,gBAAWC,CAAX,SAAWA,CAAX;;AACA,mBAAO,CAACD,CAAD,EAAIC,CAAJ,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;EAvQwCC,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IEncodeFeature,\n IImage,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport { rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions, lineStyleType } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_frag from '../shaders/wall_frag.glsl';\nimport line_vert from '../shaders/wall_vert.glsl';\n\nexport default class LineWallModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity,\n sourceColor,\n targetColor,\n textureBlend = 'normal',\n heightfixed = false,\n lineTexture = false,\n iconStep = 100,\n iconStepCount = 1,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\n }\n\n // 转化渐变色\n let useLinearColor = 0; // 默认不生效\n let sourceColorArr = [0, 0, 0, 0];\n let targetColorArr = [0, 0, 0, 0];\n if (sourceColor && targetColor) {\n sourceColorArr = rgb2arr(sourceColor);\n targetColorArr = rgb2arr(targetColor);\n useLinearColor = 1;\n }\n\n if (this.dataTextureTest && this.dataTextureNeedUpdate({ opacity })) {\n this.judgeStyleAttributes({ opacity });\n const encodeData = this.layer.getEncodedData();\n const { data, width, height } = this.calDataFrame(\n this.cellLength,\n encodeData,\n this.cellProperties,\n );\n this.rowCount = height; // 当前数据纹理有多少行\n\n this.dataTexture =\n this.cellLength > 0 && data.length > 0\n ? this.createTexture2D({\n flipY: true,\n data,\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width,\n height,\n })\n : this.createTexture2D({\n flipY: true,\n data: [1],\n format: gl.LUMINANCE,\n type: gl.FLOAT,\n width: 1,\n height: 1,\n });\n }\n\n return {\n u_heightfixed: Number(heightfixed),\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n // u_opacity: opacity === undefined ? 1 : opacity,\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,\n\n // 纹理支持参数\n u_texture: this.texture, // 贴图\n u_line_texture: lineTexture ? 1.0 : 0.0, // 传入线的标识\n u_iconStepCount: iconStepCount,\n u_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const { animateOption } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption as IAnimateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public initModels(): IModel[] {\n this.updateTexture();\n this.iconService.on('imageUpdate', this.updateTexture);\n\n return this.buildModels();\n }\n\n public clearModels() {\n this.texture?.destroy();\n this.dataTexture?.destroy();\n this.iconService.off('imageUpdate', this.updateTexture);\n }\n\n public buildModels(): IModel[] {\n return [\n this.layer.buildLayerModel({\n moduleName: 'linewall',\n vertexShader: line_vert,\n fragmentShader: line_frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: false },\n }),\n ];\n }\n protected registerBuiltinAttributes() {\n // const lineType = this\n // point layer size;\n const {\n lineType = 'solid',\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n // if (lineType === 'dash') {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Distance',\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'total_distance',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Total_Distance',\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[5]];\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: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n const { size = 1 } = feature;\n return Array.isArray(size) ? [size[0], size[1]] : [size as number, 0];\n },\n },\n });\n\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 // @ts-ignore\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: 'miter',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Miter',\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: 1,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[4]];\n },\n },\n });\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_iconMapUV',\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 iconMap = this.iconService.getIconMap();\n const { texture } = feature;\n const { x, y } = iconMap[texture as string] || { x: 0, y: 0 };\n return [x, y];\n },\n },\n });\n }\n private updateTexture = () => {\n const { createTexture2D } = this.rendererService;\n if (this.texture) {\n this.texture.update({\n data: this.iconService.getCanvas(),\n });\n this.layer.render();\n return;\n }\n this.texture = createTexture2D({\n data: this.iconService.getCanvas(),\n mag: gl.NEAREST,\n min: gl.NEAREST,\n premultiplyAlpha: false,\n width: 1024,\n height: this.iconService.canvasHeight || 128,\n });\n };\n}\n"],"file":"wall.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.31",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@antv/geo-coord": "^1.0.8",
|
|
27
|
-
"@antv/l7-core": "^2.6.
|
|
28
|
-
"@antv/l7-source": "^2.6.
|
|
29
|
-
"@antv/l7-utils": "^2.6.
|
|
27
|
+
"@antv/l7-core": "^2.6.31",
|
|
28
|
+
"@antv/l7-source": "^2.6.31",
|
|
29
|
+
"@antv/l7-utils": "^2.6.31",
|
|
30
30
|
"@babel/runtime": "^7.7.7",
|
|
31
31
|
"@mapbox/martini": "^0.2.0",
|
|
32
32
|
"@turf/meta": "^6.0.2",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/gl-matrix": "^2.4.5",
|
|
53
53
|
"@types/lodash": "^4.14.138"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "756e15ae8404fed11c538dc3f9abb2cd62bda786",
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
}
|