@antv/l7-layers 2.9.15 → 2.9.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/es/core/BaseLayer.d.ts +4 -2
- package/es/core/BaseLayer.js +47 -21
- package/es/core/BaseLayer.js.map +1 -1
- package/es/core/BaseModel.d.ts +2 -1
- package/es/core/BaseModel.js +3 -0
- package/es/core/BaseModel.js.map +1 -1
- package/es/core/interface.d.ts +14 -1
- package/es/core/interface.js.map +1 -1
- package/es/image/models/image.js.map +1 -1
- package/es/line/index.d.ts +1 -1
- package/es/line/index.js +13 -1
- package/es/line/index.js.map +1 -1
- package/es/line/models/earthArc_3d.d.ts +17 -0
- package/es/line/models/earthArc_3d.js +311 -0
- package/es/line/models/earthArc_3d.js.map +1 -0
- package/es/line/models/half.d.ts +18 -0
- package/es/line/models/half.js +244 -0
- package/es/line/models/half.js.map +1 -0
- package/es/line/models/index.d.ts +1 -1
- package/es/line/models/index.js +9 -1
- package/es/line/models/index.js.map +1 -1
- package/es/line/models/tile.d.ts +20 -0
- package/es/line/models/tile.js +327 -0
- package/es/line/models/tile.js.map +1 -0
- package/es/plugins/DataMappingPlugin.js +1 -1
- package/es/plugins/DataMappingPlugin.js.map +1 -1
- package/es/plugins/DataSourcePlugin.js +7 -6
- package/es/plugins/DataSourcePlugin.js.map +1 -1
- package/es/plugins/FeatureScalePlugin.js +35 -9
- package/es/plugins/FeatureScalePlugin.js.map +1 -1
- package/es/plugins/ShaderUniformPlugin.js +3 -1
- package/es/plugins/ShaderUniformPlugin.js.map +1 -1
- package/es/point/index.d.ts +1 -1
- package/es/point/index.js +10 -2
- package/es/point/index.js.map +1 -1
- package/es/point/models/earthExtrude.d.ts +24 -0
- package/es/point/models/earthExtrude.js +259 -0
- package/es/point/models/earthExtrude.js.map +1 -0
- package/es/point/models/earthFill.d.ts +20 -0
- package/es/point/models/earthFill.js +255 -0
- package/es/point/models/earthFill.js.map +1 -0
- package/es/point/models/extrude.d.ts +0 -1
- package/es/point/models/extrude.js +2 -10
- package/es/point/models/extrude.js.map +1 -1
- package/es/point/models/fill.d.ts +8 -1
- package/es/point/models/fill.js +55 -75
- package/es/point/models/fill.js.map +1 -1
- package/es/point/models/index.d.ts +1 -1
- package/es/point/models/index.js +9 -1
- package/es/point/models/index.js.map +1 -1
- package/es/point/models/radar.js +2 -6
- package/es/point/models/radar.js.map +1 -1
- package/es/point/models/tile.d.ts +31 -0
- package/es/point/models/tile.js +291 -0
- package/es/point/models/tile.js.map +1 -0
- package/es/polygon/index.js +6 -0
- package/es/polygon/index.js.map +1 -1
- package/es/polygon/models/index.d.ts +1 -1
- package/es/polygon/models/index.js +5 -1
- package/es/polygon/models/index.js.map +1 -1
- package/es/polygon/models/tile.d.ts +16 -0
- package/es/polygon/models/tile.js +137 -0
- package/es/polygon/models/tile.js.map +1 -0
- package/es/raster/index.d.ts +2 -2
- package/es/raster/index.js +4 -4
- package/es/raster/index.js.map +1 -1
- package/es/raster/models/index.js +1 -1
- package/es/raster/models/index.js.map +1 -1
- package/es/raster/models/raster.d.ts +2 -0
- package/es/raster/models/raster.js +24 -12
- package/es/raster/models/raster.js.map +1 -1
- package/es/tile/interface.d.ts +28 -0
- package/es/tile/interface.js +2 -0
- package/es/tile/interface.js.map +1 -0
- package/es/tile/manager/tileConfigManager.d.ts +17 -0
- package/es/tile/manager/tileConfigManager.js +123 -0
- package/es/tile/manager/tileConfigManager.js.map +1 -0
- package/es/tile/manager/tileLayerManager.d.ts +35 -0
- package/es/tile/manager/tileLayerManager.js +297 -0
- package/es/tile/manager/tileLayerManager.js.map +1 -0
- package/es/tile/manager/tilePickerManager.d.ts +21 -0
- package/es/tile/manager/tilePickerManager.js +189 -0
- package/es/tile/manager/tilePickerManager.js.map +1 -0
- package/es/tile/models/tileModel.d.ts +8 -0
- package/es/tile/models/tileModel.js +61 -0
- package/es/tile/models/tileModel.js.map +1 -0
- package/es/tile/tileFactory/base.d.ts +44 -0
- package/es/tile/tileFactory/base.js +423 -0
- package/es/tile/tileFactory/base.js.map +1 -0
- package/es/tile/tileFactory/index.d.ts +5 -0
- package/es/tile/tileFactory/index.js +30 -0
- package/es/tile/tileFactory/index.js.map +1 -0
- package/es/tile/tileFactory/line.d.ts +12 -0
- package/es/tile/tileFactory/line.js +65 -0
- package/es/tile/tileFactory/line.js.map +1 -0
- package/es/tile/tileFactory/point.d.ts +12 -0
- package/es/tile/tileFactory/point.js +65 -0
- package/es/tile/tileFactory/point.js.map +1 -0
- package/es/tile/tileFactory/polygon.d.ts +12 -0
- package/es/tile/tileFactory/polygon.js +65 -0
- package/es/tile/tileFactory/polygon.js.map +1 -0
- package/es/tile/tileFactory/raster.d.ts +12 -0
- package/es/tile/tileFactory/raster.js +61 -0
- package/es/tile/tileFactory/raster.js.map +1 -0
- package/es/tile/tileFactory/rasterData.d.ts +12 -0
- package/es/tile/tileFactory/rasterData.js +86 -0
- package/es/tile/tileFactory/rasterData.js.map +1 -0
- package/es/tile/tileFactory/rasterDataLayer.d.ts +19 -0
- package/es/{core/LayerGroup.js → tile/tileFactory/rasterDataLayer.js} +39 -32
- package/es/tile/tileFactory/rasterDataLayer.js.map +1 -0
- package/es/tile/tileFactory/vectorLayer.d.ts +27 -0
- package/es/tile/tileFactory/vectorLayer.js +131 -0
- package/es/tile/tileFactory/vectorLayer.js.map +1 -0
- package/es/tile/tileLayer/baseTileLayer.d.ts +47 -0
- package/es/tile/tileLayer/baseTileLayer.js +409 -0
- package/es/tile/tileLayer/baseTileLayer.js.map +1 -0
- package/es/tile/tmsTileLayer.d.ts +7 -0
- package/es/tile/tmsTileLayer.js +100 -0
- package/es/tile/tmsTileLayer.js.map +1 -0
- package/es/tile/utils.d.ts +11 -0
- package/es/tile/utils.js +125 -0
- package/es/tile/utils.js.map +1 -0
- package/lib/core/BaseLayer.js +45 -20
- package/lib/core/BaseLayer.js.map +1 -1
- package/lib/core/BaseModel.js +2 -0
- package/lib/core/BaseModel.js.map +1 -1
- package/lib/core/interface.js.map +1 -1
- package/lib/image/models/image.js.map +1 -1
- package/lib/line/index.js +13 -1
- package/lib/line/index.js.map +1 -1
- package/lib/line/models/earthArc_3d.js +328 -0
- package/lib/line/models/earthArc_3d.js.map +1 -0
- package/lib/line/models/half.js +260 -0
- package/lib/line/models/half.js.map +1 -0
- package/lib/line/models/index.js +13 -1
- package/lib/line/models/index.js.map +1 -1
- package/lib/line/models/tile.js +342 -0
- package/lib/line/models/tile.js.map +1 -0
- package/lib/plugins/DataMappingPlugin.js +1 -1
- package/lib/plugins/DataMappingPlugin.js.map +1 -1
- package/lib/plugins/DataSourcePlugin.js +7 -6
- package/lib/plugins/DataSourcePlugin.js.map +1 -1
- package/lib/plugins/FeatureScalePlugin.js +35 -9
- package/lib/plugins/FeatureScalePlugin.js.map +1 -1
- package/lib/plugins/ShaderUniformPlugin.js +3 -1
- package/lib/plugins/ShaderUniformPlugin.js.map +1 -1
- package/lib/point/index.js +10 -2
- package/lib/point/index.js.map +1 -1
- package/lib/point/models/earthExtrude.js +277 -0
- package/lib/point/models/earthExtrude.js.map +1 -0
- package/lib/point/models/earthFill.js +291 -0
- package/lib/point/models/earthFill.js.map +1 -0
- package/lib/point/models/extrude.js +2 -11
- package/lib/point/models/extrude.js.map +1 -1
- package/lib/point/models/fill.js +51 -93
- package/lib/point/models/fill.js.map +1 -1
- package/lib/point/models/index.js +13 -1
- package/lib/point/models/index.js.map +1 -1
- package/lib/point/models/radar.js +1 -5
- package/lib/point/models/radar.js.map +1 -1
- package/lib/point/models/tile.js +308 -0
- package/lib/point/models/tile.js.map +1 -0
- package/lib/polygon/index.js +6 -0
- package/lib/polygon/index.js.map +1 -1
- package/lib/polygon/models/index.js +7 -1
- package/lib/polygon/models/index.js.map +1 -1
- package/lib/polygon/models/tile.js +152 -0
- package/lib/polygon/models/tile.js.map +1 -0
- package/lib/raster/index.js +4 -4
- package/lib/raster/index.js.map +1 -1
- package/lib/raster/models/index.js +2 -2
- package/lib/raster/models/index.js.map +1 -1
- package/lib/raster/models/raster.js +24 -12
- package/lib/raster/models/raster.js.map +1 -1
- package/lib/tile/interface.js +2 -0
- package/lib/tile/interface.js.map +1 -0
- package/lib/tile/manager/tileConfigManager.js +134 -0
- package/lib/tile/manager/tileConfigManager.js.map +1 -0
- package/lib/tile/manager/tileLayerManager.js +305 -0
- package/lib/tile/manager/tileLayerManager.js.map +1 -0
- package/lib/tile/manager/tilePickerManager.js +195 -0
- package/lib/tile/manager/tilePickerManager.js.map +1 -0
- package/lib/tile/models/tileModel.js +73 -0
- package/lib/tile/models/tileModel.js.map +1 -0
- package/lib/tile/tileFactory/base.js +436 -0
- package/lib/tile/tileFactory/base.js.map +1 -0
- package/lib/tile/tileFactory/index.js +60 -0
- package/lib/tile/tileFactory/index.js.map +1 -0
- package/lib/tile/tileFactory/line.js +76 -0
- package/lib/tile/tileFactory/line.js.map +1 -0
- package/lib/tile/tileFactory/point.js +76 -0
- package/lib/tile/tileFactory/point.js.map +1 -0
- package/lib/tile/tileFactory/polygon.js +76 -0
- package/lib/tile/tileFactory/polygon.js.map +1 -0
- package/lib/tile/tileFactory/raster.js +74 -0
- package/lib/tile/tileFactory/raster.js.map +1 -0
- package/lib/tile/tileFactory/rasterData.js +99 -0
- package/lib/tile/tileFactory/rasterData.js.map +1 -0
- package/lib/{core/LayerGroup.js → tile/tileFactory/rasterDataLayer.js} +40 -32
- package/lib/tile/tileFactory/rasterDataLayer.js.map +1 -0
- package/lib/tile/tileFactory/vectorLayer.js +145 -0
- package/lib/tile/tileFactory/vectorLayer.js.map +1 -0
- package/lib/tile/tileLayer/baseTileLayer.js +407 -0
- package/lib/tile/tileLayer/baseTileLayer.js.map +1 -0
- package/lib/tile/tmsTileLayer.js +116 -0
- package/lib/tile/tmsTileLayer.js.map +1 -0
- package/lib/tile/utils.js +147 -0
- package/lib/tile/utils.js.map +1 -0
- package/package.json +8 -6
- package/es/core/LayerGroup.d.ts +0 -9
- package/es/core/LayerGroup.js.map +0 -1
- package/es/raster/models/raste-tile.d.ts +0 -23
- package/es/raster/models/raste-tile.js +0 -285
- package/es/raster/models/raste-tile.js.map +0 -1
- package/lib/core/LayerGroup.js.map +0 -1
- package/lib/raster/models/raste-tile.js +0 -294
- package/lib/raster/models/raste-tile.js.map +0 -1
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
+
|
|
16
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
+
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
+
|
|
20
|
+
var _isNumber2 = _interopRequireDefault(require("lodash/isNumber"));
|
|
21
|
+
|
|
22
|
+
var _l7Core = require("@antv/l7-core");
|
|
23
|
+
|
|
24
|
+
var _l7Utils = require("@antv/l7-utils");
|
|
25
|
+
|
|
26
|
+
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
27
|
+
|
|
28
|
+
var _triangulation = require("../../core/triangulation");
|
|
29
|
+
|
|
30
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
31
|
+
|
|
32
|
+
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; } }
|
|
33
|
+
|
|
34
|
+
var line_half_frag = "#define COORDINATE_SYSTEM_LNGLAT 1.0 // mapbox\n#define COORDINATE_SYSTEM_LNGLAT_OFFSET 2.0 // mapbox offset\n#define COORDINATE_SYSTEM_VECTOR_TILE 3.0\n#define COORDINATE_SYSTEM_IDENTITY 4.0\n#define COORDINATE_SYSTEM_P20 5.0 // amap\n#define COORDINATE_SYSTEM_P20_OFFSET 6.0 // amap offset\n#define COORDINATE_SYSTEM_METER_OFFSET 7.0\n\n#define COORDINATE_SYSTEM_P20_2 8.0 // amap2.0\nuniform float u_CoordinateSystem;\nvarying vec4 v_color;\nuniform float u_arrow: 0.0;\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\n#pragma include \"picking\"\n\nvarying mat4 styleMappingMat;\nvoid main() {\n float distanceAndIndex = styleMappingMat[0][3];\n float miter = styleMappingMat[0][2];\n\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\n if(u_arrow > 0.0 && distanceAndIndex < 2.0) { // arrow\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) { \n if(cross(vec3(styleMappingMat[1].rg, 0.0), vec3(styleMappingMat[1].ba, 0.0)).z < 0.0) { // amap\n discard;\n }\n } else { // amap2 mapbox map\n if(cross(vec3(styleMappingMat[1].rg, 0.0), vec3(styleMappingMat[1].ba, 0.0)).z > 0.0) { \n discard;\n }\n }\n } else { // line body\n if(miter < 0.0) {\n discard;\n }\n }\n\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";
|
|
35
|
+
var line_half_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// dash line\nattribute vec4 a_dirPoints;\nattribute vec3 a_DistanceAndIndex;\n\nuniform vec4 u_lineDir;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\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 - a_Miter - a_DistanceAndIndex\n 0.0, 0.0, 0.0, 0.0, // originX - originY - vectorX - vectorY\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 styleMappingMat[0][3] = a_DistanceAndIndex.y;\n styleMappingMat[0][2] = a_Miter;\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\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 // styleMappingMat[1].rg = a_Position.xy + offset;\n\n vec2 copyOffset = vec2(offset.x, offset.y);\n\n float lineDistance = a_DistanceAndIndex.x;\n float total_Distance = a_DistanceAndIndex.z;\n float currentLinePointRatio = lineDistance / 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\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\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); // \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 gl_Position = u_Mvp * (vec4(project_pos.xy + offset, lineHeight, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, lineHeight, 1.0));\n }\n \n if(u_arrow > 0.0 && a_DistanceAndIndex.y < 2.0) {\n vec2 startPoint = a_dirPoints.rg;\n vec2 endPoint = a_dirPoints.ba;\n vec4 t1 = project_position(vec4(startPoint, 0, 1.0));\n vec4 t2 = project_position(vec4(endPoint, 0, 1.0));\n // TODO\uFF1A \u540E\u7EED\u4F18\u5316\u53EF\u4EE5\u628A\u4F4D\u7F6E\u8BA1\u7B97\u653E\u5728 cpu \u4E2D\u5B8C\u6210\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n vec2 p1 = (u_Mvp * vec4(t1.xy, 0.0, 1.0)).xy;\n vec2 p2 = (u_Mvp * vec4(t2.xy, 0.0, 1.0)).xy;\n styleMappingMat[1].rg = normalize(p1 - p2);\n styleMappingMat[1].ba = normalize(gl_Position.xy - p2);\n } else {\n vec2 p1 = project_common_position_to_clipspace(vec4(t1.xy, 0.0, 1.0)).xy;\n vec2 p2 = project_common_position_to_clipspace(vec4(t2.xy, 0.0, 1.0)).xy;\n styleMappingMat[1].rg = normalize(p1 - p2);\n styleMappingMat[1].ba = normalize(gl_Position.xy - p2);\n }\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
36
|
+
|
|
37
|
+
var LineModel = function (_BaseModel) {
|
|
38
|
+
(0, _inherits2.default)(LineModel, _BaseModel);
|
|
39
|
+
|
|
40
|
+
var _super = _createSuper(LineModel);
|
|
41
|
+
|
|
42
|
+
function LineModel() {
|
|
43
|
+
(0, _classCallCheck2.default)(this, LineModel);
|
|
44
|
+
return _super.apply(this, arguments);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
(0, _createClass2.default)(LineModel, [{
|
|
48
|
+
key: "getUninforms",
|
|
49
|
+
value: function getUninforms() {
|
|
50
|
+
var _ref = this.layer.getLayerConfig(),
|
|
51
|
+
_ref$opacity = _ref.opacity,
|
|
52
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
53
|
+
sourceColor = _ref.sourceColor,
|
|
54
|
+
targetColor = _ref.targetColor,
|
|
55
|
+
_ref$arrow = _ref.arrow,
|
|
56
|
+
arrow = _ref$arrow === void 0 ? {
|
|
57
|
+
enable: false,
|
|
58
|
+
arrowWidth: 2,
|
|
59
|
+
arrowHeight: 3,
|
|
60
|
+
tailWidth: 1
|
|
61
|
+
} : _ref$arrow;
|
|
62
|
+
|
|
63
|
+
var useLinearColor = 0;
|
|
64
|
+
var sourceColorArr = [0, 0, 0, 0];
|
|
65
|
+
var targetColorArr = [0, 0, 0, 0];
|
|
66
|
+
|
|
67
|
+
if (sourceColor && targetColor) {
|
|
68
|
+
sourceColorArr = (0, _l7Utils.rgb2arr)(sourceColor);
|
|
69
|
+
targetColorArr = (0, _l7Utils.rgb2arr)(targetColor);
|
|
70
|
+
useLinearColor = 1;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
74
|
+
opacity: opacity
|
|
75
|
+
})) {
|
|
76
|
+
this.judgeStyleAttributes({
|
|
77
|
+
opacity: opacity
|
|
78
|
+
});
|
|
79
|
+
var encodeData = this.layer.getEncodedData();
|
|
80
|
+
|
|
81
|
+
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
82
|
+
data = _this$calDataFrame.data,
|
|
83
|
+
width = _this$calDataFrame.width,
|
|
84
|
+
height = _this$calDataFrame.height;
|
|
85
|
+
|
|
86
|
+
this.rowCount = height;
|
|
87
|
+
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
88
|
+
flipY: true,
|
|
89
|
+
data: data,
|
|
90
|
+
format: _l7Core.gl.LUMINANCE,
|
|
91
|
+
type: _l7Core.gl.FLOAT,
|
|
92
|
+
width: width,
|
|
93
|
+
height: height
|
|
94
|
+
}) : this.createTexture2D({
|
|
95
|
+
flipY: true,
|
|
96
|
+
data: [1],
|
|
97
|
+
format: _l7Core.gl.LUMINANCE,
|
|
98
|
+
type: _l7Core.gl.FLOAT,
|
|
99
|
+
width: 1,
|
|
100
|
+
height: 1
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
u_dataTexture: this.dataTexture,
|
|
106
|
+
u_cellTypeLayout: this.getCellTypeLayout(),
|
|
107
|
+
u_opacity: (0, _isNumber2.default)(opacity) ? opacity : 1.0,
|
|
108
|
+
u_linearColor: useLinearColor,
|
|
109
|
+
u_sourceColor: sourceColorArr,
|
|
110
|
+
u_targetColor: targetColorArr,
|
|
111
|
+
u_arrow: Number(arrow.enable),
|
|
112
|
+
u_arrowHeight: arrow.arrowHeight || 3,
|
|
113
|
+
u_arrowWidth: arrow.arrowWidth || 2,
|
|
114
|
+
u_tailWidth: arrow.tailWidth === undefined ? 1 : arrow.tailWidth
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
key: "initModels",
|
|
119
|
+
value: function initModels() {
|
|
120
|
+
return this.buildModels();
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "clearModels",
|
|
124
|
+
value: function clearModels() {
|
|
125
|
+
var _this$dataTexture;
|
|
126
|
+
|
|
127
|
+
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
128
|
+
}
|
|
129
|
+
}, {
|
|
130
|
+
key: "buildModels",
|
|
131
|
+
value: function buildModels() {
|
|
132
|
+
var _ref2 = this.layer.getLayerConfig(),
|
|
133
|
+
_ref2$mask = _ref2.mask,
|
|
134
|
+
mask = _ref2$mask === void 0 ? false : _ref2$mask,
|
|
135
|
+
_ref2$maskInside = _ref2.maskInside,
|
|
136
|
+
maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside,
|
|
137
|
+
_ref2$depth = _ref2.depth,
|
|
138
|
+
depth = _ref2$depth === void 0 ? false : _ref2$depth;
|
|
139
|
+
|
|
140
|
+
var _this$getShaders = this.getShaders(),
|
|
141
|
+
frag = _this$getShaders.frag,
|
|
142
|
+
vert = _this$getShaders.vert;
|
|
143
|
+
|
|
144
|
+
this.layer.triangulation = _triangulation.LineTriangulation;
|
|
145
|
+
return [this.layer.buildLayerModel({
|
|
146
|
+
moduleName: 'line_half',
|
|
147
|
+
vertexShader: vert,
|
|
148
|
+
fragmentShader: frag,
|
|
149
|
+
triangulation: _triangulation.LineTriangulation,
|
|
150
|
+
primitive: _l7Core.gl.TRIANGLES,
|
|
151
|
+
blend: this.getBlend(),
|
|
152
|
+
depth: {
|
|
153
|
+
enable: depth
|
|
154
|
+
},
|
|
155
|
+
stencil: (0, _l7Utils.getMask)(mask, maskInside)
|
|
156
|
+
})];
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "getShaders",
|
|
160
|
+
value: function getShaders() {
|
|
161
|
+
return {
|
|
162
|
+
frag: line_half_frag,
|
|
163
|
+
vert: line_half_vert,
|
|
164
|
+
type: 'normal'
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}, {
|
|
168
|
+
key: "registerBuiltinAttributes",
|
|
169
|
+
value: function registerBuiltinAttributes() {
|
|
170
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
171
|
+
name: 'distanceAndIndex',
|
|
172
|
+
type: _l7Core.AttributeType.Attribute,
|
|
173
|
+
descriptor: {
|
|
174
|
+
name: 'a_DistanceAndIndex',
|
|
175
|
+
buffer: {
|
|
176
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
177
|
+
data: [],
|
|
178
|
+
type: _l7Core.gl.FLOAT
|
|
179
|
+
},
|
|
180
|
+
size: 3,
|
|
181
|
+
update: function update(feature, featureIdx, vertex, attributeIdx, normal, vertexIndex) {
|
|
182
|
+
return vertexIndex === undefined ? [vertex[3], 10, vertex[5]] : [vertex[3], vertexIndex, vertex[5]];
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
187
|
+
name: 'dirPoints',
|
|
188
|
+
type: _l7Core.AttributeType.Attribute,
|
|
189
|
+
descriptor: {
|
|
190
|
+
name: 'a_dirPoints',
|
|
191
|
+
buffer: {
|
|
192
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
193
|
+
data: [],
|
|
194
|
+
type: _l7Core.gl.FLOAT
|
|
195
|
+
},
|
|
196
|
+
size: 4,
|
|
197
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
198
|
+
var startPoint = feature.coordinates[0] || [0, 0];
|
|
199
|
+
var endPoint = feature.coordinates[3] || [0, 0];
|
|
200
|
+
return [startPoint[0], startPoint[1], endPoint[0], endPoint[1]];
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
205
|
+
name: 'size',
|
|
206
|
+
type: _l7Core.AttributeType.Attribute,
|
|
207
|
+
descriptor: {
|
|
208
|
+
name: 'a_Size',
|
|
209
|
+
buffer: {
|
|
210
|
+
usage: _l7Core.gl.DYNAMIC_DRAW,
|
|
211
|
+
data: [],
|
|
212
|
+
type: _l7Core.gl.FLOAT
|
|
213
|
+
},
|
|
214
|
+
size: 2,
|
|
215
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
216
|
+
var _feature$size = feature.size,
|
|
217
|
+
size = _feature$size === void 0 ? 1 : _feature$size;
|
|
218
|
+
return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
223
|
+
name: 'normal',
|
|
224
|
+
type: _l7Core.AttributeType.Attribute,
|
|
225
|
+
descriptor: {
|
|
226
|
+
name: 'a_Normal',
|
|
227
|
+
buffer: {
|
|
228
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
229
|
+
data: [],
|
|
230
|
+
type: _l7Core.gl.FLOAT
|
|
231
|
+
},
|
|
232
|
+
size: 3,
|
|
233
|
+
update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
|
|
234
|
+
return normal;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
this.styleAttributeService.registerStyleAttribute({
|
|
239
|
+
name: 'miter',
|
|
240
|
+
type: _l7Core.AttributeType.Attribute,
|
|
241
|
+
descriptor: {
|
|
242
|
+
name: 'a_Miter',
|
|
243
|
+
buffer: {
|
|
244
|
+
usage: _l7Core.gl.STATIC_DRAW,
|
|
245
|
+
data: [],
|
|
246
|
+
type: _l7Core.gl.FLOAT
|
|
247
|
+
},
|
|
248
|
+
size: 1,
|
|
249
|
+
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
250
|
+
return [vertex[4]];
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}]);
|
|
256
|
+
return LineModel;
|
|
257
|
+
}(_BaseModel2.default);
|
|
258
|
+
|
|
259
|
+
exports.default = LineModel;
|
|
260
|
+
//# sourceMappingURL=half.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/half.ts"],"names":["LineModel","layer","getLayerConfig","opacity","sourceColor","targetColor","arrow","enable","arrowWidth","arrowHeight","tailWidth","useLinearColor","sourceColorArr","targetColorArr","dataTextureTest","dataTextureNeedUpdate","judgeStyleAttributes","encodeData","getEncodedData","calDataFrame","cellLength","cellProperties","data","width","height","rowCount","dataTexture","length","createTexture2D","flipY","format","gl","LUMINANCE","type","FLOAT","u_dataTexture","u_cellTypeLayout","getCellTypeLayout","u_opacity","u_linearColor","u_sourceColor","u_targetColor","u_arrow","Number","u_arrowHeight","u_arrowWidth","u_tailWidth","undefined","buildModels","destroy","mask","maskInside","depth","getShaders","frag","vert","triangulation","LineTriangulation","buildLayerModel","moduleName","vertexShader","fragmentShader","primitive","TRIANGLES","blend","getBlend","stencil","line_half_frag","line_half_vert","styleAttributeService","registerStyleAttribute","name","AttributeType","Attribute","descriptor","buffer","usage","STATIC_DRAW","size","update","feature","featureIdx","vertex","attributeIdx","normal","vertexIndex","startPoint","coordinates","endPoint","DYNAMIC_DRAW","Array","isArray","BaseModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AAOA;;AAEA;;AAEA;;;;;;;;;IAIqBA,S;;;;;;;;;;;;WACnB,wBAAqC;AACnC,iBAUI,KAAKC,KAAL,CAAWC,cAAX,EAVJ;AAAA,8BACEC,OADF;AAAA,UACEA,OADF,6BACY,CADZ;AAAA,UAEEC,WAFF,QAEEA,WAFF;AAAA,UAGEC,WAHF,QAGEA,WAHF;AAAA,4BAIEC,KAJF;AAAA,UAIEA,KAJF,2BAIU;AACNC,QAAAA,MAAM,EAAE,KADF;AAENC,QAAAA,UAAU,EAAE,CAFN;AAGNC,QAAAA,WAAW,EAAE,CAHP;AAINC,QAAAA,SAAS,EAAE;AAJL,OAJV;;AAaA,UAAIC,cAAc,GAAG,CAArB;AACA,UAAIC,cAAc,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,C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ACNC,OADM,EAENC,UAFM,EAGNC,MAHM,EAINC,YAJM,EAKH;AACH,mBAAO,CAACD,MAAM,CAAC,CAAD,CAAP,CAAP;AACD;AAhBS;AAHoC,OAAlD;AAsBD;;;EA9OoCU,mB","sourcesContent":["import {\n AttributeType,\n gl,\n IEncodeFeature,\n IModel,\n IModelUniform,\n} from '@antv/l7-core';\nimport { getMask, rgb2arr } from '@antv/l7-utils';\nimport { isNumber } from 'lodash';\nimport BaseModel from '../../core/BaseModel';\nimport { ILineLayerStyleOptions } from '../../core/interface';\nimport { LineTriangulation } from '../../core/triangulation';\nimport line_half_frag from '../shaders/half/line_half_frag.glsl';\nimport line_half_vert from '../shaders/half/line_half_vert.glsl';\n\nexport default class LineModel extends BaseModel {\n public getUninforms(): IModelUniform {\n const {\n opacity = 1,\n sourceColor,\n targetColor,\n arrow = {\n enable: false,\n arrowWidth: 2,\n arrowHeight: 3,\n tailWidth: 1,\n },\n } = this.layer.getLayerConfig() as ILineLayerStyleOptions;\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 return {\n u_dataTexture: this.dataTexture, // 数据纹理 - 有数据映射的时候纹理中带数据,若没有任何数据映射时纹理是 [1]\n u_cellTypeLayout: this.getCellTypeLayout(),\n u_opacity: isNumber(opacity) ? opacity : 1.0,\n\n // 渐变色支持参数\n u_linearColor: useLinearColor,\n u_sourceColor: sourceColorArr,\n u_targetColor: targetColorArr,\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 return this.buildModels();\n }\n\n public clearModels() {\n this.dataTexture?.destroy();\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 } = this.getShaders();\n this.layer.triangulation = LineTriangulation;\n return [\n this.layer.buildLayerModel({\n moduleName: 'line_half',\n vertexShader: vert,\n fragmentShader: frag,\n triangulation: LineTriangulation,\n primitive: gl.TRIANGLES,\n blend: this.getBlend(),\n depth: { enable: depth },\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_half_frag,\n vert: line_half_vert,\n type: 'normal',\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: 3,\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, vertex[5]]\n : [vertex[3], vertexIndex, vertex[5]];\n },\n },\n });\n this.styleAttributeService.registerStyleAttribute({\n name: 'dirPoints',\n type: AttributeType.Attribute,\n descriptor: {\n name: 'a_dirPoints',\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: 4,\n update: (\n feature: IEncodeFeature,\n featureIdx: number,\n vertex: number[],\n attributeIdx: number,\n ) => {\n // console.log(feature)\n const startPoint = (feature.coordinates[0] || [0, 0]) as number[];\n const endPoint = (feature.coordinates[3] || [0, 0]) as number[];\n\n return [startPoint[0], startPoint[1], endPoint[0], endPoint[1]];\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}\n"],"file":"half.js"}
|
package/lib/line/models/index.js
CHANGED
|
@@ -7,20 +7,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
|
|
10
|
+
var _tileModel = _interopRequireDefault(require("../../tile/models/tileModel"));
|
|
11
|
+
|
|
10
12
|
var _arc = _interopRequireDefault(require("./arc"));
|
|
11
13
|
|
|
12
14
|
var _arc_3d = _interopRequireDefault(require("./arc_3d"));
|
|
13
15
|
|
|
14
16
|
var _arcmini = _interopRequireDefault(require("./arcmini"));
|
|
15
17
|
|
|
18
|
+
var _earthArc_3d = _interopRequireDefault(require("./earthArc_3d"));
|
|
19
|
+
|
|
16
20
|
var _great_circle = _interopRequireDefault(require("./great_circle"));
|
|
17
21
|
|
|
22
|
+
var _half = _interopRequireDefault(require("./half"));
|
|
23
|
+
|
|
18
24
|
var _line = _interopRequireDefault(require("./line"));
|
|
19
25
|
|
|
20
26
|
var _linearline = _interopRequireDefault(require("./linearline"));
|
|
21
27
|
|
|
22
28
|
var _simpleLine = _interopRequireDefault(require("./simpleLine"));
|
|
23
29
|
|
|
30
|
+
var _tile = _interopRequireDefault(require("./tile"));
|
|
31
|
+
|
|
24
32
|
var _wall = _interopRequireDefault(require("./wall"));
|
|
25
33
|
|
|
26
34
|
var LineModels = {
|
|
@@ -30,8 +38,12 @@ var LineModels = {
|
|
|
30
38
|
greatcircle: _great_circle.default,
|
|
31
39
|
wall: _wall.default,
|
|
32
40
|
line: _line.default,
|
|
41
|
+
halfLine: _half.default,
|
|
33
42
|
simple: _simpleLine.default,
|
|
34
|
-
linearline: _linearline.default
|
|
43
|
+
linearline: _linearline.default,
|
|
44
|
+
vectorline: _tileModel.default,
|
|
45
|
+
tileLine: _tile.default,
|
|
46
|
+
earthArc3d: _earthArc_3d.default
|
|
35
47
|
};
|
|
36
48
|
var _default = LineModels;
|
|
37
49
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineModels","arc","ArcModel","arcmini","ArcMiniModel","arc3d","Arc3DModel","greatcircle","GreatCircleModel","wall","LineWallModel","line","LineModel","simple","SimpleLineModel","linearline","LinearLine"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["../../../src/line/models/index.ts"],"names":["LineModels","arc","ArcModel","arcmini","ArcMiniModel","arc3d","Arc3DModel","greatcircle","GreatCircleModel","wall","LineWallModel","line","LineModel","halfLine","LineHalfModel","simple","SimpleLineModel","linearline","LinearLine","vectorline","LineTileModel","tileLine","TileLineModel","earthArc3d","EarthArc3DModel"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAgBA,IAAMA,UAA2C,GAAG;AAClDC,EAAAA,GAAG,EAAEC,YAD6C;AAElDC,EAAAA,OAAO,EAAEC,gBAFyC;AAGlDC,EAAAA,KAAK,EAAEC,eAH2C;AAIlDC,EAAAA,WAAW,EAAEC,qBAJqC;AAKlDC,EAAAA,IAAI,EAAEC,aAL4C;AAMlDC,EAAAA,IAAI,EAAEC,aAN4C;AAOlDC,EAAAA,QAAQ,EAAEC,aAPwC;AAQlDC,EAAAA,MAAM,EAAEC,mBAR0C;AASlDC,EAAAA,UAAU,EAAEC,mBATsC;AAUlDC,EAAAA,UAAU,EAAEC,kBAVsC;AAWlDC,EAAAA,QAAQ,EAAEC,aAXwC;AAYlDC,EAAAA,UAAU,EAAEC;AAZsC,CAApD;eAeexB,U","sourcesContent":["import LineTileModel from '../../tile/models/tileModel';\nimport ArcModel from './arc';\nimport Arc3DModel from './arc_3d';\nimport ArcMiniModel from './arcmini';\nimport EarthArc3DModel from './earthArc_3d';\nimport GreatCircleModel from './great_circle';\nimport LineHalfModel from './half';\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 | 'halfLine'\n | 'linearline'\n | 'vectorline'\n | 'tileLine'\n | 'earthArc3d';\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 halfLine: LineHalfModel,\n simple: SimpleLineModel,\n linearline: LinearLine,\n vectorline: LineTileModel,\n tileLine: TileLineModel,\n earthArc3d: EarthArc3DModel,\n};\n\nexport default LineModels;\n"],"file":"index.js"}
|