Преглед изворни кода

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

YaolongHan пре 4 година
родитељ
комит
d272d1d2b1

+ 4 - 5
src/components/mapClass/EditScence.ts

@@ -8,7 +8,7 @@ import { SImgTextItem } from "@/lib/items/SImgTextItem";
 import { SImageMarkerItem } from "@/lib/items/SImageMarkerItem"
 import { SPoint, SFont } from '@saga-web/draw/lib';
 import { Legend } from '@/lib/types/Legend';
-import { uuid } from "@/components/mapClass/until"
+import { uuid } from "@/components/mapClass/until";
 
 /**
  * 在线绘图
@@ -103,6 +103,7 @@ export class EditScence extends SGraphScene {
      * 增加线段item
      */
     addLine(event: SMouseEvent): boolean {
+
         const item = new SLineItem(null, new SPoint(event.x, event.y));
         item.status = SItemStatus.Create;
         item.zOrder = ItemOrder.lineOrder;
@@ -193,9 +194,9 @@ export class EditScence extends SGraphScene {
             /** 名称  */
             Name: '嗡嗡嗡',
             /** 图标(Image),线类型(Line) */
-            Type: 'Image',
+            Type: "Image",
             /** 位置  */
-            Pos: new SPoint(event.x, event.y),
+            Pos: {X: event.x, Y: event.y},
             /** 由应用自己定义  */
             Properties:{
                 Url:require('./../../assets/logo.png'),
@@ -204,11 +205,9 @@ export class EditScence extends SGraphScene {
         }
 
         const item = new SImageMarkerItem(null, data);
-        // item.url = url;
         item.zOrder = ItemOrder.imageOrder;
         item.selectable = true;
         item.moveable = true;
-        // item.moveTo(event.x, event.y);
         this.addItem(item);
         this.grabItem == null;
         this.focusItem = item;

+ 9 - 79
src/lib/items/SImageMarkerItem.ts

@@ -12,75 +12,6 @@ export class SImageMarkerItem extends SImageItem {
     /** 标识对象数据 */
     data: Marker;
 
-    /** x轴缩放属性 */
-    // _scaleX: number = 1;
-    // get scaleX(): number {
-    //     return this._scaleX;
-    // }
-    // set scaleX(v: number) {
-    //     this._scaleX = v;
-    //     if (this.data.Scale) {
-    //         this.data.Scale.X = v;
-    //     }
-    //     this.update();
-    // }
-
-    /** y轴缩放属性 */
-    // _scaleY: number = 1;
-    // get scaleY(): number {
-    //     return this._scaleY;
-    // }
-    // set scaleY(v: number) {
-    //     this._scaleY = v;
-    //     if (this.data.Scale) {
-    //         this.data.Scale.Y = v;
-    //     }
-    //     this.update();
-    // }
-
-    /** y轴旋转属性 */
-    // _rolate: number = 0;
-    // get rolate(): number {
-    //     return this._rolate;
-    // }
-    // set rolate(v: number) {
-    //     this._rolate = v;
-    //     if (this.data.Rolate) {
-    //         this.data.Rolate.Z = v;
-    //     }
-    //     this.update();
-    // }
-
-    // set name(v: string) {
-    //     this.data.Name = v;
-    // }
-
-    set url(v: string) {
-        if (this.data.Properties) {
-            this.data.Properties.Url = v;
-        }
-    }
-
-    set x(v: number) {
-        this.data.Pos.X = v;
-    }
-
-    set y(v: number) {
-        this.data.Pos.Y = v;
-    }
-
-    set width(v: number) {
-        if (this.data.Size) {
-            this.data.Size.Width = v;
-        }
-    }
-
-    set height(v: number) {
-        if (this.data.Size) {
-            this.data.Size.Height = v;
-        }
-    }
-
     /**
      * 构造函数
      *
@@ -91,22 +22,21 @@ export class SImageMarkerItem extends SImageItem {
         super(parent);
         this.data = data;
         this.id = data.ID;
+        this.name = data.Name;
         this.moveTo(data.Pos.X, data.Pos.Y);
-        // if (data.Scale) {
-        //     this.scaleX = data.Scale.X;
-        //     this.scaleY = data.Scale.Y;
-        // }
-        // if (data.Rolate && data.Rolate.Z) {
-        //     this.rolate = data.Rolate.Z;
-        // }
         if (data.Size) {
             this.width = data.Size.Width;
             this.height = data.Size.Height;
         }
         if (data.Properties && data.Properties.Url) {
-            if (data.Properties.Url instanceof String) {
-                this.url = data.Properties.Url;
-            }
+            this.url = data.Properties.Url;
         }
     } // Constructor
+
+    toData(): Marker {
+        this.data.Pos = {X: this.x, Y: this.y};
+        this.data.Size = {Width: this.width, Height: this.height};
+        this.data.Properties.Url = this.url;
+        return this.data;
+    }
 } // Class SImageMarkerItem

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

@@ -108,4 +108,5 @@ export class SLineMarkerItem extends SPolylineItem {
             this.line = data.Properties.Line;
         }
     } // Constructor
+    
 } // Class SLineMarkerItem

+ 1 - 2
src/lib/types/Legend.ts

@@ -31,7 +31,7 @@ import { Size } from "@saga-web/big/lib/types/Size";
  */
 export interface Legend {
     /** ID */
-    ID?: string;
+    ID: string;
     /** 名称  */
     Name: string;
     /** 返回工程信息化对象 ID 列表 */
@@ -56,5 +56,4 @@ export interface Legend {
     OutLine?: Point[][];
     /** 由应用自己定义  */
     Properties?: any;
-    Num?: Number
 } // Interface Legend

+ 1 - 1
src/lib/types/Marker.ts

@@ -31,7 +31,7 @@ import { Size } from "@saga-web/big/lib/types/Size";
  */
 export interface Marker {
     /** ID */
-    ID?: string;
+    ID: string;
     /** 名称  */
     Name: string;
     /** 图标(Image),线类型(Line) */