@antv/l7-layers 2.8.43 → 2.9.0

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.
Files changed (179) hide show
  1. package/es/core/BaseLayer.d.ts +3 -1
  2. package/es/core/BaseLayer.js +23 -3
  3. package/es/core/BaseLayer.js.map +1 -1
  4. package/es/core/BaseModel.d.ts +2 -1
  5. package/es/core/BaseModel.js +3 -0
  6. package/es/core/BaseModel.js.map +1 -1
  7. package/es/core/interface.d.ts +12 -0
  8. package/es/core/interface.js.map +1 -1
  9. package/es/image/models/image.js.map +1 -1
  10. package/es/line/index.d.ts +1 -1
  11. package/es/line/index.js +7 -1
  12. package/es/line/index.js.map +1 -1
  13. package/es/line/models/index.d.ts +1 -1
  14. package/es/line/models/index.js +5 -1
  15. package/es/line/models/index.js.map +1 -1
  16. package/es/line/models/tile.d.ts +20 -0
  17. package/es/line/models/tile.js +327 -0
  18. package/es/line/models/tile.js.map +1 -0
  19. package/es/plugins/ShaderUniformPlugin.js +3 -1
  20. package/es/plugins/ShaderUniformPlugin.js.map +1 -1
  21. package/es/point/index.d.ts +1 -1
  22. package/es/point/index.js +8 -2
  23. package/es/point/index.js.map +1 -1
  24. package/es/point/models/index.d.ts +1 -1
  25. package/es/point/models/index.js +5 -1
  26. package/es/point/models/index.js.map +1 -1
  27. package/es/point/models/tile.d.ts +31 -0
  28. package/es/point/models/tile.js +291 -0
  29. package/es/point/models/tile.js.map +1 -0
  30. package/es/polygon/index.js +6 -0
  31. package/es/polygon/index.js.map +1 -1
  32. package/es/polygon/models/extrude.js +1 -5
  33. package/es/polygon/models/extrude.js.map +1 -1
  34. package/es/polygon/models/fill.js +0 -4
  35. package/es/polygon/models/fill.js.map +1 -1
  36. package/es/polygon/models/index.d.ts +1 -1
  37. package/es/polygon/models/index.js +5 -1
  38. package/es/polygon/models/index.js.map +1 -1
  39. package/es/polygon/models/tile.d.ts +16 -0
  40. package/es/polygon/models/tile.js +137 -0
  41. package/es/polygon/models/tile.js.map +1 -0
  42. package/es/raster/index.d.ts +2 -2
  43. package/es/raster/index.js +4 -4
  44. package/es/raster/index.js.map +1 -1
  45. package/es/raster/models/index.js +1 -1
  46. package/es/raster/models/index.js.map +1 -1
  47. package/es/raster/models/raster.d.ts +1 -0
  48. package/es/raster/models/raster.js +8 -2
  49. package/es/raster/models/raster.js.map +1 -1
  50. package/es/tile/interface.d.ts +28 -0
  51. package/es/tile/interface.js +2 -0
  52. package/es/tile/interface.js.map +1 -0
  53. package/es/tile/manager/tileConfigManager.d.ts +17 -0
  54. package/es/tile/manager/tileConfigManager.js +123 -0
  55. package/es/tile/manager/tileConfigManager.js.map +1 -0
  56. package/es/tile/manager/tileLayerManager.d.ts +34 -0
  57. package/es/tile/manager/tileLayerManager.js +283 -0
  58. package/es/tile/manager/tileLayerManager.js.map +1 -0
  59. package/es/tile/manager/tilePickerManager.d.ts +20 -0
  60. package/es/tile/manager/tilePickerManager.js +164 -0
  61. package/es/tile/manager/tilePickerManager.js.map +1 -0
  62. package/es/tile/models/tileModel.d.ts +8 -0
  63. package/es/tile/models/tileModel.js +61 -0
  64. package/es/tile/models/tileModel.js.map +1 -0
  65. package/es/tile/tileFactory/base.d.ts +40 -0
  66. package/es/tile/tileFactory/base.js +352 -0
  67. package/es/tile/tileFactory/base.js.map +1 -0
  68. package/es/tile/tileFactory/index.d.ts +5 -0
  69. package/es/tile/tileFactory/index.js +30 -0
  70. package/es/tile/tileFactory/index.js.map +1 -0
  71. package/es/tile/tileFactory/line.d.ts +12 -0
  72. package/es/tile/tileFactory/line.js +65 -0
  73. package/es/tile/tileFactory/line.js.map +1 -0
  74. package/es/tile/tileFactory/point.d.ts +12 -0
  75. package/es/tile/tileFactory/point.js +65 -0
  76. package/es/tile/tileFactory/point.js.map +1 -0
  77. package/es/tile/tileFactory/polygon.d.ts +12 -0
  78. package/es/tile/tileFactory/polygon.js +65 -0
  79. package/es/tile/tileFactory/polygon.js.map +1 -0
  80. package/es/tile/tileFactory/raster.d.ts +12 -0
  81. package/es/tile/tileFactory/raster.js +61 -0
  82. package/es/tile/tileFactory/raster.js.map +1 -0
  83. package/es/tile/tileFactory/rasterData.d.ts +12 -0
  84. package/es/tile/tileFactory/rasterData.js +75 -0
  85. package/es/tile/tileFactory/rasterData.js.map +1 -0
  86. package/es/tile/tileFactory/rasterDataLayer.d.ts +19 -0
  87. package/es/{core/LayerGroup.js → tile/tileFactory/rasterDataLayer.js} +39 -32
  88. package/es/tile/tileFactory/rasterDataLayer.js.map +1 -0
  89. package/es/tile/tileFactory/vectorLayer.d.ts +27 -0
  90. package/es/tile/tileFactory/vectorLayer.js +131 -0
  91. package/es/tile/tileFactory/vectorLayer.js.map +1 -0
  92. package/es/tile/tileLayer/baseTileLayer.d.ts +51 -0
  93. package/es/tile/tileLayer/baseTileLayer.js +409 -0
  94. package/es/tile/tileLayer/baseTileLayer.js.map +1 -0
  95. package/es/tile/tmsTileLayer.d.ts +7 -0
  96. package/es/tile/tmsTileLayer.js +94 -0
  97. package/es/tile/tmsTileLayer.js.map +1 -0
  98. package/es/tile/utils.d.ts +11 -0
  99. package/es/tile/utils.js +120 -0
  100. package/es/tile/utils.js.map +1 -0
  101. package/lib/core/BaseLayer.js +21 -2
  102. package/lib/core/BaseLayer.js.map +1 -1
  103. package/lib/core/BaseModel.js +2 -0
  104. package/lib/core/BaseModel.js.map +1 -1
  105. package/lib/core/interface.js.map +1 -1
  106. package/lib/image/models/image.js.map +1 -1
  107. package/lib/line/index.js +7 -1
  108. package/lib/line/index.js.map +1 -1
  109. package/lib/line/models/index.js +7 -1
  110. package/lib/line/models/index.js.map +1 -1
  111. package/lib/line/models/tile.js +342 -0
  112. package/lib/line/models/tile.js.map +1 -0
  113. package/lib/plugins/ShaderUniformPlugin.js +3 -1
  114. package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
  115. package/lib/point/index.js +8 -2
  116. package/lib/point/index.js.map +1 -1
  117. package/lib/point/models/index.js +7 -1
  118. package/lib/point/models/index.js.map +1 -1
  119. package/lib/point/models/tile.js +308 -0
  120. package/lib/point/models/tile.js.map +1 -0
  121. package/lib/polygon/index.js +6 -0
  122. package/lib/polygon/index.js.map +1 -1
  123. package/lib/polygon/models/extrude.js +1 -5
  124. package/lib/polygon/models/extrude.js.map +1 -1
  125. package/lib/polygon/models/fill.js +0 -4
  126. package/lib/polygon/models/fill.js.map +1 -1
  127. package/lib/polygon/models/index.js +7 -1
  128. package/lib/polygon/models/index.js.map +1 -1
  129. package/lib/polygon/models/tile.js +152 -0
  130. package/lib/polygon/models/tile.js.map +1 -0
  131. package/lib/raster/index.js +4 -4
  132. package/lib/raster/index.js.map +1 -1
  133. package/lib/raster/models/index.js +2 -2
  134. package/lib/raster/models/index.js.map +1 -1
  135. package/lib/raster/models/raster.js +8 -2
  136. package/lib/raster/models/raster.js.map +1 -1
  137. package/lib/tile/interface.js +2 -0
  138. package/lib/tile/interface.js.map +1 -0
  139. package/lib/tile/manager/tileConfigManager.js +134 -0
  140. package/lib/tile/manager/tileConfigManager.js.map +1 -0
  141. package/lib/tile/manager/tileLayerManager.js +291 -0
  142. package/lib/tile/manager/tileLayerManager.js.map +1 -0
  143. package/lib/tile/manager/tilePickerManager.js +170 -0
  144. package/lib/tile/manager/tilePickerManager.js.map +1 -0
  145. package/lib/tile/models/tileModel.js +73 -0
  146. package/lib/tile/models/tileModel.js.map +1 -0
  147. package/lib/tile/tileFactory/base.js +366 -0
  148. package/lib/tile/tileFactory/base.js.map +1 -0
  149. package/lib/tile/tileFactory/index.js +60 -0
  150. package/lib/tile/tileFactory/index.js.map +1 -0
  151. package/lib/tile/tileFactory/line.js +76 -0
  152. package/lib/tile/tileFactory/line.js.map +1 -0
  153. package/lib/tile/tileFactory/point.js +76 -0
  154. package/lib/tile/tileFactory/point.js.map +1 -0
  155. package/lib/tile/tileFactory/polygon.js +76 -0
  156. package/lib/tile/tileFactory/polygon.js.map +1 -0
  157. package/lib/tile/tileFactory/raster.js +74 -0
  158. package/lib/tile/tileFactory/raster.js.map +1 -0
  159. package/lib/tile/tileFactory/rasterData.js +88 -0
  160. package/lib/tile/tileFactory/rasterData.js.map +1 -0
  161. package/lib/{core/LayerGroup.js → tile/tileFactory/rasterDataLayer.js} +40 -32
  162. package/lib/tile/tileFactory/rasterDataLayer.js.map +1 -0
  163. package/lib/tile/tileFactory/vectorLayer.js +145 -0
  164. package/lib/tile/tileFactory/vectorLayer.js.map +1 -0
  165. package/lib/tile/tileLayer/baseTileLayer.js +408 -0
  166. package/lib/tile/tileLayer/baseTileLayer.js.map +1 -0
  167. package/lib/tile/tmsTileLayer.js +109 -0
  168. package/lib/tile/tmsTileLayer.js.map +1 -0
  169. package/lib/tile/utils.js +142 -0
  170. package/lib/tile/utils.js.map +1 -0
  171. package/package.json +7 -5
  172. package/es/core/LayerGroup.d.ts +0 -9
  173. package/es/core/LayerGroup.js.map +0 -1
  174. package/es/raster/models/raste-tile.d.ts +0 -23
  175. package/es/raster/models/raste-tile.js +0 -285
  176. package/es/raster/models/raste-tile.js.map +0 -1
  177. package/lib/core/LayerGroup.js.map +0 -1
  178. package/lib/raster/models/raste-tile.js +0 -294
  179. package/lib/raster/models/raste-tile.js.map +0 -1
