Skip to content

Commit 5cd11fa

Browse files
author
潘卓然Y7000P
committed
【SDK】【修复】【修复忽略目录&修正地图文档查询序号】
1 parent 8d307a0 commit 5cd11fa

3,006 files changed

Lines changed: 673499 additions & 852310 deletions

File tree

Some content is hidden

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

.babelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compact": false,
3+
"ast": false,
4+
"presets": [
5+
["es2015", { "modules": false }]
6+
]
7+
}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/docs/openlayers/
99
/docs/cesium/
1010

11+
/src/service/node_modules/
12+
1113
/src/leaflet/theme/
1214
/src/mapboxgl/theme/
1315
/src/openlayers/theme/
@@ -20,8 +22,10 @@
2022
/website/public/docs/mapboxgl/
2123
/website/public/docs/openlayers/
2224
/website/public/docs/cesium/
25+
/website/public/static/data/
2326
/website/public/static/data/deckgl/
2427
/website/public/static/data/echarts/gps/
2528
/website/public/static/data/echarts/line/
2629
/website/public/static/data/echarts/point/
27-
/website/public/static/data/echarts/road/
30+
/website/public/static/data/echarts/road/
31+
/website/public/static/libs/cdn

LICENSE

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

src/cesiumjs/overlay/PopupLayer.js

Lines changed: 161 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { CesiumZondy } from "../core/Base";
1+
import { CesiumZondy } from '../core/Base';
22

3-
import { updataPopupPosition } from "./popup/popup";
4-
import Cesium from "../../../node_modules/cesium/Source/Cesium";
3+
import { updataPopupPosition } from './popup/popup';
4+
import Cesium from '../../../node_modules/cesium/Source/Cesium';
55

66
var popupsIdIndex = 0;
77

