瀏覽代碼

修改字段

haojianlong 4 年之前
父節點
當前提交
74dde4794a
共有 37 個文件被更改,包括 348 次插入237 次删除
  1. 2 2
      persagy-web-big/package.json
  2. 7 8
      persagy-web-big/src/items/floor/SColumnItem.ts
  3. 27 28
      persagy-web-big/src/items/floor/SSpaceItem.ts
  4. 8 9
      persagy-web-big/src/items/floor/SWallItem.ts
  5. 35 36
      persagy-web-big/src/items/floor/ZoneItem.ts
  6. 35 0
      persagy-web-big/src/types/BigPoint.ts
  7. 7 7
      persagy-web-big/src/types/ImageData.ts
  8. 4 4
      persagy-web-big/src/types/Marker.ts
  9. 2 2
      persagy-web-big/src/types/Place.ts
  10. 9 9
      persagy-web-big/src/types/TextData.ts
  11. 2 1
      persagy-web-big/src/types/floor/Casement.ts
  12. 2 1
      persagy-web-big/src/types/floor/Column.ts
  13. 4 3
      persagy-web-big/src/types/floor/Door.ts
  14. 2 1
      persagy-web-big/src/types/floor/Space.ts
  15. 2 1
      persagy-web-big/src/types/floor/VirtualWall.ts
  16. 3 2
      persagy-web-big/src/types/floor/Wall.ts
  17. 2 1
      persagy-web-big/src/types/floor/Zone.ts
  18. 2 2
      persagy-web-big/src/types/topology/Anchor.ts
  19. 8 8
      persagy-web-big/src/types/topology/MarkerTopo.ts
  20. 13 13
      persagy-web-big/src/types/topology/Node.ts
  21. 11 11
      persagy-web-big/src/types/topology/Relation.ts
  22. 35 7
      persagy-web-big/src/utils/SMathUtil.ts
  23. 3 3
      persagy-web-draw/src/SColor.ts
  24. 1 1
      persagy-web-graph/package.json
  25. 6 0
      persagy-web-graph/src/SGraphItem.ts
  26. 60 26
      persagy-web-graph/src/SGraphSelectContainer.ts
  27. 7 7
      persagy-web-graph/src/items/SGraphAreaGroupItem.ts
  28. 7 7
      persagy-web-graph/src/items/SGraphPolyGroupItem.ts
  29. 6 6
      persagy-web-graph/src/items/SGraphRectItem.ts
  30. 7 7
      persagy-web-graph/src/items/SGraphShape.ts
  31. 5 0
      persagy-web-graph/src/items/SGraphSvgItem.ts
  32. 2 2
      persagy-web-graph/src/types/AreaGroup.ts
  33. 3 3
      persagy-web-graph/src/types/Point.ts
  34. 2 2
      persagy-web-graph/src/types/PolyGroup.ts
  35. 6 6
      persagy-web-graph/src/types/SGraphRect.ts
  36. 4 4
      persagy-web-graph/src/types/SGraphStyle.ts
  37. 7 7
      persagy-web-graph/src/types/SGraphSvg.ts

+ 2 - 2
persagy-web-big/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@persagy-web/big",
-    "version": "2.2.11",
+    "version": "2.2.13",
     "description": "博锐尚格建筑信息化库",
     "main": "lib/index.js",
     "types": "lib/index.d.js",
@@ -41,6 +41,6 @@
         "typescript": "^3.9.3"
     },
     "dependencies": {
-        "@persagy-web/graph": "2.2.15"
+        "@persagy-web/graph": "2.2.17"
     }
 }

+ 7 - 8
persagy-web-big/src/items/floor/SColumnItem.ts

