mxdraw 0.1.22 → 0.1.26

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 (127) 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/McGePoint3d/McGePoint3d.js +1 -0
  4. package/dist/lib/MxModule/McGePoint3d/index.js +1 -0
  5. package/dist/lib/MxModule/McGePoint3dArray/McGePoint3dArray.js +1 -0
  6. package/dist/lib/MxModule/McGePoint3dArray/index.js +1 -0
  7. package/dist/lib/MxModule/McGeTool/McGeTool.js +1 -0
  8. package/dist/lib/MxModule/McGeTool/index.js +1 -0
  9. package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +1 -3
  10. package/dist/lib/MxModule/McGiWorldDraw/index.js +1 -2
  11. package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +1 -19
  12. package/dist/lib/MxModule/McGiWorldDrawType/index.js +1 -4
  13. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +1 -31
  14. package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +1 -5
  15. package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +1 -159
  16. package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +1 -5
  17. package/dist/lib/MxModule/Mx3PointArc/Mx3PointArc.js +1 -0
  18. package/dist/lib/MxModule/Mx3PointArc/index.js +1 -0
  19. package/dist/lib/MxModule/MxDb2LineAngularDimension/MxDb2LineAngularDimension.js +1 -0
  20. package/dist/lib/MxModule/MxDb2LineAngularDimension/index.js +1 -0
  21. package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +1 -213
  22. package/dist/lib/MxModule/MxDbAlignedDimension/index.js +1 -5
  23. package/dist/lib/MxModule/MxDbAnyLine/MxDbAnyLine.js +1 -0
  24. package/dist/lib/MxModule/MxDbAnyLine/index.js +1 -0
  25. package/dist/lib/MxModule/MxDbArea/MxDbArea.js +1 -0
  26. package/dist/lib/MxModule/MxDbArea/index.js +1 -0
  27. package/dist/lib/MxModule/MxDbCloudLine/MxDbCloudLine.js +1 -0
  28. package/dist/lib/MxModule/MxDbCloudLine/index.js +1 -0
  29. package/dist/lib/MxModule/MxDbCoord/MxDbCoord.js +1 -0
  30. package/dist/lib/MxModule/MxDbCoord/index.js +1 -0
  31. package/dist/lib/MxModule/MxDbEllipse/MxDbEllipse.js +1 -0
  32. package/dist/lib/MxModule/MxDbEllipse/index.js +1 -0
  33. package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +1 -258
  34. package/dist/lib/MxModule/MxDbEntity/index.js +1 -5
  35. package/dist/lib/MxModule/MxDbImage/MxDbImage.js +1 -160
  36. package/dist/lib/MxModule/MxDbImage/index.js +1 -5
  37. package/dist/lib/MxModule/MxDbLeadComment/MxDbLeadComment.js +1 -0
  38. package/dist/lib/MxModule/MxDbLeadComment/index.js +1 -0
  39. package/dist/lib/MxModule/MxDbLine/MxDbLine.js +1 -94
  40. package/dist/lib/MxModule/MxDbLine/index.js +1 -5
  41. package/dist/lib/MxModule/MxDbPolyline/MxDbPolyline.js +1 -97
  42. package/dist/lib/MxModule/MxDbPolyline/index.js +1 -5
  43. package/dist/lib/MxModule/MxDbRect/MxDbRect.js +1 -273
  44. package/dist/lib/MxModule/MxDbRect/index.js +1 -4
  45. package/dist/lib/MxModule/MxDbRectBoxLeadComment/MxDbRectBoxLeadComment.js +1 -0
  46. package/dist/lib/MxModule/MxDbRectBoxLeadComment/index.js +1 -0
  47. package/dist/lib/MxModule/MxDbRegularPolygon/MxDbRegularPolygon.js +1 -0
  48. package/dist/lib/MxModule/MxDbRegularPolygon/index.js +1 -0
  49. package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +1 -419
  50. package/dist/lib/MxModule/MxDbSVG/index.js +1 -5
  51. package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +1 -21
  52. package/dist/lib/MxModule/MxDbSVGText/index.js +1 -5
  53. package/dist/lib/MxModule/MxDbText/MxDbText.js +1 -0
  54. package/dist/lib/MxModule/MxDbText/index.js +1 -0
  55. package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +1 -782
  56. package/dist/lib/MxModule/MxDrawObject/index.js +1 -5
  57. package/dist/lib/MxModule/MxFilters/MxFilters.js +1 -201
  58. package/dist/lib/MxModule/MxFilters/index.js +1 -4
  59. package/dist/lib/MxModule/MxFun/MxFun.js +1 -683
  60. package/dist/lib/MxModule/MxFun/index.js +1 -4
  61. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +1 -296
  62. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +1 -29
  63. package/dist/lib/MxModule/MxThreeJS/index.js +1 -7
  64. package/dist/lib/MxModule/MxType/MxType.js +1 -27
  65. package/dist/lib/MxModule/MxType/index.js +1 -4
  66. package/dist/lib/MxModule/Mxassembly/Mxassembly.js +1 -20
  67. package/dist/lib/MxModule/Mxassembly/index.js +1 -9
  68. package/dist/lib/MxModule/loadCoreCode/index.js +1 -5
  69. package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +1 -125
  70. package/dist/lib/MxModule/loadCoreCode/mxUiData.js +1 -312
  71. package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1 -1519
  72. package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +1 -7760
  73. package/dist/lib/MxModule/store/PubsubClass.js +1 -40
  74. package/dist/lib/MxModule/store/StoreClass.js +1 -73
  75. package/dist/lib/MxModule/store/index.js +1 -19
  76. package/dist/lib/MxModule/store/store.js +1 -25
  77. package/dist/lib/MxModule/useCanvasResizeListener/index.js +1 -5
  78. package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +1 -95
  79. package/dist/lib/doc.js +1 -38
  80. package/dist/lib/mxdraw.js +1 -67
  81. package/dist/lib/tools/algorithm/math.js +1 -16
  82. package/dist/lib/tools/algorithm/random.js +1 -13
  83. package/dist/lib/tools/dom/create.js +1 -47
  84. package/dist/lib/tools/dynamicImport/index.js +1 -243
  85. package/dist/lib/tools/formatting/index.js +1 -20
  86. package/dist/lib/tools/proxy/index.js +1 -17
  87. package/dist/lib/tools/three/index.js +1 -124
  88. package/dist/mxdraw.es5.js +1 -0
  89. package/dist/mxdraw.umd.js +1 -0
  90. package/dist/types/MxModule/McGePoint3d/McGePoint3d.d.ts +11 -0
  91. package/dist/types/MxModule/McGePoint3d/index.d.ts +3 -0
  92. package/dist/types/MxModule/McGePoint3dArray/McGePoint3dArray.d.ts +14 -0
  93. package/dist/types/MxModule/McGePoint3dArray/index.d.ts +3 -0
  94. package/dist/types/MxModule/McGeTool/McGeTool.d.ts +38 -0
  95. package/dist/types/MxModule/McGeTool/index.d.ts +4 -0
  96. package/dist/types/MxModule/Mx3PointArc/Mx3PointArc.d.ts +19 -0
  97. package/dist/types/MxModule/Mx3PointArc/index.d.ts +3 -0
  98. package/dist/types/MxModule/MxDb2LineAngularDimension/MxDb2LineAngularDimension.d.ts +22 -0
  99. package/dist/types/MxModule/MxDb2LineAngularDimension/index.d.ts +3 -0
  100. package/dist/types/MxModule/MxDbAnyLine/MxDbAnyLine.d.ts +18 -0
  101. package/dist/types/MxModule/MxDbAnyLine/index.d.ts +3 -0
  102. package/dist/types/MxModule/MxDbArea/MxDbArea.d.ts +17 -0
  103. package/dist/types/MxModule/MxDbArea/index.d.ts +3 -0
  104. package/dist/types/MxModule/MxDbCloudLine/MxDbCloudLine.d.ts +27 -0
  105. package/dist/types/MxModule/MxDbCloudLine/index.d.ts +3 -0
  106. package/dist/types/MxModule/MxDbCoord/MxDbCoord.d.ts +19 -0
  107. package/dist/types/MxModule/MxDbCoord/index.d.ts +3 -0
  108. package/dist/types/MxModule/MxDbEllipse/MxDbEllipse.d.ts +18 -0
  109. package/dist/types/MxModule/MxDbEllipse/index.d.ts +3 -0
  110. package/dist/types/MxModule/MxDbLeadComment/MxDbLeadComment.d.ts +17 -0
  111. package/dist/types/MxModule/MxDbLeadComment/index.d.ts +3 -0
  112. package/dist/types/MxModule/MxDbRectBoxLeadComment/MxDbRectBoxLeadComment.d.ts +19 -0
  113. package/dist/types/MxModule/MxDbRectBoxLeadComment/index.d.ts +3 -0
  114. package/dist/types/MxModule/MxDbRegularPolygon/MxDbRegularPolygon.d.ts +18 -0
  115. package/dist/types/MxModule/MxDbRegularPolygon/index.d.ts +2 -0
  116. package/dist/types/MxModule/MxDbText/MxDbText.d.ts +20 -0
  117. package/dist/types/MxModule/MxDbText/index.d.ts +3 -0
  118. package/dist/types/MxModule/MxDrawObject/MxDrawObject.d.ts +11 -0
  119. package/dist/types/MxModule/MxFun/MxFun.d.ts +8 -33
  120. package/dist/types/MxModule/Mxassembly/Mxassembly.d.ts +9 -3
  121. package/dist/types/mxdraw.d.ts +27 -2
  122. package/dist/types/tools/three/index.d.ts +41 -2
  123. package/package.json +3 -2
  124. package/dist/lib/MxModule/McGeVector3d/McGeVector3d.js +0 -3
  125. package/dist/lib/MxModule/McGeVector3d/index.js +0 -3
  126. package/dist/types/MxModule/McGeVector3d/McGeVector3d.d.ts +0 -18
  127. package/dist/types/MxModule/McGeVector3d/index.d.ts +0 -3
