Map.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. <template>
  2. <div id="map">
  3. <!-- <div id="popup" class="style_container ol-popup">
  4. <div class="container">
  5. <div class="close_func">
  6. <a href="#" id="popup-closer" class="ol-popup-closer">×</a>
  7. </div>
  8. <div id="popup-title" class="popup-title"></div>
  9. <div id="popup-content" class="popup-content"></div>
  10. </div>
  11. </div>
  12. <div class="style_container changeBaseMap">
  13. <div class="container">
  14. <p
  15. :class="[
  16. 'bg',
  17. {
  18. active: mapChangeIsShow,
  19. },
  20. ]"
  21. @click="mapChangeIsShow = !mapChangeIsShow"
  22. ></p>
  23. <div class="style_container mapChangeIsShow" v-if="mapChangeIsShow">
  24. <div class="container">
  25. <ul>
  26. <li v-for="(item, index) in mapList" :key="index">
  27. <p :class="['bg', item.class, { active: item.active }]" @click="changeMap(item)">
  28. <span>{{ item.title }}</span>
  29. </p>
  30. </li>
  31. </ul>
  32. </div>
  33. </div>
  34. </div>
  35. </div> -->
  36. </div>
  37. </template>
  38. <script>
  39. import api from "@/api/menu";
  40. import Map from "ol/Map";
  41. import View from "ol/View";
  42. import Tile from "ol/layer/Tile";
  43. import XYZ from "ol/source/XYZ";
  44. import { defaults } from "ol/control";
  45. import { transform } from "ol/proj";
  46. import { Zoom, ScaleLine, Rotate, FullScreen, MousePosition } from "ol/control";
  47. import { createStringXY } from "ol/coordinate";
  48. import GeoJSON from "ol/format/GeoJSON";
  49. import VectorSource from "ol/source/Vector";
  50. import VectorLayer from "ol/layer/Vector";
  51. import Overlay from "ol/Overlay";
  52. import { Fill, Stroke, Text, Style } from "ol/style";
  53. import Select from "ol/interaction/Select";
  54. import { getLayerData } from "@/utils/getLayerDataAndCreateFeatures";
  55. import { createLayer } from "@/utils/ol_plugins/layer_control";
  56. export default {
  57. data() {
  58. return {
  59. TDT_Mercator: {
  60. vector_layer: { id: "vec_w", layer_id: "vec" },
  61. vector_layer_annotation: { id: "cva_w", layer_id: "cva" },
  62. raster_layer: { id: "img_w", layer_id: "img" },
  63. raster_layer_annotation: { id: "cia_w", layer_id: "cia" },
  64. topography_layer: { id: "ter_w", layer_id: "ter" },
  65. topography_layer_annotation: { id: "cta_w", layer_id: "cta" },
  66. national_boundary: { id: "ibo_w", layer_id: "ibo" },
  67. },
  68. TDT_lnglat: {
  69. vector_layer: { id: "vec_c", layer_id: "vec" },
  70. vector_layer_annotation: { id: "cva_c", layer_id: "cva" },
  71. raster_layer: { id: "img_c", layer_id: "img" },
  72. raster_layer_annotation: { id: "cia_c", layer_id: "cia" },
  73. topography_layer: { id: "ter_c", layer_id: "ter" },
  74. topography_layer_annotation: { id: "cta_c", layer_id: "cta" },
  75. national_boundary: { id: "ibo_c", layer_id: "ibo" },
  76. },
  77. TDT_layer_common_config: {
  78. SERVICE: "WMTS",
  79. REQUEST: "GetTile",
  80. VERSION: "1.0.0",
  81. STYLE: "default",
  82. TILEMATRIXSET: "w",
  83. TILEMATRIX: "{z}",
  84. TILEROW: "{y}",
  85. TILECOL: "{x}",
  86. FORMAT: "tiles",
  87. },
  88. TDT_Mercator_common_config:
  89. "&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=w&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=tiles",
  90. TDT_lnglat_common_config:
  91. "&SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&STYLE=default&TILEMATRIXSET=c&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&FORMAT=tiles",
  92. keyword: "",
  93. mapList: [
  94. {
  95. title: "地图",
  96. class: "vector",
  97. active: true,
  98. },
  99. {
  100. title: "影像",
  101. class: "raster",
  102. active: false,
  103. },
  104. {
  105. title: "地形",
  106. class: "dixing",
  107. active: false,
  108. },
  109. ],
  110. mapChangeIsShow: false,
  111. base_layer: null,
  112. base_layer_annotation: null,
  113. national_boundary: null,
  114. };
  115. },
  116. components: {},
  117. created() { },
  118. mounted() {
  119. let that = this;
  120. var mousePositionControl = new MousePosition({
  121. coordinateFormat: createStringXY(6),
  122. projection: "EPSG:4326",
  123. className: "custom-mouse-position",
  124. target: document.getElementById("mouse-position"),
  125. undefinedHTML: "&nbsp;",
  126. });
  127. let rotate = new Rotate({
  128. autoHide: true,
  129. label: "N",
  130. });
  131. let zoom = new Zoom({ target: undefined, delta: 1 });
  132. let scaleLine = new ScaleLine();
  133. let fullScreen = new FullScreen();
  134. // e90d56e5a09d1767899ad45846b0cefd
  135. let center = transform(
  136. [systemConfig.mapDefault.center.lng, systemConfig.mapDefault.center.lat],
  137. "EPSG:4326",
  138. "EPSG:3857"
  139. );
  140. let view = new View({
  141. center: center,
  142. zoom: systemConfig.mapDefault.zoom,
  143. constrainResolution: true, // 以整数级别缩放地图
  144. });
  145. that.$store.commit("setMouseLocation", [
  146. systemConfig.mapDefault.center.lng,
  147. systemConfig.mapDefault.center.lat,
  148. ]);
  149. that.$store.commit("setZoom", systemConfig.mapDefault.zoom);
  150. let map = new Map({
  151. target: "map", //地图标签id
  152. logo: false,
  153. controls: defaults({
  154. attribution: false,
  155. zoom: false,
  156. rotate: false,
  157. }),
  158. //.extend([scaleLine, fullScreen]),
  159. view: view,
  160. });
  161. globalVariable.map = map;
  162. globalVariable.map.getLayerById = function (id) {
  163. let arr = this.getLayers()
  164. .getArray()
  165. .filter(function (layer) {
  166. return layer.id == id || layer.values_.id == id;
  167. });
  168. if (arr.length == 0) {
  169. return null;
  170. } else if (arr.length < 2) {
  171. return arr[0];
  172. } else {
  173. throw "Layer ID repeat";
  174. }
  175. };
  176. // // 监听鼠标经纬度
  177. // map.on("pointermove", function (e) {
  178. // let lonlat = transform(e.coordinate, "EPSG:3857", "EPSG:4326");
  179. // that.$store.commit("setMouseLocation", [
  180. // Number(lonlat[0].toFixed(6)),
  181. // Number(lonlat[1].toFixed(6)),
  182. // ]);
  183. // });
  184. // // 监听地图变化时,缩放级别
  185. // map.getView().on("change:center", function (e) {
  186. // let lonlat = transform(globalVariable.map.getView().getCenter(), "EPSG:3857", "EPSG:4326");
  187. // that.$store.commit("setMouseLocation", [
  188. // Number(lonlat[0].toFixed(6)),
  189. // Number(lonlat[1].toFixed(6)),
  190. // ]);
  191. // });
  192. // map.getView().on("change", function (e) {
  193. // that.$store.commit("setZoom", e.target.getZoom());
  194. // });
  195. // // 图层选中事件
  196. // this.selectSingleClick = new Select();
  197. // globalVariable.map.addInteraction(this.selectSingleClick);
  198. // this.selectSingleClick.on("select", function (selectEvent) {
  199. // let selectSingleClickFeatures = that.selectSingleClick.getFeatures();
  200. // let selected = selectEvent.selected[0];
  201. // if (!selected) return;
  202. // if (selectEvent.target.getLayer(selectEvent.selected[0]) != null) {
  203. // switch (selectEvent.target.getLayer(selectEvent.selected[0]).values_.name) {
  204. // case "singlepoint":
  205. // if (selected.values_.callback) {
  206. // selected.values_.callback(selected, selectSingleClickFeatures);
  207. // return;
  208. // }
  209. // selectSingleClickFeatures.clear();
  210. // break;
  211. // case "cluster":
  212. // if (!selected.values_.features) {
  213. // selectSingleClickFeatures.clear();
  214. // break;
  215. // }
  216. // if (selected.values_.features.length == 1) {
  217. // let newFeature = selected.values_.features[0];
  218. // if (newFeature.values_.callback) {
  219. // newFeature.values_.callback(
  220. // newFeature,
  221. // selectSingleClickFeatures
  222. // );
  223. // } else {
  224. // selectSingleClickFeatures.clear();
  225. // return;
  226. // }
  227. // } else {
  228. // // TODO 缩放级别
  229. // globalVariable.map.getView().fit(
  230. // new VectorSource({
  231. // features: selected.values_.features,
  232. // }).getExtent()
  233. // );
  234. // selectSingleClickFeatures.clear();
  235. // return;
  236. // }
  237. // break;
  238. // case "heatmap":
  239. // return;
  240. // break;
  241. // default:
  242. // if (selected.values_.callback) {
  243. // selected.values_.callback(selected, selectSingleClickFeatures);
  244. // }
  245. // selectSingleClickFeatures.clear();
  246. // break;
  247. // }
  248. // } else {
  249. // selectSingleClickFeatures.clear();
  250. // }
  251. // });
  252. this.changeMap(this.mapList[0]);
  253. // this.loadRegionBoundary();
  254. // if (!this.$root.popup) {
  255. // this.$root.popup_container = $("#popup");
  256. // this.$root.popup_content = $("#popup-content");
  257. // this.$root.popup_title = $("#popup-title");
  258. // this.$root.popup_closer = $("#popup-closer");
  259. // this.$root.popup_closer.bind("click", this.popupcloseEvent);
  260. // this.$root.popup = new Overlay({
  261. // element: this.$root.popup_container[0],
  262. // autoPan: true,
  263. // autoPanMargin: 100,
  264. // positioning: "center-right",
  265. // });
  266. // globalVariable.map.addOverlay(this.$root.popup);
  267. // this.$root.popup_setPositionAndRelocation = function (position) {
  268. // that.$root.popup.setPosition(position);
  269. // let height = 0 - 70 - that.$root.popup_content.height();
  270. // that.$root.popup_container.css({
  271. // transform: " translate(-50%, " + height + "px)",
  272. // });
  273. // };
  274. // // 初始化
  275. // this.$root.popup.setPosition(undefined);
  276. // // 地图点击事件
  277. // map.on("click", function (e) {
  278. // that.$root.popup.setPosition(undefined);
  279. // });
  280. // }
  281. },
  282. methods: {
  283. // // overlay 关闭
  284. // popupcloseEvent() {
  285. // this.$root.popup.setPosition(undefined);
  286. // return false;
  287. // },
  288. getCompleteUrl(param) {
  289. let url =
  290. systemConfig.tdt_url +
  291. "/" +
  292. param.id +
  293. "/wmts?" +
  294. "tk=" +
  295. systemConfig.tdt_tk +
  296. "&LAYER=" +
  297. param.layer_id +
  298. this.TDT_Mercator_common_config;
  299. return url;
  300. },
  301. addLayerToMap(url, title) {
  302. let layer = new Tile({
  303. title: title,
  304. source: new XYZ({ url: url }),
  305. zIndex: 0,
  306. });
  307. globalVariable.map.addLayer(layer);
  308. return layer;
  309. },
  310. removeLayerToMap(layer) {
  311. globalVariable.map.removeLayer(layer);
  312. },
  313. changeMap(item) {
  314. this.mapList = this.mapList.map(function name(item_) {
  315. if (item_.class != item.class) {
  316. item_.active = false;
  317. } else {
  318. item_.active = true;
  319. }
  320. return item_;
  321. });
  322. this.addBaseLayer(item);
  323. },
  324. addBaseLayer(item) {
  325. if (this.base_layer) {
  326. this.removeLayerToMap(this.base_layer);
  327. }
  328. if (this.base_layer_annotation) {
  329. this.removeLayerToMap(this.base_layer_annotation);
  330. }
  331. if (this.national_boundary) {
  332. this.removeLayerToMap(this.national_boundary);
  333. }
  334. switch (item.class) {
  335. case "vector":
  336. this.base_layer = this.addLayerToMap(
  337. this.getCompleteUrl(this.TDT_Mercator.vector_layer)
  338. ); // 天地图 底图
  339. this.base_layer_annotation = this.addLayerToMap(
  340. this.getCompleteUrl(this.TDT_Mercator.vector_layer_annotation)
  341. ); // 天地图 国境线
  342. this.national_boundary = this.addLayerToMap(
  343. this.getCompleteUrl(this.TDT_Mercator.national_boundary)
  344. ); // 天地图 底图对应注记
  345. globalVariable.map.getView().setMaxZoom(18);
  346. break;
  347. case "raster":
  348. this.base_layer = this.addLayerToMap(
  349. this.getCompleteUrl(this.TDT_Mercator.raster_layer)
  350. ); // 天地图 底图
  351. this.base_layer_annotation = this.addLayerToMap(
  352. this.getCompleteUrl(this.TDT_Mercator.raster_layer_annotation)
  353. ); // 天地图 国境线
  354. this.national_boundary = this.addLayerToMap(
  355. this.getCompleteUrl(this.TDT_Mercator.national_boundary)
  356. ); // 天地图 底图对应注记
  357. globalVariable.map.getView().setMaxZoom(18);
  358. break;
  359. case "dixing":
  360. this.base_layer = this.addLayerToMap(
  361. this.getCompleteUrl(this.TDT_Mercator.topography_layer)
  362. ); // 天地图 底图
  363. this.base_layer_annotation = this.addLayerToMap(
  364. this.getCompleteUrl(this.TDT_Mercator.topography_layer_annotation)
  365. ); // 天地图 国境线
  366. this.national_boundary = this.addLayerToMap(
  367. this.getCompleteUrl(this.TDT_Mercator.national_boundary)
  368. ); // 天地图 底图对应注记
  369. globalVariable.map.getView().setMaxZoom(14);
  370. break;
  371. default:
  372. break;
  373. }
  374. },
  375. loadRegionBoundary() {
  376. const boundary_style = function (feature) {
  377. let default_style = new Style({
  378. stroke: new Stroke({
  379. color: "rgba(50, 164, 220, 1)",
  380. width: 3,
  381. }),
  382. fill: new Fill({
  383. color: "rgba(50, 164, 220, 0.1)",
  384. }),
  385. });
  386. return default_style;
  387. };
  388. const diming_textStyle = new Style({
  389. text: new Text({
  390. // 字体与大小
  391. font: "16px Microsoft YaHei",
  392. //文字填充色
  393. fill: new Fill({
  394. color: "rgba(50, 164, 220, 1)",
  395. }),
  396. //文字边界宽度与颜色
  397. stroke: new Stroke({
  398. color: "#fff",
  399. width: 2,
  400. }),
  401. // 显示文本,数字需要转换为文本string类型!
  402. /*text: "" + vectorSource.features.values_.limitvalue + "",*/
  403. offsetX: 0,
  404. offsetY: 0,
  405. }),
  406. });
  407. let that = this;
  408. const styleCallback = function (feature) {
  409. const limitvalue = feature.values_.Name;
  410. if (
  411. limitvalue != null &&
  412. limitvalue != undefined &&
  413. limitvalue.length > 0
  414. ) {
  415. diming_textStyle.getText().setText("" + limitvalue + "");
  416. }
  417. return diming_textStyle;
  418. };
  419. let province_boundary = this.geojsonSource(
  420. "../static/data/sheng.geojson"
  421. );
  422. let province_text = this.geojsonSource("../static/data/shengD.geojson");
  423. let city_boundary = this.geojsonSource("../static/data/shi.geojson");
  424. let city_text = this.geojsonSource("../static/data/shiD.geojson");
  425. let country_boundary = this.geojsonSource("../static/data/xian.geojson");
  426. let country_text = this.geojsonSource("../static/data/xianD.geojson");
  427. let province_boundary_layer = this.geojsonLayer(
  428. "province_boundary",
  429. province_boundary,
  430. boundary_style,
  431. 1,
  432. 7
  433. );
  434. let province_text_layer = this.geojsonLayer(
  435. "province_text",
  436. province_text,
  437. styleCallback,
  438. 1,
  439. 7
  440. );
  441. let city_boundary_layer = this.geojsonLayer(
  442. "city_boundary",
  443. city_boundary,
  444. boundary_style,
  445. 7,
  446. 9
  447. );
  448. let city_text_layer = this.geojsonLayer(
  449. "city_text",
  450. city_text,
  451. styleCallback,
  452. 7,
  453. 9
  454. );
  455. let country_boundary_layer = this.geojsonLayer(
  456. "country_boundary",
  457. country_boundary,
  458. boundary_style,
  459. 9,
  460. 18
  461. );
  462. let country_text_layer = this.geojsonLayer(
  463. "country_text",
  464. country_text,
  465. styleCallback,
  466. 9,
  467. 18
  468. );
  469. globalVariable.map.addLayer(province_boundary_layer);
  470. globalVariable.map.addLayer(province_text_layer);
  471. globalVariable.map.addLayer(city_boundary_layer);
  472. globalVariable.map.addLayer(city_text_layer);
  473. globalVariable.map.addLayer(country_boundary_layer);
  474. globalVariable.map.addLayer(country_text_layer);
  475. },
  476. geojsonSource(url) {
  477. return new VectorSource({
  478. projection: "EPSG:4326",
  479. url: url,
  480. format: new GeoJSON(),
  481. });
  482. },
  483. geojsonLayer(id, source, style, minZoom, maxZoom) {
  484. return new VectorLayer({
  485. id: id,
  486. source: source,
  487. style: style,
  488. minZoom: minZoom,
  489. maxZoom: maxZoom,
  490. zIndex: 1,
  491. });
  492. },
  493. // loadDefaultLayer() {
  494. // let that = this,
  495. // type = 0;
  496. // if (
  497. // this.urlParam.modelId == "" ||
  498. // this.urlParam.modelId == null ||
  499. // this.urlParam.modelId == undefined
  500. // ) {
  501. // return;
  502. // }
  503. // if (!isNaN(Number(this.urlParam.showType))) {
  504. // if (
  505. // Number(this.urlParam.showType) < 0 ||
  506. // Number(this.urlParam.showType) > 3
  507. // ) {
  508. // type = 0;
  509. // } else {
  510. // type = Number(this.urlParam.showType);
  511. // }
  512. // } else {
  513. // type = 0;
  514. // }
  515. // let layerType = "singlepoint";
  516. // switch (type) {
  517. // case 0:
  518. // layerType = "singlepoint";
  519. // break;
  520. // case 1:
  521. // layerType = "aggregation";
  522. // break;
  523. // case 2:
  524. // layerType = "heatmap";
  525. // break;
  526. // default:
  527. // break;
  528. // }
  529. // // 根据类型加载;
  530. // api
  531. // .getModelByID({ id: this.urlParam.modelId })
  532. // .then((result) => {
  533. // if (result.code == 200) {
  534. // that.searchData(result.content, layerType);
  535. // } else {
  536. // that.$message({
  537. // type: "warning",
  538. // message: result.message,
  539. // });
  540. // }
  541. // })
  542. // .catch((err) => {
  543. // that.$message({
  544. // type: "warning",
  545. // message: "服务器异常,请稍后重试!",
  546. // });
  547. // });
  548. // },
  549. searchData(content, layerType) {
  550. let that = this;
  551. // 上传loading
  552. const loading = this.$createLoading("数据获取中,请稍后!")
  553. getLayerData(content, this.setPopup, loading)
  554. .then((result) => {
  555. let source = new VectorSource();
  556. source.addFeatures(result);
  557. that.addDifferentLayer(content, layerType, source);
  558. })
  559. .catch((err) => {
  560. that.$message({
  561. type: "warning",
  562. message: err,
  563. });
  564. });
  565. },
  566. // 设置 popup
  567. setPopup(properties, position) {
  568. let that = this;
  569. that.$root.popup_content.html(
  570. `<div>名称:${properties.title}</div>
  571. <div>类别:${properties.classify}</div>
  572. <div>详情:${properties.content}</div>
  573. `
  574. );
  575. that.$root.popup_setPositionAndRelocation(position);
  576. },
  577. // 地图 加载 不同图层
  578. addDifferentLayer(item, layerType, source) {
  579. let layer = createLayer(item, layerType, source, this.$store.state.token);
  580. globalVariable.map.addLayer(layer);
  581. globalVariable.map.getView().fit(source.getExtent());
  582. },
  583. },
  584. computed: {
  585. // urlParam() {
  586. // return this.$store.state.urlParams;
  587. // },
  588. },
  589. watch: {},
  590. };
  591. </script>
  592. <style lang="less" scoped>
  593. #map {
  594. width: 100%;
  595. height: 100%;
  596. position: absolute;
  597. /deep/ .ol-zoom {
  598. top: inherit;
  599. left: inherit;
  600. bottom: 60px;
  601. right: 20px;
  602. .ol-zoom-in,
  603. .ol-zoom-out {
  604. width: 30px;
  605. height: 30px;
  606. font-size: 24px;
  607. }
  608. }
  609. /deep/ .ol-scale-line {
  610. top: unset;
  611. left: unset;
  612. // bottom: 60px;
  613. left: 20px;
  614. }
  615. .changeBaseMap {
  616. position: absolute;
  617. top: 90px;
  618. right: 20px;
  619. z-index: 2;
  620. }
  621. .changeBaseMap > .container {
  622. width: 40px;
  623. height: 40px;
  624. cursor: pointer;
  625. border-radius: 4px;
  626. overflow: hidden;
  627. > p {
  628. width: 30px;
  629. height: 30px;
  630. margin: 5px 5px;
  631. background-position-x: center;
  632. background-position-y: center;
  633. background-repeat: no-repeat;
  634. background-image: url(~@/assets/images/tool/mapchange1.png);
  635. &:hover,
  636. &.active {
  637. background-image: url(~@/assets/images/tool/mapchange_active1.png);
  638. }
  639. }
  640. .mapChangeIsShow {
  641. position: absolute;
  642. top: -5px;
  643. left: calc(-234px - 10px - 12px - 10px);
  644. }
  645. .mapChangeIsShow > .container {
  646. width: calc(234px + 12px);
  647. height: 100%;
  648. border-radius: 4px;
  649. ul {
  650. width: fit-content;
  651. height: fit-content;
  652. }
  653. li {
  654. position: relative;
  655. display: inline-block;
  656. .bg {
  657. width: 68px;
  658. height: 63px;
  659. margin: 5px 5px;
  660. border: 2px solid #ffffff;
  661. background-position-x: center;
  662. background-position-y: center;
  663. background-size: 100% 100%;
  664. background-repeat: no-repeat;
  665. &:hover {
  666. border: 2px solid #c9c9c9;
  667. }
  668. &.active {
  669. border: 2px solid #00a9f9;
  670. span {
  671. background: #00a9f9b3;
  672. }
  673. }
  674. &.vector {
  675. background-image: url(~@/assets/images/maptype/xianhua.png);
  676. }
  677. &.raster {
  678. background-image: url(~@/assets/images/maptype/raster.png);
  679. }
  680. &.dixing {
  681. background-image: url(~@/assets/images/maptype/dixing.png);
  682. }
  683. }
  684. span {
  685. position: absolute;
  686. bottom: 5px;
  687. padding: 2px 5px;
  688. text-align: center;
  689. color: #ffffff;
  690. background: #00000080;
  691. }
  692. }
  693. }
  694. }
  695. }
  696. </style>