build-dxf 0.1.146 → 0.1.148
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/build.js +68 -44
- package/src/dxf-system/plugins/editor/Command/DrawHole.d.ts +2 -2
- package/src/dxf-system/plugins/editor/Command/DrawWindow.d.ts +2 -2
- package/src/dxf-system/type.d.ts +2 -2
- package/src/dxf-system/utils/WallHole.d.ts +5 -5
- package/src/index3.js +9 -3
- package/src/utils/algorithms/CheckPointCloudContinuity.d.ts +1 -0
- package/src/utils/algorithms/LineSegmentUtils.d.ts +2 -0
- package/src/utils/algorithms/Quadtree.d.ts +1 -1
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -2739,9 +2739,9 @@ class Quadtree {
|
|
|
2739
2739
|
}));
|
|
2740
2740
|
return array;
|
|
2741
2741
|
}
|
|
2742
|
-
static from(lines) {
|
|
2742
|
+
static from(lines, userDataFun) {
|
|
2743
2743
|
const quadtree = new Quadtree(Box2.fromByLineSegment(...lines));
|
|
2744
|
-
lines.forEach((line) => quadtree.insert({ line, userData: void 0 }));
|
|
2744
|
+
lines.forEach((line, index2) => quadtree.insert({ line, userData: userDataFun ? userDataFun(line, index2) : void 0 }));
|
|
2745
2745
|
return quadtree;
|
|
2746
2746
|
}
|
|
2747
2747
|
}
|
|
@@ -3675,6 +3675,18 @@ class LineSegmentUtils {
|
|
|
3675
3675
|
}
|
|
3676
3676
|
return lines;
|
|
3677
3677
|
}
|
|
3678
|
+
/** 线段合法性检测 */
|
|
3679
|
+
static legitimacy(line) {
|
|
3680
|
+
const values = [
|
|
3681
|
+
line.start.x,
|
|
3682
|
+
line.start.y,
|
|
3683
|
+
line.end.x,
|
|
3684
|
+
line.end.y
|
|
3685
|
+
];
|
|
3686
|
+
return values.every(
|
|
3687
|
+
(v2) => typeof v2 === "number" && !Number.isNaN(v2)
|
|
3688
|
+
);
|
|
3689
|
+
}
|
|
3678
3690
|
/**保留四位小数位数
|
|
3679
3691
|
* @param points
|
|
3680
3692
|
*/
|
|
@@ -8519,13 +8531,14 @@ class PCSparseOctree {
|
|
|
8519
8531
|
}
|
|
8520
8532
|
}
|
|
8521
8533
|
const box3$1 = new THREE.Box3();
|
|
8522
|
-
|
|
8523
|
-
|
|
8534
|
+
const temp = new Vector3();
|
|
8535
|
+
function projectPointToSegment(point2, start, _end, dir) {
|
|
8524
8536
|
const len2 = dir.lengthSq();
|
|
8525
8537
|
if (len2 < 1e-12) {
|
|
8526
8538
|
return 0;
|
|
8527
8539
|
}
|
|
8528
|
-
|
|
8540
|
+
temp.copy(point2);
|
|
8541
|
+
let t2 = temp.sub(start).dot(dir) / len2;
|
|
8529
8542
|
t2 = Math.max(0, Math.min(1, t2));
|
|
8530
8543
|
return t2;
|
|
8531
8544
|
}
|
|
@@ -8570,7 +8583,7 @@ class CheckPointCloudContinuity {
|
|
|
8570
8583
|
* @param points
|
|
8571
8584
|
*/
|
|
8572
8585
|
static checkByProjectionContinuity(points, opt) {
|
|
8573
|
-
let { ratio = 0.6, axisLine } = opt ?? {};
|
|
8586
|
+
let { ratio = 0.6, gridSize = 0.02, axisLine } = opt ?? {};
|
|
8574
8587
|
if (!axisLine) {
|
|
8575
8588
|
const rectangle = new Polygon(
|
|
8576
8589
|
points.map((p2) => new Point(p2.x, p2.y))
|
|
@@ -8584,17 +8597,17 @@ class CheckPointCloudContinuity {
|
|
|
8584
8597
|
start.set(xline.start.x, xline.start.y, 0);
|
|
8585
8598
|
end.set(xline.end.x, xline.end.y, 0);
|
|
8586
8599
|
const xts = this.projectPoint(points, start, end);
|
|
8587
|
-
if (!this.continuity(xts, xline.length, ratio)) return false;
|
|
8600
|
+
if (!this.continuity(xts, xline.length, gridSize, ratio)) return false;
|
|
8588
8601
|
const yline2 = xline.clone().rotate(Math.PI * 0.5);
|
|
8589
8602
|
start.set(yline2.start.x, yline2.start.y, 0);
|
|
8590
8603
|
end.set(yline2.end.x, yline2.end.y, 0);
|
|
8591
8604
|
const yts = this.projectPoint(points, start, end);
|
|
8592
|
-
if (!this.continuity(yts, yline2.length, ratio)) return false;
|
|
8605
|
+
if (!this.continuity(yts, yline2.length, gridSize, ratio)) return false;
|
|
8593
8606
|
const center = xline.center.clone();
|
|
8594
8607
|
start.set(center.x, center.y, 10);
|
|
8595
8608
|
end.set(center.x, center.y, -10);
|
|
8596
8609
|
const zts = this.projectPoint(points, start, end);
|
|
8597
|
-
if (!this.continuity(zts, 20, ratio)) return false;
|
|
8610
|
+
if (!this.continuity(zts, 20, gridSize, ratio)) return false;
|
|
8598
8611
|
return true;
|
|
8599
8612
|
}
|
|
8600
8613
|
/** 通过区域投影面积占比检测
|
|
@@ -8619,7 +8632,7 @@ class CheckPointCloudContinuity {
|
|
|
8619
8632
|
const dir = xline.direction(), angle = Math.atan2(dir.y, dir.x), center = xline.center, cos = Math.cos(-angle), sin = Math.sin(-angle), voxelizationPoints = [], xMap = new CounterMap(), yMap = new CounterMap(), occupied = /* @__PURE__ */ new Set();
|
|
8620
8633
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
8621
8634
|
points.forEach((p2) => {
|
|
8622
|
-
const dx = p2.x - center.x, dy = p2.y - center.y, x = Math.floor((dx * cos - dy * sin) / gridSize), y = Math.floor(p2.z / gridSize), key = BigInt(x) << 32n
|
|
8635
|
+
const dx = p2.x - center.x, dy = p2.y - center.y, x = Math.floor((dx * cos - dy * sin) / gridSize), y = Math.floor(p2.z / gridSize), key = BigInt(x) << 32n | BigInt(y) & 0xffffffffn;
|
|
8623
8636
|
if (occupied.has(key)) return;
|
|
8624
8637
|
occupied.add(key);
|
|
8625
8638
|
xMap.increment(x, 1);
|
|
@@ -8646,10 +8659,11 @@ class CheckPointCloudContinuity {
|
|
|
8646
8659
|
*/
|
|
8647
8660
|
static projectPoint(points, start, end) {
|
|
8648
8661
|
const point2 = new Vector3();
|
|
8662
|
+
const dir = end.clone().sub(start);
|
|
8649
8663
|
return points.map((p2) => {
|
|
8650
8664
|
point2.copy(p2);
|
|
8651
|
-
return projectPointToSegment(point2, start, end);
|
|
8652
|
-
})
|
|
8665
|
+
return projectPointToSegment(point2, start, end, dir);
|
|
8666
|
+
});
|
|
8653
8667
|
}
|
|
8654
8668
|
}
|
|
8655
8669
|
const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -8841,7 +8855,7 @@ class WallHole {
|
|
|
8841
8855
|
otherLines.push(line);
|
|
8842
8856
|
return [];
|
|
8843
8857
|
}
|
|
8844
|
-
WallHole.
|
|
8858
|
+
WallHole.forEachStorageType(line, (data, k) => {
|
|
8845
8859
|
if (k !== "passageEntrance") return;
|
|
8846
8860
|
data.forEach((v2) => {
|
|
8847
8861
|
const id = WallHole.getId(v2);
|
|
@@ -8897,7 +8911,7 @@ class WallHole {
|
|
|
8897
8911
|
* @param line
|
|
8898
8912
|
* @returns
|
|
8899
8913
|
*/
|
|
8900
|
-
static
|
|
8914
|
+
static forEachStorageType(line, callBack) {
|
|
8901
8915
|
if (line.userData.isWindow) {
|
|
8902
8916
|
line.userData.drawWindow?.forEach((item) => item.type = "window");
|
|
8903
8917
|
callBack(line.userData.drawWindow ?? [], "drawWindow");
|
|
@@ -8914,6 +8928,7 @@ class WallHole {
|
|
|
8914
8928
|
if (key === "drawWindow") return 0.3;
|
|
8915
8929
|
if (key === "passageEntrance") {
|
|
8916
8930
|
if (type === "door") return 0.4;
|
|
8931
|
+
else if (type === "passageEntrance") return 0.2;
|
|
8917
8932
|
}
|
|
8918
8933
|
return 0.05;
|
|
8919
8934
|
}
|
|
@@ -8940,7 +8955,7 @@ class WallHole {
|
|
|
8940
8955
|
line.forEach((line2) => this.miniWidthFilter(line2));
|
|
8941
8956
|
return this;
|
|
8942
8957
|
}
|
|
8943
|
-
this.
|
|
8958
|
+
this.forEachStorageType(line, (data, key) => {
|
|
8944
8959
|
line.userData[key] = data.filter((w) => w.width > WallHole.getMinWidth(key, w.type));
|
|
8945
8960
|
if (line.userData[key].length === 0) WallHole.clear(line, key);
|
|
8946
8961
|
});
|
|
@@ -8954,7 +8969,7 @@ class WallHole {
|
|
|
8954
8969
|
line.forEach((line2) => this.filterIllegal(line2));
|
|
8955
8970
|
return this;
|
|
8956
8971
|
}
|
|
8957
|
-
this.
|
|
8972
|
+
this.forEachStorageType(line, (data, key) => {
|
|
8958
8973
|
data.forEach((w) => {
|
|
8959
8974
|
if (!w.type && key === "drawWindow") w.type = "window";
|
|
8960
8975
|
try {
|
|
@@ -8978,7 +8993,7 @@ class WallHole {
|
|
|
8978
8993
|
*/
|
|
8979
8994
|
static recomputedCenter(lines) {
|
|
8980
8995
|
lines.forEach((line) => {
|
|
8981
|
-
this.
|
|
8996
|
+
this.forEachStorageType(line, (data, key) => {
|
|
8982
8997
|
data.forEach((w) => {
|
|
8983
8998
|
try {
|
|
8984
8999
|
const center = line.projectPoint(Point.from(w.p));
|
|
@@ -9070,7 +9085,7 @@ class WallHole {
|
|
|
9070
9085
|
* @param insertObject
|
|
9071
9086
|
*/
|
|
9072
9087
|
static removeHole(target, insertObject) {
|
|
9073
|
-
this.
|
|
9088
|
+
this.forEachStorageType(target, (data, key) => {
|
|
9074
9089
|
let index2 = data.indexOf(insertObject);
|
|
9075
9090
|
if (index2 > -1) {
|
|
9076
9091
|
data.splice(index2, 1);
|
|
@@ -9083,7 +9098,7 @@ class WallHole {
|
|
|
9083
9098
|
* @param source
|
|
9084
9099
|
*/
|
|
9085
9100
|
static copyHole(target, source) {
|
|
9086
|
-
WallHole.
|
|
9101
|
+
WallHole.forEachStorageType(source, (data, key) => {
|
|
9087
9102
|
data.forEach((item) => {
|
|
9088
9103
|
WallHole.addHole(target, cloneUserData(item), key);
|
|
9089
9104
|
});
|
|
@@ -9096,6 +9111,7 @@ class WallHole {
|
|
|
9096
9111
|
*/
|
|
9097
9112
|
static splitHole(target, source) {
|
|
9098
9113
|
if (!Array.isArray(source)) source = [];
|
|
9114
|
+
this.filterIllegal(target);
|
|
9099
9115
|
source = source.filter((line) => line.length > 1e-9);
|
|
9100
9116
|
const iterator = this.getIterator(target);
|
|
9101
9117
|
for (const hole of iterator) {
|
|
@@ -9115,7 +9131,8 @@ class WallHole {
|
|
|
9115
9131
|
}
|
|
9116
9132
|
}
|
|
9117
9133
|
if (!find && maxLine) {
|
|
9118
|
-
|
|
9134
|
+
let v2 = maxLine.projectPointValue(hole.p);
|
|
9135
|
+
v2 = Math.min(1, Math.max(0, v2));
|
|
9119
9136
|
const point2 = maxLine.pointAt(v2, PointUtils.globalPoint);
|
|
9120
9137
|
hole.p.x = point2.x;
|
|
9121
9138
|
hole.p.y = point2.y;
|
|
@@ -10200,7 +10217,7 @@ function clippingInsertObjectDoubleWall(lines) {
|
|
|
10200
10217
|
if (WallHole.isHole(line)) {
|
|
10201
10218
|
const normal = line.normal(), center = line.center;
|
|
10202
10219
|
if (!poly.pointWithin(center.add(normal.clone().multiplyScalar(1e-6)))) normal.multiplyScalar(-1);
|
|
10203
|
-
WallHole.
|
|
10220
|
+
WallHole.forEachStorageType(line, (data) => data.forEach((d2) => {
|
|
10204
10221
|
const wioLine = WallHole.holeDataToLine(line, d2);
|
|
10205
10222
|
wioLine.setLength(wioLine.length - 4e-3);
|
|
10206
10223
|
const len = wioLine.length;
|
|
@@ -10267,7 +10284,7 @@ class WallHoleDrawData {
|
|
|
10267
10284
|
if ("expandDirect" in line.userData) {
|
|
10268
10285
|
openDirect = line.userData.expandDirect === "left" ? line.getRightDirection() : line.getLeftDirection();
|
|
10269
10286
|
}
|
|
10270
|
-
WallHole.
|
|
10287
|
+
WallHole.forEachStorageType(line, (data, k) => {
|
|
10271
10288
|
const list = grid && doubleWallPoint$1(grid, line), dwh = defaultWallWidth$1 * 0.5;
|
|
10272
10289
|
data.map(({ full, width, p: p2, height, groundClearance, uuid: uuid2, type }) => {
|
|
10273
10290
|
if (full) width = line.length;
|
|
@@ -10318,7 +10335,7 @@ class WallHoleDrawData {
|
|
|
10318
10335
|
mergeLineUserData(newLine, lines);
|
|
10319
10336
|
WallHole.merge([newLine]);
|
|
10320
10337
|
const newLines = [];
|
|
10321
|
-
WallHole.
|
|
10338
|
+
WallHole.forEachStorageType(newLine, (data, key) => {
|
|
10322
10339
|
data.forEach(({ full, width, p: p2, height, groundClearance, type }) => {
|
|
10323
10340
|
const point2 = Point.from(p2), direct = newLine.direction();
|
|
10324
10341
|
if (full) width = newLine.length;
|
|
@@ -10839,7 +10856,7 @@ class ThreeVJiaPipeline extends Pipeline {
|
|
|
10839
10856
|
let centerVec2 = null;
|
|
10840
10857
|
lineSegments = LineSegmentUndirectedGraph.rotate(lineSegments.map((line) => line.clone()), angle, (line, center, angle2) => {
|
|
10841
10858
|
if (!centerVec2) centerVec2 = { x: center.x, y: center.y };
|
|
10842
|
-
WallHole.
|
|
10859
|
+
WallHole.forEachStorageType(line, (data) => {
|
|
10843
10860
|
data.forEach((item) => {
|
|
10844
10861
|
const point2 = Point.from(item.p);
|
|
10845
10862
|
point2.rotate(center, angle2);
|
|
@@ -10850,7 +10867,7 @@ class ThreeVJiaPipeline extends Pipeline {
|
|
|
10850
10867
|
const heights = [];
|
|
10851
10868
|
lineSegments.forEach((line) => {
|
|
10852
10869
|
if (line.userData.isDoor) heights.push(line.userData.height ?? 0);
|
|
10853
|
-
WallHole.
|
|
10870
|
+
WallHole.forEachStorageType(line, (data) => {
|
|
10854
10871
|
heights.push(line.userData.height ?? 0);
|
|
10855
10872
|
data.forEach((item) => {
|
|
10856
10873
|
const h = (item.height ?? 0) + (item.groundClearance ?? 0);
|
|
@@ -10875,10 +10892,12 @@ function mmTom(value) {
|
|
|
10875
10892
|
return Number((value / 1e3).toFixed(4));
|
|
10876
10893
|
}
|
|
10877
10894
|
function getLineIndexByCenter(targetLines, lines) {
|
|
10878
|
-
const grid = Quadtree.from(lines);
|
|
10895
|
+
const grid = Quadtree.from(lines, (_, i) => ({ index: i }));
|
|
10879
10896
|
const indices = targetLines.map((line) => {
|
|
10880
10897
|
const res = grid.queryPoint(line.center);
|
|
10881
|
-
if (res.length)
|
|
10898
|
+
if (res.length) {
|
|
10899
|
+
return res[0].userData.index;
|
|
10900
|
+
}
|
|
10882
10901
|
return -1;
|
|
10883
10902
|
});
|
|
10884
10903
|
return indices;
|
|
@@ -10956,25 +10975,29 @@ function splitIntersectedLine(lines, minLen = 1e-9, opt) {
|
|
|
10956
10975
|
lines = LineSegmentUtils.splitIntersections(lines, {
|
|
10957
10976
|
obstacle,
|
|
10958
10977
|
onSplit: (line, newLines) => {
|
|
10959
|
-
|
|
10960
|
-
|
|
10961
|
-
|
|
10962
|
-
|
|
10963
|
-
|
|
10964
|
-
|
|
10965
|
-
}
|
|
10966
|
-
if (balconyRailing && line.userData.isBalconyRailing) {
|
|
10967
|
-
const len = line.length;
|
|
10968
|
-
newLines.forEach((line2) => {
|
|
10969
|
-
if (line2.length / len < balconyRailing.filteringRatio) {
|
|
10970
|
-
if (opt?.balconyRailing?.behavior === "discard") removeSet.add(line2);
|
|
10971
|
-
else delete line2.userData.isBalconyRailing;
|
|
10978
|
+
try {
|
|
10979
|
+
WallHole.splitHole(line, newLines);
|
|
10980
|
+
if (line.userData.isBayWindow) {
|
|
10981
|
+
newLines.sort((a2, b4) => b4.length - a2.length);
|
|
10982
|
+
for (let i = 1; i < newLines.length; i++) {
|
|
10983
|
+
newLines[i].userData.isBayWindow = false;
|
|
10972
10984
|
}
|
|
10973
|
-
}
|
|
10985
|
+
}
|
|
10986
|
+
if (balconyRailing && line.userData.isBalconyRailing) {
|
|
10987
|
+
const len = line.length;
|
|
10988
|
+
newLines.forEach((line2) => {
|
|
10989
|
+
if (line2.length / len < balconyRailing.filteringRatio) {
|
|
10990
|
+
if (opt?.balconyRailing?.behavior === "discard") removeSet.add(line2);
|
|
10991
|
+
else delete line2.userData.isBalconyRailing;
|
|
10992
|
+
}
|
|
10993
|
+
});
|
|
10994
|
+
}
|
|
10995
|
+
} catch (error) {
|
|
10996
|
+
console.error(error.message);
|
|
10974
10997
|
}
|
|
10975
10998
|
}
|
|
10976
10999
|
});
|
|
10977
|
-
lines = lines.filter((line) => line.length >= minLen && !removeSet.has(line));
|
|
11000
|
+
lines = lines.filter((line) => line.length >= minLen && !removeSet.has(line) && LineSegmentUtils.legitimacy(line));
|
|
10978
11001
|
return dedup ? LineSegmentUtils.deduplicate(lines, 3) : lines;
|
|
10979
11002
|
}
|
|
10980
11003
|
function mergeChainsLine(lines, callBack, removeLines, newLines) {
|
|
@@ -10991,7 +11014,7 @@ function mergeChainsLine(lines, callBack, removeLines, newLines) {
|
|
|
10991
11014
|
}
|
|
10992
11015
|
function clippingLineUserData(newLine, line2) {
|
|
10993
11016
|
const { drawWindow, passageEntrance, ...opt } = line2.userData;
|
|
10994
|
-
WallHole.
|
|
11017
|
+
WallHole.forEachStorageType(line2, (data, key) => {
|
|
10995
11018
|
if (key === "drawWindow") {
|
|
10996
11019
|
return;
|
|
10997
11020
|
}
|
|
@@ -12128,6 +12151,7 @@ function correction(lines, targettLine, option) {
|
|
|
12128
12151
|
lines = recoveryBayWindow(lines, bayWindow);
|
|
12129
12152
|
lines = removeDangline(lines, 0.1, false);
|
|
12130
12153
|
lines = removeShortDoor(lines);
|
|
12154
|
+
WallHole.miniWidthFilter(lines);
|
|
12131
12155
|
lines = LineSegmentUtils.GroupBuilder(LineSegmentUtils.group(lines, (line) => line.userData.isDoor || line.userData.isBalconyRailing ? "otherLines" : "newLines")).handle("newLines", (newLines) => {
|
|
12132
12156
|
newLines = BuildGroup.bayWindow(newLines, false);
|
|
12133
12157
|
const { wallGroup = true } = option ?? {};
|
|
@@ -23838,7 +23862,7 @@ function hasCircle(lineData, startIndex, direction) {
|
|
|
23838
23862
|
let lines = originalDataToLineData(lineData).lineSegments;
|
|
23839
23863
|
const center = lines[startIndex].center;
|
|
23840
23864
|
let findlines = splitIntersectedLine(lines.map((line2) => line2.clone()), 1e-9);
|
|
23841
|
-
let removeSet =
|
|
23865
|
+
let removeSet = findDiscretePointLine(findlines);
|
|
23842
23866
|
findlines = findlines.filter((line2) => !removeSet.has(line2));
|
|
23843
23867
|
const list = findlines.filter((line2) => line2.userData.isBayWindow && line2.isPointOnSegment(center));
|
|
23844
23868
|
if (list.length === 0) return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from './Command';
|
|
2
2
|
import { LineSegment } from '../../../../utils/algorithms/LineSegment';
|
|
3
3
|
import { ComponentContainer } from '../../../../utils/ecs';
|
|
4
|
-
import { HoleData,
|
|
4
|
+
import { HoleData, HoleStorageType, HoleType, LineUserData } from '../../../type';
|
|
5
5
|
import { Point } from '../../../../utils';
|
|
6
6
|
import * as THREE from "three";
|
|
7
7
|
export interface DrawHoleData {
|
|
@@ -25,7 +25,7 @@ export declare class DrawHole extends Command<{
|
|
|
25
25
|
defaultHeight: number;
|
|
26
26
|
defaultGroundClearance: number;
|
|
27
27
|
holeType?: HoleType;
|
|
28
|
-
holeKey:
|
|
28
|
+
holeKey: HoleStorageType;
|
|
29
29
|
showEditWidth: boolean;
|
|
30
30
|
showEditHeight: boolean;
|
|
31
31
|
showEditGroundClearance: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HoleStorageType, HoleType } from '../../../type';
|
|
2
2
|
import { DrawHole } from './DrawHole';
|
|
3
3
|
import * as THREE from "three";
|
|
4
4
|
export declare class DrawWindow extends DrawHole {
|
|
@@ -7,5 +7,5 @@ export declare class DrawWindow extends DrawHole {
|
|
|
7
7
|
static shortcutKeys: string[];
|
|
8
8
|
static commandName: string;
|
|
9
9
|
holeType: HoleType;
|
|
10
|
-
holeKey:
|
|
10
|
+
holeKey: HoleStorageType;
|
|
11
11
|
}
|
package/src/dxf-system/type.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ export interface GroupItem {
|
|
|
7
7
|
id: string;
|
|
8
8
|
type?: string;
|
|
9
9
|
}
|
|
10
|
-
export type
|
|
11
|
-
export type HoleType = "door" | "window" | "beam";
|
|
10
|
+
export type HoleStorageType = 'drawWindow' | 'passageEntrance';
|
|
11
|
+
export type HoleType = "door" | "window" | "beam" | "passageEntrance";
|
|
12
12
|
export interface HoleData {
|
|
13
13
|
p: {
|
|
14
14
|
x: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LineSegment } from '../../utils/algorithms/LineSegment';
|
|
2
|
-
import { HoleData,
|
|
2
|
+
import { HoleData, HoleStorageType, HoleType, LineUserData } from '../type';
|
|
3
3
|
/**
|
|
4
4
|
* 墙体嵌入物(窗户、空洞)处理对象
|
|
5
5
|
*/
|
|
@@ -80,17 +80,17 @@ export declare class WallHole {
|
|
|
80
80
|
* @param line
|
|
81
81
|
* @returns
|
|
82
82
|
*/
|
|
83
|
-
static
|
|
83
|
+
static forEachStorageType(line: LineSegment<LineUserData>, callBack: (data: HoleData[], key: HoleStorageType) => void): void;
|
|
84
84
|
/** 获取最小
|
|
85
85
|
* @param line
|
|
86
86
|
* @returns
|
|
87
87
|
*/
|
|
88
|
-
static getMinWidth(key:
|
|
88
|
+
static getMinWidth(key: HoleStorageType, type?: HoleType): 0.4 | 0.2 | 0.05 | 0.3;
|
|
89
89
|
/** 清理孔洞
|
|
90
90
|
* @param target
|
|
91
91
|
* @param key
|
|
92
92
|
*/
|
|
93
|
-
static clear(target: LineSegment, key?:
|
|
93
|
+
static clear(target: LineSegment, key?: HoleStorageType): void;
|
|
94
94
|
/** 过滤宽度最小值孔洞
|
|
95
95
|
* @param line
|
|
96
96
|
*/
|
|
@@ -113,7 +113,7 @@ export declare class WallHole {
|
|
|
113
113
|
* @param insertObject
|
|
114
114
|
* @param type
|
|
115
115
|
*/
|
|
116
|
-
static addHole(target: LineSegment<LineUserData>, insertObject: HoleData, type?:
|
|
116
|
+
static addHole(target: LineSegment<LineUserData>, insertObject: HoleData, type?: HoleStorageType): void;
|
|
117
117
|
/** 移除孔洞
|
|
118
118
|
* @param target
|
|
119
119
|
* @param insertObject
|
package/src/index3.js
CHANGED
|
@@ -11917,7 +11917,9 @@ class Command extends Component {
|
|
|
11917
11917
|
" justify-center items-center bg-[rgba(0,0,0,0.5)]": !isMobileRef.value
|
|
11918
11918
|
},
|
|
11919
11919
|
"onClick": (e) => e.stopPropagation(),
|
|
11920
|
-
"onPointerdown": (e) => e.stopPropagation()
|
|
11920
|
+
"onPointerdown": (e) => e.stopPropagation(),
|
|
11921
|
+
"onPointerup": (e) => e.stopPropagation(),
|
|
11922
|
+
"onMousedown": (e) => e.stopPropagation()
|
|
11921
11923
|
}, [isMobileRef.value && createVNode("div", {
|
|
11922
11924
|
"class": "flex-1 pointer-events-none"
|
|
11923
11925
|
}, null), createVNode("div", {
|
|
@@ -14878,6 +14880,8 @@ function createPage$2(el, editWidth, editHeight, editGroundClearance) {
|
|
|
14878
14880
|
return createVNode("div", {
|
|
14879
14881
|
"class": " z-20 absolute left-0 top-[50%] translate-y-[-50%] flex flex-col p-[10px] gap-[16px]",
|
|
14880
14882
|
"onClick": (e) => e.stopPropagation(),
|
|
14883
|
+
"onMousedown": (e) => e.stopPropagation(),
|
|
14884
|
+
"onPointerup": (e) => e.stopPropagation(),
|
|
14881
14885
|
"onPointerdown": (e) => e.stopPropagation()
|
|
14882
14886
|
}, [editWidth && createVNode(_sfc_main$5, {
|
|
14883
14887
|
"iconSize": "28px",
|
|
@@ -17729,7 +17733,7 @@ class Drawer extends Pipeline {
|
|
|
17729
17733
|
const color = new THREE.Color(5745151);
|
|
17730
17734
|
const holeLines = ctx.data.flatMap((line2) => {
|
|
17731
17735
|
const holeLines2 = [];
|
|
17732
|
-
WallHole.
|
|
17736
|
+
WallHole.forEachStorageType(line2, (data, key) => {
|
|
17733
17737
|
data.forEach((item) => {
|
|
17734
17738
|
let type = key == "drawWindow" ? "window" : item.type;
|
|
17735
17739
|
const holeLine = WallHole.holeDataToLine(line2, item);
|
|
@@ -17808,6 +17812,7 @@ class Drawer extends Pipeline {
|
|
|
17808
17812
|
const colors = {
|
|
17809
17813
|
default: new THREE.Color(16776960),
|
|
17810
17814
|
// 0xff5722
|
|
17815
|
+
passageEntrance: new THREE.Color(16776960),
|
|
17811
17816
|
window: new THREE.Color(16711935),
|
|
17812
17817
|
door: new THREE.Color(16776960),
|
|
17813
17818
|
beam: new THREE.Color(16711680)
|
|
@@ -17816,7 +17821,7 @@ class Drawer extends Pipeline {
|
|
|
17816
17821
|
const type = line2.userData.type ?? "default";
|
|
17817
17822
|
const color = colors[type] ?? colors.default;
|
|
17818
17823
|
line2.points.forEach((p) => {
|
|
17819
|
-
if (type === "default") {
|
|
17824
|
+
if (type === "default" || type === "passageEntrance") {
|
|
17820
17825
|
ctx.cache.lineDasheds.push(p.x, p.y, 0);
|
|
17821
17826
|
ctx.cache.lineDashedColor.push(color.r, color.g, color.b);
|
|
17822
17827
|
} else {
|
|
@@ -18181,6 +18186,7 @@ function createPage(el) {
|
|
|
18181
18186
|
return createVNode("div", {
|
|
18182
18187
|
"class": " z-20 absolute left-0 top-[50%] translate-y-[-50%] flex flex-col p-[10px] gap-[16px]",
|
|
18183
18188
|
"onClick": (e) => e.stopPropagation(),
|
|
18189
|
+
"onMousedown": (e) => e.stopPropagation(),
|
|
18184
18190
|
"onPointerdown": (e) => e.stopPropagation()
|
|
18185
18191
|
}, [createVNode(_sfc_main$4, {
|
|
18186
18192
|
"icon": "tdesign:rotate-locked-filled",
|
|
@@ -85,5 +85,5 @@ export declare class Quadtree<T = any> {
|
|
|
85
85
|
* @returns
|
|
86
86
|
*/
|
|
87
87
|
boundsToArray(array?: number[], colors?: number[], recursion?: boolean): number[];
|
|
88
|
-
static from(lines: LineSegment[]): Quadtree<any>;
|
|
88
|
+
static from(lines: LineSegment[], userDataFun?: (line: LineSegment, index: number) => any): Quadtree<any>;
|
|
89
89
|
}
|