Commit fd5c83de by wanghao

同步v3.4.8代码

parent 3d017208
...@@ -761,6 +761,12 @@ ...@@ -761,6 +761,12 @@
"hasPannel": true "hasPannel": true
}, },
{ {
"name": "天地图POI点查询",
"thumbnail": "query-tdtPOI.jpg",
"main": "query/tdtPOI",
"hasPannel": true
},
{
"name": "百度POI点查询", "name": "百度POI点查询",
"thumbnail": "query-baiduPOI.jpg", "thumbnail": "query-baiduPOI.jpg",
"main": "query/baiduPOI", "main": "query/baiduPOI",
......

48.5 KB | W: | H:

136 KB | W: | H:

public/config/thumbnail/layero-heatmap-heatLayer-arc.jpg
public/config/thumbnail/layero-heatmap-heatLayer-arc.jpg
public/config/thumbnail/layero-heatmap-heatLayer-arc.jpg
public/config/thumbnail/layero-heatmap-heatLayer-arc.jpg
  • 2-up
  • Swipe
  • Onion skin

37.7 KB | W: | H:

95.8 KB | W: | H:

public/config/thumbnail/layero-heatmap-heatLayer.jpg
public/config/thumbnail/layero-heatmap-heatLayer.jpg
public/config/thumbnail/layero-heatmap-heatLayer.jpg
public/config/thumbnail/layero-heatmap-heatLayer.jpg
  • 2-up
  • Swipe
  • Onion skin

50.4 KB | W: | H:

87.3 KB | W: | H:

public/config/thumbnail/thing-analysis-measure.jpg
public/config/thumbnail/thing-analysis-measure.jpg
public/config/thumbnail/thing-analysis-measure.jpg
public/config/thumbnail/thing-analysis-measure.jpg
  • 2-up
  • Swipe
  • Onion skin
/** /**
* Mars3D三维可视化平台 mars3d * Mars3D三维可视化平台 mars3d
* *
* 版本信息:v3.4.7 * 版本信息:v3.4.8
* 编译日期:2022-09-07 15:00:41 * 编译日期:2022-09-26 09:04:57
* 版权所有:Copyright by 火星科技 http://mars3d.cn * 版权所有:Copyright by 火星科技 http://mars3d.cn
* 使用单位:免费公开版 ,2022-06-01 * 使用单位:免费公开版 ,2022-06-01
*/ */
......
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.
...@@ -166,7 +166,7 @@ html { ...@@ -166,7 +166,7 @@ html {
vertical-align: middle; vertical-align: middle;
} }
.cesium-viewer-toolbar > .cesium-toolbar-button, .cesium-viewer-toolbar>.cesium-toolbar-button,
.cesium-navigationHelpButton-wrapper, .cesium-navigationHelpButton-wrapper,
.cesium-viewer-geocoderContainer { .cesium-viewer-geocoderContainer {
margin-bottom: 5px; margin-bottom: 5px;
...@@ -205,10 +205,12 @@ html { ...@@ -205,10 +205,12 @@ html {
left: 40px; left: 40px;
transform-origin: left bottom; transform-origin: left bottom;
} }
.cesium-navigation-help-instructions, .cesium-navigation-help-instructions,
.cesium-navigation-button { .cesium-navigation-button {
background-color: rgba(23, 49, 71, 0.8); background-color: rgba(23, 49, 71, 0.8);
} }
.cesium-navigation-button-selected, .cesium-navigation-button-selected,
.cesium-navigation-button-unselected:hover { .cesium-navigation-button-unselected:hover {
background-color: rgba(23, 49, 71, 1); background-color: rgba(23, 49, 71, 1);
...@@ -276,6 +278,7 @@ html { ...@@ -276,6 +278,7 @@ html {
left: 10px; left: 10px;
right: auto; right: auto;
} }
.cesium-cesiumInspector { .cesium-cesiumInspector {
background-color: rgba(23, 49, 71, 0.8); background-color: rgba(23, 49, 71, 0.8);
} }
...@@ -284,6 +287,7 @@ html { ...@@ -284,6 +287,7 @@ html {
.mars3d-compass .mars3d-compass-outer { .mars3d-compass .mars3d-compass-outer {
fill: rgba(23, 49, 71, 0.8); fill: rgba(23, 49, 71, 0.8);
} }
.mars3d-contextmenu-ul, .mars3d-contextmenu-ul,
.mars3d-sub-menu { .mars3d-sub-menu {
background-color: rgba(23, 49, 71, 0.8); background-color: rgba(23, 49, 71, 0.8);
...@@ -338,14 +342,17 @@ html { ...@@ -338,14 +342,17 @@ html {
.mars3d-template-titile a { .mars3d-template-titile a {
font-size: 16px; font-size: 16px;
} }
.mars3d-popup-btn-custom { .mars3d-popup-btn-custom {
padding: 3px 10px; padding: 3px 10px;
border: 1px solid #209ffd; border: 1px solid #209ffd;
background: #209ffd1c; background: #209ffd1c;
} }
.mars3d-popup-content { .mars3d-popup-content {
margin: 15px; margin: 15px;
} }
.mars3d-divGraphic:hover { .mars3d-divGraphic:hover {
z-index: 999 !important; z-index: 999 !important;
} }
...@@ -154,6 +154,8 @@ export function bindMapDemo() { ...@@ -154,6 +154,8 @@ export function bindMapDemo() {
} }
] ]
map.bindContextMenu(mapContextmenuItems) map.bindContextMenu(mapContextmenuItems)
map.openContextMenu(new mars3d.LngLatPoint(116.266845, 30.967094, 1000.4).toCartesian())
} }
// 演示右键菜单“方法名称”方式(如config.json中配置时) // 演示右键菜单“方法名称”方式(如config.json中配置时)
......
...@@ -134,7 +134,7 @@ function startRoam() { ...@@ -134,7 +134,7 @@ function startRoam() {
return return
} }
frameNum = ++frameNum % 400 frameNum = ++frameNum % 100 // 调整间隔多少拍一次
if (frameNum !== 0) { if (frameNum !== 0) {
if (frameNum === 10 && graphicFrustum) { if (frameNum === 10 && graphicFrustum) {
graphicLayer.removeGraphic(graphicFrustum) graphicLayer.removeGraphic(graphicFrustum)
......
...@@ -193,7 +193,6 @@ function inintRoad(positionsSJ, positionsTD) { ...@@ -193,7 +193,6 @@ function inintRoad(positionsSJ, positionsTD) {
// =================添加高铁车头================ // =================添加高铁车头================
const graphicHead = addTrainHead(arrProperty[0], availability) const graphicHead = addTrainHead(arrProperty[0], availability)
map.trackedEntity = graphicHead.entity // 设置相机的视角跟随的Entity实例
// =================添加车身==================== // =================添加车身====================
const len = arrProperty.length const len = arrProperty.length
...@@ -207,6 +206,10 @@ function inintRoad(positionsSJ, positionsTD) { ...@@ -207,6 +206,10 @@ function inintRoad(positionsSJ, positionsTD) {
// ==============添加铁路,定时更新================ // ==============添加铁路,定时更新================
addRailway(graphicHead, mpoints) addRailway(graphicHead, mpoints)
// // 设置相机的视角跟随的Entity实例
// map.trackedEntity = graphicHead
// ==============更新echarts================ // ==============更新echarts================
let lastDistance let lastDistance
...@@ -239,7 +242,8 @@ function addTrainHead(position, availability, rotatePI) { ...@@ -239,7 +242,8 @@ function addTrainHead(position, availability, rotatePI) {
url: "//data.mars3d.cn/gltf/mars/train/heada.glb", url: "//data.mars3d.cn/gltf/mars/train/heada.glb",
scale: 0.001, scale: 0.001,
minimumPixelSize: 16, minimumPixelSize: 16,
heading: rotatePI ? 90 : -90 heading: rotatePI ? 90 : -90,
mergeOrientation: true // 用于设置模型不是标准的方向时的纠偏处理,在orientation基础的方式值上加上设置是heading值
} }
}) })
graphicLayer.addGraphic(graphicModel) graphicLayer.addGraphic(graphicModel)
...@@ -257,7 +261,8 @@ function addTrainBody(position, availability) { ...@@ -257,7 +261,8 @@ function addTrainBody(position, availability) {
url: "//data.mars3d.cn/gltf/mars/train/body.glb", url: "//data.mars3d.cn/gltf/mars/train/body.glb",
scale: 0.001, scale: 0.001,
minimumPixelSize: 16, minimumPixelSize: 16,
heading: -90 heading: -90,
mergeOrientation: true // 用于设置模型不是标准的方向时的纠偏处理,在orientation基础的方式值上加上设置是heading值
} }
}) })
graphicLayer.addGraphic(graphicModel) graphicLayer.addGraphic(graphicModel)
......
...@@ -111,6 +111,12 @@ export function setMoelStyle(style) { ...@@ -111,6 +111,12 @@ export function setMoelStyle(style) {
fixedRoute.model.setStyle(style) fixedRoute.model.setStyle(style)
} }
export function clearMoelPitchRoll () {
fixedRoute.model.style.pitch = undefined
fixedRoute.model.style.roll = undefined
}
export function clearGroundLayer() { export function clearGroundLayer() {
groundLayer.clear() groundLayer.clear()
} }
......
...@@ -69,7 +69,7 @@ function addGraphicLayer() { ...@@ -69,7 +69,7 @@ function addGraphicLayer() {
model: { model: {
url: "//data.mars3d.cn/gltf/mars/jingche/jingche.gltf", url: "//data.mars3d.cn/gltf/mars/jingche/jingche.gltf",
heading: 90, heading: 90,
noPitchRoll: true, mergeOrientation: true, // 用于设置模型不是标准的方向时的纠偏处理,在orientation基础的方式值上加上设置是heading值
minimumPixelSize: 50 minimumPixelSize: 50
}, },
polyline: { polyline: {
......
...@@ -14,7 +14,9 @@ export const mapOptions = { ...@@ -14,7 +14,9 @@ export const mapOptions = {
}, },
control: { control: {
// animation: true, //是否创建 动画小器件,左下角仪表 // animation: true, //是否创建 动画小器件,左下角仪表
timeline: true // 是否显示 时间线控件 timeline: true,
clockAnimate: true,
distanceLegend: { left: "100px", bottom: "27px" }
} }
} }
......
...@@ -175,6 +175,37 @@ export function bindLayerContextMenu() { ...@@ -175,6 +175,37 @@ export function bindLayerContextMenu() {
graphicLayer.removeGraphic(parent) graphicLayer.removeGraphic(parent)
} }
} }
},
{
text: "跟踪锁定",
icon: "fa fa-lock",
show: function (e) {
const graphic = e.graphic
if (!graphic) {
return false
}
if (graphic.entity instanceof Cesium.Entity) {
return true
} else if (graphic.trackedEntity instanceof Cesium.Entity) {
return true
}
return false
},
callback: function (e) {
map.trackedEntity = e.graphic
}
},
{
text: "取消锁定",
icon: "fa fa-unlock-alt",
show: function (e) {
return map.trackedEntity !== undefined
},
callback: function (e) {
map.trackedEntity = undefined
}
} }
]) ])
} }
...@@ -65,7 +65,8 @@ function addDemoGraphic2(graphicLayer) { ...@@ -65,7 +65,8 @@ function addDemoGraphic2(graphicLayer) {
position: [116.257665, 30.869372, 1500], position: [116.257665, 30.869372, 1500],
style: { style: {
url: "//data.mars3d.cn/gltf/mars/zhui.glb", url: "//data.mars3d.cn/gltf/mars/zhui.glb",
scale: 200 scale: 200,
minimumPixelSize: 50
} }
}) })
graphicLayer.addGraphic(graphic) graphicLayer.addGraphic(graphic)
......
...@@ -36,6 +36,7 @@ export function onMounted(mapInstance) { ...@@ -36,6 +36,7 @@ export function onMounted(mapInstance) {
addDemoGraphic2(graphicLayer) addDemoGraphic2(graphicLayer)
addDemoGraphic3(graphicLayer) addDemoGraphic3(graphicLayer)
addDemoGraphic4(graphicLayer) addDemoGraphic4(graphicLayer)
addDemoGraphic5(graphicLayer)
} }
/** /**
...@@ -144,6 +145,29 @@ function addDemoGraphic4(graphicLayer) { ...@@ -144,6 +145,29 @@ function addDemoGraphic4(graphicLayer) {
graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer) graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
} }
function addDemoGraphic5(graphicLayer) {
const graphic = new mars3d.graphic.Sector({
position: [117.237446, 31.753303, 23.1],
style: {
radius: 5000,
startAngle: 0, // 开始角度(正东方向为0,顺时针到360度)
endAngle: 60,
fill: false,
outline: true,
noCenter: true,
outlineStyle: {
width: 3,
color: "#ff0000",
closure: false
}
},
attr: { remark: "示例5" }
})
graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
}
// 生成演示数据(测试数据量) // 生成演示数据(测试数据量)
export function addRandomGraphicByCount(count) { export function addRandomGraphicByCount(count) {
graphicLayer.clear() graphicLayer.clear()
......
...@@ -47,6 +47,7 @@ export function onMounted(mapInstance) { ...@@ -47,6 +47,7 @@ export function onMounted(mapInstance) {
addDemoGraphic13(graphicLayer) addDemoGraphic13(graphicLayer)
addDemoGraphic14(graphicLayer) addDemoGraphic14(graphicLayer)
addDemoGraphic15(graphicLayer) addDemoGraphic15(graphicLayer)
addDemoGraphic16(graphicLayer)
} }
/** /**
...@@ -472,10 +473,32 @@ function addDemoGraphic15(graphicLayer) { ...@@ -472,10 +473,32 @@ function addDemoGraphic15(graphicLayer) {
speed: 10 speed: 10
} }
}, },
attr: { remark: "示例4" } attr: { remark: "示例15" }
}) })
graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer) graphicLayer.addGraphic(graphic) // 还可以另外一种写法: graphic.addTo(graphicLayer)
}
function addDemoGraphic16(graphicLayer) {
const graphic = new mars3d.graphic.PolylineEntity({
positions: [
[116.929192, 31.891959, 32.8],
[116.960064, 31.883802, 35.7],
[116.948047, 31.868749, 33.7]
],
style: {
width: 3,
color: "#ff0000"
},
attr: { remark: "示例16" }
})
graphicLayer.addGraphic(graphic)
// 动态平滑追加点
const positions_draw = graphic.setCallbackPositions() // 切换坐标为动态回调模式
setInterval(() => {
const position = new mars3d.LngLatPoint(116.979661 + Math.random() * 0.01, 31.863542 + Math.random() * 0.01, 38).toCartesian()
positions_draw.push(position) // 追加点
}, 3000)
} }
// 生成演示数据(测试数据量) // 生成演示数据(测试数据量)
......
...@@ -30,18 +30,8 @@ export function onMounted(mapInstance) { ...@@ -30,18 +30,8 @@ export function onMounted(mapInstance) {
graphicLayer = new mars3d.layer.GraphicLayer() graphicLayer = new mars3d.layer.GraphicLayer()
map.addLayer(graphicLayer) map.addLayer(graphicLayer)
// 加个模型 addDemoGraphic1()
const graphic = new mars3d.graphic.ModelEntity({ addDemoGraphic2()
name: "地面站模型",
position: [117.170264, 31.840312, 258],
style: {
url: "//data.mars3d.cn/gltf/mars/leida.glb",
scale: 1,
minimumPixelSize: 40,
clampToGround: true
}
})
graphicLayer.addGraphic(graphic)
} }
/** /**
...@@ -52,11 +42,23 @@ export function onUnmounted() { ...@@ -52,11 +42,23 @@ export function onUnmounted() {
map = null map = null
} }
export function addDemoGraphic1(radarParsms) { export function addDemoGraphic1() {
const radarParsms = {
outerRadius: 2000,
innerRadius: 500,
headingValue: 0,
pitchValue: 0,
rollValue: 0,
startFovH: 180,
endFovH: -180,
startFovV: 0,
endFovV: 90,
areaColor: "rgba(255,0,0,0.5)"
}
const camberRadar = new mars3d.graphic.CamberRadar({ const camberRadar = new mars3d.graphic.CamberRadar({
position: [117.170264, 31.840312, 363], position: [117.170264, 31.840312, 363],
name: "雷达模型",
style: { style: {
color: "#ff0000", color: "#ff0000",
opacity: 0.5, opacity: 0.5,
...@@ -68,16 +70,31 @@ export function addDemoGraphic1(radarParsms) { ...@@ -68,16 +70,31 @@ export function addDemoGraphic1(radarParsms) {
heading: radarParsms.headingValue, heading: radarParsms.headingValue,
pitch: radarParsms.pitchValue, pitch: radarParsms.pitchValue,
roll: radarParsms.rollValue, roll: radarParsms.rollValue,
startFovH: Cesium.Math.toRadians(radarParsms.startFovH), startFovH: radarParsms.startFovH,
endFovH: Cesium.Math.toRadians(radarParsms.endFovH), endFovH: radarParsms.endFovH,
startFovV: Cesium.Math.toRadians(radarParsms.startFovV), startFovV: radarParsms.startFovV,
endFovV: Cesium.Math.toRadians(radarParsms.endFovV), endFovV: radarParsms.endFovV,
flat: true flat: true
} }
}) })
graphicLayer.addGraphic(camberRadar) graphicLayer.addGraphic(camberRadar)
} }
function addDemoGraphic2() {
// 加个模型
const graphic = new mars3d.graphic.ModelEntity({
name: "地面站模型",
position: [117.170264, 31.840312, 258],
style: {
url: "//data.mars3d.cn/gltf/mars/leida.glb",
scale: 1,
minimumPixelSize: 40,
clampToGround: true
}
})
graphicLayer.addGraphic(graphic)
}
// 生成演示数据(测试数据量) // 生成演示数据(测试数据量)
export function addRandomGraphicByCount(count) { export function addRandomGraphicByCount(count) {
graphicLayer.clear() graphicLayer.clear()
...@@ -101,10 +118,10 @@ export function addRandomGraphicByCount(count) { ...@@ -101,10 +118,10 @@ export function addRandomGraphicByCount(count) {
segmentH: 50, segmentH: 50,
radius: result.radius, radius: result.radius,
startRadius: result.radius * 0.3, startRadius: result.radius * 0.3,
startFovH: Cesium.Math.toRadians(180), startFovH: 180,
endFovH: Cesium.Math.toRadians(-180), endFovH: -180,
startFovV: Cesium.Math.toRadians(0), startFovV: 0,
endFovV: Cesium.Math.toRadians(90) endFovV: 90
}, },
attr: { index: index } attr: { index: index }
}) })
...@@ -127,10 +144,10 @@ export function startDrawGraphic() { ...@@ -127,10 +144,10 @@ export function startDrawGraphic() {
segmentH: 50, segmentH: 50,
radius: 2000, radius: 2000,
startRadius: 800, startRadius: 800,
startFovH: Cesium.Math.toRadians(180), startFovH: 180,
endFovH: Cesium.Math.toRadians(-180), endFovH: -180,
startFovV: Cesium.Math.toRadians(0), startFovV: 0,
endFovV: Cesium.Math.toRadians(90) endFovV: 90
} }
}) })
} }
...@@ -183,28 +200,28 @@ export function innerRadiusChange(val) { ...@@ -183,28 +200,28 @@ export function innerRadiusChange(val) {
export function startFovHChange(value) { export function startFovHChange(value) {
const camberRadar = getLastGraphic() const camberRadar = getLastGraphic()
if (camberRadar) { if (camberRadar) {
camberRadar.startFovH = Cesium.Math.toRadians(value) camberRadar.startFovH = value
} }
} }
export function endFovHChange(value) { export function endFovHChange(value) {
const camberRadar = getLastGraphic() const camberRadar = getLastGraphic()
if (camberRadar) { if (camberRadar) {
camberRadar.endFovH = Cesium.Math.toRadians(value) camberRadar.endFovH = value
} }
} }
export function startFovVChange(value) { export function startFovVChange(value) {
const camberRadar = getLastGraphic() const camberRadar = getLastGraphic()
if (camberRadar) { if (camberRadar) {
camberRadar.startFovV = Cesium.Math.toRadians(value) camberRadar.startFovV = value
} }
} }
export function endFovVChange(value) { export function endFovVChange(value) {
const camberRadar = getLastGraphic() const camberRadar = getLastGraphic()
if (camberRadar) { if (camberRadar) {
camberRadar.endFovV = Cesium.Math.toRadians(value) camberRadar.endFovV = value
} }
} }
......
...@@ -34,7 +34,8 @@ export function onMounted(mapInstance) { ...@@ -34,7 +34,8 @@ export function onMounted(mapInstance) {
globalNotify("已知问题提示", `当前使用的是原生Cesium+SuperMap3D插件方式,很多API不支持,完整方式需要参考Github开源代码切换Cesium到超图版Cesium。`) globalNotify("已知问题提示", `当前使用的是原生Cesium+SuperMap3D插件方式,很多API不支持,完整方式需要参考Github开源代码切换Cesium到超图版Cesium。`)
showMaxNiaochaoDemo() // showMaxNiaochaoDemo()
showQxSuofeiyaDemo()
} }
/** /**
...@@ -161,7 +162,7 @@ export function showBIMQiaoDemo() { ...@@ -161,7 +162,7 @@ export function showBIMQiaoDemo() {
layer.style3D.lineWidth = 0.5 layer.style3D.lineWidth = 0.5
layer.style3D.lineColor = new Cesium.Color(60 / 255, 60 / 255, 60 / 255, 1) layer.style3D.lineColor = new Cesium.Color(60 / 255, 60 / 255, 60 / 255, 1)
layer.style3D.fillStyle = Cesium.FillStyle.Fill_And_WireFrame layer.style3D.fillStyle = Cesium.FillStyle.Fill_And_WireFrame
layer.wireFrameMode = Cesium.WireFrameType.EffectOutline layer.wireFrameMode = Cesium.WireFrameType?.EffectOutline
} }
}) })
} }
......
...@@ -6,7 +6,7 @@ let canvasWindLayer ...@@ -6,7 +6,7 @@ let canvasWindLayer
// 需要覆盖config.json中地图属性参数(当前示例框架中自动处理合并) // 需要覆盖config.json中地图属性参数(当前示例框架中自动处理合并)
export const mapOptions = { export const mapOptions = {
scene: { scene: {
center: { lat: 16.490922, lng: 101.305158, alt: 31274431, heading: 0, pitch: -88 } center: { lat: 24.677182, lng: 107.044123, alt: 20407002, heading: 0, pitch: -90 }
} }
} }
...@@ -22,15 +22,17 @@ export function onMounted(mapInstance) { ...@@ -22,15 +22,17 @@ export function onMounted(mapInstance) {
// 风场 // 风场
canvasWindLayer = new mars3d.layer.CanvasWindLayer({ canvasWindLayer = new mars3d.layer.CanvasWindLayer({
color: "#4696db", // 颜色 color: "#ffffff", // 颜色
frameRate: 10, // 每秒刷新次数 frameRate: 20, // 每秒刷新次数
speedRate: 120, // 风前进速率 speedRate: 120, // 风前进速率
particlesNumber: 3000, particlesNumber: 3000,
maxAge: 60, maxAge: 60,
lineWidth: 1.5 lineWidth: 1
}) })
map.addLayer(canvasWindLayer) map.addLayer(canvasWindLayer)
loadEarthData() loadEarthData()
} }
......
...@@ -6,7 +6,18 @@ export let map // mars3d.Map三维地图对象 ...@@ -6,7 +6,18 @@ export let map // mars3d.Map三维地图对象
export const mapOptions = { export const mapOptions = {
scene: { scene: {
center: { lat: 28.665233, lng: 108.757799, alt: 4255656, heading: 356, pitch: -87 } center: { lat: 28.665233, lng: 108.757799, alt: 4255656, heading: 356, pitch: -87 }
},
// 方式1:在创建地球前的参数中配置
layers: [
{
name: "矢量瓦片图层",
icon: "img/basemaps/osm.png",
type: "pbf", // lib\mars3d\thirdParty\pbf-mapbox\PbfLayer.js 中定义的类型
url: "https://api.maptiler.com/maps/basic/style.json?key=pSHUA9sSkNny3iqoWG4P",
popup: "all",
show: true
} }
]
} }
/** /**
...@@ -34,19 +45,19 @@ export function onUnmounted() { ...@@ -34,19 +45,19 @@ export function onUnmounted() {
map = null map = null
} }
function addPbfLayer() { // function addPbfLayer() {
// 在 lib\mars3d\thirdParty\pbf-mapbox\PbfLayer.js 中定义的 // // 在 lib\mars3d\thirdParty\pbf-mapbox\PbfLayer.js 中定义的
const pbfLayer = new mars3d.layer.PbfLayer({ // const pbfLayer = new mars3d.layer.PbfLayer({
url: "https://api.maptiler.com/maps/basic/style.json?key=pSHUA9sSkNny3iqoWG4P", // url: "https://api.maptiler.com/maps/basic/style.json?key=pSHUA9sSkNny3iqoWG4P",
popup: "all" // popup: "all"
}) // })
map.addLayer(pbfLayer) // map.addLayer(pbfLayer)
// 单击事件 // // 单击事件
pbfLayer.on(mars3d.EventType.click, function (event) { // pbfLayer.on(mars3d.EventType.click, function (event) {
console.log("单击了矢量数据,共" + event.features.length + "条", event) // console.log("单击了矢量数据,共" + event.features.length + "条", event)
}) // })
} // }
function addPbfLayer2() { function addPbfLayer2() {
const exampleStyle = { const exampleStyle = {
......
...@@ -37,6 +37,10 @@ export function onMounted(mapInstance) { ...@@ -37,6 +37,10 @@ export function onMounted(mapInstance) {
console.log(`地图所有图层加载完成`) console.log(`地图所有图层加载完成`)
}) })
map.on(mars3d.EventType.keyup, function (e) {
console.log("按下了键盘", e)
})
// on绑定事件 // on绑定事件
map.on(mars3d.EventType.cameraChanged, this.map_cameraChangedHandler, this) map.on(mars3d.EventType.cameraChanged, this.map_cameraChangedHandler, this)
map.on(mars3d.EventType.click, this.map_clickHandler, this) map.on(mars3d.EventType.click, this.map_clickHandler, this)
......
...@@ -56,6 +56,26 @@ export function onMounted(mapInstance) { ...@@ -56,6 +56,26 @@ export function onMounted(mapInstance) {
}) })
queryGaodePOI = new mars3d.query.GaodePOI() queryGaodePOI = new mars3d.query.GaodePOI()
// 右键菜单
const defaultContextmenuItems = map.getDefaultContextMenu()
defaultContextmenuItems.push({
text: "查看此处地址",
icon: "fa fa-eye",
show: function (e) {
return Cesium.defined(e.cartesian)
},
callback: (e) => {
queryGaodePOI.getAddress({
location: e.cartesian,
success: (result) => {
console.log("根据经纬度坐标获取地址,逆地理编码", result)
globalAlert(result.address)
}
})
}
})
map.bindContextMenu(defaultContextmenuItems)
} }
/** /**
...@@ -147,7 +167,8 @@ function loadData(queryOptions, text) { ...@@ -147,7 +167,8 @@ function loadData(queryOptions, text) {
hideLoading() hideLoading()
}, },
error: function (msg) { error: function (msg) {
globalAlert(msg).hideLoading() hideLoading()
globalAlert(msg)
} }
} }
queryGaodePOI.query(lastQueryOptions) queryGaodePOI.query(lastQueryOptions)
......
...@@ -4,6 +4,7 @@ export let map // mars3d.Map三维地图对象 ...@@ -4,6 +4,7 @@ export let map // mars3d.Map三维地图对象
let slope let slope
let contourLine let contourLine
let graphicLayer let graphicLayer
/** /**
* 初始化地图业务,生命周期钩子函数(必须) * 初始化地图业务,生命周期钩子函数(必须)
* 框架在地图初始化完成后自动调用该函数 * 框架在地图初始化完成后自动调用该函数
...@@ -12,9 +13,11 @@ let graphicLayer ...@@ -12,9 +13,11 @@ let graphicLayer
*/ */
export function onMounted(mapInstance) { export function onMounted(mapInstance) {
map = mapInstance // 记录map map = mapInstance // 记录map
addSlope()
graphicLayer = new mars3d.layer.GraphicLayer() graphicLayer = new mars3d.layer.GraphicLayer()
map.addLayer(graphicLayer) map.addLayer(graphicLayer)
addSlope()
} }
/** /**
...@@ -32,6 +35,7 @@ function addSlope() { ...@@ -32,6 +35,7 @@ function addSlope() {
scale: 0.3, // 箭头长度的比例(范围0.1-0.9) scale: 0.3, // 箭头长度的比例(范围0.1-0.9)
color: Cesium.Color.YELLOW, color: Cesium.Color.YELLOW,
width: 15, // 箭头宽度 width: 15, // 箭头宽度
// clampToGround: true,
show: true show: true
}, },
tooltip: function (event) { tooltip: function (event) {
......
...@@ -630,8 +630,36 @@ const styleConfig = { ...@@ -630,8 +630,36 @@ const styleConfig = {
}, },
div: { div: {
name: "DIV点标记", name: "DIV点标记",
extends: ["divBoderLabel", "divLightPoint", "divUpLabel", "popup", "tooltip"],
style: [ style: [
{ name: "html", label: "Html文本", type: "label", defval: "" }, {
name: "color",
label: "颜色",
type: "color",
defval: "#00ffff",
show(style, allStyle, graphicType) {
return graphicType === "divLightPoint" || graphicType === "divBoderLabel" || graphicType === "divUpLabel"
}
},
{
name: "boderColor",
label: "边框颜色",
type: "color",
defval: "#00ffff",
show(style, allStyle, graphicType) {
return graphicType === "divBoderLabel"
}
},
{
name: "size",
label: "大小",
type: "number",
step: 1,
defval: 10,
show(style, allStyle, graphicType) {
return graphicType === "divLightPoint"
}
},
{ {
name: "horizontalOrigin", name: "horizontalOrigin",
...@@ -739,7 +767,8 @@ const styleConfig = { ...@@ -739,7 +767,8 @@ const styleConfig = {
show(style, allStyle, graphicType) { show(style, allStyle, graphicType) {
return !style.diffHeight || style.diffHeight !== 0 return !style.diffHeight || style.diffHeight !== 0
} }
} },
{ name: "html", label: "Html文本", type: "label", defval: "" }
] ]
}, },
fontBillboard: { fontBillboard: {
...@@ -1806,6 +1835,7 @@ const styleConfig = { ...@@ -1806,6 +1835,7 @@ const styleConfig = {
polyline: { polyline: {
name: "线", name: "线",
primitive: true, primitive: true,
extends: ["curve", "distanceMeasure", "heightMeasure"],
style: [ style: [
{ name: "width", label: "线宽", type: "number", step: 1, defval: 4.0 }, { name: "width", label: "线宽", type: "number", step: 1, defval: 4.0 },
{ {
...@@ -2438,8 +2468,196 @@ const styleConfig = { ...@@ -2438,8 +2468,196 @@ const styleConfig = {
polygon: { polygon: {
name: "面", name: "面",
primitive: true, primitive: true,
extends: [
"video2D",
"attackArrow",
"attackArrowPW",
"attackArrowYW",
"closeVurve",
"straightArrow",
"doubleArrow",
"fineArrow",
"fineArrowYW",
"areaMeasure",
"gatheringPlace",
"isosTriangle",
"lune",
"regular"
],
style: [
{
name: "diffHeight",
label: "立体高度",
type: "number",
step: 1,
defval: 0.0,
show(style, allStyle, graphicType) {
return !style.clampToGround
}
},
{
name: "fill",
label: "是否填充",
type: "radio",
defval: true,
show(style, allStyle, graphicType) {
return !style.clampToGround
}
},
{
name: "materialType",
label: "填充材质",
type: "combobox",
defval: "Color",
data: [
{ label: "纯色", value: "Color" },
{ label: "图片", value: "Image", defval: { image: "img/tietu/gugong.jpg" } },
{ label: "网格", value: "Grid" },
{ label: "条纹", value: "Stripe" },
{ label: "棋盘", value: "Checkerboard" },
{ label: "文本", value: "Text" },
{ label: "渐变面", value: "PolyGradient" },
{ label: "水面", value: "Water" },
{ label: "蓝光水面", value: "WaterLight" }
],
show(style, allStyle, graphicType) {
return style.fill !== false && this.data.some((item) => item.value === style.materialType)
}
},
{
name: "stRotationDegree",
label: "填充方向",
type: "slider",
min: 0.0,
max: 360.0,
step: 0.01,
defval: 0.0,
show: (style) => {
return style.fill !== false
}
},
{ name: "outline", label: "是否边框", type: "radio", defval: false },
{
name: "outlineWidth",
label: "边框宽度",
type: "number",
min: 0,
step: 1,
defval: 1.0,
show: (style) => {
return style.outline
}
},
{
name: "outlineColor",
label: "边框颜色",
type: "color",
defval: "#ffffff",
show: (style) => {
return style.outline
}
},
{
name: "distanceDisplayCondition",
label: "是否按视距显示",
type: "radio",
defval: false
},
{
name: "distanceDisplayCondition_far",
label: "最大距离",
type: "number",
step: 1,
defval: 100000.0,
show(style, allStyle, graphicType) {
return style.distanceDisplayCondition
}
},
{
name: "distanceDisplayCondition_near",
label: "最小距离",
type: "number",
step: 1,
defval: 0.0,
show(style, allStyle, graphicType) {
return style.distanceDisplayCondition
}
},
{
name: "hasShadows",
label: "是否阴影",
type: "radio",
defval: false,
show(style, allStyle, graphicType) {
return !style.clampToGround
}
},
{
name: "clampToGround",
label: "是否贴地",
type: "radio",
defval: false,
show(style, allStyle, graphicType) {
return false // 面无法切换
}
},
{
name: "zIndex",
label: "层级顺序",
type: "number",
min: 0,
step: 1,
defval: 0.0,
show(style, allStyle, graphicType) {
return style.clampToGround
}
}
]
},
sector: {
name: "扇形面",
style: [ style: [
{ {
name: "radius",
label: "半径",
type: "number",
step: 0.1,
defval: 0.0
},
{
name: "startAngle",
label: "开始角度",
type: "slider",
min: 0.0,
max: 360.0,
step: 0.01,
defval: 0.0,
},
{
name: "endAngle",
label: "结束角度",
type: "slider",
min: 0.0,
max: 360.0,
step: 0.01,
defval: 0.0,
},
{
name: "noCenter",
label: "不连中心点",
type: "radio",
defval: false
},
{
name: "diffHeight", name: "diffHeight",
label: "立体高度", label: "立体高度",
type: "number", type: "number",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论