Browse Source

政务专用

dev-烟台中转登录
dai 3 years ago
parent
commit
fd3920d09f
  1. 4
      public/index.html
  2. 21
      src/utils/dai-map.js
  3. 1
      src/utils/tdt-wp-zw.js
  4. 6
      src/views/modules/visual/command/cpts/map.vue
  5. 32
      src/views/modules/visual/cpts/map/index.vue
  6. 32
      src/views/modules/visual/cpts/map/index2.vue

4
public/index.html

@ -10,8 +10,8 @@
<!-- <script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&libraries=service&key=LWBBZ-TIGC3-VFP3L-YNMWH-FJB7T-JFBLO"></script>
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script> -->
<!-- <script src="http://api.tianditu.gov.cn/api?v=4.0&tk=c4dc987b442bd141a887d8d4a5d07926" type="text/javascript"></script> -->
<script src="http://www.sdmap.gov.cn/api/olapi/ol/openlayers.js" type="text/javascript"></script>
<!-- <script src="http://59.206.203.34/api/olapi/ol/openlayers.js" type="text/javascript"></script> -->
<!-- <script src="http://www.sdmap.gov.cn/api/olapi/ol/openlayers.js" type="text/javascript"></script> -->
<script src="http://59.206.203.34/api/olapi/ol/openlayers.js" type="text/javascript"></script>
<!-- f2图表 -->
<!-- <script src="https://gw.alipayobjects.com/os/lib/antv/f2/3.8.1/dist/f2.min.js"></script> -->

21
src/utils/dai-map.js

