Skip to content

Commit 80e2f6f

Browse files
committed
【杨琨】【二三维联动】
1 parent f804c9a commit 80e2f6f

12 files changed

Lines changed: 181 additions & 81 deletions

File tree

src/mapboxgl/overlay/FabricLayer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class FabricLayer {
2828
this.mapContainer.appendChild(this.canvas);
2929

3030
this.m_fabricCanvas = this._createFabricCanvas(this.canvas, fabricClass, m_fabricOptions);
31+
this.m_fabricCanvas.setMap(this.map)
3132
// this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
3233

3334
this.bindEvent();
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* @class: Module:2DPlot.PlotCanvas
2+
* @class: Module:2DPlot.PlotLayer2D
33
* @Description: 二维图层类
44
* @Author: zk
55
* @Date: 2022-05-13 10:34:57
@@ -13,7 +13,7 @@ import { createGuid } from '../PlotUtilBase/Util/Guid';
1313
import SymbolManager from '../PlotBase/SymbolManager/SymbolManager';
1414
import FabricLineUtil from './EditTool/FabricLineUtil';
1515

16-
export default class PlotCanvas {
16+
export default class PlotLayer2D {
1717
constructor() {
1818
// 标绘对象
1919
this.m_plotObjects = [];
@@ -29,7 +29,7 @@ export default class PlotCanvas {
2929
}
3030

3131
/**
32-
* @function: Module:PlotCanvas.prototype.bindFabricCanvas
32+
* @function: Module:PlotLayer2D.prototype.bindFabricCanvas
3333
* @description: 添加fabric canvas
3434
* @param {*} fabricCanvas
3535
* @return {*}
@@ -41,7 +41,7 @@ export default class PlotCanvas {
4141
}
4242

4343
/**
44-
* @function: Module:PlotCanvas.prototype.removeFabricCanvas
44+
* @function: Module:PlotLayer2D.prototype.removeFabricCanvas
4545
* @description: 移除fabric canvas
4646
*/
4747
removeFabricCanvas() {
@@ -51,7 +51,7 @@ export default class PlotCanvas {
5151
}
5252

5353
/**
54-
* @function: Module:PlotCanvas.prototype.bindEvent
54+
* @function: Module:PlotLayer2D.prototype.bindEvent
5555
* @description: 绑定事件
5656
* @param {*} fabricCanvas
5757
*/
@@ -60,7 +60,7 @@ export default class PlotCanvas {
6060
fabricCanvas.on('object:modified', this._objectModifiedEventAction);
6161
}
6262
/**
63-
* @function: Module:PlotCanvas.prototype.removeEvent
63+
* @function: Module:PlotLayer2D.prototype.removeEvent
6464
* @description: 移除事件
6565
*/
6666
removeEvent() {
@@ -90,7 +90,7 @@ export default class PlotCanvas {
9090
}
9191
}
9292
/**
93-
* @function: Module:PlotCanvas.prototype.on
93+
* @function: Module:PlotLayer2D.prototype.on
9494
* @description: 监听事件
9595
* @param {String} eventName 事件名,参考fabricjs Canvas类事件
9696
* @param {Function} handler 绑定函数
@@ -100,7 +100,7 @@ export default class PlotCanvas {
100100
this._fabricCanvas.on(eventName, handler);
101101
}
102102
/**
103-
* @function: Module:PlotCanvas.prototype.off
103+
* @function: Module:PlotLayer2D.prototype.off
104104
* @description: 移除监听事件
105105
* @param {String} eventName 事件名
106106
* @return {*}
@@ -113,7 +113,7 @@ export default class PlotCanvas {
113113
});
114114
}
115115
/**
116-
* @function: Module:PlotCanvas.prototype._createHandler
116+
* @function: Module:PlotLayer2D.prototype._createHandler
117117
* @description: 监听函数包装
118118
* @param {*} handler
119119
* @return {*}
@@ -128,7 +128,7 @@ export default class PlotCanvas {
128128
};
129129
}
130130
/**
131-
* @function: Module:PlotCanvas.prototype.setCoordSys
131+
* @function: Module:PlotLayer2D.prototype.setCoordSys
132132
* @description: 设置坐标参数对象
133133
* @param {*} coordSys
134134
*/
@@ -137,15 +137,15 @@ export default class PlotCanvas {
137137
}
138138

139139
/**
140-
* @function: Module:PlotCanvas.prototype.getCoordSys
140+
* @function: Module:PlotLayer2D.prototype.getCoordSys
141141
* @description: 获取坐标参数独享
142142
*/
143143
getCoordSys() {
144144
return this.m_CoordSys;
145145
}
146146

147147
/**
148-
* @function: Module:PlotCanvas.prototype.addPlotObjectBy3DPlotObj
148+
* @function: Module:PlotLayer2D.prototype.addPlotObjectBy3DPlotObj
149149
* @description: 根据三维对象添加二维对象
150150
* @param {*} plotObj3D
151151
* @return {*}
@@ -163,7 +163,7 @@ export default class PlotCanvas {
163163
return plotObj;
164164
}
165165
/**
166-
* @function: Module:PlotCanvas.prototype.add
166+
* @function: Module:PlotLayer2D.prototype.add
167167
* @description: 添加标绘对象
168168
* @param {Object} plotObj
169169
* @return {*}
@@ -175,7 +175,7 @@ export default class PlotCanvas {
175175
}
176176
}
177177
/**
178-
* @function: Module:PlotCanvas.prototype.remove
178+
* @function: Module:PlotLayer2D.prototype.remove
179179
* @description: 删除标绘对象
180180
* @param {Object} plotObj
181181
* @return {*}
@@ -190,7 +190,7 @@ export default class PlotCanvas {
190190
}
191191
}
192192
/**
193-
* @function: Module:PlotCanvas.prototype.removeById
193+
* @function: Module:PlotLayer2D.prototype.removeById
194194
* @description: 通过要素id移除
195195
* @param {String} id
196196
* @return {*}
@@ -200,7 +200,7 @@ export default class PlotCanvas {
200200
this.remove(plotObject);
201201
}
202202
/**
203-
* @function: Module:PlotCanvas.prototype.getPlotObjectById
203+
* @function: Module:PlotLayer2D.prototype.getPlotObjectById
204204
* @description: 根据要素id获取要素对象
205205
* @param {*} uid
206206
* @return {*}
@@ -217,7 +217,7 @@ export default class PlotCanvas {
217217
}
218218

219219
/**
220-
* @function: Module:PlotCanvas.prototype.toGeoJSON
220+
* @function: Module:PlotLayer2D.prototype.toGeoJSON
221221
* @description: 导出geosjon对象
222222
*/
223223
toGeoJSON() {
@@ -234,7 +234,7 @@ export default class PlotCanvas {
234234
}
235235

236236
/**
237-
* @function: Module:PlotCanvas.prototype.fromGeoJSON
237+
* @function: Module:PlotLayer2D.prototype.fromGeoJSON
238238
* @description: 加载geojson对象
239239
* @param {Object} geoJson geojson对象
240240
* @return {*}
@@ -252,7 +252,7 @@ export default class PlotCanvas {
252252
}
253253

254254
/**
255-
* @function: Module:PlotCanvas.prototype.addGeoJSONObject
255+
* @function: Module:PlotLayer2D.prototype.addGeoJSONObject
256256
* @description: 根据geojson子节点添加要素
257257
* @param {*} geoFeature geojson collection子节点
258258
*/
@@ -275,7 +275,7 @@ export default class PlotCanvas {
275275
}
276276

277277
/**
278-
* @function: Module:PlotCanvas.prototype.setFabricCanvas
278+
* @function: Module:PlotLayer2D.prototype.setFabricCanvas
279279
* @description: 设置fabricCanvas
280280
* @param {Object} fabricCanvas
281281
* @return {*}
@@ -284,31 +284,31 @@ export default class PlotCanvas {
284284
this._fabricCanvas = fabricCanvas;
285285
}
286286
/**
287-
* @function: Module:PlotCanvas.prototype.getFabricCanvas
287+
* @function: Module:PlotLayer2D.prototype.getFabricCanvas
288288
* @description: 获取fabricCanvas
289289
*/
290290
getFabricCanvas() {
291291
return this._fabricCanvas;
292292
}
293293

294294
/**
295-
* @function: Module:PlotCanvas.prototype.getPlotObjects
295+
* @function: Module:PlotLayer2D.prototype.getPlotObjects
296296
* @description: 获取标绘对象列表
297297
* @return {Array<Object>}
298298
*/
299299
getPlotObjects() {
300300
return this.m_plotObjects;
301301
}
302302
/**
303-
* @function: Module:PlotCanvas.prototype.getLayerId
303+
* @function: Module:PlotLayer2D.prototype.getLayerId
304304
* @description: 获取图层Id
305305
* @return {String}
306306
*/
307307
getLayerId() {
308308
return this._layerId;
309309
}
310310
/**
311-
* @function: Module:PlotCanvas.prototype.setVisible
311+
* @function: Module:PlotLayer2D.prototype.setVisible
312312
* @description: 设置图层可见性
313313
* @param {Boolean} flag
314314
*/
@@ -327,7 +327,7 @@ export default class PlotCanvas {
327327
}
328328

329329
/**
330-
* @function: Module:PlotCanvas.prototype.queryPlotByLatLng
330+
* @function: Module:PlotLayer2D.prototype.queryPlotByLatLng
331331
* @description: 点选标绘对象
332332
* @param {{lng:number,lat:number}|[number,number]} latlng
333333
* @return {*}
@@ -339,7 +339,7 @@ export default class PlotCanvas {
339339
}
340340

341341
/**
342-
* @function: Module:PlotCanvas.prototype.queryPlotByPoint
342+
* @function: Module:PlotLayer2D.prototype.queryPlotByPoint
343343
* @description: 点选标绘对象
344344
* @param {{ x: number; y: number; } | [number,number]} point
345345
* @return {null | Object} 标绘对象
@@ -358,7 +358,7 @@ export default class PlotCanvas {
358358
}
359359

360360
/**
361-
* @function: Module:PlotCanvas.prototype.queryPlotsByLatlngBounds
361+
* @function: Module:PlotLayer2D.prototype.queryPlotsByLatlngBounds
362362
* @description: 矩阵选查询
363363
* @param {{ left: number; right: number; bottom: number; top: number; }} bounds
364364
* @return {*}
@@ -372,7 +372,7 @@ export default class PlotCanvas {
372372
return this.queryPlotsByBounds({ left: leftBottom[0], top: leftBottom[1], bottom: rightTop[1], right: rightTop[0] });
373373
}
374374
/**
375-
* @function: Module:PlotCanvas.prototype.queryPlotsByBounds
375+
* @function: Module:PlotLayer2D.prototype.queryPlotsByBounds
376376
* @description: 矩阵选查询
377377
* @param {{ left: number; right: number; bottom: number; top: number; }} bounds
378378
* @return {*}
@@ -415,7 +415,7 @@ export default class PlotCanvas {
415415

416416

417417
/**
418-
* @function: Module:PlotCanvas.prototype.requestRenderAll
418+
* @function: Module:PlotLayer2D.prototype.requestRenderAll
419419
* @description: 请求渲染
420420
*/
421421
requestRenderAll() {

0 commit comments

Comments
 (0)