瀏覽代碼

feat edit编辑器场景态

YaolongHan 4 年之前
父節點
當前提交
f86d2acfd9

文件差異過大導致無法顯示
+ 12554 - 0
package-lock.json


+ 4 - 4
package.json

@@ -8,11 +8,11 @@
     "lint": "vue-cli-service lint"
   },
   "dependencies": {
-    "@saga-web/base": "2.1.9",
-    "@saga-web/big": "1.0.17",
+    "@saga-web/base": "2.1.14",
+    "@saga-web/big": "1.0.19",
     "@saga-web/draw": "2.1.84",
-    "@saga-web/graph": "2.1.66",
-    "@saga-web/feng-map": "1.0.6",
+    "@saga-web/graph": "2.1.68",
+    "@saga-web/feng-map": "1.0.7",
     "@saga-web/topology": "1.0.84",
     "ant-design-vue": "^1.6.0",
     "core-js": "^3.6.4",

+ 0 - 1
src/components/baseEditer.vue

@@ -45,7 +45,6 @@ export default {
         this.appName,
         null
       );
-      console.log(this.fmap);
       this.fmap.parseData("1001724_29", 6, res => {
         console.log(res);
         this.fParser = new SFloorParser(null);

+ 5 - 8
src/components/mapClass/SPolygonItem.ts

@@ -17,8 +17,7 @@
  *
  * ********************************************************************************************************************
  */
-
-import { SGraphItem, SGraphCommand } from "@saga-web/graph/";
+import { SGraphItem, SGraphPointListInsert, SGraphPointListDelete, SGraphPointListUpdate } from "@saga-web/graph/lib";
 import { SMouseEvent, SUndoStack } from "@saga-web/base/";;
 import {
     SColor,
@@ -32,8 +31,6 @@ import { PolygonData } from "./type/PolygonData";
 import { SRelationState } from "@saga-web/big/lib/enums/SRelationState"
 import { SMathUtil } from "@saga-web/big/lib/utils/SMathUtil";
 
-import { SPointListInsert, SPointListInDelete, SPointListUpdate } from "./command/index"
-
 /**
  * 编辑多边形
  *
@@ -311,7 +308,7 @@ export class SPolygonItem extends SGraphItem {
                 const delePoint = new SPoint(this.pointList[lenIndex].x, this.pointList[lenIndex].y)
                 this.deletePoint(lenIndex);
                 // 记录顶点操作记录压入堆栈
-                this.recordAction(SPointListInDelete, [this.pointList, delePoint,lenIndex]);
+                this.recordAction(SGraphPointListDelete, [this.pointList, delePoint,lenIndex]);
             }
         } else {
             // 1 判断是否点击在多边形顶点
@@ -362,7 +359,7 @@ export class SPolygonItem extends SGraphItem {
                     if (len.MinDis <= this.scenceLen) {
                         this.pointList.splice(index + 1, 0, len.Point);
                         // 记录新增顶点操作记录压入堆栈
-                        this.recordAction(SPointListInsert, [this.pointList, len.Point, index + 1])
+                        this.recordAction(SGraphPointListInsert, [this.pointList, len.Point, index + 1])
                     }
                 }
             } else {
@@ -498,7 +495,7 @@ export class SPolygonItem extends SGraphItem {
             this.insertPoint(event.x, event.y);
             // 记录新增顶点操作记录压入堆栈
             let pos = new SPoint(event.x, event.y);
-            this.recordAction(SPointListInsert, [this.pointList, pos])
+            this.recordAction(SGraphPointListInsert, [this.pointList, pos])
         } else if (this._status == SRelationState.Edit) {
             // 对多边形数组做编辑操作
             this.editPolygonPoint(event);
@@ -564,7 +561,7 @@ export class SPolygonItem extends SGraphItem {
         if (this._status == SRelationState.Edit) {
             if (-1 != this.curIndex) {
                 const pos = new SPoint(this.pointList[this.curIndex].x, this.pointList[this.curIndex].y)
-                this.recordAction(SPointListUpdate, [this.pointList, this.curPoint, pos, this.curIndex])
+                this.recordAction(SGraphPointListUpdate, [this.pointList, this.curPoint, pos, this.curIndex])
             }
             this.curIndex = -1;
             this.curPoint = null;

+ 0 - 82
src/components/mapClass/command/SPointListInDelete.ts

@@ -1,82 +0,0 @@
-/*
- * ********************************************************************************************************************
- *
- *                      :*$@@%$*:                         ;:                ;;    ;;
- *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
- *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
- *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
- *                   =@*                                  %!              @ $= % %@=   =%@!      %=
- *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
- *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
- *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
- *          $@*   ;@@@%=!:                *@*
- *          =@$    ;;;!=%@@@@=!           =@!
- *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
- *            ;%@@$=$@@%*       *@@@$=%@@%;
- *               ::;::             ::;::                                              All rights reserved.
- *
- * ********************************************************************************************************************
- */
-
-import { SPoint } from "@saga-web/draw/lib";
-import { SGraphItem, SGraphCommand } from "@saga-web/graph";
-
-/**
- * 多边形、折线等相关顶点的位置删除命令
- *
- * @author  韩耀龙
- */
-
-export class SPointListInDelete extends SGraphCommand {
-    /**  指向item对象 */
-    item: SGraphItem;
-    /** 索引 */
-    index: number | null;
-    /**  删除位置 */
-    pos: SPoint | null;
-    /** 顶点数组 */
-    pointList: SPoint[];
-
-    /**
-     * 构造函数
-     * @param   item        指向item对象
-     * @param   pointList   顶点数组
-     * @param   index       索引
-     */
-    constructor(item: SGraphItem, pointList: SPoint[], pos: SPoint, index: number | null = null) {
-        super(null);
-        this.item = item;
-        this.index = index;
-        this.pointList = pointList;
-        this.pos = pos
-
-    }
-    // mergeWith(command: SUndoCommand): boolean {
-    //     return false;
-    // }
-
-    /**
-     * 执行重做操作执行
-     */
-    redo(): void {
-        if (this.index == null) {
-            this.pointList.pop()
-        } else {
-            this.pointList.splice(this.index, 1);
-        }
-        this.item.update();
-    }
-
-    /**
-     * 执行取消操作执行
-     */
-    undo(): void {
-        if (this.pos == null) return;
-        if (this.index == null) {
-            this.pointList.push(this.pos)
-        } else {
-            this.pointList.splice(this.index, 0, this.pos);
-        }
-        this.item.update();
-    }
-}

+ 0 - 83
src/components/mapClass/command/SPointListInsert.ts

@@ -1,83 +0,0 @@
-/*
- * ********************************************************************************************************************
- *
- *                      :*$@@%$*:                         ;:                ;;    ;;
- *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
- *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
- *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
- *                   =@*                                  %!              @ $= % %@=   =%@!      %=
- *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
- *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
- *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
- *          $@*   ;@@@%=!:                *@*
- *          =@$    ;;;!=%@@@@=!           =@!
- *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
- *            ;%@@$=$@@%*       *@@@$=%@@%;
- *               ::;::             ::;::                                              All rights reserved.
- *
- * ********************************************************************************************************************
- */
-
-import { SPoint } from "@saga-web/draw/lib";
-import { SGraphItem,SGraphCommand} from "@saga-web/graph";
-
-
-/**
- * 多边形、折线等相关顶点的位置插入命令
- *
- * @author  韩耀龙
- */
-
-export class SPointListInsert extends SGraphCommand {
-    /**  指向item对象 */
-    item: SGraphItem;
-    /**  当前位置 */
-    pos: SPoint;
-    /** 索引 */
-    index: number | null;
-    /** 顶点数组 */
-    pointList: SPoint[];
-
-    /**
-     * 构造函数
-     * @param   item        指向item对象
-     * @param   pointList   顶点数组
-     * @param   pos         当前位置
-     * @param   index       索引
-     */
-    constructor(item: SGraphItem, pointList: SPoint[], pos: SPoint, index: number | null = null) {
-        super(null);
-        this.item = item;
-        this.pos = pos;
-        this.index = index;
-        this.pointList = pointList;
-    }
-    // mergeWith(command: SUndoCommand): boolean {
-    //     return false;
-    // }
-
-    /**
-     * 执行重做操作执行
-     */
-    redo(): void {
-        const point = new SPoint(this.pos.x, this.pos.y);
-        if (this.index == null) {
-            this.pointList.push(point)
-        } else {
-            this.pointList.splice(this.index, 0, point);
-        }
-        this.item.update();
-    }
-
-    /**
-     * 执行取消操作执行
-     */
-    undo(): void {
-        if (this.index == null) {
-            this.pointList.pop()
-        } else {
-            this.pointList.splice(this.index,1);
-        }
-        this.item.update();
-    }
-}

+ 0 - 80
src/components/mapClass/command/SPointListUpdate.ts

@@ -1,80 +0,0 @@
-/*
- * ********************************************************************************************************************
- *
- *                      :*$@@%$*:                         ;:                ;;    ;;
- *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
- *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
- *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
- *                   =@*                                  %!              @ $= % %@=   =%@!      %=
- *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
- *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
- *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
- *          $@*   ;@@@%=!:                *@*
- *          =@$    ;;;!=%@@@@=!           =@!
- *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
- *            ;%@@$=$@@%*       *@@@$=%@@%;
- *               ::;::             ::;::                                              All rights reserved.
- *
- * ********************************************************************************************************************
- */
-
-import { SGraphyCommand } from "@saga-web/graphy/lib";
-import { SPoint } from "@saga-web/draw/lib";
-import { SGraphItem, SGraphCommand } from "@saga-web/graph";
-
-/**
- * 多边形、折线等相关顶点的位置更新命令
- *
- * @author  韩耀龙
- */
-
-export class SPointListUpdate extends SGraphCommand {
-    /**  指向item对象 */
-    item: SGraphItem;
-    /**  原位置 */
-    old: SPoint;
-    /**  当前位置 */
-    pos: SPoint;
-    /** 索引 */
-    index: number;
-    /** 顶点数组 */
-    pointList: SPoint[];
-
-    /**
-     * 构造函数
-     * @param   item        指向item对象
-     * @param   pointList   顶点数组
-     * @param   old         原位置
-     * @param   pos         当前位置
-     * @param   index       索引
-     */
-    constructor(item: SGraphItem, pointList: SPoint[], old: SPoint, pos: SPoint, index: number) {
-        super(null);
-        this.item = item;
-        this.old = old;
-        this.pos = pos;
-        this.index = index;
-        this.pointList = pointList;
-    }
-    // mergeWith(command: SUndoCommand): boolean {
-    //     return false;
-    // }
-
-    /**
-     * 执行重做操作执行
-     */
-    redo(): void {
-        this.pointList[this.index].x = this.pos.x;
-        this.pointList[this.index].y = this.pos.y;
-        this.item.update();
-    }
-
-    /**
-     * 执行取消操作执行
-     */
-    undo(): void {
-        this.pointList[this.index].x = this.old.x;
-        this.pointList[this.index].y = this.old.y;
-        this.item.update();
-    }
-}

+ 0 - 6
src/components/mapClass/command/index.ts

@@ -1,6 +0,0 @@
-import { SPointListInsert } from "./SPointListInsert"
-import { SPointListInDelete } from "./SPointListInDelete"
-import { SPointListUpdate } from "./SPointListUpdate"
-export {
-    SPointListInsert, SPointListInDelete, SPointListUpdate
-}

+ 112 - 0
src/components/mapClass/editScence.ts

@@ -0,0 +1,112 @@
+import { SGraphyScene } from "@saga-web/graphy";
+import { SMouseEvent, SUndoStack } from "@saga-web/base";
+
+
+
+
+/**
+ * 在线绘图
+ *
+ * @author 韩耀龙
+ */
+
+export class editScence extends SGraphyScene {
+
+    undoStack = new SUndoStack();
+    // 状态 1处于选择状态 2 处于编辑状态
+    private status = 1;
+
+    constructor() {
+        super();
+    }
+
+    /**
+    * 选择空间状态
+    */
+    initStatus() {
+
+    }
+
+    /**
+     * 增加线段item
+     */
+    addLine() {
+
+    }
+
+    /**
+     * 增加多边形item
+     */
+    addPolygonItem() {
+
+    }
+
+    /**
+     * 增加textItem
+     */
+    addImgItem() {
+    }
+
+    /**
+     * 增加管道
+     */
+    addTextItem(): void {
+
+    }
+
+    /**
+     * 增加图标
+     */
+    addIconItem(): void {
+
+    }
+
+    /**
+     * 更改item对应属性
+     */
+    editItemStatus(): void {
+
+    }
+
+    /**
+    * 删除指定item
+    */
+    deleiteItemStatus(): void {
+
+    }
+
+    /**
+     * 对齐指定item
+     */
+    alignItem(type, itemList): void {
+    }
+
+    /**
+     * 提取item
+     */
+    extractItem(): void {
+    }
+
+    /**
+     * 锁住item
+     */
+    lockItem(): void {
+    }
+
+
+    /**
+     * 执行取消操作
+     */
+    redo(): void {
+        this.undoStack.undo();
+
+    }
+
+    /**
+    * 执行重做操作执行
+    */
+    undo(): void {
+        this.undoStack.redo();
+    }
+
+}

+ 0 - 30
src/components/mapClass/type/Point.ts

@@ -1,30 +0,0 @@
-/*
- * ********************************************************************************************************************
- *
- *                      :*$@@%$*:                         ;:                ;;    ;;
- *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
- *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
- *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
- *                   =@*                                  %!              @ $= % %@=   =%@!      %=
- *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
- *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
- *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
- *          $@*   ;@@@%=!:                *@*
- *          =@$    ;;;!=%@@@@=!           =@!
- *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2020.  北京上格云技术有限公司
- *            ;%@@$=$@@%*       *@@@$=%@@%;
- *               ::;::             ::;::                                              All rights reserved.
- *
- * ********************************************************************************************************************
- */
-
-/**
- * Point接口
- *
- * @author  郝建龙
- */
-export interface Point {
-    X: number;
-    Y: number;
-    Z?: number;
-} // Interface Equip

+ 0 - 14
src/components/mapClass/type/PolygonData.ts

@@ -1,14 +0,0 @@
-
-import { Point } from "./Point";
-
-/**
- * 关系多边形传入参数接口
- *
- * @author  韩耀龙
- */
-export interface PolygonData {
-    /** id  */
-    ID?: string;
-    /** 多边形下顶点  */
-    PointList?: Point[];
-} // Interface Relation

+ 3 - 2
src/views/editer.vue

@@ -11,8 +11,8 @@
       </div>
       <!-- 绘制界面 -->
       <div class="baseEdit">
-        <!-- <baseEditer ref="graphy"></baseEditer> -->
-        <baseEditertest ref="graphy"></baseEditertest>
+        <baseEditer ref="graphy"></baseEditer>
+        <!-- <baseEditertest ref="graphy"></baseEditertest> -->
         <!-- <baseEditerzy ref="graphy"></baseEditerzy> -->
       </div>
       <!-- 右侧工具栏 -->
@@ -44,6 +44,7 @@ export default {
   methods: {
     // 左侧工具栏 点击事件
     toolActionClick(name) {
+      console.log(name)
       this.$refs.graphy.changeStatus(name);
     }
   }