haojianlong пре 4 година
родитељ
комит
72c0860f30

+ 0 - 1
docs/.vuepress/components/scene/items/area.vue

@@ -30,7 +30,6 @@
             init(){
                 this.view = new SGraphView(this.id);
                 const scene = new SGraphScene();
-                console.log(this.outline[0][0])
                 const item = new SGraphAreaGroupItem(null, {OutLine: this.outline});
                 scene.addItem(item);
                 this.view.scene = scene;

+ 65 - 0
docs/.vuepress/components/scene/items/svg.vue

@@ -0,0 +1,65 @@
+<template>
+    <div>
+        <canvas :id="id" width="800px" height="400px"></canvas>
+    </div>
+</template>
+
+<script>
+    import {SGraphScene, SGraphShape, SGraphView} from "@persagy-web/graph/lib";
+    import {SRect} from "@persagy-web/draw/lib";
+
+    class SGraphSvgItem extends SGraphShape{
+
+        constructor(parent, data) {
+            super(parent, data.Style);
+            this.img = new Image();
+            this.img.src = data.Url;
+            this.img.onload = e => {
+                console.log(e);
+                console.log('---------------');
+                // this.width =
+                this.update()
+            };
+            this.img.onerror = err => {
+                console.log(err)
+            };
+        }
+
+        boundingRect() {
+            return new SRect(0,0,100,100)
+        }
+
+        onDraw(painter) {
+            painter.drawImage(this.img, 0, 0, 100, 100)
+        }
+    }
+
+    export default {
+        name: "svgCanvas",
+        data(){
+            return{
+                id: 'svg' + Date.now(),
+                view: '',
+            }
+        },
+        mounted() {
+            this.init()
+        },
+        methods:{
+            init(){
+                this.view = new SGraphView(this.id);
+                const scene = new SGraphScene();
+                this.view.scene = scene;
+                // https://desk-fd.zol-img.com.cn/t_s2560x1600c5/g6/M00/0B/0E/ChMkKV9N5U2IfX_aAA-zeHRQZW8AABvcADsv-0AD7OQ688.jpg
+                // https://cdn-img.easyicon.net/image/2019/panda-search.svg
+                const item = new SGraphSvgItem(null, { Url: 'https://cdn-img.easyicon.net/image/2019/panda-search.svg'});
+                scene.addItem(item);
+                this.view.fitSceneToView();
+            }
+        }
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 10 - 9
docs/guides/format/systemJson.md

@@ -23,13 +23,13 @@
             BuildingID: '',                     // 建筑ID
             FloorID: '',                        // 楼层id
             Note: '',                           // 图说明
-            Log: {                              //图操作日志
-                  Mark:'',                      //图的存盘标记
+            Log: {                              // 图操作日志
+                  Mark:'',                      // 图的存盘标记
                   CommandList:[
                    {
-                        Command: '',            //命令
-                        Desc: '',               //描述
-                        Detail: ''              //详情
+                        Command: '',            // 命令
+                        Desc: '',               // 描述
+                        Detail: ''              // 详情
                     }
                 ]
             }
@@ -50,7 +50,8 @@
             AttachObjectIds:[],                 // 返回工程信息化对象 ID 列表
             GraphElementType: '',               // 图例类型 None/Line/Zone/Image:非图例/线条/区域类型/图标
             GraphElementId: '',                 // 对应的图元ID
-            Num: 1                              //图例数量
+            Num: 1                              // 图例数量
+            Type: '',                           // 节点类型(image / zone)
             Pos: {X: 0, Y: 0},                  // 位置
             Scale: {X: 1, Y: 1, Z: 1},          // 缩放
             Rolate: {X: 0, Y: 0, Z: 0},         // 旋转
@@ -58,7 +59,7 @@
             AnchorList:[
                     {
                         ID: '',                 // 锚点ID
-                        Pos: '',                // 锚点的坐标
+                        Pos: {X: 0, Y: 0},      // 锚点的坐标
                     },
                     ...
                 ],
@@ -83,7 +84,7 @@
             Pos: {X: 0, y: 0},                  // 位置
             Scale: {X: 1, Y: 1, Z: 1},          // 缩放
             Rolate: {X: 0, Y: 0, Z: 0},         // 旋转
-            Size: {Width:0, Height: 0},         // 大小
+            Size: {Width: 0, Height: 0},        // 大小
             Properties: {}                      // 由应用自己定义
         },
         ...
@@ -105,7 +106,7 @@
             Dir: 0,                             // 方向(0:无向,1:节点1到节点2,2:节点2到节点1)
             LineType: '',                       // 直线(Line),水平垂直
             PointList: [],                      // 线的顶点坐标
-            Style: ''                           // 线的绘图样式
+            Style: {}                           // 线的绘图样式
         },
         ...
     ]

+ 1 - 0
docs/guides/scene/items/svg.md

@@ -4,3 +4,4 @@
 [[toc]]
 :::
 
+<scene-items-svg />