f35b59a5 by jikai

111111

1 parent 5410061f
......@@ -5,20 +5,52 @@
</template>
<script>
export default {
components: {},
data() {
return {
viewer: undefined,
entity: undefined,
}
},
mounted() {
Cesium.Ion.defaultAccessToken = this.config.mapToken;
var viewer = new Cesium.Viewer('cesiumContainer', {
fullscreenButton: true,
this.viewer = new Cesium.Viewer('cesiumContainer', {
geocoder:true,
timeline:false
});
this.viewer.imageryLayers.addImageryProvider(
new Cesium.UrlTemplateImageryProvider({
url: "https://mt1.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali"
}));
let tileset = new Cesium.Cesium3DTileset({
url : 'http://localhost:9000/model/e44fe150d09b11eaabec1d24e8548b3a/tileset.json',
skipLevelOfDetail : true,
baseScreenSpaceError : 1024,
skipScreenSpaceErrorFactor : 16,
skipLevels : 1,
immediatelyLoadDesiredLevelOfDetail : false,
loadSiblings : false,
cullWithChildrenBounds : true
}), height = -2440;
this.viewer.scene.primitives.add(tileset);
tileset.readyPromise.then(argument => {
var cartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height);
var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height + height);
var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
this.viewer.zoomTo(tileset);
});
},
methods: {
......