Browse Source

Merge remote-tracking branch 'origin/master'

onlyh 3 years ago
parent
commit
c6592a6fbe
2 changed files with 10 additions and 1 deletions
  1. 4 1
      src/utils/graph/DivideFloorScene.ts
  2. 6 0
      src/utils/graph/generate.ts

+ 4 - 1
src/utils/graph/DivideFloorScene.ts

@@ -548,7 +548,10 @@ export class DivideFloorScene extends FloorScene {
                 }
                 if (this.customWall.length) {
                     this.customWall.forEach(t => {
-                        tempWall.push(t.toData())
+                        const data = t.toData();
+                        if (data.OutLine.length) {
+                            tempWall.push(data)
+                        }
                     })
                 }
                 console.log(map.EntityList[0].Elements.Walls.length);

+ 6 - 0
src/utils/graph/generate.ts

@@ -206,6 +206,12 @@ export class generate {
      * @return 简化后的轮廓线数据
     */
     static simplyOutline(outline: SPoint[]): SPoint[] {
+        for (let i = 0; i < outline.length - 1; i++) {
+            if (outline[i].x - outline[i + 1].x == 0 && outline[i].y - outline[i + 1].y == 0) {
+                outline.splice(i, 1);
+                i--;
+            }
+        }
         if (outline.length > 2) {
             for (let i = 1; i < outline.length - 1; i++) {
                 if (outline[i].y - outline[i - 1].y == 0 && outline[i + 1].y - outline[i].y == 0) {