zhangyu пре 4 година
родитељ
комит
28acb99a8c

Разлика између датотеке није приказан због своје велике величине
+ 458 - 417
package-lock.json


+ 4 - 4
package.json

@@ -8,11 +8,11 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
-    "@saga-web/base": "2.1.19",
-    "@saga-web/big": "1.0.39",
-    "@saga-web/draw": "2.1.94",
+    "@saga-web/base": "2.1.20",
+    "@saga-web/big": "1.0.43",
+    "@saga-web/draw": "2.1.96",
     "@saga-web/feng-map": "1.0.11",
-    "@saga-web/graph": "2.1.82",
+    "@saga-web/graph": "2.1.86",
     "@saga-web/topology": "1.0.84",
     "ant-design-vue": "^1.6.0",
     "core-js": "^3.6.4",

+ 23 - 2
src/components/mapClass/SPolygonItem.ts

@@ -217,11 +217,21 @@ export class SPolygonItem extends SGraphItem {
      * @param pointList    绘制多边形数组
      */
     protected drawShowPolygon(painter: SPainter, pointList: SPoint[]): void {
+        painter.save();
         painter.pen.lineCapStyle = SLineCapStyle.Square;
         painter.pen.color = this._strokeColor;
         painter.pen.lineWidth = painter.toPx(this._lineWidth);
         painter.brush.color = this._fillColor;
+        if (this.selected) {
+            painter.shadow.shadowBlur = 10;
+            painter.shadow.shadowColor = new SColor(`#00000060`);
+            painter.shadow.shadowOffsetX = 5;
+            painter.shadow.shadowOffsetY = 5;
+        } else {
+            painter.shadow.shadowColor = SColor.Transparent;
+        }
         painter.drawPolygon([...pointList]);
+        painter.restore();
     }
 
 
@@ -240,10 +250,17 @@ export class SPolygonItem extends SGraphItem {
         }
         painter.drawPolyline(pointList);
         painter.pen.color = SColor.Transparent;
-        painter.brush.color = this._fillColor;
+        painter.brush.color = new SColor(this._fillColor.value + "80");
         painter.pen.lineWidth = painter.toPx(this._lineWidth);
+        
         if (this.lastPoint) {
             painter.drawPolygon([...pointList, this.lastPoint]);
+            // 绘制顶点块
+            painter.pen.color = SColor.Black;
+            painter.brush.color = SColor.White;
+            pointList.forEach((item, index) => {
+                painter.drawCircle(item.x, item.y, painter.toPx(this.len / 2))
+            });
         } else {
             painter.drawPolygon(pointList);
         }
@@ -259,7 +276,11 @@ export class SPolygonItem extends SGraphItem {
      */
     protected drawEditPolygon(painter: SPainter, pointList: SPoint[]): void {
         // 展示多边形
-        this.drawShowPolygon(painter, pointList);
+        painter.pen.lineCapStyle = SLineCapStyle.Square;
+        painter.pen.color = this._strokeColor;
+        painter.pen.lineWidth = painter.toPx(this._lineWidth);
+        painter.brush.color = new SColor(this._fillColor.value + "80");
+        painter.drawPolygon([...pointList]);
         // 绘制顶点块
         painter.pen.color = SColor.Black;
         painter.brush.color = SColor.White;

+ 0 - 13
src/lib/enums/SLineStyle.ts

@@ -1,13 +0,0 @@
-/**
- * 线样式
- *
- * @author  张宇
- */
-export enum SLineStyle {
-    /** 实线    */
-    Soild,
-    /** 虚线    */
-    Dashed,
-    /** 点线    */
-    Dotted
-} // Enum SLineStyle

+ 4 - 7
src/lib/items/SImageLegendItem.ts

@@ -3,19 +3,17 @@ import { SGraphItem } from "@saga-web/graph/lib";
 import { SIconTextItem } from '@saga-web/big/lib/items/SIconTextItem';
 import { Legend } from '../types/Legend';
 import { ItemOrder } from '@saga-web/big/lib';
-import { SImgTextItem } from './SImgTextItem';
 import { SFont } from '@saga-web/draw/lib';
 /**
  * 图例节点Item(图标类型)
  *
  * * @author  张宇(taohuzy@163.com)
  */
-// export class SImageLegendItem extends SIconTextItem {
-export class SImageLegendItem extends SImgTextItem {
+export class SImageLegendItem extends SIconTextItem {
     /** 图例节点对象数据 */
     data: Legend;
     /** 图例数量 */
-    _num: number = 0;
+    _num: number = 1;
     get num(): number {
         return this._num;
     }
@@ -28,11 +26,10 @@ export class SImageLegendItem extends SImgTextItem {
             this.data.Num = 1;
         }
         this.data.Properties.Num = this._num;
-        this.text = `${this.data.Num > 1?` × ${this.data.Num}`:''}`;
+        this.text = `${this.data.Name}${this.data.Num > 1?` × ${this.data.Num}`:''}`;
         this.update();
     }
 
-
     /**
      * 构造函数
      *
@@ -54,7 +51,7 @@ export class SImageLegendItem extends SImgTextItem {
             this.height = data.Size.Height;
         }
         if (data.Num) {
-            this.text = `${data.Num > 1?` × ${data.Num}`:''}`;
+            this.text = `${data.Name}${data.Num > 1?` × ${data.Num}`:''}`;
         }
         if (data.Properties && data.Properties.Url) {
             this.img.url = data.Properties.Url;

+ 1 - 1
src/lib/items/SImageMarkerItem.ts

@@ -1,5 +1,5 @@
 
-import { SGraphItem, SImageItem, SImageShowType } from "@saga-web/graph/lib";
+import { SGraphItem, SImageItem } from "@saga-web/graph/lib";
 import { SPainter } from "@saga-web/draw";
 import { Marker } from '../types/Marker';
 import { ItemOrder } from '@saga-web/big/lib';

+ 0 - 204
src/lib/items/SImgTextItem.ts

@@ -1,204 +0,0 @@
-import { SItemStatus } from "@saga-web/big/lib/enums/SItemStatus";
-import { SGraphItem } from '@saga-web/graph/lib/SGraphItem';
-import { STextBaseLine } from '@saga-web/draw/lib';
-import { SMouseEvent } from '@saga-web/base/lib/SMouseEvent';
-import { SSize, SFont } from '@saga-web/draw/lib';
-import { SPainter } from '@saga-web/draw/lib';
-import { SColor } from '@saga-web/draw/lib';
-import { SRect } from '@saga-web/draw/lib';
-import { SObjectItem, SImageItem, STextItem, SAnchorItem } from '@saga-web/graph/lib';
-
-/**
-     * 图例item  icon
-     *
-     * */
-export class SImgTextItem extends SObjectItem {
-
-  /** item状态  */
-  _status: SItemStatus = SItemStatus.Normal;
-  get status(): SItemStatus {
-    return this._status;
-  }
-  set status(v: SItemStatus) {
-    this._status = v;
-    this.update();
-  }
-
-  /** 是否显示文字  */
-  _showText: boolean = true;
-  get showText(): boolean {
-    return this._showText;
-  }
-  set showText(v: boolean) {
-    if (v === this._showText) {
-      return
-    }
-    this._showText = v;
-    if (v) {
-      this.textItem.show();
-    } else {
-      this.textItem.hide();
-    }
-  }
-
-  /** X轴坐标 */
-  get x(): number {
-    return this.pos.x;
-  } // Get x
-  set x(v: number) {
-    this.pos.x = v;
-    this.$emit("changePos");
-    this.update();
-  } // Set x
-  /** Y轴坐标 */
-  get y(): number {
-    return this.pos.y;
-  } // Get y
-  set y(v: number) {
-    this.pos.y = v;
-    this.$emit("changePos");
-    this.update();
-  } // Set y
-
-  /** icon宽 */
-  get sWidth(): number {
-    return this.img.width;
-  }
-  set sWidth(v: number) {
-    this.img.width = v
-    this.update();
-  }
-
-  /** icon宽 */
-  get sHeight(): number {
-    return this.img.height;
-  }
-  set sHeight(v: number) {
-    this.img.height = v
-    this.update();
-  }
-
-  /** 是否显示锚点  */
-  _showAnchor: boolean = false;
-  get showAnchor(): boolean {
-    return this._showAnchor;
-  }
-  set showAnchor(v: boolean) {
-    this._showAnchor = v;
-    this.anchorList.forEach(t => {
-      t.visible = v;
-    })
-  }
-
-  get text(): string {
-    return this.textItem.text;
-  }
-  set text(v: string) {
-    this.textItem.text = v;
-    this.update();
-  }
-  get color(): string {
-    return this.textItem.color;
-  }
-  set color(v: string) {
-    this.textItem.color = v;
-    this.update();
-  }
-  get font(): SFont {
-    return this.textItem.font;
-  }
-  set font(v: SFont) {
-    this.textItem.font = v;
-    this.update();
-  }
-  /** img Item    */
-  img: SImageItem = new SImageItem(this);
-
-  /** text item   */
-  textItem: STextItem = new STextItem(this);
-
-  /**
-   * 构造体
-   *
-   * */
-  constructor(parent: SGraphItem | null) {
-    super(parent);
-    this.img.url = `http://adm.sagacloud.cn:8080/doc/assets/img/logo.png`;
-    this.img.width = 32;
-    this.img.height = 32;
-    let anchorPoint = [{ x: 0, y: this.img.height / 2 }, { x: 0, y: -this.img.height / 2 }, { x: -this.img.width / 2, y: 0 }, { x: this.img.width / 2, y: 0 }];
-    this.anchorList = anchorPoint.map(t => {
-      let item = new SAnchorItem(this);
-      item.moveTo(t.x, t.y);
-      return item;
-    });
-    this.update();
-    this.textItem.text = "请填写文本";
-    this.textItem.moveTo(16, -6);
-    this.moveable = true;
-    this.selectable = true;
-    this.isTransform = false;
-    this.textItem.enabled = false;
-    this.img.enabled = false;
-  }
-
-  /**
-   * 鼠标按下事件
-   *
-   * */
-  onMouseDown(event: SMouseEvent): boolean {
-    console.log(this)
-    if (this.status == SItemStatus.Normal) {
-      return super.onMouseDown(event);
-    } else if (this.status == SItemStatus.Edit) {
-      return super.onMouseDown(event);
-    }
-    return true;
-  } // Function onMouseDown()
-
-  /**
-   * 宽高发发生变化
-   *
-   * @param   oldSize 改之前的大小
-   * @param   newSize 改之后大小
-   * */
-  onResize(oldSize: SSize, newSize: SSize) {
-    console.log(arguments);
-  } // Function onResize()
-
-  /**
-   * 鼠标双击事件
-   *
-   * @param   event   鼠标事件
-   * @return  是否处理事件
-   * */
-  onDoubleClick(event: SMouseEvent): boolean {
-    this.status = SItemStatus.Edit;
-    return true;
-  } // Function onDoubleClick()
-
-  /**
-   * 宽高发生变化
-   *
-   * @return  SRect   所有子对象的并集
-   * */
-  boundingRect(): SRect {
-    let rect = this.img.boundingRect().adjusted(this.img.pos.x, this.img.pos.y, 0, 0);
-    if (this.showText) {
-      rect = rect.unioned(this.textItem.boundingRect().adjusted(this.textItem.pos.x, this.textItem.pos.y, 0, 0))
-    }
-    return rect;
-  } // Function boundingRect()
-
-  /**
-   * Item绘制操作
-   *
-   * @param   painter painter对象
-   */
-  onDraw(painter: SPainter): void {
-    painter.pen.lineWidth = painter.toPx(1);
-    painter.pen.color = new SColor("#00FF00");
-    painter.brush.color = SColor.Transparent;
-    painter.drawRect(this.boundingRect());
-  } // Function onDraw()
-}

+ 1 - 1
src/lib/items/SLineMarkerItem.ts

@@ -1,7 +1,7 @@
 
 import { SGraphItem } from "@saga-web/graph/lib";
 import { SPoint } from "@saga-web/draw/lib";
-import { SLineItem, ItemOrder } from '@saga-web/big/lib';
+import { ItemOrder, SLineItem } from '@saga-web/big/lib';
 import { Marker } from '../types/Marker';
 
 /**

+ 15 - 4
src/lib/items/STextMarkerItem.ts

@@ -1,7 +1,6 @@
-import { SGraphItem, STextItem } from "@saga-web/graph/lib";
+import { SGraphItem, STextItem, SLineStyle } from "@saga-web/graph/lib";
 import { SPainter, SColor,SFont } from "@saga-web/draw";
 import { Marker } from '../types/Marker';
-import { SLineStyle } from '../enums/SLineStyle';
 import { ItemOrder } from '@saga-web/big/lib';
 
 /**
@@ -24,7 +23,7 @@ export class STextMarkerItem extends STextItem {
     }
 
     /** 边框样式    */
-    private _borderStyle: SLineStyle = SLineStyle.Soild;
+    private _borderStyle: SLineStyle = SLineStyle.None;
     get borderStyle(): SLineStyle {
         return this._borderStyle;
     }
@@ -82,17 +81,29 @@ export class STextMarkerItem extends STextItem {
         // 绘制文本
         painter.brush.color = new SColor(this.color);
         painter.font = this.font;
+        this.drawFormatText(painter);
+        if (this.selected) {
+            this.borderStyle = SLineStyle.Dashed;
+        } else {
+            this.borderStyle = SLineStyle.None;
+        }
         if (this.borderStyle == SLineStyle.Dashed) {
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth * 3),
                 painter.toPx(this.lineWidth * 7)
             ];
+            painter.brush.color = SColor.Transparent;
+            painter.drawRect(this.boundingRect());
         } else if (this.borderStyle == SLineStyle.Dotted) {
             painter.pen.lineDash = [
                 painter.toPx(this.lineWidth),
                 painter.toPx(this.lineWidth)
             ];
+            painter.brush.color = SColor.Transparent;
+            painter.drawRect(this.boundingRect());
+        } else if (this.borderStyle == SLineStyle.Soild) {
+            painter.brush.color = SColor.Transparent;
+            painter.drawRect(this.boundingRect());
         }
-        this.drawFormatText(painter);
     } // Function onDraw()
 } // Class STextMarkerItem

+ 6 - 11
src/lib/items/SZoneLegendItem.ts

@@ -1,11 +1,10 @@
 
 import { SGraphItem } from "@saga-web/graph/lib";
-import { SPolygonItem } from "@/components/mapClass/SPolygonItem";
 import { Legend } from '../types/Legend';
 import { SPainter, SColor, SFont, SPoint } from "@saga-web/draw";
 import { STextItem } from '@saga-web/graph/lib';
 import { hexify } from "@/components/mapClass/until"
-import { SItemStatus, ItemOrder } from '@saga-web/big/lib';
+import { SItemStatus, ItemOrder, SPolygonItem } from '@saga-web/big/lib';
 /**
  * 图例节点Item(区域类型)
  *
@@ -104,14 +103,10 @@ export class SZoneLegendItem extends SPolygonItem {
             this.setPointList = [];
             let setPointList: SPoint[];
             if (data.OutLine) {
-                if (data.OutLine[0] instanceof SPoint) {
-                    this.setPointList = data.OutLine;
-                } else {
-                    setPointList = data.OutLine.map(i => {
-                        return (new SPoint(i.X, i.Y))
-                    })
-                    this.setPointList = setPointList;
-                }
+                setPointList = data.OutLine.map(i => {
+                    return (new SPoint(i.X, i.Y))
+                })
+                this.setPointList = setPointList;
             }
             // 设置线宽
             if (data.Properties.LineWidth) {
@@ -151,7 +146,7 @@ export class SZoneLegendItem extends SPolygonItem {
 
     toData(): any {
         this.data.Pos = {X: this.x, Y: this.y};
-        this.data.Name = this.text;
+        this.data.Name = this.name;
         this.data.Properties.FillColor = this.fillColor.value;
         this.data.Properties.StrokeColor = this.strokeColor.value;
         this.data.Properties.LineWidth = this.lineWidth;