Commit 2770a838 by lyc

更新了刻度盘

parent be9b10a4
...@@ -41,6 +41,7 @@ import vueCodeRectangularSpaceGrid from '@/examples/sceneSet/rectangularSpaceGri ...@@ -41,6 +41,7 @@ import vueCodeRectangularSpaceGrid from '@/examples/sceneSet/rectangularSpaceGri
import vueCodeEarthCoordinate from '@/examples/sceneSet/earthCoordinate/earthCoordinate.vue?raw' import vueCodeEarthCoordinate from '@/examples/sceneSet/earthCoordinate/earthCoordinate.vue?raw'
import vueCodeSkyBox from '@/examples/sceneSet/skyBox/skyBox.vue?raw' import vueCodeSkyBox from '@/examples/sceneSet/skyBox/skyBox.vue?raw'
import vueCodeMapx from '@/examples/sceneSet/mapx/mapx.vue?raw' import vueCodeMapx from '@/examples/sceneSet/mapx/mapx.vue?raw'
import vueCodeScale from '@/examples/sceneSet/scale/scale.vue?raw'
// 相机 // 相机
import vueCodeViewTrack from '@/examples/camera/viewTrack/viewTrack.vue?raw' import vueCodeViewTrack from '@/examples/camera/viewTrack/viewTrack.vue?raw'
...@@ -99,12 +100,13 @@ const vueCodeMap = { ...@@ -99,12 +100,13 @@ const vueCodeMap = {
场景信息: vueCodeSceneInfo, 场景信息: vueCodeSceneInfo,
场景截图: vueCodeSceneScreenshot, 场景截图: vueCodeSceneScreenshot,
经纬网络2D: vueCodeJingweiNetwork2D, 经纬网络2D: vueCodeJingweiNetwork2D,
刻度: vueCodeDial, 时间: vueCodeDial,
圆形空间网格: vueCodeCircularSpaceGrid, 圆形空间网格: vueCodeCircularSpaceGrid,
矩形空间网格: vueCodeRectangularSpaceGrid, 矩形空间网格: vueCodeRectangularSpaceGrid,
地球坐标系: vueCodeEarthCoordinate, 地球坐标系: vueCodeEarthCoordinate,
天空盒: vueCodeSkyBox, 天空盒: vueCodeSkyBox,
鹰眼图: vueCodeMapx, 鹰眼图: vueCodeMapx,
刻度盘: vueCodeScale,
// 相机 // 相机
相机缩放: vueCodeCameraZoom, 相机缩放: vueCodeCameraZoom,
......
...@@ -41,6 +41,7 @@ import functionCodeRectangularSpaceGrid from '@/examples/sceneSet/rectangularSpa ...@@ -41,6 +41,7 @@ import functionCodeRectangularSpaceGrid from '@/examples/sceneSet/rectangularSpa
import functionCodeEarthCoordinate from '@/examples/sceneSet/earthCoordinate/earthCoordinate-function.js?raw' import functionCodeEarthCoordinate from '@/examples/sceneSet/earthCoordinate/earthCoordinate-function.js?raw'
import functionCodeSkyBox from '@/examples/sceneSet/skyBox/skyBox-function.js?raw' import functionCodeSkyBox from '@/examples/sceneSet/skyBox/skyBox-function.js?raw'
import functionCodeMapx from '@/examples/sceneSet/mapx/mapx-function.js?raw' import functionCodeMapx from '@/examples/sceneSet/mapx/mapx-function.js?raw'
import functionCodeScale from '@/examples/sceneSet/scale/scale.js?raw'
// 相机 // 相机
import functionCodeViewTrack from '@/examples/camera/viewTrack/viewTrack-function.js?raw' import functionCodeViewTrack from '@/examples/camera/viewTrack/viewTrack-function.js?raw'
...@@ -99,12 +100,13 @@ const functionCodeMap = { ...@@ -99,12 +100,13 @@ const functionCodeMap = {
场景信息: functionCodeSceneInfo, 场景信息: functionCodeSceneInfo,
场景截图: functionCodeSceneScreenshot, 场景截图: functionCodeSceneScreenshot,
经纬网络2D: functionCodeJingweiNetwork2D, 经纬网络2D: functionCodeJingweiNetwork2D,
刻度: functionCodeDial, 时间: functionCodeDial,
圆形空间网格: functionCodeCircularSpaceGrid, 圆形空间网格: functionCodeCircularSpaceGrid,
矩形空间网格: functionCodeRectangularSpaceGrid, 矩形空间网格: functionCodeRectangularSpaceGrid,
地球坐标系: functionCodeEarthCoordinate, 地球坐标系: functionCodeEarthCoordinate,
天空盒: functionCodeSkyBox, 天空盒: functionCodeSkyBox,
鹰眼图: functionCodeMapx, 鹰眼图: functionCodeMapx,
刻度盘: functionCodeScale,
// 相机 // 相机
跟踪视角: functionCodeViewTrack, 跟踪视角: functionCodeViewTrack,
......
export function change(viewer, divisionCount) {
for (let i = 0; i < divisionCount; i++) {
const angle = (360 / divisionCount) * i;
const startLongitude = angle - 180;
const endLongitude = startLongitude + 10;
viewer.entities.add({
polyline: {
positions: Cesium.Cartesian3.fromDegreesArrayHeights([
startLongitude, 0, 100000,
endLongitude, 0, 100000
]),
width: 2,
material: Cesium.Color.PINK,
}
});
viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(startLongitude + 5, 0, 0),
label: {
text: `${startLongitude}°`,
font: '16px Helvetica',
fillColor: Cesium.Color.WHITE,
pixelOffset: new Cesium.Cartesian2(0, -10),
scale: 0.5,
}
});
}
}
<template>
<div id="cesiumContainer" class="cesium-container"></div>
</template>
<script setup>
import { onMounted } from 'vue';
import { change } from './function';
let viewer;
onMounted(() => {
const script = document.createElement('script');
script.src = 'https://cesium.com/downloads/cesiumjs/releases/1.99/Build/Cesium/Cesium.js';
script.onload = () => {
window.Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3Njg4ZWU5Yi1iZDhiLTRhYmUtOTRiYS04YjM5NmUwNjVmMDMiLCJpZCI6MjI3MzQ3LCJpYXQiOjE3MjA1MjA4Mjh9.E5XW4LnwgfVAaBC-znaYr61m4yK0-j2qEQhi9qwFFPE'
viewer = new window.Cesium.Viewer('cesiumContainer', {
infoBox: false,
});
viewer.camera.changed.addEventListener(() => {
let alt = (viewer.camera.positionCartographic.height / 1000).toFixed(2);
let divisionCount = alt > 8000 ? 36 : 360;
viewer.entities.removeAll();
change(viewer, divisionCount)
})
};
document.head.appendChild(script);
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://cesium.com/downloads/cesiumjs/releases/1.119/Build/Cesium/Widgets/widgets.css';
document.head.appendChild(link);
});
</script>
<style>
.cesium-container {
width: 100%;
height: 100vh;
}
</style>
\ No newline at end of file
...@@ -128,8 +128,8 @@ export const elementSceneSetMap = { ...@@ -128,8 +128,8 @@ export const elementSceneSetMap = {
title: '经纬网络2D', title: '经纬网络2D',
pngUrl: '/src/assets/JingweiNetwork2D.png' pngUrl: '/src/assets/JingweiNetwork2D.png'
}, },
刻度: { 时间: {
title: '刻度盘', title: '时间盘',
pngUrl: '/src/assets/Dial.png' pngUrl: '/src/assets/Dial.png'
}, },
圆形空间网格: { 圆形空间网格: {
...@@ -151,6 +151,10 @@ export const elementSceneSetMap = { ...@@ -151,6 +151,10 @@ export const elementSceneSetMap = {
鹰眼图: { 鹰眼图: {
title: '鹰眼图', title: '鹰眼图',
pngUrl: '/src/assets/Mapx.png' pngUrl: '/src/assets/Mapx.png'
},
刻度盘: {
title: '刻度盘',
pngUrl: '/src/assets/Mapx.png'
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment