build-dxf 0.0.8 → 0.0.9
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/package.json +34 -2
- package/src/index.d.ts +5 -0
- package/src/index.js +11 -3
- package/src/plugins/ModelDataPlugin/index.d.ts +10 -2
- package/src/plugins/ModelDataPlugin/index.js +61 -747
- package/src/plugins/RenderPlugin/index.d.ts +206 -32
- package/src/plugins/RenderPlugin/index.js +18372 -208
|
@@ -1,6 +1,33 @@
|
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';
|
|
4
|
+
import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js';
|
|
5
|
+
import { CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js';
|
|
6
|
+
import { CSS3DRenderer } from 'three/addons/renderers/CSS3DRenderer.js';
|
|
7
|
+
import { CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js';
|
|
8
|
+
import { DefineComponent } from 'vue';
|
|
1
9
|
import { EventDispatcher as EventDispatcher_2 } from 'three';
|
|
10
|
+
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
11
|
+
import { PublicProps } from 'vue';
|
|
2
12
|
import * as THREE from 'three';
|
|
3
13
|
|
|
14
|
+
declare type __VLS_Props = {
|
|
15
|
+
lines?: OriginalDataItem[];
|
|
16
|
+
detailsPoint?: {
|
|
17
|
+
position: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
z: number;
|
|
21
|
+
};
|
|
22
|
+
direction: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
};
|
|
27
|
+
desc: string;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
|
|
4
31
|
declare class Box2 {
|
|
5
32
|
minX: number;
|
|
6
33
|
maxX: number;
|
|
@@ -134,13 +161,23 @@ declare class ComponentManager<TEventMap extends {} = {}> extends EventDispatche
|
|
|
134
161
|
* @param type
|
|
135
162
|
*/
|
|
136
163
|
findComponentByType<T extends typeof Component>(type: T): InstanceType<T> | null;
|
|
164
|
+
/**
|
|
165
|
+
*
|
|
166
|
+
* @param type
|
|
167
|
+
*/
|
|
168
|
+
findComponentByName(name: string): Component<{}> | null;
|
|
137
169
|
}
|
|
138
170
|
|
|
139
171
|
declare namespace components {
|
|
140
172
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
173
|
+
DetailsPointRender,
|
|
174
|
+
DomContainer,
|
|
175
|
+
OriginalLineRender,
|
|
176
|
+
RendererDescription,
|
|
177
|
+
Renderer,
|
|
178
|
+
PointGroup,
|
|
179
|
+
ModelDataRender,
|
|
180
|
+
DomEventRegister
|
|
144
181
|
}
|
|
145
182
|
}
|
|
146
183
|
export { components }
|
|
@@ -150,32 +187,75 @@ export { components }
|
|
|
150
187
|
*/
|
|
151
188
|
declare type DataItem = [Point, Point, number[], boolean, number];
|
|
152
189
|
|
|
153
|
-
declare class
|
|
154
|
-
handleSuccess: {
|
|
155
|
-
desPoints: IDesPointItem[];
|
|
156
|
-
};
|
|
157
|
-
}> {
|
|
190
|
+
declare class DetailsPointRender extends Component {
|
|
158
191
|
Dxf: Dxf | null;
|
|
192
|
+
Renderer: Renderer | null;
|
|
159
193
|
WhiteModel: WhiteModel | null;
|
|
160
194
|
Variable: Variable | null;
|
|
161
|
-
|
|
162
|
-
|
|
195
|
+
desPointGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
196
|
+
rayLineGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
163
197
|
data: any[];
|
|
164
198
|
onAddFromParent(parent: ComponentManager): void;
|
|
165
199
|
/**
|
|
166
|
-
*
|
|
167
|
-
* @param data
|
|
200
|
+
* 更新模型
|
|
168
201
|
*/
|
|
169
|
-
|
|
202
|
+
updateModel(): void;
|
|
203
|
+
createDesPoint(): void;
|
|
204
|
+
createRayline(): void;
|
|
205
|
+
private _desBoxInfo;
|
|
170
206
|
/**
|
|
171
|
-
*
|
|
207
|
+
* 显示详情div盒子
|
|
208
|
+
* @param point
|
|
209
|
+
* @param div
|
|
210
|
+
* @param param2
|
|
211
|
+
* @returns
|
|
172
212
|
*/
|
|
173
|
-
|
|
174
|
-
private _timer;
|
|
213
|
+
showDesBox(point: THREE.Vector3, div: HTMLDivElement, { message, position }: any): void;
|
|
175
214
|
/**
|
|
176
|
-
*
|
|
215
|
+
* 隐藏详情盒子
|
|
177
216
|
*/
|
|
178
|
-
|
|
217
|
+
hideDesBox(): void;
|
|
218
|
+
private orbitControlsTarget;
|
|
219
|
+
private fov;
|
|
220
|
+
/**
|
|
221
|
+
* 查看详情点
|
|
222
|
+
* @param point
|
|
223
|
+
* @param position
|
|
224
|
+
*/
|
|
225
|
+
onLook(point: THREE.Vector3, position: THREE.Vector3): void;
|
|
226
|
+
/**
|
|
227
|
+
* 取消查看详情点
|
|
228
|
+
*/
|
|
229
|
+
cancelLook(): void;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
declare class DomContainer extends Component {
|
|
233
|
+
domElement: HTMLDivElement;
|
|
234
|
+
canvas: HTMLCanvasElement;
|
|
235
|
+
html2DRenderer: HTMLDivElement;
|
|
236
|
+
constructor();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
declare class DomEventRegister extends Component {
|
|
240
|
+
/**
|
|
241
|
+
*
|
|
242
|
+
* @param parent
|
|
243
|
+
*/
|
|
244
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
245
|
+
/**
|
|
246
|
+
*
|
|
247
|
+
* @param el
|
|
248
|
+
* @param callBack
|
|
249
|
+
* @param offset
|
|
250
|
+
* @param condition
|
|
251
|
+
*/
|
|
252
|
+
dragMoveHelper(el: HTMLElement, callBack: (offset: {
|
|
253
|
+
x: number;
|
|
254
|
+
y: number;
|
|
255
|
+
}, mx: number, my: number) => void, offset?: {
|
|
256
|
+
x: number;
|
|
257
|
+
y: number;
|
|
258
|
+
}, condition?: () => boolean): void;
|
|
179
259
|
}
|
|
180
260
|
|
|
181
261
|
/**
|
|
@@ -290,13 +370,9 @@ declare class Dxf extends Component<{
|
|
|
290
370
|
static createData(pointsGroups: Point[][], sealed?: boolean): OriginalDataItem[];
|
|
291
371
|
}
|
|
292
372
|
|
|
293
|
-
declare
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
dxfModelGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
297
|
-
onAddFromParent(parent: ComponentManager): void;
|
|
298
|
-
updateMode(): void;
|
|
299
|
-
}
|
|
373
|
+
export declare const Dxf3DView: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
374
|
+
elRef: HTMLDivElement;
|
|
375
|
+
}, HTMLDivElement>;
|
|
300
376
|
|
|
301
377
|
declare class DxfSystem extends ComponentManager {
|
|
302
378
|
Dxf: Dxf;
|
|
@@ -343,12 +419,6 @@ declare interface EventTypeMap {
|
|
|
343
419
|
};
|
|
344
420
|
}
|
|
345
421
|
|
|
346
|
-
declare interface IDesPointItem {
|
|
347
|
-
message: string;
|
|
348
|
-
position: THREE.Vector3;
|
|
349
|
-
intersection: THREE.Vector3;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
422
|
/**
|
|
353
423
|
* 非轴对称线段
|
|
354
424
|
*/
|
|
@@ -378,7 +448,11 @@ declare class LineSegment<T = Record<string, any>> {
|
|
|
378
448
|
clone(): LineSegment<Record<string, any>>;
|
|
379
449
|
}
|
|
380
450
|
|
|
381
|
-
|
|
451
|
+
declare class ModelDataRender extends Component {
|
|
452
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
453
|
+
dxf(parent: ComponentManager): void;
|
|
454
|
+
whiteModel(parent: ComponentManager): void;
|
|
455
|
+
}
|
|
382
456
|
|
|
383
457
|
declare interface OriginalDataItem {
|
|
384
458
|
start: {
|
|
@@ -402,6 +476,18 @@ declare interface OriginalDataItem {
|
|
|
402
476
|
isDoor?: boolean;
|
|
403
477
|
}
|
|
404
478
|
|
|
479
|
+
declare class OriginalLineRender extends Component {
|
|
480
|
+
Dxf: Dxf | null;
|
|
481
|
+
Renderer: Renderer | null;
|
|
482
|
+
originalLineMode: THREE.LineSegments<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
483
|
+
appendLineMode: THREE.LineSegments<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
484
|
+
textGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
485
|
+
pointGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
486
|
+
distanceGroup: THREE.Group<THREE.Object3DEventMap>;
|
|
487
|
+
onAddFromParent(parent: ComponentManager): void;
|
|
488
|
+
updateMode(data: any): void;
|
|
489
|
+
}
|
|
490
|
+
|
|
405
491
|
declare class Point {
|
|
406
492
|
x: number;
|
|
407
493
|
y: number;
|
|
@@ -516,6 +602,12 @@ declare class Point {
|
|
|
516
602
|
static zero(): Point;
|
|
517
603
|
}
|
|
518
604
|
|
|
605
|
+
declare interface PointGroup {
|
|
606
|
+
points: Point[];
|
|
607
|
+
indices: number[];
|
|
608
|
+
rectIndices: number[];
|
|
609
|
+
}
|
|
610
|
+
|
|
519
611
|
/**
|
|
520
612
|
* 非轴对称矩形
|
|
521
613
|
*/
|
|
@@ -554,6 +646,85 @@ declare class Rectangle {
|
|
|
554
646
|
static fromByLineSegment(line: LineSegment, width?: number, horizontal?: boolean, hScale?: number): Rectangle;
|
|
555
647
|
}
|
|
556
648
|
|
|
649
|
+
declare class Renderer extends Component {
|
|
650
|
+
static CSS2DObject: typeof CSS2DObject;
|
|
651
|
+
static CSS3DObject: typeof CSS3DObject;
|
|
652
|
+
static CSS3DSprite: typeof CSS3DSprite;
|
|
653
|
+
static Group: typeof THREE.Group;
|
|
654
|
+
static Object3D: typeof THREE.Object3D;
|
|
655
|
+
static Mesh: typeof THREE.Mesh;
|
|
656
|
+
static Line: typeof THREE.Line;
|
|
657
|
+
static LineSegments: typeof THREE.LineSegments;
|
|
658
|
+
static Points: typeof THREE.Points;
|
|
659
|
+
scene: THREE.Scene;
|
|
660
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
661
|
+
renderer: THREE.WebGLRenderer;
|
|
662
|
+
orbitControls?: OrbitControls;
|
|
663
|
+
private resizeObserver?;
|
|
664
|
+
private description;
|
|
665
|
+
html2DRenderer?: CSS2DRenderer;
|
|
666
|
+
html3DRenderer?: CSS3DRenderer;
|
|
667
|
+
container: THREE.Group<THREE.Object3DEventMap>;
|
|
668
|
+
onUpdate?: () => void;
|
|
669
|
+
onResize?: (width: number, height: number) => void;
|
|
670
|
+
private tweenTaskList;
|
|
671
|
+
constructor(description: RendererDescription);
|
|
672
|
+
/**
|
|
673
|
+
* 世界坐标转屏幕坐标
|
|
674
|
+
* @param worldPosition
|
|
675
|
+
* @param camera
|
|
676
|
+
* @param renderer
|
|
677
|
+
* @returns
|
|
678
|
+
*/
|
|
679
|
+
worldToScreenPosition(worldPosition: THREE.Vector3): THREE.Vector2;
|
|
680
|
+
cameraPositionRecord: [THREE.Vector3, THREE.Quaternion][];
|
|
681
|
+
/**
|
|
682
|
+
* 相机
|
|
683
|
+
* @param position
|
|
684
|
+
* @param lookAt
|
|
685
|
+
* @param onEnd
|
|
686
|
+
*/
|
|
687
|
+
cameraTo(position: THREE.Vector3, lookAt: THREE.Vector3, onEnd?: any): void;
|
|
688
|
+
cameraBack(): void;
|
|
689
|
+
/**
|
|
690
|
+
* 创建点
|
|
691
|
+
* @param pos
|
|
692
|
+
*/
|
|
693
|
+
createPointMesh(pos?: Point | THREE.Vector3, size?: number, parameters?: THREE.MeshBasicMaterialParameters, parent?: THREE.Object3D): void;
|
|
694
|
+
/**
|
|
695
|
+
* 创建文本
|
|
696
|
+
* @param text
|
|
697
|
+
* @param pos
|
|
698
|
+
* @param style
|
|
699
|
+
*/
|
|
700
|
+
createText(text: any, pos?: Point | THREE.Vector3, style?: any, parent?: THREE.Object3D): void;
|
|
701
|
+
/**
|
|
702
|
+
* 创建几何缓冲区
|
|
703
|
+
* @param map
|
|
704
|
+
* @param count
|
|
705
|
+
*/
|
|
706
|
+
createLineSegments(map: Record<string, number[]>, count: number, parameters?: THREE.LineBasicMaterialParameters, parent?: THREE.Object3D): THREE.LineSegments<THREE.BufferGeometry<THREE.NormalBufferAttributes, THREE.BufferGeometryEventMap>, THREE.LineBasicMaterial, THREE.Object3DEventMap>;
|
|
707
|
+
destroy(): void;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
declare interface RendererDescription {
|
|
711
|
+
canvas: HTMLCanvasElement;
|
|
712
|
+
orbitControls?: {
|
|
713
|
+
enableDamping?: boolean;
|
|
714
|
+
dampingFactor?: number;
|
|
715
|
+
domElement: HTMLElement;
|
|
716
|
+
};
|
|
717
|
+
htmlRenderer?: {
|
|
718
|
+
'2d'?: HTMLElement;
|
|
719
|
+
'3d'?: HTMLElement;
|
|
720
|
+
};
|
|
721
|
+
resizeObserver?: HTMLElement | null;
|
|
722
|
+
scene?: THREE.Scene;
|
|
723
|
+
camera?: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
export declare function RenderPlugin(dxfSystem: DxfSystem): void;
|
|
727
|
+
|
|
557
728
|
declare type Unit = "Unitless" | "Inches" | "Feet" | "Miles" | "Millimeters" | "Centimeters" | "Meters" | "Kilometers" | "Microinches" | "Mils" | "Yards" | "Angstroms" | "Nanometers" | "Microns" | "Decimeters" | "Decameters" | "Hectometers" | "Gigameters" | "Astronomical units" | "Light years" | "Parsecs";
|
|
558
729
|
|
|
559
730
|
declare class Variable extends Component<EventType> {
|
|
@@ -583,6 +754,9 @@ declare class WhiteModel extends Component<{
|
|
|
583
754
|
originalWhiteMode: THREE.Group<THREE.Object3DEventMap>;
|
|
584
755
|
onAddFromParent(parent: ComponentManager): void;
|
|
585
756
|
updateModel(): void;
|
|
757
|
+
toOBJ(): Promise<string>;
|
|
758
|
+
toBlob(): Promise<Blob | undefined>;
|
|
759
|
+
download(filename: string): Promise<void>;
|
|
586
760
|
}
|
|
587
761
|
|
|
588
762
|
export { }
|