mxdraw 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/lib/MxModule/McGeVector3d/McGeVector3d.js +2 -0
  2. package/dist/lib/MxModule/McGeVector3d/index.js +3 -0
  3. package/dist/lib/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.js +213 -0
  4. package/dist/lib/MxModule/MxDbAlignedDimension/index.js +5 -0
  5. package/dist/lib/MxModule/MxDbEntity/MxDbEntity.js +45 -19
  6. package/dist/lib/MxModule/MxDbImage/MxDbImage.js +150 -0
  7. package/dist/lib/MxModule/MxDbImage/index.js +5 -0
  8. package/dist/lib/MxModule/MxDbSVG/MxDbSVG.js +208 -0
  9. package/dist/lib/MxModule/MxDbSVG/index.js +5 -0
  10. package/dist/lib/MxModule/MxDrawObject/MxDrawObject.js +41 -44
  11. package/dist/lib/MxModule/MxFun/MxFun.js +66 -29
  12. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +6 -1
  13. package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +2 -2
  14. package/dist/lib/MxModule/MxThreeJS/SVGLoader.js +4 -4
  15. package/dist/lib/MxModule/Mxassembly/Mxassembly.js +18 -0
  16. package/dist/lib/MxModule/Mxassembly/index.js +9 -0
  17. package/dist/lib/MxModule/loadCoreCode/loadCoreCode.js +14 -0
  18. package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1519 -0
  19. package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +83 -80
  20. package/dist/lib/MxModule/store/store.js +1 -0
  21. package/dist/lib/mxdraw.js +15 -2
  22. package/dist/lib/types/Mxassembly.js +2 -0
  23. package/dist/mxdraw.es5.js +3 -3
  24. package/dist/mxdraw.es5.js.map +1 -1
  25. package/dist/mxdraw.umd.js +3 -3
  26. package/dist/mxdraw.umd.js.map +1 -1
  27. package/dist/types/MxModule/McGeVector3d/McGeVector3d.d.ts +17 -0
  28. package/dist/types/MxModule/McGeVector3d/index.d.ts +3 -0
  29. package/dist/types/MxModule/McGiWorldDraw/McGiWorldDraw.d.ts +61 -65
  30. package/dist/types/MxModule/MxDbAlignedDimension/MxDbAlignedDimension.d.ts +21 -0
  31. package/dist/types/MxModule/MxDbAlignedDimension/index.d.ts +3 -0
  32. package/dist/types/MxModule/MxDbEntity/MxDbEntity.d.ts +46 -25
  33. package/dist/types/MxModule/MxDbImage/MxDbImage.d.ts +28 -0
  34. package/dist/types/MxModule/MxDbImage/index.d.ts +3 -0
  35. package/dist/types/MxModule/MxDbSVG/MxDbSVG.d.ts +42 -0
  36. package/dist/types/MxModule/MxDbSVG/index.d.ts +3 -0
  37. package/dist/types/MxModule/MxDrawObject/MxDrawObject.d.ts +38 -39
  38. package/dist/types/MxModule/MxFun/MxFun.d.ts +57 -26
  39. package/dist/types/MxModule/MxThreeJS/MxThreeJS.d.ts +2 -2
  40. package/dist/types/MxModule/MxType/index.d.ts +1 -1
  41. package/dist/types/MxModule/Mxassembly/Mxassembly.d.ts +11 -0
  42. package/dist/types/MxModule/Mxassembly/index.d.ts +3 -0
  43. package/dist/types/MxModule/loadCoreCode/mxcadassembly_es5.d.ts +1 -0
  44. package/dist/types/MxModule/store/store.d.ts +2 -0
  45. package/dist/types/mxdraw.d.ts +11 -1
  46. package/dist/types/types/MxDrawObject.d.ts +2 -2
  47. package/dist/types/types/MxFun.d.ts +7 -4
  48. package/dist/types/types/Mxassembly.d.ts +3 -0
  49. package/package.json +3 -3
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ /** @module MrxDbgUiPrPointClass */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /** @module McEdGetPointWorldDrawObject*/
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ var MxDbAlignedDimension_1 = require("./MxDbAlignedDimension");
5
+ exports.default = MxDbAlignedDimension_1.default;
@@ -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
- * @param
33
- * @returns void
34
- * @example
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
- * 得到对象的id.
71
- * @param
72
- * @returns number
73
- * @example
74
- * ``` typescript
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,150 @@
1
+ "use strict";
2
+ ///////////////////////////////////////////////////////////////////////////////
3
+ //版权所有(C)2002-2022,成都梦想凯德科技有限公司。
4
+ //本软件代码及其文档和相关资料归成都梦想凯德科技有限公司
5
+ //应用包含本软件的程序必须包括以下声明
6
+ //在版权声明中:
7
+ //此应用程序与成都梦想凯德科技有限公司成协议。
8
+ //通过使用本软件、其文档或相关材料
9
+ ///////////////////////////////////////////////////////////////////////////////
10
+ /** @module MxDbImage*/
11
+ var __extends = (this && this.__extends) || (function () {
12
+ var extendStatics = function (d, b) {
13
+ extendStatics = Object.setPrototypeOf ||
14
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
15
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
16
+ return extendStatics(d, b);
17
+ };
18
+ return function (d, b) {
19
+ if (typeof b !== "function" && b !== null)
20
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
21
+ extendStatics(d, b);
22
+ function __() { this.constructor = d; }
23
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
24
+ };
25
+ })();
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ var THREE = require("three");
28
+ var MxDbEntity_1 = require("../MxDbEntity");
29
+ var MxFun_1 = require("../MxFun");
30
+ /**
31
+ * MxDbImage 图片对象.
32
+ */
33
+ var MxDbImage = /** @class */ (function (_super) {
34
+ __extends(MxDbImage, _super);
35
+ function MxDbImage() {
36
+ var _this = _super !== null && _super.apply(this, arguments) || this;
37
+ // pt1,pt2是图片的两个对角点.
38
+ _this.pt1 = new THREE.Vector3();
39
+ _this.pt2 = new THREE.Vector3();
40
+ _this.imagePath = '';
41
+ _this.isLoadMaterialFromPath = true;
42
+ _this.material = null;
43
+ return _this;
44
+ }
45
+ MxDbImage.prototype.getTypeName = function () {
46
+ return 'MxDbImage';
47
+ };
48
+ // 图片对象的绘制
49
+ MxDbImage.prototype.worldDraw = function (pWorldDraw) {
50
+ var _this = this;
51
+ var pt3 = new THREE.Vector3(this.pt1.x, this.pt2.y);
52
+ var pt4 = new THREE.Vector3(this.pt2.x, this.pt1.y);
53
+ pWorldDraw.drawLine(this.pt1, pt3);
54
+ pWorldDraw.drawLine(pt3, this.pt2);
55
+ pWorldDraw.drawLine(this.pt2, pt4);
56
+ pWorldDraw.drawLine(pt4, this.pt1);
57
+ if (pWorldDraw.getType() == 1) {
58
+ // 图片正常的显示绘制.
59
+ if (this.material) {
60
+ var w = Math.abs(this.pt1.x - this.pt2.x);
61
+ var h = Math.abs(this.pt1.y - this.pt2.y);
62
+ var geometry = new THREE.PlaneGeometry(w, h);
63
+ var x = Math.min(this.pt1.x, this.pt2.x);
64
+ var y = Math.min(this.pt1.y, this.pt2.y);
65
+ for (var i = 0; i < geometry.vertices.length; i++) {
66
+ geometry.vertices[i].x += x + w * 0.5;
67
+ geometry.vertices[i].y += y + h * 0.5;
68
+ geometry.vertices[i].z = 0;
69
+ }
70
+ var mesh = new THREE.Mesh(geometry, this.material);
71
+ mesh.material['depthTest'] = false;
72
+ pWorldDraw.drawEntity(mesh);
73
+ }
74
+ else if (this.imagePath.length > 0 && this.isLoadMaterialFromPath) {
75
+ var myThis_1 = this;
76
+ MxFun_1.default.loadImageMaterial('./models/img/mxcad.jpg', function (material) {
77
+ _this.isLoadMaterialFromPath = false;
78
+ if (!material) {
79
+ return;
80
+ }
81
+ myThis_1.setMaterial(material);
82
+ myThis_1.setNeedUpdateDisplay();
83
+ MxFun_1.default.updateDisplay();
84
+ });
85
+ }
86
+ }
87
+ };
88
+ MxDbImage.prototype.setImagePath = function (sPath) {
89
+ this.imagePath = sPath;
90
+ this.isLoadMaterialFromPath = true;
91
+ this.material = null;
92
+ };
93
+ MxDbImage.prototype.getImagePath = function () {
94
+ return this.imagePath;
95
+ };
96
+ MxDbImage.prototype.setMaterial = function (material) {
97
+ this.material = material;
98
+ };
99
+ MxDbImage.prototype.setPoint1 = function (pt1) {
100
+ this.pt1 = pt1;
101
+ };
102
+ MxDbImage.prototype.getPoint1 = function () {
103
+ return this.pt1;
104
+ };
105
+ MxDbImage.prototype.setPoint2 = function (pt2) {
106
+ this.pt2 = pt2;
107
+ };
108
+ MxDbImage.prototype.getPoint2 = function () {
109
+ return this.pt2;
110
+ };
111
+ // 返回图片的可编辑的夹点.
112
+ MxDbImage.prototype.getGripPoints = function () {
113
+ var ret = [];
114
+ ret.push(this.pt1);
115
+ ret.push(this.pt2);
116
+ return ret;
117
+ };
118
+ // 图片的夹点拖动编辑.
119
+ MxDbImage.prototype.moveGripPointsAt = function (index, offset) {
120
+ if (index == 0) {
121
+ this.pt1.add(offset);
122
+ }
123
+ else if ((index = 1)) {
124
+ this.pt2.add(offset);
125
+ }
126
+ return true;
127
+ };
128
+ // 图片数据的保存.
129
+ MxDbImage.prototype.dwgIn = function (obj) {
130
+ this.onDwgIn(obj);
131
+ this.pt1.copy(obj['pt1']);
132
+ this.pt2.copy(obj['pt2']);
133
+ this.imagePath = obj['imagePath'].substr(0);
134
+ this.isLoadMaterialFromPath = true;
135
+ return true;
136
+ };
137
+ // 图片数据的恢复.
138
+ MxDbImage.prototype.dwgOut = function (obj) {
139
+ this.onDwgOut(obj);
140
+ obj['pt1'] = this.pt1;
141
+ obj['pt2'] = this.pt2;
142
+ obj['imagePath'] = this.imagePath;
143
+ return obj;
144
+ };
145
+ MxDbImage.prototype.create = function () {
146
+ return new MxDbImage();
147
+ };
148
+ return MxDbImage;
149
+ }(MxDbEntity_1.default));
150
+ exports.default = MxDbImage;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /** @module McEdGetPointWorldDrawObject*/
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ var MxDbImage_1 = require("./MxDbImage");
5
+ exports.default = MxDbImage_1.default;