Browse Source

add s3m layer

tags/2.11.0
Caven Chen 3 years ago
parent
commit
6f01b72eb7
2 changed files with 36 additions and 3 deletions
  1. 35
    2
      modules/s3m/S3MLayer.js
  2. 1
    1
      packages/s3m/src/components.js

+ 35
- 2
modules/s3m/S3MLayer.js View File

@@ -3,13 +3,46 @@
* @Date: 2022-02-20 13:46:53
*/

import { Cesium } from '@dc-modules/namespace'
import State from '@dc-modules/state/State'
import { Layer } from '@dc-modules/layer'
import S3MTilesLayer from 's3m-lib/S3MTiles/S3MTilesLayer'
import ClusterLayer from '../layer/type/ClusterLayer'

class S3MLayer extends Layer {
constructor(id, url) {
constructor(id, url, options = {}) {
super(id)
this._url = url
this._options = options
}

get type() {
return Layer.getLayerType('s3m')
}

_onAdd(viewer) {
this._viewer = viewer
delete this._options['context']
delete this._options['url']
this._delegate = new S3MTilesLayer({
context: this._viewer.scene.context,
url: this._url,
...this._options
})
this._viewer.scene.primitives.add(this._delegate)
this._addedHook && this._addedHook()
this._state = State.ADDED
}

_onRemove() {
if (!this._delegate) {
return
}
this._viewer.scene.primitives.remove(this._delegate)
this._removedHook && this._removedHook()
this._state = State.REMOVED
}
}

Layer.registerType('s3m')

export default S3MLayer

+ 1
- 1
packages/s3m/src/components.js View File

@@ -3,7 +3,7 @@
* @Date: 2021-03-13 17:17:19
*/

import S3MLayer from '@dc-modules/mapv/MapvLayer'
import S3MLayer from '@dc-modules/s3m/S3MLayer'

const components = { S3MLayer }


Loading…
Cancel
Save