Forráskód Böngészése

更新item更新方法update;2.0.537

haojianlong 5 éve
szülő
commit
7f6175225a

+ 8 - 8
package-lock.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/cad-engine",
-    "version": "2.0.528",
+    "version": "2.0.537",
     "lockfileVersion": 1,
     "requires": true,
     "dependencies": {
@@ -30,19 +30,19 @@
             "integrity": "sha512-V5Xgh02IFmRgM0/7Hkm34RFS/VHepK7786LefuJLyuRh0B48DNJSPrkBAgad5Rl5VM76c8hSQikiS/fyuy7nDQ=="
         },
         "@saga-web/draw": {
-            "version": "2.1.74",
-            "resolved": "http://dev.dp.sagacloud.cn:8082/repository/npm-saga/@saga-web/draw/-/draw-2.1.74.tgz",
-            "integrity": "sha512-ruPBhBdjUpjQw8gMmvCYXlqueS/W3TX8Lr2oBIH0Bg2lhezMhuHf6j46TAA6/oCuKwg99REV2jU2i50WWkogdQ==",
+            "version": "2.1.75",
+            "resolved": "http://dev.dp.sagacloud.cn:8082/repository/npm-saga/@saga-web/draw/-/draw-2.1.75.tgz",
+            "integrity": "sha512-li7WE+RVMXK6s+OtoCSxBhZeXzWWDipSOIcskvqhzTXftDU19JyHPXHQpYxV17gLOAbEqXBZml+wDayXqSZQ9Q==",
             "requires": {
                 "@saga-web/base": "^2.1.9"
             }
         },
         "@saga-web/graphy": {
-            "version": "2.1.39",
-            "resolved": "http://dev.dp.sagacloud.cn:8082/repository/npm-saga/@saga-web/graphy/-/graphy-2.1.39.tgz",
-            "integrity": "sha512-WyD+DCmcrNETqiEkeenD4V7zSE1kejFXAhQC9f+vAnFnxtEJBzCMF3fLnM2jtquynstz7aSRQ7kCRzEdls8XDA==",
+            "version": "2.1.40",
+            "resolved": "http://dev.dp.sagacloud.cn:8082/repository/npm-saga/@saga-web/graphy/-/graphy-2.1.40.tgz",
+            "integrity": "sha512-TiUZMl2KcNvMyiQEfkeiBvZH/HnEUPSJCXNA3oFp0PPKwFZbzXWRDhMDa4AzoNxkuPLQaHHhQID/Neti46jNKw==",
             "requires": {
-                "@saga-web/draw": "^2.1.74"
+                "@saga-web/draw": "^2.1.75"
             }
         },
         "@types/eslint-visitor-keys": {

+ 3 - 3
package.json

@@ -1,6 +1,6 @@
 {
     "name": "@saga-web/cad-engine",
-    "version": "2.0.530",
+    "version": "2.0.537",
     "description": "上格云 CAD图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -32,8 +32,8 @@
     },
     "dependencies": {
         "@saga-web/base": "2.1.9",
-        "@saga-web/draw": "2.1.74",
-        "@saga-web/graphy": "2.1.39",
+        "@saga-web/draw": "2.1.75",
+        "@saga-web/graphy": "2.1.40",
         "axios": "^0.18.0",
         "pako": "^1.0.10",
         "poly-decomp": "^0.3.0",

+ 10 - 5
src/DivideFloorScene.ts

@@ -116,6 +116,7 @@ export class DivideFloorScene extends ZoneScene {
             this.removeItem(this.sceneMark);
             this.sceneMark = null;
             this.isMarking = false;
+            this.view && this.view.update();
         }
     } // Function clearSceneMark()
 
@@ -129,6 +130,7 @@ export class DivideFloorScene extends ZoneScene {
             this.removeItem(this.cutItem);
             this.cutItem = null;
             this.isCutting = false;
+            this.view && this.view.update();
         }
     } // Function clearCut()
 
@@ -857,9 +859,10 @@ export class DivideFloorScene extends ZoneScene {
             regions: [],
             inverted: false
         };
