Skip to content

Commit 307fb95

Browse files
committed
同步代码
1 parent 3e09de4 commit 307fb95

File tree

193 files changed

+936
-196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+936
-196
lines changed

public/config/example.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2409,6 +2409,13 @@
24092409
"api": "Regular.html",
24102410
"hasPannel": true
24112411
},
2412+
{
2413+
"name": "平行四边形",
2414+
"thumbnail": "graphic-entity-polygon-parallelogram.jpg",
2415+
"main": "graphic/entity/polygon-parallelogram",
2416+
"api": "Parallelogram.html",
2417+
"hasPannel": true
2418+
},
24122419
{
24132420
"name": "",
24142421
"thumbnail": "graphic-primitive-pit.jpg",
-1.31 KB
-598 Bytes
-1.18 KB
-22.4 KB
-26.1 KB
-25.8 KB
-732 Bytes
-990 Bytes
-510 Bytes
-23.5 KB
-20.9 KB
-19.1 KB
-22.8 KB
-272 Bytes
-22.9 KB
-21.6 KB
-24.4 KB
-21.5 KB
-20 KB
-18.4 KB
-21.9 KB
-19.3 KB
-941 Bytes
-20.4 KB
-23.9 KB
-24.6 KB
-19.3 KB
-343 Bytes
-46.9 KB
-24.8 KB
-1.68 KB
-19.3 KB
-26.2 KB
-23.5 KB
-20.3 KB
-1.6 KB
-22.9 KB
-23.4 KB
-9.9 KB
-23.9 KB
-19.6 KB
-17.8 KB
-23.1 KB
-25.4 KB
-24.4 KB
-2.09 KB
-22.1 KB
-22.7 KB
-25.4 KB
-209 Bytes
-16.1 KB
-23.3 KB
-19.4 KB
-23.7 KB

public/lib/mars3d/mars3d.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* Mars3D三维可视化平台 mars3d
33
*
4-
* 版本信息:v3.8.7
5-
* 编译日期:2024-11-14 18:36
4+
* 版本信息:v3.8.8
5+
* 编译日期:2024-11-23 11:59
66
* 版权所有:Copyright by 火星科技 http://mars3d.cn
77
* 使用单位:免费公开版 ,2024-08-01
88
*/

public/lib/mars3d/mars3d.d.ts

Lines changed: 151 additions & 18 deletions
Large diffs are not rendered by default.

public/lib/mars3d/mars3d.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/lib/mars3d/plugins/echarts/mars3d-echarts.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/lib/mars3d/plugins/heatmap/mars3d-heatmap.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/lib/mars3d/plugins/mapv/mars3d-mapv.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/lib/mars3d/plugins/space/mars3d-space.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/lib/mars3d/plugins/wind/mars3d-wind.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/temp/js/common.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ function init() {
2828
}).then(function (m) {
2929
parentGlobal._mapInstance = m
3030
parentGlobal.mapWork = window
31+
32+
parentGlobal.map = m // only for test
3133
})
3234
// parentGlobal._mapInstance = initMapFun(json.map3d)
3335
// parentGlobal.mapWork = window // 这句话是将当前js对象绑定赋予给index.项目内进行调用

