| | |
| | | import "ol/ol.css"; |
| | | import OlView from "ol/View.js"; |
| | | import XYZ from "ol/source/XYZ"; |
| | | import TileArcGISRest from "ol/source/TileArcGISRest"; |
| | | import OlLayerTile from "ol/layer/Tile.js"; |
| | | import OlMap from "ol/Map.js"; |
| | | import tip from "./tip.vue"; |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | gunAddlayer: new VectorLayer({ |
| | | // 图标图层 |
| | | zIndex: 22, |
| | | source: new VectorSource(), |
| | | }), |
| | | peopleAddlayer: new VectorLayer({ |
| | | // 图标图层 |
| | | zIndex: 22, |
| | | source: new VectorSource(), |
| | | }), |
| | | carAddlayer: new VectorLayer({ |
| | | // 图标图层 |
| | | zIndex: 22, |
| | | source: new VectorSource(), |
| | | }), |
| | | // peopleLineAddlayer: new VectorLayer({ |
| | | // gunAddlayer: new VectorLayer({ |
| | | // // 图标图层 |
| | | // zIndex: 22, |
| | | // source: new VectorSource(), |
| | | // }), |
| | | beginsPoint: new VectorLayer({ |
| | | // 图标图层 |
| | | zIndex: 22, |
| | | source: new VectorSource(), |
| | | }), |
| | | DrawLayer: new VectorLayer({ |
| | | // 图标图层 |
| | | // zIndex: 1000, |
| | | source: new VectorSource(), |
| | | }), |
| | | // peopleAddlayer: new VectorLayer({ |
| | | // // 图标图层 |
| | | // zIndex: 22, |
| | | // source: new VectorSource(), |
| | | // }), |
| | | // carAddlayer: new VectorLayer({ |
| | | // // 图标图层 |
| | | // zIndex: 22, |
| | | // source: new VectorSource(), |
| | | // }), |
| | | // // peopleLineAddlayer: new VectorLayer({ |
| | | // // // 图标图层 |
| | | // // zIndex: 22, |
| | | // // source: new VectorSource(), |
| | | // // }), |
| | | // beginsPoint: new VectorLayer({ |
| | | // // 图标图层 |
| | | // zIndex: 22, |
| | | // source: new VectorSource(), |
| | | // }), |
| | | // DrawLayer: new VectorLayer({ |
| | | // // 图标图层 |
| | | // // zIndex: 1000, |
| | | // source: new VectorSource(), |
| | | // }), |
| | | toMoveTime: null, |
| | | oldService: "", |
| | | mapService: [ |
| | | // { |
| | |
| | | // new OlLayerTile({ |
| | | zIndex: 5, |
| | | title: data.length - 1, |
| | | source: new XYZ({ |
| | | source: new TileArcGISRest({ |
| | | url: data[data.length - 1].service, // 注记 |
| | | // '水系图', http://59.55.128.156:6080/arcgis/rest/services/fuzhoupcsdhl/MapServer |
| | | // '行政区', http://59.55.128.156:6080/arcgis/rest/services/fzxzq/MapServer |
| | | }), |
| | | // }), |
| | | }); |
| | |
| | | // } |
| | | // } |
| | | // console.log("str", str); |
| | | // that.view.setCenter(layer); |
| | | let doit = () => { |
| | | this.toMoveTime = setTimeout(() => { |
| | | console.log(window.ol2d); |
| | | |
| | | // console.log(layer.getData()); |
| | | // // let position = layer.values_.source.tmpExtent_; |
| | | // let position = layer.renderer_.renderedExtent_; |
| | | // let lonlat = [ |
| | | // [position[0], position[1]], |
| | | // [position[2], position[3]], |
| | | // ]; |
| | | // let pot = layer.getFeatures()[0]; |
| | | // console.log(pot); |
| | | // // let zoomto = new ZoomToExtent({ extent: lonlat }); |
| | | // // console.log(window.ol2d); |
| | | // // window.ol2d.zoomToExtent(position); |
| | | // this.view.setCenter(lonlat[0]); |
| | | }, 500); |
| | | }; |
| | | if (this.toMoveTime) { |
| | | clearTimeout(this.toMoveTime); |
| | | doit(); |
| | | } else { |
| | | doit(); |
| | | } |
| | | |
| | | that.oldService = data[data.length - 1].service; |
| | | window.ol2d.addLayer(layer); |
| | | that.mapService.push({ |