mxdraw 0.1.7 → 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 +53 -12
- package/dist/lib/MxModule/MxDbImage/MxDbImage.js +2 -1
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +120 -96
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +189 -57
- package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +21 -0
- package/dist/lib/MxModule/MxDbSVGText/index.js +5 -0
- package/dist/lib/MxModule/MxFun/MxFun.js +65 -0
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +2 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +64 -48
- package/dist/lib/mxdraw.js +4 -1
- package/dist/lib/tools/dynamicImport/index.js +5 -5
- package/dist/lib/types/MxCADObject.js +0 -1
- package/dist/mxdraw.es5.js +3 -3
- package/dist/mxdraw.es5.js.map +1 -1
- package/dist/mxdraw.umd.js +3 -3
- package/dist/mxdraw.umd.js.map +1 -1
- package/dist/types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts +1 -1
- package/dist/types/MxModule/McGiWorldDraw/index.d.ts +1 -1
- package/dist/types/MxModule/McGiWorldDrawType/index.d.ts +1 -1
- package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +33 -4
- package/dist/types/MxModule/MxDbRect/MxDbRect.d.ts +15 -34
- package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +9 -9
- package/dist/types/MxModule/MxDbSVGText/MxDbSVGText.d.ts +10 -0
- package/dist/types/MxModule/MxDbSVGText/index.d.ts +3 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +24 -0
- package/dist/types/mxdraw.d.ts +3 -1
- package/dist/types/types/MxCADObject.d.ts +5 -5
- package/package.json +1 -1
|
@@ -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,9 +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
|
-
var
|
|
26
|
+
var MxDbSVGText_1 = require("../MxDbSVGText");
|
|
27
27
|
var MxThreeJS_1 = require("../MxThreeJS");
|
|
28
28
|
var MxType_1 = require("../MxType");
|
|
29
29
|
/**
|
|
@@ -34,68 +34,124 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
34
34
|
function MxDbSVG() {
|
|
35
35
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
36
36
|
_this.svgPos = new THREE.Vector3();
|
|
37
|
+
_this.svg = null;
|
|
37
38
|
_this.svgPath = '';
|
|
38
39
|
_this.svgSize = new THREE.Vector2(50, 50);
|
|
39
40
|
_this.svgAlignmentRatio = new THREE.Vector2(0, 0);
|
|
41
|
+
_this.svgRotate = 0;
|
|
40
42
|
_this.isSvgDirtyLocation = false;
|
|
41
43
|
_this.isLoadFromPath = true;
|
|
42
|
-
_this.
|
|
43
|
-
_this.
|
|
44
|
-
|
|
44
|
+
_this.aryText = [];
|
|
45
|
+
_this.svgBoxSize = null;
|
|
46
|
+
// 固定尺寸,图片和文字大小,取屏幕像素绘图单位。
|
|
47
|
+
_this.fixedSize = false;
|
|
45
48
|
return _this;
|
|
46
49
|
}
|
|
47
50
|
MxDbSVG.prototype.worldDraw = function (pWorldDraw) {
|
|
48
|
-
this
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
var _this = this;
|
|
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);
|
|
52
59
|
}
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
var
|
|
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);
|
|
57
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
|
+
});
|
|
58
103
|
if (this.svg) {
|
|
59
104
|
pWorldDraw.drawEntity(this.svg);
|
|
60
105
|
}
|
|
61
106
|
else {
|
|
62
107
|
if (this.svgPath.length > 0 && this.isLoadFromPath) {
|
|
63
108
|
var myThis_1 = this;
|
|
109
|
+
var mxobj_1 = pWorldDraw.getMxObject();
|
|
64
110
|
MxThreeJS_1.default.loadSVG(this.svgPath, undefined, function (obj) {
|
|
65
111
|
if (obj) {
|
|
66
112
|
var box = new THREE.Box3().setFromObject(obj);
|
|
67
|
-
|
|
68
|
-
|
|
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;
|
|
69
120
|
obj.scale.z = obj.scale.x;
|
|
121
|
+
obj.rotateZ(myThis_1.svgRotate);
|
|
70
122
|
myThis_1.isSvgDirtyLocation = true;
|
|
123
|
+
var color_1 = new THREE.Color(_this.color);
|
|
71
124
|
obj.traverse(function (child) {
|
|
72
125
|
if (child.material) {
|
|
126
|
+
child.material = child.material.clone();
|
|
73
127
|
child.material.transparent = true;
|
|
128
|
+
child.material.color = color_1;
|
|
74
129
|
}
|
|
75
130
|
});
|
|
76
131
|
//this.svgPos.multiply
|
|
77
132
|
myThis_1.svg = obj;
|
|
78
|
-
myThis_1.setNeedUpdateDisplay(
|
|
79
|
-
|
|
133
|
+
myThis_1.setNeedUpdateDisplay();
|
|
134
|
+
mxobj_1.updateDisplay();
|
|
80
135
|
}
|
|
81
136
|
myThis_1.isLoadFromPath = false;
|
|
82
137
|
});
|
|
83
138
|
}
|
|
84
139
|
}
|
|
85
|
-
pWorldDraw.drawSelectLine(pt1
|
|
86
|
-
pWorldDraw.drawSelectLine(
|
|
140
|
+
pWorldDraw.drawSelectLine(pt1, pt2);
|
|
141
|
+
pWorldDraw.drawSelectLine(pt3, pt4);
|
|
87
142
|
}
|
|
88
143
|
else {
|
|
89
|
-
pWorldDraw.drawLine(pt1
|
|
90
|
-
pWorldDraw.drawLine(
|
|
91
|
-
pWorldDraw.drawLine(pt2
|
|
92
|
-
pWorldDraw.drawLine(
|
|
144
|
+
pWorldDraw.drawLine(pt1, pt3);
|
|
145
|
+
pWorldDraw.drawLine(pt3, pt2);
|
|
146
|
+
pWorldDraw.drawLine(pt2, pt4);
|
|
147
|
+
pWorldDraw.drawLine(pt4, pt1);
|
|
93
148
|
}
|
|
94
149
|
};
|
|
95
150
|
MxDbSVG.prototype.setSvgPath = function (path) {
|
|
96
151
|
this.svgPath = path;
|
|
97
152
|
this.svg = null;
|
|
98
153
|
this.isLoadFromPath = true;
|
|
154
|
+
this.svgBoxSize = null;
|
|
99
155
|
};
|
|
100
156
|
MxDbSVG.prototype.getSvgPath = function () {
|
|
101
157
|
return this.svgPath;
|
|
@@ -121,24 +177,16 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
121
177
|
MxDbSVG.prototype.getSvgAlignmentRatio = function () {
|
|
122
178
|
return this.svgAlignmentRatio;
|
|
123
179
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
MxDbSVG.prototype.setText = function (txt) {
|
|
132
|
-
this.txt = txt;
|
|
133
|
-
};
|
|
134
|
-
MxDbSVG.prototype.getText = function () {
|
|
135
|
-
return this.txt;
|
|
136
|
-
};
|
|
137
|
-
MxDbSVG.prototype.setTextPostion = function (pos) {
|
|
138
|
-
this.txtPos = pos;
|
|
180
|
+
MxDbSVG.prototype.getText = function (index) {
|
|
181
|
+
if (index < this.aryText.length) {
|
|
182
|
+
return this.aryText[index];
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
139
187
|
};
|
|
140
|
-
MxDbSVG.prototype.
|
|
141
|
-
|
|
188
|
+
MxDbSVG.prototype.addText = function (txt) {
|
|
189
|
+
this.aryText.push(txt);
|
|
142
190
|
};
|
|
143
191
|
MxDbSVG.prototype.getGripPoints = function () {
|
|
144
192
|
var ret = [];
|
|
@@ -148,22 +196,38 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
148
196
|
MxDbSVG.prototype.moveGripPointsAt = function (index, offset) {
|
|
149
197
|
if (index == 0) {
|
|
150
198
|
this.svgPos.add(offset);
|
|
151
|
-
this.
|
|
199
|
+
if (!this.fixedSize) {
|
|
200
|
+
this.aryText.forEach(function (txt) {
|
|
201
|
+
txt.txtPos.add(offset);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
152
204
|
}
|
|
153
205
|
this.isSvgDirtyLocation = true;
|
|
154
206
|
return true;
|
|
155
207
|
};
|
|
156
|
-
MxDbSVG.prototype.calcSvgPosition = function () {
|
|
208
|
+
MxDbSVG.prototype.calcSvgPosition = function (mxObj) {
|
|
157
209
|
if (!this.svg || !this.isSvgDirtyLocation) {
|
|
158
210
|
return;
|
|
159
211
|
}
|
|
160
212
|
this.isSvgDirtyLocation = false;
|
|
161
|
-
|
|
162
|
-
|
|
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;
|
|
163
221
|
};
|
|
164
222
|
MxDbSVG.prototype.dwgIn = function (obj) {
|
|
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,9 +237,17 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
173
237
|
this.isSvgDirtyLocation = true;
|
|
174
238
|
if (!this.svg)
|
|
175
239
|
this.isLoadFromPath = true;
|
|
176
|
-
this.
|
|
177
|
-
|
|
178
|
-
this.
|
|
240
|
+
this.svgBoxSize = null;
|
|
241
|
+
var aryText = obj['txts'];
|
|
242
|
+
this.aryText = [];
|
|
243
|
+
aryText.forEach(function (txt) {
|
|
244
|
+
var copyTxt = new MxDbSVGText_1.default();
|
|
245
|
+
copyTxt.txt = txt.txt;
|
|
246
|
+
copyTxt.txtHeight = txt.txtHeight;
|
|
247
|
+
copyTxt.txtPos.copy(txt.txtPos);
|
|
248
|
+
_this.aryText.push(copyTxt);
|
|
249
|
+
});
|
|
250
|
+
this.svgRotate = obj['svgRotate'];
|
|
179
251
|
return true;
|
|
180
252
|
};
|
|
181
253
|
MxDbSVG.prototype.dwgOut = function (obj) {
|
|
@@ -187,9 +259,9 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
187
259
|
obj['svgPos'] = this.svgPos;
|
|
188
260
|
obj['svgSize'] = this.svgSize;
|
|
189
261
|
obj['svgAlignmentRatio'] = this.svgAlignmentRatio;
|
|
190
|
-
obj['
|
|
191
|
-
obj['
|
|
192
|
-
obj['
|
|
262
|
+
obj['txts'] = this.aryText;
|
|
263
|
+
obj['fixedSize'] = this.fixedSize;
|
|
264
|
+
obj['svgRotate'] = this.svgRotate;
|
|
193
265
|
return obj;
|
|
194
266
|
};
|
|
195
267
|
MxDbSVG.prototype.create = function () {
|
|
@@ -197,12 +269,72 @@ var MxDbSVG = /** @class */ (function (_super) {
|
|
|
197
269
|
};
|
|
198
270
|
MxDbSVG.prototype.transformBy = function (mat) {
|
|
199
271
|
this.svgPos.applyMatrix4(mat);
|
|
200
|
-
this.txtPos.applyMatrix4(mat);
|
|
201
272
|
this.isSvgDirtyLocation = true;
|
|
273
|
+
if (!this.fixedSize) {
|
|
274
|
+
this.aryText.forEach(function (txt) {
|
|
275
|
+
txt.txtPos.applyMatrix4(mat);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
202
278
|
};
|
|
203
279
|
MxDbSVG.prototype.getTypeName = function () {
|
|
204
280
|
return 'MxDbSVG';
|
|
205
281
|
};
|
|
282
|
+
MxDbSVG.prototype.setColor = function (color) {
|
|
283
|
+
_super.prototype.setColor.call(this, color);
|
|
284
|
+
if (this.svg) {
|
|
285
|
+
var color_2 = new THREE.Color(this.color);
|
|
286
|
+
this.svg.traverse(function (child) {
|
|
287
|
+
if (child.material) {
|
|
288
|
+
child.material.color = color_2;
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
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
|
+
};
|
|
206
338
|
return MxDbSVG;
|
|
207
339
|
}(MxDbEntity_1.default));
|
|
208
340
|
exports.default = MxDbSVG;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
4
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
5
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
6
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
7
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
/** @module MxDbSVG*/
|
|
9
|
+
var THREE = require("three");
|
|
10
|
+
var MxDbSVGText = /** @class */ (function () {
|
|
11
|
+
function MxDbSVGText() {
|
|
12
|
+
this.txtPos = new THREE.Vector3();
|
|
13
|
+
this.txt = '';
|
|
14
|
+
this.txtHeight = 1;
|
|
15
|
+
this.color = undefined;
|
|
16
|
+
this._txtObject = null;
|
|
17
|
+
this._txtAspectRatio = -1;
|
|
18
|
+
}
|
|
19
|
+
return MxDbSVGText;
|
|
20
|
+
}());
|
|
21
|
+
exports.default = MxDbSVGText;
|
|
@@ -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
|
* 导出库时已实例化,只需要调用实例方法 例如:
|
|
@@ -59,6 +60,10 @@ var MxFun = /** @class */ (function () {
|
|
|
59
60
|
// canvasParent 未插入到文档
|
|
60
61
|
document.body.appendChild(canvasParent);
|
|
61
62
|
}
|
|
63
|
+
if (!useWebsocket && isNewFile) {
|
|
64
|
+
// 只有sockec方式,才能新建文件,这里暂是把isNewFile设置成 false
|
|
65
|
+
isNewFile = false;
|
|
66
|
+
}
|
|
62
67
|
// 设置样式
|
|
63
68
|
// canvasParent.style.width = '100%'
|
|
64
69
|
// canvasParent.style.height = '80vh'
|
|
@@ -559,6 +564,66 @@ var MxFun = /** @class */ (function () {
|
|
|
559
564
|
MxFun.prototype.openFile = function (sFile) {
|
|
560
565
|
return store_1.default.state.MxFun.openFile(sFile);
|
|
561
566
|
};
|
|
567
|
+
/**
|
|
568
|
+
* 添加一个MxDbEntity实体到当前绘图对象上。
|
|
569
|
+
* @param ent 实体对象
|
|
570
|
+
* @returns number 返回对象的id.
|
|
571
|
+
* @example
|
|
572
|
+
* ```typescript
|
|
573
|
+
*
|
|
574
|
+
*
|
|
575
|
+
* ```
|
|
576
|
+
*/
|
|
577
|
+
MxFun.prototype.addToCurrentSpace = function (ent) {
|
|
578
|
+
return this.getCurrentDraw().addMxEntity(ent);
|
|
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
|
+
};
|
|
562
627
|
return MxFun;
|
|
563
628
|
}());
|
|
564
629
|
exports.default = MxFun;
|
|
@@ -45,11 +45,13 @@ var MxDbImage_1 = require("../MxDbImage");
|
|
|
45
45
|
var MxDbSVG_1 = require("../MxDbSVG");
|
|
46
46
|
var MxDbAlignedDimension_1 = require("../MxDbAlignedDimension");
|
|
47
47
|
var MxDbLine_1 = require("../MxDbLine");
|
|
48
|
+
var MxDbRect_1 = require("../MxDbRect");
|
|
48
49
|
function rxInitMxEntity() {
|
|
49
50
|
new MxDbImage_1.default().rxInit();
|
|
50
51
|
new MxDbSVG_1.default().rxInit();
|
|
51
52
|
new MxDbAlignedDimension_1.default().rxInit();
|
|
52
53
|
new MxDbLine_1.default().rxInit();
|
|
54
|
+
new MxDbRect_1.default().rxInit();
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* 加载MxDraw库的核心代码 才能使用Mx的其他模块
|