forked from geosolutions-it/MapStore2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
geosolutions-it#81: implemented a simple 3dtileset layer for CesiumJS…
…, basic options, only a url (using https://github.com/CesiumGS/3d-tiles-samples as a server)
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
web/client/components/map/cesium/plugins/ThreeDimTileSetLayer.js
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,29 @@ | ||
import Layers from '../../../../utils/cesium/Layers'; | ||
import * as Cesium from 'Cesium'; | ||
|
||
Layers.registerType('3dtileset', { | ||
create: (options, map) => { | ||
if (options.visibility) { | ||
const tileSet = map.scene.primitives.add(new Cesium.Cesium3DTileset({ | ||
url: options.url | ||
})); | ||
map.zoomTo(tileSet, new Cesium.HeadingPitchRange(0, -0.5, 0)); | ||
return { | ||
detached: true, | ||
tileSet, | ||
remove: () => { | ||
map.scene.primitives.remove(tileSet); | ||
} | ||
}; | ||
} | ||
return null; | ||
}, | ||
update: function(layer, newOptions, oldOptions, map) { | ||
if (!newOptions.visibility && oldOptions.visibility) { | ||
layer.remove(); | ||
} else if (newOptions.visibility && !oldOptions.visibility) { | ||
return this.create(newOptions, map); | ||
} | ||
return null; | ||
} | ||
}); |
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