@@ -1,683 +1 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- /** @module MxFun */
13
- var random_1 = require("../../tools/algorithm/random");
14
- var create_1 = require("../../tools/dom/create");
15
- var MxDrawObject_1 = require("../MxDrawObject");
16
- var store_1 = require("../store");
17
- var useCanvasResizeListener_1 = require("../useCanvasResizeListener");
18
- var MrxDbgUiPrPoint_1 = require("../MrxDbgUiPrPoint");
19
- var mxUiData_1 = require("../loadCoreCode/mxUiData");
20
- /**
21
- * MxFun 模块
22
- * 导出库时已实例化,只需要调用实例方法 例如:
23
- * ```typescript
24
- * Mx.MxFun.createMxObject
25
- * ```
26
- */
27
- var MxFun = /** @class */ (function () {
28
- function MxFun() {
29
- // 对象方法代理
30
- // objectMethodProxy(this, store.state.MxFun as MxFunType, 'acutPrintf')
31
- }
32
- /**
33
- * 创建图纸展示控件实例
34
- * @param canvasId 提供一个canvas元素或者唯一的ID或者class类亦或者Jquery选中的元素
35
- * @paramType string | HTMLCanvasElement | JQuery<HTMLElement>
36
- * @param cadFile 提供要展示的图纸名称
37
- * @paramType string
38
- * @param callback 图纸展示控件创建完成后的回调函数 回调参数mxDraw和dom
39
- * @paramType function
40
- * @param isNewFile 是否新建文件
41
- * @paramType boolean
42
- * @return void
43
- * @example
44
- * ``` typescript
45
- * Mx.MxFun.createMxObject({
46
- * canvasId: "my-app",
47
- * cadFile: "test2.dwg",
48
- * callback(mxDraw, { canvas, canvasParent }) {
49
- * console.log(mxDraw, canvas, canvasParent)
50
- * },
51
- * isNewFile: true
52
- * })
53
- * ```
54
- */
55
- MxFun.prototype.createMxObject = function (_a) {
56
- var _b = _a.canvasId, canvasId = _b === void 0 ? (0, random_1.createReandomId)() : _b, _c = _a.cadFile, cadFile = _c === void 0 ? '' : _c, callback = _a.callback, _d = _a.isNewFile, isNewFile = _d === void 0 ? false : _d, _e = _a.useWebsocket, useWebsocket = _e === void 0 ? false : _e, _f = _a.isAutoResize, isAutoResize = _f === void 0 ? true : _f;
57
- this.initUiDataObject(mxUiData_1.default);
58
- // 获取canvas和其父级
59
- var canvas = (0, create_1.createCanvas)(canvasId);
60
- var canvasParent = (0, create_1.createCanvasParent)(canvas);
61
- if (!canvasParent.parentNode || canvasParent.parentNode.nodeType == 11) {
62
- // canvasParent 未插入到文档
63
- document.body.appendChild(canvasParent);
64
- }
65
- if (!useWebsocket && isNewFile) {
66
- // 只有sockec方式,才能新建文件,这里暂是把isNewFile设置成 false
67
- isNewFile = false;
68
- }
69
- // 设置样式
70
- // canvasParent.style.width = '100%'
71
- // canvasParent.style.height = '80vh'
72
- // canvasParent.style.position = 'relative';
73
- // 创建实例
74
- ;
75
- store_1.default.state.MxFun.createMxObject(canvasId, cadFile, function (mxDraw) {
76
- var mxdrawObj = new MxDrawObject_1.default(mxDraw);
77
- mxDraw.setMouseRightRotate(false);
78
- mxDraw.setIniset({ EnableOsnapFunction: true });
79
- mxDraw.addEvent('onResize', function () {
80
- canvasParent.tabindex = 3;
81
- return {
82
- width: canvasParent.clientWidth,
83
- height: canvasParent.clientHeight
84
- };
85
- });
86
- // 使用canvas侦听器 监听canvas元素的大小变化
87
- if (isAutoResize)
88
- (0, useCanvasResizeListener_1.default)(mxdrawObj, canvas);
89
- callback &&
90
- callback(mxdrawObj, {
91
- canvas: canvas,
92
- canvasParent: canvasParent
93
- });
94
- }, undefined, isNewFile, useWebsocket);
95
- };
96
- /**
97
- * 为程序设置服务器地址
98
- * @param MXSERVER 服务器地址
99
- * @return void
100
- * @example
101
- * ``` typescript
102
- * Mx.MxFun.setMxServer("ws://localhost:5090")
103
- * ```
104
- */
105
- MxFun.prototype.setMxServer = function (MXSERVER) {
106
- if (MXSERVER === void 0) { MXSERVER = 'ws://localhost:5090'; }
107
- ;
108
- store_1.default.state.MxFun.setMxServer(MXSERVER);
109
- };
110
- /**
111
- * 设置加载dwg文件,直接使用html get协议加载数据,这样就不需要梦想后台服务器程序。
112
- * @param isStaticLoad 是否启用html get协议加载数据文件
113
- * @return void
114
- * @example
115
- * ``` typescript
116
- * Mx.MxFun.enablStaticLoad(true)
117
- * ```
118
- */
119
- MxFun.prototype.enablStaticLoad = function (isStaticLoad) {
120
- ;
121
- store_1.default.state.MxFun.enablStaticLoad(isStaticLoad);
122
- };
123
- /**
124
- * 设置加载dwg文件,直接使用html get协议加载数据时,使用的服务器地址。
125
- * @param server 服务网络地址.
126
- * @return void
127
- * @example
128
- * ``` typescript
129
- * Mx.MxFun.setStaticServer("http://localhost:3000/demo");
130
- * ```
131
- */
132
- MxFun.prototype.setStaticServer = function (server) {
133
- ;
134
- store_1.default.state.MxFun.setStaticServer(server);
135
- };
136
- /**
137
- * 注册命令
138
- * @param cmdName 命令名
139
- * @param fun 命令函数
140
- * @return void
141
- * @example
142
- * ``` typescript
143
- * Mx.MxFun.addCommand("draw", ()=> {
144
- * console.log("draw")
145
- * })
146
- * ```
147
- */
148
- MxFun.prototype.addCommand = function (cmdName, fun) {
149
- ;
150
- store_1.default.state.MxFun.addCommand(cmdName, fun);
151
- };
152
- /**
153
- * 执行命令
154
- * @param cmdName 命令名
155
- * @return boolean 命令执行成功为true
156
- * @example
157
- * ``` typescript
158
- * if(Mx.MxFun.sendStringToExecute("draw")) {
159
- * console.log("成功执行draw命令")
160
- * }
161
- * ```
162
- */
163
- MxFun.prototype.sendStringToExecute = function (cmdName) {
164
- var _a;
165
- var ages = [];
166
- for (var _i = 1; _i < arguments.length; _i++) {
167
- ages[_i - 1] = arguments[_i];
168
- }
169
- return (_a = store_1.default.state.MxFun).sendStringToExecute.apply(_a, __spreadArray([cmdName], ages, false));
170
- };
171
- /**
172
- * 调用后台服务程序中的NodeJS用户定义函数 后台程序使用Mx.MxFun.registFun注册用户定义函数
173
- * @param funName 函数名
174
- * @param param 函数参数
175
- * @param retfun 函数返回值回调
176
- * @return void
177
- * @example
178
- * ``` typescript
179
- * Mx.MxFun.call("getDrawObject", {
180
- * cadFile: "test.dwg"
181
- * }, (res)=> {
182
- * console.log(res)
183
- * })
184
- * ```
185
- */
186
- MxFun.prototype.call = function (funName, param, retfun) {
187
- return store_1.default.state.MxFun.call(funName, param, retfun);
188
- };
189
- /**
190
- * 获取当前绘图控件对象
191
- * @return MxDrawObjectType 当前绘图控件对象
192
- * @example
193
- * ``` typescript
194
- * const mxDraw = Mx.MxFun.getCurrentDraw()
195
- * mxDraw.getScene()
196
- * ```
197
- */
198
- MxFun.prototype.getCurrentDraw = function () {
199
- return new MxDrawObject_1.default(store_1.default.state.MxFun.getCurrentDraw());
200
- };
201
- /**
202
- * 屏幕坐标长度转THREE.JS坐标长度
203
- * @param len 屏幕坐标长度
204
- * @return number THREE.JS坐标长度
205
- * @example
206
- * ``` typescript
207
- * const len = Mx.MxFun.screenCoordLong2World(36)
208
- * console.log(len)
209
- * ```
210
- */
211
- MxFun.prototype.screenCoordLong2World = function (len) {
212
- return store_1.default.state.MxFun.screenCoordLong2World(len);
213
- };
214
- /**
215
- * 屏幕坐标长度转文档坐标长度
216
- * @param len 屏幕坐标长度
217
- * @return number 文档坐标长度
218
- * @example
219
- * ``` typescript
220
- * const len = Mx.MxFun.screenCoordLong2Doc(36)
221
- * console.log(len)
222
- * ```
223
- */
224
- MxFun.prototype.screenCoordLong2Doc = function (len) {
225
- return store_1.default.state.MxFun.screenCoordLong2Doc(len);
226
- };
227
- /**
228
- * 文档坐标长度转屏幕坐标长度
229
- * @param len 文档坐标长度
230
- * @return number 屏幕坐标长度
231
- * @example
232
- * ``` typescript
233
- * const len = Mx.MxFun.docCoordLong2Screen(36)
234
- * console.log(len)
235
- * ```
236
- */
237
- MxFun.prototype.docCoordLong2Screen = function (len) {
238
- return store_1.default.state.MxFun.docCoordLong2Screen(len);
239
- };
240
- /**
241
- * THREE.JS坐标长度转屏幕坐标长度
242
- * @param len THREE.JS坐标长度
243
- * @return number 屏幕坐标长度
244
- * @example
245
- * ``` typescript
246
- * const len = Mx.MxFun.worldCoordLong2Doc(36)
247
- * console.log(len)
248
- * ```
249
- */
250
- MxFun.prototype.worldCoordLong2Doc = function (len) {
251
- return store_1.default.state.MxFun.worldCoordLong2Doc(len);
252
- };
253
- /**
254
- * DWG文档坐标长度到ThreeJS坐标长度
255
- * @returns number
256
- * @example
257
- * ```typescript
258
- *
259
- *
260
- * ```
261
- */
262
- MxFun.prototype.docCoordLong2World = function (l) {
263
- return store_1.default.state.MxFun.docCoordLong2World(l);
264
- };
265
- /**
266
- * 屏幕坐标转THREE.JS坐标.
267
- * @param x 坐标x
268
- * @param y 坐标y
269
- * @param z 坐标z
270
- * @return THREE.Vector3 THREE.JS坐标
271
- * @example
272
- * ``` typescript
273
- * const vector3 = Mx.MxFun.screenCoord2World(36, 21, 0)
274
- * console.log(vector3)
275
- * ```
276
- */
277
- MxFun.prototype.screenCoord2World = function (x, y, z) {
278
- return store_1.default.state.MxFun.screenCoord2World(x, y, z);
279
- };
280
- /**
281
- * THREE.JS坐标转屏幕坐标.,屏幕坐标的Y轴向下。坐标原点在左上角.
282
- * @param x 坐标x
283
- * @param y 坐标y
284
- * @param z 坐标z
285
- * @return THREE.Vector3 屏幕坐标
286
- * @example
287
- * ``` typescript
288
- * const vector3 = Mx.MxFun.worldCoord2Screen(36, 21, 0)
289
- * console.log(vector3)
290
- * ```
291
- */
292
- MxFun.prototype.worldCoord2Screen = function (x, y, z) {
293
- return store_1.default.state.MxFun.worldCoord2Screen(x, y, z);
294
- };
295
- /**
296
- * 文档坐标转THREE.JS坐标
297
- * 说明: 文档坐标,THREE.JS坐标的X轴都是从左到右,Y轴是下到上,但是屏幕像素坐标系:X轴都是从左到右,Y轴是上到下
298
- * @param x 坐标x
299
- * @param y 坐标y
300
- * @param z 坐标z
301
- * @return THREE.Vector3 THREE.JS坐标
302
- * @example
303
- * ``` typescript
304
- * const vector3 = Mx.MxFun.docCoord2World(36, 21, 0)
305
- * console.log(vector3)
306
- * ```
307
- */
308
- MxFun.prototype.docCoord2World = function (x, y, z) {
309
- return store_1.default.state.MxFun.docCoord2World(x, y, z);
310
- };
311
- /**
312
- * THREE.JS坐标转文档坐标.
313
- * @param x 坐标x
314
- * @param y 坐标y
315
- * @param z 坐标z
316
- * @return THREE.Vector3 文档坐标
317
- * @example
318
- * ``` typescript
319
- * const vector3 = Mx.MxFun.worldCoord2Doc(36, 21, 0)
320
- * console.log(vector3)
321
- * ```
322
- */
323
- MxFun.prototype.worldCoord2Doc = function (x, y, z) {
324
- return store_1.default.state.MxFun.worldCoord2Doc(x, y, z);
325
- };
326
- /**
327
- * 屏幕转文档坐标
328
- * @param x 坐标x
329
- * @param y 坐标y
330
- * @param z 坐标z
331
- * @return THREE.Vector3 文档坐标
332
- * @example
333
- * ``` typescript
334
- * const vector3 = Mx.MxFun.screenCoord2Doc(36, 21, 0)
335
- * console.log(vector3)
336
- * ```
337
- */
338
- MxFun.prototype.screenCoord2Doc = function (x, y) {
339
- return store_1.default.state.MxFun.screenCoord2Doc(x, y, 0);
340
- };
341
- /**
342
- * 文档转屏幕坐标.
343
- * @param x 坐标x
344
- * @param y 坐标y
345
- * @param z 坐标z
346
- * @return THREE.Vector3 屏幕坐标
347
- * @example
348
- * ``` typescript
349
- * const vector3 = Mx.MxFun.docCoord2Screen(36, 21, 0)
350
- * console.log(vector3)
351
- * ```
352
- */
353
- MxFun.prototype.docCoord2Screen = function (x, y) {
354
- return store_1.default.state.MxFun.docCoord2Screen(x, y, 0);
355
- };
356
- /**
357
- * 更新显示,使用Three.js绘制了对象,调用该函数更新显示。
358
- * @return void
359
- * @example
360
- * ``` typescript
361
- * Mx.MxFun.updateDisplay()
362
- * ```
363
- */
364
- MxFun.prototype.updateDisplay = function () {
365
- return store_1.default.state.MxFun.updateDisplay();
366
- };
367
- /**
368
- * 设置窗口鼠标等事件的回调操作
369
- * @param fun 参数1 type: 鼠标事件类型 "mouseup"鼠标释放 、"mousedown" 鼠标按下 参数2 event:事件对象 返回值: number 为0,表示事件往下传递,如果非0,表示事件已经被处理,不要往下传递了
370
- * @return void
371
- * @example
372
- * ``` typescript
373
- * Mx.MxFun.addWindowsEvent((type, event)=> {
374
- * console.log(event)
375
- * if(type = "mouseup") {
376
- * console.log("鼠标释放")
377
- * }else {
378
- * console.log("鼠标按下")
379
- * }
380
- * // 事件往下传递
381
- * // return 0
382
- * // 事件已处理不再传递
383
- * return -1
384
- * })
385
- * ```
386
- */
387
- MxFun.prototype.addWindowsEvent = function (fun) {
388
- return store_1.default.state.MxFun.addWindowsEvent(fun);
389
- };
390
- /**
391
- * 当前是否有命令在运行
392
- * @return boolean
393
- * @example
394
- * ``` typescript
395
- * if(Mx.MxFun.isRunningCommand()) {
396
- * // 当前已有命令在运行
397
- * }
398
- * ```
399
- */
400
- MxFun.prototype.isRunningCommand = function () {
401
- return store_1.default.state.MxFun.isRunningCommand();
402
- };
403
- /**
404
- * 窗口缩放,把指定的范围内的图形放到视区中
405
- * @param dLBx 矩形框范围的左下角X坐标
406
- * @param dLBy 矩形框范围的左下角X坐标
407
- * @param dRTx 矩形框范围的左下角X坐标
408
- * @param dRTy 矩形框范围的左下角X坐标
409
- * @param isWorld 传入的坐标是否是thruee.js坐标,默认传文档坐标
410
- * @return void
411
- * @example
412
- * ``` typescript
413
- * Mx.MxFun.zoomW(21, 22, 300, 310, false)
414
- * ```
415
- */
416
- MxFun.prototype.zoomW = function (dLBx, dLBy, dRTx, dRTy, isWorld) {
417
- return store_1.default.state.MxFun.zoomW(dLBx, dLBy, dRTx, dRTy, isWorld);
418
- };
419
- /**
420
- * 显示或隐藏图层
421
- * @param idLayer 图层id,或层名
422
- * @param isShow 是否显示
423
- * @param isSketch 暂不使用
424
- * @return void
425
- * @example
426
- * ``` typescript
427
- * Mx.MxFun.showLayer(366, true, false)
428
- * Mx.MxFun.showLayer("2363", fasle, false)
429
- * ```
430
- */
431
- MxFun.prototype.showLayer = function (idLayer, isShow, isSketch) {
432
- return store_1.default.state.MxFun.showLayer(idLayer, isShow, isSketch);
433
- };
434
- // acutPrintf(sval: string, ...val: string[]): void {
435
- // (store.state.MxFun as MxFunType).acutPrintf(sval, ...val)
436
- // }
437
- /**
438
- * 获取当前MxCAD对象,该函数在MxCAD模式下使用
439
- * @return MxDrawObjectType MxCAD对象
440
- * @example
441
- * ``` typescript
442
- * const mxcad = Mx.MxFun.getCurrentMxCAD()
443
- * console.log(mxcad)
444
- * ```
445
- */
446
- MxFun.prototype.getCurrentMxCAD = function () {
447
- // 暂时还没有实现。
448
- return store_1.default.state.MxFun.getCurrentMxCAD();
449
- };
450
- /**
451
- * 得到地址栏参数
452
- * @param name
453
- * @return string 地址栏参数
454
- * @example
455
- * ``` typescript
456
- * if(Mx.MxFun.getQueryString("mousetest") === "y")
457
- * ```
458
- */
459
- MxFun.prototype.getQueryString = function (name) {
460
- return store_1.default.state.MxFun.getQueryString(name);
461
- };
462
- /**
463
- * 设置控件的配制参数.
464
- * @param name
465
- * @return object 配制参数.
466
- * @example
467
- * ``` typescript
468
- * Mx.MxFun.setIniset({
469
- * EnableIntelliSelect: true
470
- * })
471
- * ```
472
- */
473
- MxFun.prototype.setIniset = function (iniObj) {
474
- return store_1.default.state.MxFun.setIniset(iniObj);
475
- };
476
- /**
477
- * 更新图纸图层数据
478
- * @param dataLayers
479
- * @return boolean 更新成功或失败
480
- * @example
481
- * ``` typescript
482
- * if(Mx.MxFun.upDisplayForLayerData({
483
- *
484
- * })) {
485
- * console.log("更新成功")
486
- * }
487
- * ```
488
- */
489
- MxFun.prototype.upDisplayForLayerData = function (dataLayers) {
490
- return store_1.default.state.MxFun.upDisplayForLayerData(dataLayers);
491
- };
492
- /**
493
- * 初始化插件的UI数据对象。
494
- * @param uiDataObj
495
- * @return
496
- * @example
497
- * ``` typescript
498
- * ```
499
- */
500
- MxFun.prototype.initUiDataObject = function (uiDataObj) {
501
- return store_1.default.state.MxFun.initUiDataObject(uiDataObj);
502
- };
503
- /**
504
- * 梦想开发测试
505
- * @param p
506
- * @return any
507
- * @example
508
- * ``` typescript
509
- * console.log(Mx.MxFun.TestMX());
510
- * ```
511
- */
512
- MxFun.prototype.testMX = function (p) {
513
- return 5 + 6;
514
- };
515
- /**
516
- * 加载一个图片对象,返回Three.js材质对象,该函数具有缓存功能,下次加载同样的图片,可以直接返回.
517
- * @param p
518
- * @return any
519
- * @example
520
- * ``` typescript
521
- *
522
- * ```
523
- */
524
- MxFun.prototype.loadImageMaterial = function (imageUrlPath, callResult) {
525
- if (callResult) {
526
- ;
527
- store_1.default.state.MxFun.loadImageMaterial(imageUrlPath, callResult);
528
- return new Promise(function (resolve, reject) {
529
- resolve(null);
530
- });
531
- }
532
- else {
533
- return new Promise(function (resolve, reject) {
534
- ;
535
- store_1.default.state.MxFun.loadImageMaterial(imageUrlPath, function (material) {
536
- if (material) {
537
- resolve(material);
538
- }
539
- else {
540
- resolve(null);
541
- }
542
- });
543
- });
544
- }
545
- };
546
- /**
547
- * 判断点是否在一个闭合的多边形区域。
548
- * @param p
549
- * @return any
550
- * @example
551
- * ``` typescript
552
- * let aryPoint:Array<THREE.Vector3> = [];
553
- * aryPoint.push(new THREE.Vector3(0,0,0));
554
- * aryPoint.push(new THREE.Vector3(0,100,0));
555
- * aryPoint.push(new THREE.Vector3(100,100,0));
556
- * aryPoint.push(new THREE.Vector3(100,0,0));
557
- * let pt:THREE.Vector3 = new THREE.Vector3(150,150);
558
- * if(MxFun.pointInPolyline(pt,aryPoint) ){
559
- * console.log("in");
560
- * }
561
- * ```
562
- */
563
- MxFun.prototype.pointInPolyline = function (pt, vecPolyline) {
564
- return store_1.default.state.MxFun.pointInPolyline(pt, vecPolyline);
565
- };
566
- /**
567
- * 计算多边形区域的面积
568
- * @param p
569
- * @return any
570
- * @example
571
- * ``` typescript
572
- * ```
573
- */
574
- MxFun.prototype.calcArea = function (aryPoint) {
575
- return store_1.default.state.MxFun.calcArea(aryPoint);
576
- };
577
- /**
578
- * 重新打开cad文件,该函数在控件创建完后,需要再次重新打开文件,调用。
579
- * @param sFile 打的cad文件路径
580
- * @return any
581
- * @example
582
- * ``` typescript
583
- * ```
584
- */
585
- MxFun.prototype.openFile = function (sFile, useWebsocket) {
586
- if (useWebsocket === void 0) { useWebsocket = false; }
587
- return store_1.default.state.MxFun.openFile(sFile, useWebsocket);
588
- };
589
- /**
590
- * 添加一个MxDbEntity实体到当前绘图对象上。
591
- * @param ent 实体对象
592
- * @returns number 返回对象的id.
593
- * @example
594
- * ```typescript
595
- *
596
- *
597
- * ```
598
- */
599
- MxFun.prototype.addToCurrentSpace = function (ent) {
600
- return this.getCurrentDraw().addMxEntity(ent);
601
- };
602
- /**
603
- * 在图上选择一个对象。
604
- * @param strPrompt 提示字符串
605
- * @param filter 过滤条件
606
- * @returns number 返回对象的id
607
- * @example
608
- * ```typescript
609
- *
610
- *
611
- * ```
612
- */
613
- MxFun.prototype.selectEnt = function (strPrompt, filter) {
614
- var _this = this;
615
- if (filter === void 0) { filter = null; }
616
- return new Promise(function (resolve, reject) {
617
- var getPoint = new MrxDbgUiPrPoint_1.default();
618
- getPoint.setMessage(strPrompt);
619
- getPoint.go(function (status) {
620
- if (status != 0) {
621
- resolve(0);
622
- return;
623
- }
624
- var pt = getPoint.value();
625
- var mxobj = _this.getCurrentDraw();
626
- var aryFind = mxobj.findMxEntityAtPoint(pt);
627
- var iFindId = 0;
628
- while (true) {
629
- if (aryFind.length == 0) {
630
- break;
631
- }
632
- var iLen = aryFind.length;
633
- for (var i = 0; i < iLen; i++) {
634
- var ent = aryFind[i];
635
- if (filter) {
636
- if (filter['type'] && filter['type'] != ent.getTypeName()) {
637
- continue;
638
- }
639
- }
640
- iFindId = ent.objectId();
641
- break;
642
- }
643
- break;
644
- }
645
- resolve(iFindId);
646
- });
647
- });
648
- };
649
- /**
650
- * 监听命令行消息动态更新的数据
651
- * 在取点对象中设置的命令以及我们提供的图形对象中是有一套命令提示和参数化绘图,而该回调函数主要用来监听消息变化
652
- * @parma callback 回调函数中data中的msCmdTip表示命令提示 msCmdText表示当前用户输入的输入内容 msCmdDisplay表示所有的消息记录
653
- * */
654
- MxFun.prototype.listenForCommandLineInput = function (callback) {
655
- var cmdLine = mxUiData_1.default.getCmdLine();
656
- cmdLine.mountUpDisplayFun(callback);
657
- };
658
- /**
659
- * 设置命令行消息数据 (在监听input输入框的onKeydown事件的回调函数中调用)
660
- * @param msCmdText 用户输入的数据 input输入框输入的文本信息
661
- * @param keyCode 按键Code input输入框的onKeydown事件的event事件对象的keyCode属性
662
- * */
663
- MxFun.prototype.setCommandLineInputData = function (msCmdText, keyCode) {
664
- var cmdLine = mxUiData_1.default.getCmdLine();
665
- cmdLine.setCmdText(msCmdText);
666
- mxUiData_1.default.onKeydown(keyCode);
667
- };
668
- /**
669
- * 监听指针(鼠标光标)移动变化的坐标信息
670
- * @parma callback 回调函数中返回坐标信息
671
- * */
672
- MxFun.prototype.listenForCoordTip = function (callback) {
673
- mxUiData_1.default.mountSetCoordFun(callback);
674
- };
675
- /**
676
- * 返回mxfun.min.js中的THREE.JS对象,可以用它来创建mxfun.min.js中THREE对象。
677
- * */
678
- MxFun.prototype.getMxFunTHREE = function () {
679
- return store_1.default.state.MxFun.getTHREE();
680
- };
681
- return MxFun;
682
- }());
683
- exports.default = MxFun;
1
+ "use strict";var __spreadArray=this&&this.__spreadArray||function(t,e,o){if(o||2===arguments.length)for(var r,n=0,a=e.length;n<a;n++)!r&&n in e||(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))};Object.defineProperty(exports,"__esModule",{value:!0});var random_1=require("../../tools/algorithm/random"),create_1=require("../../tools/dom/create"),MxDrawObject_1=require("../MxDrawObject"),store_1=require("../store"),useCanvasResizeListener_1=require("../useCanvasResizeListener"),MrxDbgUiPrPoint_1=require("../MrxDbgUiPrPoint"),mxUiData_1=require("../loadCoreCode/mxUiData"),MxFun=function(){function t(){}return t.prototype.createMxObject=function(t){var e=t.canvasId,o=void 0===e?(0,random_1.createReandomId)():e,r=t.cadFile,n=void 0===r?"":r,a=t.callback,u=t.isNewFile,i=void 0!==u&&u,d=t.useWebsocket,s=void 0!==d&&d,c=t.isAutoResize,l=void 0===c||c;this.initUiDataObject(mxUiData_1.default);var p=(0,create_1.createCanvas)(o),f=(0,create_1.createCanvasParent)(p);f.parentNode&&11!=f.parentNode.nodeType||document.body.appendChild(f),!s&&i&&(i=!1),store_1.default.state.MxFun.createMxObject(o,n,function(t){var e=new MxDrawObject_1.default(t);t.setMouseRightRotate(!1),t.setIniset({EnableOsnapFunction:!0}),t.addEvent("onResize",function(){return f.tabindex=3,{width:f.clientWidth,height:f.clientHeight}}),l&&(0,useCanvasResizeListener_1.default)(e,p),a&&a(e,{canvas:p,canvasParent:f})},void 0,i,s)},t.prototype.setMxServer=function(t){void 0===t&&(t="ws://localhost:5090"),store_1.default.state.MxFun.setMxServer(t)},t.prototype.enablStaticLoad=function(t){store_1.default.state.MxFun.enablStaticLoad(t)},t.prototype.setStaticServer=function(t){store_1.default.state.MxFun.setStaticServer(t)},t.prototype.addCommand=function(t,e){store_1.default.state.MxFun.addCommand(t,e)},t.prototype.sendStringToExecute=function(t){for(var e,o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];return(e=store_1.default.state.MxFun).sendStringToExecute.apply(e,__spreadArray([t],o,!1))},t.prototype.call=function(t,e,o){return store_1.default.state.MxFun.call(t,e,o)},t.prototype.getCurrentDraw=function(){return new MxDrawObject_1.default(store_1.default.state.MxFun.getCurrentDraw())},t.prototype.screenCoordLong2World=function(t){return store_1.default.state.MxFun.screenCoordLong2World(t)},t.prototype.screenCoordLong2Doc=function(t){return store_1.default.state.MxFun.screenCoordLong2Doc(t)},t.prototype.docCoordLong2Screen=function(t){return store_1.default.state.MxFun.docCoordLong2Screen(t)},t.prototype.worldCoordLong2Doc=function(t){return store_1.default.state.MxFun.worldCoordLong2Doc(t)},t.prototype.docCoordLong2World=function(t){return store_1.default.state.MxFun.docCoordLong2World(t)},t.prototype.screenCoord2World=function(t,e,o){return store_1.default.state.MxFun.screenCoord2World(t,e,o)},t.prototype.worldCoord2Screen=function(t,e,o){return store_1.default.state.MxFun.worldCoord2Screen(t,e,o)},t.prototype.docCoord2World=function(t,e,o){return store_1.default.state.MxFun.docCoord2World(t,e,o)},t.prototype.worldCoord2Doc=function(t,e,o){return store_1.default.state.MxFun.worldCoord2Doc(t,e,o)},t.prototype.screenCoord2Doc=function(t,e){return store_1.default.state.MxFun.screenCoord2Doc(t,e,0)},t.prototype.docCoord2Screen=function(t,e){return store_1.default.state.MxFun.docCoord2Screen(t,e,0)},t.prototype.updateDisplay=function(){return store_1.default.state.MxFun.updateDisplay()},t.prototype.addWindowsEvent=function(t){return store_1.default.state.MxFun.addWindowsEvent(t)},t.prototype.isRunningCommand=function(){return store_1.default.state.MxFun.isRunningCommand()},t.prototype.zoomW=function(t,e,o,r,n){return store_1.default.state.MxFun.zoomW(t,e,o,r,n)},t.prototype.showLayer=function(t,e,o){return store_1.default.state.MxFun.showLayer(t,e,o)},t.prototype.getCurrentMxCAD=function(){return store_1.default.state.MxFun.getCurrentMxCAD()},t.prototype.getQueryString=function(t){return store_1.default.state.MxFun.getQueryString(t)},t.prototype.setIniset=function(t){return store_1.default.state.MxFun.setIniset(t)},t.prototype.upDisplayForLayerData=function(t){return store_1.default.state.MxFun.upDisplayForLayerData(t)},t.prototype.initUiDataObject=function(t){return store_1.default.state.MxFun.initUiDataObject(t)},t.prototype.testMX=function(t){return 11},t.prototype.loadImageMaterial=function(t,e){return e?(store_1.default.state.MxFun.loadImageMaterial(t,e),new Promise(function(t,e){t(null)})):new Promise(function(e,o){store_1.default.state.MxFun.loadImageMaterial(t,function(t){e(t||null)})})},t.prototype.openFile=function(t,e){return void 0===e&&(e=!1),store_1.default.state.MxFun.openFile(t,e)},t.prototype.addToCurrentSpace=function(t){return this.getCurrentDraw().addMxEntity(t)},t.prototype.selectEnt=function(t,e){var o=this;return void 0===e&&(e=null),new Promise(function(r,n){var a=new MrxDbgUiPrPoint_1.default;a.setMessage(t),a.go(function(t){if(0==t){for(var n=a.value(),u=o.getCurrentDraw().findMxEntityAtPoint(n),i=0;0!=u.length;){for(var d=u.length,s=0;s<d;s++){var c=u[s];if(!e||!e.type||e.type==c.getTypeName()){i=c.objectId();break}}break}r(i)}else r(0)})})},t.prototype.listenForCommandLineInput=function(t){mxUiData_1.default.getCmdLine().mountUpDisplayFun(t)},t.prototype.setCommandLineInputData=function(t,e){mxUiData_1.default.getCmdLine().setCmdText(t),mxUiData_1.default.onKeydown(e)},t.prototype.listenForCoordTip=function(t){mxUiData_1.default.mountSetCoordFun(t)},t.prototype.getMxFunTHREE=function(){return store_1.default.state.MxFun.getTHREE()},t.prototype.getMxFunThreeTool=function(){return store_1.default.state.MxFun.getMxThreeJS()},t}();exports.default=MxFun;
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var MxFun_1 = require("./MxFun");
4
- exports.default = new MxFun_1.default();
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxFun_1=require("./MxFun");exports.default=new MxFun_1.default;