src/example/graphic/apply/quyu/map.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let terrainClip
77
// 需要覆盖config.json中地图属性参数(当前示例框架中自动处理合并)
88
export const mapOptions = {
99
scene: {
10-
center: { lat: 30.773023, lng: 116.473055, alt: 133111.3, heading: 40.4, pitch: -47.9 },
10+
center: { lat: 21.748008, lng: 113.230533, alt: 699712.9, heading: 350.3, pitch: -52 },
1111
orderIndependentTranslucency: false,
1212
backgroundImage: "url(//data.mars3d.cn/img/busines/background1.jpg)",
1313
showMoon: false,
@@ -27,7 +27,9 @@ export const mapOptions = {
2727
}
2828

2929
// 行政区划编码(全国统一,可以按需修改其他省市县编码)
30-
const xzqhCode = "340100"
30+
const xzqhCode = "430000"
31+
32+
const wallHeight = 40000 // 墙高
3133

3234
/**
3335
* 初始化地图业务,生命周期钩子函数(必须)
@@ -94,8 +96,8 @@ export function onMounted(mapInstance) {
9496
const wall = new mars3d.graphic.WallPrimitive({
9597
positions: options.positions,
9698
style: {
97-
setHeight: -20000,
98-
diffHeight: 20000, // 墙高
99+
setHeight: -wallHeight,
100+
diffHeight: wallHeight, // 墙高
99101
width: 10,
100102
materialType: mars3d.MaterialType.Image2,
101103
materialOptions: {
@@ -160,7 +162,7 @@ function addCenterGraphi(attr) {
160162
position: attr.centroid,
161163
style: {
162164
html: `<div class="mars-four-color mars3d-animation">
163-
<img src="${getImage()}" class="four-color_bg"></img>
165+
<img src="//data.mars3d.cn/img/marker/bg/${getImage()}" class="four-color_bg"></img>
164166
<div class="four-color_name">${attr.name}</div>
165167
</div>`,
166168
horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
@@ -172,29 +174,21 @@ function addCenterGraphi(attr) {
172174
graphicLayer.addGraphic(divGraphic)
173175
}
174176

175-
// 简化geojson的坐标
176-
function simplifyGeoJSON(geojson) {
177-
try {
178-
geojson = turf.simplify(geojson, { tolerance: 0.009, highQuality: true, mutate: true })
179-
} catch (e) {
180-
//
181-
}
182-
return geojson
183-
}
177+
184178

185179
// 根据随机数字取图片
186180
function getImage() {
187181
const num = Math.floor(Math.random() * 5)
188182
switch (num) {
189183
case 1:
190-
return "/img/icon/map-title-y.png"
184+
return "map-title-y.png"
191185
case 2:
192-
return "/img/icon/map-title-h.png"
186+
return "map-title-h.png"
193187
case 3:
194-
return "/img/icon/map-title-o.png"
188+
return "map-title-o.png"
195189
case 4:
196-
return "/img/icon/map-title-r.png"
190+
return "map-title-r.png"
197191
default:
198-
return "/img/icon/map-title-b.png"
192+
return "map-title-b.png"
199193
}
200194
}

src/example/graphic/apply/quyuNum/map.js

Lines changed: 71 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export let graphicLayer // 矢量图层对象
66
// 需要覆盖config.json中地图属性参数(当前示例框架中自动处理合并)
77
export const mapOptions = {
88
scene: {
9-
center: { lat: 30.053342, lng: 117.677104, alt: 187118, heading: 350, pitch: -50 },
9+
center: { lat: 21.748008, lng: 113.230533, alt: 699712.9, heading: 350.3, pitch: -52 },
1010
showSun: false,
1111
showMoon: false,
1212
showSkyBox: false,
@@ -26,6 +26,11 @@ export const mapOptions = {
2626
layers: []
2727
}
2828

29+
// 行政区划编码(全国统一,可以按需修改其他省市县编码)
30+
const xzqhCode = "430000"
31+
32+
const wallHeight = 40000 // 墙高
33+
2934
/**
3035
* 初始化地图业务,生命周期钩子函数(必须)
3136
* 框架在地图初始化完成后自动调用该函数
@@ -35,15 +40,14 @@ export const mapOptions = {
3540
export function onMounted(mapInstance) {
3641
map = mapInstance // 记录map
3742

38-
// 合肥市边界墙
3943
const borderWall = new mars3d.layer.GeoJsonLayer({
40-
name: "合肥市边界墙",
41-
url: "//data.mars3d.cn/file/geojson/areas/340100.json",
44+
name: "边界墙",
45+
url: `//data.mars3d.cn/file/geojson/areas/${xzqhCode}.json`,
4246
symbol: {
4347
type: "wallP",
4448
styleOptions: {
45-
setHeight: -25000,
46-
diffHeight: 25000, // 墙高
49+
setHeight: -wallHeight,
50+
diffHeight: wallHeight, // 墙高
4751
materialType: mars3d.MaterialType.Image2,
4852
materialOptions: {
4953
image: "//data.mars3d.cn/img/textures/fence-top.png",
@@ -54,10 +58,6 @@ export function onMounted(mapInstance) {
5458
})
5559
map.addLayer(borderWall)
5660

57-
// 创建矢量数据图层
58-
graphicLayer = new mars3d.layer.GraphicLayer()
59-
map.addLayer(graphicLayer)
60-
6161
addGraphics()
6262
}
6363

@@ -77,76 +77,69 @@ export function onUnmounted() {
7777
*polygon面 PolylineEntity线 光锥体 和 LED数字显示
7878
* @returns {void} 无
7979
*/
80-
function addGraphics() {
81-
mars3d.Util.fetchJson({ url: "//data.mars3d.cn/file/geojson/areas/340100_full.json" })
82-
.then(function (geojson) {
83-
const arr = mars3d.Util.geoJsonToGraphics(geojson) // 解析geojson
84-
85-
for (let i = 0; i < arr.length; i++) {
86-
const item = arr[i]
87-
88-
// polygon面
89-
const polygonEntity = new mars3d.graphic.PolygonEntity({
90-
positions: item.positions,
91-
style: {
92-
fill: true,
93-
color: "#4881a7",
94-
opacity: 0.5,
95-
label: {
96-
text: item.attr.name,
97-
font_size: 20,
98-
color: "#ffffff",
99-
font_family: "楷体",
100-
outline: true,
101-
outlineColor: "black",
102-
setHeight: 2000,
103-
visibleDepth: false,
104-
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0, 500000),
105-
scaleByDistance: new Cesium.NearFarScalar(200000, 1.0, 500000, 0.5)
106-
}
107-
}
108-
})
109-
graphicLayer.addGraphic(polygonEntity)
110-
111-
// PolylineEntity线
112-
const graphicLine = new mars3d.graphic.PolylineEntity({
113-
positions: item.positions,
114-
style: {
115-
color: "rgba(255,255,255,0.5)",
116-
width: 1
117-
}
118-
})
119-
graphicLayer.addGraphic(graphicLine)
120-
121-
// 中心点
122-
const center = item.attr.centroid
123-
124-
// 光锥体
125-
const coneGlow = new mars3d.graphic.LightCone({
126-
position: center,
127-
style: {
128-
radius: 1500,
129-
height: 15000
130-
}
131-
})
132-
graphicLayer.addGraphic(coneGlow)
133-
134-
// LED数字显示
135-
const number = Math.floor(Math.random() * (4000 - 3000 + 1) + 3000) // 随机数字 3000-4000
136-
const graphic = new mars3d.graphic.DivGraphic({
137-
position: [center[0], center[1], 12000],
138-
style: {
139-
html: `<div class ="coneNum">${number}`,
140-
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
141-
verticalOrigin: Cesium.VerticalOrigin.CENTER,
142-
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0, 500000),
143-
scaleByDistance: new Cesium.NearFarScalar(200000, 1.0, 500000, 0.5)
80+
async function addGraphics() {
81+
const url = `//data.mars3d.cn/file/geojson/areas/${xzqhCode}_full.json`
82+
const geojson = await mars3d.Util.fetchJson({ url: url })
83+
84+
const arr = mars3d.Util.geoJsonToGraphics(geojson) // 解析geojson
85+
86+
// 创建矢量数据图层
87+
graphicLayer = new mars3d.layer.GraphicLayer()
88+
map.addLayer(graphicLayer)
89+
90+
for (let i = 0; i < arr.length; i++) {
91+
const item = arr[i]
92+
if (!item.isMultiMax) {
93+
continue
94+
}
95+
// polygon面
96+
const polygonEntity = new mars3d.graphic.PolygonEntity({
97+
positions: item.positions,
98+
style: {
99+
fill: true,
100+
color: "#4881a7",
101+
opacity: 0.5,
102+
outline: true,
103+
outlineStyle: {
104+
color: "rgba(255,255,255,0.5)",
105+
width: 1
106+
},
107+
// 高亮时的样式
108+
highlight: {
109+
opacity: 0.9,
110+
outlineStyle: {
111+
width: 2
144112
}
145-
})
146-
graphicLayer.addGraphic(graphic)
113+
}
147114
}
148115
})
149-
.catch(function (error) {
150-
console.log("加载JSON出错", error)
116+
graphicLayer.addGraphic(polygonEntity)
117+
118+
// 中心点
119+
const center = item.attr.centroid
120+
121+
// 光锥体
122+
const coneGlow = new mars3d.graphic.LightCone({
123+
position: center,
124+
style: {
125+
radius: wallHeight * 0.1,
126+
height: wallHeight
127+
}
128+
})
129+
graphicLayer.addGraphic(coneGlow)
130+
131+
// LED数字显示
132+
const number = Math.floor(Math.random() * (400 - 300 + 1) + 300) // 随机数字
133+
const graphic = new mars3d.graphic.DivGraphic({
134+
position: [center[0], center[1], wallHeight],
135+
style: {
136+
html: `<div class ="coneNum">${item.attr.name}:${number}</div>`,
137+
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
138+
verticalOrigin: Cesium.VerticalOrigin.CENTER,
139+
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0.0, 2000000),
140+
scaleByDistance: new Cesium.NearFarScalar(500000, 1.0, 1000000, 0.5)
141+
}
151142
})
143+
graphicLayer.addGraphic(graphic)
144+
}
152145
}

src/example/graphic/custom/fixedRoute-flight-ray/map.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ function addGraphicLayer() {
9494

9595
// ui面板信息展示
9696
fixedRoute.on(mars3d.EventType.change, mars3d.Util.funThrottle((event) => {
97+
// 取实时信息,可以通过 fixedRoute.info
9798
eventTarget.fire("roamLineChange", event)
9899
}, 500))
99100

src/example/graphic/custom/fixedRoute-flight/map.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ function addGraphicLayer() {
156156
model: {
157157
url: "//data.mars3d.cn/gltf/mars/MQ-9-Predator.glb",
158158
scale: 1,
159+
heading: 0,
159160
minimumPixelSize: 100
160161
},
161162
path: {
@@ -178,6 +179,7 @@ function addGraphicLayer() {
178179

179180
// ui面板信息展示
180181
fixedRoute.on(mars3d.EventType.change, mars3d.Util.funThrottle((event) => {
182+
// 取实时信息,可以通过 fixedRoute.info
181183
eventTarget.fire("roamLineChange", event)
182184
}, 500))
183185

src/example/graphic/custom/fixedRoute-ground-tileset/map.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ function addRoamLine() {
9393

9494
// ui面板信息展示
9595
fixedRoute.on(mars3d.EventType.change, mars3d.Util.funThrottle((event) => {
96+
// 取实时信息,可以通过 fixedRoute.info
9697
eventTarget.fire("roamLineChange", event)
9798
}, 500))
9899

src/example/graphic/custom/fixedRoute-ground/map.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function addGraphicLayer() {
9999
})
100100
// ui面板信息展示
101101
fixedRoute.on(mars3d.EventType.change, mars3d.Util.funThrottle((event) => {
102+
// 取实时信息,可以通过 fixedRoute.info
102103
eventTarget.fire("roamLineChange", event)
103104
}, 500))
104105

src/example/graphic/custom/fixedRoute-shoot/map.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ function addGraphicLayer(arr) {
9595

9696
// ui面板信息展示
9797
fixedRoute.on(mars3d.EventType.change, mars3d.Util.funThrottle((event) => {
98+
// 取实时信息,可以通过 fixedRoute.info
9899
eventTarget.fire("roamLineChange", event)
99100
}, 500))
100101

src/example/graphic/custom/fixedRoute-sky/map.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function onMounted(mapInstance) {
3636

3737
// ui面板信息展示
3838
fixedRoute.on(mars3d.EventType.change, mars3d.Util.funThrottle((event) => {
39+
// 取实时信息,可以通过 fixedRoute.info
3940
eventTarget.fire("roamLineChange", event)
4041
}, 500))
4142

src/example/graphic/custom/fixedRoute-walk/map.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ function addGraphicLayer() {
105105

106106
// ui面板信息展示
107107
fixedRoute.on(mars3d.EventType.change, mars3d.Util.funThrottle((event) => {
108+
// 取实时信息,可以通过 fixedRoute.info
108109
eventTarget.fire("roamLineChange", event)
109110
}, 500))
110111

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { MarsPannel } from "@mars/components/MarsUI"
2+
import { GraphicLayerState } from "@mars/components/MarsSample/GraphicLayerState"
3+
import { LocationTo } from "@mars/components/MarsSample/LocationTo"
4+
5+
function UIComponent() {
6+
return (
7+
<>
8+
<MarsPannel visible={true} top={10} right={10}>
9+
<GraphicLayerState drawLabel1={"绘制面"} drawLabel2={"绘制立体面"} />
10+
</MarsPannel>
11+
<LocationTo />
12+
</>
13+
)
14+
}
15+
16+
export default UIComponent

0 commit comments

Comments
 (0)