mxdraw 0.1.16 → 0.1.21
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/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.js +128 -1
- package/dist/lib/MxModule/McEdGetPointWorldDrawObject/index.js +5 -1
- package/dist/lib/MxModule/McGeVector3d/McGeVector3d.js +2 -1
- package/dist/lib/MxModule/McGeVector3d/index.js +3 -1
- package/dist/lib/MxModule/McGiWorldDraw/McGiWorldDraw.js +3 -1
- package/dist/lib/MxModule/McGiWorldDraw/index.js +2 -1
- package/dist/lib/MxModule/McGiWorldDrawType/McGiWorldDrawType.js +19 -1
- package/dist/lib/MxModule/McGiWorldDrawType/index.js +4 -1
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/MrxDbgUiPrBaseReturn.js +31 -1
- package/dist/lib/MxModule/MrxDbgUiPrBaseReturn/index.js +5 -1
- package/dist/lib/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.js +159 -1
- package/dist/lib/MxModule/MrxDbgUiPrPoint/index.js +5 -1
- package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +213 -1
- package/dist/lib/MxModule/MxDbAlignedDimension/index.js +5 -1
- package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +258 -1
- package/dist/lib/MxModule/MxDbEntity/index.js +5 -1
- package/dist/lib/MxModule/MxDbImage/MxDbImage.js +160 -1
- package/dist/lib/MxModule/MxDbImage/index.js +5 -1
- package/dist/lib/MxModule/MxDbLine/MxDbLine.js +94 -1
- package/dist/lib/MxModule/MxDbLine/index.js +5 -1
- package/dist/lib/MxModule/MxDbPolyline/MxDbPolyline.js +97 -0
- package/dist/lib/MxModule/MxDbPolyline/index.js +5 -0
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +273 -1
- package/dist/lib/MxModule/MxDbRect/index.js +4 -1
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +419 -1
- package/dist/lib/MxModule/MxDbSVG/index.js +5 -1
- package/dist/lib/MxModule/MxDbSVGText/MxDbSVGText.js +21 -1
- package/dist/lib/MxModule/MxDbSVGText/index.js +5 -1
- package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +782 -1
- package/dist/lib/MxModule/MxDrawObject/index.js +5 -1
- package/dist/lib/MxModule/MxFilters/MxFilters.js +201 -1
- package/dist/lib/MxModule/MxFilters/index.js +4 -1
- package/dist/lib/MxModule/MxFun/MxFun.js +676 -1
- package/dist/lib/MxModule/MxFun/index.js +4 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +283 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +146 -1
- package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +1862 -1
- package/dist/lib/MxModule/MxThreeJS/index.js +7 -1
- package/dist/lib/MxModule/MxType/MxType.js +27 -1
- package/dist/lib/MxModule/MxType/index.js +4 -1
- package/dist/lib/MxModule/Mxassembly/Mxassembly.js +20 -1
- package/dist/lib/MxModule/Mxassembly/index.js +9 -1
- package/dist/lib/MxModule/loadCoreCode/index.js +5 -1
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +125 -1
- package/dist/lib/MxModule/loadCoreCode/mxUiData.js +312 -1
- package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1519 -1
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +7363 -1
- package/dist/lib/MxModule/store/PubsubClass.js +40 -1
- package/dist/lib/MxModule/store/StoreClass.js +73 -1
- package/dist/lib/MxModule/store/index.js +19 -1
- package/dist/lib/MxModule/store/store.js +25 -1
- package/dist/lib/MxModule/useCanvasResizeListener/index.js +5 -1
- package/dist/lib/MxModule/useCanvasResizeListener/useCanvasResizeListener.js +95 -1
- package/dist/lib/doc.js +38 -1
- package/dist/lib/mxdraw.js +67 -1
- package/dist/lib/tools/algorithm/math.js +16 -1
- package/dist/lib/tools/algorithm/random.js +13 -1
- package/dist/lib/tools/dom/create.js +47 -1
- package/dist/lib/tools/dynamicImport/index.js +243 -1
- package/dist/lib/tools/formatting/index.js +20 -1
- package/dist/lib/tools/proxy/index.js +17 -1
- package/dist/lib/tools/three/index.js +124 -1
- package/dist/lib/types/McEdGetPointWorldDrawObject.js +2 -1
- package/dist/lib/types/MrxDbgUiPrPoint.js +2 -1
- package/dist/lib/types/MxCADObject.js +2 -1
- package/dist/lib/types/MxDrawObject.js +2 -1
- package/dist/lib/types/MxFun.js +2 -1
- package/dist/lib/types/Mxassembly.js +2 -1
- package/dist/types/MxModule/McEdGetPointWorldDrawObject/McEdGetPointWorldDrawObjectClass.d.ts +1 -0
- package/dist/types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts +1 -0
- package/dist/types/MxModule/MrxDbgUiPrPoint/MrxDbgUiPrPointClass.d.ts +2 -1
- package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +1 -0
- package/dist/types/MxModule/MxDbLine/MxDbLine.d.ts +2 -2
- package/dist/types/MxModule/MxDbPolyline/MxDbPolyline.d.ts +21 -0
- package/dist/types/MxModule/MxDbPolyline/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +1 -0
- package/dist/types/MxModule/MxDbSVGText/MxDbSVGText.d.ts +1 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +7 -2
- package/dist/types/MxModule/MxThreeJS/MxThreeJS.d.ts +2 -0
- package/dist/types/MxModule/MxType/MxType.d.ts +1 -0
- package/dist/types/MxModule/loadCoreCode/mxUiData.d.ts +3 -3
- package/dist/types/MxModule/store/StoreClass.d.ts +10 -4
- package/dist/types/MxModule/store/store.d.ts +2 -2
- package/dist/types/mxdraw.d.ts +9 -2
- package/dist/types/types/MxFun.d.ts +6 -0
- package/package.json +1 -1
- package/dist/mxdraw.es5.js +0 -1
- package/dist/mxdraw.umd.js +0 -1
|
@@ -1 +1,419 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
4
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
5
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
6
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
7
|
+
/** @module MxDbSVG*/
|
|
8
|
+
var __extends = (this && this.__extends) || (function () {
|
|
9
|
+
var extendStatics = function (d, b) {
|
|
10
|
+
extendStatics = Object.setPrototypeOf ||
|
|
11
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
12
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
13
|
+
return extendStatics(d, b);
|
|
14
|
+
};
|
|
15
|
+
return function (d, b) {
|
|
16
|
+
if (typeof b !== "function" && b !== null)
|
|
17
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18
|
+
extendStatics(d, b);
|
|
19
|
+
function __() { this.constructor = d; }
|
|
20
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
21
|
+
};
|
|
22
|
+
})();
|
|
23
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
33
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
34
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
35
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
36
|
+
function step(op) {
|
|
37
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
38
|
+
while (_) try {
|
|
39
|
+
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;
|
|
40
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
41
|
+
switch (op[0]) {
|
|
42
|
+
case 0: case 1: t = op; break;
|
|
43
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
44
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
45
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
46
|
+
default:
|
|
47
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
50
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
51
|
+
if (t[2]) _.ops.pop();
|
|
52
|
+
_.trys.pop(); continue;
|
|
53
|
+
}
|
|
54
|
+
op = body.call(thisArg, _);
|
|
55
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
56
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
var THREE = require("three");
|
|
61
|
+
var MxDbEntity_1 = require("../MxDbEntity");
|
|
62
|
+
var MxDbSVGText_1 = require("../MxDbSVGText");
|
|
63
|
+
var MxThreeJS_1 = require("../MxThreeJS");
|
|
64
|
+
var MxType_1 = require("../MxType");
|
|
65
|
+
/**
|
|
66
|
+
* MxDbSVG SVG对象.
|
|
67
|
+
*/
|
|
68
|
+
var MxDbSVG = /** @class */ (function (_super) {
|
|
69
|
+
__extends(MxDbSVG, _super);
|
|
70
|
+
function MxDbSVG() {
|
|
71
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
72
|
+
_this.svgPos = new THREE.Vector3();
|
|
73
|
+
_this.svg = null;
|
|
74
|
+
_this.svgPath = '';
|
|
75
|
+
_this.svgSize = new THREE.Vector2(50, 50);
|
|
76
|
+
_this.svgAlignmentRatio = new THREE.Vector2(0, 0);
|
|
77
|
+
_this.svgRotate = 0;
|
|
78
|
+
_this.svgReverse = false;
|
|
79
|
+
_this.svgMargin = new THREE.Vector2(0, 0);
|
|
80
|
+
_this.isSvgDirtyLocation = false;
|
|
81
|
+
_this.isLoadFromPath = true;
|
|
82
|
+
_this.aryText = [];
|
|
83
|
+
_this.svgBoxSize = null;
|
|
84
|
+
// 固定尺寸,图片和文字大小,取屏幕像素绘图单位。
|
|
85
|
+
_this.fixedSize = false;
|
|
86
|
+
_this.useSvgColor = false;
|
|
87
|
+
return _this;
|
|
88
|
+
}
|
|
89
|
+
MxDbSVG.prototype.calcVewSize = function (mxObj) {
|
|
90
|
+
var sizew = this.svgSize.x;
|
|
91
|
+
var sizeh = this.svgSize.y;
|
|
92
|
+
if (sizeh <= 0) {
|
|
93
|
+
if (this.svgBoxSize) {
|
|
94
|
+
sizeh = (this.svgBoxSize.y / this.svgBoxSize.x) * sizew;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
sizeh = sizew;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (this.fixedSize) {
|
|
101
|
+
sizew = mxObj.screenCoordLong2Doc(sizew);
|
|
102
|
+
sizeh = mxObj.screenCoordLong2Doc(sizeh);
|
|
103
|
+
}
|
|
104
|
+
return [sizew, sizeh];
|
|
105
|
+
};
|
|
106
|
+
MxDbSVG.prototype.worldDraw = function (pWorldDraw) {
|
|
107
|
+
var _this = this;
|
|
108
|
+
var mxObj = pWorldDraw.getMxObject();
|
|
109
|
+
this.calcSvgPosition(mxObj);
|
|
110
|
+
var _a = this.calcVewSize(mxObj), sizew = _a[0], sizeh = _a[1];
|
|
111
|
+
var matSclae = new THREE.Matrix4();
|
|
112
|
+
if (this.svgReverse)
|
|
113
|
+
matSclae.makeScale(1, -1, 1);
|
|
114
|
+
var mat = new THREE.Matrix4();
|
|
115
|
+
mat.makeRotationZ(this.svgRotate);
|
|
116
|
+
var matMove = new THREE.Matrix4();
|
|
117
|
+
var svgNewPos = new THREE.Vector3(this.svgPos.x - sizew * this.svgAlignmentRatio.x, this.svgPos.y - sizeh * this.svgAlignmentRatio.y, 0);
|
|
118
|
+
matMove.makeTranslation(svgNewPos.x, svgNewPos.y, svgNewPos.z);
|
|
119
|
+
mat.multiply(matSclae);
|
|
120
|
+
mat.premultiply(matMove);
|
|
121
|
+
var pt1 = new THREE.Vector3(0, 0, 0);
|
|
122
|
+
var pt3 = new THREE.Vector3(sizew, 0, 0);
|
|
123
|
+
var pt2 = new THREE.Vector3(sizew, sizeh, 0);
|
|
124
|
+
var pt4 = new THREE.Vector3(0, sizeh, 0);
|
|
125
|
+
pt1.applyMatrix4(mat);
|
|
126
|
+
pt3.applyMatrix4(mat);
|
|
127
|
+
pt2.applyMatrix4(mat);
|
|
128
|
+
pt4.applyMatrix4(mat);
|
|
129
|
+
if (pWorldDraw.getType() == 1) {
|
|
130
|
+
this.aryText.forEach(function (txt) {
|
|
131
|
+
if (txt.txt.length > 0) {
|
|
132
|
+
var posTxt = new THREE.Vector3(txt.txtPos.x, txt.txtPos.y, 0);
|
|
133
|
+
if (_this.fixedSize) {
|
|
134
|
+
if (txt.txtPos.x > 0)
|
|
135
|
+
posTxt.x = _this.svgPos.x + mxObj.screenCoordLong2Doc(txt.txtPos.x);
|
|
136
|
+
else
|
|
137
|
+
posTxt.x = _this.svgPos.x - mxObj.screenCoordLong2Doc(txt.txtPos.x);
|
|
138
|
+
if (txt.txtPos.y > 0)
|
|
139
|
+
posTxt.y = _this.svgPos.y + mxObj.screenCoordLong2Doc(txt.txtPos.y);
|
|
140
|
+
else
|
|
141
|
+
posTxt.y = _this.svgPos.y - mxObj.screenCoordLong2Doc(txt.txtPos.y);
|
|
142
|
+
}
|
|
143
|
+
var bakColor = undefined;
|
|
144
|
+
if (txt.color) {
|
|
145
|
+
bakColor = pWorldDraw.getColor();
|
|
146
|
+
pWorldDraw.setColor(txt.color);
|
|
147
|
+
}
|
|
148
|
+
var iSize = txt.txtHeight;
|
|
149
|
+
if (_this.fixedSize)
|
|
150
|
+
iSize = mxObj.screenCoordLong2Doc(txt.txtHeight);
|
|
151
|
+
txt._txtObject = pWorldDraw.drawText(txt.txt, iSize, 0, posTxt);
|
|
152
|
+
txt._txtAspectRatio = -1;
|
|
153
|
+
if (bakColor) {
|
|
154
|
+
pWorldDraw.setColor(bakColor);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
if (this.svg) {
|
|
159
|
+
pWorldDraw.drawEntity(this.svg);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
if (this.svgPath.length > 0 && this.isLoadFromPath) {
|
|
163
|
+
var myThis_1 = this;
|
|
164
|
+
var mxobj_1 = pWorldDraw.getMxObject();
|
|
165
|
+
MxThreeJS_1.default.loadSVG(this.svgPath, undefined, function (obj) {
|
|
166
|
+
if (obj) {
|
|
167
|
+
var box = new THREE.Box3().setFromObject(obj);
|
|
168
|
+
if (!myThis_1.svgBoxSize) {
|
|
169
|
+
myThis_1.svgBoxSize = new THREE.Vector3();
|
|
170
|
+
}
|
|
171
|
+
myThis_1.svgBoxSize.x = box.max.x - box.min.x;
|
|
172
|
+
myThis_1.svgBoxSize.y = box.max.y - box.min.y;
|
|
173
|
+
var _a = myThis_1.calcVewSize(mxObj), sizew_1 = _a[0], sizeh_1 = _a[1];
|
|
174
|
+
obj.scale.x = sizew_1 / myThis_1.svgBoxSize.x;
|
|
175
|
+
obj.scale.y = sizeh_1 / myThis_1.svgBoxSize.y;
|
|
176
|
+
obj.scale.z = obj.scale.x;
|
|
177
|
+
if (myThis_1.svgReverse) {
|
|
178
|
+
obj.scale.y *= -1;
|
|
179
|
+
}
|
|
180
|
+
obj.rotateZ(myThis_1.svgRotate);
|
|
181
|
+
myThis_1.isSvgDirtyLocation = true;
|
|
182
|
+
var color_1 = new THREE.Color(pWorldDraw.getColor());
|
|
183
|
+
obj.traverse(function (child) {
|
|
184
|
+
if (child.material) {
|
|
185
|
+
child.material = child.material.clone();
|
|
186
|
+
child.material.transparent = true;
|
|
187
|
+
if (!myThis_1.useSvgColor)
|
|
188
|
+
child.material.color = color_1;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
//this.svgPos.multiply
|
|
192
|
+
myThis_1.svg = obj;
|
|
193
|
+
myThis_1.setNeedUpdateDisplay();
|
|
194
|
+
mxobj_1.updateDisplay();
|
|
195
|
+
}
|
|
196
|
+
myThis_1.isLoadFromPath = false;
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
pWorldDraw.drawSelectLine(pt1, pt2);
|
|
201
|
+
pWorldDraw.drawSelectLine(pt3, pt4);
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
pWorldDraw.drawLine(pt1, pt3);
|
|
205
|
+
pWorldDraw.drawLine(pt3, pt2);
|
|
206
|
+
pWorldDraw.drawLine(pt2, pt4);
|
|
207
|
+
pWorldDraw.drawLine(pt4, pt1);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
MxDbSVG.prototype.setSvgPath = function (path, preload) {
|
|
211
|
+
if (preload === void 0) { preload = false; }
|
|
212
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
213
|
+
return __generator(this, function (_a) {
|
|
214
|
+
switch (_a.label) {
|
|
215
|
+
case 0:
|
|
216
|
+
this.svgPath = path;
|
|
217
|
+
this.svg = null;
|
|
218
|
+
this.isLoadFromPath = true;
|
|
219
|
+
this.svgBoxSize = null;
|
|
220
|
+
if (!preload) return [3 /*break*/, 2];
|
|
221
|
+
return [4 /*yield*/, MxThreeJS_1.default.loadSVG(path)];
|
|
222
|
+
case 1:
|
|
223
|
+
_a.sent();
|
|
224
|
+
_a.label = 2;
|
|
225
|
+
case 2: return [2 /*return*/];
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
};
|
|
230
|
+
MxDbSVG.prototype.getSvgPath = function () {
|
|
231
|
+
return this.svgPath;
|
|
232
|
+
};
|
|
233
|
+
MxDbSVG.prototype.setSvgPostion = function (pos) {
|
|
234
|
+
this.svgPos = pos.clone();
|
|
235
|
+
this.isSvgDirtyLocation = true;
|
|
236
|
+
};
|
|
237
|
+
MxDbSVG.prototype.getSvgPostion = function () {
|
|
238
|
+
return this.svgPos;
|
|
239
|
+
};
|
|
240
|
+
MxDbSVG.prototype.setSvgSize = function (size) {
|
|
241
|
+
this.svgSize = size;
|
|
242
|
+
this.isSvgDirtyLocation = true;
|
|
243
|
+
};
|
|
244
|
+
MxDbSVG.prototype.getSvgSize = function () {
|
|
245
|
+
return this.svgSize;
|
|
246
|
+
};
|
|
247
|
+
MxDbSVG.prototype.setSvgAlignmentRatio = function (alignmentRatio) {
|
|
248
|
+
this.svgAlignmentRatio = alignmentRatio;
|
|
249
|
+
this.isSvgDirtyLocation = true;
|
|
250
|
+
};
|
|
251
|
+
MxDbSVG.prototype.getSvgAlignmentRatio = function () {
|
|
252
|
+
return this.svgAlignmentRatio;
|
|
253
|
+
};
|
|
254
|
+
MxDbSVG.prototype.getText = function (index) {
|
|
255
|
+
if (index < this.aryText.length) {
|
|
256
|
+
return this.aryText[index];
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
MxDbSVG.prototype.addText = function (txt) {
|
|
263
|
+
this.aryText.push(txt);
|
|
264
|
+
};
|
|
265
|
+
MxDbSVG.prototype.getGripPoints = function () {
|
|
266
|
+
var ret = [];
|
|
267
|
+
ret.push(this.svgPos);
|
|
268
|
+
return ret;
|
|
269
|
+
};
|
|
270
|
+
MxDbSVG.prototype.moveGripPointsAt = function (index, offset) {
|
|
271
|
+
if (index == 0) {
|
|
272
|
+
this.svgPos.add(offset);
|
|
273
|
+
if (!this.fixedSize) {
|
|
274
|
+
this.aryText.forEach(function (txt) {
|
|
275
|
+
txt.txtPos.add(offset);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
this.isSvgDirtyLocation = true;
|
|
280
|
+
return true;
|
|
281
|
+
};
|
|
282
|
+
MxDbSVG.prototype.calcSvgPosition = function (mxObj) {
|
|
283
|
+
if (!this.svg || !this.isSvgDirtyLocation) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
this.isSvgDirtyLocation = false;
|
|
287
|
+
var _a = this.calcVewSize(mxObj), sizew = _a[0], sizeh = _a[1];
|
|
288
|
+
this.svg.position.x =
|
|
289
|
+
this.svgPos.x - sizew * this.svgAlignmentRatio.x - this.svgMargin.x * sizew;
|
|
290
|
+
this.svg.position.y =
|
|
291
|
+
this.svgPos.y - sizeh * this.svgAlignmentRatio.y - this.svgMargin.y * sizeh;
|
|
292
|
+
};
|
|
293
|
+
MxDbSVG.prototype.dwgIn = function (obj) {
|
|
294
|
+
var _this = this;
|
|
295
|
+
this.onDwgIn(obj);
|
|
296
|
+
this.fixedSize = obj['fixedSize'];
|
|
297
|
+
if (this.fixedSize) {
|
|
298
|
+
// svg = null,重新加载svg.
|
|
299
|
+
this.svg = null;
|
|
300
|
+
}
|
|
301
|
+
else if (obj.type == MxType_1.default.MxCloneType.kClone && obj['svg']) {
|
|
302
|
+
this.svg = obj['svg'].clone();
|
|
303
|
+
}
|
|
304
|
+
this.svgPos.copy(obj['svgPos']);
|
|
305
|
+
this.svgPath = obj['svgPath'].substr(0);
|
|
306
|
+
this.svgSize.copy(obj['svgSize']);
|
|
307
|
+
this.svgAlignmentRatio.copy(obj['svgAlignmentRatio']);
|
|
308
|
+
this.isSvgDirtyLocation = true;
|
|
309
|
+
if (!this.svg)
|
|
310
|
+
this.isLoadFromPath = true;
|
|
311
|
+
this.svgBoxSize = null;
|
|
312
|
+
var aryText = obj['txts'];
|
|
313
|
+
this.aryText = [];
|
|
314
|
+
aryText.forEach(function (txt) {
|
|
315
|
+
var copyTxt = new MxDbSVGText_1.default();
|
|
316
|
+
copyTxt.txt = txt.txt;
|
|
317
|
+
copyTxt.txtHeight = txt.txtHeight;
|
|
318
|
+
copyTxt.txtPos.copy(txt.txtPos);
|
|
319
|
+
_this.aryText.push(copyTxt);
|
|
320
|
+
});
|
|
321
|
+
this.svgRotate = obj['svgRotate'];
|
|
322
|
+
this.useSvgColor = obj['useSvgColor'];
|
|
323
|
+
this.svgReverse = obj['svgReverse'];
|
|
324
|
+
this.svgMargin = obj['svgMargin'];
|
|
325
|
+
return true;
|
|
326
|
+
};
|
|
327
|
+
MxDbSVG.prototype.dwgOut = function (obj) {
|
|
328
|
+
this.onDwgOut(obj);
|
|
329
|
+
if (obj.type == MxType_1.default.MxCloneType.kClone) {
|
|
330
|
+
obj['svg'] = this.svg;
|
|
331
|
+
}
|
|
332
|
+
obj['svgPath'] = this.svgPath;
|
|
333
|
+
obj['svgPos'] = this.svgPos;
|
|
334
|
+
obj['svgSize'] = this.svgSize;
|
|
335
|
+
obj['svgAlignmentRatio'] = this.svgAlignmentRatio;
|
|
336
|
+
obj['txts'] = this.aryText;
|
|
337
|
+
obj['fixedSize'] = this.fixedSize;
|
|
338
|
+
obj['svgRotate'] = this.svgRotate;
|
|
339
|
+
obj['useSvgColor'] = this.useSvgColor;
|
|
340
|
+
obj['svgReverse'] = this.svgReverse;
|
|
341
|
+
obj['svgMargin'] = this.svgMargin;
|
|
342
|
+
return obj;
|
|
343
|
+
};
|
|
344
|
+
MxDbSVG.prototype.create = function () {
|
|
345
|
+
return new MxDbSVG();
|
|
346
|
+
};
|
|
347
|
+
MxDbSVG.prototype.transformBy = function (mat) {
|
|
348
|
+
this.svgPos.applyMatrix4(mat);
|
|
349
|
+
this.isSvgDirtyLocation = true;
|
|
350
|
+
if (!this.fixedSize) {
|
|
351
|
+
this.aryText.forEach(function (txt) {
|
|
352
|
+
txt.txtPos.applyMatrix4(mat);
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
MxDbSVG.prototype.getTypeName = function () {
|
|
357
|
+
return 'MxDbSVG';
|
|
358
|
+
};
|
|
359
|
+
MxDbSVG.prototype.setColor = function (color) {
|
|
360
|
+
_super.prototype.setColor.call(this, color);
|
|
361
|
+
if (this.svg) {
|
|
362
|
+
var color_2 = new THREE.Color(this.color);
|
|
363
|
+
this.svg.traverse(function (child) {
|
|
364
|
+
if (child.material) {
|
|
365
|
+
child.material.color = color_2;
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
MxDbSVG.prototype.onViewChange = function () {
|
|
371
|
+
if (!this.fixedSize) {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
var mxObj = this.getMxObject();
|
|
375
|
+
if (mxObj == null)
|
|
376
|
+
return false;
|
|
377
|
+
if (this.svg) {
|
|
378
|
+
if (!this.svgBoxSize) {
|
|
379
|
+
this.svgBoxSize = new THREE.Vector3();
|
|
380
|
+
var box = new THREE.Box3().setFromObject(this.svg);
|
|
381
|
+
this.svgBoxSize.x = box.max.x - box.min.x;
|
|
382
|
+
this.svgBoxSize.y = box.max.y - box.min.y;
|
|
383
|
+
}
|
|
384
|
+
var _a = this.calcVewSize(mxObj), sizew = _a[0], sizeh = _a[1];
|
|
385
|
+
this.svg.scale.x = sizew / this.svgBoxSize.x;
|
|
386
|
+
this.svg.scale.y = sizeh / this.svgBoxSize.y;
|
|
387
|
+
this.svg.scale.z = this.svg.scale.x;
|
|
388
|
+
if (this.svgReverse) {
|
|
389
|
+
this.svg.scale.y *= -1;
|
|
390
|
+
}
|
|
391
|
+
this.isSvgDirtyLocation = true;
|
|
392
|
+
this.calcSvgPosition(mxObj);
|
|
393
|
+
}
|
|
394
|
+
var myThis = this;
|
|
395
|
+
this.aryText.forEach(function (txt) {
|
|
396
|
+
if (txt._txtObject && mxObj) {
|
|
397
|
+
var iSize = mxObj.screenCoordLong2Doc(txt.txtHeight);
|
|
398
|
+
if (iSize > 0.00001) {
|
|
399
|
+
if (txt._txtAspectRatio <= 0) {
|
|
400
|
+
txt._txtAspectRatio = txt._txtObject.scale.x / txt._txtObject.scale.y;
|
|
401
|
+
}
|
|
402
|
+
txt._txtObject.scale.set(txt._txtAspectRatio * iSize, iSize, 1);
|
|
403
|
+
if (txt.txtPos.x > 0)
|
|
404
|
+
txt._txtObject.position.x = myThis.svgPos.x + mxObj.screenCoordLong2Doc(txt.txtPos.x);
|
|
405
|
+
else
|
|
406
|
+
txt._txtObject.position.x = myThis.svgPos.x - mxObj.screenCoordLong2Doc(txt.txtPos.x);
|
|
407
|
+
if (txt.txtPos.y > 0)
|
|
408
|
+
txt._txtObject.position.y = myThis.svgPos.y + mxObj.screenCoordLong2Doc(txt.txtPos.y);
|
|
409
|
+
else
|
|
410
|
+
txt._txtObject.position.y = myThis.svgPos.y - mxObj.screenCoordLong2Doc(txt.txtPos.y);
|
|
411
|
+
txt._txtObject.updateMatrix();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
return true;
|
|
416
|
+
};
|
|
417
|
+
return MxDbSVG;
|
|
418
|
+
}(MxDbEntity_1.default));
|
|
419
|
+
exports.default = MxDbSVG;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
/** @module McEdGetPointWorldDrawObject*/
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var MxDbSVG_1 = require("./MxDbSVG");
|
|
5
|
+
exports.default = MxDbSVG_1.default;
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
4
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
5
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
6
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
7
|
+
/** @module MxDbSVG*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
/** @module McEdGetPointWorldDrawObject*/
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var MxDbSVGText_1 = require("./MxDbSVGText");
|
|
5
|
+
exports.default = MxDbSVGText_1.default;
|