Commit aae3441c by wanghao

同步代码

parent 8a1cef01
......@@ -46,13 +46,13 @@
"showRenderLoopErrors": true,
"contextmenu": { "hasDefault": true },
"mouseDownView": true,
"zoom": { "insertIndex": 1 },
"zoom": { "insertBefore": "sceneModePicker" },
"compass": { "bottom": "toolbar", "left": "5px" },
"distanceLegend": { "left": "100px", "bottom": "2px" },
"locationBar": {
"crs": "CGCS2000_GK_Zone_3",
"crsDecimal": 0,
"template": "<div>经度:{lng}</div> <div>纬度:{lat}</div> <div class='hide1000'>横{crsx} 纵{crsy}</div> <div>海拔:{alt}米</div> <div class='hide700'>层级:{level}</div><div>方向:{heading}°</div> <div>俯仰角:{pitch}°</div><div class='hide700'>视高:{cameraHeight}米</div>帧率:{fps} FPS</div>"
"template": "<div>经度:{lng}</div> <div>纬度:{lat}</div> <div class='hide1000'>横{crsx} 纵{crsy}</div> <div>海拔:{alt}米</div> <div class='hide700'>层级:{level}</div><div>方向:{heading}°</div> <div>俯仰角:{pitch}°</div><div class='hide700'>视高:{cameraHeight}米</div><div class='hide700'>帧率:{fps} FPS</div>"
}
},
"templateValues": {
......@@ -1081,7 +1081,7 @@
"pid": 2030,
"name": "校园(含单体)",
"type": "group",
"hasOpacity":true,
"hasOpacity": true,
"center": { "lat": 43.821193, "lng": 125.143124, "alt": 990, "heading": 342, "pitch": -50 },
"layers": [
{
......
/**
* Mars3D三维可视化平台 mars3d
*
* 版本信息:v3.6.8
* 编译日期:2023-10-09 17:41:17
* 版本信息:v3.6.9
* 编译日期:2023-10-17 12:43:40
* 版权所有:Copyright by 火星科技 http://mars3d.cn
* 使用单位:免费公开版 ,2023-03-17
*/
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -44,8 +44,12 @@ export function onUnmounted() {
}
export function addDemoGraphic1() {
const startTime = new Date().getTime()
const url = "//data.mars3d.cn/file/geojson/buildings-hf.json"
mars3d.Util.fetchJson({ url: url }).then((data) => {
console.log("1.geojson数据请求完成", data)
const arr = mars3d.Util.geoJsonToGraphics(data, {
symbol: {
callback: function (attr) {
......@@ -60,7 +64,7 @@ export function addDemoGraphic1() {
}
})
globalMsg("共加载" + arr.length + "个面") // 多个面对象的合并渲染。
console.log("2.开始渲染PolygonCombine对象", arr)
const graphic = new mars3d.graphic.PolygonCombine({
instances: arr, // 公共样式
......@@ -76,6 +80,14 @@ export function addDemoGraphic1() {
}
})
graphicLayer.addGraphic(graphic)
graphic.readyPromise.then(() => {
console.log("3.PolygonCombine渲染完成")
const endTime = new Date().getTime()
const usedTime = (endTime - startTime) / 1000 // 两个时间戳相差的毫秒数
globalMsg(`生成${arr.length}条数据,共耗时${usedTime.toFixed(2)}秒`) // 多个面对象的合并渲染。
})
})
}
......
......@@ -30,14 +30,6 @@ export function onMounted(mapInstance) {
.then(function (data) {
console.log("演示数据data", data)
// let min = Number.MAX_VALUE
// let max = Number.MIN_VALUE
// data.values.forEach((element) => {
// min = Math.min(element, min)
// max = Math.max(element, max)
// })
// console.log(`min:${min},max:${max}`)
addDemoGraphic1(data)
})
.catch(function (error) {
......@@ -53,6 +45,25 @@ export function onUnmounted() {
map = null
}
const colors = [
"rgb(0,0,0,0)",
"rgb(170,36,250)",
"rgba(212,142,254,0.13)",
"rgba(238,2,48,0.12)",
"rgba(254,100,92,0.11)",
"rgba(254,172,172,0.1)",
"rgba(140,140,0,0.09)",
"rgba(200,200,2,0.08)",
"rgba(252,244,100,0.07)",
"rgba(16,146,26,0.06)",
"rgba(0,234,0,0.05)",
"rgba(166,252,168,0.04)",
"rgba(30,38,208,0.03)",
"rgba(122,114,238,0.02)",
"rgba(192,192,254,0.01)"
]
const steps = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65]
function addDemoGraphic1(data) {
// 创建气象数据体渲染模型
const volumeCloud = new mars3d.graphic.VolumeCloud({
......@@ -69,28 +80,15 @@ function addDemoGraphic1(data) {
zmin: data.zmin, // 最小高度
zmax: data.zmax // 最大高度
},
steps: 1000,
colorsKey: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65],
colors: [
"rgb(0,0,0,0)",
"rgb(170,36,250)",
"rgba(212,142,254,0.13)",
"rgba(238,2,48,0.12)",
"rgba(254,100,92,0.11)",
"rgba(254,172,172,0.1)",
"rgba(140,140,0,0.09)",
"rgba(200,200,2,0.08)",
"rgba(252,244,100,0.07)",
"rgba(16,146,26,0.06)",
"rgba(0,234,0,0.05)",
"rgba(166,252,168,0.04)",
"rgba(30,38,208,0.03)",
"rgba(122,114,238,0.02)",
"rgba(192,192,254,0.01)"
]
steps: steps,
colors: colors
// flyTo: true
})
graphicLayer.addGraphic(volumeCloud)
// 显示边界,方便对比测试
showDebuggerRectangleOutline(volumeCloud)
// setInterval(() => {
// for (let index = 0, len = data.values.length; index < len; index++) {
// if (data.values[index] > 20) {
......@@ -106,3 +104,27 @@ function addDemoGraphic1(data) {
// })
// }, 1000)
}
// 显示Rectangle矩形体边界,方便对比测试
function showDebuggerRectangleOutline(volumeCloud) {
const boxOutlineInstance = new Cesium.GeometryInstance({
geometry: new Cesium.RectangleOutlineGeometry({
ellipsoid: Cesium.Ellipsoid.WGS84,
rectangle: volumeCloud._rectangle,
height: volumeCloud.options.data.zmin,
extrudedHeight: volumeCloud.options.data.zmax
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.WHITE)
}
})
map.scene.primitives.add(
new Cesium.Primitive({
geometryInstances: boxOutlineInstance,
appearance: new Cesium.PerInstanceColorAppearance({
flat: true
})
})
)
}
......@@ -154,6 +154,29 @@ export function startDrawGraphic() {
})
}
// 凝视目标
export function changeLookAt() {
const cone = graphicLayer.graphics[0]
if (cone.lookAt) {
cone.lookAt = null
} else {
map.graphicLayer.startDraw({
type: "point",
style: {
pixelSize: 12,
color: "#ffff00"
},
success: function (graphic) {
const position = graphic.positionShow
map.graphicLayer.clear()
cone.lookAt = position
}
})
}
}
// 在图层绑定Popup弹窗
export function bindLayerPopup() {
graphicLayer.bindPopup(function (event) {
......
......@@ -7,9 +7,6 @@ let satelliteSensor
let satelliteSensor2
let modelGraphic
const reverse = true // z轴方向,true朝向空中,false朝向地心
const converter = Cesium.Transforms.eastNorthUpToFixedFrame
// let converter = Cesium.Transforms.localFrameToFixedFrameGenerator('east', 'south')
// 需要覆盖config.json中地图属性参数(当前示例框架中自动处理合并)
export const mapOptions = {
......@@ -93,9 +90,8 @@ export function addModelGraphic(sensorParams) {
pitch: sensorParams.pitchValue,
roll: sensorParams.rollValue,
color: "rgba(0,255,255,0.7)"
},
fixedFrameTransform: converter,
reverse: reverse
}
// lookAt: Cesium.Cartesian3.fromDegrees(28.54, -26.45, 0)
})
graphicLayer.addGraphic(satelliteSensor)
......@@ -110,9 +106,7 @@ export function addModelGraphic(sensorParams) {
pitch: -sensorParams.pitchValue,
roll: sensorParams.rollValue,
color: "rgba(255,255,0,0.7)"
},
fixedFrameTransform: converter,
reverse: reverse
}
})
graphicLayer.addGraphic(satelliteSensor2)
}
......
......@@ -41,9 +41,6 @@ export function onUnmounted() {
let modelGraphic
const reverse = true // z轴方向,true朝向空中,false朝向地心
const converter = Cesium.Transforms.eastNorthUpToFixedFrame
// const converter = Cesium.Transforms.localFrameToFixedFrameGenerator('east', 'south')
// 初始化创建一个卫星视锥体
export function addDemoGraphic1(sensorParams) {
......@@ -78,9 +75,7 @@ export function addDemoGraphic1(sensorParams) {
roll: sensorParams.rollValue,
color: "rgba(0,255,255,0.7)",
flat: true
},
fixedFrameTransform: converter,
reverse: reverse
}
})
graphicLayer.addGraphic(satelliteSensor)
eventTarget.fire("addTableData", { graphicLayer })
......
......@@ -82,13 +82,13 @@ export function addLayer() {
arcGisLayer = new mars3d.layer.ArcGisLayer({
name: "合肥建筑物",
url: "//server.mars3d.cn/arcgis/rest/services/mars/guihua/MapServer",
// usePreCachedTilesIfAvailable: false, // 非标准瓦片 或 大地2000高斯投影坐标系时,请打开此参数
// layerDefs: `{ 0: "用地编号 = 'R2'" }`,
// url: '//server.mars3d.cn/arcgis/rest/services/crs/ssjzw4326/MapServer',
// url: '//server.mars3d.cn/arcgis/rest/services/crs/ssjzw4490/MapServer', //大地2000地理坐标系
// url: '//server.mars3d.cn/arcgis/rest/services/crs/ssjzw4548/MapServer', //大地2000高斯投影坐标系
// url: '//server.mars3d.cn/arcgis/rest/services/crs/ssjzw2000/MapServer', //大地2000高斯投影坐标系
// usePreCachedTilesIfAvailable: false, //大地2000高斯投影坐标系时,如果是瓦片,请打开此参数
// queryParameters: { returnGeometry: false },
highlight: {
clampToGround: true,
......
......@@ -10,12 +10,13 @@ export const mapOptions = {
control: {
homeButton: true,
sceneModePicker: true,
navigationHelpButton: true,
infoBox: false,
vrButton: true,
fullscreenButton: true,
geocoder: "gaode",
geocoder: { service: "gaode", insertIndex: 0 },
baseLayerPicker: true,
fullscreenButton: true,
navigationHelpButton: true,
clockAnimate: true, // 时钟动画控制(左下角)
timeline: true, // 是否显示时间线控件
......@@ -23,15 +24,13 @@ export const mapOptions = {
compass: { top: "10px", left: "5px" },
distanceLegend: { left: "180px", bottom: "30px" },
locationBar: {
fps: true,
template:
"<div>lng:{lng}</div> <div>lat:{lat}</div> <div>alt:{alt} m</div> <div>level:{level}</div><div>heading:{heading}°</div> <div>pitch:{pitch}°</div><div>cameraHeight:{cameraHeight}m</div>"
}
},
lang: mars3d.LangType.EN // 使用英文
// eslint-disable-next-line no-undef
lang: CustomLang // 使用自定义语言配置,配置信息在 ./CustomLang.js
}
// 其他语言,可以引入 CustomLang.js 后修改 英文为其他语言即可
export const eventTarget = new mars3d.BaseClass()
......@@ -43,7 +42,6 @@ export const eventTarget = new mars3d.BaseClass()
*/
export function onMounted(mapInstance) {
map = mapInstance
map.toolbar.style.bottom = "55px" // 修改toolbar控件的样式
// 涉及到多语言的模块:标绘提示
......@@ -100,6 +98,25 @@ export function onUnmounted() {
map = null
}
export function toCustomLang() {
if (map.controls.locationBar) {
map.controls.locationBar.options.template =
"<div>lng:{lng}</div> <div>lat:{lat}</div> <div>alt:{alt} m</div> <div>level:{level}</div><div>heading:{heading}°</div> <div>pitch:{pitch}°</div><div>cameraHeight:{cameraHeight}m</div><div class='hide700'> {fps} FPS</div>"
}
// eslint-disable-next-line no-undef
map.lang = CustomLang // 使用自定义语言配置,配置信息在 ./CustomLang.js
}
export function toDefaultLange() {
if (map.controls.locationBar) {
map.controls.locationBar.options.template =
"<div>经度:{lng}</div> <div>纬度:{lat}</div> <div class='hide1000'>横{crsx} 纵{crsy}</div> <div>海拔:{alt}米</div> <div class='hide700'>层级:{level}</div><div>方向:{heading}°</div> <div>俯仰角:{pitch}°</div><div class='hide700'>视高:{cameraHeight}米</div><div class='hide700'>帧率:{fps} FPS</div>"
}
map.lang = mars3d.Lang // 使用默认配置
}
export function distance() {
drawLayer.stopDraw()
measure.distance()
......
......@@ -104,6 +104,9 @@ export function showXianDemo() {
dynamicScreenSpaceError: true,
cullWithChildrenBounds: false,
center: { lat: 28.440675, lng: 119.487735, alt: 639, heading: 269, pitch: -38 },
clip: {
enabled: true
},
flyTo: true
})
map.addLayer(tilesetLayer)
......
......@@ -87,6 +87,9 @@ export function showTehDemo() {
skipLevelOfDetail: true,
preferLeaves: true,
center: { lat: 31.795308, lng: 117.21948, alt: 1820, heading: 0, pitch: -39 },
flat: {
enabled: true
},
flyTo: true
})
map.addLayer(tilesetLayer)
......
......@@ -47,6 +47,9 @@ export function showDytDemo() {
position: { alt: -27 },
maximumScreenSpaceError: 1,
editHeight: 420, // 相对高度 (单位:米),基于 压平/淹没区域 最低点高度的偏移量
flood: {
enabled: true
},
flyTo: true
})
map.addLayer(tilesetLayer)
......@@ -80,6 +83,9 @@ export function showTehDemo() {
cullWithChildrenBounds: false,
skipLevelOfDetail: true,
preferLeaves: true,
flood: {
enabled: true
},
flyTo: true
})
map.addLayer(tilesetLayer)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论