demo-mars3d
This commit is contained in:
14
demo-mars3d/index.html
Normal file
14
demo-mars3d/index.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>mars3d-vite</title>
|
||||
<script type="module" src="/src/index.ts"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="mars3dContainer"></div>
|
||||
</body>
|
||||
</html>
|
20
demo-mars3d/package.json
Normal file
20
demo-mars3d/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "mars3d-demo",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"serve": "vite build && vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^3.0.4",
|
||||
"vite-plugin-earth": "link:.."
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/turf": "^6.5.0",
|
||||
"mars3d": "^3.5.0",
|
||||
"mars3d-cesium": "^1.103.1"
|
||||
}
|
||||
}
|
9
demo-mars3d/src/css/main.css
Normal file
9
demo-mars3d/src/css/main.css
Normal file
@ -0,0 +1,9 @@
|
||||
html,
|
||||
body,
|
||||
#mars3dContainer {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
54
demo-mars3d/src/index.ts
Normal file
54
demo-mars3d/src/index.ts
Normal file
@ -0,0 +1,54 @@
|
||||
import * as mars3d from 'mars3d';
|
||||
import './css/main.css';
|
||||
import 'mars3d/dist/mars3d.css';
|
||||
/**
|
||||
*
|
||||
* import * as mars3d from 'mars3d';
|
||||
* const map = new mars3d.Map('mars3dContainer', {});
|
||||
*
|
||||
*
|
||||
*/
|
||||
const map = new mars3d.Map('mars3dContainer', {
|
||||
scene: {
|
||||
center: { lat: 30.054604, lng: 108.885436, alt: 17036414, heading: 0, pitch: -90 },
|
||||
showSun: true,
|
||||
showMoon: true,
|
||||
showSkyBox: true,
|
||||
showSkyAtmosphere: false, // 关闭球周边的白色轮廓 map.scene.skyAtmosphere = false
|
||||
fog: true,
|
||||
fxaa: true,
|
||||
globe: {
|
||||
showGroundAtmosphere: false, // 关闭大气(球表面白蒙蒙的效果)
|
||||
depthTestAgainstTerrain: false,
|
||||
baseColor: '#546a53'
|
||||
},
|
||||
cameraController: {
|
||||
zoomFactor: 3.0,
|
||||
minimumZoomDistance: 1,
|
||||
maximumZoomDistance: 50000000,
|
||||
enableRotate: true,
|
||||
enableZoom: true
|
||||
}
|
||||
},
|
||||
control: {
|
||||
baseLayerPicker: true, // basemaps底图切换按钮
|
||||
homeButton: true, // 视角复位按钮
|
||||
sceneModePicker: true, // 二三维切换按钮
|
||||
navigationHelpButton: true, // 帮助按钮
|
||||
fullscreenButton: true, // 全屏按钮
|
||||
contextmenu: { hasDefault: true } // 右键菜单
|
||||
},
|
||||
terrain: {
|
||||
url: '//data.mars3d.cn/terrain',
|
||||
show: true
|
||||
},
|
||||
basemaps: [
|
||||
{
|
||||
name: '天地图影像',
|
||||
icon: 'img/basemaps/tdt_img.png',
|
||||
type: 'tdt',
|
||||
layer: 'img_d',
|
||||
show: true
|
||||
}
|
||||
]
|
||||
});
|
10
demo-mars3d/vite.config.ts
Normal file
10
demo-mars3d/vite.config.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import earth from 'vite-plugin-earth';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
earth({
|
||||
useMars3D: true
|
||||
})
|
||||
]
|
||||
});
|
Reference in New Issue
Block a user