build-dxf 0.1.79 → 0.1.81
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 +1 -1
- package/src/DomEventRegister.js +1 -1
- package/src/api/index.d.ts +22 -0
- package/src/api/type.d.ts +30 -0
- package/src/build.js +142 -108
- package/src/index3.js +11 -0
- package/src/utils/DxfSystem/components/CorrectionDxf.d.ts +1 -1
- package/src/utils/DxfSystem/components/Dxf.d.ts +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/CadPreProcessor/index.d.ts +3 -3
- package/src/utils/DxfSystem/utils/lineHandle/CadPreProcessor/{stepElimination.d.ts → linesSmoothing.d.ts} +1 -1
- package/src/utils/DxfSystem/utils/lineHandle/buildGroup/buildBayWindowGroup.d.ts +7 -0
- package/src/utils/DxfSystem/utils/lineHandle/{buildGroup.d.ts → buildGroup/buildDoubleWallGroup.d.ts} +2 -7
- package/src/utils/DxfSystem/utils/lineHandle/buildGroup/index.d.ts +2 -0
- package/src/utils/DxfSystem/utils/tools/WallInsertObject.d.ts +1 -1
- package/src/utils/algorithmsStructures/mergeUShapedPath.d.ts +6 -0
- package/src/utils/algorithmsStructures/stepElimination.d.ts +1 -1
- package/src/utils/tools/StorageHelper.d.ts +2 -0
- package/src/utils/tools/getJson.d.ts +5 -0
package/package.json
CHANGED
package/src/DomEventRegister.js
CHANGED
|
@@ -107,7 +107,7 @@ const _Renderer = class _Renderer extends Component {
|
|
|
107
107
|
this.description = description;
|
|
108
108
|
const {
|
|
109
109
|
scene = new THREE.Scene(),
|
|
110
|
-
camera = new THREE.PerspectiveCamera(45, 1,
|
|
110
|
+
camera = new THREE.PerspectiveCamera(45, 1, 1e-4, 1e3)
|
|
111
111
|
} = description;
|
|
112
112
|
this.camera = camera;
|
|
113
113
|
this.scene = scene;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IRegion, ISpace } from './type';
|
|
2
|
+
export declare function getSpaceListApi(): Promise<ISpace[]>;
|
|
3
|
+
/** 获取区域列表api
|
|
4
|
+
* @param idSpace
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function getRegionListApi(idSpace: String): Promise<IRegion[]>;
|
|
8
|
+
/** 获取名下所有区域列表 api
|
|
9
|
+
*/
|
|
10
|
+
export declare function getRegionListAllApi(): Promise<{
|
|
11
|
+
regionList: IRegion[][];
|
|
12
|
+
spaceList: ISpace[];
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* 更新三维家json
|
|
16
|
+
*/
|
|
17
|
+
export declare function updateThreeJiaJsonApi(body: {
|
|
18
|
+
schemeContent: string;
|
|
19
|
+
idRegion: string;
|
|
20
|
+
models: string;
|
|
21
|
+
dxf: string;
|
|
22
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type ModelItemType = "dxf" | "gltf" | "jpg" | "glb" | "originalJson" | "json" | "obj" | "threeVJiaJson" | "publicInfoJson" | "trajectory";
|
|
2
|
+
export interface IModelItem {
|
|
3
|
+
type: ModelItemType;
|
|
4
|
+
url: string;
|
|
5
|
+
data?: any;
|
|
6
|
+
}
|
|
7
|
+
export interface IRegion {
|
|
8
|
+
idRegion: string;
|
|
9
|
+
regionName: string;
|
|
10
|
+
type: string;
|
|
11
|
+
active: string;
|
|
12
|
+
createTime: string;
|
|
13
|
+
updateTime: number;
|
|
14
|
+
url: string;
|
|
15
|
+
idSpace: string;
|
|
16
|
+
username: string;
|
|
17
|
+
nickName: string;
|
|
18
|
+
headerImg: string;
|
|
19
|
+
dxf: string;
|
|
20
|
+
models: IModelItem[];
|
|
21
|
+
ext: string;
|
|
22
|
+
progress: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ISpace {
|
|
25
|
+
idSpace: string;
|
|
26
|
+
spaceName: string;
|
|
27
|
+
accountRole: number;
|
|
28
|
+
active: number;
|
|
29
|
+
regionList: IRegion[];
|
|
30
|
+
}
|
package/src/build.js
CHANGED
|
@@ -3107,7 +3107,9 @@ class WallInsertObject {
|
|
|
3107
3107
|
return item.id ?? item.doorId;
|
|
3108
3108
|
}
|
|
3109
3109
|
static getNearId(item) {
|
|
3110
|
-
|
|
3110
|
+
let nearId = item.nearId ?? item.nearDoorId;
|
|
3111
|
+
if (nearId === -1) nearId = void 0;
|
|
3112
|
+
return nearId;
|
|
3111
3113
|
}
|
|
3112
3114
|
/** 遍历孔洞
|
|
3113
3115
|
* @param line
|
|
@@ -6571,6 +6573,39 @@ class MaxiCircles extends MiniCircles {
|
|
|
6571
6573
|
};
|
|
6572
6574
|
}
|
|
6573
6575
|
}
|
|
6576
|
+
const maxiCircles$1 = new MaxiCircles();
|
|
6577
|
+
function buildBayWindowGroup(lines, clear = true) {
|
|
6578
|
+
const bayWindowLines = lines.filter((line) => line.userData.isBayWindow), groupedLineSet = /* @__PURE__ */ new Set();
|
|
6579
|
+
const removeSet = findDiscretePointLine2(lines, null, true);
|
|
6580
|
+
const lines_ = lines.filter((line) => !removeSet.has(line));
|
|
6581
|
+
lines.forEach((line) => {
|
|
6582
|
+
if (LineGroupType.hasType(line, "bayWindow")) {
|
|
6583
|
+
if (line.userData.isWindow) line.currentData.isBayWindowLine = true;
|
|
6584
|
+
LineGroupType.removeByType(line, "bayWindow");
|
|
6585
|
+
}
|
|
6586
|
+
});
|
|
6587
|
+
const grid = createPointVirtualGrid(lines);
|
|
6588
|
+
removeSet.clear();
|
|
6589
|
+
bayWindowLines.forEach((bayWindowLine) => {
|
|
6590
|
+
let { circles } = maxiCircles$1.miniCircle(lines_, { circleEdges: [bayWindowLine] });
|
|
6591
|
+
circles = circles.filter((group) => group.some((line) => line.userData.isWindow && line.currentData.isBayWindowLine));
|
|
6592
|
+
if (circles.length) {
|
|
6593
|
+
grid.queryPolygon(Polygon.fromByLines(circles[0]), "inside").forEach((res) => removeSet.add(res.userData));
|
|
6594
|
+
}
|
|
6595
|
+
const id = uuid();
|
|
6596
|
+
if (circles.length) {
|
|
6597
|
+
const group = circles[0];
|
|
6598
|
+
group.forEach((line) => {
|
|
6599
|
+
clear && LineGroupType.clear(line);
|
|
6600
|
+
LineGroupType.set(line, id, "bayWindow", true);
|
|
6601
|
+
groupedLineSet.add(line);
|
|
6602
|
+
});
|
|
6603
|
+
} else clear && LineGroupType.clear(bayWindowLine);
|
|
6604
|
+
});
|
|
6605
|
+
lines = lines.filter((line) => !removeSet.has(line));
|
|
6606
|
+
clear && lines.forEach((line) => groupedLineSet.has(line) || LineGroupType.clear(line));
|
|
6607
|
+
return lines;
|
|
6608
|
+
}
|
|
6574
6609
|
const maxiCircles = new MaxiCircles();
|
|
6575
6610
|
let trajectory;
|
|
6576
6611
|
function isDoublePeDoorCircle(circle) {
|
|
@@ -6588,7 +6623,6 @@ function isDoublePeDoorCircle(circle) {
|
|
|
6588
6623
|
return matching.length > 0;
|
|
6589
6624
|
}
|
|
6590
6625
|
function isPolyHasTrajectoryPoint(lines) {
|
|
6591
|
-
if (isDoublePeDoorCircle(lines)) return true;
|
|
6592
6626
|
if (!trajectory) return true;
|
|
6593
6627
|
const ploy = Polygon.fromByLines2(lines);
|
|
6594
6628
|
const box = ploy.getBox2();
|
|
@@ -6599,29 +6633,56 @@ function isPolyHasTrajectoryPoint(lines) {
|
|
|
6599
6633
|
}
|
|
6600
6634
|
return true;
|
|
6601
6635
|
}
|
|
6602
|
-
function
|
|
6603
|
-
const doorLines = [], otherLines = [], peDoubleDoors = [];
|
|
6604
|
-
for (let i = 0; i <
|
|
6605
|
-
const line =
|
|
6636
|
+
function initData(lines) {
|
|
6637
|
+
const doorLines = [], otherLines = [], bayWindowLines = [], peDoors = [], peDoubleDoors = [];
|
|
6638
|
+
for (let i = 0; i < lines.length; i++) {
|
|
6639
|
+
const line = lines[i];
|
|
6606
6640
|
if (line.userData.isDoor) {
|
|
6607
6641
|
doorLines.push(line);
|
|
6608
6642
|
continue;
|
|
6609
6643
|
}
|
|
6610
6644
|
if (line.userData.isBayWindow) {
|
|
6645
|
+
bayWindowLines.push(line);
|
|
6611
6646
|
continue;
|
|
6612
6647
|
}
|
|
6613
6648
|
if (line.userData.isPassageEntrance && line.userData.passageEntrance?.length) {
|
|
6614
|
-
const isDoubleDoor = line.userData.passageEntrance.some((item) => typeof WIO.
|
|
6649
|
+
const isDoubleDoor = line.userData.passageEntrance.some((item) => typeof WIO.getNearId(item) === "number");
|
|
6615
6650
|
if (isDoubleDoor) peDoubleDoors.push(line);
|
|
6651
|
+
else peDoors.push(line);
|
|
6616
6652
|
continue;
|
|
6617
6653
|
}
|
|
6618
6654
|
otherLines.push(line);
|
|
6619
6655
|
}
|
|
6620
|
-
otherLines
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
const
|
|
6656
|
+
return { doorLines, otherLines, bayWindowLines, peDoors, peDoubleDoors };
|
|
6657
|
+
}
|
|
6658
|
+
function getPeDoubleDoorCircles(lines, peDoubleDoorLines) {
|
|
6659
|
+
let allLines = [...lines, ...peDoubleDoorLines];
|
|
6660
|
+
const notFoundLines = [];
|
|
6661
|
+
const circlesList = [];
|
|
6662
|
+
for (let i = 0; i < peDoubleDoorLines.length; i++) {
|
|
6663
|
+
const line = peDoubleDoorLines[i];
|
|
6664
|
+
let { circles } = maxiCircles.miniCircle(allLines, { circleEdges: [line] });
|
|
6665
|
+
const finalCircles = circles.filter(isDoublePeDoorCircle);
|
|
6666
|
+
if (finalCircles.length) circlesList.push(...finalCircles);
|
|
6667
|
+
else notFoundLines.push(line);
|
|
6668
|
+
}
|
|
6669
|
+
return {
|
|
6670
|
+
circlesList,
|
|
6671
|
+
notFoundLines
|
|
6672
|
+
};
|
|
6673
|
+
}
|
|
6674
|
+
function buildDoubleWallGroup_(lines_, clearInternalLine = false) {
|
|
6675
|
+
const {
|
|
6676
|
+
doorLines,
|
|
6677
|
+
otherLines,
|
|
6678
|
+
// bayWindowLines,
|
|
6679
|
+
// peDoors,
|
|
6680
|
+
peDoubleDoors
|
|
6681
|
+
} = initData(lines_);
|
|
6682
|
+
const { notFoundLines, circlesList } = getPeDoubleDoorCircles(otherLines, peDoubleDoors);
|
|
6683
|
+
otherLines.push(...notFoundLines);
|
|
6684
|
+
let { internalEdges, circles } = maxiCircles.maxiCircles(otherLines, (circles2) => circles2.filter(isPolyHasTrajectoryPoint));
|
|
6685
|
+
const { circles: finalCircles } = maxiCircles.mergeCircles([...circlesList, ...circles], internalEdges);
|
|
6625
6686
|
lines_.forEach((line) => LineGroupType.removeByTypes(line, ["doubleWall", "wall"]));
|
|
6626
6687
|
const grid = new PointVirtualGrid(), finalCirclesSet = new Set(finalCircles.flat(2));
|
|
6627
6688
|
otherLines.forEach((line) => !finalCirclesSet.has(line) && grid.insert(line.center, line));
|
|
@@ -6650,38 +6711,6 @@ const buildDoubleWallGroup = Object.assign(buildDoubleWallGroup_, {
|
|
|
6650
6711
|
else trajectory = void 0;
|
|
6651
6712
|
}
|
|
6652
6713
|
});
|
|
6653
|
-
function buildBayWindowGroup(lines, clear = true) {
|
|
6654
|
-
const bayWindowLines = lines.filter((line) => line.userData.isBayWindow), groupedLineSet = /* @__PURE__ */ new Set();
|
|
6655
|
-
const removeSet = findDiscretePointLine2(lines, null, true);
|
|
6656
|
-
const lines_ = lines.filter((line) => !removeSet.has(line));
|
|
6657
|
-
lines.forEach((line) => {
|
|
6658
|
-
if (LineGroupType.hasType(line, "bayWindow")) {
|
|
6659
|
-
if (line.userData.isWindow) line.currentData.isBayWindowLine = true;
|
|
6660
|
-
LineGroupType.removeByType(line, "bayWindow");
|
|
6661
|
-
}
|
|
6662
|
-
});
|
|
6663
|
-
const grid = createPointVirtualGrid(lines);
|
|
6664
|
-
removeSet.clear();
|
|
6665
|
-
bayWindowLines.forEach((bayWindowLine) => {
|
|
6666
|
-
let { circles } = maxiCircles.miniCircle(lines_, { circleEdges: [bayWindowLine] });
|
|
6667
|
-
circles = circles.filter((group) => group.some((line) => line.userData.isWindow && line.currentData.isBayWindowLine));
|
|
6668
|
-
if (circles.length) {
|
|
6669
|
-
grid.queryPolygon(Polygon.fromByLines(circles[0]), "inside").forEach((res) => removeSet.add(res.userData));
|
|
6670
|
-
}
|
|
6671
|
-
const id = uuid();
|
|
6672
|
-
if (circles.length) {
|
|
6673
|
-
const group = circles[0];
|
|
6674
|
-
group.forEach((line) => {
|
|
6675
|
-
clear && LineGroupType.clear(line);
|
|
6676
|
-
LineGroupType.set(line, id, "bayWindow", true);
|
|
6677
|
-
groupedLineSet.add(line);
|
|
6678
|
-
});
|
|
6679
|
-
} else clear && LineGroupType.clear(bayWindowLine);
|
|
6680
|
-
});
|
|
6681
|
-
lines = lines.filter((line) => !removeSet.has(line));
|
|
6682
|
-
clear && lines.forEach((line) => groupedLineSet.has(line) || LineGroupType.clear(line));
|
|
6683
|
-
return lines;
|
|
6684
|
-
}
|
|
6685
6714
|
class DoubleWallHelper {
|
|
6686
6715
|
static errorAngle = 4;
|
|
6687
6716
|
/** 线段投影分析
|
|
@@ -8484,7 +8513,7 @@ class AxisAlignCorr {
|
|
|
8484
8513
|
}
|
|
8485
8514
|
}
|
|
8486
8515
|
function shortDistanceLink(lines, radius = 0.1) {
|
|
8487
|
-
const
|
|
8516
|
+
const dpSet = findDiscretePoint(lines.filter((line) => !line.userData.isDoor)), pointVirtualGrid = createPointVirtualGrid(dpSet.map((v2) => v2)), appendLines = [], visited = /* @__PURE__ */ new Set();
|
|
8488
8517
|
const getWeight2 = (target, point2, line) => {
|
|
8489
8518
|
if (target.weight) return target.weight;
|
|
8490
8519
|
const targetLine = target.userData, targetPoint = target.point;
|
|
@@ -8492,24 +8521,21 @@ function shortDistanceLink(lines, radius = 0.1) {
|
|
|
8492
8521
|
target.weight = weight;
|
|
8493
8522
|
return weight;
|
|
8494
8523
|
};
|
|
8495
|
-
for (
|
|
8496
|
-
const line = dpLines[i];
|
|
8524
|
+
for (const [point2, line] of dpSet) {
|
|
8497
8525
|
if (line.userData.isDoor) continue;
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
const
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
else appendLines.push(new LineSegment(projectLine1.center, projectLine2.center));
|
|
8512
|
-
});
|
|
8526
|
+
if (visited.has(point2)) continue;
|
|
8527
|
+
const list = pointVirtualGrid.queryCircle(point2, radius, true).map((item) => Object.assign({}, item)).filter((item) => {
|
|
8528
|
+
const targetLine2 = item.userData, targetPoint2 = item.point, direct1 = line.getAnotherPoint(point2).directionFrom(point2), direct2 = targetLine2.getAnotherPoint(targetPoint2).directionFrom(targetPoint2), angle = direct1.angleBetween(direct2, "angle");
|
|
8529
|
+
return angle > 90;
|
|
8530
|
+
}).sort((a2, b4) => getWeight2(b4, point2, line) - getWeight2(a2, point2, line));
|
|
8531
|
+
if (list.length === 0) continue;
|
|
8532
|
+
const { point: targetPoint } = list[0];
|
|
8533
|
+
const targetLine = list[0].userData;
|
|
8534
|
+
visited.add(point2);
|
|
8535
|
+
visited.add(targetPoint);
|
|
8536
|
+
const projectLine1 = line.projectLineSegment(targetLine), projectLine2 = targetLine.projectLineSegment(line), len1 = projectLine1.length(), len2 = projectLine2.length();
|
|
8537
|
+
if (len1 === 0 && len2 === 0) appendLines.push(new LineSegment(point2.clone(), list[0].point.clone()));
|
|
8538
|
+
else appendLines.push(new LineSegment(projectLine1.center, projectLine2.center));
|
|
8513
8539
|
}
|
|
8514
8540
|
return [...lines, ...appendLines];
|
|
8515
8541
|
}
|
|
@@ -8645,9 +8671,7 @@ function axisAlignCorr$1(lines, targettLine, option) {
|
|
|
8645
8671
|
if (wallGroup) {
|
|
8646
8672
|
newLines = DoubleWallHelper.complementSide(newLines);
|
|
8647
8673
|
WallInsertObject.recomputed(newLines);
|
|
8648
|
-
TEST = true;
|
|
8649
8674
|
newLines = buildDoubleWallGroup(newLines, true);
|
|
8650
|
-
TEST = false;
|
|
8651
8675
|
newLines = buildBayWindowGroup(newLines, false);
|
|
8652
8676
|
}
|
|
8653
8677
|
new WallInsertObject(lines).recomputed().merge();
|
|
@@ -19267,21 +19291,17 @@ function removeShortDoubleWall(lineSegments) {
|
|
|
19267
19291
|
const doubleWalls = LineGroupType.getGroupsByType(lineSegments, "doubleWall"), freePointLines = [...findDiscretePointLine2(lineSegments)].filter((line) => line.length() < 0.3), grid = createPointVirtualGrid(doubleWalls.flat(4)), lines = freePointLines.filter((line) => grid.queryPoint(line.start).length > 0 || grid.queryPoint(line.end).length > 0), removeSet = new Set(lines);
|
|
19268
19292
|
return lineSegments.filter((line) => !removeSet.has(line));
|
|
19269
19293
|
}
|
|
19270
|
-
function
|
|
19294
|
+
function getNextPoint(point2, line, next, width) {
|
|
19271
19295
|
if (next.length === 0) {
|
|
19272
19296
|
const direct = point2.directionFrom(line.getAnotherPoint(point2));
|
|
19273
|
-
point2.add(direct.multiplyScalar(width));
|
|
19274
|
-
return true;
|
|
19297
|
+
return point2.clone().add(direct.multiplyScalar(width));
|
|
19275
19298
|
}
|
|
19276
19299
|
const p2 = next[0].userData.projectPoint(point2, false);
|
|
19277
19300
|
if (!p2) return false;
|
|
19278
|
-
|
|
19279
|
-
next.forEach((d2) => d2.point.copy(p2));
|
|
19280
|
-
return true;
|
|
19301
|
+
return p2;
|
|
19281
19302
|
}
|
|
19282
|
-
function stepElimination
|
|
19303
|
+
function stepElimination(lineSegments, findMinWidth = 0.1, onMerge) {
|
|
19283
19304
|
const grid = createPointVirtualGrid(lineSegments);
|
|
19284
|
-
const minWidth = 0.1;
|
|
19285
19305
|
function getIntersInfo(line, point2) {
|
|
19286
19306
|
const intersList = grid.queryPoint(point2, true);
|
|
19287
19307
|
if (intersList.length == 0) return;
|
|
@@ -19300,7 +19320,6 @@ function stepElimination$1(lineSegments, callBack) {
|
|
|
19300
19320
|
}
|
|
19301
19321
|
if (count !== 1) return;
|
|
19302
19322
|
if (!firstLine || !firstPoint) return;
|
|
19303
|
-
if (parallel2.length !== 0) return;
|
|
19304
19323
|
const firstOtherPoint = firstLine.getAnotherPoint(firstPoint);
|
|
19305
19324
|
const nextResult = grid.queryPoint(firstOtherPoint, true);
|
|
19306
19325
|
return {
|
|
@@ -19318,7 +19337,7 @@ function stepElimination$1(lineSegments, callBack) {
|
|
|
19318
19337
|
for (let i = 0; i < lineSegments.length; i++) {
|
|
19319
19338
|
const line = lineSegments[i];
|
|
19320
19339
|
const len = line.length();
|
|
19321
|
-
if (len >
|
|
19340
|
+
if (len > findMinWidth) continue;
|
|
19322
19341
|
const startInfo = getIntersInfo(line, line.start);
|
|
19323
19342
|
if (!startInfo) continue;
|
|
19324
19343
|
const endInfo = getIntersInfo(line, line.end);
|
|
@@ -19336,13 +19355,28 @@ function stepElimination$1(lineSegments, callBack) {
|
|
|
19336
19355
|
mainInfo = endInfo;
|
|
19337
19356
|
secondaryInfo = startInfo;
|
|
19338
19357
|
}
|
|
19339
|
-
const
|
|
19340
|
-
|
|
19341
|
-
|
|
19342
|
-
|
|
19358
|
+
const parallel2 = startInfo.parallel.concat(endInfo.parallel);
|
|
19359
|
+
const newPoint = getNextPoint(mainInfo.firstPoint, mainInfo.firstLine, secondaryInfo.next, secondaryInfo.length);
|
|
19360
|
+
if (!newPoint) continue;
|
|
19361
|
+
removeLines.push(line);
|
|
19343
19362
|
line.points.forEach((p2) => grid.remove(p2));
|
|
19344
|
-
|
|
19345
|
-
|
|
19363
|
+
if (parallel2.length === 0) {
|
|
19364
|
+
const oldLine = mainInfo.firstLine.clone();
|
|
19365
|
+
mainInfo.firstPoint.copy(newPoint);
|
|
19366
|
+
secondaryInfo.next.forEach((d2) => d2.point.copy(newPoint));
|
|
19367
|
+
removeLines.push(secondaryInfo.firstLine);
|
|
19368
|
+
secondaryInfo.firstLine.points.forEach((p2) => grid.remove(p2));
|
|
19369
|
+
mainInfo.firstLine.points.forEach((p2) => grid.update(p2));
|
|
19370
|
+
if (typeof onMerge === "function") onMerge(mainInfo.firstLine, line, secondaryInfo.firstLine, oldLine);
|
|
19371
|
+
} else {
|
|
19372
|
+
secondaryInfo.firstPoint.copy(mainInfo.firstPoint);
|
|
19373
|
+
secondaryInfo.firstOtherPoint.copy(newPoint);
|
|
19374
|
+
secondaryInfo.next.forEach((d2) => d2.point.copy(newPoint));
|
|
19375
|
+
startInfo.parallel.concat(endInfo.parallel).forEach((item) => item.point.copy(mainInfo.firstPoint));
|
|
19376
|
+
secondaryInfo.firstLine.points.forEach((p2) => grid.update(p2));
|
|
19377
|
+
secondaryInfo.next.forEach((d2) => grid.update(d2.point));
|
|
19378
|
+
startInfo.parallel.concat(endInfo.parallel).forEach((item) => grid.update(item.point));
|
|
19379
|
+
}
|
|
19346
19380
|
}
|
|
19347
19381
|
const removeLinesSet = new Set(removeLines);
|
|
19348
19382
|
lineSegments = lineSegments.filter((line) => !removeLinesSet.has(line));
|
|
@@ -19353,32 +19387,32 @@ function repetitiveTask(count, callfun) {
|
|
|
19353
19387
|
callfun(i);
|
|
19354
19388
|
}
|
|
19355
19389
|
}
|
|
19356
|
-
function
|
|
19357
|
-
|
|
19358
|
-
|
|
19359
|
-
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
height: source.userData.drawDoorData.height,
|
|
19365
|
-
groundClearance: source.userData.drawDoorData.groundClearance
|
|
19366
|
-
});
|
|
19367
|
-
if (target.userData.isDoor) {
|
|
19368
|
-
delete target.userData.isDoor;
|
|
19369
|
-
WallInsertObject.addInsertObject(target, {
|
|
19370
|
-
p: oldLine.center.toJson(opt?.originalZ),
|
|
19371
|
-
width: oldLine.length(),
|
|
19372
|
-
full: false,
|
|
19373
|
-
type: "door",
|
|
19374
|
-
height: target.userData.drawDoorData?.height,
|
|
19375
|
-
groundClearance: target.userData.drawDoorData?.groundClearance ?? 0
|
|
19376
|
-
});
|
|
19377
|
-
}
|
|
19378
|
-
WallInsertObject.copyInsertObject(target, source);
|
|
19379
|
-
WallInsertObject.recomputed([target]);
|
|
19380
|
-
});
|
|
19390
|
+
function stepEliminationMerge(target, _, source, oldLine) {
|
|
19391
|
+
if (source.userData.isDoor) WallInsertObject.addInsertObject(target, {
|
|
19392
|
+
p: source.center.toJson(),
|
|
19393
|
+
width: source.length(),
|
|
19394
|
+
full: false,
|
|
19395
|
+
type: "door",
|
|
19396
|
+
height: source.userData.drawDoorData.height,
|
|
19397
|
+
groundClearance: source.userData.drawDoorData.groundClearance
|
|
19381
19398
|
});
|
|
19399
|
+
if (target.userData.isDoor) {
|
|
19400
|
+
delete target.userData.isDoor;
|
|
19401
|
+
WallInsertObject.addInsertObject(target, {
|
|
19402
|
+
p: oldLine.center.toJson(),
|
|
19403
|
+
width: oldLine.length(),
|
|
19404
|
+
full: false,
|
|
19405
|
+
type: "door",
|
|
19406
|
+
height: target.userData.drawDoorData?.height,
|
|
19407
|
+
groundClearance: target.userData.drawDoorData?.groundClearance ?? 0
|
|
19408
|
+
});
|
|
19409
|
+
}
|
|
19410
|
+
WallInsertObject.copyInsertObject(target, source);
|
|
19411
|
+
WallInsertObject.recomputed([target]);
|
|
19412
|
+
}
|
|
19413
|
+
function linesSmoothing(lines, _) {
|
|
19414
|
+
repetitiveTask(2, () => lines = stepElimination(lines, 0.1, stepEliminationMerge));
|
|
19415
|
+
WallInsertObject.recomputed(lines);
|
|
19382
19416
|
return lines;
|
|
19383
19417
|
}
|
|
19384
19418
|
const PRE_PROCESSOR = {
|
|
@@ -19399,9 +19433,9 @@ const PRE_PROCESSOR = {
|
|
|
19399
19433
|
/** 处理门线垂直方向有其他线段遮挡的情况
|
|
19400
19434
|
*/
|
|
19401
19435
|
DoorSpaceHandle: doorSpaceHandle,
|
|
19402
|
-
/**
|
|
19436
|
+
/** 线段平滑处理
|
|
19403
19437
|
*/
|
|
19404
|
-
|
|
19438
|
+
LinesSmoothing: linesSmoothing,
|
|
19405
19439
|
/** 移除与双线墙链接的短线段
|
|
19406
19440
|
*/
|
|
19407
19441
|
RemoveShortDoubleWall: removeShortDoubleWall
|
|
@@ -22142,7 +22176,7 @@ async function buildJson(opt) {
|
|
|
22142
22176
|
doorFind && (dxfSystem.Dxf.addPreProcessor(PRE_PROCESSOR.DoorSpaceHandle), dxfSystem.Dxf.addPreProcessor(PRE_PROCESSOR.DoorFind), dxfSystem.Dxf.addPreProcessor(PRE_PROCESSOR.DoorSpaceHandle));
|
|
22143
22177
|
if (opt.axisAlignCorr !== false) {
|
|
22144
22178
|
dxfSystem.Dxf.addPreProcessor(PRE_PROCESSOR.AxisAlignCorr);
|
|
22145
|
-
dxfSystem.Dxf.addPreProcessor(PRE_PROCESSOR.
|
|
22179
|
+
dxfSystem.Dxf.addPreProcessor(PRE_PROCESSOR.LinesSmoothing);
|
|
22146
22180
|
dxfSystem.Dxf.addPreProcessor(PRE_PROCESSOR.RemoveShortDoubleWall);
|
|
22147
22181
|
}
|
|
22148
22182
|
if (trajectory2) {
|
package/src/index3.js
CHANGED
|
@@ -17248,9 +17248,20 @@ class StorageHelper {
|
|
|
17248
17248
|
if (typeof v === "number") return v;
|
|
17249
17249
|
return Number(v);
|
|
17250
17250
|
}
|
|
17251
|
+
static getJson(key, defaultValue) {
|
|
17252
|
+
const v = this.get(key, defaultValue);
|
|
17253
|
+
try {
|
|
17254
|
+
if (v) return JSON.parse(v);
|
|
17255
|
+
} catch (error) {
|
|
17256
|
+
}
|
|
17257
|
+
return defaultValue;
|
|
17258
|
+
}
|
|
17251
17259
|
static set(key, vaalue) {
|
|
17252
17260
|
localStorage.setItem(key, String(vaalue));
|
|
17253
17261
|
}
|
|
17262
|
+
static setJson(key, value) {
|
|
17263
|
+
this.set(key, JSON.stringify(value));
|
|
17264
|
+
}
|
|
17254
17265
|
}
|
|
17255
17266
|
const _hoisted_1 = ["innerHTML"];
|
|
17256
17267
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -15,7 +15,7 @@ export declare class CorrectionDxf<TEventMap extends {} = {}> extends Dxf<{} & T
|
|
|
15
15
|
DoubleWallAlignment: typeof import('../utils/lineHandle/CadPreProcessor/doubleWallAlignment').doubleWallAlignment;
|
|
16
16
|
WallHeightHandle: typeof import('../utils/lineHandle/CadPreProcessor/wallHeightHandle').wallHeightHandle;
|
|
17
17
|
DoorSpaceHandle: typeof import('../utils/lineHandle/CadPreProcessor/doorSpaceHandle').doorSpaceHandle;
|
|
18
|
-
|
|
18
|
+
LinesSmoothing: typeof import('../utils/lineHandle/CadPreProcessor/linesSmoothing').linesSmoothing;
|
|
19
19
|
RemoveShortDoubleWall: typeof import('../utils/lineHandle/CadPreProcessor/removeShortDoubleWall').removeShortDoubleWall;
|
|
20
20
|
};
|
|
21
21
|
rotateCorrCad?: CAD;
|
|
@@ -29,7 +29,7 @@ export declare class Dxf<TEventMap extends {} = {}> extends Component<{
|
|
|
29
29
|
DoubleWallAlignment: typeof import('../utils/lineHandle/CadPreProcessor/doubleWallAlignment').doubleWallAlignment;
|
|
30
30
|
WallHeightHandle: typeof import('../utils/lineHandle/CadPreProcessor/wallHeightHandle').wallHeightHandle;
|
|
31
31
|
DoorSpaceHandle: typeof import('../utils/lineHandle/CadPreProcessor/doorSpaceHandle').doorSpaceHandle;
|
|
32
|
-
|
|
32
|
+
LinesSmoothing: typeof import('../utils/lineHandle/CadPreProcessor/linesSmoothing').linesSmoothing;
|
|
33
33
|
RemoveShortDoubleWall: typeof import('../utils/lineHandle/CadPreProcessor/removeShortDoubleWall').removeShortDoubleWall;
|
|
34
34
|
};
|
|
35
35
|
width: number;
|
|
@@ -6,7 +6,7 @@ import { doubleWallAlignment } from './doubleWallAlignment';
|
|
|
6
6
|
import { wallHeightHandle } from './wallHeightHandle';
|
|
7
7
|
import { doorSpaceHandle } from './doorSpaceHandle';
|
|
8
8
|
import { removeShortDoubleWall } from './removeShortDoubleWall';
|
|
9
|
-
import {
|
|
9
|
+
import { linesSmoothing } from './linesSmoothing';
|
|
10
10
|
/**
|
|
11
11
|
* 默认提供的预处理函数
|
|
12
12
|
*/
|
|
@@ -28,9 +28,9 @@ export declare const PRE_PROCESSOR: {
|
|
|
28
28
|
/** 处理门线垂直方向有其他线段遮挡的情况
|
|
29
29
|
*/
|
|
30
30
|
DoorSpaceHandle: typeof doorSpaceHandle;
|
|
31
|
-
/**
|
|
31
|
+
/** 线段平滑处理
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
LinesSmoothing: typeof linesSmoothing;
|
|
34
34
|
/** 移除与双线墙链接的短线段
|
|
35
35
|
*/
|
|
36
36
|
RemoveShortDoubleWall: typeof removeShortDoubleWall;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LineSegment } from '../../../../algorithmsStructures/LineSegment';
|
|
2
2
|
import { SetDataOption } from '../../../type';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function linesSmoothing(lines: LineSegment[], _?: SetDataOption): LineSegment<Record<string, any>>[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LineSegment } from '../../../../algorithmsStructures/LineSegment';
|
|
2
|
+
import { LineUserData } from '../../../type';
|
|
3
|
+
/** 构建飘窗组组结构
|
|
4
|
+
* @param lines
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildBayWindowGroup(lines: LineSegment<LineUserData>[], clear?: boolean): LineSegment<LineUserData>[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LineSegment } from '
|
|
2
|
-
import { LineUserData } from '
|
|
1
|
+
import { LineSegment } from '../../../../algorithmsStructures/LineSegment';
|
|
2
|
+
import { LineUserData } from '../../../type';
|
|
3
3
|
/** 双线墙
|
|
4
4
|
* @param lines_
|
|
5
5
|
* @param clearInternalLine
|
|
@@ -10,8 +10,3 @@ export declare function buildDoubleWallGroup_(lines_: LineSegment<LineUserData>[
|
|
|
10
10
|
export declare const buildDoubleWallGroup: typeof buildDoubleWallGroup_ & {
|
|
11
11
|
setTrajectory(trajectory_: Record<string, any> | undefined): void;
|
|
12
12
|
};
|
|
13
|
-
/** 构建飘窗组组结构
|
|
14
|
-
* @param lines
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
|
-
export declare function buildBayWindowGroup(lines: LineSegment<LineUserData>[], clear?: boolean): LineSegment<LineUserData>[];
|
|
@@ -2,7 +2,7 @@ import { LineSegment } from '../../../algorithmsStructures/LineSegment';
|
|
|
2
2
|
import { InsertObject, LineUserData } from '../../type';
|
|
3
3
|
type InsertObjectKey = 'drawWindow' | 'passageEntrance';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 墙体嵌入物(窗户、空洞)处理
|
|
6
6
|
*/
|
|
7
7
|
export declare class WallInsertObject {
|
|
8
8
|
static mountedObjectType: never[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LineSegment } from './LineSegment';
|
|
2
|
+
/** 合并U形路径
|
|
3
|
+
* @param lineSegments
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare function mergeUShapedPath(lineSegments: LineSegment[], findMinWidth?: number, onMerge?: (mainLine: LineSegment, sortLine: LineSegment, secondaryLine: LineSegment, oldLine: LineSegment) => void): LineSegment<Record<string, any>>[];
|
|
@@ -3,4 +3,4 @@ import { LineSegment } from './LineSegment';
|
|
|
3
3
|
* @param lineSegments
|
|
4
4
|
* @returns
|
|
5
5
|
*/
|
|
6
|
-
export declare function stepElimination(lineSegments: LineSegment[],
|
|
6
|
+
export declare function stepElimination(lineSegments: LineSegment[], findMinWidth?: number, onMerge?: (mainLine: LineSegment, sortLine: LineSegment, secondaryLine: LineSegment, oldLine: LineSegment) => void): LineSegment<Record<string, any>>[];
|
|
@@ -2,5 +2,7 @@ export declare class StorageHelper {
|
|
|
2
2
|
static get(key: string, defaultValue?: any): any;
|
|
3
3
|
static getBoolean(key: string, defaultValue?: boolean): boolean;
|
|
4
4
|
static getNumber(key: string, defaultValue?: number): number;
|
|
5
|
+
static getJson<T = any>(key: string, defaultValue: T): any;
|
|
5
6
|
static set(key: string, vaalue: any): void;
|
|
7
|
+
static setJson<T = any>(key: string, value: T): void;
|
|
6
8
|
}
|