@@ -45,11 +45,11 @@ export class SColumnItem extends SGraphPolyGroupItem {
      */
     constructor(parent: SGraphItem | null, data: Column) {
         const style = {
-            Default: {
-                Stroke: "#000000",
-                Fill: "#000000",
-                LineWidth: 0,
-                Effect: {}
+            default: {
+                stroke: "#000000",
+                fill: "#000000",
+                lineWidth: 0,
+                effect: {}
             }
         };
         let tempArr = data.OutLine;
@@ -57,13 +57,12 @@ export class SColumnItem extends SGraphPolyGroupItem {
         if (tempArr && tempArr.length) {
             outline = tempArr.map(t => {
                 return t.map(it => {
-                    it.Y = -it.Y;
-                    return it;
+                    return { x: it.X, y: -it.Y };
                 });
             });
         }
 
-        super(parent, { Outline: outline, Style: style });
+        super(parent, { outline: outline, style: style });
         this.data = data;
         this.zOrder = ItemOrder.columnOrder;
     } // Constructor

+ 27 - 28
persagy-web-big/src/items/floor/SSpaceItem.ts

@@ -99,38 +99,37 @@ export class SSpaceItem extends SGraphAreaGroupItem {
      */
     constructor(parent: SGraphItem | null, data: Space) {
         super(parent, {
-            Outline: [
+            outline: [
                 data.OutLine.map(t => {
                     return t.map(it => {
-                        it.Y = -it.Y;
-                        return it;
+                        return { x: it.X, y: -it.Y };
                     });
                 })
             ],
-            Style: {
-                Default: {
-                    Stroke: "#2b2b2b",
-                    Fill: "#f1fffd80",
-                    LineWidth: 1,
-                    Effect: {}
+            style: {
+                default: {
+                    stroke: "#2b2b2b",
+                    fill: "#f1fffd80",
+                    lineWidth: 1,
+                    effect: {}
                 },
-                Selected: {
-                    Stroke: "#2b2b2b",
-                    Fill: "#1abc9c",
-                    LineWidth: 1,
-                    Effect: {}
+                selected: {
+                    stroke: "#2b2b2b",
+                    fill: "#1abc9c",
+                    lineWidth: 1,
+                    effect: {}
                 },
-                Disabled: {
-                    Stroke: "#2b2b2b",
-                    Fill: "#afafaf",
-                    LineWidth: 1,
-                    Effect: {}
+                disabled: {
+                    stroke: "#2b2b2b",
+                    fill: "#afafaf",
+                    lineWidth: 1,
+                    effect: {}
                 },
-                Highlight: {
-                    Stroke: "#2b2b2b",
-                    Fill: "#fbb029",
-                    LineWidth: 1,
-                    Effect: {}
+                highlight: {
+                    stroke: "#2b2b2b",
+                    fill: "#fbb029",
+                    lineWidth: 1,
+                    effect: {}
                 }
             }
         });
@@ -144,16 +143,16 @@ export class SSpaceItem extends SGraphAreaGroupItem {
      *
      * */
     setStyle(): string {
-        let status = "Default";
+        let status = "default";
         if (this.style) {
             if (this.highLightFlag) {
-                status = "Highlight";
+                status = "highlight";
             } else if (this.enabled) {
                 if (this.selected) {
-                    status = "Selected";
+                    status = "selected";
                 }
             } else {
-                status = "Disabled";
+                status = "disabled";
             }
         }
         return status;

+ 8 - 9
persagy-web-big/src/items/floor/SWallItem.ts

@@ -46,11 +46,11 @@ export class SWallItem extends SGraphAreaGroupItem {
      */
     constructor(parent: SGraphItem | null, data: Wall) {
         const style = {
-            Default: {
-                Stroke: "#000000",
-                Fill: "#000000",
-                LineWidth: 0,
-                Effect: {}
+            default: {
+                stroke: "#000000",
+                fill: "#000000",
+                lineWidth: 0,
+                effect: {}
             }
         };
         let tempArr = data.OutLine;
@@ -58,15 +58,14 @@ export class SWallItem extends SGraphAreaGroupItem {
         if (tempArr && tempArr.length) {
             outline = tempArr.map(t => {
                 return t.map(it => {
-                    it.Y = -it.Y;
-                    return it;
+                    return { x: it.X, y: -it.Y };
                 });
             });
         }
 
         super(parent, {
-            Outline: outline.length ? [outline] : [],
-            Style: style
+            outline: outline.length ? [outline] : [],
+            style: style
         });
 
         this.data = data;

+ 35 - 36
persagy-web-big/src/items/floor/ZoneItem.ts

@@ -76,46 +76,45 @@ export class SZoneItem extends SGraphAreaGroupItem {
      */
     constructor(parent: SGraphItem | null, data: Zone) {
         super(parent, {
-            Outline: data.OutLine.map((t): Point[][] => {
+            outline: data.OutLine.map((t): Point[][] => {
                 return t.map((it): Point[] => {
                     return it.map(
                         (item): Point => {
-                            item.Y = -item.Y;
-                            return item;
+                            return { x: item.X, y: -item.Y };
                         }
                     );
                 });
             }),
-            Style: {
-                Default: {
-                    Stroke: "#00000000",
-                    Fill: "#ffee2280",
-                    LineWidth: 1,
-                    Effect: {}
+            style: {
+                default: {
+                    stroke: "#00000000",
+                    fill: "#ffee2280",
+                    lineWidth: 1,
+                    effect: {}
                 },
-                Selected: {
-                    Stroke: "#00000000",
-                    Fill: "#1abc9c",
-                    LineWidth: 1,
-                    Effect: {}
+                selected: {
+                    stroke: "#00000000",
+                    fill: "#1abc9c",
+                    lineWidth: 1,
+                    effect: {}
                 },
-                Highlight: {
-                    Stroke: "#00000000",
-                    Fill: data.Color || "#fbb029",
-                    LineWidth: 1,
-                    Effect: {}
+                highlight: {
+                    stroke: "#00000000",
+                    fill: data.Color || "#fbb029",
+                    lineWidth: 1,
+                    effect: {}
                 },
-                Unselect: {
-                    Stroke: "#00000000",
-                    Fill: "#cecece",
-                    LineWidth: 1,
-                    Effect: {}
+                unselect: {
+                    stroke: "#00000000",
+                    fill: "#cecece",
+                    lineWidth: 1,
+                    effect: {}
                 },
-                Infected: {
-                    Stroke: "#00000000",
-                    Fill: "#ff0000",
-                    LineWidth: 1,
-                    Effect: {}
+                infected: {
+                    stroke: "#00000000",
+                    fill: "#ff0000",
+                    lineWidth: 1,
+                    effect: {}
                 }
             }
         });
@@ -156,21 +155,21 @@ export class SZoneItem extends SGraphAreaGroupItem {
      *
      * */
     setStyle(): string {
-        let status = "Default";
+        let status = "default";
         if (this.style) {
             if (!this.selectable) {
-                status = "Unselect";
+                status = "unselect";
             } else {
                 if (this.selected) {
-                    status = "Selected";
+                    status = "selected";
                 } else if (this.highLightFlag) {
-                    status = "Highlight";
+                    status = "highlight";
                 } else if (this.isInfected) {
-                    status = "Infected";
+                    status = "infected";
                 } else {
-                    status = "Default";
+                    status = "default";
                     if (this.data.Color) {
-                        this.style.Default.Fill = `${this.data.Color}${
+                        this.style.default.fill = `${this.data.Color}${
                             Transparency[this.transparency]
                         }`;
                     }

+ 35 - 0
persagy-web-big/src/types/BigPoint.ts

@@ -0,0 +1,35 @@
+/*
+ * *********************************************************************************************************************
+ *
+ *          !!
+ *        .F88X
+ *        X8888Y
+ *      .}888888N;
+ *        i888888N;        .:!              .I$WI:
+ *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
+ *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
+ *            +888888N;  .8888888Y                                  "&&8Y.}8,
+ *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
+ *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
+ *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
+ *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
+ *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
+ *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
+ *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
+ *      .:R888888I
+ *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
+ *        ~8888'
+ *        .!88~                                                                     All rights reserved.
+ *
+ * *********************************************************************************************************************
+ */
+/**
+ * 轮廓坐标接口
+ *
+ * @author  郝建龙
+ */
+export interface BigPoint {
+    X: number;
+    Y: number;
+    Z?: number;
+} // Interface BigPoint

+ 7 - 7
persagy-web-big/src/types/ImageData.ts

@@ -31,17 +31,17 @@
  */
 export interface ImageData {
     /** 图片的id */
-    Id?: string;
+    id?: string;
     /** 图片的名称 */
-    Name?: string;
+    name?: string;
     /** X坐标 */
-    X: number;
+    x: number;
     /** Y坐标 */
-    Y: number;
+    y: number;
     /** 图片url */
-    Url: string;
+    url: string;
     /** 绘制图片的宽 */
-    Width: number;
+    width: number;
     /** 绘制图片的高 */
-    Height: number;
+    height: number;
 } // Interface ImageData

+ 4 - 4
persagy-web-big/src/types/Marker.ts

@@ -31,11 +31,11 @@
  */
 export interface Marker {
     /** 标记的id */
-    Id?: string;
+    id?: string;
     /** 标记的名称 */
-    Name?: string;
+    name?: string;
     /** X坐标 */
-    X: number;
+    x: number;
     /** Y坐标 */
-    Y: number;
+    y: number;
 } // Interface Marker

+ 2 - 2
persagy-web-big/src/types/Place.ts

@@ -24,7 +24,7 @@
  * *********************************************************************************************************************
  */
 
-import { Point } from "@persagy-web/graph";
+import { BigPoint } from "./BigPoint";
 
 /**
  * 位置接口
@@ -32,6 +32,6 @@ import { Point } from "@persagy-web/graph";
  * @author  郝建龙
  */
 export interface Place {
-    Points: Point[];
+    Points: BigPoint[];
     Type: string;
 } // Interface Place

+ 9 - 9
persagy-web-big/src/types/TextData.ts

@@ -33,21 +33,21 @@ import { STextAlign, STextBaseLine, STextDirection } from "@persagy-web/draw";
  */
 export interface TextData {
     /** 文本的id */
-    Id?: string;
+    id?: string;
     /** 文本内容 */
-    Text: string;
+    text: string;
     /** X坐标 */
-    X: number;
+    x: number;
     /** Y坐标 */
-    Y: number;
+    y: number;
     /** 文本最大宽 */
-    Width?: number;
+    width?: number;
     /** 文本对齐方向 */
-    TextAlign?: STextAlign;
+    textAlign?: STextAlign;
     /** 文本基线对齐 */
-    BaseLine?: STextBaseLine;
+    baseLine?: STextBaseLine;
     /** 文本方向 */
-    TextDirection?: STextDirection;
+    textDirection?: STextDirection;
     /** 文本大小 */
-    Size?: number;
+    size?: number;
 } // Interface TextData

+ 2 - 1
persagy-web-big/src/types/floor/Casement.ts

@@ -26,6 +26,7 @@
 
 import { Place } from "../Place";
 import { Point } from "@persagy-web/graph";
+import { BigPoint } from "../BigPoint";
 
 /**
  * 窗户item接口
@@ -40,7 +41,7 @@ export interface Casement {
     /** 名称 */
     Name: string;
     /** 轮廓线 */
-    OutLine: Point[][];
+    OutLine: BigPoint[][];
     /** 拥有者的RevitId */
     Owner: string;
     /** 对应Revit模型id */

+ 2 - 1
persagy-web-big/src/types/floor/Column.ts

@@ -26,6 +26,7 @@
 
 import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
+import { BigPoint } from "../BigPoint";
 
 /**
  * 柱子item接口
@@ -36,7 +37,7 @@ export interface Column {
     /** 名称 */
     Name?: string;
     /** 轮廓线 */
-    OutLine: Point[][];
+    OutLine: BigPoint[][];
     /** 房间边界 */
     RoomBoundary?: boolean;
     /** 位置 */

+ 4 - 3
persagy-web-big/src/types/floor/Door.ts

@@ -26,6 +26,7 @@
 
 import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
+import { BigPoint } from "../BigPoint";
 
 /**
  * 门item接口
@@ -34,9 +35,9 @@ import { Place } from "../Place";
  */
 export interface Door {
     /** 面朝方向 */
-    FaceDirection: Point;
+    FaceDirection: BigPoint;
     /** 把手方向 */
-    HandDirection: Point;
+    HandDirection: BigPoint;
     /** 位置 */
     Location: Place;
     /** 模型id(外键) */
@@ -44,7 +45,7 @@ export interface Door {
     /** 名称 */
     Name: string;
     /** 轮廓线 */
-    OutLine: Point[][];
+    OutLine: BigPoint[][];
     /** 拥有者的RevitId */
     Owner: string;
     /** 对应Revit模型id */

+ 2 - 1
persagy-web-big/src/types/floor/Space.ts

@@ -26,6 +26,7 @@
 
 import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
+import { BigPoint } from "../BigPoint";
 
 /**
  * 空间item接口
@@ -44,7 +45,7 @@ export interface Space {
     /** 名称 */
     Name?: string;
     /** 轮廓线 */
-    OutLine: Point[][];
+    OutLine: BigPoint[][];
     /** 对应Revit模型id */
     SourceId?: string;
     /** 补充信息 */

+ 2 - 1
persagy-web-big/src/types/floor/VirtualWall.ts

@@ -26,6 +26,7 @@
 
 import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
+import { BigPoint } from "../BigPoint";
 
 /**
  * 虚拟墙item接口
@@ -40,7 +41,7 @@ export interface VirtualWall {
     /** 名称 */
     Name?: string;
     /** 轮廓线 */
-    OutLine: Point[][];
+    OutLine: BigPoint[][];
     /** 对应Revit模型id */
     SourceId?: string;
 } // interface VirtualWall

+ 3 - 2
persagy-web-big/src/types/floor/Wall.ts

@@ -26,6 +26,7 @@
 
 import { Point } from "@persagy-web/graph";
 import { Place } from "../Place";
+import { BigPoint } from "../BigPoint";
 
 /**
  * 墙item接口
@@ -42,9 +43,9 @@ export interface Wall {
     /** 名称 */
     Name?: string;
     /** 轮廓线 */
-    OutLine: Point[][];
+    OutLine: BigPoint[][];
     /** 轮廓线 */
-    Holes?: Point[][];
+    Holes?: BigPoint[][];
     /** 对应Revit模型id */
     SourceId?: string;
     /** 厚度 */

+ 2 - 1
persagy-web-big/src/types/floor/Zone.ts

@@ -25,6 +25,7 @@
  */
 
 import { Point } from "@persagy-web/graph";
+import { BigPoint } from "../BigPoint";
 
 /**
  * 业务空间item接口
@@ -35,7 +36,7 @@ export interface Zone {
     /** 名称 */
     RoomLocalName: string;
     /** 轮廓线 */
-    OutLine: Point[][][];
+    OutLine: BigPoint[][][];
     /** 业务空间id */
     RoomID: string;
     /** 颜色 */

+ 2 - 2
persagy-web-big/src/types/topology/Anchor.ts

@@ -31,7 +31,7 @@ import { Point } from "@persagy-web/graph/lib";
  * */
 export interface Anchor {
     /** ID */
-    ID: string;
+    id: string;
     /** 位置 */
-    Pos: Point;
+    pos: Point;
 } // interface Anchor

+ 8 - 8
persagy-web-big/src/types/topology/MarkerTopo.ts

@@ -33,19 +33,19 @@ import { Size } from "../Size";
  * */
 export interface MarkerTopo {
     /** ID */
-    ID: string;
+    id: string;
     /** 名称 */
-    Name: string;
+    name: string;
     /** 类型 */
-    Type: string;
+    type: string;
     /** 位置 */
-    Pos: Point;
+    pos: Point;
     /** 缩放 */
-    Scale: Point;
+    scale: Point;
     /** 旋转 */
-    Rotate: Point;
+    rotate: Point;
     /** 大小 */
-    Size: Size;
+    size: Size;
     /** 由应用自己定义 */
-    Properties: any;
+    properties: any;
 } // interface MarkerTo

+ 13 - 13
persagy-web-big/src/types/topology/Node.ts

@@ -33,29 +33,29 @@ import { Anchor } from "./Anchor";
  * */
 export interface Node {
     /** ID */
-    ID: string;
+    id: string;
     /** 名称 */
-    Name: string;
+    name: string;
     /** 图例类型 */
-    GraphElementType: string;
+    graphElementType: string;
     /** 对应的图元ID */
-    GraphElementId: string;
+    graphElementId: string;
     /** 图例数量 */
-    Num: number;
+    num: number;
     /** 节点类型 */
-    Type: string;
+    type: string;
     /** 位置 */
-    Pos: Point;
+    pos: Point;
     /** 缩放 */
-    Scale: Point;
+    scale: Point;
     /** 旋转 */
-    Rotate: Point;
+    rotate: Point;
     /** 大小 */
-    Size: Size;
+    size: Size;
     /** 锚点 */
-    AnchorList: Anchor[];
+    anchorList: Anchor[];
     /** 轮廓线 */
-    OutLine: Point[][];
+    outLine: Point[][];
     /** 由应用自己定义 */
-    Properties: any;
+    properties: any;
 } // interface Node

+ 11 - 11
persagy-web-big/src/types/topology/Relation.ts

@@ -32,25 +32,25 @@ import { Point } from "@persagy-web/graph/lib";
  * */
 export interface Relation {
     /** ID */
-    ID: string;
+    id: string;
     /** 名称 */
-    Name: string;
+    name: string;
     /** 对应的图元ID */
-    GraphElementId: string;
+    graphElementId: string;
     /** 关联节点1_id */
-    Node1ID: string;
+    node1Id: string;
     /** 关联节点2_id */
-    Node2ID: string;
+    node2Id: string;
     /** 关联锚点1_id */
-    Anchor1ID: string;
+    anchor1Id: string;
     /** 关联锚点2_id */
-    Anchor2ID: string;
+    anchor2ID: string;
     /** 方向 */
-    Dir: SRelationDir;
+    dir: SRelationDir;
     /** 直线(Line),水平垂直 */
-    LineType: string;
+    lineType: string;
     /** 线的顶点坐标 */
-    PointList: Point[];
+    pointList: Point[];
     /** 线的绘图样式 */
-    Style: any;
+    style: any;
 } // interface Relation

+ 35 - 7
persagy-web-big/src/utils/SMathUtil.ts

@@ -63,11 +63,26 @@ export class SMathUtil {
             return null;
         }
         let minDis = {
-            MinDis: SMathUtil.pointDistance(p.x, p.y, arr[0].X, -arr[0].Y),
+            // @ts-ignore
+            MinDis: SMathUtil.pointDistance(
+                p.x,
+                p.y,
+                // @ts-ignore
+                arr[0].X || arr[0].x,
+                // @ts-ignore
+                -arr[0].Y || -arr[0].y
+            ),
             Point: arr[0]
         };
         for (let i = 1; i < arr.length; i++) {
-            let ds = SMathUtil.pointDistance(p.x, p.y, arr[i].X, -arr[i].Y);
+            let ds = SMathUtil.pointDistance(
+                p.x,
+                p.y,
+                // @ts-ignore
+                arr[i].X || arr[i].x,
+                // @ts-ignore
+                -arr[i].Y || -arr[i].y
+            );
             if (ds < minDis.MinDis) {
                 minDis.MinDis = ds;
                 minDis.Point = arr[i];
@@ -140,16 +155,29 @@ export class SMathUtil {
         let PTL = SMathUtil.pointToLine(
             p,
             new SLine(
-                arr[arr.length - 1].X,
-                -arr[arr.length - 1].Y,
-                arr[0].X,
-                -arr[0].Y
+                // @ts-ignore
+                arr[arr.length - 1].X || arr[arr.length - 1].x,
+                // @ts-ignore
+                -arr[arr.length - 1].Y || -arr[arr.length - 1].y,
+                // @ts-ignore
+                arr[0].X || arr[0].x,
+                // @ts-ignore
+                -arr[0].Y || -arr[0].y
             )
         );
         for (let i = 0; i < arr.length - 1; i++) {
             let temp = SMathUtil.pointToLine(
                 p,
-                new SLine(arr[i].X, -arr[i].Y, arr[i + 1].X, -arr[i + 1].Y)
+                new SLine(
+                    // @ts-ignore
+                    arr[i].X || arr[i].x,
+                    // @ts-ignore
+                    -arr[i].Y || -arr[i].y,
+                    // @ts-ignore
+                    arr[i + 1].X || arr[i + 1].x,
+                    // @ts-ignore
+                    -arr[i + 1].Y || -arr[i + 1].y
+                )
             );
             if (temp.MinDis < PTL.MinDis) {
                 PTL = temp;

+ 3 - 3
persagy-web-draw/src/SColor.ts

@@ -154,7 +154,7 @@ export class SColor {
      * @param   r       红色分量
      * @param   g       绿色分量
      * @param   b       蓝色分量
-     * @param   a       透明度分量
+     * @param   a       透明度分量0-255
      */
     constructor(r: number, g: number, b: number, a: number);
 
@@ -178,7 +178,7 @@ export class SColor {
      * @param   r       红色分量 | 字符串描述颜色 | 颜色
      * @param   g       绿色分量
      * @param   b       蓝色分量
-     * @param   a       透明度分量
+     * @param   a       透明度分量0-255
      */
     constructor(
         r?: number | string | SColor,
@@ -220,7 +220,7 @@ export class SColor {
      * @param   r       红色分量
      * @param   g       绿色分量
      * @param   b       蓝色分量
-     * @param   a       透明度分量
+     * @param   a       透明度分量0-255
      */
     private setRgba(r: number, g: number, b: number, a: number): void {
         this._value =

+ 1 - 1
persagy-web-graph/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@persagy-web/graph",
-    "version": "2.2.15",
+    "version": "2.2.18",
     "description": "博锐尚格二维图形引擎。",
     "main": "lib/index.js",
     "types": "lib/index.d.js",

+ 6 - 0
persagy-web-graph/src/SGraphItem.ts

@@ -182,6 +182,12 @@ export class SGraphItem extends SObject {
         this.update();
     } // Set selected
 
+    /** 是否可修改大小 */
+    _resizeable: boolean = true;
+
+    /** 选中时是否显示选择器 */
+    showSelect: boolean = true;
+
     /** 是否进行变形 */
     isTransform = true;
 

+ 60 - 26
persagy-web-graph/src/SGraphSelectContainer.ts

@@ -80,6 +80,25 @@ export class SGraphSelectContainer extends SGraphItem {
     minHeight: number = 0;
     /** 最小高 */
     maxHeight: number = Number.MAX_SAFE_INTEGER;
+    /** 边框颜色 */
+    _strokeColor: SColor = new SColor("#82C7FC");
+    /**  画笔颜色 */
+    get strokeColor(): SColor {
+        return this._strokeColor;
+    } // Get strokeColor
+    set strokeColor(v: SColor) {
+        this._strokeColor = v;
+        this.update();
+    } // Set strokeColor
+    /** 填充颜色 */
+    _fillColor: SColor = new SColor("#ffffff");
+    get fillColor(): SColor {
+        return this._fillColor;
+    } // Get fillColor
+    set fillColor(v: SColor) {
+        this._fillColor = v;
+        this.update();
+    } // Set fillColor
     /** 绘制矩形的圆角半径 */
     /** 统计选中item的数量 */
     get count(): number {
@@ -146,7 +165,7 @@ export class SGraphSelectContainer extends SGraphItem {
         }
         item.selected = true;
         this.itemList.push(item);
-        this.throttle(this.selectChange, 100);
+        this.throttle(this.selectChange, 80);
     } // Function addItem()
 
     /**
@@ -161,7 +180,7 @@ export class SGraphSelectContainer extends SGraphItem {
         this.itemList.length = 0;
         item.selected = true;
         this.itemList.push(item);
-        this.throttle(this.selectChange, 200);
+        this.throttle(this.selectChange, 80);
     } // Function setItem()
 
     /**
@@ -173,7 +192,7 @@ export class SGraphSelectContainer extends SGraphItem {
             t.selected = false;
         });
         this.itemList.length = 0;
-        this.throttle(this.selectChange, 200);
+        this.throttle(this.selectChange, 80);
     } // Function clear()
 
     /**
@@ -186,7 +205,7 @@ export class SGraphSelectContainer extends SGraphItem {
             if (this.itemList[i] == item) {
                 this.itemList[i].selected = false;
                 this.itemList.splice(i, 1);
-                this.throttle(this.selectChange, 200);
+                this.throttle(this.selectChange, 80);
                 return;
             }
         }
@@ -198,7 +217,7 @@ export class SGraphSelectContainer extends SGraphItem {
         }
         item.selected = true;
         this.itemList.push(item);
-        this.throttle(this.selectChange, 200);
+        this.throttle(this.selectChange, 80);
     } // Function toggleItem()
 
     /**
@@ -698,7 +717,12 @@ export class SGraphSelectContainer extends SGraphItem {
             this.getSize();
             // 计算边界8个点
             this.calExtreme();
-            this.visible = true;
+            if (
+                this.count > 1 ||
+                (this.count == 1 && this.itemList[0].showSelect)
+            ) {
+                this.visible = true;
+            }
         } else {
             this.visible = false;
             this.curIndex = -1;
@@ -838,7 +862,11 @@ export class SGraphSelectContainer extends SGraphItem {
      */
     onMouseMove(event: SMouseEvent): boolean {
         this.setCursor(9);
-        if (this.curIndex > -1 && this.count == 1) {
+        if (
+            this.curIndex > -1 &&
+            this.count == 1 &&
+            this.itemList[0]._resizeable
+        ) {
             this.setCursor(this.curIndex);
             // @ts-ignore
             const difX = event.x - this.curPoint.x;
@@ -980,24 +1008,30 @@ export class SGraphSelectContainer extends SGraphItem {
     onDraw(painter: SPainter): void {
         // 缓存场景长度
         this.sceneDis = painter.toPx(this.dis);
-        painter.pen.lineWidth = painter.toPx(1);
-        painter.pen.color = SColor.White;
-        painter.brush.color = SColor.Transparent;
-        painter.drawRect(0, 0, this.width, this.height);
-
-        painter.pen.color = SColor.Black;
-        painter.pen.lineDash = [painter.toPx(4), painter.toPx(4)];
-        painter.drawRect(0, 0, this.width, this.height);
-
-        const r = painter.toPx(this.radius);
-        painter.pen.lineDash = [];
-        this.pointList.forEach((t, i) => {
-            if (i == this.curIndex) {
-                painter.brush.color = new SColor("#409eff");
-            } else {
-                painter.brush.color = SColor.White;
-            }
-            painter.drawCircle(t.x, t.y, r);
-        });
+        // 多选时 或者 只选择一个并且是需要显示选择器时 绘制
+        if (
+            this.count > 1 ||
+            (this.count == 1 && this.itemList[0].showSelect)
+        ) {
+            painter.pen.lineWidth = painter.toPx(1);
+            painter.pen.color = SColor.White;
+            painter.brush.color = SColor.Transparent;
+            painter.drawRect(0, 0, this.width, this.height);
+
+            painter.pen.color = this.strokeColor;
+            painter.pen.lineDash = [painter.toPx(4), painter.toPx(4)];
+            painter.drawRect(0, 0, this.width, this.height);
+
+            const r = painter.toPx(this.radius);
+            painter.pen.lineDash = [];
+            this.pointList.forEach((t, i) => {
+                if (i == this.curIndex) {
+                    painter.brush.color = this.fillColor;
+                } else {
+                    painter.brush.color = SColor.White;
+                }
+                painter.drawCircle(t.x, t.y, r);
+            });
+        }
     } // Function onDraw()
 } // Class SGraphSelectContainer

+ 7 - 7
persagy-web-graph/src/items/SGraphAreaGroupItem.ts

@@ -61,12 +61,12 @@ export class SGraphAreaGroupItem extends SGraphShape {
      * @param   data    轮廓线及风格数据
      * */
     constructor(parent: SGraphItem | null, data: AreaGroup) {
-        super(parent, data.Style);
-        if (data.Outline.length && data.Outline[0] && data.Outline[0].length) {
-            let tempArr = data.Outline;
-            this.minX = tempArr[0][0][0].X;
+        super(parent, data.style);
+        if (data.outline.length && data.outline[0] && data.outline[0].length) {
+            let tempArr = data.outline;
+            this.minX = tempArr[0][0][0].x;
             this.maxX = this.minX;
-            this.minY = tempArr[0][0][0].Y;
+            this.minY = tempArr[0][0][0].y;
             this.maxY = this.minY;
             // 处理轮廓点数组,同时计算最大最小值
             this.pointList = tempArr.map((t): SPoint[][] => {
@@ -74,8 +74,8 @@ export class SGraphAreaGroupItem extends SGraphShape {
                 let tempArr = t.map((it): SPoint[] => {
                     let array = it.map(
                         (item): SPoint => {
-                            let x = item.X,
-                                y = item.Y;
+                            let x = item.x,
+                                y = item.y;
                             if (x < this.minX) {
                                 this.minX = x;
                             }

+ 7 - 7
persagy-web-graph/src/items/SGraphPolyGroupItem.ts

@@ -53,17 +53,17 @@ export class SGraphPolyGroupItem extends SGraphShape {
      * @param   data    轮廓线及风格数据
      * */
     constructor(parent: SGraphItem | null, data: PolyGroup) {
-        super(parent, data.Style);
-        if (data.Outline.length && data.Outline[0] && data.Outline[0].length) {
-            this.minX = data.Outline[0][0].X;
+        super(parent, data.style);
+        if (data.outline.length && data.outline[0] && data.outline[0].length) {
+            this.minX = data.outline[0][0].x;
             this.maxX = this.minX;
-            this.minY = data.Outline[0][0].Y;
+            this.minY = data.outline[0][0].y;
             this.maxY = this.minY;
-            this.pointList = data.Outline.map((t): SPoint[] => {
+            this.pointList = data.outline.map((t): SPoint[] => {
                 return t.map(
                     (it): SPoint => {
-                        let x = it.X,
-                            y = it.Y;
+                        let x = it.x,
+                            y = it.y;
                         if (x < this.minX) {
                             this.minX = x;
                         }

+ 6 - 6
persagy-web-graph/src/items/SGraphRectItem.ts

@@ -79,12 +79,12 @@ export class SGraphRectItem extends SGraphShape {
      * @param data      矩形数据
      */
     constructor(parent: SGraphItem | null, data: SGraphRect) {
-        super(parent, data.Style);
-        this.width = data.Width;
-        this.height = data.Height;
-        this.moveTo(data.X, data.Y);
-        if (data.Radius && !isNaN(data.Radius)) {
-            this.radius = Number(data.Radius);
+        super(parent, data.style);
+        this.width = data.width;
+        this.height = data.height;
+        this.moveTo(data.x, data.y);
+        if (data.radius && !isNaN(data.radius)) {
+            this.radius = Number(data.radius);
         }
     } // Constructor
 

+ 7 - 7
persagy-web-graph/src/items/SGraphShape.ts

@@ -59,14 +59,14 @@ export class SGraphShape extends SGraphItem {
      *
      * */
     setStyle(): string {
-        let status = "Default";
+        let status = "default";
         if (this.style) {
             if (this.enabled) {
                 if (this.selected) {
-                    status = "Selected";
+                    status = "selected";
                 }
             } else {
-                status = "Disabled";
+                status = "disabled";
             }
         }
         return status;
@@ -127,14 +127,14 @@ export class SGraphShape extends SGraphItem {
     onDraw(painter: SPainter): void {
         const status = this.setStyle();
         if (this.style && this.style[status]) {
-            const grad = this.parseFill(this.style[status].Fill);
+            const grad = this.parseFill(this.style[status].fill);
             if (grad) {
                 painter.brush.gradient = grad;
             } else {
-                painter.brush.color = new SColor(this.style[status].Fill);
+                painter.brush.color = new SColor(this.style[status].fill);
             }
-            painter.pen.color = new SColor(this.style[status].Stroke);
-            painter.pen.lineWidth = this.style[status].LineWidth;
+            painter.pen.color = new SColor(this.style[status].stroke);
+            painter.pen.lineWidth = this.style[status].lineWidth;
         } else {
             painter.brush.color = SColor.White;
         }

+ 5 - 0
persagy-web-graph/src/items/SGraphSvgItem.ts

@@ -80,6 +80,11 @@ export class SGraphSvgItem extends SGraphShape {
         this.update();
     } // Set height
 
+    /** img宽 */
+    private imgWidth: number = 0;
+    /** img高 */
+    private imgHeight: number = 0;
+
     /**
      * 构造函数
      *

+ 2 - 2
persagy-web-graph/src/types/AreaGroup.ts

@@ -32,7 +32,7 @@ import { Style } from "./Style";
  * */
 export interface AreaGroup {
     /** 轮廓线集合 */
-    Outline: Point[][][];
+    outline: Point[][][];
     /** Item 风格 */
-    Style?: Style;
+    style?: Style;
 } // Interface AreaGroup

+ 3 - 3
persagy-web-graph/src/types/Point.ts

@@ -29,7 +29,7 @@
  * @author  郝建龙
  */
 export interface Point {
-    X: number;
-    Y: number;
-    Z?: number;
+    x: number;
+    y: number;
+    z?: number;
 } // Interface Point

+ 2 - 2
persagy-web-graph/src/types/PolyGroup.ts

@@ -32,7 +32,7 @@ import { Style } from "./Style";
  * */
 export interface PolyGroup {
     /** 轮廓线集合 */
-    Outline: Point[][];
+    outline: Point[][];
     /** Item 风格 */
-    Style?: Style;
+    style?: Style;
 } // Interface PolyGroup

+ 6 - 6
persagy-web-graph/src/types/SGraphRect.ts

@@ -32,15 +32,15 @@ import { Style } from "./Style";
  * */
 export interface SGraphRect {
     /** item风格 */
-    Style?: Style;
+    style?: Style;
     /** 矩形左上角X坐标 */
-    X: number;
+    x: number;
     /** 矩形左上角Y坐标 */
-    Y: number;
+    y: number;
     /** 矩形宽 */
-    Width: number;
+    width: number;
     /** 矩形左上角X坐标 */
-    Height: number;
+    height: number;
     /** 当为圆角时的圆角半径 */
-    Radius?: number;
+    radius?: number;
 } // Interface SGraphRect

+ 4 - 4
persagy-web-graph/src/types/SGraphStyle.ts

@@ -31,11 +31,11 @@
  */
 export interface SGraphStyle {
     /** 边框颜色 */
-    Stroke: string;
+    stroke: string;
     /** 填充颜色 */
-    Fill: string;
+    fill: string;
     /** 线条宽度 */
-    LineWidth: number;
+    lineWidth: number;
     /** 特效 */
-    Effect: any;
+    effect: any;
 } // Interface SGraphStyle

+ 7 - 7
persagy-web-graph/src/types/SGraphSvg.ts

@@ -27,21 +27,21 @@
 import { Style } from "./Style";
 
 /**
- * 矩形(包含圆角矩形)数据类型
+ * svg数据类型
  *
  * @author 郝建龙
  * */
 export interface SGraphSvg {
     /** item风格 */
-    Style?: Style;
+    style?: Style;
     /** 矩形左上角X坐标 */
-    X: number;
+    x: number;
     /** 矩形左上角Y坐标 */
-    Y: number;
+    y: number;
     /** 矩形宽 */
-    Width: number;
+    width: number;
     /** 矩形左上角X坐标 */
-    Height: number;
+    height: number;
     /** 当为圆角时的圆角半径 */
-    Url: string;
+    url: string;
 } // Interface SGraphSvg