@@ -56,192 +56,180 @@ var popupsIdIndex = 0;
5656
});
5757
*/
5858
export default class PopupLayer {
59-
constructor(map, position, options, container) {
60-
this.map = map;
61-
this.scene = map.scene;
59+
constructor(map, position, options, container) {
60+
this.map = map;
61+
this.scene = map.scene;
6262

63-
this.position = position;
64-
this.options = options;
65-
this.container = container;
63+
this.position = position;
64+
this.options = options;
65+
this.container = container;
6666

67-
this.popupId = options.popupId || "cesium-popup-id-" + popupsIdIndex++;
68-
this.popupClass = options.popupClass || "cesium-popup";
69-
this.popupContentId =
70-
options.popupContentId || "cesium-popup-content-id-" + popupsIdIndex++;
67+
this.popupId = options.popupId || 'cesium-popup-id-' + popupsIdIndex++;
68+
this.popupClass = options.popupClass || 'cesium-popup';
69+
this.popupContentId = options.popupContentId || 'cesium-popup-content-id-' + popupsIdIndex++;
7170

72-
this.options.postRender = this.options.postRender === undefined ? true : this.options.postRender;
71+
this.options.postRender = this.options.postRender === undefined ? true : this.options.postRender;
7372

74-
this.scene = map.scene;
75-
this.camera = map.camera;
76-
this.isShow = true;
73+
this.scene = map.scene;
74+
this.camera = map.camera;
75+
this.isShow = true;
7776

78-
this.handler = new Cesium.ScreenSpaceEventHandler(this.scene.canvas);
77+
this.handler = new Cesium.ScreenSpaceEventHandler(this.scene.canvas);
7978

80-
this.infoDiv = null;
81-
// this.px_position = null;
82-
if (position.entity) {
83-
this.cartesian = position.entity.position._value;
79+
this.infoDiv = null;
80+
// this.px_position = null;
81+
if (position.entity) {
82+
this.cartesian = position.entity.position._value;
83+
}
84+
85+
this.cartesian =
86+
this.cartesian ||
87+
this.position.cartesian ||
88+
Cesium.Cartesian3.fromDegrees(this.position.longitude, this.position.latitude, this.position.height);
89+
90+
let parents = document.getElementsByClassName('cesium-widget');
91+
parent = parents.length > 0 ? parents[0] : map.container;
92+
this.parent = parent;
93+
94+
// this.initDevicePixelRatio();
95+
this.showClose = options.showClose === undefined ? true : options.showClose;
96+
this.popup = this._createPopup();
97+
98+
this.moveStart = this.eventMoveStart.bind(this);
99+
this.moveEnd = this.eventMoveEnd.bind(this);
100+
this.movement = this.movement.bind(this);
101+
this.update = this.update.bind(this);
102+
103+
this.bindEvent();
104+
105+
return this;
106+
}
107+
108+
_createPopup() {
109+
const self = this;
110+
this.hide = this.hide.bind(this);
111+
let infoDiv = window.document.createElement('div');
112+
infoDiv.id = this.popupId;
113+
infoDiv.style.display = 'none';
114+
infoDiv.innerHTML =
115+
'<div id="' +
116+
this.popupContentId +
117+
'" class="cesium-popup">' +
118+
// '<a class="cesium-popup-close-button" href="javascript:void(0)" onClick="function remove(){self.remove()}">×</a>' +
119+
'<div class="cesium-popup-content-wrapper">' +
120+
this.container +
121+
'</div>' +
122+
'<div class="cesium-popup-tip-container">' +
123+
'<div class="cesium-popup-tip" />' +
124+
'</div>' +
125+
'</div>';
126+
let close = window.document.createElement('div');
127+
close.className = 'cesium-popup-close-button';
128+
close.addEventListener('click', () => self.hide());
129+
close.innerText = 'x';
130+
this.parent.appendChild(infoDiv);
131+
// window.document.getElementById(this.popupId).style.display = 'block';
132+
if (this.showClose) {
133+
window.document.getElementById(this.popupContentId).appendChild(close);
134+
}
135+
this.infoDiv = infoDiv;
136+
}
137+
138+
bindEvent() {
139+
let self = this;
140+
this.handler.setInputAction(this.movement, Cesium.ScreenSpaceEventType.LEFT_CLICK);
141+
142+
if (this.options.postRender) {
143+
this.map.scene.postRender.addEventListener(() => self.update());
144+
} else {
145+
this.map.camera.changed.addEventListener(() => self.update());
146+
this.handler.setInputAction(this.moveStart, Cesium.ScreenSpaceEventType.LEFT_DOWN);
147+
this.handler.setInputAction(this.moveEnd, Cesium.ScreenSpaceEventType.LEFT_UP);
148+
this.map.scene.camera.moveEnd.addEventListener(() => self.update());
149+
}
84150
}
85151

86-
this.cartesian =
87-
this.cartesian ||
88-
this.position.cartesian ||
89-
Cesium.Cartesian3.fromDegrees(
90-
this.position.longitude,
91-
this.position.latitude,
92-
this.position.height
93-
);
94-
95-
let parents = document.getElementsByClassName('cesium-widget');
96-
parent = parents.length > 0 ? parents[0] : map.container;
97-
this.parent = parent;
98-
99-
// this.initDevicePixelRatio();
100-
this.showClose = options.showClose === undefined ? true : options.showClose;
101-
this.popup = this._createPopup();
102-
103-
this.moveStart = this.eventMoveStart.bind(this);
104-
this.moveEnd = this.eventMoveEnd.bind(this);
105-
this.movement = this.movement.bind(this);
106-
this.update = this.update.bind(this);
107-
108-
this.bindEvent();
109-
110-
return this;
111-
}
112-
113-
_createPopup() {
114-
const self = this;
115-
this.hide = this.hide.bind(this);
116-
let infoDiv = window.document.createElement("div");
117-
infoDiv.id = this.popupId;
118-
infoDiv.style.display = "none";
119-
infoDiv.innerHTML =
120-
'<div id="' +
121-
this.popupContentId +
122-
'" class="cesium-popup">' +
123-
// '<a class="cesium-popup-close-button" href="javascript:void(0)" onClick="function remove(){self.remove()}">×</a>' +
124-
'<div class="cesium-popup-content-wrapper">' +
125-
this.container +
126-
"</div>" +
127-
'<div class="cesium-popup-tip-container">' +
128-
'<div class="cesium-popup-tip" />' +
129-
"</div>" +
130-
"</div>";
131-
let close = window.document.createElement("div");
132-
close.className = "cesium-popup-close-button";
133-
close.addEventListener("click", () => self.hide());
134-
close.innerText = "x";
135-
this.parent.appendChild(infoDiv);
136-
window.document.getElementById(this.popupId).style.display = "block";
137-
if (this.showClose) {
138-
window.document.getElementById(this.popupContentId).appendChild(close);
152+
unbindEvent() {
153+
let self = this;
154+
if (this.options.postRender) {
155+
this.map.scene.postRender.removeEventListener(() => self.update());
156+
} else {
157+
this.map.camera.changed.removeEventListener(() => self.update());
158+
this.map.scene.camera.moveEnd.removeEventListener(() => self.update());
159+
this.handler.destroy();
160+
}
139161
}
140-
this.infoDiv = infoDiv;
141-
}
142-
143-
bindEvent() {
144-
let self = this;
145-
this.handler.setInputAction(
146-
this.movement,
147-
Cesium.ScreenSpaceEventType.LEFT_CLICK
148-
);
149-
150-
if (this.options.postRender) {
151-
this.map.scene.postRender.addEventListener(() => self.update());
152-
} else {
153-
this.map.camera.changed.addEventListener(() => self.update());
154-
this.handler.setInputAction(
155-
this.moveStart,
156-
Cesium.ScreenSpaceEventType.LEFT_DOWN
157-
);
158-
this.handler.setInputAction(
159-
this.moveEnd,
160-
Cesium.ScreenSpaceEventType.LEFT_UP
161-
);
162-
this.map.scene.camera.moveEnd.addEventListener(() => self.update());
162+
163+
movement(movement) {
164+
var pickedPrimitive = this.map.scene.pick(movement.position);
165+
var pickedEntity = Cesium.defined(pickedPrimitive) ? pickedPrimitive.id : undefined;
166+
if (Cesium.defined(pickedEntity) /* && Cesium.defined(pickedEntity.billboard) */) {
167+
if (this.position && this.position.entity) {
168+
pickedPrimitive.id === this.position.entity.id;
169+
this.show();
170+
}
171+
}
172+
}
173+
174+
eventMoveStart(movement) {
175+
this.hide();
176+
}
177+
178+
eventMoveEnd() {
179+
this.update();
163180
}
164-
}
165-
166-
unbindEvent() {
167-
let self = this;
168-
if (this.options.postRender) {
169-
this.map.scene.postRender.removeEventListener(() => self.update());
170-
} else {
171-
this.map.camera.changed.removeEventListener(() => self.update());
172-
this.map.scene.camera.moveEnd.removeEventListener(() => self.update());
173-
this.handler.destroy();
181+
182+
update() {
183+
if (this.cartesian && this.isShow) {
184+
updataPopupPosition(this.map, this.cartesian, this.popupId, this.popupContentId, this.options);
185+
}
174186
}
175-
}
176-
177-
movement(movement) {
178-
var pickedPrimitive = this.map.scene.pick(movement.position);
179-
var pickedEntity = Cesium.defined(pickedPrimitive)
180-
? pickedPrimitive.id
181-
: undefined;
182-
if (
183-
Cesium.defined(
184-
pickedEntity
185-
) /* && Cesium.defined(pickedEntity.billboard) */
186-
) {
187-
if( this.position && this.position.entity ){
188-
pickedPrimitive.id === this.position.entity.id;
189-
this.show();
190-
}
187+
188+
/**
189+
* 显示图层
190+
* @function module:客户端可视化.PopupLayer.prototype.show
191+
*/
192+
show() {
193+
this.isShow = true;
194+
let node = window.document.getElementById(this.popupId);
195+
if (node && node.style) {
196+
node.style.display = 'block';
197+
}
191198
}
192-
}
193-
194-
eventMoveStart(movement) {
195-
this.hide();
196-
}
197-
198-
eventMoveEnd() {
199-
this.update();
200-
}
201-
202-
update() {
203-
if (this.cartesian && this.isShow) {
204-
updataPopupPosition(
205-
this.map,
206-
this.cartesian,
207-
this.popupId,
208-
this.popupContentId,
209-
this.options
210-
);
199+
200+
/**
201+
* 隐藏图层
202+
* @function module:客户端可视化.PopupLayer.prototype.hide
203+
*/
204+
hide() {
205+
this.isShow = false;
206+
let node = window.document.getElementById(this.popupId);
207+
if (node && node.style) {
208+
node.style.display = 'none';
209+
}
211210
}
212-
}
213-
214-
/**
215-
* 显示图层
216-
* @function module:客户端可视化.PopupLayer.prototype.show
217-
*/
218-
show() {
219-
this.isShow = true;
220-
window.document.getElementById(this.popupId).style.display = "block";
221-
}
222-
223-
/**
224-
* 隐藏图层
225-
* @function module:客户端可视化.PopupLayer.prototype.hide
226-
*/
227-
hide() {
228-
this.isShow = false;
229-
window.document.getElementById(this.popupId).style.display = "none";
230-
}
231-
232-
/**
233-
* 删除图层
234-
* @function module:客户端可视化.PopupLayer.prototype.remove
235-
*/
236-
remove() {
237-
this.unbindEvent();
238-
this.parent.removeChild(this.infoDiv);
239-
/* var self = this;
211+
212+
/**
213+
* 删除图层
214+
* @function module:客户端可视化.PopupLayer.prototype.remove
215+
*/
216+
remove() {
217+
this.unbindEvent();
218+
let node = window.document.getElementById(this.popupId);
219+
if (node) {
220+
if (node.parentNode) {
221+
node.parentNode.removeChild(node);
222+
} else {
223+
node.remove();
224+
}
225+
}
226+
// this.parent.removeChild(this.infoDiv);
227+
/* var self = this;
240228
if (this.canvas.parentElement)
241229
this.canvas.parentElement.removeChild(this.canvas);
242230
this.map = undefined; */
243-
return this;
244-
}
231+
return this;
232+
}
245233
}
246234

247235
CesiumZondy.Overlayer.PopupLayer = PopupLayer;

0 commit comments

Comments
 (0)