@ -325,16 +325,20 @@ export default function init(ele, position, params) {
),
});
this.map.addLayer(graphicLayer);
this.marker = new OpenLayers.Geometry.Point(lng, lat);
let pt = new OpenLayers.Geometry.Point(lng, lat);
var style = {
externalGraphic: require("@/assets/img/common/map-poi.png"),
graphicWidth: 32,
graphicHeight: 32,
};
var feature = new OpenLayers.Feature.Vector(this.marker, null, style);
var feature = new OpenLayers.Feature.Vector(pt, null, style);
graphicLayer.addFeatures([feature]);
this.marker = feature;
this.markerLayer = graphicLayer;
} else {
// this.marker.setLngLat(lnglat);
this.marker.geometry.x = lng;
this.marker.geometry.y = lat;
this.markerLayer.redraw();
}
};
@ -361,6 +365,17 @@ export default function init(ele, position, params) {
}
});
};
this.on = function (eventType, fn) {
if (eventType == "dragend") {
this.map.events.register("moveend", null, (e) => {
console.log("dragend", e);
fn(e);
});
} else {
this.map.events.register(eventType, null, moveendHandler);
}
};
}
this.searchNearby = async function (keyword) {

1
src/utils/tdt-wp-zw.js

@ -1,4 +1,5 @@
export const baseUrl = "http://59.206.203.34/tileservice/SDPubMap";
export default {
vec: "http://59.206.203.34/tileservice/SDPubMap?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=sdvec&STYLE=default&TILEMATRIXSET=c&TILEMATRIX={z}&TILEROW={row}&TILECOL={col}&FORMAT=image%2Fpng",
// vec: "http://service.sdmap.gov.cn/tileservice/sdpubmap?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=sdvec&STYLE=default&TILEMATRIXSET=c&TILEMATRIX={z}&TILEROW={x}&TILECOL={y}&FORMAT=image%2Fpng&tk=e758167d5b90c351b70a979c0820840c",
};

6
src/views/modules/visual/command/cpts/map.vue

@ -5,14 +5,14 @@
<div
class="btn"
v-if="mapStyleType == 'light'"
v-show="mapType != 'td'"
v-show="mapType == 'qq'"
@click="shiftMapStyle('dark')"
>
切换深色模式
</div>
<div
class="btn"
v-show="mapType != 'td'"
v-show="mapType == 'qq'"
v-else
@click="shiftMapStyle('light')"
>
@ -372,7 +372,7 @@ export default {
39.9088810666821,
];
if (mapType == "td") {
if (mapType != "qq") {
myMap = new Map({
center: iniCenter,
zoom: 18,

32
src/views/modules/visual/cpts/map/index.vue

@ -4,14 +4,14 @@
<div
class="btn"
v-if="mapStyleType == 'light'"
v-show="mapType != 'td'"
v-show="mapType == 'qq'"
@click="shiftMapStyle('dark')"
>
切换深色模式
</div>
<div
class="btn"
v-show="mapType != 'td'"
v-show="mapType == 'qq'"
v-else
@click="shiftMapStyle('light')"
>
@ -35,6 +35,8 @@ import {
import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index";
import { mapType, searchNearby } from "@/utils/dai-map";
import tdtWp from "@/utils/tdt-wp";
import tdtWpZw from "@/utils/tdt-wp-zw";
let myMap;
let scene;
@ -319,7 +321,7 @@ export default {
39.9088810666821,
];
if (mapType == "td") {
if (mapType != "qq") {
myMap = new Map({
center: iniCenter,
zoom: 18,
@ -346,6 +348,8 @@ export default {
scene.on("loaded", async () => {
if (mapType == "td") {
this.iniMapBase(scene);
} else if (mapType == "tdzw") {
this.iniMapBase2(scene);
}
this.iniMapGrid(scene);
@ -405,6 +409,28 @@ export default {
scene.addLayer(annotionLayer);
},
//
iniMapBase2(scene) {
console.log("-----------------iniMapBase");
//
const baseLayer = new RasterLayer({
zIndex: 1,
});
baseLayer
.source(tdtWpZw.vec, {
parser: {
type: "rasterTile",
tileSize: 256,
zoomOffset: 0,
},
})
.style({
opacity: 0.7,
});
scene.addLayer(baseLayer);
},
iniMapGrid(scene) {
const { darkStyle, lightStyle, polygonData, polygonDotData } = this;

32
src/views/modules/visual/cpts/map/index2.vue

@ -5,13 +5,13 @@
class="btn"
v-if="mapStyleType == 'light'"
@click="shiftMapStyle('dark')"
v-show="mapType != 'td'"
v-show="mapType == 'qq'"
>
切换深色模式
</div>
<div
class="btn"
v-show="mapType != 'td'"
v-show="mapType == 'qq'"
v-else
@click="shiftMapStyle('light')"
>
@ -36,6 +36,8 @@ import {
import { GaodeMap, Map } from "@antv/l7-maps";
import { spliceIntoChunks } from "@/utils/index";
import { mapType, searchNearby } from "@/utils/dai-map";
import tdtWp from "@/utils/tdt-wp";
import tdtWpZw from "@/utils/tdt-wp-zw";
let myMap;
let scene;
@ -338,7 +340,7 @@ export default {
39.9088810666821,
];
if (mapType == "td") {
if (mapType != "qq") {
myMap = new Map({
center: iniCenter,
zoom: 18,
@ -365,6 +367,8 @@ export default {
scene.on("loaded", async () => {
if (mapType == "td") {
this.iniMapBase(scene);
} else if (mapType == "tdzw") {
this.iniMapBase2(scene);
}
this.iniMapGrid(scene);
@ -424,6 +428,28 @@ export default {
scene.addLayer(annotionLayer);
},
//
iniMapBase2(scene) {
console.log("-----------------iniMapBase");
//
const baseLayer = new RasterLayer({
zIndex: 1,
});
baseLayer
.source(tdtWpZw.vec, {
parser: {
type: "rasterTile",
tileSize: 256,
zoomOffset: 0,
},
})
.style({
opacity: 0.7,
});
scene.addLayer(baseLayer);
},
iniMapGrid(scene) {
const { darkStyle, lightStyle, polygonData, polygonDotData } = this;

Loading…
Cancel
Save