build-dxf 0.1.80 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-dxf",
3
- "version": "0.1.80",
3
+ "version": "0.1.81",
4
4
  "description": "线段构建双线墙壁的dxf版本",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -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, 0.01, 1e3)
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
@@ -19294,15 +19294,14 @@ function removeShortDoubleWall(lineSegments) {
19294
19294
  function getNextPoint(point2, line, next, width) {
19295
19295
  if (next.length === 0) {
19296
19296
  const direct = point2.directionFrom(line.getAnotherPoint(point2));
19297
- return direct.multiplyScalar(width);
19297
+ return point2.clone().add(direct.multiplyScalar(width));
19298
19298
  }
19299
19299
  const p2 = next[0].userData.projectPoint(point2, false);
19300
19300
  if (!p2) return false;
19301
19301
  return p2;
19302
19302
  }
19303
- function stepElimination(lineSegments, onMerge) {
19303
+ function stepElimination(lineSegments, findMinWidth = 0.1, onMerge) {
19304
19304
  const grid = createPointVirtualGrid(lineSegments);
19305
- const minWidth = 0.1;
19306
19305
  function getIntersInfo(line, point2) {
19307
19306
  const intersList = grid.queryPoint(point2, true);
19308
19307
  if (intersList.length == 0) return;
@@ -19338,7 +19337,7 @@ function stepElimination(lineSegments, onMerge) {
19338
19337
  for (let i = 0; i < lineSegments.length; i++) {
19339
19338
  const line = lineSegments[i];
19340
19339
  const len = line.length();
19341
- if (len > minWidth) continue;
19340
+ if (len > findMinWidth) continue;
19342
19341
  const startInfo = getIntersInfo(line, line.start);
19343
19342
  if (!startInfo) continue;
19344
19343
  const endInfo = getIntersInfo(line, line.end);
@@ -19359,19 +19358,28 @@ function stepElimination(lineSegments, onMerge) {
19359
19358
  const parallel2 = startInfo.parallel.concat(endInfo.parallel);
19360
19359
  const newPoint = getNextPoint(mainInfo.firstPoint, mainInfo.firstLine, secondaryInfo.next, secondaryInfo.length);
19361
19360
  if (!newPoint) continue;
19361
+ removeLines.push(line);
19362
+ line.points.forEach((p2) => grid.remove(p2));
19362
19363
  if (parallel2.length === 0) {
19363
19364
  const oldLine = mainInfo.firstLine.clone();
19364
19365
  mainInfo.firstPoint.copy(newPoint);
19365
19366
  secondaryInfo.next.forEach((d2) => d2.point.copy(newPoint));
19366
- removeLines.push(secondaryInfo.firstLine, line);
19367
- line.points.concat(secondaryInfo.firstLine.points).forEach((p2) => grid.remove(p2));
19367
+ removeLines.push(secondaryInfo.firstLine);
19368
+ secondaryInfo.firstLine.points.forEach((p2) => grid.remove(p2));
19368
19369
  mainInfo.firstLine.points.forEach((p2) => grid.update(p2));
19369
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));
19370
19379
  }
19371
19380
  }
19372
19381
  const removeLinesSet = new Set(removeLines);
19373
19382
  lineSegments = lineSegments.filter((line) => !removeLinesSet.has(line));
19374
- lineSegments = lineSegmentClipping(lineSegments, 0);
19375
19383
  return lineSegments;
19376
19384
  }
19377
19385
  function repetitiveTask(count, callfun) {
@@ -19403,7 +19411,8 @@ function stepEliminationMerge(target, _, source, oldLine) {
19403
19411
  WallInsertObject.recomputed([target]);
19404
19412
  }
19405
19413
  function linesSmoothing(lines, _) {
19406
- repetitiveTask(1, () => lines = stepElimination(lines, stepEliminationMerge));
19414
+ repetitiveTask(2, () => lines = stepElimination(lines, 0.1, stepEliminationMerge));
19415
+ WallInsertObject.recomputed(lines);
19407
19416
  return lines;
19408
19417
  }
19409
19418
  const PRE_PROCESSOR = {
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({
@@ -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[], onMerge?: (mainLine: LineSegment, sortLine: LineSegment, secondaryLine: LineSegment, oldLine: LineSegment) => void): LineSegment<Record<string, any>>[];
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
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 获取json
3
+ * @param url
4
+ */
5
+ export declare function getJson(url: string): Promise<any>;