build-dxf 0.0.17 → 0.0.18
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
CHANGED
package/src/build.js
CHANGED
|
@@ -2198,6 +2198,7 @@ class LineAnalysis extends Component {
|
|
|
2198
2198
|
* 门的位置判断
|
|
2199
2199
|
*/
|
|
2200
2200
|
doorsAnalysis() {
|
|
2201
|
+
this.parent?.findComponentByName("Renderer");
|
|
2201
2202
|
const dxf = this.Dxf, doorPoints = [], pointVirtualGrid = this.pointVirtualGrid, quadtree = this.quadtree, doorSearchNearAngle = this.doorSearchNearAngle, doorSearchDistance = this.doorSearchDistance, doors = [];
|
|
2202
2203
|
const excludePoints = dxf.doors.flatMap((item) => {
|
|
2203
2204
|
const index2 = item[4];
|
|
@@ -2239,12 +2240,15 @@ class LineAnalysis extends Component {
|
|
|
2239
2240
|
});
|
|
2240
2241
|
dxf.lineSegments.forEach((line, i) => {
|
|
2241
2242
|
if (line.userData?.isDoor) return;
|
|
2242
|
-
const
|
|
2243
|
+
const index2 = this.lineSegmentList.indexOf(line);
|
|
2244
|
+
const excludeMode = excludeIndexMap.get(index2);
|
|
2243
2245
|
if (excludeMode === -1) return;
|
|
2244
2246
|
line.points.forEach((p, j) => {
|
|
2245
2247
|
if (excludeMode === j) return;
|
|
2246
2248
|
if (excludePoints.find((p1) => p1.equal(p))) return;
|
|
2247
|
-
const res = this.pointVirtualGrid.queryPoint(p).filter(
|
|
2249
|
+
const res = this.pointVirtualGrid.queryPoint(p).filter(
|
|
2250
|
+
(d) => d.userData?.index !== i
|
|
2251
|
+
);
|
|
2248
2252
|
if (res.length === 0) {
|
|
2249
2253
|
doorPoints.push({
|
|
2250
2254
|
line,
|
|
@@ -2472,12 +2476,13 @@ class LineAnalysis extends Component {
|
|
|
2472
2476
|
* @returns
|
|
2473
2477
|
*/
|
|
2474
2478
|
findLongLineSegment(line) {
|
|
2479
|
+
const dxf = this.Dxf;
|
|
2475
2480
|
const resLine = line.clone();
|
|
2476
2481
|
const res1 = this.pointVirtualGrid.queryPoint(line.start);
|
|
2477
2482
|
const res2 = this.pointVirtualGrid.queryPoint(line.end);
|
|
2478
2483
|
for (let i = 0; i < res1.length; i++) {
|
|
2479
2484
|
const { userData } = res1[i];
|
|
2480
|
-
const line2 =
|
|
2485
|
+
const line2 = dxf.lineSegments[userData?.index];
|
|
2481
2486
|
if (line2 === line) continue;
|
|
2482
2487
|
if (line2 && line2.directionEqual(line)) {
|
|
2483
2488
|
if (line2.start.equal(line.start)) resLine.start.copy(line2.end);
|
|
@@ -2487,7 +2492,7 @@ class LineAnalysis extends Component {
|
|
|
2487
2492
|
}
|
|
2488
2493
|
for (let i = 0; i < res2.length; i++) {
|
|
2489
2494
|
const { userData } = res2[i];
|
|
2490
|
-
const line2 =
|
|
2495
|
+
const line2 = dxf.lineSegments[userData?.index];
|
|
2491
2496
|
if (line2 === line) continue;
|
|
2492
2497
|
if (line2 && line2.directionEqual(line)) {
|
|
2493
2498
|
if (line2.end.equal(line.end)) resLine.end.copy(line2.start);
|
|
@@ -2519,6 +2524,9 @@ class DoorsAnalysis {
|
|
|
2519
2524
|
resultList;
|
|
2520
2525
|
// 已过滤门的线段
|
|
2521
2526
|
lineSegments;
|
|
2527
|
+
doorSearchNearAngle = 110;
|
|
2528
|
+
doorSearchDistance = 2;
|
|
2529
|
+
doors = [];
|
|
2522
2530
|
constructor(dxf, pointVirtualGrid, quadtree, resultList = [], lineSegments = []) {
|
|
2523
2531
|
this.dxf = dxf;
|
|
2524
2532
|
this.pointVirtualGrid = pointVirtualGrid;
|
|
@@ -2539,6 +2547,7 @@ class DoorsAnalysis {
|
|
|
2539
2547
|
return !!this.doorPoint.find((p1) => p1.point.equal(point));
|
|
2540
2548
|
});
|
|
2541
2549
|
this.possibleDoorPoints = this.searchPossiblePoints();
|
|
2550
|
+
if (dxf.doors.length < 2) ;
|
|
2542
2551
|
}
|
|
2543
2552
|
/**
|
|
2544
2553
|
*
|
|
@@ -2619,6 +2628,19 @@ class DoorsAnalysis {
|
|
|
2619
2628
|
});
|
|
2620
2629
|
return excludeIndexMap;
|
|
2621
2630
|
}
|
|
2631
|
+
/** 最近点查找
|
|
2632
|
+
* @description 以点为圆心,查找半径内符合角度的点,
|
|
2633
|
+
* @param param0
|
|
2634
|
+
* @param doorIndex
|
|
2635
|
+
* @param record
|
|
2636
|
+
* @returns
|
|
2637
|
+
*/
|
|
2638
|
+
searchNearby({ point, line, index: index2 }, doorIndex, record) {
|
|
2639
|
+
const pointVirtualGrid = this.pointVirtualGrid, doorSearchDistance = this.doorSearchDistance;
|
|
2640
|
+
const direct = line.direction();
|
|
2641
|
+
if (line.start === point) direct.multiplyScalar(-1);
|
|
2642
|
+
pointVirtualGrid.queryCircle(point, doorSearchDistance).filter((r) => r.userData?.index !== index2).sort((a, b) => a.point.distance(point) - b.point.distance(point));
|
|
2643
|
+
}
|
|
2622
2644
|
}
|
|
2623
2645
|
class DxfSystem extends ComponentManager {
|
|
2624
2646
|
Dxf;
|
|
@@ -18,7 +18,10 @@ export declare class LineAnalysis extends Component {
|
|
|
18
18
|
static name: string;
|
|
19
19
|
Dxf: Dxf | null;
|
|
20
20
|
Variable: Variable | null;
|
|
21
|
-
lineSegmentList: LineSegment
|
|
21
|
+
lineSegmentList: LineSegment<{
|
|
22
|
+
isDoor: boolean;
|
|
23
|
+
isWindow: boolean;
|
|
24
|
+
}>[];
|
|
22
25
|
container: THREE.Group<THREE.Object3DEventMap>;
|
|
23
26
|
errorAngle: number;
|
|
24
27
|
width: number;
|