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.
- 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 +150 -0
- package/dist/lib/MxModule/MxDbImage/index.js +5 -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/MxFun/MxFun.js +66 -29
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.js +6 -1
- package/dist/lib/MxModule/MxThreeJS/MxThreeJS.mixin.js +2 -2
- 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 +14 -0
- package/dist/lib/MxModule/loadCoreCode/mxcadassembly_es5.js +1519 -0
- package/dist/lib/MxModule/loadCoreCode/mxfun.es5.js +83 -80
- package/dist/lib/MxModule/store/store.js +1 -0
- package/dist/lib/mxdraw.js +15 -2
- 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 +46 -25
- package/dist/types/MxModule/MxDbImage/MxDbImage.d.ts +28 -0
- package/dist/types/MxModule/MxDbImage/index.d.ts +3 -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/MxFun/MxFun.d.ts +57 -26
- 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/mxdraw.d.ts +11 -1
- package/dist/types/types/MxDrawObject.d.ts +2 -2
- package/dist/types/types/MxFun.d.ts +7 -4
- package/dist/types/types/Mxassembly.d.ts +3 -0
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @module McGiWorldDraw*/
|
|
2
|
-
import McGiWorldDrawType from
|
|
3
|
-
import MxDrawObject from
|
|
2
|
+
import McGiWorldDrawType from '../McGiWorldDrawType';
|
|
3
|
+
import MxDrawObject from '../MxDrawObject';
|
|
4
4
|
/**
|
|
5
5
|
* McGiWorldDraw 用于构建一个动态绘制回调对象的规范接口
|
|
6
6
|
* @abstract 是 {@link MxDbEntity.worldDraw }必须实现的抽象回调方法中的回调对象 通过回调对象完成一些动态绘制任务
|
|
@@ -92,7 +92,7 @@ export default interface McGiWorldDraw {
|
|
|
92
92
|
* ```
|
|
93
93
|
*
|
|
94
94
|
*/
|
|
95
|
-
drawLine(pt1: THREE.Vector3, pt2: THREE.Vector3): void;
|
|
95
|
+
drawLine(pt1: THREE.Vector3 | number, pt2: THREE.Vector3 | number, x2?: number, y2?: number): void;
|
|
96
96
|
/**
|
|
97
97
|
* 绘制连续的直线
|
|
98
98
|
* @param points 点数组
|
|
@@ -104,20 +104,6 @@ export default interface McGiWorldDraw {
|
|
|
104
104
|
*
|
|
105
105
|
*/
|
|
106
106
|
drawLines(points: THREE.Vector3[]): void;
|
|
107
|
-
/**
|
|
108
|
-
* 绘制直线
|
|
109
|
-
* @param x1 第一个点的X坐标
|
|
110
|
-
* @param y1 第一个点的Y坐标
|
|
111
|
-
* @param x2 第二个点的X坐标
|
|
112
|
-
* @param y2 第二个点的Y坐标
|
|
113
|
-
* @returns
|
|
114
|
-
* @example
|
|
115
|
-
* ``` typescript
|
|
116
|
-
*
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
*/
|
|
120
|
-
drawLine2(x1: number, y1: number, x2: number, y2: number): void;
|
|
121
107
|
/**
|
|
122
108
|
* 绘制圆
|
|
123
109
|
* @param cen 圆的中心点 THREE.Vector3
|
|
@@ -165,63 +151,73 @@ export default interface McGiWorldDraw {
|
|
|
165
151
|
*/
|
|
166
152
|
getRenderOrder(): number;
|
|
167
153
|
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
154
|
+
* 设置宽度单位是屏幕像素,默认是屏幕像素,设置false,单位是Threejs坐标。
|
|
155
|
+
* @returns
|
|
156
|
+
* @example
|
|
157
|
+
* ``` typescript
|
|
158
|
+
*
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
*/
|
|
176
162
|
setLineWidthIsPixels(isPixels: boolean): void;
|
|
177
163
|
/**
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
164
|
+
* 得到宽度单位
|
|
165
|
+
* @returns
|
|
166
|
+
* @example
|
|
167
|
+
* ``` typescript
|
|
168
|
+
*
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
186
172
|
getLineWidthIsPixels(): boolean;
|
|
187
173
|
/**
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
174
|
+
* 设置虚线显示数据。
|
|
175
|
+
* @returns
|
|
176
|
+
* @example
|
|
177
|
+
* ``` typescript
|
|
178
|
+
*
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
*/
|
|
196
182
|
setDash(dDashArray: number, dDashRatio: number): void;
|
|
197
183
|
/**
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
184
|
+
* 得到虚线显示数据。
|
|
185
|
+
* @returns
|
|
186
|
+
* @example
|
|
187
|
+
* ``` typescript
|
|
188
|
+
*
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
*/
|
|
206
192
|
getDash(): any;
|
|
207
193
|
/**
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
194
|
+
* 设置虚线显示
|
|
195
|
+
* @returns
|
|
196
|
+
* @example
|
|
197
|
+
* ``` typescript
|
|
198
|
+
*
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
*/
|
|
216
202
|
setDashLineDisplay(isDashLine: boolean): void;
|
|
217
203
|
/**
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
204
|
+
*是否虚线显示
|
|
205
|
+
* @returns
|
|
206
|
+
* @example
|
|
207
|
+
* ``` typescript
|
|
208
|
+
*
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
*/
|
|
226
212
|
isDashLineDisplay(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
*绘制选择线。
|
|
215
|
+
* @returns
|
|
216
|
+
* @example
|
|
217
|
+
* ``` typescript
|
|
218
|
+
*
|
|
219
|
+
* ```
|
|
220
|
+
*
|
|
221
|
+
*/
|
|
222
|
+
drawSelectLine(pt1: THREE.Vector3 | number, pt2: THREE.Vector3 | number, x2?: number, y2?: number): void;
|
|
227
223
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @module MxDbAlignedDimension*/
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import McGiWorldDraw from '../McGiWorldDraw';
|
|
4
|
+
import MxDbEntity from '../MxDbEntity';
|
|
5
|
+
/**
|
|
6
|
+
* MxDbAlignedDimension 尺寸对象.
|
|
7
|
+
*/
|
|
8
|
+
export default class MxDbAlignedDimension extends MxDbEntity {
|
|
9
|
+
private pt1;
|
|
10
|
+
private pt2;
|
|
11
|
+
getTypeName(): string;
|
|
12
|
+
private getDirection;
|
|
13
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
14
|
+
setPoint1(pt1: THREE.Vector3): void;
|
|
15
|
+
setPoint2(pt2: THREE.Vector3): void;
|
|
16
|
+
getGripPoints(): Array<THREE.Vector3>;
|
|
17
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
18
|
+
dwgIn(obj: any): boolean;
|
|
19
|
+
dwgOut(obj: any): object;
|
|
20
|
+
create(): MxDbEntity;
|
|
21
|
+
}
|
|
@@ -22,6 +22,7 @@ import McGiWorldDraw from '../McGiWorldDraw';
|
|
|
22
22
|
*/
|
|
23
23
|
export default abstract class MxDbEntity {
|
|
24
24
|
private iColor;
|
|
25
|
+
private iRenderOrder;
|
|
25
26
|
/**
|
|
26
27
|
* 自定义对象的绘制函数。在方法中定义如何绘制图形
|
|
27
28
|
* @param pWorldDraw 绘制对象{@link McGiWorldDraw }
|
|
@@ -96,23 +97,23 @@ export default abstract class MxDbEntity {
|
|
|
96
97
|
*/
|
|
97
98
|
abstract dwgOut(obj: any): object;
|
|
98
99
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
* 得到对象类型名
|
|
101
|
+
* @param
|
|
102
|
+
* @returns string
|
|
103
|
+
* @example
|
|
104
|
+
* ``` typescript
|
|
105
|
+
*
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
107
108
|
abstract getTypeName(): string;
|
|
108
109
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
* 自定义实体的坐标变换.
|
|
111
|
+
* @param
|
|
112
|
+
* @returns void
|
|
113
|
+
* @example
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
116
117
|
transformBy(mat: THREE.Matrix4): void;
|
|
117
118
|
private getImp;
|
|
118
119
|
/**
|
|
@@ -126,14 +127,14 @@ export default abstract class MxDbEntity {
|
|
|
126
127
|
*/
|
|
127
128
|
setNeedUpdateDisplay(isImmediate?: boolean): boolean;
|
|
128
129
|
/**
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
* 得到对象的id.
|
|
131
|
+
* @param
|
|
132
|
+
* @returns number
|
|
133
|
+
* @example
|
|
134
|
+
* ``` typescript
|
|
135
|
+
*
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
137
138
|
objectId(): number;
|
|
138
139
|
/**
|
|
139
140
|
* 删除对象
|
|
@@ -173,7 +174,7 @@ export default abstract class MxDbEntity {
|
|
|
173
174
|
* ``` typescript
|
|
174
175
|
*
|
|
175
176
|
* ```
|
|
176
|
-
|
|
177
|
+
*/
|
|
177
178
|
clone(type?: number): any;
|
|
178
179
|
/**
|
|
179
180
|
* 自定义对象内部数据输入同步(实现dwgIn抽象方法 必须在实现中调用 this.onDwgIn())
|
|
@@ -193,6 +194,26 @@ export default abstract class MxDbEntity {
|
|
|
193
194
|
* ``` typescript
|
|
194
195
|
*
|
|
195
196
|
* ```
|
|
196
|
-
|
|
197
|
+
*/
|
|
197
198
|
rxInit(): void;
|
|
199
|
+
/**
|
|
200
|
+
* 设置显示顺序
|
|
201
|
+
* @param
|
|
202
|
+
* @returns boolean
|
|
203
|
+
* @example
|
|
204
|
+
* ``` typescript
|
|
205
|
+
*
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
setRenderOrder(iRenderOrder: number): void;
|
|
209
|
+
/**
|
|
210
|
+
* 得到显示顺序
|
|
211
|
+
* @param
|
|
212
|
+
* @returns boolean
|
|
213
|
+
* @example
|
|
214
|
+
* ``` typescript
|
|
215
|
+
*
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
getRenderOrder(): number;
|
|
198
219
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @module MxDbImage*/
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import McGiWorldDraw from '../McGiWorldDraw';
|
|
4
|
+
import MxDbEntity from '../MxDbEntity';
|
|
5
|
+
/**
|
|
6
|
+
* MxDbImage 图片对象.
|
|
7
|
+
*/
|
|
8
|
+
export default class MxDbImage extends MxDbEntity {
|
|
9
|
+
private pt1;
|
|
10
|
+
private pt2;
|
|
11
|
+
private imagePath;
|
|
12
|
+
private isLoadMaterialFromPath;
|
|
13
|
+
private material;
|
|
14
|
+
getTypeName(): string;
|
|
15
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
16
|
+
setImagePath(sPath: string): void;
|
|
17
|
+
getImagePath(): string;
|
|
18
|
+
setMaterial(material: THREE.MeshLambertMaterial): void;
|
|
19
|
+
setPoint1(pt1: THREE.Vector3): void;
|
|
20
|
+
getPoint1(): THREE.Vector3;
|
|
21
|
+
setPoint2(pt2: THREE.Vector3): void;
|
|
22
|
+
getPoint2(): THREE.Vector3;
|
|
23
|
+
getGripPoints(): Array<THREE.Vector3>;
|
|
24
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
25
|
+
dwgIn(obj: any): boolean;
|
|
26
|
+
dwgOut(obj: any): object;
|
|
27
|
+
create(): MxDbEntity;
|
|
28
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** @module MxDbSVG*/
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import McGiWorldDraw from '../McGiWorldDraw';
|
|
4
|
+
import MxDbEntity from '../MxDbEntity';
|
|
5
|
+
/**
|
|
6
|
+
* MxDbSVG SVG对象.
|
|
7
|
+
*/
|
|
8
|
+
export default class MxDbSVG extends MxDbEntity {
|
|
9
|
+
private svgPos;
|
|
10
|
+
private svg;
|
|
11
|
+
private svgPath;
|
|
12
|
+
private svgSize;
|
|
13
|
+
private svgAlignmentRatio;
|
|
14
|
+
private isSvgDirtyLocation;
|
|
15
|
+
private isLoadFromPath;
|
|
16
|
+
private txtPos;
|
|
17
|
+
private txt;
|
|
18
|
+
private txtHeight;
|
|
19
|
+
worldDraw(pWorldDraw: McGiWorldDraw): void;
|
|
20
|
+
setSvgPath(path: string): void;
|
|
21
|
+
getSvgPath(): string;
|
|
22
|
+
setSvgPostion(pos: THREE.Vector3): void;
|
|
23
|
+
getSvgPostion(): THREE.Vector3;
|
|
24
|
+
setSvgSize(size: THREE.Vector2): void;
|
|
25
|
+
getSvgSize(): THREE.Vector2;
|
|
26
|
+
setSvgAlignmentRatio(alignmentRatio: THREE.Vector2): void;
|
|
27
|
+
getSvgAlignmentRatio(): THREE.Vector2;
|
|
28
|
+
setTextHeight(height: number): void;
|
|
29
|
+
getTextHeight(): number;
|
|
30
|
+
setText(txt: string): void;
|
|
31
|
+
getText(): string;
|
|
32
|
+
setTextPostion(pos: THREE.Vector3): void;
|
|
33
|
+
getTextPostion(): THREE.Vector3;
|
|
34
|
+
getGripPoints(): Array<THREE.Vector3>;
|
|
35
|
+
moveGripPointsAt(index: number, offset: THREE.Vector3): boolean;
|
|
36
|
+
private calcSvgPosition;
|
|
37
|
+
dwgIn(obj: any): boolean;
|
|
38
|
+
dwgOut(obj: any): object;
|
|
39
|
+
create(): MxDbEntity;
|
|
40
|
+
transformBy(mat: THREE.Matrix4): void;
|
|
41
|
+
getTypeName(): string;
|
|
42
|
+
}
|
|
@@ -278,7 +278,7 @@ export default class MxDrawObject {
|
|
|
278
278
|
*
|
|
279
279
|
* ```
|
|
280
280
|
*/
|
|
281
|
-
screenCoord2Doc(x: number, y: number
|
|
281
|
+
screenCoord2Doc(x: number, y: number): THREE.Vector3;
|
|
282
282
|
/**
|
|
283
283
|
* ThreeJS坐标长度到DWG文档坐标长度
|
|
284
284
|
* @returns number
|
|
@@ -348,7 +348,7 @@ export default class MxDrawObject {
|
|
|
348
348
|
*
|
|
349
349
|
* ```
|
|
350
350
|
*/
|
|
351
|
-
docCoord2Screen(x: number, y: number
|
|
351
|
+
docCoord2Screen(x: number, y: number): THREE.Vector3;
|
|
352
352
|
/**
|
|
353
353
|
* 屏幕坐标长度到DWG文档坐标长度
|
|
354
354
|
* @returns number
|
|
@@ -422,24 +422,24 @@ export default class MxDrawObject {
|
|
|
422
422
|
*/
|
|
423
423
|
getMxCurrentSelect(): Array<number>;
|
|
424
424
|
/**
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
425
|
+
* 把对象添加到当前选择中.
|
|
426
|
+
* @returns void
|
|
427
|
+
* @example
|
|
428
|
+
* ```typescript
|
|
429
|
+
*
|
|
430
|
+
*
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
433
|
addMxCurrentSelect(id: number): void;
|
|
434
434
|
/**
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
435
|
+
* 清除当前所有选择
|
|
436
|
+
* @returns void
|
|
437
|
+
* @example
|
|
438
|
+
* ```typescript
|
|
439
|
+
*
|
|
440
|
+
*
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
443
|
clearMxCurrentSelect(): boolean;
|
|
444
444
|
/**
|
|
445
445
|
*通过id获取绘制的对象.
|
|
@@ -454,8 +454,7 @@ export default class MxDrawObject {
|
|
|
454
454
|
getMxEntity(id: number): MxDbEntity;
|
|
455
455
|
/**
|
|
456
456
|
* 查找某点位置处的用户自绘对象.
|
|
457
|
-
* @param ptMouse 查找的点位 THREE.Vector3
|
|
458
|
-
* @param isWorldCoord 点是否是默认坐标 默认为 true
|
|
457
|
+
* @param ptMouse 查找的点位 THREE.Vector3,默认是文档坐标
|
|
459
458
|
* @returns MxDbEntity[] 返回用户自绘对象数组
|
|
460
459
|
* @example
|
|
461
460
|
* ```typescript
|
|
@@ -463,7 +462,7 @@ export default class MxDrawObject {
|
|
|
463
462
|
*
|
|
464
463
|
* ```
|
|
465
464
|
*/
|
|
466
|
-
findMxEntityAtPoint(ptMouse: THREE.Vector3
|
|
465
|
+
findMxEntityAtPoint(ptMouse: THREE.Vector3): Array<MxDbEntity>;
|
|
467
466
|
/**
|
|
468
467
|
*得到所有用户自绘对象.
|
|
469
468
|
* @returns MxDbEntity[] 返回用户自绘对象数组
|
|
@@ -551,25 +550,25 @@ export default class MxDrawObject {
|
|
|
551
550
|
*/
|
|
552
551
|
saveMxEntityToJson(): string;
|
|
553
552
|
/**
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
553
|
+
* 从json字符串恢复MxEntity
|
|
554
|
+
* @param dataString json字符串.
|
|
555
|
+
* @returns
|
|
556
|
+
* @example
|
|
557
|
+
* ```typescript
|
|
558
|
+
*
|
|
559
|
+
*
|
|
560
|
+
* ```
|
|
561
|
+
*/
|
|
563
562
|
loadMxEntityFromJson(dataString: string): boolean;
|
|
564
563
|
/**
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
564
|
+
* 删除所有对MxEntity
|
|
565
|
+
* @param
|
|
566
|
+
* @returns
|
|
567
|
+
* @example
|
|
568
|
+
* ```typescript
|
|
569
|
+
*
|
|
570
|
+
*
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
574
573
|
eraseAllMxEntity(): void;
|
|
575
574
|
}
|
|
@@ -136,6 +136,28 @@ export default class MxFun {
|
|
|
136
136
|
* ```
|
|
137
137
|
*/
|
|
138
138
|
screenCoordLong2World(len: number): number;
|
|
139
|
+
/**
|
|
140
|
+
* 屏幕坐标长度转文档坐标长度
|
|
141
|
+
* @param len 屏幕坐标长度
|
|
142
|
+
* @return number 文档坐标长度
|
|
143
|
+
* @example
|
|
144
|
+
* ``` typescript
|
|
145
|
+
* const len = Mx.MxFun.screenCoordLong2Doc(36)
|
|
146
|
+
* console.log(len)
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
screenCoordLong2Doc(len: number): number;
|
|
150
|
+
/**
|
|
151
|
+
* 文档坐标长度转屏幕坐标长度
|
|
152
|
+
* @param len 文档坐标长度
|
|
153
|
+
* @return number 屏幕坐标长度
|
|
154
|
+
* @example
|
|
155
|
+
* ``` typescript
|
|
156
|
+
* const len = Mx.MxFun.docCoordLong2Screen(36)
|
|
157
|
+
* console.log(len)
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
docCoordLong2Screen(len: number): number;
|
|
139
161
|
/**
|
|
140
162
|
* THREE.JS坐标长度转屏幕坐标长度
|
|
141
163
|
* @param len THREE.JS坐标长度
|
|
@@ -148,14 +170,14 @@ export default class MxFun {
|
|
|
148
170
|
*/
|
|
149
171
|
worldCoordLong2Doc(len: number): number;
|
|
150
172
|
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
173
|
+
* DWG文档坐标长度到ThreeJS坐标长度
|
|
174
|
+
* @returns number
|
|
175
|
+
* @example
|
|
176
|
+
* ```typescript
|
|
177
|
+
*
|
|
178
|
+
*
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
159
181
|
docCoordLong2World(l: number): number;
|
|
160
182
|
/**
|
|
161
183
|
* 屏幕坐标转THREE.JS坐标.
|
|
@@ -222,7 +244,7 @@ export default class MxFun {
|
|
|
222
244
|
* console.log(vector3)
|
|
223
245
|
* ```
|
|
224
246
|
*/
|
|
225
|
-
screenCoord2Doc(x: number
|
|
247
|
+
screenCoord2Doc(x: number | THREE.Vector3, y?: number): THREE.Vector3;
|
|
226
248
|
/**
|
|
227
249
|
* 文档转屏幕坐标.
|
|
228
250
|
* @param x 坐标x
|
|
@@ -235,7 +257,7 @@ export default class MxFun {
|
|
|
235
257
|
* console.log(vector3)
|
|
236
258
|
* ```
|
|
237
259
|
*/
|
|
238
|
-
docCoord2Screen(x: number
|
|
260
|
+
docCoord2Screen(x: number | THREE.Vector3, y?: number): THREE.Vector3;
|
|
239
261
|
/**
|
|
240
262
|
* 更新显示,使用Three.js绘制了对象,调用该函数更新显示。
|
|
241
263
|
* @return void
|
|
@@ -391,22 +413,22 @@ export default class MxFun {
|
|
|
391
413
|
*/
|
|
392
414
|
loadImageMaterial(imageUrlPath: string, callResult: (material: MeshLambertMaterial) => void): void;
|
|
393
415
|
/**
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
416
|
+
* 判断点是否在一个闭合的多边形区域。
|
|
417
|
+
* @param p
|
|
418
|
+
* @return any
|
|
419
|
+
* @example
|
|
420
|
+
* ``` typescript
|
|
421
|
+
* let aryPoint:Array<THREE.Vector3> = [];
|
|
422
|
+
* aryPoint.push(new THREE.Vector3(0,0,0));
|
|
423
|
+
* aryPoint.push(new THREE.Vector3(0,100,0));
|
|
424
|
+
* aryPoint.push(new THREE.Vector3(100,100,0));
|
|
425
|
+
* aryPoint.push(new THREE.Vector3(100,0,0));
|
|
426
|
+
* let pt:THREE.Vector3 = new THREE.Vector3(150,150);
|
|
427
|
+
* if(MxFun.pointInPolyline(pt,aryPoint) ){
|
|
428
|
+
* console.log("in");
|
|
429
|
+
* }
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
410
432
|
pointInPolyline(pt: THREE.Vector3, vecPolyline: Array<THREE.Vector3>): boolean;
|
|
411
433
|
/**
|
|
412
434
|
* 计算多边形区域的面积
|
|
@@ -417,5 +439,14 @@ export default class MxFun {
|
|
|
417
439
|
* ```
|
|
418
440
|
*/
|
|
419
441
|
calcArea(aryPoint: Array<THREE.Vector3>): number;
|
|
442
|
+
/**
|
|
443
|
+
* 重新打开cad文件,该函数在控件创建完后,需要再次重新打开文件,调用。
|
|
444
|
+
* @param sFile 打的cad文件路径
|
|
445
|
+
* @return any
|
|
446
|
+
* @example
|
|
447
|
+
* ``` typescript
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
openFile(sFile: string): boolean;
|
|
420
451
|
}
|
|
421
452
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector3, Line, Object3D,
|
|
1
|
+
import { Vector3, Line, Object3D, Points, Sprite, Mesh, MeshBasicMaterial } from 'three';
|
|
2
2
|
/**
|
|
3
3
|
* MxThreeJS 模块
|
|
4
4
|
* ##### 使用说明:
|
|
@@ -68,7 +68,7 @@ export default class MxThreeJS {
|
|
|
68
68
|
* Mx.MxThreeJS.createCircle(new Three.Vector3(1,10,0), 10, 0)
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
|
-
createCircle(mCenterPt: Vector3, dRadius: number, iColor: ColorType):
|
|
71
|
+
createCircle(mCenterPt: Vector3, dRadius: number, iColor: ColorType): Object3D;
|
|
72
72
|
/**
|
|
73
73
|
* 创建Three.js点对象。
|
|
74
74
|
* @param mPt 点位置
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import MxType from
|
|
1
|
+
import MxType from './MxType';
|
|
2
2
|
export default MxType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function mxcadassemblyinit(): any;
|