build-dxf 0.1.103 → 0.1.104

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-dxf",
3
- "version": "0.1.103",
3
+ "version": "0.1.104",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
package/src/build.js CHANGED
@@ -413,6 +413,7 @@ class LineSegment {
413
413
  get center() {
414
414
  return this.#center.clone();
415
415
  }
416
+ #direction = Point.zero();
416
417
  constructor(p1, p2) {
417
418
  this.set(p1 ?? this.start, p2 ?? this.end);
418
419
  this.start.currentData[LineSegment.LINE_SYMBOL] = this;
@@ -426,6 +427,7 @@ class LineSegment {
426
427
  this.points[0].x + (this.points[1].x - this.points[0].x) * 0.5,
427
428
  this.points[0].y + (this.points[1].y - this.points[0].y) * 0.5
428
429
  );
430
+ this.#direction = this.points[1].directionFrom(this.points[0]);
429
431
  };
430
432
  this.points.forEach((p2) => fields.forEach((k) => {
431
433
  let value = p2[k];
@@ -447,6 +449,13 @@ class LineSegment {
447
449
  this.end.copy(p2);
448
450
  return this;
449
451
  }
452
+ setLength(len) {
453
+ const direct = this.direction();
454
+ const start = this.#center.clone().add(direct.clone().multiplyScalar(len * 0.5));
455
+ const end = this.#center.clone().add(direct.clone().multiplyScalar(-len * 0.5));
456
+ this.set(start, end);
457
+ return this;
458
+ }
450
459
  /** 获取另一个点
451
460
  * @param point
452
461
  * @returns
@@ -591,7 +600,7 @@ class LineSegment {
591
600
  * @returns
592
601
  */
593
602
  direction() {
594
- return this.points[1].directionFrom(this.points[0]);
603
+ return this.#direction.clone();
595
604
  }
596
605
  /**
597
606
  * 获取发向量
@@ -1877,6 +1886,9 @@ class PointSpatialHash {
1877
1886
  });
1878
1887
  return list;
1879
1888
  }
1889
+ queryPoints(points, excludeOneself = false) {
1890
+ return points.flatMap((p2) => this.queryPoint(p2, excludeOneself));
1891
+ }
1880
1892
  /** 获取多边形内的点
1881
1893
  * @param polygon
1882
1894
  */
@@ -2356,6 +2368,24 @@ class WallInsertObject {
2356
2368
  }
2357
2369
  return false;
2358
2370
  }
2371
+ /** 是否配对
2372
+ * @param lines
2373
+ */
2374
+ static isPairing(lines) {
2375
+ const set2 = /* @__PURE__ */ new Set();
2376
+ for (let i = 0; i < lines.length; i++) {
2377
+ const line = lines[i];
2378
+ const passageEntrance = line.userData.passageEntrance ?? [];
2379
+ for (let i2 = 0; i2 < passageEntrance.length; i2++) {
2380
+ const item = passageEntrance[i2];
2381
+ const id = this.getId(item);
2382
+ const nearId = this.getNearId(item);
2383
+ if (typeof item.nearId !== "number" || typeof id !== "number") continue;
2384
+ if (set2.has(nearId)) return true;
2385
+ set2.add(id);
2386
+ }
2387
+ }
2388
+ }
2359
2389
  /** 获取孔洞 id
2360
2390
  * @param item
2361
2391
  * @returns
@@ -2477,13 +2507,19 @@ class WallInsertObject {
2477
2507
  this.forEachInsertObjectData(line, (data, key) => {
2478
2508
  data.forEach((w) => {
2479
2509
  try {
2510
+ const center = Point.from(w.p);
2511
+ const windowLine = line.projectLineSegment(wallInsertObjectToLine(line, w));
2512
+ if (windowLine.len / w.width < 0.4 && !windowLine.containsPoint(center)) {
2513
+ w.width = 0;
2514
+ return;
2515
+ }
2480
2516
  if (w.full) {
2481
- const center = line.center;
2482
- w.p = { x: center?.x ?? 0, y: center?.y ?? 0, z: w.p.z };
2517
+ const center2 = line.center;
2518
+ w.p = { x: center2?.x ?? 0, y: center2?.y ?? 0, z: w.p.z };
2483
2519
  w.width = line.length();
2484
2520
  return;
2485
2521
  }
2486
- const windowLine = line.projectLineSegment(wallInsertObjectToLine(line, w)), windowCenter = windowLine.center;
2522
+ let windowCenter = windowLine.center;
2487
2523
  w.p = { x: windowCenter.x ?? 0, y: windowCenter.y ?? 0, z: w.p.z };
2488
2524
  w.width = windowLine.length();
2489
2525
  } catch (error) {
@@ -3330,15 +3366,14 @@ class LineSegmentUtils {
3330
3366
  * @param lines
3331
3367
  * @returns
3332
3368
  */
3333
- static deduplication(lines, eps = 1e-3) {
3369
+ static deduplication(lines, eps = 4) {
3334
3370
  const seen = /* @__PURE__ */ new Set();
3335
3371
  const result = [];
3336
- const snap = (v2) => Math.round(v2 / eps);
3337
3372
  for (const line of lines) {
3338
3373
  const p1 = line.start;
3339
3374
  const p2 = line.end;
3340
- const key1 = `${snap(p1.x)}_${snap(p1.y)}`;
3341
- const key2 = `${snap(p2.x)}_${snap(p2.y)}`;
3375
+ const key1 = `${p1.x.toFixed(eps)}_${p1.y.toFixed(eps)}`;
3376
+ const key2 = `${p2.x.toFixed(eps)}_${p2.y.toFixed(eps)}`;
3342
3377
  const key = key1 < key2 ? `${key1}_${key2}` : `${key2}_${key1}`;
3343
3378
  if (!seen.has(key)) {
3344
3379
  seen.add(key);
@@ -3484,9 +3519,10 @@ class LineSegmentUtils {
3484
3519
  );
3485
3520
  const lines = [...lineSegments].sort((a2, b4) => b4.length() - a2.length()).slice(0, 20);
3486
3521
  const angles = lines.map((line2) => {
3487
- let angle = parseInt(yAxisLine.includedAngle(line2) + "");
3522
+ let angle = yAxisLine.angle(line2, { unit: "degree", range: "180" });
3488
3523
  if (angle > 90) angle = 180 - angle;
3489
- return angle;
3524
+ let key = Math.round(angle / bin) * bin;
3525
+ return key;
3490
3526
  });
3491
3527
  const lineMap = /* @__PURE__ */ new Map();
3492
3528
  angles.forEach((angle, index2) => {
@@ -6288,6 +6324,7 @@ function mergeLineUserData(newLine, line2) {
6288
6324
  line2 = [...line2].sort((a2, b4) => a2.length(true) - b4.length(true));
6289
6325
  return line2.forEach((l) => mergeLineUserData(newLine, l));
6290
6326
  }
6327
+ if (line2.userData.isBayWindow === false) delete line2.userData.isBayWindow;
6291
6328
  if (line2.userData.isPassageEntrance === false) delete line2.userData.isPassageEntrance;
6292
6329
  if (newLine.userData.isPassageEntrance === false) delete newLine.userData.isPassageEntrance;
6293
6330
  const { drawWindow, passageEntrance, ...opt } = line2.userData;
@@ -7521,37 +7558,6 @@ class BayWindowHelper {
7521
7558
  return winGroup;
7522
7559
  }
7523
7560
  }
7524
- function getDoorAll(lines) {
7525
- return lines.filter((line) => line.userData.isDoor || WallInsertObject.isDoor(line));
7526
- }
7527
- function findRooms(lines) {
7528
- lines = lines.map((line) => line.clone());
7529
- lines = lineSegmentClipping(lines, 0);
7530
- const rooms = [];
7531
- LineSegmentUtils.groupByPath(lines).forEach((group) => {
7532
- const removeSet = findDiscretePointLine2(group, null, true);
7533
- lines = group.filter((line) => !removeSet.has(line) && !line.userData.isBayWindow);
7534
- const doors = getDoorAll(lines), maxiCircles2 = new MaxiCircles();
7535
- let { circles } = maxiCircles2.miniCircle(lines, { circleEdges: doors, side: Side.IN });
7536
- circles = circles.filter((circle) => !LineGroupType.isGroup(circle));
7537
- const ploys = circles.map(((p2) => Polygon.fromByLinePath(p2)));
7538
- ploys.forEach((ploy, i) => {
7539
- const xList = [];
7540
- const yList = [];
7541
- ploy.forEach((p2) => {
7542
- xList.push(p2.x);
7543
- yList.push(p2.y);
7544
- });
7545
- const minX = Math.min(...xList), maxX = Math.max(...xList), minY = Math.min(...yList), maxY = Math.max(...yList), center = new Point((maxX - minX) * 0.5 + minX, (maxY - minY) * 0.5 + minY);
7546
- rooms.push({
7547
- lines: circles[i],
7548
- ploy,
7549
- center
7550
- });
7551
- });
7552
- });
7553
- return rooms;
7554
- }
7555
7561
  const holeTypeMap = {
7556
7562
  door: "DOOR",
7557
7563
  RAILING: "RAILING",
@@ -7646,6 +7652,7 @@ class ThreeVJiaJson extends Pipeline {
7646
7652
  const info = BayWindowHelper.computedInfo(lines);
7647
7653
  if (info) {
7648
7654
  const { dottedLine, windowLine, depth, side } = info, line = new LineSegment(dottedLine.start.clone(), dottedLine.end.clone()), win = windowLine?.userData.drawWindow && windowLine.userData.drawWindow[0];
7655
+ if (side === "LEFT") line.swapValue();
7649
7656
  line.userData = {
7650
7657
  groundClearance: win?.groundClearance ?? 0,
7651
7658
  height: win?.height,
@@ -7691,6 +7698,7 @@ class ThreeVJiaJson extends Pipeline {
7691
7698
  type,
7692
7699
  start: line.start.toJson2D(),
7693
7700
  end: line.end.toJson2D(),
7701
+ depth: line.userData.depth,
7694
7702
  height: line.userData?.height ?? DEFAULT_DOOR_HEIGHT,
7695
7703
  sillHeight: line.userData?.groundClearance ?? DOOR_GROUND_CLEARANCE_HEIGHT,
7696
7704
  groundClearance: line.userData?.groundClearance ?? DOOR_GROUND_CLEARANCE_HEIGHT
@@ -7716,7 +7724,12 @@ class ThreeVJiaJson extends Pipeline {
7716
7724
  pillars: [],
7717
7725
  beams: [],
7718
7726
  holes: [],
7719
- rooms: []
7727
+ rooms: [],
7728
+ center: {
7729
+ x: 0,
7730
+ y: 0
7731
+ },
7732
+ angle: 0
7720
7733
  };
7721
7734
  const cache = {
7722
7735
  wallLines: []
@@ -7735,17 +7748,26 @@ class ThreeVJiaJson extends Pipeline {
7735
7748
  height: line.currentData[WALL_HEIGHT_KEY] ?? this.maxHeight
7736
7749
  });
7737
7750
  });
7738
- const rooms = findRooms(this.lines);
7751
+ return option;
7752
+ }
7753
+ /** 添加房间
7754
+ * @param option
7755
+ * @param rooms
7756
+ */
7757
+ static appendRooms(option, rooms) {
7739
7758
  option.rooms = rooms.map((room, i) => ({
7740
7759
  name: `房间(${i + 1})`,
7741
- position: room.center.toJson(),
7760
+ position: room.center.clone().rotate(option.center, option.angle).toJson(),
7742
7761
  roomTypeId: 17
7743
7762
  }));
7744
- return option;
7763
+ }
7764
+ static fillPlaceHolders() {
7745
7765
  }
7746
7766
  }
7747
7767
  function lineDataToThreeVJiaJson(lineSegments, angle = 0, updateGroup = true) {
7768
+ let centerVec2 = null;
7748
7769
  lineSegments = LineSegmentUndirectedGraph.rotate(lineSegments.map((line) => line.clone()), angle, (line, center, angle2) => {
7770
+ if (!centerVec2) centerVec2 = { x: center.x, y: center.y };
7749
7771
  WallInsertObject.forEachInsertObjectData(line, (data) => {
7750
7772
  data.forEach((item) => {
7751
7773
  const point2 = Point.from(item.p);
@@ -7758,7 +7780,11 @@ function lineDataToThreeVJiaJson(lineSegments, angle = 0, updateGroup = true) {
7758
7780
  lineSegments.forEach((line) => {
7759
7781
  if (line.userData.isDoor) heights.push(line.userData.height ?? 0);
7760
7782
  WallInsertObject.forEachInsertObjectData(line, (data) => {
7761
- data.forEach((item) => heights.push(item.height ?? 0));
7783
+ heights.push(line.userData.height ?? 0);
7784
+ data.forEach((item) => {
7785
+ const h = (item.height ?? 0) + (item.groundClearance ?? 0);
7786
+ heights.push(h);
7787
+ });
7762
7788
  });
7763
7789
  });
7764
7790
  if (heights.length === 0) heights.push(DEFAULT_WALL_HEIGHT);
@@ -7771,12 +7797,12 @@ function lineDataToThreeVJiaJson(lineSegments, angle = 0, updateGroup = true) {
7771
7797
  const json = threeVJiaJson.transform();
7772
7798
  json.name = name;
7773
7799
  json.communityName = communityName;
7800
+ json.angle = angle;
7801
+ json.center = centerVec2;
7774
7802
  return json;
7775
7803
  }
7776
7804
  };
7777
7805
  }
7778
- function fillPlaceHolders(option, items) {
7779
- }
7780
7806
  function createPointSpatialHash(lines) {
7781
7807
  const grid = new PointSpatialHash();
7782
7808
  for (const seg of lines) {
@@ -7877,7 +7903,6 @@ const tools = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
7877
7903
  WallGroupManager,
7878
7904
  createPointSpatialHash,
7879
7905
  createQuadtree,
7880
- fillPlaceHolders,
7881
7906
  getLineIndexByCenter,
7882
7907
  lineDataToOriginalData,
7883
7908
  lineDataToThreeVJiaJson,
@@ -8799,7 +8824,7 @@ function sortByAxis(lines, axis) {
8799
8824
  });
8800
8825
  return lines;
8801
8826
  }
8802
- function layoutDesign(lines, axis, intersectPoints) {
8827
+ function layoutDesign(lines, axis, intersectPoints, opt) {
8803
8828
  let blocks = lines.map((line, index2) => {
8804
8829
  const sv = axis.projectPointValue(line.start), ev = axis.projectPointValue(line.end), range = sv < ev ? [sv, ev] : [ev, sv];
8805
8830
  return { range, index: index2, rangeSize: range[1] - range[0] };
@@ -8845,7 +8870,7 @@ function layoutDesign(lines, axis, intersectPoints) {
8845
8870
  const nextLine = newLines[i + 1];
8846
8871
  nextLine.start.copy(line.start);
8847
8872
  line.currentData[DELETE_SYMBOL] = true;
8848
- mergeLineUserData(nextLine, line);
8873
+ opt.onMergeLine && opt.onMergeLine(nextLine, line);
8849
8874
  }
8850
8875
  lines.length = 0;
8851
8876
  lines.push(...newLines);
@@ -8860,6 +8885,8 @@ class AlignToParallelSegments {
8860
8885
  * @param gap 平行轴投影区间间隙
8861
8886
  */
8862
8887
  static group(lines, parallelAxis, verticalAxis, esp = 0.05, gap = 0.01) {
8888
+ esp = esp / verticalAxis.len;
8889
+ gap = gap / parallelAxis.len;
8863
8890
  const vls = lines.map((line) => [
8864
8891
  verticalAxis.projectPointValue(line.start),
8865
8892
  line,
@@ -8881,24 +8908,24 @@ class AlignToParallelSegments {
8881
8908
  * @param groups
8882
8909
  * @param verticalLines
8883
8910
  */
8884
- static fittingAlignment(groups, verticalLines) {
8911
+ static fittingAlignment(groups, verticalLines, opt = {}) {
8885
8912
  const grid = PointSpatialHash.fromByLines(verticalLines);
8886
8913
  for (let i = 0; i < groups.length; i++) {
8887
8914
  const group = groups[i];
8888
8915
  if (group.length <= 1) continue;
8889
- const axisLine = fitting(group);
8890
- const points = [];
8916
+ const axisLine = fitting(group), intersectList = [];
8891
8917
  for (let j = 0; j < group.length; j++) {
8892
8918
  const line = group[j];
8893
8919
  line.points.forEach((p2) => {
8894
- const intersectPoints = grid.queryCircle(p2, 1e-4).map((result) => result.point);
8920
+ const intersects = grid.queryCircle(p2, 1e-4);
8895
8921
  const pv = axisLine.projectPointValue(p2);
8896
8922
  axisLine.pointAt(pv, p2);
8897
- intersectPoints.forEach((point2) => point2.copy(p2));
8898
- points.push(...intersectPoints);
8923
+ intersects.forEach(({ point: point2 }) => point2.copy(p2));
8924
+ intersectList.push(...intersects);
8899
8925
  });
8900
8926
  }
8901
- layoutDesign(group, axisLine, points);
8927
+ const intersectPoints = intersectList.filter((item) => item.userData.len > 1e-5).map((item) => item.point);
8928
+ layoutDesign(group, axisLine, intersectPoints, opt);
8902
8929
  }
8903
8930
  return groups.flat().filter((line) => {
8904
8931
  if (line.length() < 1e-9) return false;
@@ -8913,14 +8940,15 @@ class AlignToParallelSegments {
8913
8940
  * @param lines
8914
8941
  * @returns
8915
8942
  */
8916
- static align(lines, esp = 0.05, gap = 0.05) {
8917
- const axisLine = lines.find((line) => line.length() > 0.4), axisLineV = axisLine.clone().rotate(Math.PI * 0.5, axisLine.center);
8943
+ static align(lines, opt = {}) {
8944
+ const { esp = 0.06, gap = 0.05 } = opt;
8945
+ const axisLine = lines[LineSegmentUtils.maxLengthLineIndex(lines)].clone().setLength(100), axisLineV = axisLine.clone().rotate(Math.PI * 0.5, axisLine.center);
8918
8946
  let [pllLines, verticalLines] = LineSegmentUtils.groupByParallelToAxis(lines, axisLine);
8919
8947
  const groups = this.group(pllLines, axisLine, axisLineV, esp, gap);
8920
- pllLines = this.fittingAlignment(groups, verticalLines);
8948
+ pllLines = this.fittingAlignment(groups, verticalLines, opt);
8921
8949
  verticalLines = verticalLines.filter((line) => line.length() > 1e-6);
8922
8950
  const groups2 = this.group(verticalLines, axisLineV, axisLine, esp, gap);
8923
- verticalLines = this.fittingAlignment(groups2, pllLines);
8951
+ verticalLines = this.fittingAlignment(groups2, pllLines, opt);
8924
8952
  pllLines = pllLines.filter((line) => line.length() > 1e-6);
8925
8953
  return [
8926
8954
  ...pllLines,
@@ -9054,8 +9082,9 @@ function correction(lines, targettLine, option) {
9054
9082
  lines = preprocessing(lines);
9055
9083
  lines = AxisAlignCorr.start(lines, targettLine);
9056
9084
  lines = lineSegmentClipping(lines, 1e-9);
9057
- lines = AlignToParallelSegments.align(lines);
9058
- new WallInsertObject(lines).recomputed().merge();
9085
+ lines = AlignToParallelSegments.align(lines, {
9086
+ onMergeLine: mergeLineUserData
9087
+ });
9059
9088
  lines = adsorption(lines, option);
9060
9089
  lines = lineSegmentClipping(lines, 1e-9);
9061
9090
  lines = removeDangline(lines, 0.1, false);
@@ -9512,10 +9541,9 @@ function doubleWallAlignment(lines) {
9512
9541
  let newLine = new LineSegment().set(point2, newPoint);
9513
9542
  allGrid.insert(newLine.start, newLine).insert(newLine.end, newLine);
9514
9543
  point2.copy(newPoint);
9515
- return [newLine];
9544
+ return newLine;
9516
9545
  }
9517
9546
  point2.copy(newPoint);
9518
- return [];
9519
9547
  };
9520
9548
  const newLines = expLines.flatMap((line) => {
9521
9549
  const normal = line.normal(), id = LineGroupType.getIdByType(line, "doubleWall");
@@ -9524,7 +9552,8 @@ function doubleWallAlignment(lines) {
9524
9552
  const old_line = line.clone();
9525
9553
  line.points.forEach((p2) => {
9526
9554
  const newPoint = p2.clone().add(step);
9527
- newLines2.push(...movePoint(p2, newPoint, old_line));
9555
+ let newLine = movePoint(p2, newPoint, old_line);
9556
+ newLine && newLines2.push(newLine);
9528
9557
  });
9529
9558
  allGrid.update(line.start);
9530
9559
  allGrid.update(line.end);
@@ -11891,6 +11920,7 @@ class CorrectionDxf extends Dxf {
11891
11920
  this.originalData = data;
11892
11921
  this.lineSegments = LinePipeline.builtin.WallHeightHandle(this.lineSegments, options);
11893
11922
  }
11923
+ this.options = options;
11894
11924
  const zList = [];
11895
11925
  data.forEach(({ start, end }) => zList.push(start.z ?? 0, end.z ?? 0));
11896
11926
  this.originalZAverage = zList.reduce((count, num) => count + num, 0) / zList.length;
@@ -11945,17 +11975,63 @@ class CorrectionDxf extends Dxf {
11945
11975
  return this.rotateCorrCad?.downloadDxf(filename, unit);
11946
11976
  }
11947
11977
  }
11978
+ function roomTest(trajectory2) {
11979
+ return (lines) => {
11980
+ const doubleLines = lines.filter((line) => WIO.isDouble(line));
11981
+ if (WIO.isPairing(doubleLines)) {
11982
+ return false;
11983
+ }
11984
+ const ply = Polygon.fromByLinePath(lines);
11985
+ if (trajectory2) {
11986
+ let has = Object.keys(trajectory2).some((k) => {
11987
+ const p2 = trajectory2[k];
11988
+ if (ply.pointWithin(p2)) return true;
11989
+ return false;
11990
+ });
11991
+ if (!has) return false;
11992
+ }
11993
+ return true;
11994
+ };
11995
+ }
11996
+ function findRooms(lines, trajectory2) {
11997
+ lines = lines.map((line) => line.clone());
11998
+ lines = lineSegmentClipping(lines, 0);
11999
+ const rooms = [];
12000
+ const maxiCircles2 = new MaxiCircles();
12001
+ LineSegmentUtils.groupByPath(lines).forEach((group) => {
12002
+ const removeSet = findDiscretePointLine2(group, null, true);
12003
+ lines = group.filter((line) => !removeSet.has(line) && !line.userData.isBayWindow);
12004
+ const circles = maxiCircles2.miniCircle(lines).circles.filter(roomTest(trajectory2));
12005
+ const ploys = circles.map(((p2) => Polygon.fromByLinePath(p2)));
12006
+ ploys.forEach((ploy, i) => {
12007
+ const xList = [];
12008
+ const yList = [];
12009
+ ploy.forEach((p2) => {
12010
+ xList.push(p2.x);
12011
+ yList.push(p2.y);
12012
+ });
12013
+ const minX = Math.min(...xList), maxX = Math.max(...xList), minY = Math.min(...yList), maxY = Math.max(...yList), center = new Point((maxX - minX) * 0.5 + minX, (maxY - minY) * 0.5 + minY);
12014
+ rooms.push({
12015
+ lines: circles[i],
12016
+ ploy,
12017
+ center
12018
+ });
12019
+ });
12020
+ });
12021
+ return rooms;
12022
+ }
11948
12023
  class ThreeVJia extends Component {
11949
12024
  static name = "ThreeVJia";
11950
12025
  lineSegments = [];
11951
12026
  neededUpdate = true;
12027
+ trajectory;
11952
12028
  /**
11953
12029
  */
11954
12030
  onAddFromParent() {
11955
12031
  const angleCorrectionDxf = this.parent?.findComponentByName("CorrectionDxf");
11956
12032
  angleCorrectionDxf.addEventListener("cadChange", async () => {
11957
12033
  this.neededUpdate = true;
11958
- console.log(this.toJson());
12034
+ this.trajectory = angleCorrectionDxf.options.trajectory;
11959
12035
  });
11960
12036
  }
11961
12037
  cacheJson;
@@ -11963,8 +12039,9 @@ class ThreeVJia extends Component {
11963
12039
  */
11964
12040
  updateData() {
11965
12041
  if (!this.neededUpdate) return;
11966
- const angleCorrectionDxf = this.parent?.findComponentByName("CorrectionDxf");
12042
+ const angleCorrectionDxf = this.parent?.findComponentByName("CorrectionDxf"), dxf = this.parent?.findComponentByName("Dxf"), rooms = findRooms(dxf.getLineSegments(), this.trajectory);
11967
12043
  this.cacheJson = lineDataToThreeVJiaJson(angleCorrectionDxf.getLineSegments(), angleCorrectionDxf.angle).toJson();
12044
+ ThreeVJiaJson.appendRooms(this.cacheJson, rooms);
11968
12045
  this.neededUpdate = false;
11969
12046
  }
11970
12047
  /** 转为json
@@ -22101,7 +22178,6 @@ const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
22101
22178
  clippingInsertObjectDoubleWall,
22102
22179
  clippingLineUserData,
22103
22180
  components,
22104
- fillPlaceHolders,
22105
22181
  findDiscretePoint,
22106
22182
  findDiscretePoint2,
22107
22183
  findDiscretePointLine,
@@ -11,6 +11,7 @@ export declare class ThreeVJia extends Component<{
11
11
  static name: string;
12
12
  lineSegments: LineSegment<LineUserData>[];
13
13
  neededUpdate: boolean;
14
+ trajectory?: Record<string, any> | undefined;
14
15
  /**
15
16
  */
16
17
  onAddFromParent(): void;
@@ -2,7 +2,7 @@ import { LineSegment } from '../../utils/algorithms/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[];
@@ -29,6 +29,10 @@ export declare class WallInsertObject {
29
29
  * @returns
30
30
  */
31
31
  static isDouble(line: LineSegment<LineUserData>): boolean;
32
+ /** 是否配对
33
+ * @param lines
34
+ */
35
+ static isPairing(lines: LineSegment<LineUserData>[]): true | undefined;
32
36
  /** 获取孔洞 id
33
37
  * @param item
34
38
  * @returns
@@ -10,4 +10,4 @@ export interface IRoom {
10
10
  /** 查找房间
11
11
  * @param lines
12
12
  */
13
- export declare function findRooms(lines: LineSegment<LineUserData>[]): IRoom[];
13
+ export declare function findRooms(lines: LineSegment<LineUserData>[], trajectory?: Record<string, any> | undefined): IRoom[];
@@ -2,6 +2,7 @@ import { LineSegment } from '../../utils/algorithms/LineSegment';
2
2
  import { LineUserData } from '../type';
3
3
  import { WallGroupManager } from './WallGroupManager';
4
4
  import { Pipeline, HandlerContext } from '../../utils/algorithms/Pipeline';
5
+ import { IRoom } from './findRooms';
5
6
  type Vec2 = {
6
7
  x: number;
7
8
  y: number;
@@ -45,6 +46,11 @@ type Room = {
45
46
  export type ThreeVJiaJsonObject = {
46
47
  version: string;
47
48
  name: string;
49
+ center: {
50
+ x: number;
51
+ y: number;
52
+ };
53
+ angle: number;
48
54
  communityName: string;
49
55
  city: string;
50
56
  province: string;
@@ -104,6 +110,12 @@ export declare class ThreeVJiaJson extends Pipeline<DataOption, ICache> {
104
110
  * @returns
105
111
  */
106
112
  transform(): ThreeVJiaJsonObject;
113
+ /** 添加房间
114
+ * @param option
115
+ * @param rooms
116
+ */
117
+ static appendRooms(option: ThreeVJiaJsonObject, rooms: IRoom[]): void;
118
+ static fillPlaceHolders(): void;
107
119
  }
108
120
  /**
109
121
  * 转为 三维家 墙体结构
@@ -116,9 +128,4 @@ export declare function lineDataToThreeVJiaJson(lineSegments: LineSegment<LineUs
116
128
  lines: never[];
117
129
  toJson(name?: string, communityName?: string): ThreeVJiaJsonObject;
118
130
  };
119
- /**
120
- * @param option
121
- * @param items
122
- */
123
- export declare function fillPlaceHolders(option: ThreeVJiaJsonObject, items: any): void;
124
131
  export {};
package/src/index.css CHANGED
@@ -41,6 +41,15 @@
41
41
  --tw-drop-shadow-color: initial;
42
42
  --tw-drop-shadow-alpha: 100%;
43
43
  --tw-drop-shadow-size: initial;
44
+ --tw-backdrop-blur: initial;
45
+ --tw-backdrop-brightness: initial;
46
+ --tw-backdrop-contrast: initial;
47
+ --tw-backdrop-grayscale: initial;
48
+ --tw-backdrop-hue-rotate: initial;
49
+ --tw-backdrop-invert: initial;
50
+ --tw-backdrop-opacity: initial;
51
+ --tw-backdrop-saturate: initial;
52
+ --tw-backdrop-sepia: initial;
44
53
  }
45
54
  }
46
55
  }
@@ -334,6 +343,10 @@
334
343
  display: grid;
335
344
  }
336
345
 
346
+ .hidden {
347
+ display: none;
348
+ }
349
+
337
350
  .table {
338
351
  display: table;
339
352
  }
@@ -843,6 +856,11 @@
843
856
  filter: var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, );
844
857
  }
845
858
 
859
+ .backdrop-filter {
860
+ -webkit-backdrop-filter: var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );
861
+ backdrop-filter: var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );
862
+ }
863
+
846
864
  .transition {
847
865
  transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
848
866
  transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
@@ -1116,6 +1134,51 @@
1116
1134
  inherits: false
1117
1135
  }
1118
1136
 
1137
+ @property --tw-backdrop-blur {
1138
+ syntax: "*";
1139
+ inherits: false
1140
+ }
1141
+
1142
+ @property --tw-backdrop-brightness {
1143
+ syntax: "*";
1144
+ inherits: false
1145
+ }
1146
+
1147
+ @property --tw-backdrop-contrast {
1148
+ syntax: "*";
1149
+ inherits: false
1150
+ }
1151
+
1152
+ @property --tw-backdrop-grayscale {
1153
+ syntax: "*";
1154
+ inherits: false
1155
+ }
1156
+
1157
+ @property --tw-backdrop-hue-rotate {
1158
+ syntax: "*";
1159
+ inherits: false
1160
+ }
1161
+
1162
+ @property --tw-backdrop-invert {
1163
+ syntax: "*";
1164
+ inherits: false
1165
+ }
1166
+
1167
+ @property --tw-backdrop-opacity {
1168
+ syntax: "*";
1169
+ inherits: false
1170
+ }
1171
+
1172
+ @property --tw-backdrop-saturate {
1173
+ syntax: "*";
1174
+ inherits: false
1175
+ }
1176
+
1177
+ @property --tw-backdrop-sepia {
1178
+ syntax: "*";
1179
+ inherits: false
1180
+ }
1181
+
1119
1182
  * {
1120
1183
  -webkit-tap-highlight-color: transparent;
1121
1184
  }
@@ -1173,10 +1236,10 @@ button[data-v-624dc8f8]:active {
1173
1236
  color: #a7a7a7
1174
1237
  }
1175
1238
 
1176
- [data-v-89a7b533] {
1239
+ [data-v-50ec85be] {
1177
1240
  font-family: 宋体;
1178
1241
  }
1179
- .button[data-v-89a7b533] {
1242
+ .button[data-v-50ec85be] {
1180
1243
  padding: 5px 10px;
1181
1244
  border: none;
1182
1245
  background: var(--primary-color);
package/src/index3.js CHANGED
@@ -16652,6 +16652,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16652
16652
  drawLines(lines2, { color: randomColor() });
16653
16653
  });
16654
16654
  }
16655
+ function angleTest() {
16656
+ if (defaultComponent.selectLines.length !== 2) {
16657
+ ElMessage.warning({ message: "请选择两条线段" });
16658
+ return;
16659
+ }
16660
+ const line1 = defaultComponent.selectLines[0];
16661
+ const line2 = defaultComponent.selectLines[1];
16662
+ console.log(
16663
+ line1.angle(line2, { unit: "degree", range: "180" })
16664
+ );
16665
+ }
16655
16666
  function commandConfirm() {
16656
16667
  variable.set("currentKeyDown", "enter");
16657
16668
  queueMicrotask(() => variable.set("currentKeyUp", "enter"));
@@ -16908,7 +16919,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16908
16919
  title: "取消命令(Esc)",
16909
16920
  class: "active:scale-[0.7] transition-all flex items-center justify-center",
16910
16921
  onClick: _cache[0] || (_cache[0] = (e) => (unref(editor).cancelCommand(), e.stopPropagation()))
16911
- }, [..._cache[20] || (_cache[20] = [
16922
+ }, [..._cache[21] || (_cache[21] = [
16912
16923
  createElementVNode("svg", {
16913
16924
  fill: "#fff",
16914
16925
  width: "16",
@@ -16926,7 +16937,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16926
16937
  onClick: commandConfirm,
16927
16938
  title: "确认命令(Enter)",
16928
16939
  class: "active:scale-[0.7] transition-all flex items-center justify-center"
16929
- }, [..._cache[21] || (_cache[21] = [
16940
+ }, [..._cache[22] || (_cache[22] = [
16930
16941
  createElementVNode("svg", {
16931
16942
  fill: "#fff",
16932
16943
  width: "16",
@@ -16949,7 +16960,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16949
16960
  modelValue: dxfVisible.value,
16950
16961
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dxfVisible.value = $event)
16951
16962
  }, {
16952
- default: withCtx(() => [..._cache[22] || (_cache[22] = [
16963
+ default: withCtx(() => [..._cache[23] || (_cache[23] = [
16953
16964
  createTextVNode("Dxf", -1)
16954
16965
  ])]),
16955
16966
  _: 1
@@ -16959,7 +16970,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16959
16970
  modelValue: unref(editor).renderManager.lineAdsorption.value,
16960
16971
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(editor).renderManager.lineAdsorption.value = $event)
16961
16972
  }, {
16962
- default: withCtx(() => [..._cache[23] || (_cache[23] = [
16973
+ default: withCtx(() => [..._cache[24] || (_cache[24] = [
16963
16974
  createTextVNode("线吸附", -1)
16964
16975
  ])]),
16965
16976
  _: 1
@@ -16970,7 +16981,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
16970
16981
  modelValue: unref(editor).renderManager.pointAdsorption.value,
16971
16982
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(editor).renderManager.pointAdsorption.value = $event)
16972
16983
  }, {
16973
- default: withCtx(() => [..._cache[24] || (_cache[24] = [
16984
+ default: withCtx(() => [..._cache[25] || (_cache[25] = [
16974
16985
  createTextVNode("点吸附", -1)
16975
16986
  ])]),
16976
16987
  _: 1
@@ -17016,7 +17027,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17016
17027
  createVNode(unref(ElDropdownMenu), null, {
17017
17028
  default: withCtx(() => [
17018
17029
  createVNode(unref(ElDropdownItem), { onClick: selectLocalFile }, {
17019
- default: withCtx(() => [..._cache[26] || (_cache[26] = [
17030
+ default: withCtx(() => [..._cache[27] || (_cache[27] = [
17020
17031
  createTextVNode(" 选择文件 ", -1)
17021
17032
  ])]),
17022
17033
  _: 1
@@ -17024,7 +17035,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17024
17035
  createVNode(unref(ElDropdownItem), {
17025
17036
  onClick: _cache[4] || (_cache[4] = ($event) => unref(dxfSystem).CorrectionDxf.downloadOriginalData("json.json"))
17026
17037
  }, {
17027
- default: withCtx(() => [..._cache[27] || (_cache[27] = [
17038
+ default: withCtx(() => [..._cache[28] || (_cache[28] = [
17028
17039
  createTextVNode(" 下载Json ", -1)
17029
17040
  ])]),
17030
17041
  _: 1
@@ -17032,7 +17043,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17032
17043
  createVNode(unref(ElDropdownItem), {
17033
17044
  onClick: _cache[5] || (_cache[5] = ($event) => unref(dxfSystem).CorrectionDxf.downloadDxf("test.dxf"))
17034
17045
  }, {
17035
- default: withCtx(() => [..._cache[28] || (_cache[28] = [
17046
+ default: withCtx(() => [..._cache[29] || (_cache[29] = [
17036
17047
  createTextVNode(" 下载DXF ", -1)
17037
17048
  ])]),
17038
17049
  _: 1
@@ -17040,7 +17051,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17040
17051
  createVNode(unref(ElDropdownItem), {
17041
17052
  onClick: _cache[6] || (_cache[6] = ($event) => unref(dxfSystem).CorrectionDxf.downloadDxfImage("dxf.jpg"))
17042
17053
  }, {
17043
- default: withCtx(() => [..._cache[29] || (_cache[29] = [
17054
+ default: withCtx(() => [..._cache[30] || (_cache[30] = [
17044
17055
  createTextVNode(" 下载JPG ", -1)
17045
17056
  ])]),
17046
17057
  _: 1
@@ -17048,7 +17059,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17048
17059
  createVNode(unref(ElDropdownItem), {
17049
17060
  onClick: _cache[7] || (_cache[7] = ($event) => unref(whiteModel).downloadGltf("test.glb", true))
17050
17061
  }, {
17051
- default: withCtx(() => [..._cache[30] || (_cache[30] = [
17062
+ default: withCtx(() => [..._cache[31] || (_cache[31] = [
17052
17063
  createTextVNode(" 下载白膜 ", -1)
17053
17064
  ])]),
17054
17065
  _: 1
@@ -17056,7 +17067,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17056
17067
  createVNode(unref(ElDropdownItem), {
17057
17068
  onClick: _cache[8] || (_cache[8] = ($event) => unref(threeVJia).download())
17058
17069
  }, {
17059
- default: withCtx(() => [..._cache[31] || (_cache[31] = [
17070
+ default: withCtx(() => [..._cache[32] || (_cache[32] = [
17060
17071
  createTextVNode(" 下载三维家JSON ", -1)
17061
17072
  ])]),
17062
17073
  _: 1
@@ -17078,7 +17089,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17078
17089
  }, null, 8, ["modelValue"])
17079
17090
  ]),
17080
17091
  default: withCtx(() => [
17081
- _cache[32] || (_cache[32] = createElementVNode("div", { class: "w-full" }, "z值调整", -1))
17092
+ _cache[33] || (_cache[33] = createElementVNode("div", { class: "w-full" }, "z值调整", -1))
17082
17093
  ]),
17083
17094
  _: 1
17084
17095
  })) : createCommentVNode("", true)
@@ -17106,6 +17117,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17106
17117
  }, "回环测试", 32)
17107
17118
  ]),
17108
17119
  _: 1
17120
+ }),
17121
+ createVNode(unref(ElDropdownItem), null, {
17122
+ default: withCtx(() => [
17123
+ createElementVNode("div", {
17124
+ class: "w-full",
17125
+ onMousedown: _cache[13] || (_cache[13] = withModifiers(() => {
17126
+ }, ["stop"])),
17127
+ onClick: withModifiers(angleTest, ["stop", "prevent"])
17128
+ }, "角度测试", 32)
17129
+ ]),
17130
+ _: 1
17109
17131
  })
17110
17132
  ]),
17111
17133
  _: 1
@@ -17116,7 +17138,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17116
17138
  size: "small",
17117
17139
  class: "mt-[10px] w-full"
17118
17140
  }, {
17119
- default: withCtx(() => [..._cache[25] || (_cache[25] = [
17141
+ default: withCtx(() => [..._cache[26] || (_cache[26] = [
17120
17142
  createTextVNode("其他功能", -1)
17121
17143
  ])]),
17122
17144
  _: 1
@@ -17127,16 +17149,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17127
17149
  ])) : (openBlock(), createElementBlock("div", {
17128
17150
  key: 1,
17129
17151
  class: normalizeClass([{ "translate-y-full": isMainCommand.value }, "z-8 absolute left-0 bottom-0 transition-transform w-full bg-white p-[5px] box-border text-[14px]"]),
17130
- onMousedown: _cache[16] || (_cache[16] = (e) => e.stopPropagation()),
17131
- onPointerdown: _cache[17] || (_cache[17] = (e) => e.stopPropagation())
17152
+ onMousedown: _cache[17] || (_cache[17] = (e) => e.stopPropagation()),
17153
+ onPointerdown: _cache[18] || (_cache[18] = (e) => e.stopPropagation())
17132
17154
  }, [
17133
17155
  createElementVNode("div", _hoisted_14, [
17134
17156
  createVNode(unref(ElCheckbox), {
17135
17157
  size: "small",
17136
17158
  modelValue: dxfVisible.value,
17137
- "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => dxfVisible.value = $event)
17159
+ "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => dxfVisible.value = $event)
17138
17160
  }, {
17139
- default: withCtx(() => [..._cache[33] || (_cache[33] = [
17161
+ default: withCtx(() => [..._cache[34] || (_cache[34] = [
17140
17162
  createTextVNode("Dxf", -1)
17141
17163
  ])]),
17142
17164
  _: 1
@@ -17144,9 +17166,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17144
17166
  createVNode(unref(ElCheckbox), {
17145
17167
  size: "small",
17146
17168
  modelValue: unref(editor).renderManager.lineAdsorption.value,
17147
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => unref(editor).renderManager.lineAdsorption.value = $event)
17169
+ "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(editor).renderManager.lineAdsorption.value = $event)
17148
17170
  }, {
17149
- default: withCtx(() => [..._cache[34] || (_cache[34] = [
17171
+ default: withCtx(() => [..._cache[35] || (_cache[35] = [
17150
17172
  createTextVNode("线吸附", -1)
17151
17173
  ])]),
17152
17174
  _: 1
@@ -17155,9 +17177,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17155
17177
  disabled: !unref(editor).renderManager.lineAdsorption.value,
17156
17178
  size: "small",
17157
17179
  modelValue: unref(editor).renderManager.pointAdsorption.value,
17158
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => unref(editor).renderManager.pointAdsorption.value = $event)
17180
+ "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => unref(editor).renderManager.pointAdsorption.value = $event)
17159
17181
  }, {
17160
- default: withCtx(() => [..._cache[35] || (_cache[35] = [
17182
+ default: withCtx(() => [..._cache[36] || (_cache[36] = [
17161
17183
  createTextVNode("点吸附", -1)
17162
17184
  ])]),
17163
17185
  _: 1
@@ -17216,13 +17238,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17216
17238
  }, [
17217
17239
  isMainCommand.value ? (openBlock(), createElementBlock("div", {
17218
17240
  key: 0,
17219
- onMousemove: _cache[19] || (_cache[19] = (e) => e.stopPropagation()),
17241
+ onMousemove: _cache[20] || (_cache[20] = (e) => e.stopPropagation()),
17220
17242
  class: "cursor-pointer z-8 box-border bg-[rgba(0,0,0,0.5)] rounded-[6px] p-[5px] absolute left-[50%] translate-x-[-50%] top-[20px] flex gap-[5px] items-center"
17221
17243
  }, [
17222
17244
  createElementVNode("button", {
17223
- onClick: _cache[18] || (_cache[18] = (e) => (unref(editor).cancelCommand(), e.stopPropagation())),
17245
+ onClick: _cache[19] || (_cache[19] = (e) => (unref(editor).cancelCommand(), e.stopPropagation())),
17224
17246
  class: "bg-transparent! button cursor-pointer"
17225
- }, [..._cache[36] || (_cache[36] = [
17247
+ }, [..._cache[37] || (_cache[37] = [
17226
17248
  createElementVNode("svg", {
17227
17249
  fill: "#fff",
17228
17250
  viewBox: "0 0 1024 1024",
@@ -17238,7 +17260,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17238
17260
  key: 0,
17239
17261
  onClick: commandConfirm,
17240
17262
  class: "button bg-transparent! cursor-pointer"
17241
- }, [..._cache[37] || (_cache[37] = [
17263
+ }, [..._cache[38] || (_cache[38] = [
17242
17264
  createElementVNode("svg", {
17243
17265
  fill: "#28c932",
17244
17266
  viewBox: "0 0 1026 1024",
@@ -17259,7 +17281,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
17259
17281
  };
17260
17282
  }
17261
17283
  });
17262
- const EditorToolContent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-89a7b533"]]);
17284
+ const EditorToolContent = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-50ec85be"]]);
17263
17285
  class StorageHelper {
17264
17286
  static get(key, defaultValue = void 0) {
17265
17287
  const value = localStorage.getItem(key);
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
+ export default _default;
@@ -1,4 +1,9 @@
1
1
  import { LineSegment } from './LineSegment';
2
+ export interface AlignDescriptor {
3
+ esp?: number;
4
+ gap?: number;
5
+ onMergeLine?: (target: LineSegment, source: LineSegment) => void;
6
+ }
2
7
  /** 通过平行轴和垂直轴分组对齐线段,搭配垂直纠正使用
3
8
  */
4
9
  export declare class AlignToParallelSegments {
@@ -14,10 +19,10 @@ export declare class AlignToParallelSegments {
14
19
  * @param groups
15
20
  * @param verticalLines
16
21
  */
17
- static fittingAlignment(groups: LineSegment[][], verticalLines: LineSegment[]): LineSegment<Record<string, any>>[];
22
+ static fittingAlignment(groups: LineSegment[][], verticalLines: LineSegment[], opt?: AlignDescriptor): LineSegment<Record<string, any>>[];
18
23
  /** 对齐到平行线段, 请在垂直纠正(AxisAlignCorr)后使用
19
24
  * @param lines
20
25
  * @returns
21
26
  */
22
- static align(lines: LineSegment[], esp?: number, gap?: number): LineSegment<Record<string, any>>[];
27
+ static align(lines: LineSegment[], opt?: AlignDescriptor): LineSegment<Record<string, any>>[];
23
28
  }
@@ -17,6 +17,7 @@ export declare class LineSegment<T = Record<string, any>> {
17
17
  constructor(p1?: Point, p2?: Point);
18
18
  private _initLenListener;
19
19
  set(p1: Point, p2: Point): this;
20
+ setLength(len: number): this;
20
21
  /** 获取另一个点
21
22
  * @param point
22
23
  * @returns
@@ -74,7 +74,10 @@ export declare class Point<T = Record<string, any>> {
74
74
  * @param point
75
75
  * @param angle 旋转角度,单位为弧度
76
76
  */
77
- rotate(point: Point, angle: number): this;
77
+ rotate(point: {
78
+ x: number;
79
+ y: number;
80
+ }, angle: number): this;
78
81
  /**
79
82
  * 保留小数位数
80
83
  * @param count
@@ -83,6 +83,7 @@ export declare class PointSpatialHash<T = Record<string, any>> {
83
83
  * @param point
84
84
  */
85
85
  queryPoint(point: Point, excludeOneself?: boolean): PvgList<T>;
86
+ queryPoints(points: Point[], excludeOneself?: boolean): Target<T>[];
86
87
  /** 获取多边形内的点
87
88
  * @param polygon
88
89
  */