123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <template>
- <div id="container" class="box">
- <div id="cesiumContainer"></div>
- </div>
- </template>
- <script>
- var Cesium = require("cesium/Cesium");
- var widgets = require("cesium/Widgets/widgets.css");
- import wtTree from "../../public/static/fj";
- export default {
- name: "cesiumPage",
- data() {
- return {
- publicPath: process.env.BASE_URL,
- url: "http://localhost:8888/tiles",
-
- initPosition: [106.0231304, 37.73323706, 0],
- viewer: null,
- };
- },
- mounted() {
- this.viewer = new Cesium.Viewer("cesiumContainer", {
- animation: false,
- shouldAnimate: true,
- homeButton: false,
- fullscreenButton: false,
- baseLayerPicker: false,
- geocoder: false,
- timeline: false,
- sceneModePicker: false,
- navigationHelpButton: false,
- infoBox: false,
- requestRenderMode: true,
- scene3DOnly: false,
- sceneMode: 3,
- fullscreenElement: document.body,
- imageryProvider: new Cesium.TileMapServiceImageryProvider({
- url: this.url,
- fileExtension: "jpg",
- maximumLevel: 13,
- }),
- baseLayerPicker: false,
- });
-
-
- var scene = this.viewer.scene;
-
-
- scene.skyAtmosphere.hueShift = -0.8;
- scene.skyAtmosphere.saturationShift = -0.7;
- scene.skyAtmosphere.brightnessShift = -0.33;
- scene.fog.density = 0.001;
- scene.fog.minimumBrightness = 0.8;
-
- Cesium.Math.setRandomNumberSeed(0);
- var promise = this.viewer.dataSources.add(
- Cesium.GeoJsonDataSource.load(
- `${this.publicPath}static/mapgeoJsonnx.json`,
- {
- stroke: Cesium.Color.RAD,
- fill: Cesium.Color.TRANSPARENT,
- strokeWidth: 3,
- markerSymbol: "?",
- }
- )
- );
- this.viewer._cesiumWidget._creditContainer.style.display = "none";
-
- var position = Cesium.Cartesian3.fromDegrees(117.48, 30.67, 0);
- },
- methods: {
- addFengjiModel(position) {
- var hpRoll = new Cesium.HeadingPitchRoll(0.0, 0.0, 0.0);
- var origin = Cesium.Cartesian3.fromDegrees(106.0231304, 37.73323706, 0);
- var orientation = Cesium.Transforms.headingPitchRollQuaternion(
- position,
- hpRoll
- );
- var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
- origin,
- hpRoll
- );
- var model = this.viewer.scene.primitives.add(
- Cesium.Model.fromGltf({
- url: `${this.publicPath}static/WT01.glb`,
- modelMatrix: modelMatrix,
- minimumPixelSize: 150,
-
- maximumSize: 150,
-
- maximumScale: 200,
- scale: 0.05,
- runAnimations: true,
- })
- );
- },
- },
- };
- </script>
-
- <style scoped>
- html,
- body,
- #cesiumContainer {
- width: 100%;
- height: 100%;
- margin: 0;
- padding: 0;
- overflow: hidden;
- }
- .box {
- height: 100%;
- }
- </style>
|