| | |
| | | import { getTopLeft, getWidth } from "ol/extent.js"; |
| | | import { format } from "ol/coordinate"; |
| | | import store from "@/store"; |
| | | import { nextTick } from "vue"; |
| | | const olMap = { |
| | | map: null, |
| | | Layer: null, |
| | |
| | | }, |
| | | deleteLayer() { |
| | | if (this.map && this.Layer) { |
| | | |
| | | |
| | | this.map.removeLayer(this.Layer); |
| | | this.Layer = null; |
| | | } |
| | |
| | | this.map.values_.view.projection_ = projection |
| | | } |
| | | |
| | | // var projection = getProjection("ESRI:103880"); |
| | | var projectionExtent = projection.getExtent(); |
| | | |
| | | var size = getWidth(projectionExtent) / 256; |
| | |
| | | }); |
| | | if (this.map) { |
| | | this.map.addLayer(this.Layer); |
| | | this.map.getView().fit(this.projectionObj.extent); |
| | | // |
| | | // |
| | | |
| | | // this.map.getView().fit(this.projectionObj.extent, this.map.getSize()); |
| | | if (res.bak) { |
| | | var obj = JSON.parse(res.bak); |
| | | this.map.getView().setCenter(obj.center) |
| | | this.map.getView().setZoom(obj.zoom); |
| | | } else { |
| | | this.map.getView().fit(this.projectionObj.extent); |
| | | // var val = this.projectionObj.extent; |
| | | // this.map.getView().setCenter([(val[0] + val[1]) / 2, (val[2] + val[3]) / 2.4]) |
| | | // this.map.getView().setZoom(3); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | }, |