2023西安数博会CIM演示-【前端】-Web
AdaKing88
2023-08-21 bc03b832caa49bbcd2674fe4cae3701b5059bf95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<template>
  <div style="padding:5px">
    <div v-show="is3d === true">
      <sdk-container style="width: 100%; height: 500px" />
    </div>
    <div v-show="is3d === false">
      <iframe style="width: 100%; " frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"
        allowtransparency="yes" :src="serviceUrl" />
    </div>
  </div>
</template>
 
<script>
import sdkContainer from "../../components/sgword/mapView.vue";
export default {
  components: {
    sdkContainer
  },
  data() {
    return {
      is3d: false,
      serviceRoot: "http://103.85.165.99:9001/gisserver/",
      serviceUrl: "",
    }
  },
  methods: {
    showData(rowdata) {
      let that = this;
      let stype = rowdata.type;
      let spath = "";
      switch (stype) {
        case "WFS": this.is3d = false;
          spath = "wfsserver/" + rowdata.name + "?VERSION=1.0.0&SERVICE=WFS&REQUEST=DescribeFeatureType";
          window.open(this.serviceRoot + spath)
          break;
        case "WMS": this.is3d = true;
          //spath = "service/wms1.3.jsp?name=" + rowdata.name;
          spath = "wmsserver/" + rowdata.name;
          this.$nextTick(() => {
            let jlid = sgworld.ProjectTree.findItem("图层");
            if (jlid) {
              sgworld.ProjectTree.deleteItem(jlid);
            }
            jlid = sgworld.ProjectTree.createGroup("图层", "0");
            sgworld.Creator.createImageryProvider('gisserver', "wms", {
              url: this.serviceRoot + spath,
              layers: '',
              parameters: {
                format: "image/png",
                transparent: true,
              }
            }, jlid, undefined, true, "");
 
          })
          break;
        case "TMS": this.is3d = true;
          // spath = "service/tms1.3.jsp?name=" + rowdata.name;
          spath = "tmsserver/" + rowdata.name;
          this.$nextTick(() => {
            let jlid = sgworld.ProjectTree.findItem("图层");
            if (jlid) {
              sgworld.ProjectTree.deleteItem(jlid);
            }
            jlid = sgworld.ProjectTree.createGroup("图层", "0");
            sgworld.Creator.createUrlTemplateImageryProvider('tms服务', {
              url: Cesium.buildModuleUrl(this.serviceRoot + spath + "/{z}/{x}/{reverseY}.jpeg"),
            }, jlid, undefined, true, "");
          })
 
          break;
        case "WCS": this.is3d = false;
          spath = "service/wcs.jsp?name=" + rowdata.name;
          window.open(this.serviceRoot + spath);
          // chrome://flags/#block-insecure-private-network-requests
          break;
        case "C3D": this.is3d = true;
          // spath = "service/c3d.jsp?name=" + rowdata.name; 
          spath = "c3dserver/" + rowdata.name + "/tileset.json";
          this.$nextTick(() => {
            let jlid = sgworld.ProjectTree.findItem("图层");
            if (jlid) {
              sgworld.ProjectTree.deleteItem(jlid);
            }
            jlid = sgworld.ProjectTree.createGroup("图层", "0");
            sgworld.Creator.create3DTilesets("", this.serviceRoot + spath, {}, {}, jlid, true, (data) => {
              sgworld.Navigate.flyToObj(data);
            });
          })
          break;
        case "CTS": this.is3d = true;
          // spath = "service/cts.jsp?name=" + rowdata.name; 
          spath = "ctsserver/" + rowdata.name; this.$nextTick(() => {
            let jlid = sgworld.ProjectTree.findItem("图层");
            if (jlid) {
              sgworld.ProjectTree.deleteItem(jlid);
            }
            jlid = sgworld.ProjectTree.createGroup("图层", "0");
            var option = {
              requestVertexNormals: true,
              url: this.serviceRoot + spath
            };
            sgworld.Creator.createTerrain("gisserver地形", option, jlid, true, "");
          })
          break;
        default: break;
      }
      // if (spath)
      //   this.serviceUrl = this.serviceRoot + spath;
    }
  }
}
</script>
 
<style>
</style>