Ver código fonte

折线item绘制增加选中状态;工厂类移除万达专用item创建

haojianlong 5 anos atrás
pai
commit
ae86705065

+ 0 - 82
saga-web-big/src/factories/SItemFactory.ts

@@ -15,16 +15,6 @@ import { Zone } from "../types/floor/Zone";
 import { Legend } from "../types/topology/Legend";
 import { Marker } from "../types/topology/Marker";
 import { Relation } from "../types/topology/Relation";
-import {
-    SVerticalRelation,
-    SNoneLegendItem,
-    SLineLegendItem,
-    SZoneLegendItem,
-    SImageLegendItem,
-    SImageMarkerItem,
-    SLineMarkerItem,
-    STextMarkerItem
-} from "..";
 
 /**
  * 拓扑图信息解析器
@@ -107,76 +97,4 @@ export class SItemFactory {
     createZone(data: Zone): SZoneItem {
         return new SZoneItem(null, data);
     } // Function createZone()
-
-    /**
-     * 创建图例节点item(非图例类型)
-     *
-     * @param   data    图例节点数据
-     * */
-    createNoneLegend(data: Legend): SNoneLegendItem {
-        return new SNoneLegendItem(null, data);
-    } // Function createNoneLegend()
-
-    /**
-     * 创建图例节点item(线类型)
-     *
-     * @param   data    图例节点数据
-     * */
-    createLineLegend(data: Legend): SLineLegendItem {
-        return new SLineLegendItem(null, data);
-    } // Function createLineLegend()
-
-    /**
-     * 创建图例节点item(区域类型)
-     *
-     * @param   data    图例节点数据
-     * */
-    createZoneLegend(data: Legend): SZoneLegendItem {
-        return new SZoneLegendItem(null, data);
-    } // Function createZoneLegend()
-
-    /**
-     * 创建图例节点item(图标类型)
-     *
-     * @param   data    图例节点数据
-     * */
-    createImageLegend(data: Legend): SImageLegendItem {
-        return new SImageLegendItem(null, data);
-    } // Function createImageLegend()
-
-    /**
-     * 创建标识item(图类型)
-     *
-     * @param   data    标识对象数据
-     * */
-    createImageMarker(data: Marker): SImageMarkerItem {
-        return new SImageMarkerItem(null, data);
-    } // Function createImageMarker()
-
-    /**
-     * 创建标识item(线类型)
-     *
-     * @param   data    标识对象数据
-     * */
-    createLineMarker(data: Marker): SLineMarkerItem {
-        return new SLineMarkerItem(null, data);
-    } // Function createLineMarker()
-
-    /**
-     * 创建标识item(文本类型)
-     *
-     * @param   data    标识对象数据
-     * */
-    createTextMarker(data: Marker): STextMarkerItem {
-        return new STextMarkerItem(null, data);
-    } // Function createTextMarker()
-
-    /**
-     * 创建管线关系item
-     *
-     * @param   data    管线关系对象数据
-     * */
-    createRelation(data: Relation): SVerticalRelation {
-        return new SVerticalRelation(null, data);
-    } // Function createRelation()
 } // class SItemFactory

+ 25 - 4
saga-web-big/src/items/SPolylineItem.ts

@@ -405,6 +405,15 @@ export class SPolylineItem extends SGraphItem {
     } // Function cancelOperate()
 
     /**
+     * 绘制基本图形
+     * */
+    drawBaseLine(painter: SPainter): void {
+        // 绘制基本图形
+        painter.pen.color = new SColor(this.strokeColor);
+        painter.drawPolyline(this.pointList);
+    } // Function drawBaseLine()
+
+    /**
      * Item绘制操作
      *
      * @param   painter painter对象
@@ -412,17 +421,18 @@ export class SPolylineItem extends SGraphItem {
     onDraw(painter: SPainter): void {
         // 缓存场景长度
         this.sceneDis = painter.toPx(this.dis);
-        // 绘制基本图形
-        painter.pen.lineWidth = painter.toPx(this.lineWidth);
-        painter.pen.color = new SColor(this.strokeColor);
-        painter.drawPolyline(this.pointList);
         // 创建状态
+        painter.pen.lineWidth = painter.toPx(this.lineWidth);
         if (this.status == SItemStatus.Create && this.lastPoint) {
+            // 绘制基本图形
+            this.drawBaseLine(painter);
             painter.drawLine(
                 this.pointList[this.pointList.length - 1],
                 this.lastPoint
             );
         } else if (this.status == SItemStatus.Edit) {
+            // 绘制基本图形
+            this.drawBaseLine(painter);
             // 编辑状态
             this.pointList.forEach((t, i): void => {
                 painter.brush.color = SColor.White;
@@ -431,6 +441,17 @@ export class SPolylineItem extends SGraphItem {
                 }
                 painter.drawCircle(t.x, t.y, painter.toPx(5));
             });
+        } else {
+            // 查看状态
+            if (this.selected) {
+                painter.pen.lineWidth = painter.toPx(this.lineWidth * 2);
+                painter.shadow.shadowBlur = 10;
+                painter.shadow.shadowColor = new SColor(`#00000060`);
+                painter.shadow.shadowOffsetX = 5;
+                painter.shadow.shadowOffsetY = 5;
+            }
+            // 绘制基本图形
+            this.drawBaseLine(painter);
         }
     } // Function onDraw()
 } // Class SPolylineItem