mxdraw 0.1.9 → 0.1.10
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.
- package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +28 -0
- package/dist/lib/MxModule/MxDbImage/MxDbImage.js +2 -1
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +153 -38
- package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +3 -0
- package/dist/lib/MxModule/MxFun/MxFun.js +48 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +8 -8
- package/dist/mxdraw.es5.js +2 -2
- package/dist/mxdraw.es5.js.map +1 -1
- package/dist/mxdraw.umd.js +2 -2
- package/dist/mxdraw.umd.js.map +1 -1
- package/dist/types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts +1 -1
- package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +21 -0
- package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +4 -0
- package/dist/types/MxModule/MxDbSVGText/MxDbSVGText.d.ts +3 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +12 -0
- package/package.json +1 -1
|
@@ -79,6 +79,34 @@ var MxDbEntity = /** @class */ (function () {
|
|
|
79
79
|
return false;
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* 返回对象所在的控件对象。
|
|
84
|
+
* @param
|
|
85
|
+
* @returns boolean
|
|
86
|
+
* @example
|
|
87
|
+
* ``` typescript
|
|
88
|
+
*
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
MxDbEntity.prototype.getMxObject = function () {
|
|
92
|
+
var imp = this.getImp();
|
|
93
|
+
if (imp)
|
|
94
|
+
return imp.getMxObject();
|
|
95
|
+
else
|
|
96
|
+
return null;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* 视区显示比较发生成变化,继承类可以向应该事件,更新显示大小。
|
|
100
|
+
* @param
|
|
101
|
+
* @returns boolean
|
|
102
|
+
* @example
|
|
103
|
+
* ``` typescript
|
|
104
|
+
*
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
MxDbEntity.prototype.onViewChange = function () {
|
|
108
|
+
return false;
|
|
109
|
+
};
|
|
82
110
|
/**
|
|
83
111
|
* 得到对象的id.
|
|
84
112
|
* @param
|
|
@@ -70,6 +70,7 @@ var MxDbImage = /** @class */ (function (_super) {
|
|
|
70
70
|
}
|
|
71
71
|
else if (this.imagePath.length > 0 && this.isLoadMaterialFromPath) {
|
|
72
72
|
var myThis_1 = this;
|
|
73
|
+
var mxobj_1 = pWorldDraw.getMxObject();
|
|
73
74
|
MxFun_1.default.loadImageMaterial(this.imagePath, function (material) {
|
|
74
75
|
_this.isLoadMaterialFromPath = false;
|
|
75
76
|
if (!material) {
|
|
@@ -77,7 +78,7 @@ var MxDbImage = /** @class */ (function (_super) {
|
|
|
77
78
|
}
|
|
78
79
|
myThis_1.setMaterial(material);
|
|
79
80
|
myThis_1.setNeedUpdateDisplay();
|
|
80
|
-
|
|
81
|
+
mxobj_1.updateDisplay();
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
-
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
4
|
-
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
5
|
-
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
6
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
7
|
-
/** @module MxDbSVG*/
|
|
8
2
|
var __extends = (this && this.__extends) || (function () {
|
|
9
3
|
var extendStatics = function (d, b) {
|
|
10
4
|
extendStatics = Object.setPrototypeOf ||
|
|
@@ -21,10 +15,15 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
21
15
|
};
|
|
22
16
|
})();
|
|
23
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
19
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
20
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
21
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
/** @module MxDbSVG*/
|
|
24
24
|
var THREE = require("three");
|
|
25
25
|
var MxDbEntity_1 = require("../MxDbEntity");
|
|
26
26
|
var MxDbSVGText_1 = require("../MxDbSVGText");
|
|
27
|
-
var MxFun_1 = require("../MxFun");
|
|
28
27
|
var MxThreeJS_1 = require("../MxThreeJS");
|
|
29
28
|
var MxType_1 = require("../MxType");
|
|
30
29
|
/**
|
|
@@ -35,40 +34,91 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
35
34
|
function MxDbSVG() {
|
|
36
35
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
37
36
|
_this.svgPos = new THREE.Vector3();
|
|
37
|
+
_this.svg = null;
|
|
38
38
|
_this.svgPath = '';
|
|
39
39
|
_this.svgSize = new THREE.Vector2(50, 50);
|
|
40
40
|
_this.svgAlignmentRatio = new THREE.Vector2(0, 0);
|
|
41
|
+
_this.svgRotate = 0;
|
|
41
42
|
_this.isSvgDirtyLocation = false;
|
|
42
43
|
_this.isLoadFromPath = true;
|
|
43
44
|
_this.aryText = [];
|
|
45
|
+
_this.svgBoxSize = null;
|
|
46
|
+
// 固定尺寸,图片和文字大小,取屏幕像素绘图单位。
|
|
47
|
+
_this.fixedSize = false;
|
|
44
48
|
return _this;
|
|
45
49
|
}
|
|
46
50
|
MxDbSVG.prototype.worldDraw = function (pWorldDraw) {
|
|
47
51
|
var _this = this;
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
var
|
|
52
|
+
var mxObj = pWorldDraw.getMxObject();
|
|
53
|
+
this.calcSvgPosition(mxObj);
|
|
54
|
+
var sizew = this.svgSize.x;
|
|
55
|
+
var sizeh = this.svgSize.y;
|
|
56
|
+
if (this.fixedSize) {
|
|
57
|
+
sizew = mxObj.screenCoordLong2Doc(sizew);
|
|
58
|
+
sizeh = mxObj.screenCoordLong2Doc(sizeh);
|
|
59
|
+
}
|
|
60
|
+
var mat = new THREE.Matrix4();
|
|
61
|
+
mat.makeRotationZ(this.svgRotate);
|
|
62
|
+
var matMove = new THREE.Matrix4();
|
|
63
|
+
var svgNewPos = new THREE.Vector3(this.svgPos.x - sizew * this.svgAlignmentRatio.x, this.svgPos.y - sizeh * this.svgAlignmentRatio.y, 0);
|
|
64
|
+
matMove.makeTranslation(svgNewPos.x, svgNewPos.y, svgNewPos.z);
|
|
65
|
+
mat.premultiply(matMove);
|
|
66
|
+
var pt1 = new THREE.Vector3(0, 0, 0);
|
|
67
|
+
var pt3 = new THREE.Vector3(sizew, 0, 0);
|
|
68
|
+
var pt2 = new THREE.Vector3(sizew, sizeh, 0);
|
|
69
|
+
var pt4 = new THREE.Vector3(0, sizeh, 0);
|
|
70
|
+
pt1.applyMatrix4(mat);
|
|
71
|
+
pt3.applyMatrix4(mat);
|
|
72
|
+
pt2.applyMatrix4(mat);
|
|
73
|
+
pt4.applyMatrix4(mat);
|
|
59
74
|
if (pWorldDraw.getType() == 1) {
|
|
75
|
+
this.aryText.forEach(function (txt) {
|
|
76
|
+
if (txt.txt.length > 0) {
|
|
77
|
+
var posTxt = new THREE.Vector3(txt.txtPos.x, txt.txtPos.y, 0);
|
|
78
|
+
if (_this.fixedSize) {
|
|
79
|
+
if (txt.txtPos.x > 0)
|
|
80
|
+
posTxt.x = _this.svgPos.x + mxObj.screenCoordLong2Doc(txt.txtPos.x);
|
|
81
|
+
else
|
|
82
|
+
posTxt.x = _this.svgPos.x - mxObj.screenCoordLong2Doc(txt.txtPos.x);
|
|
83
|
+
if (txt.txtPos.y > 0)
|
|
84
|
+
posTxt.y = _this.svgPos.y + mxObj.screenCoordLong2Doc(txt.txtPos.y);
|
|
85
|
+
else
|
|
86
|
+
posTxt.y = _this.svgPos.y - mxObj.screenCoordLong2Doc(txt.txtPos.y);
|
|
87
|
+
}
|
|
88
|
+
var bakColor = undefined;
|
|
89
|
+
if (txt.color) {
|
|
90
|
+
bakColor = pWorldDraw.getColor();
|
|
91
|
+
pWorldDraw.setColor(txt.color);
|
|
92
|
+
}
|
|
93
|
+
var iSize = txt.txtHeight;
|
|
94
|
+
if (_this.fixedSize)
|
|
95
|
+
iSize = mxObj.screenCoordLong2Doc(txt.txtHeight);
|
|
96
|
+
txt._txtObject = pWorldDraw.drawText(txt.txt, iSize, 0, posTxt);
|
|
97
|
+
txt._txtAspectRatio = -1;
|
|
98
|
+
if (bakColor) {
|
|
99
|
+
pWorldDraw.setColor(bakColor);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
60
103
|
if (this.svg) {
|
|
61
104
|
pWorldDraw.drawEntity(this.svg);
|
|
62
105
|
}
|
|
63
106
|
else {
|
|
64
107
|
if (this.svgPath.length > 0 && this.isLoadFromPath) {
|
|
65
108
|
var myThis_1 = this;
|
|
109
|
+
var mxobj_1 = pWorldDraw.getMxObject();
|
|
66
110
|
MxThreeJS_1.default.loadSVG(this.svgPath, undefined, function (obj) {
|
|
67
111
|
if (obj) {
|
|
68
112
|
var box = new THREE.Box3().setFromObject(obj);
|
|
69
|
-
|
|
70
|
-
|
|
113
|
+
if (!myThis_1.svgBoxSize) {
|
|
114
|
+
myThis_1.svgBoxSize = new THREE.Vector3();
|
|
115
|
+
}
|
|
116
|
+
myThis_1.svgBoxSize.x = box.max.x - box.min.x;
|
|
117
|
+
myThis_1.svgBoxSize.y = box.max.y - box.min.y;
|
|
118
|
+
obj.scale.x = sizew / myThis_1.svgBoxSize.x;
|
|
119
|
+
obj.scale.y = sizeh / myThis_1.svgBoxSize.y;
|
|
71
120
|
obj.scale.z = obj.scale.x;
|
|
121
|
+
obj.rotateZ(myThis_1.svgRotate);
|
|
72
122
|
myThis_1.isSvgDirtyLocation = true;
|
|
73
123
|
var color_1 = new THREE.Color(_this.color);
|
|
74
124
|
obj.traverse(function (child) {
|
|
@@ -80,27 +130,28 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
80
130
|
});
|
|
81
131
|
//this.svgPos.multiply
|
|
82
132
|
myThis_1.svg = obj;
|
|
83
|
-
myThis_1.setNeedUpdateDisplay(
|
|
84
|
-
|
|
133
|
+
myThis_1.setNeedUpdateDisplay();
|
|
134
|
+
mxobj_1.updateDisplay();
|
|
85
135
|
}
|
|
86
136
|
myThis_1.isLoadFromPath = false;
|
|
87
137
|
});
|
|
88
138
|
}
|
|
89
139
|
}
|
|
90
|
-
pWorldDraw.drawSelectLine(pt1
|
|
91
|
-
pWorldDraw.drawSelectLine(
|
|
140
|
+
pWorldDraw.drawSelectLine(pt1, pt2);
|
|
141
|
+
pWorldDraw.drawSelectLine(pt3, pt4);
|
|
92
142
|
}
|
|
93
143
|
else {
|
|
94
|
-
pWorldDraw.drawLine(pt1
|
|
95
|
-
pWorldDraw.drawLine(
|
|
96
|
-
pWorldDraw.drawLine(pt2
|
|
97
|
-
pWorldDraw.drawLine(
|
|
144
|
+
pWorldDraw.drawLine(pt1, pt3);
|
|
145
|
+
pWorldDraw.drawLine(pt3, pt2);
|
|
146
|
+
pWorldDraw.drawLine(pt2, pt4);
|
|
147
|
+
pWorldDraw.drawLine(pt4, pt1);
|
|
98
148
|
}
|
|
99
149
|
};
|
|
100
150
|
MxDbSVG.prototype.setSvgPath = function (path) {
|
|
101
151
|
this.svgPath = path;
|
|
102
152
|
this.svg = null;
|
|
103
153
|
this.isLoadFromPath = true;
|
|
154
|
+
this.svgBoxSize = null;
|
|
104
155
|
};
|
|
105
156
|
MxDbSVG.prototype.getSvgPath = function () {
|
|
106
157
|
return this.svgPath;
|
|
@@ -145,25 +196,38 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
145
196
|
MxDbSVG.prototype.moveGripPointsAt = function (index, offset) {
|
|
146
197
|
if (index == 0) {
|
|
147
198
|
this.svgPos.add(offset);
|
|
148
|
-
this.
|
|
149
|
-
|
|
150
|
-
|
|
199
|
+
if (!this.fixedSize) {
|
|
200
|
+
this.aryText.forEach(function (txt) {
|
|
201
|
+
txt.txtPos.add(offset);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
151
204
|
}
|
|
152
205
|
this.isSvgDirtyLocation = true;
|
|
153
206
|
return true;
|
|
154
207
|
};
|
|
155
|
-
MxDbSVG.prototype.calcSvgPosition = function () {
|
|
208
|
+
MxDbSVG.prototype.calcSvgPosition = function (mxObj) {
|
|
156
209
|
if (!this.svg || !this.isSvgDirtyLocation) {
|
|
157
210
|
return;
|
|
158
211
|
}
|
|
159
212
|
this.isSvgDirtyLocation = false;
|
|
160
|
-
|
|
161
|
-
|
|
213
|
+
var sizew = this.svgSize.x;
|
|
214
|
+
var sizeh = this.svgSize.y;
|
|
215
|
+
if (this.fixedSize) {
|
|
216
|
+
sizew = mxObj.screenCoordLong2Doc(sizew);
|
|
217
|
+
sizeh = mxObj.screenCoordLong2Doc(sizeh);
|
|
218
|
+
}
|
|
219
|
+
this.svg.position.x = this.svgPos.x - sizew * this.svgAlignmentRatio.x;
|
|
220
|
+
this.svg.position.y = this.svgPos.y - sizeh * this.svgAlignmentRatio.y;
|
|
162
221
|
};
|
|
163
222
|
MxDbSVG.prototype.dwgIn = function (obj) {
|
|
164
223
|
var _this = this;
|
|
165
224
|
this.onDwgIn(obj);
|
|
166
|
-
|
|
225
|
+
this.fixedSize = obj['fixedSize'];
|
|
226
|
+
if (this.fixedSize) {
|
|
227
|
+
// svg = null,重新加载svg.
|
|
228
|
+
this.svg = null;
|
|
229
|
+
}
|
|
230
|
+
else if (obj.type == MxType_1.default.MxCloneType.kClone && obj['svg']) {
|
|
167
231
|
this.svg = obj['svg'].clone();
|
|
168
232
|
}
|
|
169
233
|
this.svgPos.copy(obj['svgPos']);
|
|
@@ -173,6 +237,7 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
173
237
|
this.isSvgDirtyLocation = true;
|
|
174
238
|
if (!this.svg)
|
|
175
239
|
this.isLoadFromPath = true;
|
|
240
|
+
this.svgBoxSize = null;
|
|
176
241
|
var aryText = obj['txts'];
|
|
177
242
|
this.aryText = [];
|
|
178
243
|
aryText.forEach(function (txt) {
|
|
@@ -182,6 +247,7 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
182
247
|
copyTxt.txtPos.copy(txt.txtPos);
|
|
183
248
|
_this.aryText.push(copyTxt);
|
|
184
249
|
});
|
|
250
|
+
this.svgRotate = obj['svgRotate'];
|
|
185
251
|
return true;
|
|
186
252
|
};
|
|
187
253
|
MxDbSVG.prototype.dwgOut = function (obj) {
|
|
@@ -194,6 +260,8 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
194
260
|
obj['svgSize'] = this.svgSize;
|
|
195
261
|
obj['svgAlignmentRatio'] = this.svgAlignmentRatio;
|
|
196
262
|
obj['txts'] = this.aryText;
|
|
263
|
+
obj['fixedSize'] = this.fixedSize;
|
|
264
|
+
obj['svgRotate'] = this.svgRotate;
|
|
197
265
|
return obj;
|
|
198
266
|
};
|
|
199
267
|
MxDbSVG.prototype.create = function () {
|
|
@@ -202,9 +270,11 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
202
270
|
MxDbSVG.prototype.transformBy = function (mat) {
|
|
203
271
|
this.svgPos.applyMatrix4(mat);
|
|
204
272
|
this.isSvgDirtyLocation = true;
|
|
205
|
-
this.
|
|
206
|
-
|
|
207
|
-
|
|
273
|
+
if (!this.fixedSize) {
|
|
274
|
+
this.aryText.forEach(function (txt) {
|
|
275
|
+
txt.txtPos.applyMatrix4(mat);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
208
278
|
};
|
|
209
279
|
MxDbSVG.prototype.getTypeName = function () {
|
|
210
280
|
return 'MxDbSVG';
|
|
@@ -220,6 +290,51 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
220
290
|
});
|
|
221
291
|
}
|
|
222
292
|
};
|
|
293
|
+
MxDbSVG.prototype.onViewChange = function () {
|
|
294
|
+
if (!this.fixedSize) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
var mxObj = this.getMxObject();
|
|
298
|
+
if (mxObj == null)
|
|
299
|
+
return false;
|
|
300
|
+
if (this.svg) {
|
|
301
|
+
if (!this.svgBoxSize) {
|
|
302
|
+
this.svgBoxSize = new THREE.Vector3();
|
|
303
|
+
var box = new THREE.Box3().setFromObject(this.svg);
|
|
304
|
+
this.svgBoxSize.x = box.max.x - box.min.x;
|
|
305
|
+
this.svgBoxSize.y = box.max.y - box.min.y;
|
|
306
|
+
}
|
|
307
|
+
var sizew = mxObj.screenCoordLong2Doc(this.svgSize.x);
|
|
308
|
+
var sizeh = mxObj.screenCoordLong2Doc(this.svgSize.y);
|
|
309
|
+
this.svg.scale.x = sizew / this.svgBoxSize.x;
|
|
310
|
+
this.svg.scale.y = sizeh / this.svgBoxSize.y;
|
|
311
|
+
this.svg.scale.z = this.svg.scale.x;
|
|
312
|
+
this.isSvgDirtyLocation = true;
|
|
313
|
+
this.calcSvgPosition(mxObj);
|
|
314
|
+
}
|
|
315
|
+
var myThis = this;
|
|
316
|
+
this.aryText.forEach(function (txt) {
|
|
317
|
+
if (txt._txtObject && mxObj) {
|
|
318
|
+
var iSize = mxObj.screenCoordLong2Doc(txt.txtHeight);
|
|
319
|
+
if (iSize > 0.00001) {
|
|
320
|
+
if (txt._txtAspectRatio <= 0) {
|
|
321
|
+
txt._txtAspectRatio = txt._txtObject.scale.x / txt._txtObject.scale.y;
|
|
322
|
+
}
|
|
323
|
+
txt._txtObject.scale.set(txt._txtAspectRatio * iSize, iSize, 1);
|
|
324
|
+
if (txt.txtPos.x > 0)
|
|
325
|
+
txt._txtObject.position.x = myThis.svgPos.x + mxObj.screenCoordLong2Doc(txt.txtPos.x);
|
|
326
|
+
else
|
|
327
|
+
txt._txtObject.position.x = myThis.svgPos.x - mxObj.screenCoordLong2Doc(txt.txtPos.x);
|
|
328
|
+
if (txt.txtPos.y > 0)
|
|
329
|
+
txt._txtObject.position.y = myThis.svgPos.y + mxObj.screenCoordLong2Doc(txt.txtPos.y);
|
|
330
|
+
else
|
|
331
|
+
txt._txtObject.position.y = myThis.svgPos.y - mxObj.screenCoordLong2Doc(txt.txtPos.y);
|
|
332
|
+
txt._txtObject.updateMatrix();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
return true;
|
|
337
|
+
};
|
|
223
338
|
return MxDbSVG;
|
|
224
339
|
}(MxDbEntity_1.default));
|
|
225
340
|
exports.default = MxDbSVG;
|
|
@@ -15,6 +15,7 @@ var proxy_1 = require("../../tools/proxy");
|
|
|
15
15
|
var MxDrawObject_1 = require("../MxDrawObject");
|
|
16
16
|
var store_1 = require("../store/store");
|
|
17
17
|
var useCanvasResizeListener_1 = require("../useCanvasResizeListener");
|
|
18
|
+
var MrxDbgUiPrPoint_1 = require("../MrxDbgUiPrPoint");
|
|
18
19
|
/**
|
|
19
20
|
* MxFun 模块
|
|
20
21
|
* 导出库时已实例化,只需要调用实例方法 例如:
|
|
@@ -576,6 +577,53 @@ var MxFun = /** @class */ (function () {
|
|
|
576
577
|
MxFun.prototype.addToCurrentSpace = function (ent) {
|
|
577
578
|
return this.getCurrentDraw().addMxEntity(ent);
|
|
578
579
|
};
|
|
580
|
+
/**
|
|
581
|
+
* 在图上选择一个对象。
|
|
582
|
+
* @param strPrompt 提示字符串
|
|
583
|
+
* @param filter 过滤条件
|
|
584
|
+
* @returns number 返回对象的id
|
|
585
|
+
* @example
|
|
586
|
+
* ```typescript
|
|
587
|
+
*
|
|
588
|
+
*
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
MxFun.prototype.selectEnt = function (strPrompt, filter) {
|
|
592
|
+
var _this = this;
|
|
593
|
+
if (filter === void 0) { filter = null; }
|
|
594
|
+
return new Promise(function (resolve, reject) {
|
|
595
|
+
var getPoint = new MrxDbgUiPrPoint_1.default();
|
|
596
|
+
getPoint.setMessage(strPrompt);
|
|
597
|
+
getPoint.go(function (status) {
|
|
598
|
+
if (status != 0) {
|
|
599
|
+
resolve(0);
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
var pt = getPoint.value();
|
|
603
|
+
var mxobj = _this.getCurrentDraw();
|
|
604
|
+
var aryFind = mxobj.findMxEntityAtPoint(pt);
|
|
605
|
+
var iFindId = 0;
|
|
606
|
+
while (true) {
|
|
607
|
+
if (aryFind.length == 0) {
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
var iLen = aryFind.length;
|
|
611
|
+
for (var i = 0; i < iLen; i++) {
|
|
612
|
+
var ent = aryFind[i];
|
|
613
|
+
if (filter) {
|
|
614
|
+
if (filter['type'] && filter['type'] != ent.getTypeName()) {
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
iFindId = ent.objectId();
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
resolve(iFindId);
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
};
|
|
579
627
|
return MxFun;
|
|
580
628
|
}());
|
|
581
629
|
exports.default = MxFun;
|
|
@@ -5328,10 +5328,10 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
5328
5328
|
l.renderOrder = this.iRenderOrder, this.drawEntity(l), this.drawSelectLine(r, a);
|
|
5329
5329
|
}
|
|
5330
5330
|
else
|
|
5331
|
-
this.drawEntity(u.MxThreeJS.createLine(r, a, this.iColor, this.opacity)); }, d.prototype.drawCircle = function (t, e) { this.drawEntity(u.MxThreeJS.createCircle(t, e, this.iColor)); }, d.prototype.drawText = function (t, e, n, i) { var r = u.MxThreeJS.creatTextSprite(t, i, e, n, this.iColor); this.drawEntity(r); }, d.prototype.setupForEntity = function (t) { this.iColor = t.getColor(), this.iRenderOrder = t.getRenderOrder(), this.opacity = t.opacity; }, d);
|
|
5331
|
+
this.drawEntity(u.MxThreeJS.createLine(r, a, this.iColor, this.opacity)); }, d.prototype.drawCircle = function (t, e) { this.drawEntity(u.MxThreeJS.createCircle(t, e, this.iColor)); }, d.prototype.drawText = function (t, e, n, i) { var r = u.MxThreeJS.creatTextSprite(t, i, e, n, this.iColor); return this.drawEntity(r), r; }, d.prototype.setupForEntity = function (t) { this.iColor = t.getColor(), this.iRenderOrder = t.getRenderOrder(), this.opacity = t.opacity; }, d);
|
|
5332
5332
|
function d(t, e) { this.aryEntity = [], this.iColor = 16777215, this.dLineWidth = 0, this.lineWidthIsPixels = !0, this.iRenderOrder = s.MxData.iMxEntityRenderOrder, this.worldDrawType = 1, this.widthMaterial = null, this.dDashArray = 0, this.dDashRatio = 0, this.opacity = 1, this.mxObj = t, this.worldDrawType = e; }
|
|
5333
5333
|
n.McGiWorldDraw = l;
|
|
5334
|
-
var p, f = (r(m, p = l), m.prototype.setCurEntityId = function (t) { this.curEntityId = t; }, m.prototype.drawEntity = function (t) { }, m.prototype.drawText = function (t, e, n, i) { }, m.prototype.drawSelectLine = function (t, e, n, i) { }, m.prototype.isValid = function () { return 0 != this.curEntityId || (console.log("this.curEntityId == 0"), !1); }, m.prototype.drawLine = function (t, e, n, i) { var r, a; this.isValid() && (t instanceof Object && e instanceof Object ? (r = t, a = e) : "number" == typeof t && "number" == typeof e && (r = new c.Vector3(t, e, 0), a = new c.Vector3(n, i, 0)), this.selectManager.addLineDisplay(this.curEntityId, r, a)); }, m.prototype.drawCircle = function (t, e) { this.isValid() && this.selectManager.addCircleDisplay(this.curEntityId, t, e); }, m.prototype.drawLines = function (t) { if (!(t.length < 2))
|
|
5334
|
+
var p, f = (r(m, p = l), m.prototype.setCurEntityId = function (t) { this.curEntityId = t; }, m.prototype.drawEntity = function (t) { }, m.prototype.drawText = function (t, e, n, i) { return null; }, m.prototype.drawSelectLine = function (t, e, n, i) { }, m.prototype.isValid = function () { return 0 != this.curEntityId || (console.log("this.curEntityId == 0"), !1); }, m.prototype.drawLine = function (t, e, n, i) { var r, a; this.isValid() && (t instanceof Object && e instanceof Object ? (r = t, a = e) : "number" == typeof t && "number" == typeof e && (r = new c.Vector3(t, e, 0), a = new c.Vector3(n, i, 0)), this.selectManager.addLineDisplay(this.curEntityId, r, a)); }, m.prototype.drawCircle = function (t, e) { this.isValid() && this.selectManager.addCircleDisplay(this.curEntityId, t, e); }, m.prototype.drawLines = function (t) { if (!(t.length < 2))
|
|
5335
5335
|
for (var e = t.length, n = 0; n < e - 1; n++)
|
|
5336
5336
|
this.selectManager.addLineDisplay(this.curEntityId, t[n], t[n + 1]); }, m);
|
|
5337
5337
|
function m(t, e) { var n = p.call(this, t, a.kSelectDraw) || this; return n.selectManager = e, n.curEntityId = 0, n; }
|
|
@@ -5973,7 +5973,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
5973
5973
|
}, { "./MxFun": 45, "./MxJigCmdManager": 48, "./MxType": 60, "./MxUiVue": 64 }], 34: [function (t, e, n) {
|
|
5974
5974
|
"use strict";
|
|
5975
5975
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxDbDatabase = void 0;
|
|
5976
|
-
var o = t("three"), i = t("./MxFun"), c = t("./MxDbEntity"), r = t("./MxDbEntityGrip"), a = t("./MxDbEntitySelect"), u = t("./MxManager"), s = t("./MxType"), l = (h.prototype.getAllEntity = function () { return this.mapIdToEntity; }, h.prototype.upDirtyDisplay = function () { var e = !1; return this.mapIdToEntity.forEach(function (t) { t.getDirtyDisplay() && (t.upDisplay(), t.setDirtyDisplay(!1), e = !0); }), e; }, h.prototype.saveJson = function () { var t = { ver: 1 }, e = new o.Vector3(0, 0, 0), n = new o.Vector3(this.mxObj.getViewWidth(), this.mxObj.getViewHeight(), 0), i =
|
|
5976
|
+
var o = t("three"), i = t("./MxFun"), c = t("./MxDbEntity"), r = t("./MxDbEntityGrip"), a = t("./MxDbEntitySelect"), u = t("./MxManager"), s = t("./MxType"), l = (h.prototype.getAllEntity = function () { return this.mapIdToEntity; }, h.prototype.upDirtyDisplay = function () { var e = !1; return this.mapIdToEntity.forEach(function (t) { t.getDirtyDisplay() && (t.upDisplay(), t.setDirtyDisplay(!1), e = !0); }), e; }, h.prototype.onViewChange = function () { var e = !1; return this.mapIdToEntity.forEach(function (t) { t.onViewChange() && (e = !0); }), e; }, h.prototype.saveJson = function () { var t = { ver: 1 }, e = new o.Vector3(0, 0, 0), n = new o.Vector3(this.mxObj.getViewWidth(), this.mxObj.getViewHeight(), 0), i = this.mxObj.screenCoord2Doc(e.x, e.y, 0), r = this.mxObj.screenCoord2Doc(n.x, n.y, 0); t.view = { ptView1: i, ptView2: r }; var a = []; return this.mapIdToEntity.forEach(function (t) { var e = t.getUserObject(), n = { type: s.MxType.MxCloneType.kMxFileClone }; e.dwgOut(n), n.TypeName = e.getTypeName(), a.push(n); }), t.entitys = a, JSON.stringify(t); }, h.prototype.loadJson = function (t) { var e = JSON.parse(t); if (e.view) {
|
|
5977
5977
|
var n = e.view;
|
|
5978
5978
|
this.mxObj.zoomW(n.ptView1, n.ptView2, !1);
|
|
5979
5979
|
} for (var i = e.entitys, r = i.length, a = 0; a < r; a++) {
|
|
@@ -5989,7 +5989,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
5989
5989
|
}, { "./MxDbEntity": 35, "./MxDbEntityGrip": 36, "./MxDbEntitySelect": 37, "./MxFun": 45, "./MxManager": 51, "./MxType": 60, three: 19 }], 35: [function (t, e, n) {
|
|
5990
5990
|
"use strict";
|
|
5991
5991
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxDbEntity = n.MxDbEntityClassHierarchy = n.MxDbEntityUserObject = void 0;
|
|
5992
|
-
var s = t("three"), l = t("./McGiWorldDraw"), i = t("./MxManager"), c = t("./MxTools"), r = t("./MxType"), a = (o.prototype.getTypeName = function () { return ""; }, o.prototype.getImp = function () { return this.MxDbEntityImp; }, o.prototype.upDisplay = function () { var t = this.getImp(); return !!t && t.upDisplay(); }, o.prototype.erase = function () { var t = this.getImp(); return !!t && t.erase(); }, o.prototype.setColor = function (t) { this.iColor = t; }, o.prototype.getColor = function () { return this.iColor; }, o.prototype.setRenderOrder = function (t) { this.iRenderOrder = t; }, o.prototype.getRenderOrder = function () { return this.iRenderOrder; }, o.prototype.dwgIn = function (t) { return this.iColor = t.iColor, this.iRenderOrder = t.iRenderOrder, this.opacity = t.opacity, this.visible = t.visible, !0; }, o.prototype.dwgOut = function (t) { return t.iColor = this.iColor, t.iRenderOrder = this.iRenderOrder, t.opacity = this.opacity, t.visible = this.visible, t; }, o.prototype.clone = function (t) { var e = this.create(), n = { type: t || r.MxType.MxCloneType.kClone }; return this.dwgOut(n), e.dwgIn(n), e; }, o.prototype.init = function () { i.MxManager.getMxDbEntityClassHierarchy().init(this); }, o.prototype.transformBy = function (t) { }, o.prototype.objectId = function () { var t = this.getImp(); return t ? t.objectId() : 0; }, o);
|
|
5992
|
+
var s = t("three"), l = t("./McGiWorldDraw"), i = t("./MxManager"), c = t("./MxTools"), r = t("./MxType"), a = (o.prototype.getTypeName = function () { return ""; }, o.prototype.getMxObject = function () { var t = this.getImp(); return t ? t.getMxObject() : null; }, o.prototype.onViewChange = function () { return !1; }, o.prototype.getImp = function () { return this.MxDbEntityImp; }, o.prototype.upDisplay = function () { var t = this.getImp(); return !!t && t.upDisplay(); }, o.prototype.erase = function () { var t = this.getImp(); return !!t && t.erase(); }, o.prototype.setColor = function (t) { this.iColor = t; }, o.prototype.getColor = function () { return this.iColor; }, o.prototype.setRenderOrder = function (t) { this.iRenderOrder = t; }, o.prototype.getRenderOrder = function () { return this.iRenderOrder; }, o.prototype.dwgIn = function (t) { return this.iColor = t.iColor, this.iRenderOrder = t.iRenderOrder, this.opacity = t.opacity, this.visible = t.visible, !0; }, o.prototype.dwgOut = function (t) { return t.iColor = this.iColor, t.iRenderOrder = this.iRenderOrder, t.opacity = this.opacity, t.visible = this.visible, t; }, o.prototype.clone = function (t) { var e = this.create(), n = { type: t || r.MxType.MxCloneType.kClone }; return this.dwgOut(n), e.dwgIn(n), e; }, o.prototype.init = function () { i.MxManager.getMxDbEntityClassHierarchy().init(this); }, o.prototype.transformBy = function (t) { }, o.prototype.objectId = function () { var t = this.getImp(); return t ? t.objectId() : 0; }, o);
|
|
5993
5993
|
function o() { this.iColor = 16777215, this.iRenderOrder = i.MxData.iMxEntityRenderOrder, this.opacity = 1, this.visible = !0; }
|
|
5994
5994
|
n.MxDbEntityUserObject = a;
|
|
5995
5995
|
var u = (h.prototype.init = function (t) { var e = t.getTypeName(); this.mapType2Create.get(e) && console.log("MxError:already has this class name " + e), this.mapType2Create.set(e, t); }, h.prototype.createMxEntity = function (t) { var e = this.mapType2Create.get(t); return e ? e.create() : null; }, h);
|
|
@@ -6010,7 +6010,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
6010
6010
|
}
|
|
6011
6011
|
}
|
|
6012
6012
|
else
|
|
6013
|
-
c.MxTools.MxASSERT(!1, "this.userObject == null"); }, p.prototype.worldDraw = function (t) { this.userObject.worldDraw(t); }, p.prototype.getGripPoints = function () { return this.userObject.getGripPoints(); }, p.prototype.getUserObject = function () { return this.userObject; }, p.prototype.clone = function (t) { var e = new p; return e.initUserObject(this.userObject.clone(t)), e; }, p.prototype.transformBy = function (t) { this.userObject.transformBy(t); }, p.prototype.setColor = function (t) { this.userObject.setColor(t); }, p.prototype.getColor = function () { return this.userObject.getColor(); }, p);
|
|
6013
|
+
c.MxTools.MxASSERT(!1, "this.userObject == null"); }, p.prototype.worldDraw = function (t) { this.userObject.worldDraw(t); }, p.prototype.getGripPoints = function () { return this.userObject.getGripPoints(); }, p.prototype.getUserObject = function () { return this.userObject; }, p.prototype.clone = function (t) { var e = new p; return e.initUserObject(this.userObject.clone(t)), e; }, p.prototype.transformBy = function (t) { this.userObject.transformBy(t); }, p.prototype.setColor = function (t) { this.userObject.setColor(t); }, p.prototype.getColor = function () { return this.userObject.getColor(); }, p.prototype.getMxObject = function () { return this.mxDatabase ? this.mxDatabase.getMxObject() : null; }, p.prototype.onViewChange = function () { return !!this.userObject && this.userObject.onViewChange(); }, p);
|
|
6014
6014
|
function p() { this.threeObjectGroup = null, this.userObject = null, this.mxDatabase = null, this.isDirtyDisplay = !1, this.id = 0; }
|
|
6015
6015
|
n.MxDbEntity = d;
|
|
6016
6016
|
}, { "./McGiWorldDraw": 21, "./MxManager": 51, "./MxTools": 59, "./MxType": 60, three: 19 }], 36: [function (t, e, n) {
|
|
@@ -6191,7 +6191,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
6191
6191
|
return !1; this.reInit(), this._devicePixelRatio = window.devicePixelRatio, this._openFile = t, this._openFileExtName = t.substring(t.lastIndexOf(".") + 1), this._iniParam = []; var e = new Array; return e.push("file"), e.push(this._openFile), this._iniParam.push(e), this.onLoad(), !0; }, _.prototype.create = function (t, e) { if (this._callCreateCanvasImageData = void 0, this._devicePixelRatio = window.devicePixelRatio, this._openFile = e, this._iniParam = u.MxFun.getUrlParams(), this._openFileExtName = e.substring(e.lastIndexOf(".") + 1), "" != this._openFile && this._runMode != s.kMxCAD && this._runMode != s.kMxCADBrowseApp) {
|
|
6192
6192
|
var n = new Array;
|
|
6193
6193
|
n.push("file"), n.push(this._openFile), this._iniParam.push(n);
|
|
6194
|
-
} "" != this._userIdentitySign && (this.addInitParam("userIdentitySign", this._userIdentitySign), this.addInitParam("userRandomToken", this._userRandomToken)), this.addInitParam("runMode", this._runMode == s.kMxCAD || this._runMode == s.kMxCADBrowseApp ? "mxcad" : "browse"), this._runMode == s.kMxCAD || this._runMode == s.kMxCADBrowseApp ? ("empty" == this._openFile && (this._openFile = ""), this._mxCAD = new g.MxCADObject(this)) : this._mxCAD = null, this._userCanvas = t; var i = window.innerWidth, r = window.innerHeight; null != t && (i = t.clientWidth, r = t.clientHeight), this._viewWidth = i, this._viewHeight = r, this.m_mxDatabase.getSelectManager().setCanvasSize(i, r), this.onInitThreejs(), this.onCreate(), this.m_mxDatabase.init(this), this._parentDocObject = new c.Object3D, this.scene.add(this._parentDocObject), this.threejsselectObjects = new c.Object3D, this.scene.add(this.threejsselectObjects), this._objectsOsnap = new y.MxDrawObjectOsnap(this), this._is2d && (this._runMode != s.kMxCAD && this._runMode != s.kMxCADBrowseApp || (this.controls.mouseButtons.LEFT = -1, this.controls.mouseButtons.RIGHT = -1, this.controls.mouseButtons.MIDDLE = c.MOUSE.PAN)), this._select = new d.MxSelect(this, this.getCanvas()), this._select.enabled = u.MxFun.isEnableSelect(), this._select.init(), this._is2d || (this._select.enabled = !1), this._runMode != s.kBrowse && (this._select.enabled = !1), p.MxManager.add(this), p.MxManager.setCurrentMx(this); var a = this; if (this.controls.addEventListener("change", function () { f.MxJigCmdManager.OnThreeControlsChage(), a.callEvent("viewchange"); var t = a.getMxCAD(); t && t.getGrip().onControlsChage(), a.updateDisplay(); }), this.updateDisplay(), null == t)
|
|
6194
|
+
} "" != this._userIdentitySign && (this.addInitParam("userIdentitySign", this._userIdentitySign), this.addInitParam("userRandomToken", this._userRandomToken)), this.addInitParam("runMode", this._runMode == s.kMxCAD || this._runMode == s.kMxCADBrowseApp ? "mxcad" : "browse"), this._runMode == s.kMxCAD || this._runMode == s.kMxCADBrowseApp ? ("empty" == this._openFile && (this._openFile = ""), this._mxCAD = new g.MxCADObject(this)) : this._mxCAD = null, this._userCanvas = t; var i = window.innerWidth, r = window.innerHeight; null != t && (i = t.clientWidth, r = t.clientHeight), this._viewWidth = i, this._viewHeight = r, this.m_mxDatabase.getSelectManager().setCanvasSize(i, r), this.onInitThreejs(), this.onCreate(), this.m_mxDatabase.init(this), this._parentDocObject = new c.Object3D, this.scene.add(this._parentDocObject), this.threejsselectObjects = new c.Object3D, this.scene.add(this.threejsselectObjects), this._objectsOsnap = new y.MxDrawObjectOsnap(this), this._is2d && (this._runMode != s.kMxCAD && this._runMode != s.kMxCADBrowseApp || (this.controls.mouseButtons.LEFT = -1, this.controls.mouseButtons.RIGHT = -1, this.controls.mouseButtons.MIDDLE = c.MOUSE.PAN)), this._select = new d.MxSelect(this, this.getCanvas()), this._select.enabled = u.MxFun.isEnableSelect(), this._select.init(), this._is2d || (this._select.enabled = !1), this._runMode != s.kBrowse && (this._select.enabled = !1), p.MxManager.add(this), p.MxManager.setCurrentMx(this); var a = this; if (this.controls.addEventListener("change", function () { f.MxJigCmdManager.OnThreeControlsChage(), a.callEvent("viewchange"), a.m_mxDatabase.onViewChange(); var t = a.getMxCAD(); t && t.getGrip().onControlsChage(), a.updateDisplay(); }), this.updateDisplay(), null == t)
|
|
6195
6195
|
window.addEventListener("resize", function () { a._viewWidth = window.innerWidth, a._viewHeight = window.innerHeight, a.onResizeImp(), a.updateDisplay(); }, !1);
|
|
6196
6196
|
else {
|
|
6197
6197
|
var o = function () { if (a._viewWidth = a._userCanvas.clientWidth, a._viewHeight = a._userCanvas.clientHeight, null != a._event.onResize) {
|
|
@@ -6367,7 +6367,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
6367
6367
|
else {
|
|
6368
6368
|
var s = Math.abs(this._minDisplayPoint.x - this._maxDisplayPoint.x), l = Math.abs(this._minDisplayPoint.y - this._maxDisplayPoint.y);
|
|
6369
6369
|
s / l < n / i ? (a = .5 * l, o = n / i, r.left = -a * o, r.right = a * o, r.top = a, r.bottom = -a) : (a = .5 * s, o = i / n, r.left = -a, r.right = a, r.top = a * o, r.bottom = -a * o), r.updateProjectionMatrix();
|
|
6370
|
-
} this.renderer.setSize(n, i), this.updataClipMaterial(), this.updataCameraView(n, i), this.callEvent("viewsizechange", { width: n, height: i }), this.callEvent("viewchange"), this.m_mxDatabase.getSelectManager().setCanvasSize(n, i); }, d);
|
|
6370
|
+
} this.renderer.setSize(n, i), this.updataClipMaterial(), this.updataCameraView(n, i), this.callEvent("viewsizechange", { width: n, height: i }), this.callEvent("viewchange"), this.m_mxDatabase.getSelectManager().setCanvasSize(n, i), this.m_mxDatabase.onViewChange(); }, d);
|
|
6371
6371
|
function d() { var t = null !== a && a.apply(this, arguments) || this; return t._minDisplayPoint = null, t._maxDisplayPoint = null, t.is3DDraw = o.MxFun.is3DDwg(), t; }
|
|
6372
6372
|
n.MxDrawObject2d = h;
|
|
6373
6373
|
}, { "./MxDrawObject": 41, "./MxFun": 45, "./MxMaterial": 52, "./MxNetData": 53, three: 19, "three-orbitcontrols": 17 }], 43: [function (t, e, n) {
|
|
@@ -7135,7 +7135,7 @@ function mxfun() { !function a(o, s, l) { function c(e, t) { if (!s[e]) {
|
|
|
7135
7135
|
return !1; d.OnMxEvent(t); };
|
|
7136
7136
|
}, { "./MxCmdRunManager": 33, "./MxFun": 45, "./MxJigCmdManager": 48, "./MxTools": 59 }], 65: [function (t, e, n) {
|
|
7137
7137
|
"use strict";
|
|
7138
|
-
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxBulid = void 0, window.MxDrawVersion = "1.0(2022-04-
|
|
7138
|
+
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxBulid = void 0, window.MxDrawVersion = "1.0(2022-04-24 16:08)", (n.MxBulid || (n.MxBulid = {})).getVersion = function () { return window.MxDrawVersion ? window.MxDrawVersion : "inalid version"; };
|
|
7139
7139
|
}, {}], 66: [function (t, e, n) {
|
|
7140
7140
|
"use strict";
|
|
7141
7141
|
Object.defineProperty(n, "__esModule", { value: !0 }), n.MxWindowsEvent = void 0;
|