-        let list: Poly[] = [];
+        let list: Poly[] = [],
+            rect1: SRect;
         this.zoneList.forEach((t): void => {
-            let rect1 = t.boundingRect();
+            rect1 = t.boundingRect();
             t.pointArr.forEach((item): void => {
                 let polygons: Poly = {
                     regions: [],
@@ -880,10 +883,12 @@ export class DivideFloorScene extends ZoneScene {
             });
         });
         if (list.length) {
-            let seg1 = segments(list[0]);
+            let seg1 = segments(list[0]),
+                seg2,
+                comb;
             for (let i = 1; i < list.length; i++) {
-                let seg2 = segments(list[i]);
-                let comb = combine(seg1, seg2);
+                seg2 = segments(list[i]);
+                comb = combine(seg1, seg2);
                 seg1 = selectUnion(comb);
             }
             poly1 = polygon(seg1);

+ 1 - 0
src/FloorView.ts

@@ -115,6 +115,7 @@ export class FloorView extends SGraphyView {
             }
             this._leftKeyPos.x = se.x;
             this._leftKeyPos.y = se.y;
+            this.update();
         }
         super.onMouseMove(event);
     } // Function onMouseMove()

+ 3 - 0
src/items/SceneMarkItem.ts

@@ -102,6 +102,7 @@ export class SceneMarkItem extends SGraphyItem {
             this.lastPoint.y = p.y;
             this.outLine.push(p);
         }
+        this.update();
         return true;
     } // Function onMouseDown()
 
@@ -129,6 +130,7 @@ export class SceneMarkItem extends SGraphyItem {
                 }
             }
         }
+        this.update();
         return true;
     } // Function onMouseMove()
 
@@ -165,6 +167,7 @@ export class SceneMarkItem extends SGraphyItem {
             antiArr = antiArr.reverse();
         }
         this.mask.polygon(antiArr);
+        this.update();
     } // Function createMask()
 
     /**

+ 2 - 0
src/items/ShadeItem.ts

@@ -99,6 +99,7 @@ export class ShadeItem extends SGraphyItem {
             this.lastPoint.y = p.y;
             this.outLine.push(p);
         }
+        this.update();
         return true;
     } // Function onMouseDown()
 
@@ -126,6 +127,7 @@ export class ShadeItem extends SGraphyItem {
                 }
             }
         }
+        this.update();
         return true;
     } // Function onMouseMove()
 

+ 7 - 3
src/items/ZoneItem.ts

@@ -56,9 +56,9 @@ export class ZoneItem extends SGraphyItem {
     /** 点击位置坐标  */
     private clickPoint: SPoint | undefined;
     /** 选中时的颜色  */
-    private selectColor = Opt.selectColor;
+    private selectColor: SColor = Opt.selectColor;
     /** 不可选时的颜色  */
-    private unselectColor = Opt.zoneUnselectColor;
+    private unselectColor: SColor = Opt.zoneUnselectColor;
     /** 高亮状态    */
     private _highLightFlag: boolean = false;
     get highLightFlag(): boolean {
@@ -86,7 +86,10 @@ export class ZoneItem extends SGraphyItem {
         this._isInfected = value;
         this.update();
     } // Set isInfected
-    private infectedColor = Opt.zoneInfectedColor;
+    /** 受影响的业务空间填充颜色    */
+    private infectedColor: SColor = Opt.zoneInfectedColor;
+    /** 受影响的业务空间边框颜色    */
+    private infectedBorder: SColor = Opt.zoneInfectedBorder;
 
     /**
      * 构造函数
@@ -220,6 +223,7 @@ export class ZoneItem extends SGraphyItem {
                 painter.brush.color = new SColor(this.data.Color);
             } else if (this.isInfected) {
                 painter.brush.color = this.infectedColor;
+                // painter.pen.color = this.infectedBorder;
             } else {
                 painter.brush.color = new SColor(
                     `${this.data.Color}${Transparency[this.transparency]}`

+ 3 - 1
src/types/Opt.ts

@@ -57,5 +57,7 @@ export class Opt {
     /** 业务空间不可选中颜色 */
     static zoneUnselectColor = new SColor("#cecece");
     /** 受影响业务空间颜色 */
-    static zoneInfectedColor = new SColor("#e2675c");
+    static zoneInfectedColor = new SColor("#ff0000");
+    /** 受影响的业务空间边框颜色    */
+    static zoneInfectedBorder = new SColor("#e2675c");
 } // Interface Opt

+ 13 - 0
src/utils/SMathUtil.ts

@@ -301,4 +301,17 @@ export class SMathUtil {
         console.log(outlineList);
         return outlineList;
     } // Function getIntersectInArray()
+
+    /**
+     * 计算轮廓线面积
+     * */
+    static calculateArea(arr: SPoint[]): number {
+        let sum = 0;
+        let n = arr.length;
+        arr[n] = arr[0];
+        for (let i = 1; i <= n; i++) {
+            sum += arr[i].x * arr[i - 1].y - arr[i - 1].x * arr[i].y;
+        }
+        return sum / 2;
+    }
 } // Class SMathUtil