-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(Layer): add FeatureGeometryLayer.
- Loading branch information
Showing
9 changed files
with
80 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Group } from 'three'; | ||
|
||
import GeometryLayer from 'Layer/GeometryLayer'; | ||
import FeatureProcessing from 'Process/FeatureProcessing'; | ||
import Feature2Mesh from 'Converter/Feature2Mesh'; | ||
|
||
/** | ||
* `FeatureGeometryLayer` displays geographic vector data (geojson, kml...) in object 3D. | ||
* `FeatureGeometryLayer` is a pre-configured `GeometryLayer` to load and convert vector data. | ||
* In deed, `GeometryLayer` allows customizing data loading (`update` method) | ||
* and their conversion (`convert` method), | ||
* | ||
* @property {boolean} isFeatureGeometryLayer - Used to checkout whether this layer is | ||
* a FeatureGeometryLayer. Default is true. You should not change this, as it is used | ||
* internally for optimisation. | ||
*/ | ||
class FeatureGeometryLayer extends GeometryLayer { | ||
/** | ||
* @constructor | ||
* @extends GeometryLayer | ||
* | ||
* @param {string} id - The id of the layer, that should be unique. It is | ||
* not mandatory, but an error will be emitted if this layer is added a | ||
* {@link View} that already has a layer going by that id. | ||
* @param {Object} [config] - Optional configuration, all elements in it | ||
* will be merged as is in the layer. | ||
* @param {function} [options.batchId] - optional function to create batchId attribute. | ||
* It is passed the feature property and the feature index. | ||
* As the batchId is using an unsigned int structure on 32 bits, the batchId could be between 0 and 4,294,967,295. | ||
* @param {THREE.Object3D} [config.object3d=new THREE.Group()] root object3d layer. | ||
* | ||
*/ | ||
constructor(id, config = {}) { | ||
config.update = FeatureProcessing.update; | ||
config.convert = Feature2Mesh.convert({ | ||
batchId: config.batchId, | ||
}, | ||
); | ||
super(id, config.object3d || new Group(), config); | ||
this.isFeatureGeometryLayer = true; | ||
} | ||
} | ||
|
||
export default FeatureGeometryLayer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters