Skip to content

Commit a3a3bb9

Browse files
committed
【杨琨】【添加注释】
1 parent dfa2ec0 commit a3a3bb9

File tree

6 files changed

+145
-61
lines changed

6 files changed

+145
-61
lines changed

src/service/3DPlot/PlotLayer3D.js

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ class PlotLayer3D extends Observable {
6464
}
6565

6666
/**
67-
* @function module:PlotLayer3D.addPlot
67+
* @function module:3DPlot.PlotLayer3D.addPlot
6868
* @description 添加标绘图元
69+
* @public
70+
*
6971
* @param plot - {Plot} 必选项,要添加的标绘图元
7072
*/
7173
addPlot(plot) {
@@ -74,6 +76,12 @@ class PlotLayer3D extends Observable {
7476
return plot;
7577
}
7678

79+
/**
80+
* @description 获取scene对象
81+
* @private
82+
*
83+
* @return {Object} scene scene对象
84+
*/
7785
_getScene() {
7886
let {scene} = this._viewer;
7987
if (!scene) throw new Error("三维场景scene 未初始化");
@@ -82,8 +90,10 @@ class PlotLayer3D extends Observable {
8290
}
8391

8492
/**
85-
* @function module:PlotLayer3D.removePlotByID
93+
* @function module:3DPlot.PlotLayer3D.removePlotByID
8694
* @description 根据标绘图元ID删除标绘图元
95+
* @public
96+
*
8797
* @param id - {String} 必选项,要删除的标绘图元ID
8898
* @return {Object} json,被删除的标绘图元
8999
*/
@@ -93,8 +103,10 @@ class PlotLayer3D extends Observable {
93103
}
94104

95105
/**
96-
* @function module:PlotLayer3D.removePlotByID
106+
* @function module:3DPlot.PlotLayer3D.removePlotByID
97107
* @description 删除标绘图元
108+
* @public
109+
*
98110
* @param plot - {Plot} 必选项,要删除的标绘图元
99111
* @return {Object} json
100112
*/
@@ -107,8 +119,10 @@ class PlotLayer3D extends Observable {
107119
}
108120

109121
/**
110-
* @function module:PlotLayer3D.getPlotByID
122+
* @function module:3DPlot.PlotLayer3D.getPlotByID
111123
* @description 根据标绘图元ID获取标绘图元
124+
* @public
125+
*
112126
* @param id - {String} 必选项,标绘图元ID
113127
* @return {Object} json,没找到返回undefined
114128
*/
@@ -172,7 +186,9 @@ class PlotLayer3D extends Observable {
172186
}
173187

174188
/**
175-
* @function module:PlotLayer3D.removeAll
189+
* @function module:3DPlot.PlotLayer3D.removeAll
190+
* @public
191+
*
176192
* @description 移除图层下的所有标绘图元
177193
*/
178194
removeAll() {
@@ -181,8 +197,10 @@ class PlotLayer3D extends Observable {
181197
}
182198

183199
/**
184-
* @function module:PlotLayer3D.toJSON
200+
* @function module:3DPlot.PlotLayer3D.toJSON
185201
* @description 导出图层数据
202+
* @public
203+
*
186204
* @return {Object} json
187205
*/
188206
toJSON() {
@@ -204,8 +222,10 @@ class PlotLayer3D extends Observable {
204222
}
205223

206224
/**
207-
* @function module:PlotLayer3D.fromJSON
225+
* @function module:3DPlot.PlotLayer3D.fromJSON
208226
* @description 导入图层数据
227+
* @public
228+
*
209229
* @param geoJson - {Object} 必选项,标绘图元ID
210230
*/
211231
fromJSON(geoJson) {
@@ -220,6 +240,12 @@ class PlotLayer3D extends Observable {
220240
}
221241
}
222242

243+
/**
244+
* @description 添加单个json数据图元
245+
* @private
246+
*
247+
* @param geoFeature - {Object} json数据
248+
*/
223249
_addGeoJSONObject(geoFeature) {
224250
let that = this;
225251
const id = geoFeature.properties.symbolId;
@@ -241,13 +267,19 @@ class PlotLayer3D extends Observable {
241267
});
242268
}
243269

270+
/**
271+
* @description 添加单个Primitive数据
272+
* @private
273+
*
274+
* @param primitive - {Object} primitive数据
275+
*/
244276
_addPrimitive(primitive) {
245277
this._primitiveCollection.add(primitive);
246278
return primitive;
247279
}
248280

249281
/**
250-
* @function module:PlotLayer3D.getSnapshot
282+
* @function module:3DPlot.PlotLayer3D.getSnapshot
251283
* @description 获取屏幕快照
252284
*/
253285
getSnapshot() {
@@ -264,7 +296,7 @@ class PlotLayer3D extends Observable {
264296
}
265297

266298
/**
267-
* @function module:PlotLayer3D.queryByGeometry
299+
* @function module:3DPlot.PlotLayer3D.queryByGeometry
268300
* @description 标绘图元几何查询接口
269301
*
270302
* @param geometry {Object} 查询几何,经纬度组成的点或点数组
@@ -301,6 +333,13 @@ class PlotLayer3D extends Observable {
301333
return plots;
302334
}
303335

336+
/**
337+
* @function module:3DPlot.PlotLayer3D.addPrimitiveBy2DPlotObj
338+
* @description 把一个二维标绘图元添加入三维标绘图层中
339+
* @public
340+
*
341+
* @return {Object} primitive 三维标绘图元
342+
*/
304343
addPrimitiveBy2DPlotObj(plotObj2D) {
305344
const element = plotObj2D.getElement();
306345

@@ -314,20 +353,6 @@ class PlotLayer3D extends Observable {
314353
return primitive;
315354
}
316355

317-
_mercatorTolonlat(mercator) {
318-
let lonlat = {lon: 0, lat: 0};
319-
320-
let x = mercator.x / 20037508.34 * 180;
321-
let y = mercator.y / 20037508.34 * 180;
322-
323-
y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2);
324-
325-
lonlat.lon = x;
326-
lonlat.lat = y;
327-
328-
return lonlat;
329-
};
330-
331356
/**
332357
* @description 标绘图元拾取事件,绘制中途不会触发该事件,只有绘制图元结束才会触发
333358
* @private

src/service/3DPlot/PlotLayer3DGroup.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PlotLayer3DGroup {
2424
}
2525

2626
/**
27-
* @function module:3DPlot.addLayer
27+
* @function module:3DPlot.PlotLayer3DGroup.addLayer
2828
* @description 添加图层至图层组
2929
* @param layer - {PlotLayer} 必选项,要添加图层。
3030
*/
@@ -33,7 +33,7 @@ class PlotLayer3DGroup {
3333
}
3434

3535
/**
36-
* @function module:3DPlot.removeLayer
36+
* @function module:3DPlot.PlotLayer3DGroup.removeLayer
3737
* @description 从图层组删除图层
3838
* @param layer - {PlotLayer} 必选项,要删除的图层。
3939
*/
@@ -47,7 +47,7 @@ class PlotLayer3DGroup {
4747
}
4848

4949
/**
50-
* @function module:3DPlot.removeLayerById
50+
* @function module:3DPlot.PlotLayer3DGroup.removeLayerById
5151
* @description 根据图层ID从图层组删除图层
5252
* @param id - {String} 必选项,要删除的图层ID。
5353
*/
@@ -61,7 +61,7 @@ class PlotLayer3DGroup {
6161
}
6262

6363
/**
64-
* @function module:3DPlot.raise
64+
* @function module:3DPlot.PlotLayer3DGroup.raise
6565
* @description 图层上移,请确保图层加载完毕,再改变图层顺序
6666
* @param layer - {Object} 必选项,要上移的图层
6767
*/
@@ -70,14 +70,21 @@ class PlotLayer3DGroup {
7070
}
7171

7272
/**
73-
* @function module:3DPlot.raise
73+
* @function module:3DPlot.PlotLayer3DGroup.raise
7474
* @description 图层下移,请确保图层加载完毕,再改变图层顺序
7575
* @param layer - {Object} 必选项,要下移的图层
7676
*/
7777
lower(layer) {
7878
this._move(layer, "lower");
7979
}
8080

81+
/**
82+
* @description 移动图层方法
83+
* @private
84+
*
85+
* @param layer - {Object} 必选项,要移动的图层
86+
* @param type - {String} 必选项,方向,向上或向下
87+
*/
8188
_move(layer, type) {
8289
let index, isFind = false;
8390
for (let i = 0; i < this._plotLayerMap.length; i++) {
@@ -165,13 +172,26 @@ class PlotLayer3DGroup {
165172
}
166173
}
167174

175+
/**
176+
* @description 获取scene对象
177+
* @private
178+
*
179+
* @return {Object} scene scene对象
180+
*/
168181
_getScene() {
169182
let {scene} = this._viewer;
170183
if (!scene) throw new Error("三维场景scene 未初始化");
171184

172185
return scene;
173186
}
174187

188+
/**
189+
* @description 获取标绘图元在内部标绘列表里的index
190+
* @private
191+
*
192+
* @param {String} id 图元id
193+
* @return {Number} index 标绘图元的index
194+
*/
175195
_getPrimitiveIndexById(id) {
176196
let scene = this._getScene(), index = undefined;
177197

@@ -205,7 +225,7 @@ class PlotLayer3DGroup {
205225
this._utilPlotCanvas.removePlot(plotObject)
206226
}
207227
/**
208-
* @function: Module:PlotLayer2DGroup.prototype.getPlotObjectById
228+
* @function: Module:3DPlot.PlotLayer3DGroup.getPlotObjectById
209229
* @description: 根据要素id获取要素对象
210230
* @param {String} uid
211231
* @return {*}

src/service/3DPlot/Primitive/RegularPrimitive/SimpleAreaPrimitive.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ class SimpleAreaPrimitive extends KidneyAreaPrimitive {
6868
});
6969
}
7070

71+
/**
72+
* @description 重写父类的update方法
73+
* @function module:3DPlot.SimpleAreaPrimitive.update
74+
* @public
75+
*
76+
* @param {Boolean} frameState 是否更新
77+
*/
7178
update(frameState) {
7279
if (!this._elem || !this._elem.show) {
7380
return;
@@ -113,6 +120,12 @@ class SimpleAreaPrimitive extends KidneyAreaPrimitive {
113120
}
114121
}
115122

123+
/**
124+
* @description 重写父类的_elementInstance方法
125+
* @private
126+
*
127+
* @param {function} callback 回调函数
128+
*/
116129
_elementInstance(callback) {
117130
if (this.isMustFill) {
118131
new RegularSurfaceElementInstance(this._elem, {
@@ -131,10 +144,22 @@ class SimpleAreaPrimitive extends KidneyAreaPrimitive {
131144
}
132145
}
133146

147+
/**
148+
* @description 重写父类的getPrimitiveBaseSaveAttributes方法
149+
* @function module:3DPlot.SimpleAreaPrimitive.getPrimitiveBaseSaveAttributes
150+
* @public
151+
*
152+
* @return {Array} Attributes 属性字段数组
153+
*/
134154
getPrimitiveBaseSaveAttributes() {
135155
return SimpleAreaPrimitive.extendPrimitiveAttributes.concat([]);
136156
}
137157

158+
/**
159+
* @description 重写父类的initBaseSaveAttributes方法
160+
* @function module:3DPlot.SimpleAreaPrimitive.initBaseSaveAttributes
161+
* @public
162+
*/
138163
initBaseSaveAttributes() {
139164
this.dimModAttitude = this._elem.getSymbolPose();
140165
this.dimModHeight = this._modHeight;

src/service/3DPlot/Primitive/RegularPrimitive/SimpleLinePrimitive.js

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
/*
2-
* @Author: your name
3-
* @Date: 2021-10-25 10:17:52
4-
* @LastEditTime: 2022-05-23 17:27:48
5-
* @LastEditors: zk
6-
* @Description: In User Settings Edit
7-
* @FilePath: \MapGISPlotBase\src\3DPlot\Primitive\SimpleLinePrimitive.js
8-
*/
91
import SimpleLineElementInstance from '../ElementInstance/SimpleLineElementInstance';
102
import RegularLine1Primitive from './RegularLine1Primitive';
113

4+
/**
5+
* @class module:3DPlot.SimpleLinePrimitive
6+
* @description 标绘图元(新规则区)基类
7+
* @author 基础平台-杨琨
8+
*
9+
* @param options - {Object} 初始化参数
10+
*/
1211
class SimpleLinePrimitive extends RegularLine1Primitive {
12+
13+
/**
14+
* @description 重写父类的_elementInstance方法
15+
* @private
16+
*
17+
* @param {function} callback 回调函数
18+
*/
1319
_elementInstance(callback) {
1420
new SimpleLineElementInstance(this._elem, {
1521
...this.getBaseSaveAttributesValues(),
@@ -19,6 +25,11 @@ class SimpleLinePrimitive extends RegularLine1Primitive {
1925
});
2026
}
2127

28+
/**
29+
* @description 重写父类的initBaseSaveAttributes方法
30+
* @function module:3DPlot.SimpleLinePrimitive.initBaseSaveAttributes
31+
* @public
32+
*/
2233
initBaseSaveAttributes() {
2334
super.initBaseSaveAttributes();
2435
this.dimModAttitude = this._elem.getSymbolPose();
@@ -28,6 +39,13 @@ class SimpleLinePrimitive extends RegularLine1Primitive {
2839
this.wallGradColor = 'rgba(255,0,0,0.3)';
2940
}
3041

42+
/**
43+
* @description 重写父类的getPrimitiveBaseSaveAttributes方法
44+
* @function module:3DPlot.SimpleLinePrimitive.getPrimitiveBaseSaveAttributes
45+
* @public
46+
*
47+
* @return {Array} Attributes 属性字段数组
48+
*/
3149
getPrimitiveBaseSaveAttributes() {
3250
return SimpleLinePrimitive.extendPrimitiveAttributes.concat([]);
3351
}

0 commit comments

Comments
 (0)