Browse Source

'健壮性修改'

zhangyu 4 years ago
parent
commit
5a720385dd
2 changed files with 36 additions and 36 deletions
  1. 36 34
      src/components/baseEditer.vue
  2. 0 2
      src/lib/items/SZoneLegendItem.ts

+ 36 - 34
src/components/baseEditer.vue

@@ -80,40 +80,42 @@ export default {
       });
       // 获取主题数据
       this.readGroup().then(data => {
-        const parserData = new STopologyParser(null);
-        parserData.parseData(data.data.Data[0].Elements);
-        // 多边形
-        parserData.zoneLegendList.forEach(t => {
-          this.scene.addItem(t);
-          this.scene.Nodes.push(t);
-        });
-        // 增加文字
-        parserData.textMarkerList.forEach(t => {
-          this.scene.addItem(t);
-          this.scene.Markers.push(t);
-        });
-        // 增加图片
-        parserData.imageMarkerList.forEach(t => {
-          this.scene.addItem(t);
-          this.scene.Markers.push(t);
-        });
-        // 增加直线
-        parserData.lineMarkerList.forEach(t => {
-          this.scene.addItem(t);
-          this.scene.Markers.push(t);
-        });
-        // 增加图标类图例
-        parserData.imageLegendList.forEach(t => {
-          this.scene.addItem(t);
-          this.scene.Nodes.push(t);
-        });
-        // 增加管线类
-        // 增加图标类图例
-        parserData.relationList.forEach(t => {
-          this.scene.addItem(t);
-          this.scene.Relations.push(t);
-        });
-        this.view.fitSceneToView();
+        if (data.data.Data) {
+          const parserData = new STopologyParser(null);
+          parserData.parseData(data.data.Data[0].Elements);
+          // 多边形
+          parserData.zoneLegendList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Nodes.push(t);
+          });
+          // 增加文字
+          parserData.textMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加图片
+          parserData.imageMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加直线
+          parserData.lineMarkerList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Markers.push(t);
+          });
+          // 增加图标类图例
+          parserData.imageLegendList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Nodes.push(t);
+          });
+          // 增加管线类
+          // 增加图标类图例
+          parserData.relationList.forEach(t => {
+            this.scene.addItem(t);
+            this.scene.Relations.push(t);
+          });
+          this.view.fitSceneToView();
+        }
       });
 
       this.scene.emitChange = this.emitChange;

+ 0 - 2
src/lib/items/SZoneLegendItem.ts

@@ -66,8 +66,6 @@ export class SZoneLegendItem extends SPolygonItem {
             this.textItem.moveable = false;
         }
         this.update();
-        console.log("多边形item", this);
-        console.log("文本item", this.textItem);
     };
 
     /** 是否显示文字  */