@@ -13,6 +13,8 @@ interface ILineArrow {
13
13
  tailWidth: number;
14
14
  }
15
15
  export interface ILineLayerStyleOptions {
16
+ tileOrigin?: number[];
17
+ coord?: string;
16
18
  opacity: styleSingle;
17
19
  lineType?: keyof typeof lineStyleType;
18
20
  dashArray?: [number, number];
@@ -36,8 +38,12 @@ export interface ILineLayerStyleOptions {
36
38
  maskInside?: boolean;
37
39
  arrow?: ILineArrow;
38
40
  rampColors?: IColorRamp;
41
+ featureId?: string;
42
+ sourceLayer?: string;
39
43
  }
40
44
  export interface IPointLayerStyleOptions {
45
+ tileOrigin?: number[];
46
+ coord?: string;
41
47
  opacity: number;
42
48
  strokeOpacity: number;
43
49
  strokeWidth: number;
@@ -70,8 +76,12 @@ export interface IPointLayerStyleOptions {
70
76
  maskInside?: boolean;
71
77
  rotation?: number;
72
78
  speed?: number;
79
+ featureId?: string;
80
+ sourceLayer?: string;
73
81
  }
74
82
  export interface IPolygonLayerStyleOptions {
83
+ tileOrigin?: number[];
84
+ coord?: string;
75
85
  opacity?: number;
76
86
  opacityLinear?: {
77
87
  enable: boolean;
@@ -91,6 +101,8 @@ export interface IPolygonLayerStyleOptions {
91
101
  speed?: number;
92
102
  watercolor?: string;
93
103
  watercolor2?: string;
104
+ featureId?: string;
105
+ sourceLayer?: string;
94
106
  }
95
107
  export interface IRasterTileLayerStyleOptions {
96
108
  zIndex?: number;
@@ -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;;AA2LZ,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 rampColors?: IColorRamp;\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?: number;\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\n// 栅格瓦片图层\nexport interface IRasterTileLayerStyleOptions {\n // TODO: define\n zIndex?: number;\n opacity?: number;\n}\nexport interface IMaskLayerStyleOptions {\n opacity: styleSingle;\n}\n\nexport interface IWindLayerStyleOptions {\n uMin?: number;\n uMax?: number;\n vMin?: number;\n vMax?: number;\n fadeOpacity?: number;\n speedFactor?: number;\n dropRate?: number;\n dropRateBump?: number;\n opacity?: number;\n numParticles?: number;\n rampColors?: {\n [key: number]: string;\n };\n sizeScale?: number;\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 // billboard\n raisingHeight?: number; // 抬升高度\n canvasWidth?: number;\n canvasHeight?: number;\n drawCanvas?: (canvas: HTMLCanvasElement) => void;\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;;AAyMZ,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 tileOrigin?: number[];\n coord?: string;\n\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 rampColors?: IColorRamp;\n featureId?: string;\n sourceLayer?: string;\n}\n\nexport interface IPointLayerStyleOptions {\n tileOrigin?: number[];\n coord?: string;\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 featureId?: string;\n sourceLayer?: string;\n}\n\nexport interface IPolygonLayerStyleOptions {\n tileOrigin?: number[];\n coord?: string;\n opacity?: number;\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 featureId?: string;\n sourceLayer?: string;\n}\n\n// 栅格瓦片图层\nexport interface IRasterTileLayerStyleOptions {\n // TODO: define\n zIndex?: number;\n opacity?: number;\n}\nexport interface IMaskLayerStyleOptions {\n opacity: styleSingle;\n}\n\nexport interface IWindLayerStyleOptions {\n uMin?: number;\n uMax?: number;\n vMin?: number;\n vMax?: number;\n fadeOpacity?: number;\n speedFactor?: number;\n dropRate?: number;\n dropRateBump?: number;\n opacity?: number;\n numParticles?: number;\n rampColors?: {\n [key: number]: string;\n };\n sizeScale?: number;\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 // billboard\n raisingHeight?: number; // 抬升高度\n canvasWidth?: number;\n canvasHeight?: number;\n drawCanvas?: (canvas: HTMLCanvasElement) => void;\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 +1 @@
1
- {"version":3,"sources":["../../../src/image/models/image.ts"],"names":["AttributeType","gl","getMask","isMini","BaseModel","RasterImageTriangulation","ImageModel","layer","getLayerConfig","opacity","u_opacity","u_texture","texture","mask","maskInside","source","getSource","createTexture2D","rendererService","height","width","canvas","layerService","sceneService","getSceneConfig","img","createImage","crossOrigin","src","data","originData","onload","updateLayerRenderList","renderLayers","images","then","imageData","buildLayerModel","moduleName","vertexShader","ImageVert","fragmentShader","ImageFrag","triangulation","primitive","TRIANGLES","depth","enable","blend","getBlend","stencil","initModels","properties","type","minimum","maximum","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","FLOAT","size","update","feature","featureIdx","vertex","attributeIdx"],"mappings":";;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAMO,eANP;AAOA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,gBAAhC;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,wBAAT,QAAyC,0BAAzC;;;;IAIqBC,U;;;;;;;;;;;;;;;;;;;;;;;WAEnB,wBAAqC;AACnC,iBAAoB,KAAKC,KAAL,CAAWC,cAAX,EAApB;AAAA,UAAQC,OAAR,QAAQA,OAAR;;AACA,aAAO;AACLC,QAAAA,SAAS,EAAED,OAAO,IAAI,CADjB;AAELE,QAAAA,SAAS,EAAE,KAAKC;AAFX,OAAP;AAID;;;WACD,sBAAoB;AA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lC,YAAAA,IAAI,EAAE,EAHA;AAINwB,YAAAA,IAAI,EAAEpD,EAAE,CAAC+D;AAJH,WAFE;AAQVC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EAvGqCjE,S;;SAAnBE,U","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, isMini } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IImageLayerStyleOptions } from '../../core/interface';\nimport { RasterImageTriangulation } from '../../core/triangulation';\nimport ImageFrag from '../shaders/image_frag.glsl';\nimport ImageVert from '../shaders/image_vert.glsl';\n\nexport default class ImageModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const { opacity } = this.layer.getLayerConfig() as IImageLayerStyleOptions;\n return {\n u_opacity: opacity || 1,\n u_texture: this.texture,\n };\n }\n public initModels() {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IImageLayerStyleOptions;\n\n const source = this.layer.getSource();\n const { createTexture2D } = this.rendererService;\n this.texture = createTexture2D({\n height: 0,\n width: 0,\n });\n\n if (isMini) {\n // @ts-ignore\n const canvas = this.layerService.sceneService.getSceneConfig().canvas;\n const img = canvas.createImage();\n img.crossOrigin = 'anonymous';\n img.src = source.data.originData;\n\n img.onload = () => {\n this.texture = createTexture2D({\n data: img,\n width: img.width,\n height: img.height,\n });\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n };\n } else {\n source.data.images.then((imageData: HTMLImageElement[]) => {\n this.texture = createTexture2D({\n data: imageData[0],\n width: imageData[0].width,\n height: imageData[0].height,\n });\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n });\n }\n\n return [\n this.layer.buildLayerModel({\n moduleName: 'RasterImage',\n vertexShader: ImageVert,\n fragmentShader: ImageFrag,\n triangulation: RasterImageTriangulation,\n primitive: gl.TRIANGLES,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n public buildModels() {\n return this.initModels();\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4]];\n },\n },\n });\n }\n}\n"],"file":"image.js"}
1
+ {"version":3,"sources":["../../../src/image/models/image.ts"],"names":["AttributeType","gl","getMask","isMini","BaseModel","RasterImageTriangulation","ImageModel","layer","getLayerConfig","opacity","u_opacity","u_texture","texture","mask","maskInside","source","getSource","createTexture2D","rendererService","height","width","canvas","layerService","sceneService","getSceneConfig","img","createImage","crossOrigin","src","data","originData","onload","updateLayerRenderList","renderLayers","images","then","imageData","buildLayerModel","moduleName","vertexShader","ImageVert","fragmentShader","ImageFrag","triangulation","primitive","TRIANGLES","depth","enable","blend","getBlend","stencil","initModels","properties","type","minimum","maximum","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","DYNAMIC_DRAW","FLOAT","size","update","feature","featureIdx","vertex","attributeIdx"],"mappings":";;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAMO,eANP;AAOA,SAASC,OAAT,EAAkBC,MAAlB,QAAgC,gBAAhC;AACA,OAAOC,SAAP,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HF;AADC;AADP,OAAP;AASD;;;WAED,qCAAsC;AAEpC,WAAKC,qBAAL,CAA2BC,sBAA3B,CAAkD;AAChDC,QAAAA,IAAI,EAAE,IAD0C;AAEhDL,QAAAA,IAAI,EAAErD,aAAa,CAAC2D,SAF4B;AAGhDC,QAAAA,UAAU,EAAE;AACVF,UAAAA,IAAI,EAAE,MADI;AAEVG,UAAAA,MAAM,EAAE;AAENC,YAAAA,KAAK,EAAE7D,EAAE,CAAC8D,YAFJ;AAGNlC,YAAAA,IAAI,EAAE,EAHA;AAINwB,YAAAA,IAAI,EAAEpD,EAAE,CAAC+D;AAJH,WAFE;AAQVC,UAAAA,IAAI,EAAE,CARI;AASVC,UAAAA,MAAM,EAAE,gBACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,EAAYA,MAAM,CAAC,CAAD,CAAlB,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;;EAzGqCjE,S;;SAAnBE,U","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\nimport { getMask, isMini } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { IImageLayerStyleOptions } from '../../core/interface';\nimport { RasterImageTriangulation } from '../../core/triangulation';\nimport ImageFrag from '../shaders/image_frag.glsl';\nimport ImageVert from '../shaders/image_vert.glsl';\n\nexport default class ImageModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const { opacity } = this.layer.getLayerConfig() as IImageLayerStyleOptions;\n return {\n u_opacity: opacity || 1,\n u_texture: this.texture,\n };\n }\n public initModels() {\n const {\n mask = false,\n maskInside = true,\n } = this.layer.getLayerConfig() as IImageLayerStyleOptions;\n\n const source = this.layer.getSource();\n const { createTexture2D } = this.rendererService;\n this.texture = createTexture2D({\n height: 0,\n width: 0,\n });\n\n if (isMini) {\n // @ts-ignore\n const canvas = this.layerService.sceneService.getSceneConfig().canvas;\n const img = canvas.createImage();\n img.crossOrigin = 'anonymous';\n img.src = source.data.originData;\n\n img.onload = () => {\n this.texture = createTexture2D({\n data: img,\n width: img.width,\n height: img.height,\n });\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n };\n } else {\n source.data.images.then(\n (imageData: Array<HTMLImageElement | ImageBitmap>) => {\n this.texture = createTexture2D({\n data: imageData[0],\n width: imageData[0].width,\n height: imageData[0].height,\n });\n this.layerService.updateLayerRenderList();\n this.layerService.renderLayers();\n },\n );\n }\n\n return [\n this.layer.buildLayerModel({\n moduleName: 'RasterImage',\n vertexShader: ImageVert,\n fragmentShader: ImageFrag,\n triangulation: RasterImageTriangulation,\n primitive: gl.TRIANGLES,\n depth: { enable: false },\n blend: this.getBlend(),\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n public buildModels() {\n return this.initModels();\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n\n protected registerBuiltinAttributes() {\n // point layer size;\n this.styleAttributeService.registerStyleAttribute({\n name: 'uv',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_Uv',\n buffer: {\n // give the WebGL driver a hint that this buffer may change\n usage: gl.DYNAMIC_DRAW,\n data: [],\n type: gl.FLOAT,\n },\n size: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n return [vertex[3], vertex[4]];\n },\n },\n });\n }\n}\n"],"file":"image.js"}
@@ -22,6 +22,6 @@ export default class LineLayer extends BaseLayer<ILineLayerStyleOptions> {
22
22
  blend: string;
23
23
  } | {
24
24
  blend: string;
25
- };
25
+ } | {} | {};
26
26
  protected getModelType(): LineModelType;
27
27
  }
package/es/line/index.js CHANGED
@@ -79,7 +79,9 @@ var LineLayer = function (_BaseLayer) {
79
79
  },
80
80
  greatcircle: {
81
81
  blend: 'additive'
82
- }
82
+ },
83
+ vectorline: {},
84
+ tileLine: {}
83
85
  };
