mars3d-space 3.1.15 → 3.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/mars3d-space.js +3 -3
- package/dist/worker/mars3d-tle-worker.js +1 -1
- package/package.json +6 -3
- package/index.html +0 -286
package/index.html
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html class="no-js css-menubar" lang="zh-cn">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<title>Mars3D三维地球 space插件</title>
|
|
6
|
-
<meta charset="utf-8" />
|
|
7
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
8
|
-
<!-- 移动设备 viewport -->
|
|
9
|
-
<meta name="viewport"
|
|
10
|
-
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui" />
|
|
11
|
-
<meta name="author" content="火星科技 http://mars3d.cn " />
|
|
12
|
-
<!-- 360浏览器默认使用Webkit内核 -->
|
|
13
|
-
<meta name="renderer" content="webkit" />
|
|
14
|
-
<!-- Chrome浏览器添加桌面快捷方式(安卓) -->
|
|
15
|
-
<link rel="icon" type="image/png" href="img/favicon/favicon.png" />
|
|
16
|
-
<meta name="mobile-web-app-capable" content="yes" />
|
|
17
|
-
<!-- Safari浏览器添加到主屏幕(IOS) -->
|
|
18
|
-
<link rel="icon" sizes="192x192" href="img/favicon/apple-touch-icon.png" />
|
|
19
|
-
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
20
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
21
|
-
<meta name="apple-mobile-web-app-title" content="火星科技 MarsGIS" />
|
|
22
|
-
<!-- Win8标题栏及ICON图标 -->
|
|
23
|
-
<link rel="apple-touch-icon-precomposed" href="img/favicon/apple-touch-icon.png" />
|
|
24
|
-
<meta name="msapplication-TileImage" content="img/favicon/app-icon72x72@2x.png" />
|
|
25
|
-
<meta name="msapplication-TileColor" content="#62a8ea" />
|
|
26
|
-
|
|
27
|
-
<!--引入基础lib-->
|
|
28
|
-
<link href="https://cdn.jsdelivr.net/npm/mars3d-cesium/Build/Cesium/Widgets/widgets.css" rel="stylesheet" type="text/css" />
|
|
29
|
-
<script src="https://cdn.jsdelivr.net/npm/mars3d-cesium/Build/Cesium/Cesium.js" type="text/javascript" ></script>
|
|
30
|
-
<script src="https://unpkg.com/@turf/turf/turf.min.js" type="text/javascript" ></script>
|
|
31
|
-
<script type="text/javascript" src="http://mars3d.cn/lib/jquery/jquery-2.1.4.min.js"></script>
|
|
32
|
-
<script type="text/javascript" src="http://mars3d.cn/lib/hao/haoutil.js"></script>
|
|
33
|
-
|
|
34
|
-
<!--引入mars3d库lib-->
|
|
35
|
-
<link href="https://cdn.jsdelivr.net/npm/mars3d/dist/mars3d.css" rel="stylesheet" type="text/css" />
|
|
36
|
-
<script src="https://cdn.jsdelivr.net/npm/mars3d/dist/mars3d.js" type="text/javascript" ></script>
|
|
37
|
-
|
|
38
|
-
<script type="text/javascript" src="dist/mars3d-space.js"></script>
|
|
39
|
-
|
|
40
|
-
<style>
|
|
41
|
-
html,
|
|
42
|
-
body {
|
|
43
|
-
height: 100%;
|
|
44
|
-
width: 100%;
|
|
45
|
-
margin: 0;
|
|
46
|
-
padding: 0;
|
|
47
|
-
border: none;
|
|
48
|
-
overflow: hidden;
|
|
49
|
-
font-size: 14px;
|
|
50
|
-
background: #000;
|
|
51
|
-
}
|
|
52
|
-
</style>
|
|
53
|
-
</head>
|
|
54
|
-
|
|
55
|
-
<body>
|
|
56
|
-
<div id="mars3dContainer" class="mars3d-container"></div>
|
|
57
|
-
|
|
58
|
-
<!--业务代码-->
|
|
59
|
-
<script type="text/javascript">
|
|
60
|
-
//判断webgl支持
|
|
61
|
-
if (!mars3d.Util.webglreport()) {
|
|
62
|
-
mars3d.Util.webglerror();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//读取 config.json 配置文件
|
|
66
|
-
var configUrl = "http://mars3d.cn/example/config/config.json";
|
|
67
|
-
mars3d.Resource.fetchJson({ url: configUrl }).then(function (json) {
|
|
68
|
-
initMap(json.map3d); //构建地图
|
|
69
|
-
});
|
|
70
|
-
var map;
|
|
71
|
-
//创建三维地球场景
|
|
72
|
-
function initMap(options) {
|
|
73
|
-
//合并属性参数,可覆盖config.json中的对应配置
|
|
74
|
-
mapOptions = mars3d.Util.merge(options, {
|
|
75
|
-
scene: {
|
|
76
|
-
shadows: true,
|
|
77
|
-
center: {
|
|
78
|
-
y: 12.845055,
|
|
79
|
-
x: 112.931363,
|
|
80
|
-
z: 24286797.17,
|
|
81
|
-
heading: 3.4,
|
|
82
|
-
pitch: -89.6,
|
|
83
|
-
roll: 0,
|
|
84
|
-
},
|
|
85
|
-
cameraController: {
|
|
86
|
-
zoomFactor: 3.0,
|
|
87
|
-
minimumZoomDistance: 1000,
|
|
88
|
-
maximumZoomDistance: 300000000,
|
|
89
|
-
constrainedAxis: false, //解除在南北极区域鼠标操作限制
|
|
90
|
-
},
|
|
91
|
-
globe: { enableLighting: true },
|
|
92
|
-
clock: {
|
|
93
|
-
multiplier: 10, //速度
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
control: {
|
|
97
|
-
animation: true, //是否创建动画小器件,左下角仪表
|
|
98
|
-
timeline: true, //是否显示时间线控件
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
map = new mars3d.Map("mars3dContainer", mapOptions);
|
|
103
|
-
|
|
104
|
-
//创建矢量数据图层
|
|
105
|
-
var graphicLayer = new mars3d.layer.GraphicLayer();
|
|
106
|
-
map.addLayer(graphicLayer);
|
|
107
|
-
|
|
108
|
-
var position = Cesium.Cartesian3.fromDegrees(
|
|
109
|
-
109.266201,
|
|
110
|
-
34.328747,
|
|
111
|
-
1213.46
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
//地面站gltf模型
|
|
115
|
-
var graphic = new mars3d.graphic.ModelEntity({
|
|
116
|
-
name: "地面站模型",
|
|
117
|
-
position: position,
|
|
118
|
-
style: {
|
|
119
|
-
url: "http://data.mars3d.cn/gltf/mars/leida.glb",
|
|
120
|
-
heading: 270,
|
|
121
|
-
scale: 30,
|
|
122
|
-
minimumPixelSize: 40,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
graphicLayer.addGraphic(graphic);
|
|
126
|
-
|
|
127
|
-
dmfwGraphic = new mars3d.graphic.CircleEntity({
|
|
128
|
-
position: position,
|
|
129
|
-
style: {
|
|
130
|
-
radius: 3000000.0,
|
|
131
|
-
color: "#ff0000",
|
|
132
|
-
opacity: 0.3,
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
graphicLayer.addGraphic(dmfwGraphic);
|
|
136
|
-
|
|
137
|
-
$.ajax({
|
|
138
|
-
url: "http://data.mars3d.cn/file/apidemo/tle-china.json",
|
|
139
|
-
dataType: "json",
|
|
140
|
-
type: "get",
|
|
141
|
-
success: function (data) {
|
|
142
|
-
createSatelliteList(data.data);
|
|
143
|
-
},
|
|
144
|
-
error: function (data) {
|
|
145
|
-
haoutil.msg("获取卫星信息异常!");
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function createSatelliteList(arr) {
|
|
151
|
-
//创建矢量数据图层
|
|
152
|
-
var graphicLayer = new mars3d.layer.GraphicLayer();
|
|
153
|
-
map.addLayer(graphicLayer);
|
|
154
|
-
|
|
155
|
-
//单击地图空白处
|
|
156
|
-
map.on(mars3d.EventType.clickMap, function (event) {
|
|
157
|
-
highlightSatellite();
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
graphicLayer.on(mars3d.EventType.click, function (event) {
|
|
161
|
-
console.log("单击了卫星", event);
|
|
162
|
-
//单击事件
|
|
163
|
-
highlightSatellite(event.graphic);
|
|
164
|
-
});
|
|
165
|
-
graphicLayer.on(mars3d.EventType.change, function (event) {
|
|
166
|
-
//位置变化事件
|
|
167
|
-
processInArea(event.graphic);
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
for (var i = 0; i < arr.length; i++) {
|
|
171
|
-
var item = arr[i];
|
|
172
|
-
var norad = item.norad;
|
|
173
|
-
if (norad == null || norad === undefined) {
|
|
174
|
-
norad = mars3d.space.util.getPeriod(item.tle2);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
//属性处理
|
|
178
|
-
item.model = item.model || {};
|
|
179
|
-
item.model.url =
|
|
180
|
-
item.model.url || "http://data.mars3d.cn/gltf/mars/weixin.gltf";
|
|
181
|
-
item.model.show = true;
|
|
182
|
-
|
|
183
|
-
item.path = item.path || {};
|
|
184
|
-
item.path.color = Cesium.defaultValue(item.path.color, "#e2e2e2");
|
|
185
|
-
item.path.closure = Cesium.defaultValue(item.path.closure, true);
|
|
186
|
-
|
|
187
|
-
//test data
|
|
188
|
-
item.cone = {
|
|
189
|
-
sensorType:
|
|
190
|
-
i % 2 === 1
|
|
191
|
-
? mars3d.graphic.SatelliteSensor.Type.Rect
|
|
192
|
-
: mars3d.graphic.SatelliteSensor.Type.Conic,
|
|
193
|
-
angle1: haoutil.math.random(20, 50),
|
|
194
|
-
angle2: haoutil.math.random(10, 30),
|
|
195
|
-
show: false,
|
|
196
|
-
};
|
|
197
|
-
item.popup = `名称:${item.name}<br/>英文名:${item.name_en || ""
|
|
198
|
-
}<br/>类型:${item.type}`;
|
|
199
|
-
//属性处理 END
|
|
200
|
-
|
|
201
|
-
var satelliteObj = new mars3d.graphic.Satellite(item);
|
|
202
|
-
graphicLayer.addGraphic(satelliteObj);
|
|
203
|
-
}
|
|
204
|
-
console.log("当前卫星数量: " + arr.length);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
var lastSelectWX;
|
|
208
|
-
|
|
209
|
-
function highlightSatellite(satelliteObj) {
|
|
210
|
-
if (lastSelectWX) {
|
|
211
|
-
//重置上次选中的轨道样式
|
|
212
|
-
lastSelectWX.setOptions({
|
|
213
|
-
path: {
|
|
214
|
-
color: "#e2e2e2",
|
|
215
|
-
opacity: 0.5,
|
|
216
|
-
width: 1,
|
|
217
|
-
},
|
|
218
|
-
});
|
|
219
|
-
lastSelectWX.coneShow = false; //关闭视锥体
|
|
220
|
-
lastSelectWX = null;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (satelliteObj) {
|
|
224
|
-
//高亮选中的轨道样式
|
|
225
|
-
satelliteObj.setOptions({
|
|
226
|
-
path: {
|
|
227
|
-
color: "#ffff00",
|
|
228
|
-
opacity: 1,
|
|
229
|
-
width: 2,
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
satelliteObj.coneShow = true; //打开视锥体
|
|
233
|
-
lastSelectWX = satelliteObj;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
//判断卫星是否在面内
|
|
238
|
-
function processInArea(weixin) {
|
|
239
|
-
var position = weixin?.position;
|
|
240
|
-
if (!position) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
var thisIsInPoly = dmfwGraphic.isInPoly(position);
|
|
245
|
-
if (thisIsInPoly !== weixin._lastInPoly) {
|
|
246
|
-
if (thisIsInPoly) {
|
|
247
|
-
//开始进入区域内
|
|
248
|
-
console.log(weixin.name + "开始进入区域内");
|
|
249
|
-
|
|
250
|
-
weixin.coneShow = true; //打开视锥体
|
|
251
|
-
weixin.lineToDMZ = map.entities.add({
|
|
252
|
-
polyline: {
|
|
253
|
-
positions: new Cesium.CallbackProperty(function (time) {
|
|
254
|
-
var pots = weixin.position;
|
|
255
|
-
if (!pots) {
|
|
256
|
-
return [];
|
|
257
|
-
}
|
|
258
|
-
return [pots, dmfwGraphic.positionShow];
|
|
259
|
-
}, false),
|
|
260
|
-
arcType: Cesium.ArcType.NONE,
|
|
261
|
-
width: 7,
|
|
262
|
-
material: new mars3d.material.LineFlowMaterialProperty({
|
|
263
|
-
//动画线材质
|
|
264
|
-
color: Cesium.Color.AQUA,
|
|
265
|
-
duration: 500, //时长,控制速度
|
|
266
|
-
url: "https://mars3d.cn/example/img/textures/arrow2.png",
|
|
267
|
-
repeat: new Cesium.Cartesian2(15, 1),
|
|
268
|
-
}),
|
|
269
|
-
},
|
|
270
|
-
});
|
|
271
|
-
} else {
|
|
272
|
-
//离开区域
|
|
273
|
-
console.log(weixin.name + "离开区域");
|
|
274
|
-
|
|
275
|
-
weixin.coneShow = false; //关闭视锥体
|
|
276
|
-
map.entities.remove(weixin.lineToDMZ);
|
|
277
|
-
delete weixin.lineToDMZ;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
weixin._lastInPoly = thisIsInPoly;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
</script>
|
|
284
|
-
</body>
|
|
285
|
-
|
|
286
|
-
</html>
|