mxdraw 0.1.2 → 0.1.5
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/McGeVector3d/McGeVector3d.js +2 -0
- package/dist/lib/MxModule/McGeVector3d/index.js +3 -0
- package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +213 -0
- package/dist/lib/MxModule/MxDbAlignedDimension/index.js +5 -0
- package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +45 -19
- package/dist/lib/MxModule/MxDbImage/MxDbImage.js +147 -0
- package/dist/lib/MxModule/MxDbImage/index.js +5 -0
- package/dist/lib/MxModule/MxDbLine/MxDbLine.js +94 -0
- package/dist/lib/MxModule/MxDbLine/index.js +5 -0
- package/dist/lib/MxModule/MxDbRect/MxDbRect.js +219 -0
- package/dist/lib/MxModule/MxDbRect/index.js +4 -0
- package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +208 -0
- package/dist/lib/MxModule/MxDbSVG/index.js +5 -0
- package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +41 -44
- package/dist/lib/MxModule/MxFilters/MxFilters.js +201 -0
- package/dist/lib/MxModule/MxFilters/index.js +4 -0
- package/dist/lib/MxModule/MxFun/MxFun.js +70 -30
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +6 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +3 -3
- package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +4 -4
- package/dist/lib/MxModule/Mxassembly/Mxassembly.js +18 -0
- package/dist/lib/MxModule/Mxassembly/index.js +9 -0
- package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +16 -0
- package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1519 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +101 -92
- package/dist/lib/MxModule/store/store.js +1 -0
- package/dist/lib/doc.js +11 -1
- package/dist/lib/mxdraw.js +26 -6
- package/dist/lib/tools/three/index.js +100 -3
- package/dist/lib/types/Mxassembly.js +2 -0
- 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/McGeVector3d/McGeVector3d.d.ts +17 -0
- package/dist/types/MxModule/McGeVector3d/index.d.ts +3 -0
- package/dist/types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts +61 -65
- package/dist/types/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.d.ts +21 -0
- package/dist/types/MxModule/MxDbAlignedDimension/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +47 -26
- package/dist/types/MxModule/MxDbImage/MxDbImage.d.ts +28 -0
- package/dist/types/MxModule/MxDbImage/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbLine/MxDbLine.d.ts +22 -0
- package/dist/types/MxModule/MxDbLine/index.d.ts +3 -0
- package/dist/types/MxModule/MxDbRect/MxDbRect.d.ts +74 -0
- package/dist/types/MxModule/MxDbRect/index.d.ts +2 -0
- package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +42 -0
- package/dist/types/MxModule/MxDbSVG/index.d.ts +3 -0
- package/dist/types/MxModule/MxDrawObject/MxDrawObject.d.ts +38 -39
- package/dist/types/MxModule/MxFilters/MxFilters.d.ts +94 -0
- package/dist/types/MxModule/MxFilters/index.d.ts +2 -0
- package/dist/types/MxModule/MxFun/MxFun.d.ts +59 -27
- package/dist/types/MxModule/MxThreeJS/MxThreeJS.d.ts +2 -2
- package/dist/types/MxModule/MxType/index.d.ts +1 -1
- package/dist/types/MxModule/Mxassembly/Mxassembly.d.ts +11 -0
- package/dist/types/MxModule/Mxassembly/index.d.ts +3 -0
- package/dist/types/MxModule/loadCoreCode/mxcadassembly_es5.d.ts +1 -0
- package/dist/types/MxModule/store/store.d.ts +2 -0
- package/dist/types/doc.d.ts +6 -1
- package/dist/types/mxdraw.d.ts +18 -4
- package/dist/types/tools/three/index.d.ts +20 -1
- package/dist/types/types/MxDrawObject.d.ts +2 -2
- package/dist/types/types/MxFun.d.ts +8 -5
- package/dist/types/types/Mxassembly.d.ts +3 -0
- package/package.json +3 -3
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
19
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
20
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
21
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
/** @module MxDbAlignedDimension*/
|
|
24
|
+
var THREE = require("three");
|
|
25
|
+
var McGiWorldDrawType_1 = require("../McGiWorldDrawType");
|
|
26
|
+
var MxDbEntity_1 = require("../MxDbEntity");
|
|
27
|
+
var MxFun_1 = require("../MxFun");
|
|
28
|
+
var MxThreeJS_1 = require("../MxThreeJS");
|
|
29
|
+
/**
|
|
30
|
+
* MxDbAlignedDimension 尺寸对象.
|
|
31
|
+
*/
|
|
32
|
+
var MxDbAlignedDimension = /** @class */ (function (_super) {
|
|
33
|
+
__extends(MxDbAlignedDimension, _super);
|
|
34
|
+
function MxDbAlignedDimension() {
|
|
35
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
36
|
+
_this.pt1 = new THREE.Vector3();
|
|
37
|
+
_this.pt2 = new THREE.Vector3();
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
MxDbAlignedDimension.prototype.getTypeName = function () {
|
|
41
|
+
return 'MxDbAlignedDimension';
|
|
42
|
+
};
|
|
43
|
+
//获得标注方向
|
|
44
|
+
MxDbAlignedDimension.prototype.getDirection = function (v2ndPtTo1stPt, i3DFirstPt, i3DSecondPt) {
|
|
45
|
+
var vDirection = new THREE.Vector3(v2ndPtTo1stPt.x, v2ndPtTo1stPt.y, 0);
|
|
46
|
+
var mXnormal = new THREE.Vector3(1, 0, 0);
|
|
47
|
+
var fAngle = v2ndPtTo1stPt.angleTo(mXnormal);
|
|
48
|
+
//标尺与X的角度接近PI 靠近X轴;第二个点在右 或 标尺与X的角度接近0 靠近X轴;第二个点在左
|
|
49
|
+
var fMarkDirAnlge = -1;
|
|
50
|
+
if (fAngle < (Math.PI * 7) / 18 || fAngle > (Math.PI * 10) / 18) {
|
|
51
|
+
if (i3DFirstPt.x > i3DSecondPt.x) {
|
|
52
|
+
fMarkDirAnlge = 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var rotationWorldMatrix = new THREE.Matrix4();
|
|
56
|
+
rotationWorldMatrix.makeRotationZ((Math.PI / 2) * fMarkDirAnlge);
|
|
57
|
+
vDirection.applyMatrix4(rotationWorldMatrix);
|
|
58
|
+
return vDirection;
|
|
59
|
+
};
|
|
60
|
+
// 绘制尺寸标注.
|
|
61
|
+
MxDbAlignedDimension.prototype.worldDraw = function (pWorldDraw) {
|
|
62
|
+
if (pWorldDraw.getType() == McGiWorldDrawType_1.default.kWorldDraw ||
|
|
63
|
+
pWorldDraw.getType() == McGiWorldDrawType_1.default.kDynDragDraw) {
|
|
64
|
+
var pt1 = this.pt1;
|
|
65
|
+
var pt2 = this.pt2;
|
|
66
|
+
//标注的三条线
|
|
67
|
+
var line1;
|
|
68
|
+
var line2;
|
|
69
|
+
var line3;
|
|
70
|
+
var text;
|
|
71
|
+
var mTriangle1;
|
|
72
|
+
var mTriangle2;
|
|
73
|
+
var mPoint1;
|
|
74
|
+
var mPoint2;
|
|
75
|
+
var v2ndPtTo1stPt = new THREE.Vector3(pt1.x - pt2.x, pt1.y - pt2.y, 0);
|
|
76
|
+
var vDirection = this.getDirection(v2ndPtTo1stPt, pt1, pt2);
|
|
77
|
+
var fLen = v2ndPtTo1stPt.length();
|
|
78
|
+
var scaleWorldMatrix = new THREE.Matrix4();
|
|
79
|
+
scaleWorldMatrix.makeScale(0.01, 0.01, 0.01);
|
|
80
|
+
var vTemp = new THREE.Vector3(vDirection.x, vDirection.y, 0);
|
|
81
|
+
vTemp.applyMatrix4(scaleWorldMatrix);
|
|
82
|
+
var mTopPt1 = new THREE.Vector3(pt1.x + vTemp.x, pt1.y + vTemp.y, 0);
|
|
83
|
+
var mTopPt2 = new THREE.Vector3(pt2.x + vTemp.x, pt2.y + vTemp.y, 0);
|
|
84
|
+
var color = 0xffffff;
|
|
85
|
+
//画点
|
|
86
|
+
{
|
|
87
|
+
mPoint1 = MxThreeJS_1.default.createPoint(pt1, color);
|
|
88
|
+
mPoint2 = MxThreeJS_1.default.createPoint(pt2, color);
|
|
89
|
+
}
|
|
90
|
+
//画线
|
|
91
|
+
{
|
|
92
|
+
scaleWorldMatrix.identity();
|
|
93
|
+
scaleWorldMatrix.makeScale(0.2, 0.2, 0);
|
|
94
|
+
var vTemp1 = new THREE.Vector3(vDirection.x, vDirection.y, 0);
|
|
95
|
+
vTemp1.applyMatrix4(scaleWorldMatrix);
|
|
96
|
+
scaleWorldMatrix.identity();
|
|
97
|
+
scaleWorldMatrix.makeScale(0.02, 0.02, 0);
|
|
98
|
+
var vTemp2 = new THREE.Vector3(vDirection.x, vDirection.y, 0);
|
|
99
|
+
vTemp2.applyMatrix4(scaleWorldMatrix);
|
|
100
|
+
pWorldDraw.drawLine(mTopPt1, mTopPt2);
|
|
101
|
+
line2 = MxThreeJS_1.default.createLine(new THREE.Vector3(mTopPt1.x + vTemp2.x * 2, mTopPt1.y + vTemp2.y * 2, 0), new THREE.Vector3(pt1.x + vTemp2.x, pt1.y + vTemp2.y, 0), color);
|
|
102
|
+
line3 = MxThreeJS_1.default.createLine(new THREE.Vector3(mTopPt2.x + vTemp2.x * 2, mTopPt2.y + vTemp2.y * 2, 0), new THREE.Vector3(pt2.x + vTemp2.x, pt2.y + vTemp2.y, 0), color);
|
|
103
|
+
}
|
|
104
|
+
//画文字
|
|
105
|
+
{
|
|
106
|
+
var mXnormal = new THREE.Vector3(1, 0, 0);
|
|
107
|
+
var fAngle = v2ndPtTo1stPt.angleTo(mXnormal);
|
|
108
|
+
// vTemp 标注线垂直方向 。
|
|
109
|
+
var vTemp = new THREE.Vector3(vDirection.x, vDirection.y, 0);
|
|
110
|
+
vTemp.normalize();
|
|
111
|
+
var fSize = pt1.distanceTo(pt2);
|
|
112
|
+
if (v2ndPtTo1stPt.y < 0) {
|
|
113
|
+
if (fAngle < Math.PI / 2) {
|
|
114
|
+
fAngle = 2 * Math.PI - fAngle;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
fAngle = Math.PI - fAngle;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
if (fAngle > Math.PI / 2) {
|
|
122
|
+
fAngle = Math.PI + fAngle;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
fLen = MxFun_1.default.worldCoordLong2Doc(fLen);
|
|
126
|
+
text = MxThreeJS_1.default.creatTextSprite(fLen.toFixed(3), new THREE.Vector3(mTopPt2.x + v2ndPtTo1stPt.x / 2 + (vTemp.x * fSize) / 30, mTopPt2.y + v2ndPtTo1stPt.y / 2 + (vTemp.y * fSize) / 30, 0), fSize * 0.07, // 文字高度,取两点距离的0.1
|
|
127
|
+
fAngle, color);
|
|
128
|
+
if (text != null)
|
|
129
|
+
pWorldDraw.drawEntity(text);
|
|
130
|
+
}
|
|
131
|
+
//画三角形
|
|
132
|
+
{
|
|
133
|
+
scaleWorldMatrix.identity();
|
|
134
|
+
scaleWorldMatrix.makeScale(0.08, 0.08, 0.08);
|
|
135
|
+
var rotationWorldMatrix = new THREE.Matrix4();
|
|
136
|
+
rotationWorldMatrix.makeRotationZ((Math.PI * 17) / 18);
|
|
137
|
+
var vTrianglePt1Dir = new THREE.Vector3(v2ndPtTo1stPt.x, v2ndPtTo1stPt.y, 0);
|
|
138
|
+
vTrianglePt1Dir.applyMatrix4(scaleWorldMatrix);
|
|
139
|
+
vTrianglePt1Dir.applyMatrix4(rotationWorldMatrix);
|
|
140
|
+
rotationWorldMatrix.identity();
|
|
141
|
+
rotationWorldMatrix.makeRotationZ((-Math.PI * 17) / 18);
|
|
142
|
+
var vTrianglePt2Dir = new THREE.Vector3(v2ndPtTo1stPt.x, v2ndPtTo1stPt.y, 0);
|
|
143
|
+
vTrianglePt2Dir.applyMatrix4(scaleWorldMatrix);
|
|
144
|
+
vTrianglePt2Dir.applyMatrix4(rotationWorldMatrix);
|
|
145
|
+
var pts1 = new Array();
|
|
146
|
+
pts1.push(new THREE.Vector3(mTopPt1.x, mTopPt1.y, 0), new THREE.Vector3(mTopPt1.x + vTrianglePt1Dir.x, mTopPt1.y + vTrianglePt1Dir.y, 0), new THREE.Vector3(mTopPt1.x + vTrianglePt2Dir.x, mTopPt1.y + vTrianglePt2Dir.y, 0));
|
|
147
|
+
mTriangle1 = MxThreeJS_1.default.createTriangle(pts1, color);
|
|
148
|
+
rotationWorldMatrix.identity();
|
|
149
|
+
rotationWorldMatrix.makeRotationZ(Math.PI / 18);
|
|
150
|
+
vTrianglePt1Dir = new THREE.Vector3(v2ndPtTo1stPt.x, v2ndPtTo1stPt.y, 0);
|
|
151
|
+
vTrianglePt1Dir.applyMatrix4(scaleWorldMatrix);
|
|
152
|
+
vTrianglePt1Dir.applyMatrix4(rotationWorldMatrix);
|
|
153
|
+
rotationWorldMatrix.identity();
|
|
154
|
+
rotationWorldMatrix.makeRotationZ(-Math.PI / 18);
|
|
155
|
+
vTrianglePt2Dir = new THREE.Vector3(v2ndPtTo1stPt.x, v2ndPtTo1stPt.y, 0);
|
|
156
|
+
vTrianglePt2Dir.applyMatrix4(scaleWorldMatrix);
|
|
157
|
+
vTrianglePt2Dir.applyMatrix4(rotationWorldMatrix);
|
|
158
|
+
var pts2 = new Array();
|
|
159
|
+
pts2.push(new THREE.Vector3(mTopPt2.x, mTopPt2.y, 0), new THREE.Vector3(mTopPt2.x + vTrianglePt1Dir.x, mTopPt2.y + vTrianglePt1Dir.y, 0), new THREE.Vector3(mTopPt2.x + vTrianglePt2Dir.x, mTopPt2.y + vTrianglePt2Dir.y, 0));
|
|
160
|
+
mTriangle2 = MxThreeJS_1.default.createTriangle(pts2, color);
|
|
161
|
+
}
|
|
162
|
+
pWorldDraw.drawEntity(line2);
|
|
163
|
+
pWorldDraw.drawEntity(line3);
|
|
164
|
+
if (mTriangle1)
|
|
165
|
+
pWorldDraw.drawEntity(mTriangle1);
|
|
166
|
+
if (mTriangle2)
|
|
167
|
+
pWorldDraw.drawEntity(mTriangle2);
|
|
168
|
+
pWorldDraw.drawEntity(mPoint1);
|
|
169
|
+
pWorldDraw.drawEntity(mPoint2);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
pWorldDraw.drawLine(this.pt1, this.pt2);
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
MxDbAlignedDimension.prototype.setPoint1 = function (pt1) {
|
|
176
|
+
this.pt1 = pt1;
|
|
177
|
+
};
|
|
178
|
+
MxDbAlignedDimension.prototype.setPoint2 = function (pt2) {
|
|
179
|
+
this.pt2 = pt2;
|
|
180
|
+
};
|
|
181
|
+
MxDbAlignedDimension.prototype.getGripPoints = function () {
|
|
182
|
+
var ret = [];
|
|
183
|
+
ret.push(this.pt1);
|
|
184
|
+
ret.push(this.pt2);
|
|
185
|
+
return ret;
|
|
186
|
+
};
|
|
187
|
+
MxDbAlignedDimension.prototype.moveGripPointsAt = function (index, offset) {
|
|
188
|
+
if (index == 0) {
|
|
189
|
+
this.pt1.add(offset);
|
|
190
|
+
}
|
|
191
|
+
else if ((index = 1)) {
|
|
192
|
+
this.pt2.add(offset);
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
};
|
|
196
|
+
MxDbAlignedDimension.prototype.dwgIn = function (obj) {
|
|
197
|
+
this.onDwgIn(obj);
|
|
198
|
+
this.pt1.copy(obj['pt1']);
|
|
199
|
+
this.pt2.copy(obj['pt2']);
|
|
200
|
+
return true;
|
|
201
|
+
};
|
|
202
|
+
MxDbAlignedDimension.prototype.dwgOut = function (obj) {
|
|
203
|
+
this.onDwgOut(obj);
|
|
204
|
+
obj['pt1'] = this.pt1;
|
|
205
|
+
obj['pt2'] = this.pt2;
|
|
206
|
+
return obj;
|
|
207
|
+
};
|
|
208
|
+
MxDbAlignedDimension.prototype.create = function () {
|
|
209
|
+
return new MxDbAlignedDimension();
|
|
210
|
+
};
|
|
211
|
+
return MxDbAlignedDimension;
|
|
212
|
+
}(MxDbEntity_1.default));
|
|
213
|
+
exports.default = MxDbAlignedDimension;
|
|
@@ -26,17 +26,17 @@ var store_1 = require("../store/store");
|
|
|
26
26
|
var MxDbEntity = /** @class */ (function () {
|
|
27
27
|
function MxDbEntity() {
|
|
28
28
|
this.iColor = 0xffffff;
|
|
29
|
+
this.iRenderOrder = 30;
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
MxDbEntity.prototype.transformBy = function (mat) {
|
|
39
|
-
};
|
|
32
|
+
* 自定义实体的坐标变换.
|
|
33
|
+
* @param
|
|
34
|
+
* @returns void
|
|
35
|
+
* @example
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
MxDbEntity.prototype.transformBy = function (mat) { };
|
|
40
40
|
MxDbEntity.prototype.getImp = function () {
|
|
41
41
|
var myThis = this;
|
|
42
42
|
var imp = myThis['MxDbEntityImp'];
|
|
@@ -67,14 +67,14 @@ var MxDbEntity = /** @class */ (function () {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
* 得到对象的id.
|
|
71
|
+
* @param
|
|
72
|
+
* @returns number
|
|
73
|
+
* @example
|
|
74
|
+
* ``` typescript
|
|
75
|
+
*
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
78
|
MxDbEntity.prototype.objectId = function () {
|
|
79
79
|
var imp = this.getImp();
|
|
80
80
|
if (imp) {
|
|
@@ -134,7 +134,7 @@ var MxDbEntity = /** @class */ (function () {
|
|
|
134
134
|
* ``` typescript
|
|
135
135
|
*
|
|
136
136
|
* ```
|
|
137
|
-
|
|
137
|
+
*/
|
|
138
138
|
MxDbEntity.prototype.clone = function (type) {
|
|
139
139
|
var ret = this.create();
|
|
140
140
|
var objData = { type: type ? type : MxType_1.default.MxCloneType.kClone };
|
|
@@ -148,6 +148,7 @@ var MxDbEntity = /** @class */ (function () {
|
|
|
148
148
|
*/
|
|
149
149
|
MxDbEntity.prototype.onDwgIn = function (obj) {
|
|
150
150
|
this.iColor = obj['iColor'];
|
|
151
|
+
this.iRenderOrder = obj['iRenderOrder'];
|
|
151
152
|
};
|
|
152
153
|
/**
|
|
153
154
|
* 自定义对象内部数据输出同步(实现dwgIn抽象方法 必须在实现中调用 this.onDwgIn()
|
|
@@ -155,6 +156,7 @@ var MxDbEntity = /** @class */ (function () {
|
|
|
155
156
|
*/
|
|
156
157
|
MxDbEntity.prototype.onDwgOut = function (obj) {
|
|
157
158
|
obj['iColor'] = this.iColor;
|
|
159
|
+
obj['iRenderOrder'] = this.iRenderOrder;
|
|
158
160
|
};
|
|
159
161
|
/**
|
|
160
162
|
* 初始自定义对象的类型信息.
|
|
@@ -164,11 +166,35 @@ var MxDbEntity = /** @class */ (function () {
|
|
|
164
166
|
* ``` typescript
|
|
165
167
|
*
|
|
166
168
|
* ```
|
|
167
|
-
|
|
169
|
+
*/
|
|
168
170
|
MxDbEntity.prototype.rxInit = function () {
|
|
169
171
|
;
|
|
170
172
|
store_1.default.state.MxFun.initMxDbEntityType(this);
|
|
171
173
|
};
|
|
174
|
+
/**
|
|
175
|
+
* 设置显示顺序
|
|
176
|
+
* @param
|
|
177
|
+
* @returns boolean
|
|
178
|
+
* @example
|
|
179
|
+
* ``` typescript
|
|
180
|
+
*
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
MxDbEntity.prototype.setRenderOrder = function (iRenderOrder) {
|
|
184
|
+
this.iRenderOrder = iRenderOrder;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* 得到显示顺序
|
|
188
|
+
* @param
|
|
189
|
+
* @returns boolean
|
|
190
|
+
* @example
|
|
191
|
+
* ``` typescript
|
|
192
|
+
*
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
MxDbEntity.prototype.getRenderOrder = function () {
|
|
196
|
+
return this.iRenderOrder;
|
|
197
|
+
};
|
|
172
198
|
return MxDbEntity;
|
|
173
199
|
}());
|
|
174
200
|
exports.default = MxDbEntity;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
4
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
5
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
6
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
7
|
+
/** @module MxDbImage*/
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
var THREE = require("three");
|
|
25
|
+
var MxDbEntity_1 = require("../MxDbEntity");
|
|
26
|
+
var MxFun_1 = require("../MxFun");
|
|
27
|
+
/**
|
|
28
|
+
* MxDbImage 图片对象.
|
|
29
|
+
*/
|
|
30
|
+
var MxDbImage = /** @class */ (function (_super) {
|
|
31
|
+
__extends(MxDbImage, _super);
|
|
32
|
+
function MxDbImage() {
|
|
33
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
// pt1,pt2是图片的两个对角点.
|
|
35
|
+
_this.pt1 = new THREE.Vector3();
|
|
36
|
+
_this.pt2 = new THREE.Vector3();
|
|
37
|
+
_this.imagePath = '';
|
|
38
|
+
_this.isLoadMaterialFromPath = true;
|
|
39
|
+
_this.material = null;
|
|
40
|
+
return _this;
|
|
41
|
+
}
|
|
42
|
+
MxDbImage.prototype.getTypeName = function () {
|
|
43
|
+
return 'MxDbImage';
|
|
44
|
+
};
|
|
45
|
+
// 图片对象的绘制
|
|
46
|
+
MxDbImage.prototype.worldDraw = function (pWorldDraw) {
|
|
47
|
+
var _this = this;
|
|
48
|
+
var pt3 = new THREE.Vector3(this.pt1.x, this.pt2.y);
|
|
49
|
+
var pt4 = new THREE.Vector3(this.pt2.x, this.pt1.y);
|
|
50
|
+
pWorldDraw.drawLine(this.pt1, pt3);
|
|
51
|
+
pWorldDraw.drawLine(pt3, this.pt2);
|
|
52
|
+
pWorldDraw.drawLine(this.pt2, pt4);
|
|
53
|
+
pWorldDraw.drawLine(pt4, this.pt1);
|
|
54
|
+
if (pWorldDraw.getType() == 1) {
|
|
55
|
+
// 图片正常的显示绘制.
|
|
56
|
+
if (this.material) {
|
|
57
|
+
var w = Math.abs(this.pt1.x - this.pt2.x);
|
|
58
|
+
var h = Math.abs(this.pt1.y - this.pt2.y);
|
|
59
|
+
var geometry = new THREE.PlaneGeometry(w, h);
|
|
60
|
+
var x = Math.min(this.pt1.x, this.pt2.x);
|
|
61
|
+
var y = Math.min(this.pt1.y, this.pt2.y);
|
|
62
|
+
for (var i = 0; i < geometry.vertices.length; i++) {
|
|
63
|
+
geometry.vertices[i].x += x + w * 0.5;
|
|
64
|
+
geometry.vertices[i].y += y + h * 0.5;
|
|
65
|
+
geometry.vertices[i].z = 0;
|
|
66
|
+
}
|
|
67
|
+
var mesh = new THREE.Mesh(geometry, this.material);
|
|
68
|
+
mesh.material['depthTest'] = false;
|
|
69
|
+
pWorldDraw.drawEntity(mesh);
|
|
70
|
+
}
|
|
71
|
+
else if (this.imagePath.length > 0 && this.isLoadMaterialFromPath) {
|
|
72
|
+
var myThis_1 = this;
|
|
73
|
+
MxFun_1.default.loadImageMaterial('./models/img/mxcad.jpg', function (material) {
|
|
74
|
+
_this.isLoadMaterialFromPath = false;
|
|
75
|
+
if (!material) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
myThis_1.setMaterial(material);
|
|
79
|
+
myThis_1.setNeedUpdateDisplay();
|
|
80
|
+
MxFun_1.default.updateDisplay();
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
MxDbImage.prototype.setImagePath = function (sPath) {
|
|
86
|
+
this.imagePath = sPath;
|
|
87
|
+
this.isLoadMaterialFromPath = true;
|
|
88
|
+
this.material = null;
|
|
89
|
+
};
|
|
90
|
+
MxDbImage.prototype.getImagePath = function () {
|
|
91
|
+
return this.imagePath;
|
|
92
|
+
};
|
|
93
|
+
MxDbImage.prototype.setMaterial = function (material) {
|
|
94
|
+
this.material = material;
|
|
95
|
+
};
|
|
96
|
+
MxDbImage.prototype.setPoint1 = function (pt1) {
|
|
97
|
+
this.pt1 = pt1;
|
|
98
|
+
};
|
|
99
|
+
MxDbImage.prototype.getPoint1 = function () {
|
|
100
|
+
return this.pt1;
|
|
101
|
+
};
|
|
102
|
+
MxDbImage.prototype.setPoint2 = function (pt2) {
|
|
103
|
+
this.pt2 = pt2;
|
|
104
|
+
};
|
|
105
|
+
MxDbImage.prototype.getPoint2 = function () {
|
|
106
|
+
return this.pt2;
|
|
107
|
+
};
|
|
108
|
+
// 返回图片的可编辑的夹点.
|
|
109
|
+
MxDbImage.prototype.getGripPoints = function () {
|
|
110
|
+
var ret = [];
|
|
111
|
+
ret.push(this.pt1);
|
|
112
|
+
ret.push(this.pt2);
|
|
113
|
+
return ret;
|
|
114
|
+
};
|
|
115
|
+
// 图片的夹点拖动编辑.
|
|
116
|
+
MxDbImage.prototype.moveGripPointsAt = function (index, offset) {
|
|
117
|
+
if (index == 0) {
|
|
118
|
+
this.pt1.add(offset);
|
|
119
|
+
}
|
|
120
|
+
else if ((index = 1)) {
|
|
121
|
+
this.pt2.add(offset);
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
};
|
|
125
|
+
// 图片数据的保存.
|
|
126
|
+
MxDbImage.prototype.dwgIn = function (obj) {
|
|
127
|
+
this.onDwgIn(obj);
|
|
128
|
+
this.pt1.copy(obj['pt1']);
|
|
129
|
+
this.pt2.copy(obj['pt2']);
|
|
130
|
+
this.imagePath = obj['imagePath'].substr(0);
|
|
131
|
+
this.isLoadMaterialFromPath = true;
|
|
132
|
+
return true;
|
|
133
|
+
};
|
|
134
|
+
// 图片数据的恢复.
|
|
135
|
+
MxDbImage.prototype.dwgOut = function (obj) {
|
|
136
|
+
this.onDwgOut(obj);
|
|
137
|
+
obj['pt1'] = this.pt1;
|
|
138
|
+
obj['pt2'] = this.pt2;
|
|
139
|
+
obj['imagePath'] = this.imagePath;
|
|
140
|
+
return obj;
|
|
141
|
+
};
|
|
142
|
+
MxDbImage.prototype.create = function () {
|
|
143
|
+
return new MxDbImage();
|
|
144
|
+
};
|
|
145
|
+
return MxDbImage;
|
|
146
|
+
}(MxDbEntity_1.default));
|
|
147
|
+
exports.default = MxDbImage;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
19
|
+
//版权所有(C)2002-2022,成都梦想凯德科技有限公司。
|
|
20
|
+
//本软件代码及其文档和相关资料归成都梦想凯德科技有限公司,应用包含本软件的程序必须包括以下版权声明
|
|
21
|
+
//此应用程序与成都梦想凯德科技有限公司成协议。通过使用本软件、其文档或相关材料
|
|
22
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
23
|
+
/** @module MxDbLine*/
|
|
24
|
+
var THREE = require("three");
|
|
25
|
+
var MxDbEntity_1 = require("../MxDbEntity");
|
|
26
|
+
/**
|
|
27
|
+
* MxDbLine 直线对象.
|
|
28
|
+
*/
|
|
29
|
+
var MxDbLine = /** @class */ (function (_super) {
|
|
30
|
+
__extends(MxDbLine, _super);
|
|
31
|
+
function MxDbLine() {
|
|
32
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
33
|
+
// pt1,pt2
|
|
34
|
+
_this.pt1 = new THREE.Vector3();
|
|
35
|
+
_this.pt2 = new THREE.Vector3();
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
MxDbLine.prototype.getTypeName = function () {
|
|
39
|
+
return 'MxDbLine';
|
|
40
|
+
};
|
|
41
|
+
MxDbLine.prototype.worldDraw = function (pWorldDraw) {
|
|
42
|
+
pWorldDraw.drawLine(this.pt1, this.pt2);
|
|
43
|
+
};
|
|
44
|
+
MxDbLine.prototype.setPoint1 = function (pt1) {
|
|
45
|
+
this.pt1 = pt1;
|
|
46
|
+
};
|
|
47
|
+
MxDbLine.prototype.getPoint1 = function () {
|
|
48
|
+
return this.pt1;
|
|
49
|
+
};
|
|
50
|
+
MxDbLine.prototype.setPoint2 = function (pt2) {
|
|
51
|
+
this.pt2 = pt2;
|
|
52
|
+
};
|
|
53
|
+
MxDbLine.prototype.getPoint2 = function () {
|
|
54
|
+
return this.pt2;
|
|
55
|
+
};
|
|
56
|
+
MxDbLine.prototype.getGripPoints = function () {
|
|
57
|
+
var ret = [];
|
|
58
|
+
ret.push(this.pt1);
|
|
59
|
+
ret.push(this.pt2);
|
|
60
|
+
var midPoint = new THREE.Vector3(this.pt1.x + (this.pt2.x - this.pt1.x) * 0.5, this.pt1.y + (this.pt2.y - this.pt1.y) * 0.5, 0);
|
|
61
|
+
ret.push(midPoint);
|
|
62
|
+
return ret;
|
|
63
|
+
};
|
|
64
|
+
MxDbLine.prototype.moveGripPointsAt = function (index, offset) {
|
|
65
|
+
if (index == 0) {
|
|
66
|
+
this.pt1.add(offset);
|
|
67
|
+
}
|
|
68
|
+
else if (index == 1) {
|
|
69
|
+
this.pt2.add(offset);
|
|
70
|
+
}
|
|
71
|
+
else if (index == 2) {
|
|
72
|
+
this.pt1.add(offset);
|
|
73
|
+
this.pt2.add(offset);
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
};
|
|
77
|
+
MxDbLine.prototype.dwgIn = function (obj) {
|
|
78
|
+
this.onDwgIn(obj);
|
|
79
|
+
this.pt1.copy(obj['pt1']);
|
|
80
|
+
this.pt2.copy(obj['pt2']);
|
|
81
|
+
return true;
|
|
82
|
+
};
|
|
83
|
+
MxDbLine.prototype.dwgOut = function (obj) {
|
|
84
|
+
this.onDwgOut(obj);
|
|
85
|
+
obj['pt1'] = this.pt1;
|
|
86
|
+
obj['pt2'] = this.pt2;
|
|
87
|
+
return obj;
|
|
88
|
+
};
|
|
89
|
+
MxDbLine.prototype.create = function () {
|
|
90
|
+
return new MxDbLine();
|
|
91
|
+
};
|
|
92
|
+
return MxDbLine;
|
|
93
|
+
}(MxDbEntity_1.default));
|
|
94
|
+
exports.default = MxDbLine;
|