Ver código fonte

add s3m layer

tags/2.11.0
Caven Chen 3 anos atrás
pai
commit
6f01b72eb7
2 arquivos alterados com 36 adições e 3 exclusões
  1. 35
    2
      modules/s3m/S3MLayer.js
  2. 1
    1
      packages/s3m/src/components.js

+ 35
- 2
modules/s3m/S3MLayer.js Ver arquivo

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


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


class S3MLayer extends Layer { class S3MLayer extends Layer {
constructor(id, url) {
constructor(id, url, options = {}) {
super(id) 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 Ver arquivo

* @Date: 2021-03-13 17:17:19 * @Date: 2021-03-13 17:17:19
*/ */


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


const components = { S3MLayer } const components = { S3MLayer }



Carregando…
Cancelar
Salvar