939dec7d by jikai

111111

1 parent 4248ae6a
1
2 export default {
3 movePrompt: class MovePrompt {
4 constructor(viewer, opt) {
5 if (!opt) opt = {};
6 var randomId = Number((new Date()).getTime());
7 this.id = randomId;
8 this.style = opt.style;
9 this.viewer = viewer;
10 if (!this.viewer) return;
11 this.scene = this.viewer.scene;
12 this.camera = this.viewer.camera;
13 this.mapContainer = this.viewer.container.id;
14 this.rendHandler = null;
15 if (!this.mapContainer) return;
16
17 this.trackPopUpId = "trackPopUp" + randomId;
18 this.promptContentId = "promptContent" + randomId;
19 this.promptDivId = "promptDiv" + randomId;
20 this.trackPopUpContentId = "trackPopUpContent" + randomId;
21 this.closeBtnId = "closeBtn" + randomId;
22
23 var infoDiv;
24 var max_width = 300;
25 var max_height = 500;
26 infoDiv = window.document.createElement("div");
27 infoDiv.id = this.trackPopUpId;
28 infoDiv.className = "trackPopUp";
29
30 this.content = opt.content || ""; //提示框内容
31 if (!opt.type || opt.type == 1) {
32 infoDiv.innerHTML = '<div id="' + this.trackPopUpContentId + '" class="cesium-popup" style="top:0;left:0;">' +
33 '<div class="cesium-prompt-content-wrapper" id="' + this.promptDivId + '">' +
34 '<div id="trackPopUpLink" class="cesium-popup-content" style="max-width: ' + max_width + 'px;max-height: ' + max_height + 'px">' +
35 '<span class="promptContent" id="' + this.promptContentId + '">' + this.content + '</span>' +
36 '</div>' +
37 '</div>' +
38 '</div>';
39 } else {
40 infoDiv.innerHTML = '<div id="' + this.trackPopUpContentId + '" class="cesium-popup" style="top:0;left:0;">' +
41 '<a class="cesium-popup-close-button" href="javascript:void(0)" id="' + this.closeBtnId + '">×</a>' +
42 '<div class="cesium-popup-content-wrapper" id="' + this.promptDivId + '">' +
43 '<div id="trackPopUpLink" class="cesium-popup-content" style="max-width: ' + max_width + 'px;max-height: ' + max_height + 'px">' +
44 '<span class="popupContent" id="' + this.promptContentId + '">' + this.content + '</span>' +
45 '</div>' +
46 '</div>' +
47 '<div class="cesium-popup-tip-container">' +
48 '<div class="cesium-popup-tip"></div>' +
49 '</div>' +
50 '</div>';
51 }
52
53 window.document.getElementById(this.mapContainer).appendChild(infoDiv);
54 window.document.getElementById(this.trackPopUpId).style.display = "block";
55
56 this.offset = opt.offset || {};
57
58 this.infoDiv = window.document.getElementById(this.trackPopUpId);
59 this.trackPopUpContent = window.document.getElementById(this.trackPopUpContentId);
60
61 this.promptDiv = window.document.getElementById(this.promptDivId);
62 this.promptContent = window.document.getElementById(this.promptContentId);
63 this.trackPopUpLink = window.document.getElementById(this.promptContentId);
64
65 this.popupCartesian = opt.popupCartesian;
66 this.rendHandler = null;
67 this.show = (opt.show == undefined ? true : opt.show);
68 if(opt.type==2){
69 if(!this.popupCartesian){
70 console.warn("缺少空间坐标!");
71 return ;
72 }
73 }
74 if (opt.type && opt.type != 1 && this.popupCartesian) {
75 var clsBtn = window.document.getElementById(this.closeBtnId);
76 var that = this;
77 clsBtn.addEventListener("click", function () {
78 that.setVisible(false);
79 });
80 this.rendHandler = this.viewer.scene.postRender.addEventListener(function () {
81 if (that.popupCartesian) {
82 var px = Cesium.SceneTransforms.wgs84ToWindowCoordinates(that.scene, that.popupCartesian);
83 that.trackPopUpContent.style.left = px.x + (that.offset.x || 0)+ (Math.ceil(-that.trackPopUpContent.offsetWidth / 2)) + "px";
84 that.trackPopUpContent.style.top = px.y + (that.offset.y ||0)+ (-that.trackPopUpContent.offsetHeight) + "px";
85 var res = false;
86 var e = that.popupCartesian,
87 i = that.camera.position,
88 n = that.scene.globe.ellipsoid.cartesianToCartographic(i).height;
89 if (!(n += 1 * that.scene.globe.ellipsoid.maximumRadius, Cesium.Cartesian3.distance(i, e) > n)) {
90 res = true;
91 }
92 if (res && that.show) {
93 if (that.infoDiv) that.infoDiv.style.display = "block";
94 } else {
95 if (that.infoDiv) that.infoDiv.style.display = "none";
96 }
97 }
98 });
99 }
100 }
101 setHtml(html) {
102 if (!html) {
103 return;
104 }
105 if (this.trackPopUpLink) {
106 this.trackPopUpLink.innerText = html;
107 }
108 }
109 destroy() {
110 if (this.infoDiv && this.mapContainer) {
111 this.infoDiv.style.display = "none";
112 window.document.getElementById(this.mapContainer).removeChild(this.infoDiv);
113 this.infoDiv = null;
114 }
115 if (this.rendHandler) {
116 this.rendHandler();
117 this.rendHandler = null;
118 }
119 }
120 displayPrompt(display) {
121 if (this.infoDiv) this.infoDiv.style.display = display ? "block" : "none";
122 }
123 updateStyle(opt) {
124 if (!opt) opt = {};
125 this.promptDiv.style.background = opt.rgba || "rgba(0,0,0,.4)";
126 this.promptContent.style.color = opt.fontColor || "white";
127 }
128 updatePrompt(px, html) {
129 if (!px) return;
130 this.infoDiv.style.display = "block";
131 this.trackPopUpContent.style.left = px.x + (this.offset.x || 30) + "px";
132 this.trackPopUpContent.style.top = px.y + (this.offset.y || 30) + "px";
133 this.setHtml(html);
134 }
135 setVisible(isOpen) {
136 if(isOpen==undefined) isOpen = true;
137 if(isOpen){
138 this.infoDiv.style.display = "block";
139 this.show = true;
140 }else{
141 this.infoDiv.style.display = "none";
142 this.show = false;
143 }
144 }
145 }
146 }
...\ No newline at end of file ...\ No newline at end of file
1 export default {
2 createPoint(opt) {
3 return this.viewer.entities.add({
4 position: opt.position,
5 point: opt.point || {
6 pixelSize: 5,
7 color: Cesium.Color.YELLOW,
8 outlineWidth: 2,
9 outlineColor: Cesium.Color.DARKRED,
10 disableDepthTestDistance: Number.POSITIVE_INFINITY
11 },
12 show: false
13 });
14 },
15 createPolyline(positions) {
16 let style = this.style || {};
17 var polyline = this.viewer.entities.add({
18 polyline: {
19 positions: new Cesium.CallbackProperty(() => {
20 return positions || this.positions
21 }, false),
22 show: true,
23 material: style.material || Cesium.Color.YELLOW,
24 width: style.width || 3,
25 clampToGround: style.clampToGround == undefined ? false : true
26 }
27 });
28 polyline.objId = this.objId;
29 return polyline;
30 },
31 createPolygon() {
32 return this.viewer.entities.add({
33 polygon: {
34 hierarchy: new Cesium.CallbackProperty(() => {
35 return new Cesium.PolygonHierarchy(this.positions)
36 }, false),
37 material: new Cesium.Color.fromCssColorString("#FFD700").withAlpha(.2),
38 perPositionHeight: true,
39 width: 3,
40 outlineColor: Cesium.Color.BLACK,
41 outlineWidth: 3,
42 outline: true
43 }
44 });
45 },
46 createRectangle() {
47 var that = this;
48 var rectangle = this.viewer.entities.add({
49 rectangle: {
50 coordinates: new Cesium.CallbackProperty(() => {
51 return Cesium.Rectangle.fromCartesianArray([this.leftup, this.rightdown])
52 }, false),
53 material: new Cesium.Color.fromCssColorString("#FFD700").withAlpha(.2),
54 perPositionHeight: true,
55 width: 3,
56 outlineColor: Cesium.Color.BLACK,
57 outlineWidth: 3,
58 outline: true
59 }
60 });
61 rectangle.objId = this.objId;
62 return rectangle;
63 },
64 createCircle() {
65 var ellipse = this.viewer.entities.add({
66 position: this.center,
67 ellipse: {
68 semiMajorAxis: new Cesium.CallbackProperty(() => {
69 return this.radius
70 }, false),
71 semiMinorAxis: new Cesium.CallbackProperty(() => {
72 return this.radius
73 }, false),
74 material: new Cesium.Color.fromCssColorString("#FFD700").withAlpha(.2),
75 perPositionHeight: true,
76 width: 3,
77 outlineColor: Cesium.Color.BLACK,
78 outlineWidth: 3,
79 outline: true
80 }
81 });
82 ellipse.objId = this.objId;
83 return ellipse;
84 }
85 }
...\ No newline at end of file ...\ No newline at end of file
1 import movePrompt from './MovePrompt';
2 export default class CreateBillboard {
3 constructor(viewer, style) {
4 this.objId = Number((new Date()).getTime() + "" + Number(Math.random() * 1000).toFixed(0));
5 this.viewer = viewer;
6 this.handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
7 this.modifyHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
8 this.state = 0; //1为新增 2为编辑 0为清除
9 this.image = style.image || "content/images/map3d/mark1.png";
10 this.style = style;
11 this.billboardArg = {};
12 this.billboard = null;
13 this.openModify = false;
14 if (style) {
15 var haveImage = false;
16 for (var i in style) {
17 if (i == "image" && style[i]) {
18 haveImage = true;
19 }
20 if (style[i]) this.billboardArg[i] = style[i];
21 }
22 } else {
23 console.warn("未设置billboard的参数!");
24 return;
25 }
26 this.prompt = new movePrompt.movePrompt(viewer);
27 }
28 start(callBack) {
29 var that = this;
30 this.handler.setInputAction(function(evt) { //单机开始绘制
31 var cartesian = that.getCatesian3FromPX(evt.position, that.viewer,[]);
32 that.billboard = that.createBillboard(cartesian);
33 that.state = 1;
34 that.handler.destroy();
35 if (that.prompt) {
36 that.prompt.destroy();
37 that.prompt = null;
38 }
39 if (callBack) callBack(that.billboard);
40 }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
41 this.handler.setInputAction(function(evt) { //单机开始绘制
42 that.prompt.updatePrompt(evt.endPosition, "单击新增");
43 }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
44 }
45 createByPositions(lnglatArr, callBack) {
46 if (!lnglatArr) return;
47 var position = Cesium.Cartesian3.fromDegrees(lnglatArr[0], lnglatArr[1],lnglatArr[2]);
48 if (!position) return;
49 this.billboard = this.createBillboard(position);
50 callBack(this.billboard);
51 this.state = 1;
52 }
53 startModify() {
54 if (this.state != 2 && this.state != 1) return; //表示还没绘制完成
55 if (!this.modifyHandler) this.modifyHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
56 var that = this;
57 this.modifyHandler.setInputAction(function(evt) {
58
59 var pick = that.viewer.scene.pick(evt.position);
60 if (Cesium.defined(pick) && pick.id) {
61 if (!pick.id.objId)
62 that.forbidDrawWorld(true);
63 that.openModify = true;
64 that.forbidDrawWorld(true);
65 that.state = 2;
66 } else {
67 //if(that.modifyPrompt) that.modifyPrompt.destroy();
68 }
69
70 }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
71 this.modifyHandler.setInputAction(function(evt) { //移动时绘制线
72 if (!that.billboard || !that.openModify) return;
73 var cartesian = that.getCatesian3FromPX(evt.endPosition, that.viewer,[]);
74 if (that.billboard) {
75 //that.modifyPrompt.updatePrompt(evt.endPosition, "鼠标拖动修改");
76 that.billboard.position.setValue(cartesian);
77 }
78 }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
79
80 this.modifyHandler.setInputAction(function(evt) { //移动时绘制线
81 if (!that.billboard || !that.openModify) return;
82 that.openModify = false;
83 that.forbidDrawWorld(false);
84 if (that.modifyHandler) {
85 that.modifyHandler.destroy();
86 that.modifyHandler = null;
87 }
88 }, Cesium.ScreenSpaceEventType.LEFT_UP);
89 }
90 endModify(callback) {
91 if (this.modifyHandler) {
92 this.modifyHandler.destroy();
93 this.modifyHandler = null;
94 if (callback) callback(this.billboard);
95 }
96 this.state = 2;
97 }
98 createBillboard(cartesian) {
99 if (!cartesian) return;
100 var billboard = this.viewer.entities.add({
101 position: cartesian,
102 billboard: {
103 image: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABMElEQVRIS+2VO0oEQRCGv38RBdFDGQumgijeQFTMjDUQr6CRsgeQDfQCmoqBZkYeQF0f+Cop6AYfa8/UOGtkw8Aw0/19XVVNlxjyUIlvZlPAGjAn6brJXn4UmNk4cJeeDtAFtiWdR0QlgUNfgDzH35+BU2AT6El6q5JFBB9ZN8ADsAXslNLXVJBlnkKPdB9YkdT/GtFvBZnnqepI+sZrQ+C1GQEWJO21GcEr8AQcAquSLgcVvEkElgp8AixLOiudpKjAi3gBLEk6rjqi/r+uwMFXCXxUB5zn1BHcJ/BuBBwR+B00L6n3L/iUATMbAx7TxxlJB62myGFmtgjMAtOS/PyHR7HhhGkDFvy9wMw2UpscDUTgd5J3u/XKy87MboGJADxP7UuarCMYbgQNdl5c8g7JKYAZpEkyjAAAAABJRU5ErkJggg==',
104 heightReference: this.style.heightReference || Cesium.HeightReference.NONE,
105 disableDepthTestDistance:Number.MAX_VALUE,
106 color: Cesium.Color.RED
107 }
108 })
109 billboard.objId = this.objId;
110 return billboard;
111 }
112 getPositions() {
113 return this.billboard.position;
114 }
115 setStyle(obj) {}
116 remove() {
117 if (this.billboard) {
118 this.state = 0;
119 this.viewer.entities.remove(this.billboard);
120 this.billboard = null;
121 }
122 }
123 setVisible(vis) {
124 this.billboard.show = vis;
125 }
126 forbidDrawWorld(isForbid) {
127 this.viewer.scene.screenSpaceCameraController.enableRotate = !isForbid;
128 this.viewer.scene.screenSpaceCameraController.enableTilt = !isForbid;
129 this.viewer.scene.screenSpaceCameraController.enableTranslate = !isForbid;
130 this.viewer.scene.screenSpaceCameraController.enableInputs = !isForbid;
131 }
132 destroy() {
133 this.openModify = false;
134 if (this.handler) {
135 this.handler.destroy();
136 this.handler = null;
137 }
138 if (this.modifyHandler) {
139 this.modifyHandler.destroy();
140 this.modifyHandler = null;
141 }
142 if (this.billboard) {
143 this.viewer.entities.remove(this.billboard);
144 this.billboard = null;
145 }
146 this.style = null;
147 if (this.prompt) {
148 that.prompt.destroy();
149 this.prompt = null;
150 }
151 }
152 getCatesian3FromPX(px, viewer, entitys) {
153 var picks = viewer.scene.drillPick(px);
154 this.viewer.scene.render();
155 var cartesian;
156 var isOn3dtiles = false;
157 for (var i = 0; i < picks.length; i++) {
158 var isContinue = false;
159 for (var step = 0; step < entitys.length; step++) {
160 if (entitys[step] && picks[i].id && entitys[step].objId == picks[i].id.objId) {
161 isContinue = true;
162 break;
163 }
164 }
165 if (isContinue) continue;
166 if ((picks[i] && picks[i].primitive) || picks[i] instanceof Cesium.Cesium3DTileFeature) { //模型上拾取
167 isOn3dtiles = true;
168 }
169 }
170 if (isOn3dtiles) {
171 cartesian = viewer.scene.pickPosition(px);
172 } else {
173 var ray = viewer.camera.getPickRay(px);
174 if (!ray) return null;
175 cartesian = viewer.scene.globe.pick(ray, viewer.scene);
176 }
177 return cartesian;
178 }
179 }
...\ No newline at end of file ...\ No newline at end of file
1 import movePrompt from './MovePrompt';
2 import addCompany from './addCompany';
3 export default class CreateCircle {
4 constructor(viewer, style) {
5 this.objId = Number((new Date()).getTime() + "" + Number(Math.random() * 1000).toFixed(0));
6 this.viewer = viewer;
7 this.handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
8 this.modifyHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
9 this.circle = null;
10 this.screenSpaceCameraController = [];
11 this.style = style;
12 this.floatPoint = null;
13 this.centerPoint = null;
14 this.center = null;
15 this.float = null;
16 this.radius = 0;
17 this.modifyPoint = null;
18 this.state = 0;
19 this.pointArr = [];
20 this.prompt = new movePrompt.movePrompt(viewer);
21 }
22 start(callBack) {
23 var that = this;
24 this.handler.setInputAction(function (evt) { //单机开始绘制
25 var cartesian = that.getCatesian3FromPX(evt.position, that.viewer, [that.circle]);
26 if (!that.centerPoint) {
27 that.center = cartesian;
28 that.centerPoint = addCompany.createPoint.call(that, {position: cartesian});
29 that.centerPoint.typeAttr = "center";
30 that.floatPoint = addCompany.createPoint.call(that, {position: cartesian.clone()});
31 that.float = cartesian.clone();
32 that.floatPoint.typeAttr = "float";
33 that.circle = addCompany.createCircle.call(that);
34 } else {
35 return;
36 }
37 }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
38 this.handler.setInputAction(function (evt) { //移动时绘制线
39 if (!that.centerPoint) {
40 that.prompt.updatePrompt(evt.endPosition, "单击开始绘制");
41 return;
42 }
43 that.prompt.updatePrompt(evt.endPosition, "右键结束");
44 var cartesian = that.getCatesian3FromPX(evt.endPosition, that.viewer, [that.circle]);
45 if (that.floatPoint) {
46 that.floatPoint.position.setValue(cartesian);
47 that.float = cartesian.clone();
48 }
49 that.radius = Cesium.Cartesian3.distance(cartesian, that.center);
50 }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
51 this.handler.setInputAction(function () { //单机开始绘制
52 if (!that.circle) {
53 return;
54 }
55 that.state = 1;
56 that.handler.destroy();
57 if (that.floatPoint) that.floatPoint.show = false;
58 if (that.centerPoint) that.centerPoint.show = false;
59 if (that.prompt) {
60 that.prompt.destroy();
61 that.prompt = null;
62 }
63 if (callBack) callBack(that.circle);
64 }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
65 }
66 startModify(callback) {
67 if (this.state != 2 && this.state != 1) return; //表示还没绘制完成
68 if (!this.modifyHandler) this.modifyHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
69 var that = this;
70 if (that.floatPoint) that.floatPoint.show = true;
71 if (that.centerPoint) that.centerPoint.show = true;
72 this.modifyHandler.setInputAction(function (evt) {
73 if (!that.circle) return;
74 var pick = that.viewer.scene.pick(evt.position);
75 if (Cesium.defined(pick) && pick.id) {
76 if (!pick.id.objId)
77 that.modifyPoint = pick.id;
78 that.forbidDrawWorld(true);
79 } else {
80 if (that.floatPoint) that.floatPoint.show = false;
81 if (that.centerPoint) that.centerPoint.show = false;
82 if (that.modifyHandler) {
83 that.modifyHandler.destroy();
84 that.modifyHandler = null;
85 if (callback) callback(that.circle);
86 }
87 that.state = 2;
88 }
89 }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
90 this.modifyHandler.setInputAction(function (evt) {
91 if (!that.modifyPoint) return;
92 var cartesian = that.getCatesian3FromPX(evt.endPosition, that.viewer, [that.circle]);
93 if (!cartesian) {
94 return;
95 }
96 if (that.modifyPoint.typeAttr == "center") {
97 that.center = cartesian
98 that.centerPoint.position.setValue(that.center);
99 that.circle.position.setValue(that.center);
100 } else {
101 that.float = cartesian
102 that.floatPoint.position.setValue(that.float);
103 }
104 that.radius = Cesium.Cartesian3.distance(that.float, that.center);
105 }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
106
107 this.modifyHandler.setInputAction(function (evt) {
108 if (!that.modifyPoint) return;
109 that.modifyPoint = null;
110 that.forbidDrawWorld(false);
111 }, Cesium.ScreenSpaceEventType.LEFT_UP);
112 }
113 endModify(callback) {
114 if (this.floatPoint) this.floatPoint.show = false;
115 if (this.centerPoint) this.centerPoint.show = false;
116 if (this.modifyHandler) {
117 this.modifyHandler.destroy();
118 this.modifyHandler = null;
119 if (callback) callback(this.circle);
120 }
121 this.state = 2;
122 }
123 getCenter() {
124 return this.center;
125 }
126 getAttr() {
127 return obj;
128 }
129 setStyle(obj) {}
130 remove() {
131 if (this.circle) {
132 this.state = 0;
133 this.viewer.entities.remove(this.circle);
134 this.circle = null;
135 }
136 }
137 setVisible(vis) {
138 this.circle.show = vis;
139 }
140 forbidDrawWorld(isForbid) {
141 this.viewer.scene.screenSpaceCameraController.enableRotate = !isForbid;
142 this.viewer.scene.screenSpaceCameraController.enableTilt = !isForbid;
143 this.viewer.scene.screenSpaceCameraController.enableTranslate = !isForbid;
144 this.viewer.scene.screenSpaceCameraController.enableInputs = !isForbid;
145 }
146 destroy() {
147 if (this.handler) {
148 this.handler.destroy();
149 this.handler = null;
150 }
151 if (this.modifyHandler) {
152 this.modifyHandler.destroy();
153 this.modifyHandler = null;
154 }
155 if (this.circle) {
156 this.viewer.entities.remove(this.circle);
157 this.circle = null;
158 }
159 if (this.floatPoint) {
160 this.viewer.entities.remove(this.floatPoint);
161 this.floatPoint = null;
162 }
163 if (this.centerPoint) {
164 this.viewer.entities.remove(this.centerPoint);
165 this.centerPoint = null;
166 }
167 this.style = null;
168 this.modifyPoint = null;
169 if (this.prompt) this.prompt.destroy();
170 }
171 getCatesian3FromPX(px, viewer, entitys) {
172 var picks = viewer.scene.drillPick(px);
173 this.viewer.scene.render();
174 var cartesian;
175 var isOn3dtiles = false;
176 for (var i = 0; i < picks.length; i++) {
177 var isContinue = false;
178 for (var step = 0; step < entitys.length; step++) {
179 if (entitys[step] && picks[i].id && entitys[step].objId == picks[i].id.objId) {
180 isContinue = true;
181 break;
182 }
183 }
184 if (isContinue) continue;
185 if ((picks[i] && picks[i].primitive) || picks[i] instanceof Cesium.Cesium3DTileFeature) { //模型上拾取
186 isOn3dtiles = true;
187 }
188 }
189 if (isOn3dtiles) {
190 cartesian = viewer.scene.pickPosition(px);
191 } else {
192 var ray = viewer.camera.getPickRay(px);
193 if (!ray) return null;
194 cartesian = viewer.scene.globe.pick(ray, viewer.scene);
195 }
196 return cartesian;
197 }
198 }
...\ No newline at end of file ...\ No newline at end of file
1 import movePrompt from './MovePrompt';
2 import addCompany from './addCompany';
3 export default class CreatePolyline {
4 constructor(viewer, style) {
5 this.objId = Number((new Date()).getTime() + "" + Number(Math.random() * 1000).toFixed(0));
6 this.viewer = viewer;
7 this.handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
8 this.modifyHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
9 this.polyline = null;
10 this.positions = [];
11 this.style = style;
12 this.floatPoint = null;
13 this.linePointArr = [];
14 this.modifyPoint = null;
15 this.state = 0;
16 //初始化鼠标提示框
17 this.prompt = new movePrompt.movePrompt(viewer);
18 // this.prompt.updatePrompt({x: 495, y: 407}, "单击开始绘制");
19 }
20 start(callBack) {
21 var that = this;
22 this.handler.setInputAction(function (evt) { //单机开始绘制
23 var cartesian = that.getCatesian3FromPX(evt.position, that.viewer, [that.polyline]);
24 if (that.positions.length == 0) {
25 that.positions.push(cartesian.clone());
26 that.floatPoint = addCompany.createPoint.call(that, {position: cartesian.clone()});
27 }
28 that.positions.push(cartesian);
29 var point = addCompany.createPoint.call(that, {position: cartesian});
30 point.wz = that.linePointArr.length;
31 that.linePointArr.push(point);
32 }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
33 this.handler.setInputAction(function (evt) { //移动时绘制线
34 if (that.positions.length < 1) {
35 that.prompt.updatePrompt(evt.endPosition, "单击开始绘制");
36 return;
37 }
38 that.prompt.updatePrompt(evt.endPosition, "单击新增,右键结束");
39 var cartesian = that.getCatesian3FromPX(evt.endPosition, that.viewer, [that.polyline]);
40 if (that.floatPoint) that.floatPoint.position.setValue(cartesian);
41 if (that.positions.length == 2) {
42 if (!Cesium.defined(that.polyline)) {
43 that.polyline = addCompany.createPolyline.call(that);
44 }
45 }
46 if (that.polyline) {
47 that.positions.pop();
48 that.positions.push(cartesian);
49 }
50 }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
51 this.handler.setInputAction(function (evt) { //单机开始绘制
52 if (!that.polyline) {
53 return;
54 }
55 var cartesian = that.getCatesian3FromPX(evt.position, that.viewer, [that.polyline]);
56 that.state = 1;
57 that.handler.destroy();
58 if (that.floatPoint) {
59 if (that.floatPoint) that.floatPoint.show = false;
60 that.floatPoint = null;
61 }
62 that.positions.pop();
63 that.positions.push(cartesian);
64 var point = addCompany.createPoint.call(that, {position: cartesian});
65 point.wz = that.linePointArr.length;
66 that.linePointArr.push(point);
67 if(that.prompt){
68 that.prompt.destroy();
69 that.prompt = null;
70 }
71 if (callBack) callBack(that.polyline);
72 }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
73 }
74 startModify(callback) {
75 if (this.state != 2 && this.state != 1) return; //表示还没绘制完成
76 if (!this.modifyHandler) this.modifyHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
77 var that = this;
78 for (var i = 0; i < that.linePointArr.length; i++) {
79 var point = that.linePointArr[i];
80 if (point) point.show = true;
81 }
82 this.modifyHandler.setInputAction(function (evt) {
83 if(!that.polyline) return ;
84 var pick = that.viewer.scene.pick(evt.position);
85 if (Cesium.defined(pick) && pick.id) {
86 if (!pick.id.objId)
87 that.modifyPoint = pick.id;
88 that.forbidDrawWorld(true);
89 } else {
90 for (var i = 0; i < that.linePointArr.length; i++) {
91 var point = that.linePointArr[i];
92 if (point) point.show = false;
93 }
94 if (that.modifyHandler) {
95 that.modifyHandler.destroy();
96 that.modifyHandler = null;
97 if(callback) callback(that.polyline);
98 }
99 that.state = 2;
100 }
101 }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
102 this.modifyHandler.setInputAction(function (evt) {
103 if (that.positions.length < 1 || !that.modifyPoint) return;
104 //that.modifyPrompt.updatePrompt(evt.endPosition, "鼠标拖动修改");
105 var cartesian = that.getCatesian3FromPX(evt.endPosition, that.viewer, [that.polyline, that.modifyPoint]);
106 if (cartesian) {
107 that.modifyPoint.position.setValue(cartesian);
108 that.positions[that.modifyPoint.wz] = cartesian;
109 }
110 }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
111
112 this.modifyHandler.setInputAction(function (evt) {
113 if (!that.modifyPoint) return;
114 var cartesian = that.getCatesian3FromPX(evt.position, that.viewer, [that.polyline, that.modifyPoint]);
115 that.modifyPoint.position.setValue(cartesian);
116 that.positions[that.modifyPoint.wz] = cartesian;
117 that.modifyPoint = null;
118 that.forbidDrawWorld(false);
119 }, Cesium.ScreenSpaceEventType.LEFT_UP);
120 }
121 endModify(callback) {
122 for (var i = 0; i < this.linePointArr.length; i++) {
123 var point = this.linePointArr[i];
124 if (point) point.show = false;
125 }
126 if (this.modifyHandler) {
127 this.modifyHandler.destroy();
128 this.modifyHandler = null;
129 if(callback) callback(this.polyline);
130 }
131 this.state = 2;
132 }
133 getPositions() {
134 return this.positions;
135 }
136 getAttr() {
137 if (!this.polyline) return;
138 var obj = {};
139 var line = this.polyline.polyline;
140 obj.width = line.width._value;
141 obj.clampToGround = line.clampToGround._value;
142 obj.color = line.material.color._value;
143 obj.lineType = "solid";
144 return obj;
145 }
146 setStyle(obj) {}
147 remove() {
148 if (this.polyline) {
149 this.state = 0;
150 this.viewer.entities.remove(this.polyline);
151 this.polyline = null;
152 }
153 }
154 setVisible(vis) {
155 this.polyline.show = vis;
156 }
157 forbidDrawWorld(isForbid) {
158 this.viewer.scene.screenSpaceCameraController.enableRotate = !isForbid;
159 this.viewer.scene.screenSpaceCameraController.enableTilt = !isForbid;
160 this.viewer.scene.screenSpaceCameraController.enableTranslate = !isForbid;
161 this.viewer.scene.screenSpaceCameraController.enableInputs = !isForbid;
162 }
163 destroy() {
164 this.linePointArr = [];
165 if (this.handler) {
166 this.handler.destroy();
167 this.handler = null;
168 }
169 if (this.modifyHandler) {
170 this.modifyHandler.destroy();
171 this.modifyHandler = null;
172 }
173 if (this.polyline) {
174 this.viewer.entities.remove(this.polyline);
175 this.polyline = null;
176 }
177 if (this.floatPoint) {
178 this.viewer.entities.remove(this.floatPoint);
179 this.floatPoint = null;
180 }
181 this.positions = [];
182 this.style = null;
183 for (var i = 0; i < this.linePointArr.length; i++) {
184 var point = this.linePointArr[i];
185 this.viewer.entities.remove(point);
186 }
187 this.linePointArr = [];
188 this.modifyPoint = null;
189 if (this.prompt) this.prompt.destroy();
190 //if (this.modifyPrompt) this.modifyPrompt.destroy();
191 }
192 getCatesian3FromPX(px, viewer, entitys) {
193 var picks = viewer.scene.drillPick(px);
194 this.viewer.scene.render();
195 var cartesian;
196 var isOn3dtiles = false;
197 for (var i = 0; i < picks.length; i++) {
198 var isContinue = false;
199 for (var step = 0; step < entitys.length; step++) {
200 if (entitys[step] && picks[i].id && entitys[step].objId == picks[i].id.objId) {
201 isContinue = true;
202 break;
203 }
204 }
205 if (isContinue) continue;
206 if ((picks[i] && picks[i].primitive) || picks[i] instanceof Cesium.Cesium3DTileFeature) { //模型上拾取
207 isOn3dtiles = true;
208 }
209 }
210 if (isOn3dtiles) {
211 cartesian = viewer.scene.pickPosition(px);
212 } else {
213 var ray = viewer.camera.getPickRay(px);
214 if (!ray) return null;
215 cartesian = viewer.scene.globe.pick(ray, viewer.scene);
216 }
217 return cartesian;
218 }
219 }
...\ No newline at end of file ...\ No newline at end of file
1 import movePrompt from './MovePrompt';
2 import addCompany from './addCompany';
3 export default class CreateRectangle {
4 constructor(viewer, style) {
5 this.objId = Number((new Date()).getTime() + "" + Number(Math.random() * 1000).toFixed(0));
6 this.viewer = viewer;
7 this.handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
8 this.modifyHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
9 this.rectangle = null;
10 this.screenSpaceCameraController = [];
11 this.style = style;
12 this.rightdownPoint = null;
13 this.leftupPoint = null;
14 this.leftup = null;
15 this.rightdown = null;
16 this.radius = 0;
17 this.modifyPoint = null;
18 this.state = 0;
19 this.pointArr = [];
20 this.prompt = new movePrompt.movePrompt(viewer);
21 }
22 start(callBack) {
23 var that = this;
24 this.handler.setInputAction(function (evt) { //单机开始绘制
25 var cartesian = that.getCatesian3FromPX(evt.position, that.viewer, []);
26 if (!that.leftupPoint) {
27 that.leftup = cartesian;
28 that.leftupPoint = addCompany.createPoint.call(that, {position: cartesian});
29 that.leftupPoint.typeAttr = "leftup";
30 that.rightdownPoint = addCompany.createPoint.call(that, {position: cartesian.clone()});
31 that.rightdown = cartesian.clone();
32 that.rightdownPoint.typeAttr = "rightdown";
33 that.rectangle = addCompany.createRectangle.call(that);
34 } else {
35 return;
36 }
37 }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
38 this.handler.setInputAction(function (evt) { //移动时绘制线
39 if (!that.leftupPoint) {
40 that.prompt.updatePrompt(evt.endPosition, "单击开始绘制");
41 return;
42 }
43 that.prompt.updatePrompt(evt.endPosition, "右键结束");
44 var cartesian = that.getCatesian3FromPX(evt.endPosition, that.viewer, []);
45 if (that.rightdownPoint) {
46 that.rightdownPoint.position.setValue(cartesian);
47 that.rightdown = cartesian.clone();
48 }
49 that.radius = Cesium.Cartesian3.distance(cartesian, that.leftup);
50 }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
51 this.handler.setInputAction(function () { //单机开始绘制
52 if (!that.rectangle) {
53 return;
54 }
55 that.state = 1;
56 that.handler.destroy();
57 if (that.rightdownPoint) that.rightdownPoint.show = false;
58 if (that.leftupPoint) that.leftupPoint.show = false;
59 if (that.prompt) {
60 that.prompt.destroy();
61 that.prompt = null;
62 }
63 if (callBack) callBack(that.rectangle);
64 }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
65 }
66 startModify(callback) {
67 if (this.state != 2 && this.state != 1) return; //表示还没绘制完成
68 if (!this.modifyHandler) this.modifyHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
69 var that = this;
70 if (that.rightdownPoint) that.rightdownPoint.show = true;
71 if (that.leftupPoint) that.leftupPoint.show = true;
72 this.modifyHandler.setInputAction(function (evt) {
73 if (!that.rectangle) return;
74 var pick = that.viewer.scene.pick(evt.position);
75 if (Cesium.defined(pick) && pick.id) {
76 if (!pick.id.objId)
77 that.modifyPoint = pick.id;
78 that.forbidDrawWorld(true);
79 } else {
80 if (that.rightdownPoint) that.rightdownPoint.show = false;
81 if (that.leftupPoint) that.leftupPoint.show = false;
82 if (that.modifyHandler) {
83 that.modifyHandler.destroy();
84 that.modifyHandler = null;
85 if (callback) callback(that.rectangle);
86 }
87 that.state = 2;
88 }
89 }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
90 this.modifyHandler.setInputAction(function (evt) {
91 if (!that.modifyPoint) return;
92 var cartesian = that.getCatesian3FromPX(evt.endPosition, that.viewer, [that.rectangle, that.modifyPoint]);
93 if (!cartesian) {
94 return;
95 }
96 if (that.modifyPoint.typeAttr == "leftup") {
97 that.leftup = cartesian
98 that.leftupPoint.position.setValue(that.leftup);
99 that.rectangle.position.setValue(that.leftup);
100 } else {
101 that.rightdown = cartesian
102 that.rightdownPoint.position.setValue(that.rightdown);
103 }
104 that.radius = Cesium.Cartesian3.distance(that.rightdown, that.leftup);
105 }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
106
107 this.modifyHandler.setInputAction(function (evt) {
108 if (!that.modifyPoint) return;
109 that.modifyPoint = null;
110 that.forbidDrawWorld(false);
111 }, Cesium.ScreenSpaceEventType.LEFT_UP);
112 }
113 endModify(callback) {
114 if (this.rightdownPoint) this.rightdownPoint.show = false;
115 if (this.leftupPoint) this.leftupPoint.show = false;
116 if (this.modifyHandler) {
117 this.modifyHandler.destroy();
118 this.modifyHandler = null;
119 if (callback) callback(this.rectangle);
120 }
121 this.state = 2;
122 }
123 getPositions() {
124 return [this.leftup, this.rightdown]
125 }
126 getAttr() {
127 return obj;
128 }
129 setStyle(obj) {}
130 remove() {
131 if (this.rectangle) {
132 this.state = 0;
133 this.viewer.entities.remove(this.rectangle);
134 this.rectangle = null;
135 }
136 }
137 setVisible(vis) {
138 this.rectangle.show = vis;
139 }
140 forbidDrawWorld(isForbid) {
141 this.viewer.scene.screenSpaceCameraController.enableRotate = !isForbid;
142 this.viewer.scene.screenSpaceCameraController.enableTilt = !isForbid;
143 this.viewer.scene.screenSpaceCameraController.enableTranslate = !isForbid;
144 this.viewer.scene.screenSpaceCameraController.enableInputs = !isForbid;
145 }
146 destroy() {
147 if (this.handler) {
148 this.handler.destroy();
149 this.handler = null;
150 }
151 if (this.modifyHandler) {
152 this.modifyHandler.destroy();
153 this.modifyHandler = null;
154 }
155 if (this.rectangle) {
156 this.viewer.entities.remove(this.rectangle);
157 this.rectangle = null;
158 }
159 if (this.rightdownPoint) {
160 this.viewer.entities.remove(this.rightdownPoint);
161 this.rightdownPoint = null;
162 }
163 if (this.leftupPoint) {
164 this.viewer.entities.remove(this.leftupPoint);
165 this.leftupPoint = null;
166 }
167 this.style = null;
168 this.modifyPoint = null;
169 if (this.prompt) this.prompt.destroy();
170 }
171 getCatesian3FromPX(px, viewer, entitys) {
172 var picks = viewer.scene.drillPick(px);
173 this.viewer.scene.render();
174 var cartesian;
175 var isOn3dtiles = false;
176 for (var i = 0; i < picks.length; i++) {
177 var isContinue = false;
178 for (var step = 0; step < entitys.length; step++) {
179 if (entitys[step] && picks[i].id && entitys[step].objId == picks[i].id.objId) {
180 isContinue = true;
181 break;
182 }
183 }
184 if (isContinue) continue;
185 if ((picks[i] && picks[i].primitive) || picks[i] instanceof Cesium.Cesium3DTileFeature) { //模型上拾取
186 isOn3dtiles = true;
187 }
188 }
189 if (isOn3dtiles) {
190 cartesian = viewer.scene.pickPosition(px);
191 } else {
192 var ray = viewer.camera.getPickRay(px);
193 if (!ray) return null;
194 cartesian = viewer.scene.globe.pick(ray, viewer.scene);
195 }
196 return cartesian;
197 }
198 }
...\ No newline at end of file ...\ No newline at end of file
1 import createBillboard from './createBillboard';
2 import createPolyline from './createPolyline';
3 import createPolygon from './createPolygon';
4 import createCircle from './createCircle';
5 import createRectangle from './createRectangle';
6 export default {
7 drawTool: class DrawTool {
8 constructor(obj) {
9 if (!obj.viewer || !obj) {
10 console.warn("缺少必要参数!--viewer");
11 return;
12 }
13 this.viewer = obj.viewer;
14 this.hasEdit = obj.hasEdit;
15 this.toolArr = [];
16 this.handler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
17 this.show = obj.drawEndShow;
18 // this.lastSelectEntity = null;
19 }
20 startDraw(opt) {
21 var that = this;
22 if (opt.type == "polyline") {
23 var polyline = new createPolyline(this.viewer, opt.style);
24 polyline.start(function (evt) {
25 if (that.hasEdit) {
26 that.unbindEdit();
27 polyline.startModify(opt.modifySuccess);
28 that.lastSelectEntity = polyline;
29 }
30 if (opt.success) opt.success(evt);
31 if (that.show == false) polyline.setVisible(false);
32 });
33 this.toolArr.push(polyline);
34 }
35 if (opt.type == "polygon") {
36 var polygon = new createPolygon(this.viewer, opt.style);
37 polygon.start(function () {
38 if (that.hasEdit) {
39 that.unbindEdit();
40 polygon.startModify();
41 that.lastSelectEntity = polygon;
42 }
43 if (opt.success) opt.success(polygon);
44 if (that.show == false) polygon.setVisible(false);
45 });
46 this.toolArr.push(polygon);
47 }
48 if (opt.type == "billboard") {
49 var billboard = new createBillboard(this.viewer, opt.style);
50 billboard.start(function () {
51 if (that.hasEdit) {
52 that.unbindEdit();
53 billboard.startModify();
54 that.lastSelectEntity = billboard;
55 }
56 if (opt.success) opt.success(billboard);
57 if (that.show == false) billboard.setVisible(false);
58 });
59 this.toolArr.push(billboard);
60 }
61 if (opt.type == "circle") {
62 var circle = new createCircle(this.viewer, opt.style);
63 circle.start(function () {
64 if (that.hasEdit) {
65 that.unbindEdit();
66 circle.startModify();
67 that.lastSelectEntity = circle;
68 }
69 if (opt.success) opt.success(circle);
70 if (that.show == false) circle.setVisible(false);
71 });
72 this.toolArr.push(circle);
73 }
74 if (opt.type == "rectangle") {
75 var rectangle = new createRectangle(this.viewer, opt.style);
76 rectangle.start(function () {
77 if (that.hasEdit) {
78 that.unbindEdit();
79 rectangle.startModify();
80 that.lastSelectEntity = rectangle;
81 }
82 if (opt.success) opt.success(rectangle);
83 if (that.show == false) rectangle.setVisible(false);
84 });
85 this.toolArr.push(rectangle);
86 }
87 //重写材质
88 if (opt.type == "flowPolyline") {
89 var polyline = new CreatePolyline(this.viewer, opt.style);
90 polyline.start(function () {
91 if (that.hasEdit) {
92 that.unbindEdit();
93 polyline.startModify();
94 }
95 if (opt.success) opt.success(polyline);
96 });
97 this.toolArr.push(polyline);
98 }
99 }
100 createByPositions(opt) {
101 if (this.hasEdit) {
102 this.bindEdit();
103 }
104 if (!opt) opt = {};
105 if (opt.type == "polyline") {
106 var polyline = new CreatePolyline(this.viewer, opt.style);
107 polyline.createByPositions(opt.positions, opt.success);
108 this.toolArr.push(polyline);
109 }
110 if (opt.type == "polygon") {
111 var polygon = new CreatePolygon(this.viewer, opt.style);
112 polygon.createByPositions(opt.positions, opt.success);
113 this.toolArr.push(polygon);
114 }
115 if (opt.type == "billboard") {
116 var billboard = new CreateBillboard(this.viewer, opt.style);
117 billboard.createByPositions(opt.positions, function(){
118 if(opt.success) opt.success(billboard)
119 });
120 this.toolArr.push(billboard);
121 }
122 }
123 destroy() {
124 for (var i = 0; i < this.toolArr.length; i++) {
125 var obj = this.toolArr[i];
126 obj.destroy();
127 }
128 }
129 bindEdit() {
130 var that = this;
131 this.handler.setInputAction(function (evt) { //单机开始绘制
132 var pick = that.viewer.scene.pick(evt.position);
133 if (Cesium.defined(pick) && pick.id) {
134 for (var i = 0; i < that.toolArr.length; i++) {
135 if (pick.id.objId == that.toolArr[i].objId && (that.toolArr[i].state == 1||that.toolArr[i].state == 2)) {
136 if (that.lastSelectEntity) {
137 that.lastSelectEntity.endModify();
138 }
139 that.toolArr[i].startModify();
140 that.lastSelectEntity = that.toolArr[i];
141 break;
142 }
143 }
144 }
145 }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
146 }
147 unbindEdit() {
148 for (var i = 0; i < this.toolArr.length; i++) {
149 this.toolArr[i].endModify();
150 }
151 }
152 getCatesian3FromPX(px, viewer, entitys) {
153 var picks = viewer.scene.drillPick(px);
154 this.viewer.scene.render();
155 var cartesian;
156 var isOn3dtiles = false;
157 for (var i = 0; i < picks.length; i++) {
158 var isContinue = false;
159 for (var step = 0; step < entitys.length; step++) {
160 if (entitys[step] && picks[i].id && entitys[step].objId == picks[i].id.objId) {
161 isContinue = true;
162 break;
163 }
164 }
165 if (isContinue) continue;
166 if ((picks[i] && picks[i].primitive) || picks[i] instanceof Cesium.Cesium3DTileFeature) { //模型上拾取
167 isOn3dtiles = true;
168 }
169 }
170 if (isOn3dtiles) {
171 cartesian = viewer.scene.pickPosition(px);
172 } else {
173 var ray = viewer.camera.getPickRay(px);
174 if (!ray) return null;
175 cartesian = viewer.scene.globe.pick(ray, viewer.scene);
176 }
177 return cartesian;
178 }
179 }
180 }
...\ No newline at end of file ...\ No newline at end of file
1 export default
2 class Roller {
3 constructor(obj) {
4 this.imageryLayers = obj.imageryLayers;
5 this.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({
6 url: obj.url,
7 layer: "tdtBasicLayer",
8 style: "default",
9 format: "image/jpeg",
10 tileMatrixSetID: "GoogleMapsCompatible",
11 show: false
12 })).splitDirection = Cesium.ImagerySplitDirection.LEFT;
13 }
14 screen(opt) {
15 var slider = opt.slider, handler = new Cesium.ScreenSpaceEventHandler(slider), moveActive = false;
16 function move(movement) {
17 if (!moveActive) return;
18 var relativeOffset = movement.endPosition.x;
19 var splitPosition =
20 (slider.offsetLeft + relativeOffset) /
21 slider.parentElement.offsetWidth;
22 slider.style.left = 100.0 * splitPosition + "%";
23 opt.viewer.scene.imagerySplitPosition = splitPosition;
24 }
25
26 handler.setInputAction(function () {
27 moveActive = true;
28 }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
29 handler.setInputAction(function () {
30 moveActive = true;
31 }, Cesium.ScreenSpaceEventType.PINCH_START);
32
33 handler.setInputAction(move, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
34 handler.setInputAction(move, Cesium.ScreenSpaceEventType.PINCH_MOVE);
35
36 handler.setInputAction(function () {
37 moveActive = false;
38 }, Cesium.ScreenSpaceEventType.LEFT_UP);
39 handler.setInputAction(function () {
40 moveActive = false;
41 }, Cesium.ScreenSpaceEventType.PINCH_END);
42 }
43 }
...\ No newline at end of file ...\ No newline at end of file