| | |
| | | for (var i in res) { |
| | | var str = res[i]; |
| | | |
| | | if (str.type == 1 && str.icon == 1) { |
| | | if (str.type == 1) { |
| | | val.push(str) |
| | | } else if (str.url != null && str.type == 2 && str.icon == 1) { |
| | | } else if (str.url != null && str.type == 2 && str.serveType == 'WMS') { |
| | | if (str.isShow == 1) { |
| | | |
| | | std.push(str.id) |
| | |
| | | resolution: "20米", |
| | | date: this.getYMD(), |
| | | layers: res.toString(), |
| | | rotation: this.form.role, |
| | | rotation: this.formInline.role, |
| | | xmin: this.layerExtent.xmin, |
| | | ymin: this.layerExtent.ymin, |
| | | xmax: this.layerExtent.xmax, |
| | |
| | | mapView.removeLayer(this.vector) |
| | | } |
| | | this.layerExtent = null |
| | | this.formInline.role = ''; |
| | | }, |
| | | stopDraw() { |
| | | // if (this.draw !== null) { |
| | |
| | | mapView.addLayer(this.vector) |
| | | |
| | | let type = 'Circle' |
| | | let geometryFunction2 = createRegularPolygon(4) |
| | | // var geometryFunction = ol.interaction.Draw.createBox(); |
| | | // console.log(geometryFunction) |
| | | let geometryFunction2 = createBox() |
| | | this.draw = new Draw({ |
| | | source: this.source, |
| | | type: type, |
| | |
| | | this.draw.on("drawend", e => { |
| | | let feature = e.feature |
| | | let geom = feature.getGeometry() |
| | | var bbox = geom.getExtent(); |
| | | var ss = turf.square(bbox); |
| | | geom.setCoordinates([[[ss[0], ss[3]], [ss[2], ss[3]], [ss[2], ss[1]], [ss[0], ss[1]], [ss[0], ss[3]]]]); |
| | | e.feature.setGeometry(geom); |
| | | var extent = geom.getExtent() |
| | | var a1 = transform([extent[0], extent[1]], "EPSG:3857", "EPSG:4326") |
| | | var a2 = transform([extent[2], extent[3]], "EPSG:3857", "EPSG:4326") |
| | |
| | | |
| | | mapView.removeInteraction(this.draw) |
| | | }) |
| | | |
| | | mapView.addInteraction(this.draw); |
| | | }, |
| | | //绘制图形 |
| | | setMapAddDraw() { |
| | |
| | | }, |
| | | //地图初始化 |
| | | initMap() { |
| | | var TiandiLayer = new TileLayer({ |
| | | source: new XYZ({ |
| | | url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}", |
| | | }), |
| | | }) |
| | | var TiandiLayer, GaoDeLayer; |
| | | if (is_production) { |
| | | var base_ulr = window.sceneConfig.baseUrl; |
| | | if (base_ulr.indexOf('{host}') > -1) { |
| | | base_ulr = base_ulr.replace("{host}", iisHost) |
| | | } |
| | | GaoDeLayer = new TileLayer({ |
| | | title: "高德地图", |
| | | source: new XYZ({ |
| | | url: base_ulr, |
| | | wrapX: false |
| | | }) |
| | | }); |
| | | var base_ulr_sl = window.sceneConfig.baseUrl_sl; |
| | | if (base_ulr_sl.indexOf('{host}') > -1) { |
| | | base_ulr_sl = base_ulr_sl.replace("{host}", iisHost) |
| | | } |
| | | TiandiLayer = new TileLayer({ |
| | | source: new XYZ({ |
| | | url: base_ulr_sl, |
| | | }), |
| | | }) |
| | | } else { |
| | | TiandiLayer = new TileLayer({ |
| | | source: new XYZ({ |
| | | url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}", |
| | | }), |
| | | }) |
| | | |
| | | var GaoDeLayer = new TileLayer({ |
| | | source: new XYZ({ |
| | | url: "http://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=6", |
| | | }), |
| | | }) |
| | | // var GaoDeTitle = new TileLayer({ |
| | | // source: new XYZ({ |
| | | // url: "http://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8", |
| | | // }), |
| | | // }) |
| | | GaoDeLayer = new TileLayer({ |
| | | source: new XYZ({ |
| | | url: "http://wprd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=6", |
| | | }), |
| | | }) |
| | | |
| | | } |
| | | |
| | | window.mapView = new Map({ |
| | | target: "mapView", |
| | | layers: [TiandiLayer, GaoDeLayer], |
| | |
| | | }), |
| | | controls: defaultControls().extend([new FullScreen(), new ScaleLine(), new Rotate()]), |
| | | }) |
| | | // console.log(mapView.getLayers().item(2)) |
| | | mapView.getLayers().item(1).setVisible(false) |
| | | mapView.getLayers().item(2).setVisible(false) |
| | | // mapView.getLayers().item(2).setVisible(false) |
| | | |
| | | // this.formInline.role = mapView.getView().getRotation() |
| | | }, |
| | | //切换底图 |