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,296 +1 @@
1
- "use strict";
2
- ///////////////////////////////////////////////////////////////////////////////
3
- //版权所有(C)2002-2022,成都梦想凯德科技有限公司。
4
- //本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
5
- //此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
6
- ///////////////////////////////////////////////////////////////////////////////
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- var three_1 = require("three");
9
- var math_1 = require("../../tools/algorithm/math");
10
- var formatting_1 = require("../../tools/formatting");
11
- var store_1 = require("../store");
12
- /**
13
- * MxThreeJS 模块
14
- * ##### 使用说明:
15
- *
16
- * > 基于three.js实现创建直线对象、加载图片、SVG等功能,以下是使用的流程:
17
- * - 模块中大部分方法返回的{@link http://www.yanhuangxueyuan.com/threejs/docs/index.html#api/zh/core/Object3D | THREE.Object3D}类型继承创建的对象都可以通过取点对象{@link MrxDbgUiPrPointClass.value} 得到鼠标对应位置
18
- * - {@link MrxDbgUiPrPointClass.go}和{@link MrxDbgUiPrPointClass.goWhile}方法监听鼠标点击事件回调中通过
19
- * - {@link MxDrawObject.addObject} 方法添加到场景{@link MxDrawObject.getScene}中
20
- * - 最后调用{@link MxFun.updateDisplay} 更新视图显示完成
21
- *
22
- * > 提示: 在实际开发中MxThreeJS是配合着{@link MxDrawObject} 和 {@link MrxDbgUiPrPointClass} 完成绘制线段、文字、图片等功能,当然你也可以使用{@link http://www.yanhuangxueyuan.com/threejs/docs/index.html | three.js}来完成MxThreeJS模块的这些工作
23
- *
24
- * > 该模块导出库时已实例化为对象,只需要调用实例方法 例如:
25
- *
26
- * ```typescript
27
- * // html
28
- * <button id="line">line</button>
29
- *
30
- * // js
31
- * import Mx from "mxdraw"
32
- * import Three from "three"
33
- * Mx.loadCoreCode().then(()=> {
34
- * Mx.MxFun.setMxServer()
35
- * Mx.MxFun.createMxObject({
36
- * callback(mxDraw, dom) {
37
- * document.getElementById("line").onclick = ()=> {
38
- * const getPoint = new Mx.MrxDbgUiPrPointClass()
39
- * let lastPt, isLine
40
- * getPoint.goWhile(()=> {
41
- * const pt1 = getPoint.value()
42
- * if(isLine) {
43
- * const line = Mx.MxThreeJS.createLine(pt1, lastPt, 0xffffff)
44
- * const currentDraw = Mx.MxFun.getCurrentDraw()
45
- * currentDraw.addObject(line)
46
- * Mx.MxFun.updateDisplay()
47
- * }
48
- * lastPt = pt1.clone()
49
- * isLine = !isLine
50
- * })
51
- * }
52
- * }
53
- * })
54
- * })
55
- * ```
56
- */
57
- var MxThreeJS = /** @class */ (function () {
58
- function MxThreeJS() {
59
- }
60
- /**
61
- * 创建Three.js直线对象。
62
- * @param vPt1 {@link http://www.yanhuangxueyuan.com/threejs/docs/index.html#api/zh/math/Vector3 | THREE.Vector3} 点1
63
- * @param vPt2 {@link http://www.yanhuangxueyuan.com/threejs/docs/index.html#api/zh/math/Vector3 | THREE.Vector3} 点2
64
- * @param iColor 颜色Color
65
- * @returns {@link http://www.yanhuangxueyuan.com/threejs/docs/index.html#api/zh/objects/Line |THREE.Line}
66
- * @example
67
- * ```typescript
68
- * Mx.MxThreeJS.createLine(new Three.Vector3(1,10,0), new Three.Vector3(1,300,0), 0)
69
- * ```
70
- */
71
- MxThreeJS.prototype.createLine = function (vPt1, vPt2, iColor) {
72
- var lineGeometry = new three_1.Geometry();
73
- var lineMaterial = new three_1.LineBasicMaterial({ color: iColor });
74
- lineGeometry.vertices.push(vPt1, vPt2);
75
- return new three_1.Line(lineGeometry, lineMaterial);
76
- };
77
- /**
78
- * 创建Three.js圆对象。
79
- * @param mCenterPt 圆中心点
80
- * @param dRadius 圆半径
81
- * @param iColor 颜色
82
- * @returns THREE.Object3D
83
- * @example
84
- * ```typescript
85
- * Mx.MxThreeJS.createCircle(new Three.Vector3(1,10,0), 10, 0)
86
- * ```
87
- */
88
- MxThreeJS.prototype.createCircle = function (mCenterPt, dRadius, iColor) {
89
- var geometry = new three_1.CircleGeometry(dRadius, 64, 3, 2 * Math.PI);
90
- var material = new three_1.LineBasicMaterial({ color: iColor });
91
- geometry.vertices.shift();
92
- var mEnt = new three_1.LineLoop(geometry, material);
93
- mEnt.position.x = mCenterPt.x;
94
- mEnt.position.y = mCenterPt.y;
95
- mEnt.position.z = mCenterPt.z;
96
- return mEnt;
97
- };
98
- /**
99
- * 创建Three.js点对象。
100
- * @param mPt 点位置
101
- * @param iColor 颜色
102
- * @returns THREE.Points
103
- * @example
104
- * ```typescript
105
- * Mx.MxThreeJS.createPoint(new Three.Vector3(1,10,0), 0)
106
- * ```
107
- */
108
- MxThreeJS.prototype.createPoint = function (mPt, iColor) {
109
- var pointsGeometry = new three_1.Geometry();
110
- pointsGeometry.vertices.push(mPt);
111
- var pointsMaterial = new three_1.PointsMaterial({ color: iColor, size: 3 });
112
- var points = new three_1.Points(pointsGeometry, pointsMaterial);
113
- return points;
114
- };
115
- /**
116
- * 创建Three.js 文字
117
- * @param message 文字信息
118
- * @param pt 位置
119
- * @param iSize 文字大小
120
- * @param fAngle 旋转角度
121
- * @param iColor 颜色
122
- * @returns THREE.Sprite
123
- * @example
124
- * ```typescript
125
- * Mx.MxThreeJS.creatTextSprite("hello",new Three.Vector3(1,10,0), 90, 60, 0)
126
- * ```
127
- */
128
- MxThreeJS.prototype.creatTextSprite = function (message, pt, iSize, fAngle, iColor) {
129
- var textHeight = 256;
130
- var canvas = document.createElement('canvas');
131
- var context = canvas.getContext('2d');
132
- var textWidth = 0;
133
- var sFont = (0, formatting_1.formatString)('normal {0}px Arial', '' + textHeight);
134
- /* istanbul ignore next */
135
- if (context == null) {
136
- /* istanbul ignore next */
137
- return null;
138
- }
139
- context.font = sFont;
140
- var metrics = context.measureText(message);
141
- // 保证纹理的尺寸是2次方。
142
- textWidth = (0, math_1.floorPowerOfTwo)(metrics.width) * 2;
143
- canvas.width = textWidth;
144
- canvas.height = textHeight;
145
- context.font = sFont;
146
- context.textAlign = 'center';
147
- context.textBaseline = 'middle';
148
- context.fillStyle = (0, formatting_1.formatString)('rgba({0}, {1}, {2}, 1.0)', ((iColor >> 16) & 0xff) + '', ((iColor >> 8) & 0xff) + '', (iColor & 0xff) + '');
149
- //const sColor = formatString('#{0}', iColor.toString(16))
150
- context.fillText(message, textWidth / 2, textHeight / 2);
151
- var texture = new three_1.Texture(canvas);
152
- texture.needsUpdate = true;
153
- var material = new three_1.SpriteMaterial({
154
- transparent: true,
155
- depthTest: false,
156
- map: texture
157
- });
158
- //material.transparent = false;
159
- material.rotation = fAngle;
160
- var sprite = new three_1.Sprite(material);
161
- sprite.scale.set((textWidth / textHeight) * iSize, iSize, 1);
162
- sprite.position.set(pt.x, pt.y, pt.z);
163
- return sprite;
164
- };
165
- /**
166
- * 根据三角形数组,创建Three.js Mesh
167
- * @param points 由三个点组成的数组
168
- * @param iColor 颜色
169
- * @param opacity 透明度
170
- * @returns THREE.Mesh
171
- * @example
172
- * ```typescript
173
- * Mx.MxThreeJS.createTriangle(
174
- * [new THREE.Vector3(1,2,2),new THREE.Vector3(1,65,4),new THREE.Vector3(12,2,2)],
175
- * 0,
176
- * 1
177
- * )
178
- * ```
179
- */
180
- MxThreeJS.prototype.createTriangle = function (points, iColor, opacity) {
181
- if (opacity === void 0) { opacity = 1.0; }
182
- if (points.length < 3) {
183
- return null;
184
- }
185
- var iLen = points.length;
186
- var geometry = new three_1.Geometry();
187
- for (var i = 0; i + 2 < iLen; i += 3) {
188
- geometry.vertices.push(points[i]);
189
- geometry.vertices.push(points[i + 1]);
190
- geometry.vertices.push(points[i + 2]);
191
- var face = new three_1.Face3(i, i + 1, i + 2);
192
- geometry.faces.push(face);
193
- }
194
- geometry.computeFaceNormals();
195
- geometry.computeVertexNormals();
196
- // 如果需要renderOrder管用,必须在Material属性中,加入transparent: true,depthTest:false这两个值才行。
197
- var material = new three_1.MeshBasicMaterial({
198
- color: iColor,
199
- transparent: true,
200
- depthTest: false,
201
- side: three_1.DoubleSide,
202
- opacity: opacity
203
- });
204
- var mTriangle = new three_1.Mesh(geometry, material);
205
- return mTriangle;
206
- };
207
- /**
208
- * 创建连续直线
209
- * @param points 由多个点组成的数组
210
- * @param iColor 颜色
211
- * @returns THREE.Line
212
- * @example
213
- * ```typescript
214
- * Mx.MxThreeJS.createLines([new THREE.Vector3(1,2,2),new THREE.Vector3(1,65,4),new THREE.Vector3(12,2,2)], 0)
215
- * ```
216
- */
217
- MxThreeJS.prototype.createLines = function (points, iColor) {
218
- var lineGeometry = new three_1.Geometry();
219
- lineGeometry.vertices = points;
220
- //var lineMaterial = new LineBasicMaterial({ color: iColor,linewidth: 500 });
221
- var lineMaterial = new three_1.LineBasicMaterial({ color: iColor });
222
- var line = new three_1.Line(lineGeometry, lineMaterial);
223
- return line;
224
- };
225
- /**
226
- * 创建虚线
227
- * @param points 由多个点组成的数组
228
- * @param iColor 颜色
229
- * @param dashSize 短划线的大小
230
- * @param gapSize 短划线之间的距离
231
- * @returns THREE.Line
232
- * @example
233
- * ```typescript
234
- * Mx.MxThreeJS.createDashedLines([new THREE.Vector3(1,2,2),new THREE.Vector3(1,65,4),new THREE.Vector3(12,2,2)], 10, 20, 2)
235
- * ```
236
- */
237
- MxThreeJS.prototype.createDashedLines = function (points, iColor, dashSize, gapSize) {
238
- var lineGeometry = new three_1.Geometry();
239
- lineGeometry.vertices = points;
240
- var line = new three_1.Line(lineGeometry, new three_1.LineDashedMaterial({
241
- color: iColor,
242
- dashSize: dashSize,
243
- gapSize: gapSize //短划线之间的距离
244
- }));
245
- line.computeLineDistances();
246
- return line;
247
- };
248
- /**
249
- * 创建Image
250
- * @param pos 图片中心点位置,屏幕坐标,屏幕坐标的Y轴向上。坐标原点在左下角.
251
- * @param w 图片宽度
252
- * @param h 图片高度
253
- * @param imageUrlPath 图片URl地址
254
- * @param callResult 图片加载完成的回调 回调参数:THREE.Mesh
255
- * @returns void
256
- * @example
257
- * ```typescript
258
- * Mx.MxThreeJS.createImage(new THREE.Vector3(12,2,2), 10, 20, "../img/icon.png", (mesh)=> {
259
- * console.log(mesh)
260
- * })
261
- * ```
262
- */
263
- MxThreeJS.prototype.createImage = function (pos, w, h, imageUrlPath, callResult) { };
264
- /**
265
- * 加载SVG
266
- * @param url SVG路径地址,该函数具有缓存功能,下次加载同样的图片,可以直接返回.
267
- * @param color 颜色
268
- * @param callResult SVG加载完成的回调 回调参数:THREE.Object3D和Array<THREE.MeshBasicMaterial>
269
- * @returns void
270
- * @example
271
- * ```typescript
272
- * Mx.MxThreeJS.loadSVG("../img/icon.svg", 10, 20, 1.5, new THREE.Color(0xff0000), (threeobj, aryMeterial)=> {
273
- * console.log(threeobj, aryMeterial)
274
- * })
275
- * ```
276
- */
277
- MxThreeJS.prototype.loadSVG = function (url, color, callResult) {
278
- if (callResult) {
279
- ;
280
- store_1.default.state.MxFun.loadSVG(url, color, callResult);
281
- return new Promise(function (resolve) {
282
- resolve(null);
283
- });
284
- }
285
- else {
286
- return new Promise(function (resolve) {
287
- ;
288
- store_1.default.state.MxFun.loadSVG(url, color, function (threeobj) {
289
- resolve(threeobj);
290
- });
291
- });
292
- }
293
- };
294
- return MxThreeJS;
295
- }());
296
- exports.default = MxThreeJS;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var three_1=require("three"),store_1=require("../store"),MxThreeJS=function(){function e(){}return e.prototype.createLine=function(e,t,r){var n=new three_1.Geometry,o=new three_1.LineBasicMaterial({color:r});return n.vertices.push(e,t),new three_1.Line(n,o)},e.prototype.createCircle=function(e,t,r){var n=new three_1.CircleGeometry(t,64,3,2*Math.PI),o=new three_1.LineBasicMaterial({color:r});n.vertices.shift();var i=new three_1.LineLoop(n,o);return i.position.x=e.x,i.position.y=e.y,i.position.z=e.z,i},e.prototype.createPoint=function(e,t){var r=new three_1.Geometry;r.vertices.push(e);var n=new three_1.PointsMaterial({color:t,size:3});return new three_1.Points(r,n)},e.prototype.creatTextSprite=function(e,t,r,n,o){return store_1.default.state.MxFun.getMxThreeJS().creatTextSprite(e,t,r,n,o)},e.prototype.createTriangle=function(e,t,r){if(void 0===r&&(r=1),e.length<3)return null;for(var n=e.length,o=new three_1.Geometry,i=0;i+2<n;i+=3){o.vertices.push(e[i]),o.vertices.push(e[i+1]),o.vertices.push(e[i+2]);var a=new three_1.Face3(i,i+1,i+2);o.faces.push(a)}o.computeFaceNormals(),o.computeVertexNormals();var s=new three_1.MeshBasicMaterial({color:t,transparent:!0,depthTest:!1,side:three_1.DoubleSide,opacity:r});return new three_1.Mesh(o,s)},e.prototype.createLines=function(e,t){var r=new three_1.Geometry;r.vertices=e;var n=new three_1.LineBasicMaterial({color:t});return new three_1.Line(r,n)},e.prototype.createDashedLines=function(e,t,r,n){var o=new three_1.Geometry;o.vertices=e;var i=new three_1.Line(o,new three_1.LineDashedMaterial({color:t,dashSize:r,gapSize:n}));return i.computeLineDistances(),i},e.prototype.createImage=function(e,t,r,n,o){},e.prototype.loadSVG=function(e,t,r){return r?(store_1.default.state.MxFun.loadSVG(e,t,r),new Promise(function(e){e(null)})):new Promise(function(r){store_1.default.state.MxFun.loadSVG(e,t,function(e){r(e)})})},e}();exports.default=MxThreeJS;
@@ -1,29 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var three_1 = require("three");
4
- var three_2 = require("../../tools/three");
5
- function default_1(MxThreeJS) {
6
- MxThreeJS.createImage = function (pos, w, h, imageUrlPath, callResult) {
7
- new three_1.TextureLoader().load(imageUrlPath, function (texture) {
8
- var geometry = new three_1.PlaneGeometry(w, h);
9
- // 测试 transparent: true,打开,renderOrder才管用。
10
- var materialTexture = new three_1.MeshLambertMaterial({
11
- map: texture,
12
- transparent: true,
13
- side: three_1.DoubleSide
14
- });
15
- if (materialTexture.map)
16
- materialTexture.map.needsUpdate = true;
17
- (0, three_2.setGeometrPostion)(geometry, pos);
18
- //var mesh = new Mesh(geometry, material);
19
- var mesh = new three_1.Mesh(geometry, materialTexture);
20
- mesh.material['depthTest'] = false;
21
- //mesh.renderOrder = renderOrder;
22
- callResult && callResult(mesh);
23
- }, undefined, function (err) {
24
- console.log(err);
25
- callResult && callResult(null);
26
- });
27
- };
28
- }
29
- exports.default = default_1;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var three_1=require("three"),three_2=require("../../tools/three");function default_1(e){e.createImage=function(e,t,r,a,o){(new three_1.TextureLoader).load(a,function(a){var n=new three_1.PlaneGeometry(t,r),l=new three_1.MeshLambertMaterial({map:a,transparent:!0,side:three_1.DoubleSide});l.map&&(l.map.needsUpdate=!0),(0,three_2.setGeometrPostion)(n,e);var s=new three_1.Mesh(n,l);s.material.depthTest=!1,o&&o(s)},void 0,function(e){console.log(e),o&&o(null)})}}exports.default=default_1;
@@ -1,7 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var MxThreeJS_mixin_1 = require("./MxThreeJS.mixin");
4
- var MxThreeJS_1 = require("./MxThreeJS");
5
- var MxThreeJS = new MxThreeJS_1.default();
6
- (0, MxThreeJS_mixin_1.default)(MxThreeJS);
7
- exports.default = MxThreeJS;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxThreeJS_mixin_1=require("./MxThreeJS.mixin"),MxThreeJS_1=require("./MxThreeJS"),MxThreeJS=new MxThreeJS_1.default;(0,MxThreeJS_mixin_1.default)(MxThreeJS),exports.default=MxThreeJS;
@@ -1,27 +1 @@
1
- "use strict";
2
- /** @module MxType*/
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * 动态绘制类型
6
- * @example ```typescript
7
-
8
- * ```
9
- */
10
- var MxCloneType;
11
- (function (MxCloneType) {
12
- /** 正常Clone */
13
- MxCloneType[MxCloneType["kClone"] = 1] = "kClone";
14
- /** 动态拖动Clone */
15
- MxCloneType[MxCloneType["kDragClone"] = 2] = "kDragClone";
16
- })(MxCloneType || (MxCloneType = {}));
17
- var MxCloneType2;
18
- (function (MxCloneType2) {
19
- /** 正常Clone */
20
- MxCloneType2[MxCloneType2["kClone"] = 1] = "kClone";
21
- /** 动态拖动Clone */
22
- MxCloneType2[MxCloneType2["kDragClone"] = 2] = "kDragClone";
23
- })(MxCloneType2 || (MxCloneType2 = {}));
24
- exports.default = {
25
- MxCloneType: MxCloneType,
26
- MxCloneType2: MxCloneType2
27
- };
1
+ "use strict";var MxCloneType,MxCloneType2;Object.defineProperty(exports,"__esModule",{value:!0}),function(e){e[e.kClone=1]="kClone",e[e.kDragClone=2]="kDragClone"}(MxCloneType||(MxCloneType={})),function(e){e[e.kClone=1]="kClone",e[e.kDragClone=2]="kDragClone"}(MxCloneType2||(MxCloneType2={})),exports.default={MxCloneType:MxCloneType,MxCloneType2:MxCloneType2};
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var MxType_1 = require("./MxType");
4
- exports.default = MxType_1.default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var MxType_1=require("./MxType");exports.default=MxType_1.default;
@@ -1,20 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /** @module Mxassembly */
4
- var store_1 = require("../store/store");
5
- /**
6
- * Mxassembly 模块
7
- * 导出库时已实例化,只需要调用实例方法 例如:
8
- * ```typescript
9
- * ```
10
- */
11
- var Mxassembly = /** @class */ (function () {
12
- function Mxassembly() {
13
- }
14
- Mxassembly.prototype.NewMcGeVector3d = function () {
15
- var _a;
16
- return (_a = new store_1.default.state.Mxassembly) === null || _a === void 0 ? void 0 : _a.McGeVector3d();
17
- };
18
- return Mxassembly;
19
- }());
20
- exports.default = Mxassembly;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var store_1=require("../store/store"),Mxassembly=function(){function t(){this.mxassembly=null}return t.prototype.initImp=function(){this.mxassembly||store_1.default.state.Mxassembly&&(this.mxassembly=store_1.default.state.Mxassembly)},t.prototype.NewMcGePoint3d=function(t,e,s){this.initImp();var r=new this.mxassembly.McGePoint3d;return t&&(r.x=t),e&&(r.y=e),s&&(r.z=s),r},t.prototype.NewMcGePoint3dArray=function(t){var e=this;this.initImp();var s=new this.mxassembly.McGePoint3dArray;return t&&t.forEach(function(t){var r=e.NewMcGePoint3d();r.x=t.x,r.y=t.y,r.z=t.z,s.append(r)}),s},t}();exports.default=Mxassembly;
@@ -1,9 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var Mxassembly_1 = require("./Mxassembly");
4
- // import store from '../store/_index'
5
- // import loadCoreCode from '../loadCoreCode'
6
- // if (!store.state.MxFUn) {
7
- // loadCoreCode()
8
- // }
9
- exports.default = new Mxassembly_1.default();
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Mxassembly_1=require("./Mxassembly");exports.default=new Mxassembly_1.default;
@@ -1,5 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /** @module loadCoreCode */
4
- var loadCoreCode_1 = require("./loadCoreCode");
5
- exports.default = loadCoreCode_1.default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var loadCoreCode_1=require("./loadCoreCode");exports.default=loadCoreCode_1.default;
@@ -1,125 +1 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- /** @module loadCoreCode */
40
- var dynamicImport_1 = require("../../tools/dynamicImport");
41
- var store_1 = require("../store");
42
- var mxfun_es5_js_1 = require("./mxfun.es5.js");
43
- var mxcadassembly_es5_js_1 = require("./mxcadassembly_es5.js");
44
- function rxInitMxEntity() {
45
- var _a;
46
- /*
47
- new MxDbImage().rxInit()
48
- new MxDbSVG().rxInit()
49
- new MxDbAlignedDimension().rxInit()
50
- new MxDbLine().rxInit()
51
- new MxDbRect().rxInit()
52
- */
53
- (_a = store_1.default.state.MxFun) === null || _a === void 0 ? void 0 : _a.initDynamicCreate(dynamicImport_1.dynamicCreateMxObject);
54
- }
55
- /**
56
- * 加载MxDraw库的核心代码 才能使用Mx的其他模块
57
- * @returns Promise<{@link MxFun}>
58
- * @example
59
- * ```
60
- * Mx.loadCoreCode().then(()=> console.log("加载完成", Mx.MxFun))
61
- * ```
62
- */
63
- function loadCoreCode() {
64
- return __awaiter(this, void 0, void 0, function () {
65
- var _this = this;
66
- return __generator(this, function (_a) {
67
- return [2 /*return*/, new Promise(function (res, rej) { return __awaiter(_this, void 0, void 0, function () {
68
- var _a, _b, e_1;
69
- return __generator(this, function (_c) {
70
- switch (_c.label) {
71
- case 0:
72
- _c.trys.push([0, 2, , 3]);
73
- if (store_1.default.state.MxFun) {
74
- console.error('内部已调用loadCoreCode, 无需重复调用!');
75
- return [2 /*return*/, rej({
76
- code: 'error',
77
- msg: '内部已调用loadCoreCode, 无需重复调用'
78
- })];
79
- }
80
- _a = window;
81
- _b = window;
82
- return [4 /*yield*/, (0, dynamicImport_1.dynamicImport)('jquery')];
83
- case 1:
84
- _a.$ = _b.jQuery = _c.sent();
85
- window.MxDocumentReady = undefined;
86
- window.MxUiMain = function (requireFun) {
87
- var MxFun = requireFun('./MxFun').MxFun;
88
- store_1.default.commit('setMxFun', MxFun);
89
- store_1.default.events.emit('MxUiMain', requireFun);
90
- window.MxUiMain = undefined;
91
- };
92
- // 与MxMain有冲突(执行顺序有问题)
93
- // window.MxDocumentReady = (requireFun: (path: string) => RequireFunReturnObjectType, mxinit: () => void) => {
94
- // store.events.emit("MxDocumentReady", requireFun, mxinit)
95
- // mxinit()
96
- // }
97
- window.MxMain = function (requireFun) {
98
- store_1.default.events.emit('MxMain', requireFun);
99
- window.MxMain = undefined;
100
- rxInitMxEntity();
101
- res();
102
- return 0;
103
- };
104
- (0, mxcadassembly_es5_js_1.default)().then(function (mxassembly) {
105
- //console.log(mxassembly);
106
- store_1.default.commit('setMxassembly', mxassembly);
107
- });
108
- // 加载mxfun.min.js,mxfun()相当直接模拟了mxfun.min.js的加载。
109
- (0, mxfun_es5_js_1.default)();
110
- return [3 /*break*/, 3];
111
- case 2:
112
- e_1 = _c.sent();
113
- rej({
114
- code: 'error',
115
- msg: e_1
116
- });
117
- return [3 /*break*/, 3];
118
- case 3: return [2 /*return*/];
119
- }
120
- });
121
- }); })];
122
- });
123
- });
124
- }
125
- exports.default = loadCoreCode;
1
+ "use strict";var __awaiter=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,u)}s((r=r.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[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(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=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 dynamicImport_1=require("../../tools/dynamicImport"),store_1=require("../store"),mxfun_es5_js_1=require("./mxfun.es5.js"),mxcadassembly_es5_js_1=require("./mxcadassembly_es5.js");function rxInitMxEntity(){var e;null===(e=store_1.default.state.MxFun)||void 0===e||e.initDynamicCreate(dynamicImport_1.dynamicCreateMxObject)}function loadCoreCode(){return __awaiter(this,void 0,void 0,function(){var e=this;return __generator(this,function(t){return[2,new Promise(function(t,n){return __awaiter(e,void 0,void 0,function(){var e,r,o;return __generator(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),store_1.default.state.MxFun?(console.error("内部已调用loadCoreCode, 无需重复调用!"),[2,n({code:"error",msg:"内部已调用loadCoreCode, 无需重复调用"})]):(e=window,r=window,[4,(0,dynamicImport_1.dynamicImport)("jquery")]);case 1:return e.$=r.jQuery=i.sent(),window.MxDocumentReady=void 0,window.MxUiMain=function(e){var t=e("./MxFun").MxFun;store_1.default.commit("setMxFun",t),store_1.default.events.emit("MxUiMain",e),window.MxUiMain=void 0},window.MxMain=function(e){return store_1.default.events.emit("MxMain",e),window.MxMain=void 0,rxInitMxEntity(),t(),0},(0,mxcadassembly_es5_js_1.default)().then(function(e){store_1.default.commit("setMxassembly",e)}),(0,mxfun_es5_js_1.default)(),[3,3];case 2:return o=i.sent(),n({code:"error",msg:o}),[3,3];case 3:return[2]}})})})]})})}exports.default=loadCoreCode;