84
86
  return defaultConfig[type];
85
87
  }
@@ -88,6 +90,10 @@ var LineLayer = function (_BaseLayer) {
88
90
  value: function getModelType() {
89
91
  var _shapeAttribute$scale;
90
92
 
93
+ if (this.layerSource.parser.type === 'mvt') {
94
+ return 'vectorline';
95
+ }
96
+
91
97
  var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
92
98
  var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
93
99
  return shape || 'line';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/line/index.ts"],"names":["BaseLayer","LineModels","LineLayer","shape","getModelType","layerModel","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","line","linearline","simple","wall","arc3d","blend","arc","arcmini","greatcircle","shapeAttribute","styleAttributeService","getLayerStyleAttribute","scale","field"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,mBAAtB;AAEA,OAAOC,UAAP,MAA0C,UAA1C;;IAEqBC,S;;;;;;;;;;;;;;;;2DACG,W;;;;;;;WAEtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIJ,UAAU,CAACE,KAAD,CAAd,CAAsB,IAAtB,CAAlB;AACA,WAAKG,MAAL,GAAc,KAAKD,UAAL,CAAgBE,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKD,UAAL,CAAgBG,WAAhB,EAAd;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKP,YAAL,EAAb;AACA,UAAMU,aAAa,GAAG;AACpBC,QAAAA,IAAI,EAAE,EADc;AAEpBC,QAAAA,UAAU,EAAE,EAFQ;AAGpBC,QAAAA,MAAM,EAAE,EAHY;AAIpBC,QAAAA,IAAI,EAAE,EAJc;AAKpBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,SALa;AAMpBC,QAAAA,GAAG,EAAE;AAAED,UAAAA,KAAK,EAAE;AAAT,SANe;AAOpBE,QAAAA,OAAO,EAAE;AAAEF,UAAAA,KAAK,EAAE;AAAT,SAPW;AAQpBG,QAAAA,WAAW,EAAE;AAAEH,UAAAA,KAAK,EAAE;AAAT;AARO,OAAtB;AAUA,aAAON,aAAa,CAACH,IAAD,CAApB;AACD;;;WACD,wBAAwC;AAAA;;AACtC,UAAMa,cAAc,GAAG,KAAKC,qBAAL,CAA2BC,sBAA3B,CACrB,OADqB,CAAvB;AAGA,UAAMvB,KAAK,GAAGqB,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEG,KAAnB,0DAAG,sBAAuBC,KAArC;AACA,aAAOzB,KAAK,IAAI,MAAhB;AACD;;;;EA3CoCH,S;;SAAlBE,S","sourcesContent":["import BaseLayer from '../core/BaseLayer';\nimport { ILineLayerStyleOptions } from '../core/interface';\nimport LineModels, { LineModelType } from './models';\n\nexport default class LineLayer extends BaseLayer<ILineLayerStyleOptions> {\n public type: string = 'LineLayer';\n\n public buildModels() {\n const shape = this.getModelType();\n this.layerModel = new LineModels[shape](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n protected getDefaultConfig() {\n const type = this.getModelType();\n const defaultConfig = {\n line: {},\n linearline: {},\n simple: {},\n wall: {},\n arc3d: { blend: 'additive' },\n arc: { blend: 'additive' },\n arcmini: { blend: 'additive' },\n greatcircle: { blend: 'additive' },\n };\n return defaultConfig[type];\n }\n protected getModelType(): LineModelType {\n const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute(\n 'shape',\n );\n const shape = shapeAttribute?.scale?.field as LineModelType;\n return shape || 'line';\n }\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../src/line/index.ts"],"names":["BaseLayer","LineModels","LineLayer","shape","getModelType","layerModel","models","initModels","buildModels","properties","opacity","type","minimum","maximum","defaultConfig","line","linearline","simple","wall","arc3d","blend","arc","arcmini","greatcircle","vectorline","tileLine","layerSource","parser","shapeAttribute","styleAttributeService","getLayerStyleAttribute","scale","field"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,SAAP,MAAsB,mBAAtB;AAEA,OAAOC,UAAP,MAA0C,UAA1C;;IAEqBC,S;;;;;;;;;;;;;;;;2DACG,W;;;;;;;WAEtB,uBAAqB;AACnB,UAAMC,KAAK,GAAG,KAAKC,YAAL,EAAd;AACA,WAAKC,UAAL,GAAkB,IAAIJ,UAAU,CAACE,KAAD,CAAd,CAAsB,IAAtB,CAAlB;AACA,WAAKG,MAAL,GAAc,KAAKD,UAAL,CAAgBE,UAAhB,EAAd;AACD;;;WACD,yBAAuB;AACrB,WAAKD,MAAL,GAAc,KAAKD,UAAL,CAAgBG,WAAhB,EAAd;AACD;;;WAED,2BAA4B;AAC1B,aAAO;AACLC,QAAAA,UAAU,EAAE;AACVC,UAAAA,OAAO,EAAE;AACPC,YAAAA,IAAI,EAAE,QADC;AAEPC,YAAAA,OAAO,EAAE,CAFF;AAGPC,YAAAA,OAAO,EAAE;AAHF;AADC;AADP,OAAP;AASD;;;WACD,4BAA6B;AAC3B,UAAMF,IAAI,GAAG,KAAKP,YAAL,EAAb;AACA,UAAMU,aAAa,GAAG;AACpBC,QAAAA,IAAI,EAAE,EADc;AAEpBC,QAAAA,UAAU,EAAE,EAFQ;AAGpBC,QAAAA,MAAM,EAAE,EAHY;AAIpBC,QAAAA,IAAI,EAAE,EAJc;AAKpBC,QAAAA,KAAK,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,SALa;AAMpBC,QAAAA,GAAG,EAAE;AAAED,UAAAA,KAAK,EAAE;AAAT,SANe;AAOpBE,QAAAA,OAAO,EAAE;AAAEF,UAAAA,KAAK,EAAE;AAAT,SAPW;AAQpBG,QAAAA,WAAW,EAAE;AAAEH,UAAAA,KAAK,EAAE;AAAT,SARO;AASpBI,QAAAA,UAAU,EAAE,EATQ;AAUpBC,QAAAA,QAAQ,EAAE;AAVU,OAAtB;AAYA,aAAOX,aAAa,CAACH,IAAD,CAApB;AACD;;;WACD,wBAAwC;AAAA;;AACtC,UAAI,KAAKe,WAAL,CAAiBC,MAAjB,CAAwBhB,IAAxB,KAAiC,KAArC,EAA4C;AAC1C,eAAO,YAAP;AACD;;AACD,UAAMiB,cAAc,GAAG,KAAKC,qBAAL,CAA2BC,sBAA3B,CACrB,OADqB,CAAvB;AAGA,UAAM3B,KAAK,GAAGyB,cAAH,aAAGA,cAAH,gDAAGA,cAAc,CAAEG,KAAnB,0DAAG,sBAAuBC,KAArC;AACA,aAAO7B,KAAK,IAAI,MAAhB;AACD;;;;EAhDoCH,S;;SAAlBE,S","sourcesContent":["import BaseLayer from '../core/BaseLayer';\nimport { ILineLayerStyleOptions } from '../core/interface';\nimport LineModels, { LineModelType } from './models';\n\nexport default class LineLayer extends BaseLayer<ILineLayerStyleOptions> {\n public type: string = 'LineLayer';\n\n public buildModels() {\n const shape = this.getModelType();\n this.layerModel = new LineModels[shape](this);\n this.models = this.layerModel.initModels();\n }\n public rebuildModels() {\n this.models = this.layerModel.buildModels();\n }\n\n protected getConfigSchema() {\n return {\n properties: {\n opacity: {\n type: 'number',\n minimum: 0,\n maximum: 1,\n },\n },\n };\n }\n protected getDefaultConfig() {\n const type = this.getModelType();\n const defaultConfig = {\n line: {},\n linearline: {},\n simple: {},\n wall: {},\n arc3d: { blend: 'additive' },\n arc: { blend: 'additive' },\n arcmini: { blend: 'additive' },\n greatcircle: { blend: 'additive' },\n vectorline: {},\n tileLine: {},\n };\n return defaultConfig[type];\n }\n protected getModelType(): LineModelType {\n if (this.layerSource.parser.type === 'mvt') {\n return 'vectorline';\n }\n const shapeAttribute = this.styleAttributeService.getLayerStyleAttribute(\n 'shape',\n );\n const shape = shapeAttribute?.scale?.field as LineModelType;\n return shape || 'line';\n }\n}\n"],"file":"index.js"}
@@ -1,4 +1,4 @@
1
- export declare type LineModelType = 'arc' | 'arcmini' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'linearline';
1
+ export declare type LineModelType = 'arc' | 'arcmini' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'linearline' | 'vectorline' | 'tileLine';
2
2
  declare const LineModels: {
3
3
  [key in LineModelType]: any;
4
4
  };
@@ -1,3 +1,4 @@
1
+ import LineTileModel from '../../tile/models/tileModel';
1
2
  import ArcModel from './arc';
2
3
  import Arc3DModel from './arc_3d';
3
4
  import ArcMiniModel from './arcmini';
@@ -5,6 +6,7 @@ import GreatCircleModel from './great_circle';
5
6
  import LineModel from './line';
6
7
  import LinearLine from './linearline';
7
8
  import SimpleLineModel from './simpleLine';
9
+ import TileLineModel from './tile';
8
10
  import LineWallModel from './wall';
9
11
  var LineModels = {
10
12
  arc: ArcModel,
@@ -14,7 +16,9 @@ var LineModels = {
14
16
  wall: LineWallModel,
15
17
  line: LineModel,
16
18
  simple: SimpleLineModel,
17
- linearline: LinearLine
19
+ linearline: LinearLine,
20
+ vectorline: LineTileModel,
21
+ tileLine: TileLineModel
18
22
  };
19
23
  export default LineModels;
20
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/models/index.ts"],"names":["ArcModel","Arc3DModel","ArcMiniModel","GreatCircleModel","LineModel","LinearLine","SimpleLineModel","LineWallModel","LineModels","arc","arcmini","arc3d","greatcircle","wall","line","simple","linearline"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,eAAP,MAA4B,cAA5B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AAYA,IAAMC,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAET,QAD6C;AAElDU,EAAAA,OAAO,EAAER,YAFyC;AAGlDS,EAAAA,KAAK,EAAEV,UAH2C;AAIlDW,EAAAA,WAAW,EAAET,gBAJqC;AAKlDU,EAAAA,IAAI,EAAEN,aAL4C;AAMlDO,EAAAA,IAAI,EAAEV,SAN4C;AAOlDW,EAAAA,MAAM,EAAET,eAP0C;AAQlDU,EAAAA,UAAU,EAAEX;AARsC,CAApD;AAWA,eAAeG,UAAf","sourcesContent":["import ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport GreatCircleModel from './great_circle';\nimport LineModel from './line';\nimport LinearLine from './linearline';\nimport SimpleLineModel from './simpleLine';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'simple'\n | 'line'\n | 'linearline';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n simple: SimpleLineModel,\n linearline: LinearLine,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineTileModel","ArcModel","Arc3DModel","ArcMiniModel","GreatCircleModel","LineModel","LinearLine","SimpleLineModel","TileLineModel","LineWallModel","LineModels","arc","arcmini","arc3d","greatcircle","wall","line","simple","linearline","vectorline","tileLine"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,6BAA1B;AACA,OAAOC,QAAP,MAAqB,OAArB;AACA,OAAOC,UAAP,MAAuB,UAAvB;AACA,OAAOC,YAAP,MAAyB,WAAzB;AACA,OAAOC,gBAAP,MAA6B,gBAA7B;AACA,OAAOC,SAAP,MAAsB,QAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,eAAP,MAA4B,cAA5B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AACA,OAAOC,aAAP,MAA0B,QAA1B;AAcA,IAAMC,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEV,QAD6C;AAElDW,EAAAA,OAAO,EAAET,YAFyC;AAGlDU,EAAAA,KAAK,EAAEX,UAH2C;AAIlDY,EAAAA,WAAW,EAAEV,gBAJqC;AAKlDW,EAAAA,IAAI,EAAEN,aAL4C;AAMlDO,EAAAA,IAAI,EAAEX,SAN4C;AAOlDY,EAAAA,MAAM,EAAEV,eAP0C;AAQlDW,EAAAA,UAAU,EAAEZ,UARsC;AASlDa,EAAAA,UAAU,EAAEnB,aATsC;AAUlDoB,EAAAA,QAAQ,EAAEZ;AAVwC,CAApD;AAaA,eAAeE,UAAf","sourcesContent":["import LineTileModel from '../../tile/models/tileModel';\nimport ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport GreatCircleModel from './great_circle';\nimport LineModel from './line';\nimport LinearLine from './linearline';\nimport SimpleLineModel from './simpleLine';\nimport TileLineModel from './tile';\nimport LineWallModel from './wall';\n\nexport type LineModelType =\n | 'arc'\n | 'arcmini'\n | 'arc3d'\n | 'greatcircle'\n | 'wall'\n | 'simple'\n | 'line'\n | 'linearline'\n | 'vectorline'\n | 'tileLine';\n\nconst LineModels: { [key in LineModelType]: any } = {\n arc: ArcModel,\n arcmini: ArcMiniModel,\n arc3d: Arc3DModel,\n greatcircle: GreatCircleModel,\n wall: LineWallModel,\n line: LineModel,\n simple: SimpleLineModel,\n linearline: LinearLine,\n vectorline: LineTileModel,\n tileLine: TileLineModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
@@ -0,0 +1,20 @@
1
+ import { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
2
+ import BaseModel from '../../core/BaseModel';
3
+ export default class LineModel extends BaseModel {
4
+ protected texture: ITexture2D;
5
+ getUninforms(): IModelUniform;
6
+ initModels(): IModel[];
7
+ clearModels(): void;
8
+ buildModels(): IModel[];
9
+ /**
10
+ * 根据参数获取不同的 shader 代码
11
+ * @returns
12
+ */
13
+ getShaders(): {
14
+ frag: string;
15
+ vert: string;
16
+ type: string;
17
+ };
18
+ protected registerBuiltinAttributes(): void;
19
+ private updateTexture;
20
+ }
@@ -0,0 +1,327 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
4
+ import _inherits from "@babel/runtime/helpers/inherits";
5
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
+
9
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
+
11
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
+
13
+ import { AttributeType, gl } from '@antv/l7-core';
14
+ import { getMask, rgb2arr } from '@antv/l7-utils';
15
+ import BaseModel from '../../core/BaseModel';
16
+ import { LineTriangulation } from '../../core/triangulation';
17
+ var line_tile_frag = "#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\nvarying mat4 styleMappingMat;\n\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 // 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\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);\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";
18
+ var line_tile_vert = "\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 vec2 u_tileOrigin;\nuniform float u_coord;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_icon_step: 100;\n\nuniform float u_heightfixed: 0.0;\nuniform float u_vertexScale: 1.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\nif(u_coord > 0.0) {\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, 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 if(u_heightfixed > 0.0) {\n lineHeight *= mapboxZoomScale;\n }\n \n } else {\n // amap\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} else {\n vec2 pointPos = a_Position.xy;\n vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n tileWorld.xy += pointOffset;\n\n tileWorld.xy += offset;\n\n if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // Needs to be divided with project_uCommonUnitsPerMeter\n tileWorld.w *= u_PixelsPerMeter.z;\n }\n\n gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;\n}\n\n\n setPickingColor(a_PickingColor);\n\n\n}\n";
19
+
20
+ var LineModel = function (_BaseModel) {
21
+ _inherits(LineModel, _BaseModel);
22
+
23
+ var _super = _createSuper(LineModel);
24
+
25
+ function LineModel() {
26
+ var _this;
27
+
28
+ _classCallCheck(this, LineModel);
29
+
30
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
+ args[_key] = arguments[_key];
32
+ }
33
+
34
+ _this = _super.call.apply(_super, [this].concat(args));
35
+
36
+ _defineProperty(_assertThisInitialized(_this), "texture", void 0);
37
+
38
+ _defineProperty(_assertThisInitialized(_this), "updateTexture", function () {
39
+ var createTexture2D = _this.rendererService.createTexture2D;
40
+
41
+ if (_this.texture) {
42
+ _this.texture.update({
43
+ data: _this.iconService.getCanvas()
44
+ });
45
+
46
+ _this.layer.render();
47
+
48
+ return;
49
+ }
50
+
51
+ _this.texture = createTexture2D({
52
+ data: _this.iconService.getCanvas(),
53
+ mag: gl.NEAREST,
54
+ min: gl.NEAREST,
55
+ premultiplyAlpha: false,
56
+ width: 1024,
57
+ height: _this.iconService.canvasHeight || 128
58
+ });
59
+ });
60
+
61
+ return _this;
62
+ }
63
+
64
+ _createClass(LineModel, [{
65
+ key: "getUninforms",
66
+ value: function getUninforms() {
67
+ var _ref = this.layer.getLayerConfig(),
68
+ _ref$opacity = _ref.opacity,
69
+ opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
70
+ _ref$textureBlend = _ref.textureBlend,
71
+ textureBlend = _ref$textureBlend === void 0 ? 'normal' : _ref$textureBlend,
72
+ _ref$lineTexture = _ref.lineTexture,
73
+ lineTexture = _ref$lineTexture === void 0 ? false : _ref$lineTexture,
74
+ _ref$iconStep = _ref.iconStep,
75
+ iconStep = _ref$iconStep === void 0 ? 100 : _ref$iconStep,
76
+ _ref$vertexHeightScal = _ref.vertexHeightScale,
77
+ vertexHeightScale = _ref$vertexHeightScal === void 0 ? 20.0 : _ref$vertexHeightScal,
78
+ _ref$borderWidth = _ref.borderWidth,
79
+ borderWidth = _ref$borderWidth === void 0 ? 0.0 : _ref$borderWidth,
80
+ _ref$borderColor = _ref.borderColor,
81
+ borderColor = _ref$borderColor === void 0 ? '#ccc' : _ref$borderColor,
82
+ _ref$heightfixed = _ref.heightfixed,
83
+ heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
84
+ _ref$arrow = _ref.arrow,
85
+ arrow = _ref$arrow === void 0 ? {
86
+ enable: false,
87
+ arrowWidth: 2,
88
+ arrowHeight: 3,
89
+ tailWidth: 1
90
+ } : _ref$arrow,
91
+ _ref$coord = _ref.coord,
92
+ coord = _ref$coord === void 0 ? 'lnglat' : _ref$coord,
93
+ tileOrigin = _ref.tileOrigin;
94
+
95
+ if (this.rendererService.getDirty()) {
96
+ this.texture.bind();
97
+ }
98
+
99
+ if (this.dataTextureTest && this.dataTextureNeedUpdate({
100
+ opacity: opacity
101
+ })) {
102
+ this.judgeStyleAttributes({
103
+ opacity: opacity
104
+ });
105
+ var encodeData = this.layer.getEncodedData();
106
+
107
+ var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
108
+ data = _this$calDataFrame.data,
109
+ width = _this$calDataFrame.width,
110
+ height = _this$calDataFrame.height;
111
+
112
+ this.rowCount = height;
113
+ this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
114
+ flipY: true,
115
+ data: data,
116
+ format: gl.LUMINANCE,
117
+ type: gl.FLOAT,
118
+ width: width,
119
+ height: height
120
+ }) : this.createTexture2D({
121
+ flipY: true,
122
+ data: [1],
123
+ format: gl.LUMINANCE,
124
+ type: gl.FLOAT,
125
+ width: 1,
126
+ height: 1
127
+ });
128
+ }
129
+
130
+ return {
131
+ u_tileOrigin: tileOrigin || [0, 0],
132
+ u_coord: coord === 'lnglat' ? 1.0 : 0.0,
133
+ u_dataTexture: this.dataTexture,
134
+ u_cellTypeLayout: this.getCellTypeLayout(),
135
+ u_opacity: Number(opacity),
136
+ u_textureBlend: textureBlend === 'normal' ? 0.0 : 1.0,
137
+ u_texture: this.texture,
138
+ u_line_texture: lineTexture ? 1.0 : 0.0,
139
+ u_icon_step: iconStep,
140
+ u_textSize: [1024, this.iconService.canvasHeight || 128],
141
+ u_borderWidth: borderWidth,
142
+ u_borderColor: rgb2arr(borderColor),
143
+ u_heightfixed: Number(heightfixed),
144
+ u_vertexScale: vertexHeightScale,
145
+ u_arrow: Number(arrow.enable),
146
+ u_arrowHeight: arrow.arrowHeight || 3,
147
+ u_arrowWidth: arrow.arrowWidth || 2,
148
+ u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
149
+ };
150
+ }
151
+ }, {
152
+ key: "initModels",
153
+ value: function initModels() {
154
+ this.updateTexture();
155
+ this.iconService.on('imageUpdate', this.updateTexture);
156
+ return this.buildModels();
157
+ }
158
+ }, {
159
+ key: "clearModels",
160
+ value: function clearModels() {
161
+ var _this$texture, _this$dataTexture;
162
+
163
+ (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
164
+ (_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
165
+ this.iconService.off('imageUpdate', this.updateTexture);
166
+ }
167
+ }, {
168
+ key: "buildModels",
169
+ value: function buildModels() {
170
+ var _ref2 = this.layer.getLayerConfig(),
171
+ _ref2$mask = _ref2.mask,
172
+ mask = _ref2$mask === void 0 ? false : _ref2$mask,
173
+ _ref2$maskInside = _ref2.maskInside,
174
+ maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
175
+ _ref2$depth = _ref2.depth,
176
+ depth = _ref2$depth === void 0 ? false : _ref2$depth;
177
+
178
+ var _this$getShaders = this.getShaders(),
179
+ frag = _this$getShaders.frag,
180
+ vert = _this$getShaders.vert,
181
+ type = _this$getShaders.type;
182
+
183
+ this.layer.triangulation = LineTriangulation;
184
+ return [this.layer.buildLayerModel({
185
+ moduleName: type,
186
+ vertexShader: vert,
187
+ fragmentShader: frag,
188
+ triangulation: LineTriangulation,
189
+ primitive: gl.TRIANGLES,
190
+ blend: this.getBlend(),
191
+ depth: {
192
+ enable: depth
193
+ },
194
+ stencil: getMask(mask, maskInside)
195
+ })];
196
+ }
197
+ }, {
198
+ key: "getShaders",
199
+ value: function getShaders() {
200
+ return {
201
+ frag: line_tile_frag,
202
+ vert: line_tile_vert,
203
+ type: 'line_tile'
204
+ };
205
+ }
206
+ }, {
207
+ key: "registerBuiltinAttributes",
208
+ value: function registerBuiltinAttributes() {
209
+ var _this2 = this;
210
+
211
+ this.styleAttributeService.registerStyleAttribute({
212
+ name: 'distanceAndIndex',
213
+ type: AttributeType.Attribute,
214
+ descriptor: {
215
+ name: 'a_DistanceAndIndex',
216
+ buffer: {
217
+ usage: gl.STATIC_DRAW,
218
+ data: [],
219
+ type: gl.FLOAT
220
+ },
221
+ size: 2,
222
+ update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
223
+ return vertexIndex === undefined ? [vertex[3], 10] : [vertex[3], vertexIndex];
224
+ }
225
+ }
226
+ });
227
+ this.styleAttributeService.registerStyleAttribute({
228
+ name: 'total_distance',
229
+ type: AttributeType.Attribute,
230
+ descriptor: {
231
+ name: 'a_Total_Distance',
232
+ buffer: {
233
+ usage: gl.STATIC_DRAW,
234
+ data: [],
235
+ type: gl.FLOAT
236
+ },
237
+ size: 1,
238
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
239
+ return [vertex[5]];
240
+ }
241
+ }
242
+ });
243
+ this.styleAttributeService.registerStyleAttribute({
244
+ name: 'size',
245
+ type: AttributeType.Attribute,
246
+ descriptor: {
247
+ name: 'a_Size',
248
+ buffer: {
249
+ usage: gl.DYNAMIC_DRAW,
250
+ data: [],
251
+ type: gl.FLOAT
252
+ },
253
+ size: 2,
254
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
255
+ var _feature$size = feature.size,
256
+ size = _feature$size === void 0 ? 1 : _feature$size;
257
+ return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
258
+ }
259
+ }
260
+ });
261
+ this.styleAttributeService.registerStyleAttribute({
262
+ name: 'normal',
263
+ type: AttributeType.Attribute,
264
+ descriptor: {
265
+ name: 'a_Normal',
266
+ buffer: {
267
+ usage: gl.STATIC_DRAW,
268
+ data: [],
269
+ type: gl.FLOAT
270
+ },
271
+ size: 3,
272
+ update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
273
+ return normal;
274
+ }
275
+ }
276
+ });
277
+ this.styleAttributeService.registerStyleAttribute({
278
+ name: 'miter',
279
+ type: AttributeType.Attribute,
280
+ descriptor: {
281
+ name: 'a_Miter',
282
+ buffer: {
283
+ usage: gl.STATIC_DRAW,
284
+ data: [],
285
+ type: gl.FLOAT
286
+ },
287
+ size: 1,
288
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
289
+ return [vertex[4]];
290
+ }
291
+ }
292
+ });
293
+ this.styleAttributeService.registerStyleAttribute({
294
+ name: 'uv',
295
+ type: AttributeType.Attribute,
296
+ descriptor: {
297
+ name: 'a_iconMapUV',
298
+ buffer: {
299
+ usage: gl.DYNAMIC_DRAW,
300
+ data: [],
301
+ type: gl.FLOAT
302
+ },
303
+ size: 2,
304
+ update: function update(feature, featureIdx, vertex, attributeIdx) {
305
+ var iconMap = _this2.iconService.getIconMap();
306
+
307
+ var texture = feature.texture;
308
+
309
+ var _ref3 = iconMap[texture] || {
310
+ x: 0,
311
+ y: 0
312
+ },
313
+ x = _ref3.x,
314
+ y = _ref3.y;
315
+
316
+ return [x, y];
317
+ }
318
+ }
319
+ });
320
+ }
321
+ }]);
322
+
323
+ return LineModel;
324
+ }(BaseModel);
325
+
326
+ export { LineModel as default };
327
+ //# sourceMappingURL=tile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/line/models/tile.ts"],"names":["AttributeType","gl","getMask","rgb2arr","BaseModel","LineTriangulation","LineModel","createTexture2D","rendererService","texture","update","data","iconService","getCanvas","layer","render","mag","NEAREST","min","premultiplyAlpha","width","height","canvasHeight","getLayerConfig","opacity","textureBlend","lineTexture","iconStep","vertexHeightScale","borderWidth","borderColor","heightfixed","arrow","enable","arrowWidth","arrowHeight","tailWidth","coord","tileOrigin","getDirty","bind","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","rowCount","dataTexture","length","flipY","format","LUMINANCE","type","FLOAT","u_tileOrigin","u_coord","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","Number","u_textureBlend","u_texture","u_line_texture","u_icon_step","u_textSize","u_borderWidth","u_borderColor","u_heightfixed","u_vertexScale","u_arrow","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","updateTexture","on","buildModels","destroy","off","mask","maskInside","depth","getShaders","frag","vert","triangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_tile_frag","line_tile_vert","styleAttributeService","registerStyleAttribute","name","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","DYNAMIC_DRAW","Array","isArray","iconMap","getIconMap","x","y"],"mappings":";;;;;;;;;;;;AAAA,SACEA,aADF,EAEEC,EAFF,QAQO,eARP;AAUA,SAASC,OAAT,EAAkBC,OAAlB,QAAiC,gBAAjC;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AAEA,SAASC,iBAAT,QAAkC,0BAAlC;;;;IAKqBC,S;;;;;;;;;;;;;;;;;;oEA4RK,YAAM;AAC5B,UAAQC,eAAR,GAA4B,MAAKC,eAAjC,CAAQD,eAAR;;AACA,UAAI,MAAKE,OAAT,EAAkB;AAChB,cAAKA,OAAL,CAAaC,MAAb,CAAo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,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;;;;EA1RoCtH,S;;SAAlBE,S","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n ILayerConfig,\n IModel,\n IModelUniform,\n ITexture2D,\n} from '@antv/l7-core';\n\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\n\nimport line_tile_frag from '../shaders/tile/line_tile_frag.glsl';\nimport line_tile_vert from '../shaders/tile/line_tile_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n protected texture: ITexture2D;\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n textureBlend = 'normal',\n lineTexture = false,\n iconStep = 100,\n vertexHeightScale = 20.0,\n borderWidth = 0.0,\n borderColor = '#ccc',\n heightfixed = false,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n coord = 'lnglat',\n tileOrigin,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n\n if (this.rendererService.getDirty()) {\n this.texture.bind();\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 return {\n u_tileOrigin: tileOrigin || [0, 0],\n u_coord: coord === 'lnglat' ? 1.0 : 0.0,\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: Number(opacity),\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_icon_step: iconStep,\n u_textSize: [1024, this.iconService.canvasHeight || 128],\n\n // line border 参数\n u_borderWidth: borderWidth,\n u_borderColor: rgb2arr(borderColor),\n\n // 是否固定高度\n u_heightfixed: Number(heightfixed),\n\n // 顶点高度 scale\n u_vertexScale: vertexHeightScale,\n\n // arrow\n u_arrow: Number(arrow.enable),\n u_arrowHeight: arrow.arrowHeight || 3,\n u_arrowWidth: arrow.arrowWidth || 2,\n u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth,\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 const {\n mask = false,\n maskInside = true,\n depth = false,\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\n const { frag, vert, type } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: type,\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\n // depth: { enable: true },\n stencil: getMask(mask, maskInside),\n }),\n ];\n }\n\n /**\n * 根据参数获取不同的 shader 代码\n * @returns\n */\n public getShaders(): { frag: string; vert: string; type: string } {\n return {\n frag: line_tile_frag,\n vert: line_tile_vert,\n type: 'line_tile',\n };\n }\n\n protected registerBuiltinAttributes() {\n this.styleAttributeService.registerStyleAttribute({\n name: 'distanceAndIndex',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_DistanceAndIndex',\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: 2,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n normal: number[],\n vertexIndex?: number,\n ) => {\n return vertexIndex === undefined\n ? [vertex[3], 10]\n : [vertex[3], vertexIndex];\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 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\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":"tile.js"}
@@ -33,7 +33,9 @@ var ShaderUniformPlugin = (_dec = injectable(), _dec2 = inject(TYPES.ICameraServ
33
33
  var mvp = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
34
34
  var sceneCenterMKT = [0, 0];
35
35
  layer.hooks.beforeRender.tap('ShaderUniformPlugin', function () {
36
- _this.coordinateSystemService.refresh();
36
+ var offset = layer.getLayerConfig().tileOrigin;
37
+
38
+ _this.coordinateSystemService.refresh(offset);
37
39
 
38
40
  if (version === 'GAODE2.x') {
39
41
  var layerCenter = _this.getLayerCenter(layer);