@antv/l7-core
Advanced tools
Comparing version 2.9.17-alpha.0 to 2.9.17
@@ -34,6 +34,2 @@ import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook'; | ||
} | ||
export interface IWorkerOption { | ||
modelType: string; | ||
[key: string]: any; | ||
} | ||
export interface ILayerModelInitializationOptions { | ||
@@ -45,4 +41,2 @@ moduleName: string; | ||
segmentNumber?: number; | ||
workerEnabled?: boolean; | ||
workerOptions?: IWorkerOption; | ||
} | ||
@@ -55,4 +49,4 @@ export interface ILayerModel { | ||
getAnimateUniforms(): IModelUniform; | ||
buildModels(callbackModel: (models: IModel[]) => void): void; | ||
initModels(callbackModel: (models: IModel[]) => void): void; | ||
buildModels(): IModel[]; | ||
initModels(): IModel[]; | ||
needUpdate(): boolean; | ||
@@ -116,6 +110,10 @@ clearModels(): void; | ||
rampColorsData?: ImageData | IImagedata; | ||
pixelConstant?: number; | ||
pixelConstantR?: number; | ||
pixelConstantG?: number; | ||
pixelConstantB?: number; | ||
pixelConstantRGB?: number; | ||
coords?: string; | ||
sourceLayer?: string; | ||
featureId?: string; | ||
workerEnabled?: boolean; | ||
} | ||
@@ -240,3 +238,3 @@ export interface ITilePickManager { | ||
rebuildModels(): void; | ||
buildLayerModel(options: ILayerModelInitializationOptions & Partial<IModelInitializationOptions>): Promise<IModel>; | ||
buildLayerModel(options: ILayerModelInitializationOptions & Partial<IModelInitializationOptions>): IModel; | ||
createAttrubutes(options: ILayerModelInitializationOptions & Partial<IModelInitializationOptions>): { | ||
@@ -427,3 +425,2 @@ [attributeName: string]: IAttribute; | ||
iconfont: boolean; | ||
workerEnabled?: boolean; | ||
onHover(pickedFeature: IPickedFeature): void; | ||
@@ -430,0 +427,0 @@ onClick(pickedFeature: IPickedFeature): void; |
@@ -163,3 +163,2 @@ import { IAttribute, IAttributeInitializationOptions } from '../renderer/IAttribute'; | ||
}; | ||
createAttributesAndIndicesAscy(encodedFeatures: IEncodeFeature[], segmentNumber?: number, workerOptions?: any): Promise<any>; | ||
/** | ||
@@ -166,0 +165,0 @@ * 根据 feature range 更新指定属性 |
import 'reflect-metadata'; | ||
import { IAttribute } from '../renderer/IAttribute'; | ||
import { IElements } from '../renderer/IElements'; | ||
import { IWorkerOption } from './ILayerService'; | ||
import { IEncodeFeature, IStyleAttribute, IStyleAttributeInitializationOptions, IStyleAttributeService, IStyleAttributeUpdateOptions, Triangulation } from './IStyleAttributeService'; | ||
@@ -26,3 +25,2 @@ /** | ||
updateAttributeByFeatureRange(attributeName: string, features: IEncodeFeature[], startFeatureIdx?: number, endFeatureIdx?: number): void; | ||
createAttributesAndIndicesAscy(features: IEncodeFeature[], segmentNumber: number, workerOptions: IWorkerOption): Promise<unknown>; | ||
createAttributesAndIndices(features: IEncodeFeature[], triangulation: Triangulation, segmentNumber: number): { | ||
@@ -40,3 +38,2 @@ attributes: { | ||
clearAllAttributes(): void; | ||
private getDescriptorsWithOutFunc; | ||
} |
@@ -9,6 +9,4 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; | ||
import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
var _excluded = ["modelType"], | ||
_excluded2 = ["buffer", "update", "name"], | ||
_excluded3 = ["buffer", "update", "name"], | ||
_excluded4 = ["buffer", "update", "name"]; | ||
var _excluded = ["buffer", "update", "name"], | ||
_excluded2 = ["buffer", "update", "name"]; | ||
@@ -21,3 +19,2 @@ var _bytesPerElementMap, _dec, _dec2, _class, _class2, _descriptor; | ||
import { executeWorkerTask } from '@antv/l7-utils'; | ||
import { inject, injectable } from 'inversify'; | ||
@@ -172,66 +169,5 @@ import 'reflect-metadata'; | ||
}, { | ||
key: "createAttributesAndIndicesAscy", | ||
value: function createAttributesAndIndicesAscy(features, segmentNumber, workerOptions) { | ||
var _this = this; | ||
this.featureLayout = { | ||
sizePerElement: 0, | ||
elements: [] | ||
}; | ||
var descriptors = this.attributes.map(function (attr) { | ||
attr.resetDescriptor(); | ||
return attr.descriptor; | ||
}).filter(function (d) { | ||
return d; | ||
}); | ||
var modelType = workerOptions.modelType, | ||
restOptions = _objectWithoutProperties(workerOptions, _excluded); | ||
var _this$rendererService = this.rendererService, | ||
createAttribute = _this$rendererService.createAttribute, | ||
createBuffer = _this$rendererService.createBuffer, | ||
createElements = _this$rendererService.createElements; | ||
var attributes = {}; | ||
return new Promise(function (resolve, reject) { | ||
executeWorkerTask(modelType, _objectSpread({ | ||
descriptors: _this.getDescriptorsWithOutFunc(descriptors), | ||
features: features, | ||
segmentNumber: segmentNumber | ||
}, restOptions)).then(function (e) { | ||
e.descriptors.forEach(function (descriptor, attributeIdx) { | ||
if (descriptor) { | ||
var buffer = descriptor.buffer, | ||
update = descriptor.update, | ||
name = descriptor.name, | ||
rest = _objectWithoutProperties(descriptor, _excluded2); | ||
var vertexAttribute = createAttribute(_objectSpread({ | ||
buffer: createBuffer(buffer) | ||
}, rest)); | ||
attributes[descriptor.name || ''] = vertexAttribute; | ||
_this.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
} | ||
}); | ||
_this.featureLayout = e.featureLayout; | ||
var elements = createElements({ | ||
data: e.indices, | ||
type: gl.UNSIGNED_INT, | ||
count: e.indices.length | ||
}); | ||
_this.attributesAndIndices = { | ||
attributes: attributes, | ||
elements: elements | ||
}; | ||
resolve(_this.attributesAndIndices); | ||
}).catch(function (err) { | ||
console.warn(err); | ||
reject(err); | ||
}); | ||
}); | ||
} | ||
}, { | ||
key: "createAttributesAndIndices", | ||
value: function createAttributesAndIndices(features, triangulation, segmentNumber) { | ||
var _this2 = this; | ||
var _this = this; | ||
@@ -257,8 +193,8 @@ this.featureLayout = { | ||
features.forEach(function (feature, featureIdx) { | ||
var _this2$triangulation = _this2.triangulation(feature, segmentNumber), | ||
indicesForCurrentFeature = _this2$triangulation.indices, | ||
verticesForCurrentFeature = _this2$triangulation.vertices, | ||
normalsForCurrentFeature = _this2$triangulation.normals, | ||
vertexSize = _this2$triangulation.size, | ||
indexes = _this2$triangulation.indexes; | ||
var _this$triangulation = _this.triangulation(feature, segmentNumber), | ||
indicesForCurrentFeature = _this$triangulation.indices, | ||
verticesForCurrentFeature = _this$triangulation.vertices, | ||
normalsForCurrentFeature = _this$triangulation.normals, | ||
vertexSize = _this$triangulation.size, | ||
indexes = _this$triangulation.indexes; | ||
@@ -270,5 +206,5 @@ indicesForCurrentFeature.forEach(function (i) { | ||
var verticesNumForCurrentFeature = verticesForCurrentFeature.length / vertexSize; | ||
_this2.featureLayout.sizePerElement = size; | ||
_this.featureLayout.sizePerElement = size; | ||
_this2.featureLayout.elements.push({ | ||
_this.featureLayout.elements.push({ | ||
featureIdx: featureIdx, | ||
@@ -304,6 +240,6 @@ vertices: verticesForCurrentFeature, | ||
}); | ||
var _this$rendererService2 = this.rendererService, | ||
createAttribute = _this$rendererService2.createAttribute, | ||
createBuffer = _this$rendererService2.createBuffer, | ||
createElements = _this$rendererService2.createElements; | ||
var _this$rendererService = this.rendererService, | ||
createAttribute = _this$rendererService.createAttribute, | ||
createBuffer = _this$rendererService.createBuffer, | ||
createElements = _this$rendererService.createElements; | ||
var attributes = {}; | ||
@@ -315,3 +251,3 @@ descriptors.forEach(function (descriptor, attributeIdx) { | ||
name = descriptor.name, | ||
rest = _objectWithoutProperties(descriptor, _excluded3); | ||
rest = _objectWithoutProperties(descriptor, _excluded); | ||
@@ -322,3 +258,3 @@ var vertexAttribute = createAttribute(_objectSpread({ | ||
attributes[descriptor.name || ''] = vertexAttribute; | ||
_this2.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
_this.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
} | ||
@@ -340,3 +276,3 @@ }); | ||
value: function createAttributes(features, triangulation) { | ||
var _this3 = this; | ||
var _this2 = this; | ||
@@ -360,8 +296,8 @@ this.featureLayout = { | ||
features.forEach(function (feature, featureIdx) { | ||
var _this3$triangulation = _this3.triangulation(feature), | ||
indicesForCurrentFeature = _this3$triangulation.indices, | ||
verticesForCurrentFeature = _this3$triangulation.vertices, | ||
normalsForCurrentFeature = _this3$triangulation.normals, | ||
vertexSize = _this3$triangulation.size, | ||
indexes = _this3$triangulation.indexes; | ||
var _this2$triangulation = _this2.triangulation(feature), | ||
indicesForCurrentFeature = _this2$triangulation.indices, | ||
verticesForCurrentFeature = _this2$triangulation.vertices, | ||
normalsForCurrentFeature = _this2$triangulation.normals, | ||
vertexSize = _this2$triangulation.size, | ||
indexes = _this2$triangulation.indexes; | ||
@@ -373,5 +309,5 @@ indicesForCurrentFeature.forEach(function (i) { | ||
var verticesNumForCurrentFeature = verticesForCurrentFeature.length / vertexSize; | ||
_this3.featureLayout.sizePerElement = size; | ||
_this2.featureLayout.sizePerElement = size; | ||
_this3.featureLayout.elements.push({ | ||
_this2.featureLayout.elements.push({ | ||
featureIdx: featureIdx, | ||
@@ -407,5 +343,5 @@ vertices: verticesForCurrentFeature, | ||
}); | ||
var _this$rendererService3 = this.rendererService, | ||
createAttribute = _this$rendererService3.createAttribute, | ||
createBuffer = _this$rendererService3.createBuffer; | ||
var _this$rendererService2 = this.rendererService, | ||
createAttribute = _this$rendererService2.createAttribute, | ||
createBuffer = _this$rendererService2.createBuffer; | ||
var attributes = {}; | ||
@@ -417,3 +353,3 @@ descriptors.forEach(function (descriptor, attributeIdx) { | ||
name = descriptor.name, | ||
rest = _objectWithoutProperties(descriptor, _excluded4); | ||
rest = _objectWithoutProperties(descriptor, _excluded2); | ||
@@ -424,3 +360,3 @@ var vertexAttribute = createAttribute(_objectSpread({ | ||
attributes[descriptor.name || ''] = vertexAttribute; | ||
_this3.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
_this2.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
} | ||
@@ -445,13 +381,2 @@ }); | ||
} | ||
}, { | ||
key: "getDescriptorsWithOutFunc", | ||
value: function getDescriptorsWithOutFunc(descriptors) { | ||
return descriptors.map(function (d) { | ||
return { | ||
buffer: d.buffer, | ||
name: d.name, | ||
size: d.size | ||
}; | ||
}); | ||
} | ||
}]); | ||
@@ -458,0 +383,0 @@ |
@@ -325,2 +325,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; | ||
this.layerService.add(layer); | ||
this.render(); | ||
} | ||
@@ -332,2 +333,3 @@ }, { | ||
this.layerService.addMask(mask); | ||
this.render(); | ||
} | ||
@@ -334,0 +336,0 @@ }, { |
@@ -59,3 +59,2 @@ import { TilesetManager } from '@antv/l7-utils'; | ||
export interface ISource { | ||
inited: boolean; | ||
data: IParserData; | ||
@@ -77,5 +76,2 @@ center: [number, number]; | ||
destroy(): void; | ||
on(type: string, handler: (...args: any[]) => void): void; | ||
off(type: string, handler: (...args: any[]) => void): void; | ||
once(type: string, handler: (...args: any[]) => void): void; | ||
} | ||
@@ -82,0 +78,0 @@ export interface IRasterCfg { |
@@ -26,4 +26,2 @@ "use strict"; | ||
var _l7Utils = require("@antv/l7-utils"); | ||
var _inversify = require("inversify"); | ||
@@ -39,6 +37,4 @@ | ||
var _excluded = ["modelType"], | ||
_excluded2 = ["buffer", "update", "name"], | ||
_excluded3 = ["buffer", "update", "name"], | ||
_excluded4 = ["buffer", "update", "name"]; | ||
var _excluded = ["buffer", "update", "name"], | ||
_excluded2 = ["buffer", "update", "name"]; | ||
@@ -189,63 +185,5 @@ var _bytesPerElementMap, _dec, _dec2, _class, _class2, _descriptor; | ||
}, { | ||
key: "createAttributesAndIndicesAscy", | ||
value: function createAttributesAndIndicesAscy(features, segmentNumber, workerOptions) { | ||
var _this = this; | ||
this.featureLayout = { | ||
sizePerElement: 0, | ||
elements: [] | ||
}; | ||
var descriptors = this.attributes.map(function (attr) { | ||
attr.resetDescriptor(); | ||
return attr.descriptor; | ||
}).filter(function (d) { | ||
return d; | ||
}); | ||
var modelType = workerOptions.modelType, | ||
restOptions = (0, _objectWithoutProperties2.default)(workerOptions, _excluded); | ||
var _this$rendererService = this.rendererService, | ||
createAttribute = _this$rendererService.createAttribute, | ||
createBuffer = _this$rendererService.createBuffer, | ||
createElements = _this$rendererService.createElements; | ||
var attributes = {}; | ||
return new Promise(function (resolve, reject) { | ||
(0, _l7Utils.executeWorkerTask)(modelType, _objectSpread({ | ||
descriptors: _this.getDescriptorsWithOutFunc(descriptors), | ||
features: features, | ||
segmentNumber: segmentNumber | ||
}, restOptions)).then(function (e) { | ||
e.descriptors.forEach(function (descriptor, attributeIdx) { | ||
if (descriptor) { | ||
var buffer = descriptor.buffer, | ||
update = descriptor.update, | ||
name = descriptor.name, | ||
rest = (0, _objectWithoutProperties2.default)(descriptor, _excluded2); | ||
var vertexAttribute = createAttribute(_objectSpread({ | ||
buffer: createBuffer(buffer) | ||
}, rest)); | ||
attributes[descriptor.name || ''] = vertexAttribute; | ||
_this.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
} | ||
}); | ||
_this.featureLayout = e.featureLayout; | ||
var elements = createElements({ | ||
data: e.indices, | ||
type: _gl.gl.UNSIGNED_INT, | ||
count: e.indices.length | ||
}); | ||
_this.attributesAndIndices = { | ||
attributes: attributes, | ||
elements: elements | ||
}; | ||
resolve(_this.attributesAndIndices); | ||
}).catch(function (err) { | ||
console.warn(err); | ||
reject(err); | ||
}); | ||
}); | ||
} | ||
}, { | ||
key: "createAttributesAndIndices", | ||
value: function createAttributesAndIndices(features, triangulation, segmentNumber) { | ||
var _this2 = this; | ||
var _this = this; | ||
@@ -271,8 +209,8 @@ this.featureLayout = { | ||
features.forEach(function (feature, featureIdx) { | ||
var _this2$triangulation = _this2.triangulation(feature, segmentNumber), | ||
indicesForCurrentFeature = _this2$triangulation.indices, | ||
verticesForCurrentFeature = _this2$triangulation.vertices, | ||
normalsForCurrentFeature = _this2$triangulation.normals, | ||
vertexSize = _this2$triangulation.size, | ||
indexes = _this2$triangulation.indexes; | ||
var _this$triangulation = _this.triangulation(feature, segmentNumber), | ||
indicesForCurrentFeature = _this$triangulation.indices, | ||
verticesForCurrentFeature = _this$triangulation.vertices, | ||
normalsForCurrentFeature = _this$triangulation.normals, | ||
vertexSize = _this$triangulation.size, | ||
indexes = _this$triangulation.indexes; | ||
@@ -284,5 +222,5 @@ indicesForCurrentFeature.forEach(function (i) { | ||
var verticesNumForCurrentFeature = verticesForCurrentFeature.length / vertexSize; | ||
_this2.featureLayout.sizePerElement = size; | ||
_this.featureLayout.sizePerElement = size; | ||
_this2.featureLayout.elements.push({ | ||
_this.featureLayout.elements.push({ | ||
featureIdx: featureIdx, | ||
@@ -318,6 +256,6 @@ vertices: verticesForCurrentFeature, | ||
}); | ||
var _this$rendererService2 = this.rendererService, | ||
createAttribute = _this$rendererService2.createAttribute, | ||
createBuffer = _this$rendererService2.createBuffer, | ||
createElements = _this$rendererService2.createElements; | ||
var _this$rendererService = this.rendererService, | ||
createAttribute = _this$rendererService.createAttribute, | ||
createBuffer = _this$rendererService.createBuffer, | ||
createElements = _this$rendererService.createElements; | ||
var attributes = {}; | ||
@@ -329,3 +267,3 @@ descriptors.forEach(function (descriptor, attributeIdx) { | ||
name = descriptor.name, | ||
rest = (0, _objectWithoutProperties2.default)(descriptor, _excluded3); | ||
rest = (0, _objectWithoutProperties2.default)(descriptor, _excluded); | ||
var vertexAttribute = createAttribute(_objectSpread({ | ||
@@ -335,3 +273,3 @@ buffer: createBuffer(buffer) | ||
attributes[descriptor.name || ''] = vertexAttribute; | ||
_this2.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
_this.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
} | ||
@@ -353,3 +291,3 @@ }); | ||
value: function createAttributes(features, triangulation) { | ||
var _this3 = this; | ||
var _this2 = this; | ||
@@ -373,8 +311,8 @@ this.featureLayout = { | ||
features.forEach(function (feature, featureIdx) { | ||
var _this3$triangulation = _this3.triangulation(feature), | ||
indicesForCurrentFeature = _this3$triangulation.indices, | ||
verticesForCurrentFeature = _this3$triangulation.vertices, | ||
normalsForCurrentFeature = _this3$triangulation.normals, | ||
vertexSize = _this3$triangulation.size, | ||
indexes = _this3$triangulation.indexes; | ||
var _this2$triangulation = _this2.triangulation(feature), | ||
indicesForCurrentFeature = _this2$triangulation.indices, | ||
verticesForCurrentFeature = _this2$triangulation.vertices, | ||
normalsForCurrentFeature = _this2$triangulation.normals, | ||
vertexSize = _this2$triangulation.size, | ||
indexes = _this2$triangulation.indexes; | ||
@@ -386,5 +324,5 @@ indicesForCurrentFeature.forEach(function (i) { | ||
var verticesNumForCurrentFeature = verticesForCurrentFeature.length / vertexSize; | ||
_this3.featureLayout.sizePerElement = size; | ||
_this2.featureLayout.sizePerElement = size; | ||
_this3.featureLayout.elements.push({ | ||
_this2.featureLayout.elements.push({ | ||
featureIdx: featureIdx, | ||
@@ -420,5 +358,5 @@ vertices: verticesForCurrentFeature, | ||
}); | ||
var _this$rendererService3 = this.rendererService, | ||
createAttribute = _this$rendererService3.createAttribute, | ||
createBuffer = _this$rendererService3.createBuffer; | ||
var _this$rendererService2 = this.rendererService, | ||
createAttribute = _this$rendererService2.createAttribute, | ||
createBuffer = _this$rendererService2.createBuffer; | ||
var attributes = {}; | ||
@@ -430,3 +368,3 @@ descriptors.forEach(function (descriptor, attributeIdx) { | ||
name = descriptor.name, | ||
rest = (0, _objectWithoutProperties2.default)(descriptor, _excluded4); | ||
rest = (0, _objectWithoutProperties2.default)(descriptor, _excluded2); | ||
var vertexAttribute = createAttribute(_objectSpread({ | ||
@@ -436,3 +374,3 @@ buffer: createBuffer(buffer) | ||
attributes[descriptor.name || ''] = vertexAttribute; | ||
_this3.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
_this2.attributes[attributeIdx].vertexAttribute = vertexAttribute; | ||
} | ||
@@ -457,13 +395,2 @@ }); | ||
} | ||
}, { | ||
key: "getDescriptorsWithOutFunc", | ||
value: function getDescriptorsWithOutFunc(descriptors) { | ||
return descriptors.map(function (d) { | ||
return { | ||
buffer: d.buffer, | ||
name: d.name, | ||
size: d.size | ||
}; | ||
}); | ||
} | ||
}]); | ||
@@ -470,0 +397,0 @@ return StyleAttributeService; |
@@ -330,2 +330,3 @@ "use strict"; | ||
this.layerService.add(layer); | ||
this.render(); | ||
} | ||
@@ -337,2 +338,3 @@ }, { | ||
this.layerService.addMask(mask); | ||
this.render(); | ||
} | ||
@@ -339,0 +341,0 @@ }, { |
{ | ||
"name": "@antv/l7-core", | ||
"version": "2.9.17-alpha.0", | ||
"version": "2.9.17", | ||
"description": "", | ||
@@ -27,3 +27,3 @@ "main": "lib/index.js", | ||
"@antv/async-hook": "^2.1.0", | ||
"@antv/l7-utils": "2.9.17-alpha.0", | ||
"@antv/l7-utils": "2.9.17", | ||
"@babel/runtime": "^7.7.7", | ||
@@ -49,3 +49,3 @@ "ajv": "^6.10.2", | ||
}, | ||
"gitHead": "40e29ed8c7e46515bd76123a87f6b93c587f4f04", | ||
"gitHead": "47d1b2e7fcd601a83e5270d19ceba9f18298377a", | ||
"publishConfig": { | ||
@@ -52,0 +52,0 @@ "access": "public" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
1686704
17432
+ Added@antv/l7-utils@2.9.17(transitive)
- Removed@antv/l7-utils@2.9.17-alpha.0(transitive)
- Removedearcut@2.2.4(transitive)
- Removedweb-worker-helper@0.0.3(transitive)
Updated@antv/l7-utils@2.9.17