mxdraw 0.1.12 → 0.1.13

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.
Files changed (74) hide show
  1. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js +1 -128
  2. package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js +1 -5
  3. package/dist/lib/MxModule/McGeVector3d/McGeVector3d.js +1 -2
  4. package/dist/lib/MxModule/McGeVector3d/index.js +1 -3
  5. package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +1 -2
  6. package/dist/lib/MxModule/McGiWorldDraw/index.js +1 -2
  7. package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +1 -19
  8. package/dist/lib/MxModule/McGiWorldDrawType/index.js +1 -4
  9. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +1 -31
  10. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +1 -5
  11. package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +1 -150
  12. package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +1 -5
  13. package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +1 -213
  14. package/dist/lib/MxModule/MxDbAlignedDimension/index.js +1 -5
  15. package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +1 -241
  16. package/dist/lib/MxModule/MxDbEntity/index.js +1 -5
  17. package/dist/lib/MxModule/MxDbImage/MxDbImage.js +1 -160
  18. package/dist/lib/MxModule/MxDbImage/index.js +1 -5
  19. package/dist/lib/MxModule/MxDbLine/MxDbLine.js +1 -94
  20. package/dist/lib/MxModule/MxDbLine/index.js +1 -5
  21. package/dist/lib/MxModule/MxDbRect/MxDbRect.js +1 -273
  22. package/dist/lib/MxModule/MxDbRect/index.js +1 -4
  23. package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +1 -369
  24. package/dist/lib/MxModule/MxDbSVG/index.js +1 -5
  25. package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +1 -21
  26. package/dist/lib/MxModule/MxDbSVGText/index.js +1 -5
  27. package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +1 -754
  28. package/dist/lib/MxModule/MxDrawObject/index.js +1 -5
  29. package/dist/lib/MxModule/MxFilters/MxFilters.js +1 -201
  30. package/dist/lib/MxModule/MxFilters/index.js +1 -4
  31. package/dist/lib/MxModule/MxFun/MxFun.js +1 -630
  32. package/dist/lib/MxModule/MxFun/index.js +1 -9
  33. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +1 -283
  34. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +1 -146
  35. package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +1 -1862
  36. package/dist/lib/MxModule/MxThreeJS/index.js +1 -7
  37. package/dist/lib/MxModule/MxType/MxType.js +1 -27
  38. package/dist/lib/MxModule/MxType/index.js +1 -4
  39. package/dist/lib/MxModule/Mxassembly/Mxassembly.js +1 -18
  40. package/dist/lib/MxModule/Mxassembly/index.js +1 -9
  41. package/dist/lib/MxModule/loadCoreCode/index.js +1 -5
  42. package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +1 -125
  43. package/dist/lib/MxModule/loadCoreCode/mxUiData.js +1 -317
  44. package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1 -1519
  45. package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -7361
  46. package/dist/lib/MxModule/store/PubsubClass.js +1 -40
  47. package/dist/lib/MxModule/store/StoreClass.js +1 -73
  48. package/dist/lib/MxModule/store/index.js +1 -16
  49. package/dist/lib/MxModule/store/store.js +1 -25
  50. package/dist/lib/MxModule/useCanvasResizeListener/index.js +1 -5
  51. package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +1 -95
  52. package/dist/lib/doc.js +1 -38
  53. package/dist/lib/mxdraw.js +1 -64
  54. package/dist/lib/tools/algorithm/math.js +1 -16
  55. package/dist/lib/tools/algorithm/random.js +1 -13
  56. package/dist/lib/tools/dom/create.js +1 -47
  57. package/dist/lib/tools/dynamicImport/index.js +1 -186
  58. package/dist/lib/tools/formatting/index.js +1 -20
  59. package/dist/lib/tools/proxy/index.js +1 -17
  60. package/dist/lib/tools/three/index.js +1 -124
  61. package/dist/lib/types/McEdGetPointWorldDrawObject.js +1 -2
  62. package/dist/lib/types/MrxDbgUiPrPoint.js +1 -2
  63. package/dist/lib/types/MxCADObject.js +1 -2
  64. package/dist/lib/types/MxDrawObject.js +1 -2
  65. package/dist/lib/types/MxFun.js +1 -2
  66. package/dist/lib/types/Mxassembly.js +1 -2
  67. package/dist/mxdraw.es5.js +1 -45
  68. package/dist/mxdraw.umd.js +1 -45
  69. package/dist/types/MxModule/MxFun/MxFun.d.ts +18 -1
  70. package/dist/types/MxModule/store/index.d.ts +2 -7
  71. package/dist/types/mxdraw.d.ts +1 -4
  72. package/package.json +6 -5
  73. package/dist/mxdraw.es5.js.map +0 -1
  74. package/dist/mxdraw.umd.js.map +0 -1
