@antv/l7-layers 2.8.29 → 2.8.32

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.
@@ -76,6 +76,8 @@ export interface IPolygonLayerStyleOptions {
76
76
  enable: boolean;
77
77
  dir: string;
78
78
  };
79
+ topsurface?: boolean;
80
+ sidesurface?: boolean;
79
81
  mapTexture?: string;
80
82
  raisingHeight?: number;
81
83
  sourceColor?: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType","CanvasUpdateType"],"mappings":"AAIA,WAAYA,aAAZ;;WAAYA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a;;AAqJZ,WAAYC,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,KAAAA,gB","sourcesContent":["import { IAnimateOption, IMapService } from '@antv/l7-core';\nimport { IColorRamp } from '@antv/l7-utils';\nimport { styleOffset, styleSingle } from '../core/BaseModel';\nimport { anchorType } from '../utils/symbol-layout';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\ninterface ILineArrow {\n enable: boolean;\n arrowWidth: number;\n arrowHeight: number;\n tailWidth: number;\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 depth?: boolean;\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 raisingHeight?: number; // 线图层抬升高度\n\n mask?: boolean; // 可选参数 时候允许蒙层\n maskInside?: boolean; // 可选参数 控制图层是否显示在蒙层的内部\n\n arrow?: ILineArrow;\n}\n\nexport interface IPointLayerStyleOptions {\n opacity: number;\n strokeOpacity: number;\n strokeWidth: number;\n stroke: string;\n\n blur?: number;\n\n // text\n textOffset?: [number, number];\n textAnchor?: anchorType;\n spacing?: number;\n padding?: [number, number];\n halo?: number;\n gamma?: number;\n fontWeight?: string;\n fontFamily?: string;\n textAllowOverlap?: boolean;\n\n raisingHeight?: number; // 线图层抬升高度\n\n // cylinder\n pickLight?: boolean;\n depth?: boolean;\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n opacityLinear?: {\n enable: boolean;\n dir: string;\n };\n lightEnable: boolean;\n heightfixed?: boolean; // 圆柱体高度是否固定(不随 zoom 发生变化)\n\n offsets?: styleOffset;\n blend?: string;\n unit?: string;\n mask?: boolean;\n maskInside?: boolean;\n\n rotation?: number; // angle\n speed?: number;\n}\n\nexport interface IPolygonLayerStyleOptions {\n opacity: styleSingle;\n\n opacityLinear: {\n enable: boolean;\n dir: string;\n };\n\n mapTexture?: string; // 挤出几何体顶面贴图\n raisingHeight?: number; // 挤出几何体抬升高度\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n heightfixed?: boolean; // 挤出几何体高度是否固定(不随 zoom 发生变化)\n\n pickLight: boolean;\n mask?: boolean;\n maskInside?: boolean;\n\n // water\n waterTexture?: string;\n speed?: number;\n // ocean\n watercolor?: string;\n watercolor2?: string;\n}\n\nexport interface IImageLayerStyleOptions {\n opacity: number;\n mask?: boolean;\n maskInside?: boolean;\n}\n\nexport interface IGeometryLayerStyleOptions {\n opacity: number;\n mask?: boolean;\n maskInside?: boolean;\n\n mapTexture?: string;\n terrainTexture?: string;\n\n // planeGeometry\n center?: [number, number];\n width?: number;\n height?: number;\n\n widthSegments?: number;\n heightSegments?: number;\n\n terrainClipHeight?: number;\n rgb2height?: (r: number, g: number, b: number) => number;\n\n // sprite\n spriteAnimate?: string;\n spriteRadius?: number;\n spriteCount?: number;\n spriteSpeed?: number;\n spriteTop?: number;\n spriteUpdate?: number;\n spriteScale?: number;\n\n animateOption?: IAnimateOption;\n}\n\nexport enum CanvasUpdateType {\n 'ALWAYS' = 'always',\n 'DRAGEND' = 'dragend',\n}\n\nexport interface IDrawingOnCanvas {\n canvas: HTMLCanvasElement;\n ctx: CanvasRenderingContext2D;\n mapService: IMapService;\n size: [number, number];\n}\nexport interface ICanvasLayerStyleOptions {\n zIndex: number;\n update: CanvasUpdateType | string;\n drawingOnCanvas: (option: IDrawingOnCanvas) => void;\n}\n\nexport interface IHeatMapLayerStyleOptions {\n opacity: number;\n intensity: number;\n radius: number;\n angle: number;\n rampColors: IColorRamp;\n mask?: boolean;\n maskInside?: boolean;\n\n coverage?: number;\n}\n\nexport interface IRasterLayerStyleOptions {\n opacity: number;\n domain: [number, number];\n noDataValue: number;\n clampLow: boolean;\n clampHigh: boolean;\n rampColors: IColorRamp;\n mask?: boolean;\n maskInside?: boolean;\n}\n"],"file":"interface.js"}
1
+ {"version":3,"sources":["../../src/core/interface.ts"],"names":["lineStyleType","CanvasUpdateType"],"mappings":"AAIA,WAAYA,aAAZ;;WAAYA,a;AAAAA,EAAAA,a,CAAAA,a;AAAAA,EAAAA,a,CAAAA,a;GAAAA,a,KAAAA,a;;AAwJZ,WAAYC,gBAAZ;;WAAYA,gB;AAAAA,EAAAA,gB;AAAAA,EAAAA,gB;GAAAA,gB,KAAAA,gB","sourcesContent":["import { IAnimateOption, IMapService } from '@antv/l7-core';\nimport { IColorRamp } from '@antv/l7-utils';\nimport { styleOffset, styleSingle } from '../core/BaseModel';\nimport { anchorType } from '../utils/symbol-layout';\nexport enum lineStyleType {\n 'solid' = 0.0,\n 'dash' = 1.0,\n}\n\ninterface ILineArrow {\n enable: boolean;\n arrowWidth: number;\n arrowHeight: number;\n tailWidth: number;\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 depth?: boolean;\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 raisingHeight?: number; // 线图层抬升高度\n\n mask?: boolean; // 可选参数 时候允许蒙层\n maskInside?: boolean; // 可选参数 控制图层是否显示在蒙层的内部\n\n arrow?: ILineArrow;\n}\n\nexport interface IPointLayerStyleOptions {\n opacity: number;\n strokeOpacity: number;\n strokeWidth: number;\n stroke: string;\n\n blur?: number;\n\n // text\n textOffset?: [number, number];\n textAnchor?: anchorType;\n spacing?: number;\n padding?: [number, number];\n halo?: number;\n gamma?: number;\n fontWeight?: string;\n fontFamily?: string;\n textAllowOverlap?: boolean;\n\n raisingHeight?: number; // 线图层抬升高度\n\n // cylinder\n pickLight?: boolean;\n depth?: boolean;\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n opacityLinear?: {\n enable: boolean;\n dir: string;\n };\n lightEnable: boolean;\n heightfixed?: boolean; // 圆柱体高度是否固定(不随 zoom 发生变化)\n\n offsets?: styleOffset;\n blend?: string;\n unit?: string;\n mask?: boolean;\n maskInside?: boolean;\n\n rotation?: number; // angle\n speed?: number;\n}\n\nexport interface IPolygonLayerStyleOptions {\n opacity: styleSingle;\n\n opacityLinear: {\n enable: boolean;\n dir: string;\n };\n\n topsurface?: boolean;\n sidesurface?: boolean;\n\n mapTexture?: string; // 挤出几何体顶面贴图\n raisingHeight?: number; // 挤出几何体抬升高度\n sourceColor?: string; // 可选参数、设置渐变色的起始颜色(all)\n targetColor?: string; // 可选参数、设置渐变色的终点颜色(all)\n heightfixed?: boolean; // 挤出几何体高度是否固定(不随 zoom 发生变化)\n\n pickLight: boolean;\n mask?: boolean;\n maskInside?: boolean;\n\n // water\n waterTexture?: string;\n speed?: number;\n // ocean\n watercolor?: string;\n watercolor2?: string;\n}\n\nexport interface IImageLayerStyleOptions {\n opacity: number;\n mask?: boolean;\n maskInside?: boolean;\n}\n\nexport interface IGeometryLayerStyleOptions {\n opacity: number;\n mask?: boolean;\n maskInside?: boolean;\n\n mapTexture?: string;\n terrainTexture?: string;\n\n // planeGeometry\n center?: [number, number];\n width?: number;\n height?: number;\n\n widthSegments?: number;\n heightSegments?: number;\n\n terrainClipHeight?: number;\n rgb2height?: (r: number, g: number, b: number) => number;\n\n // sprite\n spriteAnimate?: string;\n spriteRadius?: number;\n spriteCount?: number;\n spriteSpeed?: number;\n spriteTop?: number;\n spriteUpdate?: number;\n spriteScale?: number;\n\n animateOption?: IAnimateOption;\n}\n\nexport enum CanvasUpdateType {\n 'ALWAYS' = 'always',\n 'DRAGEND' = 'dragend',\n}\n\nexport interface IDrawingOnCanvas {\n canvas: HTMLCanvasElement;\n ctx: CanvasRenderingContext2D;\n mapService: IMapService;\n size: [number, number];\n}\nexport interface ICanvasLayerStyleOptions {\n zIndex: number;\n update: CanvasUpdateType | string;\n drawingOnCanvas: (option: IDrawingOnCanvas) => void;\n}\n\nexport interface IHeatMapLayerStyleOptions {\n opacity: number;\n intensity: number;\n radius: number;\n angle: number;\n rampColors: IColorRamp;\n mask?: boolean;\n maskInside?: boolean;\n\n coverage?: number;\n}\n\nexport interface IRasterLayerStyleOptions {\n opacity: number;\n domain: [number, number];\n noDataValue: number;\n clampLow: boolean;\n clampHigh: boolean;\n rampColors: IColorRamp;\n mask?: boolean;\n maskInside?: boolean;\n}\n"],"file":"interface.js"}
@@ -16,7 +16,7 @@ import { getMask, rgb2arr } from '@antv/l7-utils';
16
16
  import BaseModel from '../../core/BaseModel';
17
17
  import { LineTriangulation } from '../../core/triangulation';
18
18
  var line_dash_frag = "#define LineTypeSolid 0.0\nuniform float u_opacity : 1.0;\n\nvarying vec4 v_color;\n\n// dash\nvarying vec4 v_dash_array;\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 d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n gl_FragColor = v_color;\n gl_FragColor.a *= opacity; // \u5168\u5C40\u900F\u660E\u5EA6\n // dash line\n \n float flag = 0.;\n float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);\n if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {\n flag = 1.;\n }\n gl_FragColor.a *=flag;\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
19
- var line_dash_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;\n\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_dash_array: [10.0, 5., 0, 0];\n\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying vec4 v_dash_array;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\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 v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n vec2 offset = project_pixel(size.xy);\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = a_Distance / a_Total_Distance; // \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\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, project_pixel(a_Size.y), 1.0));\n } else {\n float lineHeight = a_Size.y;\n \n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
19
+ var line_dash_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;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform vec4 u_dash_array: [10.0, 5., 0, 0];\n\nuniform float u_vertexScale: 1.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\nvarying vec4 v_dash_array;\n\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\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 v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n vec2 offset = project_pixel(size.xy);\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = a_DistanceAndIndex.x / a_Total_Distance; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = a_DistanceAndIndex.x; // \u5F53\u524D\u9876\u70B9\u7684\u8DDD\u79BB\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, project_pixel(a_Size.y), 1.0));\n } else {\n float lineHeight = a_Size.y;\n \n // #define COORDINATE_SYSTEM_P20 5.0\n // #define COORDINATE_SYSTEM_P20_OFFSET 6.0\n // amap1.x\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
20
20
  var line_frag = "#define Animate 0.0\n#define LineTexture 1.0\nuniform float u_blur : 0.99;\nuniform float u_opacity : 1.0;\nuniform float u_textureBlend;\n\nuniform float u_borderWidth: 0.0;\nuniform vec4 u_borderColor;\nvarying vec4 v_color;\n\n// line texture\nuniform float u_line_texture;\nuniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nvarying vec2 v_iconMapUV;\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 gl_FragColor = v_color;\n // anti-alias\n // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));\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 // v = max(smoothstep(0.95, 1.0, v), v);\n vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;\n \n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, vec2(u, v)));\n // gl_FragColor = filterColor(gl_FragColor + texture2D(u_texture, uv));\n vec4 pattern = texture2D(u_texture, uv);\n\n if(u_textureBlend == 0.0) { // normal\n pattern.a = 0.0;\n 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 = pattern;\n }\n } \n\n float v = styleMappingMat[3].a;\n float borderWidth = min(0.5, u_borderWidth);\n // \u7ED8\u5236 border\n if(borderWidth > 0.01) {\n float borderOuterWidth = borderWidth/2.0;\n\n if(v >= 1.0 - borderWidth || v <= borderWidth) {\n if(v > borderWidth) {\n float linear = smoothstep(0.0, 1.0, (v - (1.0 - borderWidth))/borderWidth);\n gl_FragColor.rgb = mix(gl_FragColor.rgb, u_borderColor.rgb, linear);\n } else if(v <= borderWidth) {\n float linear = smoothstep(0.0, 1.0, v/borderWidth);\n gl_FragColor.rgb = mix(u_borderColor.rgb, gl_FragColor.rgb, linear);\n }\n }\n\n if(v < borderOuterWidth) {\n gl_FragColor.a = mix(0.0, gl_FragColor.a, v/borderOuterWidth);\n } else if(v > 1.0 - borderOuterWidth) {\n gl_FragColor.a = mix(gl_FragColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);\n }\n }\n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
21
21
  var line_vert = "\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;\n\nattribute vec2 a_iconMapUV;\n\n// dash line\nattribute float a_Total_Distance;\nattribute vec2 a_DistanceAndIndex;\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;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.0;\nuniform float u_raisingHeight: 0.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\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;\nuniform float u_arrow: 0.0;\nuniform float u_arrowHeight: 3.0;\nuniform float u_arrowWidth: 2.0;\nuniform float u_tailWidth: 1.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 \"styleMappingCalOpacity\"\n\nvec2 calculateArrow(vec2 offset) {\n /*\n * \u5728\u652F\u6301\u7BAD\u5934\u7684\u65F6\u5019\uFF0C\u7B2C\u4E8C\u3001\u7B2C\u4E09\u7EC4\u9876\u70B9\u662F\u989D\u5916\u63D2\u5165\u7528\u4E8E\u6784\u5EFA\u9876\u70B9\u7684\n */\n float arrowFlag = -1.0;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // \u9AD8\u5FB7 2.0 \u7684\u65CB\u8F6C\u89D2\u5EA6\u4E0D\u540C\n arrowFlag = 1.0;\n }\n float pi = arrowFlag * 3.1415926/2.;\n if(a_Miter < 0.) {\n // \u6839\u636E\u7EBF\u7684\u4E24\u4FA7\u504F\u79FB\u4E0D\u540C\u3001\u65CB\u8F6C\u7684\u65B9\u5411\u76F8\u53CD\n pi = -pi;\n }\n highp float angle_sin = sin(pi);\n highp float angle_cos = cos(pi);\n // \u8BA1\u7B97\u5782\u76F4\u4E0E\u7EBF\u65B9\u5411\u7684\u65CB\u8F6C\u77E9\u9635\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float arrowWidth = u_arrowWidth;\n float arrowHeight = u_arrowHeight;\n\n vec2 arrowOffset = vec2(0.0);\n /*\n * a_DistanceAndIndex.y \u7528\u4E8E\u6807\u8BB0\u5F53\u524D\u9876\u70B9\u5C5E\u4E8E\u54EA\u4E00\u7EC4\uFF08\u4E24\u4E2A\u9876\u70B9\u4E00\u7EC4\uFF0C\u6784\u6210\u7EBF\u7684\u5176\u5B9E\u662F\u77E9\u5F62\uFF0C\u6700\u7B80\u9700\u8981\u56DB\u4E2A\u9876\u70B9\u3001\u4E24\u7EC4\u9876\u70B9\u6784\u6210\uFF09\n */\n if(a_DistanceAndIndex.y == 0.0) {\n // \u7BAD\u5934\u5C16\u90E8\n offset = vec2(0.0);\n } else if(a_DistanceAndIndex.y == 1.0) {\n // \u7BAD\u5934\u4E24\u4FA7\n arrowOffset = rotation_matrix*(offset * arrowHeight);\n offset += arrowOffset; // \u6CBF\u7EBF\u504F\u79FB\n offset = offset * arrowWidth; // \u5782\u76F4\u7EBF\u5411\u5916\u504F\u79FB\uFF08\u662F\u6784\u5EFA\u7BAD\u5934\u4E24\u4FA7\u7684\u9876\u70B9\uFF09\n } else if(a_DistanceAndIndex.y == 2.0 || a_DistanceAndIndex.y == 3.0 || a_DistanceAndIndex.y == 4.0) {\n // \u504F\u79FB\u5176\u4F59\u7684\u70B9\u4F4D\uFF08\u5C06\u957F\u5EA6\u8BA9\u4F4D\u7ED9\u7BAD\u5934\uFF09\n arrowOffset = rotation_matrix*(offset * arrowHeight) * arrowWidth;\n offset += arrowOffset;// \u6CBF\u7EBF\u504F\u79FB\n }\n\n return offset;\n}\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_texPixelLen; // \u8D34\u56FE\u7684\u50CF\u7D20\u957F\u5EA6\uFF0C\u6839\u636E\u5730\u56FE\u5C42\u7EA7\u7F29\u653E\n\n v_iconMapUV = a_iconMapUV;\n d_texPixelLen = project_float_pixel(u_icon_step);\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n d_texPixelLen *= 10.0;\n }\n\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n float lineDistance = a_DistanceAndIndex.x;\n float currentLinePointRatio = lineDistance / a_Total_Distance;\n \n if(u_arrow > 0.0) {\n // \u8BA1\u7B97\u7BAD\u5934\n offset = calculateArrow(offset);\n\n if(a_DistanceAndIndex.y > 4.0) {\n offset *= mix(1.0, u_tailWidth, currentLinePointRatio);\n }\n }\n\n float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // \u7EBF\u6A2A\u5411\u504F\u79FB\u7684\u8DDD\u79BB\uFF08\u5411\u4E24\u4FA7\u504F\u79FB\u7684\u548C\uFF09\n float linePixelSize = project_pixel(a_Size.x) * 2.0; // \u5B9A\u70B9\u4F4D\u7F6E\u504F\u79FB\uFF0C\u6309\u5730\u56FE\u7B49\u7EA7\u7F29\u653E\u540E\u7684\u8DDD\u79BB \u5355\u4FA7 * 2\n float texV = lineOffsetWidth/linePixelSize; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n // \u8BBE\u7F6E\u6570\u636E\u96C6\u7684\u53C2\u6570\n styleMappingMat[3][0] = currentLinePointRatio; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n styleMappingMat[3][1] = lineDistance; // \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] = texV; // \u7EBF\u56FE\u5C42\u8D34\u56FE\u90E8\u5206\u7684 v \u5750\u6807\u503C\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));\n\n float h = float(a_Position.z) * u_vertexScale; // \u7EBF\u9876\u70B9\u7684\u9AD8\u5EA6 - \u517C\u5BB9\u4E0D\u5B58\u5728\u7B2C\u4E09\u4E2A\u6570\u503C\u7684\u60C5\u51B5 vertex height\n float lineHeight = a_Size.y; // size \u7B2C\u4E8C\u4E2A\u53C2\u6570\u4EE3\u8868\u7684\u9AD8\u5EA6 [linewidth, lineheight]\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n lineHeight *= 0.2; // \u4FDD\u6301\u548C amap/mapbox \u4E00\u81F4\u7684\u6548\u679C\n h *= 0.2;\n if(u_heightfixed < 1.0) {\n lineHeight = project_pixel(a_Size.y);\n }\n gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight + h + u_raisingHeight, 1.0));\n } else {\n // mapbox - amap\n \n // \u517C\u5BB9 mapbox \u5728\u7EBF\u9AD8\u5EA6\u4E0A\u7684\u6548\u679C\u8868\u73B0\u57FA\u672C\u4E00\u81F4\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // mapbox\n // \u4FDD\u6301\u9AD8\u5EA6\u76F8\u5BF9\u4E0D\u53D8\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n h *= mapboxZoomScale;\n h += u_raisingHeight * mapboxZoomScale;\n if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\n h += u_raisingHeight;\n // lineHeight \u9876\u70B9\u504F\u79FB\u9AD8\u5EA6\n if(u_heightfixed < 1.0) {\n lineHeight *= pow(2.0, 20.0 - u_Zoom);\n }\n }\n\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight + h, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
22
22
  var linear_line_frag = "#define LineTypeSolid 0.0\n#define LineTypeDash 1.0\n#define Animate 0.0\n#define LineTexture 1.0\nuniform float u_blur : 0.99;\nuniform float u_line_type: 0.0;\nuniform float u_opacity : 1.0;\n\nvarying vec4 v_color;\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\n\nvarying mat4 styleMappingMat;\n// [animate, duration, interval, trailLength],\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float d_distance_ratio = styleMappingMat[3].r; // \u5F53\u524D\u70B9\u4F4D\u8DDD\u79BB\u5360\u7EBF\u603B\u957F\u7684\u6BD4\u4F8B\n\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n gl_FragColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);\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 gl_FragColor = filterColor(gl_FragColor);\n}\n";
@@ -188,10 +188,6 @@ var LineWallModel = function (_BaseModel) {
188
188
  value: function registerBuiltinAttributes() {
189
189
  var _this2 = this;
190
190
 
191
- var _ref3 = this.layer.getLayerConfig(),
192
- _ref3$lineType = _ref3.lineType,
193
- lineType = _ref3$lineType === void 0 ? 'solid' : _ref3$lineType;
194
-
195
191
  this.styleAttributeService.registerStyleAttribute({
196
192
  name: 'distance',
197
193
  type: AttributeType.Attribute,
@@ -290,12 +286,12 @@ var LineWallModel = function (_BaseModel) {
290
286
 
291
287
  var texture = feature.texture;
292
288
 
293
- var _ref4 = iconMap[texture] || {
289
+ var _ref3 = iconMap[texture] || {
294
290
  x: 0,
295
291
  y: 0
296
292
  },
297
- x = _ref4.x,
298
- y = _ref4.y;
293
+ x = _ref3.x,
294
+ y = _ref3.y;
299
295
 
300
296
  return [x, y];
301
297
  }
@@ -1 +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,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AAE,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"}
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","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,QASO,eATP;AAWA,SAASC,OAAT,QAAwB,gBAAxB;AAEA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,iBAAT,QAAkC,0BAAlC;;;;IAIqBC,a;;;;;;;;;;;;;;;;;;oEAkQK,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;;;;;;;WAjRD,wBAAqC;AACnC,iBASI,KAAKR,KAAL,CAAWS,cAAX,EATJ;AAAA,UACEC,OADF,QACEA,OADF;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WA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el,\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 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"}
@@ -19,7 +19,7 @@ import BaseModel from '../../core/BaseModel';
19
19
  import { GlobelPointFillTriangulation, PointFillTriangulation } from '../../core/triangulation';
20
20
  var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n \n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_aimate.z - u_aimate.y * u_time)), 0.0, 1.0);\n \n // TODO: \u6839\u636E\u53E0\u52A0\u6A21\u5F0F\u9009\u62E9\u6548\u679C\n if(u_additive > 0.0) {\n gl_FragColor *= intensity;\n // TODO: \u4F18\u5316\u6C34\u6CE2\u70B9 blend additive \u6A21\u5F0F\u4E0B\u6709\u7684\u62FE\u53D6\u6548\u679C \n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.a * intensity);\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
21
21
  var pointFillFrag = "\nuniform float u_globel;\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n if(u_globel > 0.0) {\n // TODO: \u5730\u7403\u6A21\u5F0F\u4E0B\u907F\u514D\u591A\u4F59\u7247\u5143\u7ED8\u5236\uFF0C\u540C\u65F6\u4E5F\u80FD\u907F\u514D\u6709\u7528\u7247\u5143\u5728\u900F\u660E\u4E14\u91CD\u53E0\u7684\u60C5\u51B5\u4E0B\u65E0\u6CD5\u5199\u5165\n // \u4ED8\u51FA\u7684\u4EE3\u4EF7\u662F\u8FB9\u7F18\u4F1A\u6709\u4E00\u4E9B\u952F\u9F7F\n if(outer_df > antialiasblur + 0.018) discard;\n }\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
22
- var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform float u_globel;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\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\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n }\n\n if(u_globel > 0.0) {\n gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1, 1.0);\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
22
+ var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform float u_globel;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_isMeter;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\nuniform float u_raisingHeight: 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\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\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // TODO: billboard\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n antialiasblur *= pow(19.0 - u_Zoom, 2.0);\n antialiasblur = max(antialiasblur, -0.01);\n // offset *= 0.5;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.xy += offset;\n offset.x = 0.0;\n offset.y = 0.0;\n }\n }\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raiseHeight = u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raiseHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, u_raisingHeight, 1.0));\n }\n\n if(u_globel > 0.0) {\n gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1, 1.0);\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
23
23
  import { Version } from '@antv/l7-maps';
24
24
  import { mat4, vec3 } from 'gl-matrix';
25
25
 
@@ -62,7 +62,9 @@ var FillModel = function (_BaseModel) {
62
62
  offsets = _ref$offsets === void 0 ? [0, 0] : _ref$offsets,
63
63
  blend = _ref.blend,
64
64
  _ref$blur = _ref.blur,
65
- blur = _ref$blur === void 0 ? 0 : _ref$blur;
65
+ blur = _ref$blur === void 0 ? 0 : _ref$blur,
66
+ _ref$raisingHeight = _ref.raisingHeight,
67
+ raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight;
66
68
 
67
69
  if (this.dataTextureTest && this.dataTextureNeedUpdate({
68
70
  opacity: opacity,
@@ -104,6 +106,7 @@ var FillModel = function (_BaseModel) {
104
106
  }
105
107
 
106
108
  return {
109
+ u_raisingHeight: Number(raisingHeight),
107
110
  u_isMeter: Number(this.isMeter),
108
111
  u_blur: blur,
109
112
  u_additive: blend === 'additive' ? 1.0 : 0.0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/point/models/fill.ts"],"names":["AttributeType","gl","getCullFace","getMask","BaseModel","GlobelPointFillTriangulation","PointFillTriangulation","Version","mat4","vec3","FillModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","blur","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_isMeter","Number","isMeter","u_blur","u_additive","u_globel","mapService","version","GLOBEL","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_stroke_opacity","u_stroke_width","u_stroke_color","getStrokeColor","u_offsets","isOffsetStatic","animateOption","enable","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","styleAttributeService","createAttributesAndIndices","unit","L7MAP","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","isGlobel","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","getBlend","stencil","cull","face","waveFillFrag","pointFillVert","pointFillFrag","destroy","option","speed","rings","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","extrude","n1","fromValues","n2","xzReg","angle","Math","PI","yReg","asin","m","create","rotateY","rotateX","v1","transformMat4","normalize","v2","v3","v4","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf"],"mappings":";;;;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,gBAArC;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SACEC,4BADF,EAEEC,sBAFF,QAGO,0BAHP;;;;AAYA,SAASC,OAAT,QAAwB,eAAxB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,WAA3B;;IACqBC,S;;;;;;;;;;;;;;;;kEACU,C;;8DACF,K;;;;;;;WAC3B,wBAAqC;AACnC,iBAQI,KAAKC,KAAL,CAAWC,cAAX,EARJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,oCAEEC,aAFF;AAAA,UAEEA,aAFF,mCAEkB,CAFlB;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,CAHhB;AAAA,6BAIEC,MAJF;AAAA,UAIEA,MAJF,4BAIW,eAJX;AAAA,8BAKEC,OALF;AAAA,UAKEA,OALF,6BAKY,CAAC,CAAD,EAAI,CAAJ,CALZ;AAAA,UAMEC,KANF,QAMEA,KANF;AAAA,2BAOEC,IAPF;AAAA,UAOEA,IAPF,0BAOS,CAPT;;AAUA,UACE,KAAKC,eAAL,IACA,KAAKC,qBAAL,CAA2B;AACzBR,QAAAA,OAAO,EAAPA,OADyB;AAEzBC,QAAAA,aAAa,EAAbA,aAFyB;AAGzBC,QAAAA,WAAW,EAAXA,WAHyB;AAIzBC,QAAAA,MAAM,EAANA,MAJyB;AAKzBC,QAAAA,OAAO,EAAPA;AALyB,OAA3B,CAFF,EASE;AAEA,aAAKK,oBAAL,CAA0B;AACxBT,UAAAA,OAAO,EAAPA,OADwB;AAExBC,UAAAA,aAAa,EAAbA,aAFwB;AAGxBC,UAAAA,WAAW,EAAXA,WAHw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,aAAa,CAAC6H,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE/H,EAAE,CAACgI,YAFJ;AAGNrG,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAErC,EAAE,CAACsC;AAJH,WAFE;AAQV2F,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,iCAAsBH,OAAtB,CAAQ2B,KAAR;AAAA,gBAAQA,KAAR,+BAAgB,CAAhB;;AACA,gBAAMC,OAAO,GAAG,MAAI,CAACrJ,KAAL,CAAWC,cAAX,GAA4BoJ,OAA5C;;AACA,gBAAMC,UAAU,GAAGD,OAAO,CAACE,OAAR,CAAgBH,KAAhB,CAAnB;AACA,mBAAO,CAACE,UAAD,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EAnWoC7J,S;;SAAlBM,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IAttribute,\n IElements,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport {\n GlobelPointFillTriangulation,\n PointFillTriangulation,\n} from '../../core/triangulation';\n// animate pointLayer shader - support animate\nimport waveFillFrag from '../shaders/animate/wave_frag.glsl';\n// static pointLayer shader - not support animate\nimport pointFillFrag from '../shaders/fill_frag.glsl';\nimport pointFillVert from '../shaders/fill_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\nimport { mat4, vec3 } from 'gl-matrix';\nexport default class FillModel extends BaseModel {\n public meter2coord: number = 1;\n private isMeter: boolean = false;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n blur = 0,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\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 return {\n u_isMeter: Number(this.isMeter),\n u_blur: blur,\n\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n u_globel: this.mapService.version === Version.GLOBEL ? 1 : 0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_stroke_opacity: isNumber(strokeOpacity) ? strokeOpacity : 1.0,\n u_stroke_width: isNumber(strokeWidth) ? strokeWidth : 0.0,\n u_stroke_color: this.getStrokeColor(stroke),\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const {\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as Partial<\n ILayerConfig & IPointLayerStyleOptions\n >;\n const { frag, vert, type } = this.getShaders(animateOption);\n\n // TODO: 判断当前的点图层的模型是普通地图模式还是地球模式\n const isGlobel = this.mapService.version === 'GLOBEL';\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: isGlobel\n ? GlobelPointFillTriangulation\n : PointFillTriangulation,\n // depth: { enable: false },\n depth: { enable: isGlobel },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(\n animateOption: Partial<IAnimateOption>,\n ): { frag: string; vert: string; type: string } {\n if (animateOption.enable) {\n switch (animateOption.type) {\n case 'wave':\n return {\n frag: waveFillFrag,\n vert: pointFillVert,\n type: 'wave',\n };\n default:\n return {\n frag: waveFillFrag,\n vert: pointFillVert,\n type: 'wave',\n };\n }\n } else {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'normal',\n };\n }\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected animateOption2Array(option: Partial<IAnimateOption>): number[] {\n return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];\n }\n protected registerBuiltinAttributes() {\n // TODO: 判断当前的点图层的模型是普通地图模式还是地球模式\n const isGlobel = this.mapService.version === 'GLOBEL';\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\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: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n let extrude;\n // 地球模式\n if (isGlobel) {\n const [x, y, z] = vertex;\n const n1 = vec3.fromValues(0, 0, 1);\n const n2 = vec3.fromValues(x, 0, z);\n\n const xzReg =\n x >= 0 ? vec3.angle(n1, n2) : Math.PI * 2 - vec3.angle(n1, n2);\n\n const yReg = Math.PI * 2 - Math.asin(y / 100);\n\n const m = mat4.create();\n mat4.rotateY(m, m, xzReg);\n mat4.rotateX(m, m, yReg);\n\n const v1 = vec3.fromValues(1, 1, 0);\n vec3.transformMat4(v1, v1, m);\n vec3.normalize(v1, v1);\n\n const v2 = vec3.fromValues(-1, 1, 0);\n vec3.transformMat4(v2, v2, m);\n vec3.normalize(v2, v2);\n\n const v3 = vec3.fromValues(-1, -1, 0);\n vec3.transformMat4(v3, v3, m);\n vec3.normalize(v3, v3);\n\n const v4 = vec3.fromValues(1, -1, 0);\n vec3.transformMat4(v4, v4, m);\n vec3.normalize(v4, v4);\n\n extrude = [...v1, ...v2, ...v3, ...v4];\n } else {\n // 平面模式\n extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n }\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\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 = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'shape',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Shape',\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 { shape = 2 } = feature;\n const shape2d = this.layer.getLayerConfig().shape2d as string[];\n const shapeIndex = shape2d.indexOf(shape as string);\n return [shapeIndex];\n },\n },\n });\n }\n}\n"],"file":"fill.js"}
1
+ {"version":3,"sources":["../../../src/point/models/fill.ts"],"names":["AttributeType","gl","getCullFace","getMask","BaseModel","GlobelPointFillTriangulation","PointFillTriangulation","Version","mat4","vec3","FillModel","layer","getLayerConfig","opacity","strokeOpacity","strokeWidth","stroke","offsets","blend","blur","raisingHeight","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","LUMINANCE","type","FLOAT","u_raisingHeight","Number","u_isMeter","isMeter","u_blur","u_additive","u_globel","mapService","version","GLOBEL","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_stroke_opacity","u_stroke_width","u_stroke_color","getStrokeColor","u_offsets","isOffsetStatic","animateOption","enable","u_aimate","animateOption2Array","u_time","getLayerAnimateTime","styleAttributeService","createAttributesAndIndices","unit","L7MAP","calMeter2Coord","buildModels","getSource","extent","minLng","minLat","maxLng","maxLat","center","MAPBOX","window","mapboxgl","MercatorCoordinate","coord","fromLngLat","lng","lat","offsetInMeters","offsetInMercatorCoordinateUnits","meterInMercatorCoordinateUnits","westCoord","x","y","z","westLnglat","toLngLat","meter2coord","m1","meterToCoord","m2","Boolean","mask","maskInside","getShaders","frag","vert","isGlobel","buildLayerModel","moduleName","vertexShader","fragmentShader","triangulation","depth","getBlend","stencil","cull","face","waveFillFrag","pointFillVert","pointFillFrag","destroy","option","speed","rings","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","extrude","n1","fromValues","n2","xzReg","angle","Math","PI","yReg","asin","m","create","rotateY","rotateX","v1","transformMat4","normalize","v2","v3","v4","extrudeIndex","Array","isArray","shape","shape2d","shapeIndex","indexOf"],"mappings":";;;;;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAUO,eAVP;AAWA,SAASC,WAAT,EAAsBC,OAAtB,QAAqC,gBAArC;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SACEC,4BADF,EAEEC,sBAFF,QAGO,0BAHP;;;;AAYA,SAASC,OAAT,QAAwB,eAAxB;AACA,SAASC,IAAT,EAAeC,IAAf,QAA2B,WAA3B;;IACqBC,S;;;;;;;;;;;;;;;;kEACU,C;;8DACF,K;;;;;;;WAC3B,wBAAqC;AACnC,iBASI,KAAKC,KAAL,CAAWC,cAAX,EATJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,oCAEEC,aAFF;AAAA,UAEEA,aAFF,mCAEkB,CAFlB;AAAA,kCAGEC,WAHF;AAAA,UAGEA,WAHF,iCAGgB,CAHhB;AAAA,6BAIEC,MAJF;AAAA,UAIEA,MAJF,4BAIW,eAJX;AAAA,8BAKEC,OALF;AAAA,UAKEA,OALF,6BAKY,CAAC,CAAD,EAAI,CAAJ,CALZ;AAAA,UAMEC,KANF,QAMEA,KANF;AAAA,2BAOEC,IAPF;AAAA,UAOEA,IAPF,0BAOS,CAPT;AAAA,oCAQEC,aARF;AAAA,UAQEA,aARF,mCAQkB,CARlB;;AAWA,UACE,KAAKC,eAAL,IACA,KAAKC,qBAAL,CAA2B;AACzBT,QAAAA,OAAO,EAAPA,OADyB;AAEzBC,QAAAA,aAAa,EAAbA,aAFyB;AAGzBC,QAAAA,WAAW,EAAXA,WAHyB;AAIzBC,QAAAA,MAAM,EAANA,MAJyB;AAKzBC,QAAAA,OAAO,EAAPA;AALyB,OAA3B,CAFF,EASE;AAEA,aAAKM,oBAAL,CAA0B;AACxBV,UA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,CAACnC,WAAzB,CAFJ;AAGD;AApBS;AAHoC,OAAlD;AA4BA,WAAK9B,qBAAL,CAA2B0D,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,OAD0C;AAEhDvF,QAAAA,IAAI,EAAEvC,aAAa,CAAC+H,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,SADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAEjI,EAAE,CAACkI,YAFJ;AAGNtG,YAAAA,IAAI,EAAE,EAHA;AAINU,YAAAA,IAAI,EAAEtC,EAAE,CAACuC;AAJH,WAFE;AAQV4F,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,iCAAsBH,OAAtB,CAAQ2B,KAAR;AAAA,gBAAQA,KAAR,+BAAgB,CAAhB;;AACA,gBAAMC,OAAO,GAAG,MAAI,CAACvJ,KAAL,CAAWC,cAAX,GAA4BsJ,OAA5C;;AACA,gBAAMC,UAAU,GAAGD,OAAO,CAACE,OAAR,CAAgBH,KAAhB,CAAnB;AACA,mBAAO,CAACE,UAAD,CAAP;AACD;AAnBS;AAHoC,OAAlD;AAyBD;;;;EAtWoC/J,S;;SAAlBM,S","sourcesContent":["import {\n AttributeType,\n gl,\n IAnimateOption,\n IAttribute,\n IElements,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getCullFace, getMask } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IPointLayerStyleOptions } from '../../core/interface';\nimport {\n GlobelPointFillTriangulation,\n PointFillTriangulation,\n} from '../../core/triangulation';\n// animate pointLayer shader - support animate\nimport waveFillFrag from '../shaders/animate/wave_frag.glsl';\n// static pointLayer shader - not support animate\nimport pointFillFrag from '../shaders/fill_frag.glsl';\nimport pointFillVert from '../shaders/fill_vert.glsl';\n\nimport { isNumber } from 'lodash';\n\nimport { Version } from '@antv/l7-maps';\nimport { mat4, vec3 } from 'gl-matrix';\nexport default class FillModel extends BaseModel {\n public meter2coord: number = 1;\n private isMeter: boolean = false;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n strokeOpacity = 1,\n strokeWidth = 0,\n stroke = 'rgba(0,0,0,0)',\n offsets = [0, 0],\n blend,\n blur = 0,\n raisingHeight = 0,\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n\n if (\n this.dataTextureTest &&\n this.dataTextureNeedUpdate({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n })\n ) {\n // 判断当前的样式中哪些是需要进行数据映射的,哪些是常量,同时计算用于构建数据纹理的一些中间变量\n this.judgeStyleAttributes({\n opacity,\n strokeOpacity,\n strokeWidth,\n stroke,\n offsets,\n });\n\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 return {\n u_raisingHeight: Number(raisingHeight),\n\n u_isMeter: Number(this.isMeter),\n u_blur: blur,\n\n u_additive: blend === 'additive' ? 1.0 : 0.0,\n u_globel: this.mapService.version === Version.GLOBEL ? 1 : 0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n u_stroke_opacity: isNumber(strokeOpacity) ? strokeOpacity : 1.0,\n u_stroke_width: isNumber(strokeWidth) ? strokeWidth : 0.0,\n u_stroke_color: this.getStrokeColor(stroke),\n u_offsets: this.isOffsetStatic(offsets)\n ? (offsets as [number, number])\n : [0, 0],\n };\n }\n public getAnimateUniforms(): IModelUniform {\n const {\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as ILayerConfig;\n return {\n u_aimate: this.animateOption2Array(animateOption),\n u_time: this.layer.getLayerAnimateTime(),\n };\n }\n\n public getAttribute(): {\n attributes: {\n [attributeName: string]: IAttribute;\n };\n elements: IElements;\n } {\n return this.styleAttributeService.createAttributesAndIndices(\n this.layer.getEncodedData(),\n PointFillTriangulation,\n );\n }\n\n public initModels(): IModel[] {\n const {\n unit = 'l7size',\n } = this.layer.getLayerConfig() as IPointLayerStyleOptions;\n const { version } = this.mapService;\n if (\n unit === 'meter' &&\n version !== Version.L7MAP &&\n version !== Version.GLOBEL\n ) {\n this.isMeter = true;\n this.calMeter2Coord();\n }\n\n return this.buildModels();\n }\n\n /**\n * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例\n * @returns\n */\n public calMeter2Coord() {\n // @ts-ignore\n const [minLng, minLat, maxLng, maxLat] = this.layer.getSource().extent;\n const center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];\n\n const { version } = this.mapService;\n if (version === Version.MAPBOX && window.mapboxgl.MercatorCoordinate) {\n const coord = window.mapboxgl.MercatorCoordinate.fromLngLat(\n { lng: center[0], lat: center[1] },\n 0,\n );\n const offsetInMeters = 1;\n const offsetInMercatorCoordinateUnits =\n offsetInMeters * coord.meterInMercatorCoordinateUnits();\n const westCoord = new window.mapboxgl.MercatorCoordinate(\n coord.x - offsetInMercatorCoordinateUnits,\n coord.y,\n coord.z,\n );\n const westLnglat = westCoord.toLngLat();\n\n this.meter2coord = center[0] - westLnglat.lng;\n return;\n }\n\n // @ts-ignore\n const m1 = this.mapService.meterToCoord(center, [minLng, minLat]);\n // @ts-ignore\n const m2 = this.mapService.meterToCoord(center, [\n maxLng === minLng ? maxLng + 0.1 : maxLng,\n maxLat === minLat ? minLat + 0.1 : maxLat,\n ]);\n this.meter2coord = (m1 + m2) / 2;\n if (!Boolean(this.meter2coord)) {\n // Tip: 兼容单个数据导致的 m1、m2 为 NaN\n this.meter2coord = 7.70681090738883;\n }\n }\n\n public buildModels(): IModel[] {\n const {\n mask = false,\n maskInside = true,\n animateOption = { enable: false },\n } = this.layer.getLayerConfig() as Partial<\n ILayerConfig & IPointLayerStyleOptions\n >;\n const { frag, vert, type } = this.getShaders(animateOption);\n\n // TODO: 判断当前的点图层的模型是普通地图模式还是地球模式\n const isGlobel = this.mapService.version === 'GLOBEL';\n return [\n this.layer.buildLayerModel({\n moduleName: 'pointfill_' + type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: isGlobel\n ? GlobelPointFillTriangulation\n : PointFillTriangulation,\n // depth: { enable: false },\n depth: { enable: isGlobel },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n cull: {\n enable: true,\n face: getCullFace(this.mapService.version),\n },\n }),\n ];\n }\n\n /**\n * 根据 animateOption 的值返回对应的 shader 代码\n * @returns\n */\n public getShaders(\n animateOption: Partial<IAnimateOption>,\n ): { frag: string; vert: string; type: string } {\n if (animateOption.enable) {\n switch (animateOption.type) {\n case 'wave':\n return {\n frag: waveFillFrag,\n vert: pointFillVert,\n type: 'wave',\n };\n default:\n return {\n frag: waveFillFrag,\n vert: pointFillVert,\n type: 'wave',\n };\n }\n } else {\n return {\n frag: pointFillFrag,\n vert: pointFillVert,\n type: 'normal',\n };\n }\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\n }\n\n // overwrite baseModel func\n protected animateOption2Array(option: Partial<IAnimateOption>): number[] {\n return [option.enable ? 0 : 1.0, option.speed || 1, option.rings || 3, 0];\n }\n protected registerBuiltinAttributes() {\n // TODO: 判断当前的点图层的模型是普通地图模式还是地球模式\n const isGlobel = this.mapService.version === 'GLOBEL';\n\n this.styleAttributeService.registerStyleAttribute({\n name: 'extrude',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Extrude',\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: 3,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n let extrude;\n // 地球模式\n if (isGlobel) {\n const [x, y, z] = vertex;\n const n1 = vec3.fromValues(0, 0, 1);\n const n2 = vec3.fromValues(x, 0, z);\n\n const xzReg =\n x >= 0 ? vec3.angle(n1, n2) : Math.PI * 2 - vec3.angle(n1, n2);\n\n const yReg = Math.PI * 2 - Math.asin(y / 100);\n\n const m = mat4.create();\n mat4.rotateY(m, m, xzReg);\n mat4.rotateX(m, m, yReg);\n\n const v1 = vec3.fromValues(1, 1, 0);\n vec3.transformMat4(v1, v1, m);\n vec3.normalize(v1, v1);\n\n const v2 = vec3.fromValues(-1, 1, 0);\n vec3.transformMat4(v2, v2, m);\n vec3.normalize(v2, v2);\n\n const v3 = vec3.fromValues(-1, -1, 0);\n vec3.transformMat4(v3, v3, m);\n vec3.normalize(v3, v3);\n\n const v4 = vec3.fromValues(1, -1, 0);\n vec3.transformMat4(v4, v4, m);\n vec3.normalize(v4, v4);\n\n extrude = [...v1, ...v2, ...v3, ...v4];\n } else {\n // 平面模式\n extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];\n }\n\n const extrudeIndex = (attributeIdx % 4) * 3;\n return [\n extrude[extrudeIndex],\n extrude[extrudeIndex + 1],\n extrude[extrudeIndex + 2],\n ];\n },\n },\n });\n\n // point layer size;\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 = 5 } = feature;\n // console.log('featureIdx', featureIdx, feature)\n return Array.isArray(size)\n ? [size[0] * this.meter2coord]\n : [(size as number) * this.meter2coord];\n },\n },\n });\n\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'shape',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Shape',\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 { shape = 2 } = feature;\n const shape2d = this.layer.getLayerConfig().shape2d as string[];\n const shapeIndex = shape2d.indexOf(shape as string);\n return [shapeIndex];\n },\n },\n });\n }\n}\n"],"file":"fill.js"}
@@ -3,11 +3,14 @@ import BaseModel from '../../core/BaseModel';
3
3
  export default class ExtrudeModel extends BaseModel {
4
4
  protected texture: ITexture2D;
5
5
  getUninforms(): {
6
+ u_topsurface: number;
7
+ u_sidesurface: number;
6
8
  u_heightfixed: number;
7
9
  u_dataTexture: ITexture2D;
8
10
  u_cellTypeLayout: number[];
9
11
  u_raisingHeight: number;
10
12
  u_opacity: number;
13
+ u_linearColor: number;
11
14
  u_sourceColor: number[];
12
15
  u_targetColor: number[];
13
16
  u_texture: ITexture2D;