@@ -1,754 +1 @@
1
- "use strict";
2
- /** @module MxDrawObject */
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- var __generator = (this && this.__generator) || function (thisArg, body) {
13
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
- function verb(n) { return function (v) { return step([n, v]); }; }
16
- function step(op) {
17
- if (f) throw new TypeError("Generator is already executing.");
18
- while (_) try {
19
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
- if (y = 0, t) op = [op[0] & 2, t.value];
21
- switch (op[0]) {
22
- case 0: case 1: t = op; break;
23
- case 4: _.label++; return { value: op[1], done: false };
24
- case 5: _.label++; y = op[1]; op = [0]; continue;
25
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
- default:
27
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
- if (t[2]) _.ops.pop();
32
- _.trys.pop(); continue;
33
- }
34
- op = body.call(thisArg, _);
35
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
- }
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- var MxThreeJS_1 = require("../MxThreeJS");
41
- /**
42
- * 引入mxdraw库不会挂载MxDrawObject 只能在以下特定函数中获取
43
- * @function
44
- * {@link MxFun.createMxObject}中callback回调参数`mxDraw`的构造类
45
- * @function
46
- * {@link MxFun.getCurrentDraw} 方法返回值的构造类
47
- * @function
48
- * {@link MxFun.getCurrentMxCAD} 方法返回值的构造类
49
- *
50
- */
51
- var MxDrawObject = /** @class */ (function () {
52
- function MxDrawObject(Mxdraw) {
53
- this._mxdrawObj = Mxdraw;
54
- }
55
- /**
56
- * 获取Three.js绘图场景
57
- * @returns THREE.Scene
58
- */
59
- MxDrawObject.prototype.getScene = function () {
60
- return this._mxdrawObj.getScene();
61
- };
62
- /**
63
- * 获取Three.js相机对象
64
- * @returns THREE.Camera
65
- */
66
- MxDrawObject.prototype.getCamera = function () {
67
- return this._mxdrawObj.getCamera();
68
- };
69
- /**
70
- * 获取Three renderer渲染器
71
- * @returns THREE.WebGLRenderer
72
- */
73
- MxDrawObject.prototype.getRenderer = function () {
74
- return this._mxdrawObj.renderer;
75
- };
76
- /**
77
- * 设置鼠标按下是否旋视区
78
- * @param isRotate 是否旋视区
79
- * @returns void
80
- * @example
81
- * ```typescript
82
- * Mx.MxFun.getCurrentDraw().setMouseRightRotate(false)
83
- * ```
84
- *
85
- */
86
- MxDrawObject.prototype.setMouseRightRotate = function (isRotate) {
87
- if (isRotate === void 0) { isRotate = true; }
88
- return this._mxdrawObj.setMouseRightRotate(isRotate);
89
- };
90
- /**
91
- * 得到全部显示所有图形所需要的显示的范围 ,Three.js的坐标系。world坐标。
92
- * @returns {minPt: value,maxPt: value}
93
- * @example
94
- * ```typescript
95
- * Mx.MxFun.getCurrentDraw().getFullDisplayRange()
96
- * ```
97
- */
98
- MxDrawObject.prototype.getFullDisplayRange = function () {
99
- return this._mxdrawObj.getFullDisplayRange();
100
- };
101
- /**
102
- * 获取Canvas对象.
103
- * @returns HTMLCanvasElement
104
- */
105
- MxDrawObject.prototype.getCanvas = function () {
106
- return this._mxdrawObj.getCanvas();
107
- };
108
- /**
109
- * 通知Three.js更新显示
110
- * @returns void
111
- */
112
- MxDrawObject.prototype.updateDisplay = function () {
113
- return this._mxdrawObj.updateDisplay();
114
- };
115
- /**
116
- * 通知Three.js生成ImgeData显示I数据.
117
- * @param fn 回调函数或者imageData
118
- * @param param 函数载荷
119
- * @returns void
120
- * @example
121
- * ```typescript
122
- * Mx.MxFun.getCurrentDraw().createCanvasImageData((imageData)=> {
123
- * console.log(imageData)
124
- * })
125
- * ```
126
- */
127
- MxDrawObject.prototype.createCanvasImageData = function (fn, param) {
128
- return this._mxdrawObj.createCanvasImageData(fn, param);
129
- };
130
- /**
131
- * 设置视区背景色,
132
- * @param color 如0xFFFFFF 白色
133
- * @returns void
134
- * @example
135
- * ```typescript
136
- * Mx.MxFun.getCurrentDraw().setViewColor(0xFFFFFF)
137
- * ```
138
- */
139
- MxDrawObject.prototype.setViewColor = function (color) {
140
- return this._mxdrawObj.setViewColor(color);
141
- };
142
- /**
143
- * 设置视区背景色,
144
- * @param width 宽度
145
- * @param height 宽度
146
- * @returns void
147
- * @example
148
- * ```typescript
149
- * Mx.MxFun.getCurrentDraw().setSize(0xFFFFFF)
150
- * ```
151
- */
152
- MxDrawObject.prototype.setSize = function (width, height) {
153
- return this._mxdrawObj.setSize(width, height);
154
- };
155
- /**
156
- * 获取某屏幕点下的绘制对象,ptMouse是.,
157
- * @param ptMouse THREE.Vector2 屏幕坐标
158
- * @returns THREE.Intersection[]
159
- * @example
160
- * ```typescript
161
- * Mx.MxFun.getCurrentDraw().getIntersectObjects(new THREE.Vector2(2, 3))
162
- * ```
163
- */
164
- MxDrawObject.prototype.getIntersectObjects = function (ptMouse) {
165
- return this._mxdrawObj.getIntersectObjects(ptMouse);
166
- };
167
- /**
168
- * 添加THREE.Object3D对象到当前场景
169
- * @param obj THREE.Object3D
170
- * @param isAddToSelect 默认值为true 是否把对象添加选择对象集中,调用 getIntersectObjects可以找到
171
- * @returns void
172
- * @example
173
- * ```typescript
174
- * Mx.MxFun.getCurrentDraw().addObject(new THREE.Object3D(), false)
175
- * ```
176
- */
177
- MxDrawObject.prototype.addObject = function (obj, isAddToSelect) {
178
- if (isAddToSelect === void 0) { isAddToSelect = true; }
179
- return this._mxdrawObj.addObject(obj, isAddToSelect);
180
- };
181
- /**
182
- * 添加THREE.Object3D对象到视区场景,对象坐标系是窗口视区坐标系。0,0点在左下角.
183
- * @param obj THREE.Object3D
184
- * @returns void
185
- * @example
186
- * ```typescript
187
- * Mx.MxFun.getCurrentDraw().addViewObject(new THREE.Object3D())
188
- * ```
189
- */
190
- MxDrawObject.prototype.addViewObject = function (obj) {
191
- return this._mxdrawObj.addViewObject(obj);
192
- };
193
- /**
194
- * 得到对象画布的宽度,单位屏幕像素
195
- * @returns number
196
- * @example
197
- * ```typescript
198
- * Mx.MxFun.getCurrentDraw().getViewWidth()
199
- * ```
200
- */
201
- MxDrawObject.prototype.getViewWidth = function () {
202
- return this._mxdrawObj.getViewWidth();
203
- };
204
- /**
205
- * 得到对象画布的高度,单位屏幕像素
206
- * @returns number
207
- * @example
208
- * ```typescript
209
- * Mx.MxFun.getCurrentDraw().getViewHeight()
210
- * ```
211
- */
212
- MxDrawObject.prototype.getViewHeight = function () {
213
- return this._mxdrawObj.getViewHeight();
214
- };
215
- /**
216
- * 删除addObject函数添加的THREE.Object3D对象
217
- * @param obj THREE.Object3D
218
- * @param isRemoveSelectObject 默认值为true 删除选择集中的对象
219
- * @returns void
220
- * @example
221
- * ```typescript
222
- * Mx.MxFun.getCurrentDraw().removeObject(new THREE.Object3D(), false)
223
- * ```
224
- */
225
- MxDrawObject.prototype.removeObject = function (obj, isRemoveSelectObject) {
226
- if (isRemoveSelectObject === void 0) { isRemoveSelectObject = true; }
227
- return this._mxdrawObj.removeObject(obj, isRemoveSelectObject);
228
- };
229
- /**
230
- * 把视区显示范围恢复到初始显示范围.
231
- * @returns void
232
- */
233
- MxDrawObject.prototype.zoomInitialStates = function () {
234
- return this._mxdrawObj.zoomInitialStates();
235
- };
236
- /**
237
- * 缩放当前显示范围,它是相对于当前显示范围进行缩放
238
- * @param scale scale缩放比例
239
- * @returns void
240
- * @example
241
- * ```typescript
242
- * Mx.MxFun.getCurrentDraw().zoomScale(0.8)
243
- * ```
244
- */
245
- MxDrawObject.prototype.zoomScale = function (scale) {
246
- return this._mxdrawObj.zoomScale(scale);
247
- };
248
- /**
249
- * 把当前显示范围移到指定的显示范围
250
- * @param minPt 坐标1 THREE.Vector3
251
- * @param maxPt 坐标2 THREE.Vector3
252
- * @param isWorld 默认为felse DWG图纸坐标,设置为true是THREEJS坐标
253
- * @returns void
254
- * @example
255
- * ```typescript
256
- * Mx.MxFun.getCurrentDraw().zoomW(new THREE.Vector3(0,10,10), new THREE.Vector3(3,8,20), true)
257
- * ```
258
- */
259
- MxDrawObject.prototype.zoomW = function (minPt, maxPt, isWorld) {
260
- return this._mxdrawObj.zoomW(minPt, maxPt, isWorld);
261
- };
262
- /**
263
- * 把当前显示范围移到指定的位置,dCenX,dCenY是DWG图纸坐标。
264
- * @param minPt DWG图纸坐标1 THREE.Vector3
265
- * @param maxPt DWG图纸坐标2 THREE.Vector3
266
- * @returns void
267
- * @example
268
- * ```typescript
269
- * Mx.MxFun.getCurrentDraw().zoomCenter(new THREE.Vector3(0,10,10), new THREE.Vector3(3,8,20))
270
- * ```
271
- */
272
- MxDrawObject.prototype.zoomCenter = function (dCenX, dCenY) {
273
- return this._mxdrawObj.zoomCenter(dCenX, dCenY);
274
- };
275
- /**
276
- * 初始化控件默认加载后,显示视区范围,默认使用图纸转换时的显示范围。。
277
- * @param minPt DWG文档坐标1显示区域的左下角 THREE.Vector3
278
- * @param maxPt DWG文档坐标2显示区域的右上角 THREE.Vector3
279
- * @returns void
280
- * @example
281
- * ```typescript
282
- * Mx.MxFun.getCurrentDraw().initZoomW(new THREE.Vector3(0,10,10), new THREE.Vector3(3,8,20))
283
- *
284
- * ```
285
- */
286
- MxDrawObject.prototype.initZoomW = function (pt1Doc, pt2Doc) {
287
- return this._mxdrawObj.initZoomW(pt1Doc, pt2Doc);
288
- };
289
- /**
290
- * 初始化控件默认加载后,显示视区范围,默认使用图纸转换时的显示范围。。
291
- * @param minPt DWG文档坐标1显示区域的左下角 THREE.Vector3
292
- * @param maxPt DWG文档坐标2显示区域的右上角 THREE.Vector3
293
- * @returns void
294
- * @example
295
- * ```typescript
296
- * Mx.MxFun.getCurrentDraw().addEvent(new THREE.Vector3(0,10,10), new THREE.Vector3(3,8,20))
297
- *
298
- * ```
299
- */
300
- /**
301
- * 控件对象的事件监听
302
- * @param eventNaem 事件名称
303
- * @param fun 回调函数
304
- * @returns void
305
- * @example
306
- * ```typescript
307
- * Mx.MxFun.getCurrentDraw().addEvent("addResizeEvent", ()=> {})
308
- * Mx.MxFun.getCurrentDraw().addEvent("viewchange", ()=> {})
309
- * 视区重绘事件.
310
- * Mx.MxFun.getCurrentDraw().addEvent("render", (renderer)=> {})
311
- * 视区大小被修改事件.,viewsize={viewWidth:viewWidth,viewHeight:viewHeight}
312
- * Mx.MxFun.getCurrentDraw().addEvent("viewsizechange", (viewsize)=> {})
313
- * 实体选择状态发生改变的事件.
314
- * Mx.MxFun.getCurrentDraw().addEvent("MxEntitySelectChange", (aryId:Array<number>)=> {})
315
- * ```
316
- */
317
- MxDrawObject.prototype.addEvent = function (eventNaem, fun) {
318
- return this._mxdrawObj.addEvent(eventNaem, fun);
319
- };
320
- /**
321
- * INI设置
322
- * @param options { EnableOsnapFunction: boolean; }
323
- * @returns void
324
- * @example
325
- * ```typescript
326
- * Mx.MxFun.getCurrentDraw().setIniset(options: { EnableOsnapFunction: true })
327
- *
328
- * ```
329
- */
330
- MxDrawObject.prototype.setIniset = function (options) {
331
- return this._mxdrawObj.setIniset(options);
332
- };
333
- /**
334
- * 屏幕坐标到ThreeJS坐标
335
- * @returns THREE.Vector3
336
- * @example
337
- * ```typescript
338
- *
339
- *
340
- * ```
341
- */
342
- MxDrawObject.prototype.screenCoord2World = function (x, y, z) {
343
- return this._mxdrawObj.screenCoord2World(x, y, z);
344
- };
345
- /**
346
- * ThreeJS坐标到屏幕坐标,屏幕坐标的Y轴向下。坐标原点在左上角.
347
- * @returns THREE.Vector3
348
- * @example
349
- * ```typescript
350
- *
351
- *
352
- * ```
353
- */
354
- MxDrawObject.prototype.worldCoord2Screen = function (x, y, z) {
355
- return this._mxdrawObj.worldCoord2Screen(x, y, z);
356
- };
357
- /**
358
- * 屏幕坐标到DWG文档坐标
359
- * @returns THREE.Vector3
360
- * @example
361
- * ```typescript
362
- *
363
- *
364
- * ```
365
- */
366
- MxDrawObject.prototype.screenCoord2Doc = function (x, y) {
367
- return this._mxdrawObj.screenCoord2Doc(x, y, 0);
368
- };
369
- /**
370
- * ThreeJS坐标长度到DWG文档坐标长度
371
- * @returns number
372
- * @example
373
- * ```typescript
374
- *
375
- *
376
- * ```
377
- */
378
- MxDrawObject.prototype.worldCoordLong2Doc = function (l) {
379
- return this._mxdrawObj.worldCoordLong2Doc(l);
380
- };
381
- /**
382
- * DWG文档坐标长度到ThreeJS坐标长度
383
- * @returns number
384
- * @example
385
- * ```typescript
386
- *
387
- *
388
- * ```
389
- */
390
- MxDrawObject.prototype.docCoordLong2World = function (l) {
391
- return this._mxdrawObj.docCoordLong2World(l);
392
- };
393
- /**
394
- * DWG文档坐标到ThreeJS坐标
395
- * @returns number
396
- * @example
397
- * ```typescript
398
- *
399
- *
400
- * ```
401
- */
402
- MxDrawObject.prototype.docCoord2World = function (x, y, z) {
403
- return this._mxdrawObj.docCoord2World(x, y, z);
404
- };
405
- /**
406
- * DWG文档坐标到ThreeJS坐标
407
- * @returns THREE.Vector3
408
- * @example
409
- * ```typescript
410
- *
411
- *
412
- * ```
413
- */
414
- MxDrawObject.prototype.docCoord2World2 = function (pt) {
415
- return this._mxdrawObj.docCoord2World(pt.x, pt.y, pt.z);
416
- };
417
- /**
418
- * ThreeJS坐标到DWG文档坐标
419
- * @returns number
420
- * @example
421
- * ```typescript
422
- *
423
- *
424
- * ```
425
- */
426
- MxDrawObject.prototype.worldCoord2Doc = function (x, y, z) {
427
- return this._mxdrawObj.worldCoord2Doc(x, y, z);
428
- };
429
- /**
430
- * ThreeJS坐标到DWG文档坐标
431
- * @returns THREE.Vector3
432
- * @example
433
- * ```typescript
434
- *
435
- *
436
- * ```
437
- */
438
- MxDrawObject.prototype.worldCoord2Doc2 = function (pt) {
439
- return this._mxdrawObj.worldCoord2Doc(pt.x, pt.y, pt.z);
440
- };
441
- /**
442
- * DWG文档坐标到屏幕坐标
443
- * @returns number
444
- * @example
445
- * ```typescript
446
- *
447
- *
448
- * ```
449
- */
450
- MxDrawObject.prototype.docCoord2Screen = function (x, y) {
451
- return this._mxdrawObj.docCoord2Screen(x, y, 0);
452
- };
453
- /**
454
- * 屏幕坐标长度到DWG文档坐标长度
455
- * @returns number
456
- * @example
457
- * ```typescript
458
- *
459
- *
460
- * ```
461
- */
462
- MxDrawObject.prototype.screenCoordLong2Doc = function (l) {
463
- return this._mxdrawObj.screenCoordLong2Doc(l);
464
- };
465
- /**
466
- * DWG文档坐标长度到屏幕坐标长度
467
- * @returns number
468
- * @example
469
- * ```typescript
470
- *
471
- *
472
- * ```
473
- */
474
- MxDrawObject.prototype.docCoordLong2Screen = function (l) {
475
- return this._mxdrawObj.docCoordLong2Screen(l);
476
- };
477
- /**
478
- * 屏幕坐标长度到ThreeJS坐标长度
479
- * @returns number
480
- * @example
481
- * ```typescript
482
- *
483
- *
484
- * ```
485
- */
486
- MxDrawObject.prototype.screenCoordLong2World = function (l) {
487
- return this._mxdrawObj.screenCoordLong2World(l);
488
- };
489
- /**
490
- * ThreeJS坐标长度到屏幕坐标长度
491
- * @returns number
492
- * @example
493
- * ```typescript
494
- *
495
- *
496
- * ```
497
- */
498
- MxDrawObject.prototype.worldCoordLong2Screen = function (l) {
499
- return this._mxdrawObj.worldCoordLong2Screen(l);
500
- };
501
- /**
502
- * 初始WebGL Renderer的创建参数,该函数在MxFun.createMxObject函数调用时,调用。
503
- * @param param
504
- * @returns void
505
- * @example
506
- * ```typescript
507
- * mxObj.initRendererParam({preserveDrawingBuffer: true})
508
- *
509
- * ```
510
- */
511
- MxDrawObject.prototype.initRendererParam = function (param) {
512
- return this._mxdrawObj.initRendererParam(param);
513
- };
514
- /**
515
- * 添加一个自定义实体到图上。
516
- * @param ent 自定义实体对象
517
- * @returns number 返回对象的id.
518
- * @example
519
- * ```typescript
520
- *
521
- *
522
- * ```
523
- */
524
- MxDrawObject.prototype.addMxEntity = function (ent) {
525
- return this._mxdrawObj.addMxEntity(ent);
526
- };
527
- /**
528
- * 得到图上当前选择的对象.
529
- * @returns Array<number> 返回对象的id数组.
530
- * @example
531
- * ```typescript
532
- *
533
- *
534
- * ```
535
- */
536
- MxDrawObject.prototype.getMxCurrentSelect = function () {
537
- return this._mxdrawObj.getMxAllSelect();
538
- };
539
- /**
540
- * 把对象添加到当前选择中.
541
- * @returns void
542
- * @example
543
- * ```typescript
544
- *
545
- *
546
- * ```
547
- */
548
- MxDrawObject.prototype.addMxCurrentSelect = function (id) {
549
- return this._mxdrawObj.addMxCurrentSelect(id);
550
- };
551
- /**
552
- * 清除当前所有选择
553
- * @returns void
554
- * @example
555
- * ```typescript
556
- *
557
- *
558
- * ```
559
- */
560
- MxDrawObject.prototype.clearMxCurrentSelect = function () {
561
- return this._mxdrawObj.clearMxCurrentSelect();
562
- };
563
- /**
564
- *通过id获取绘制的对象.
565
- * @param id 返回对象的id
566
- * @returns MxDbEntity
567
- * @example
568
- * ```typescript
569
- *
570
- *
571
- * ```
572
- */
573
- MxDrawObject.prototype.getMxEntity = function (id) {
574
- return this._mxdrawObj.getMxEntityUserObject(id);
575
- };
576
- /**
577
- * 查找某点位置处的用户自绘对象.
578
- * @param ptMouse 查找的点位 THREE.Vector3,默认是文档坐标
579
- * @returns MxDbEntity[] 返回用户自绘对象数组
580
- * @example
581
- * ```typescript
582
- *
583
- *
584
- * ```
585
- */
586
- MxDrawObject.prototype.findMxEntityAtPoint = function (ptMouse) {
587
- return this._mxdrawObj.findMxEntityAtPoint(ptMouse);
588
- };
589
- /**
590
- *得到所有用户自绘对象.
591
- * @returns MxDbEntity[] 返回用户自绘对象数组
592
- * @example
593
- * ```typescript
594
- *
595
- *
596
- * ```
597
- */
598
- MxDrawObject.prototype.getAllMxEntity = function () {
599
- return this._mxdrawObj.getAllMxEntity();
600
- };
601
- /**
602
- * 设置鼠标中键移动视区。
603
- * @param isPan 设置是否可以鼠标中键移动视区
604
- * @returns
605
- * @example
606
- * ```typescript
607
- *
608
- *
609
- * ```
610
- */
611
- MxDrawObject.prototype.setMouseMiddlePan = function (isPan) {
612
- return this._mxdrawObj.setMouseMiddlePan(isPan);
613
- };
614
- /**
615
- *重新设置ThreeJS Controls状态.
616
- * @returns
617
- * @example
618
- * ```typescript
619
- *
620
- *
621
- * ```
622
- */
623
- MxDrawObject.prototype.resetThreeJSControls = function () {
624
- return this._mxdrawObj.resetThreeJSControls();
625
- };
626
- /**
627
- * 启用或禁用鼠标中键滚动缩放视区
628
- * @param isEnable 是否启用
629
- * @returns
630
- * @example
631
- * ```typescript
632
- *
633
- *
634
- * ```
635
- */
636
- MxDrawObject.prototype.enableZoom = function (isEnable) {
637
- return this._mxdrawObj.enableZoom(isEnable);
638
- };
639
- /**
640
- * 启用或禁用鼠标移动视区
641
- * @param isEnable 是否启用
642
- * @returns
643
- * @example
644
- * ```typescript
645
- *
646
- *
647
- * ```
648
- */
649
- MxDrawObject.prototype.enablePan = function (isEnable) {
650
- return this._mxdrawObj.enablePan(isEnable);
651
- };
652
- /**
653
- * 删除MxEntity
654
- * @param id 实体id.
655
- * @returns
656
- * @example
657
- * ```typescript
658
- *
659
- *
660
- * ```
661
- */
662
- MxDrawObject.prototype.eraseMxEntity = function (id) {
663
- return this._mxdrawObj.eraseMxEntity(id);
664
- };
665
- /**
666
- * 移除安视图坐标绘制的对象.
667
- * @param obj 对象.
668
- * @returns
669
- * @example
670
- * ```typescript
671
- *
672
- *
673
- * ```
674
- */
675
- MxDrawObject.prototype.removeViewObject = function (obj) {
676
- this._mxdrawObj.removeViewObject(obj);
677
- };
678
- /**
679
- * 保存所有MxEntity的数据到json字符串.
680
- * @param
681
- * @returns json字符串
682
- * @example
683
- * ```typescript
684
- *
685
- *
686
- * ```
687
- */
688
- MxDrawObject.prototype.saveMxEntityToJson = function () {
689
- return this._mxdrawObj.saveMxEntityToJson();
690
- };
691
- /**
692
- * 从json字符串恢复MxEntity
693
- * @param dataString json字符串.
694
- * @returns
695
- * @example
696
- * ```typescript
697
- *
698
- *
699
- * ```
700
- */
701
- MxDrawObject.prototype.loadMxEntityFromJson = function (dataString, aryPreloadSVG) {
702
- if (aryPreloadSVG === void 0) { aryPreloadSVG = null; }
703
- return __awaiter(this, void 0, void 0, function () {
704
- var iLen, i;
705
- return __generator(this, function (_a) {
706
- switch (_a.label) {
707
- case 0:
708
- if (!aryPreloadSVG) return [3 /*break*/, 4];
709
- iLen = aryPreloadSVG.length;
710
- i = 0;
711
- _a.label = 1;
712
- case 1:
713
- if (!(i < iLen)) return [3 /*break*/, 4];
714
- return [4 /*yield*/, MxThreeJS_1.default.loadSVG(aryPreloadSVG[i])];
715
- case 2:
716
- _a.sent();
717
- _a.label = 3;
718
- case 3:
719
- i++;
720
- return [3 /*break*/, 1];
721
- case 4: return [2 /*return*/, this._mxdrawObj.loadMxEntityFromJson(dataString)];
722
- }
723
- });
724
- });
725
- };
726
- /**
727
- * 删除所有对MxEntity
728
- * @param
729
- * @returns
730
- * @example
731
- * ```typescript
732
- *
733
- *
734
- * ```
735
- */
736
- MxDrawObject.prototype.eraseAllMxEntity = function () {
737
- return this._mxdrawObj.eraseAllMxEntity();
738
- };
739
- /**
740
- * 把该控件对象,设置成当前控件.
741
- * @param
742
- * @returns
743
- * @example
744
- * ```typescript
745
- *
746
- *
747
- * ```
748
- */
749
- MxDrawObject.prototype.makeCurrent = function () {
750
- this._mxdrawObj.makeCurrent();
751
- };
752
- return MxDrawObject;
753
- }());
754
- exports.default = MxDrawObject;
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(t,r,e,o){return new(e||(e=Promise))(function(n,i){function a(t){try{d(o.next(t))}catch(t){i(t)}}function u(t){try{d(o.throw(t))}catch(t){i(t)}}function d(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e(function(t){t(r)})).then(a,u)}d((o=o.apply(t,r||[])).next())})},__generator=this&&this.__generator||function(t,r){var e,o,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(e)throw new TypeError("Generator is already executing.");for(;a;)try{if(e=1,o&&(n=2&i[0]?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=r.call(t,a)}catch(t){i=[6,t],o=0}finally{e=n=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};Object.defineProperty(exports,"__esModule",{value:!0});var MxThreeJS_1=require("../MxThreeJS"),MxDrawObject=function(){function t(t){this._mxdrawObj=t}return t.prototype.getScene=function(){return this._mxdrawObj.getScene()},t.prototype.getCamera=function(){return this._mxdrawObj.getCamera()},t.prototype.getRenderer=function(){return this._mxdrawObj.renderer},t.prototype.setMouseRightRotate=function(t){return void 0===t&&(t=!0),this._mxdrawObj.setMouseRightRotate(t)},t.prototype.getFullDisplayRange=function(){return this._mxdrawObj.getFullDisplayRange()},t.prototype.getCanvas=function(){return this._mxdrawObj.getCanvas()},t.prototype.updateDisplay=function(){return this._mxdrawObj.updateDisplay()},t.prototype.createCanvasImageData=function(t,r){return this._mxdrawObj.createCanvasImageData(t,r)},t.prototype.setViewColor=function(t){return this._mxdrawObj.setViewColor(t)},t.prototype.setSize=function(t,r){return this._mxdrawObj.setSize(t,r)},t.prototype.getIntersectObjects=function(t){return this._mxdrawObj.getIntersectObjects(t)},t.prototype.addObject=function(t,r){return void 0===r&&(r=!0),this._mxdrawObj.addObject(t,r)},t.prototype.addViewObject=function(t){return this._mxdrawObj.addViewObject(t)},t.prototype.getViewWidth=function(){return this._mxdrawObj.getViewWidth()},t.prototype.getViewHeight=function(){return this._mxdrawObj.getViewHeight()},t.prototype.removeObject=function(t,r){return void 0===r&&(r=!0),this._mxdrawObj.removeObject(t,r)},t.prototype.zoomInitialStates=function(){return this._mxdrawObj.zoomInitialStates()},t.prototype.zoomScale=function(t){return this._mxdrawObj.zoomScale(t)},t.prototype.zoomW=function(t,r,e){return this._mxdrawObj.zoomW(t,r,e)},t.prototype.zoomCenter=function(t,r){return this._mxdrawObj.zoomCenter(t,r)},t.prototype.initZoomW=function(t,r){return this._mxdrawObj.initZoomW(t,r)},t.prototype.addEvent=function(t,r){return this._mxdrawObj.addEvent(t,r)},t.prototype.setIniset=function(t){return this._mxdrawObj.setIniset(t)},t.prototype.screenCoord2World=function(t,r,e){return this._mxdrawObj.screenCoord2World(t,r,e)},t.prototype.worldCoord2Screen=function(t,r,e){return this._mxdrawObj.worldCoord2Screen(t,r,e)},t.prototype.screenCoord2Doc=function(t,r){return this._mxdrawObj.screenCoord2Doc(t,r,0)},t.prototype.worldCoordLong2Doc=function(t){return this._mxdrawObj.worldCoordLong2Doc(t)},t.prototype.docCoordLong2World=function(t){return this._mxdrawObj.docCoordLong2World(t)},t.prototype.docCoord2World=function(t,r,e){return this._mxdrawObj.docCoord2World(t,r,e)},t.prototype.docCoord2World2=function(t){return this._mxdrawObj.docCoord2World(t.x,t.y,t.z)},t.prototype.worldCoord2Doc=function(t,r,e){return this._mxdrawObj.worldCoord2Doc(t,r,e)},t.prototype.worldCoord2Doc2=function(t){return this._mxdrawObj.worldCoord2Doc(t.x,t.y,t.z)},t.prototype.docCoord2Screen=function(t,r){return this._mxdrawObj.docCoord2Screen(t,r,0)},t.prototype.screenCoordLong2Doc=function(t){return this._mxdrawObj.screenCoordLong2Doc(t)},t.prototype.docCoordLong2Screen=function(t){return this._mxdrawObj.docCoordLong2Screen(t)},t.prototype.screenCoordLong2World=function(t){return this._mxdrawObj.screenCoordLong2World(t)},t.prototype.worldCoordLong2Screen=function(t){return this._mxdrawObj.worldCoordLong2Screen(t)},t.prototype.initRendererParam=function(t){return this._mxdrawObj.initRendererParam(t)},t.prototype.addMxEntity=function(t){return this._mxdrawObj.addMxEntity(t)},t.prototype.getMxCurrentSelect=function(){return this._mxdrawObj.getMxAllSelect()},t.prototype.addMxCurrentSelect=function(t){return this._mxdrawObj.addMxCurrentSelect(t)},t.prototype.clearMxCurrentSelect=function(){return this._mxdrawObj.clearMxCurrentSelect()},t.prototype.getMxEntity=function(t){return this._mxdrawObj.getMxEntityUserObject(t)},t.prototype.findMxEntityAtPoint=function(t){return this._mxdrawObj.findMxEntityAtPoint(t)},t.prototype.getAllMxEntity=function(){return this._mxdrawObj.getAllMxEntity()},t.prototype.setMouseMiddlePan=function(t){return this._mxdrawObj.setMouseMiddlePan(t)},t.prototype.resetThreeJSControls=function(){return this._mxdrawObj.resetThreeJSControls()},t.prototype.enableZoom=function(t){return this._mxdrawObj.enableZoom(t)},t.prototype.enablePan=function(t){return this._mxdrawObj.enablePan(t)},t.prototype.eraseMxEntity=function(t){return this._mxdrawObj.eraseMxEntity(t)},t.prototype.removeViewObject=function(t){this._mxdrawObj.removeViewObject(t)},t.prototype.saveMxEntityToJson=function(){return this._mxdrawObj.saveMxEntityToJson()},t.prototype.loadMxEntityFromJson=function(t,r){return void 0===r&&(r=null),__awaiter(this,void 0,void 0,function(){var e,o;return __generator(this,function(n){switch(n.label){case 0:if(!r)return[3,4];e=r.length,o=0,n.label=1;case 1:return o<e?[4,MxThreeJS_1.default.loadSVG(r[o])]:[3,4];case 2:n.sent(),n.label=3;case 3:return o++,[3,1];case 4:return[2,this._mxdrawObj.loadMxEntityFromJson(t)]}})})},t.prototype.eraseAllMxEntity=function(){return this._mxdrawObj.eraseAllMxEntity()},t.prototype.makeCurrent=function(){this._mxdrawObj.makeCurrent()},t}();exports.default=MxDrawObject;