当前位置: 首页 > news >正文

dwcc2017做网站教程wordpress 美术

dwcc2017做网站教程,wordpress 美术,苏州网站建设推广咨询平台,如何进行网站设计凸显出当前区域 需要当前地方的json数据 这个可以在阿里的这个阿里 看下效果图 遮盖层的逃命都是可以调的 引入 下面一段代码 import sx from "/views/json/sx1.json"; // 下载的json import GeoJSON from "ol/format/GeoJSON"; // ol的一些方法 imp…

凸显出当前区域 需要当前地方的json数据 这个可以在阿里的这个阿里
在这里插入图片描述

看下效果图
在这里插入图片描述
遮盖层的逃命都是可以调的
引入 下面一段代码

import sx from "@/views/json/sx1.json"; //  下载的json
import GeoJSON from "ol/format/GeoJSON";  // ol的一些方法
import Polygon, { fromExtent } from "ol/geom/Polygon";
import LinearRing from 'ol/geom/LinearRing';
<template><div class="container"><div id="vue-openlayers" class="map-x"></div><divid="info-box"class="info-box"style="width: 100px; height: 100px"></div><div id="canv" style="width: 100px; height: 100px"></div></div>
</template>
<script>
import "ol/ol.css";
import { Map, View, style, Feature, geom, Overlay } from "ol";
import TileLayer from "ol/layer/Tile";
import XYZ from "ol/source/XYZ";
import { Vector as VectorSource } from "ol/source";
import VectorLayer from "ol/layer/Vector";
import { Point, LineString } from "ol/geom";
import { Style, Icon, Stroke, Text, Fill } from "ol/style";
import logo from "@/assets/logo.png";
import * as ol from "ol";
import "ol-ext/dist/ol-ext.css";import sx from "@/views/json/sx1.json";
import GeoJSON from "ol/format/GeoJSON";
import Polygon, { fromExtent } from "ol/geom/Polygon";
import LinearRing from 'ol/geom/LinearRing';export default {name: "FirstMap",data() {return {map: null,draw: null,maskLayer: null,logo,layers: [],};},methods: {initMap() {let that = this;// 将图标样式应用到点要素const features = [];const point = new Point([108.56, 34.15]); // 修改坐标格式const feature = new Feature({geometry: point,custom: { data: "123", type: "icon" },type: "icon",});feature.setStyle([new Style({image: new Icon({crossOrigin: "anonymous",src: this.logo,// size: [40, 40],scale: 0.2, // 图标缩放比例}),}),]);features.push(feature);//设置地图的数据源const source = new VectorSource({features,});let markLayerPoints = new VectorLayer({source: source,});let map = new Map({target: "vue-openlayers",layers: [new TileLayer({source: new XYZ({url: "https://gdtc.shipxy.com/tile.g?l=en&m=d&z={z}&x={x}&y={y}",}),}),markLayerPoints, // 确保图层顺序正确// vectorLayers,],view: new View({projection: "EPSG:4326",center: [108.56, 34.15], // 修改中心坐标格式zoom: 6,}),});this.map = map;that.showSFArea() // 蓝色蒙层},// 移除图层方法removeFun(layerId) {const that = this;const selArr = that.map.getLayers().getArray(); // 获取所有图层selArr.map((item, index) => {if (item.values_?.id == layerId) {// 移除图层that.map.removeLayer(selArr[index]);}});},// 创建蒙层,凸显区域showSFArea() {const initLayer = new VectorLayer({name: "blueLayer",// zIndex: 1,// opacity: 0.6,source: new VectorSource(),style: new Style({fill: new Fill({color: "rgba(3, 44, 79, 1)",}),stroke: new Stroke({color: "rgba(0,0,0,0.8)",width: 1})}),});this.map.addLayer(initLayer);this.addConver(initLayer);},// 添加遮罩addConver(converLayer) {let codeJson = sx;var fts = new GeoJSON().readFeatures(codeJson);const ft = fts[0];const converGeom = this.erase(ft.getGeometry());const convertFt = new Feature({geometry: converGeom,});converLayer.getSource().addFeature(convertFt);},// 擦除操作,生产遮罩范围erase(geom) {const extent = [-180, -90, 180, 90];const polygonRing = fromExtent(extent);const coords = geom.getCoordinates();coords.forEach((coord) => {const linearRing = new LinearRing(coord[0]);polygonRing.appendLinearRing(linearRing);});return polygonRing;},},mounted() {this.initMap();},
};
</script>
<style scoped lang="scss">
.input {position: fixed;top: 10px;right: 10px;border-radius: 10px;background: #fff;display: flex;flex-direction: column;padding: 5px;padding-bottom: 10px;> * {margin-top: 10px;display: flex;align-items: center;}
}
</style><style scoped lang="scss">
.container {position: relative;.btn {position: absolute;left: 4%;top: 1%;}
}#vue-openlayers {width: 100vw;height: 100vh;
}h3 {line-height: 40px;
}/* 隐藏信息盒子的初始样式 */
#info-box {display: none;position: absolute;background: white;border: 1px solid black;padding: 10px;border-radius: 5px;font-size: 14px;pointer-events: none; /* 防止信息盒子影响鼠标事件 */
}
</style>
http://www.yayakq.cn/news/592942/

相关文章:

  • 台州网站制作 外贸家装类设计网站
  • 那种投票网站里面怎么做怎么学建网站
  • 百度收录的网站多久更新一次哈尔滨seo关键字优化
  • 做游戏的网站佛山网站建设优化企业
  • 大连龙采做网站行不行linux下可以用wordpress
  • 高端建站咨询网络规划设计师目录
  • 用u盘做网站各省网站备案条件
  • 动漫网站开发乐山市规划和建设局网站
  • 网站付款接口这么做手机网站集成支付宝
  • 开发定制网站青岛知名设计公司
  • 仿门户网站源码宁波网站建设优化技术
  • 如何推广网站运营大学加强网站建设与管理的通知
  • 南山做网站关于枪宁波住房和建设局网站
  • 深圳网站制作的公司排名建个人网站做导购怎么备案
  • 做网站卖房写标题为什么买的网站模版不好用
  • 做外贸无网站如何做网站建设作
  • 做甲方去哪个网站应聘瀑布流响应式网站模板
  • 手机购物网站 建站做网站算法
  • 密码管理admin青岛seo整站优化招商电话
  • 网站建设合同 英文在线做头像
  • seo网站推广优化论文河北省建设厅官方网站
  • 前端网站搜索导航怎么做新能源汽车价格排行榜
  • 黑山网站制作公司免费安全正能量网站大全
  • 邯郸网站建设选哪家安阳做网站
  • 15个平面设计图素材网站做网站做那一网站好
  • 网站开发需要申请专利吗网站建设系统公司地址
  • 公司做网站需要哪些步骤电子商务网站建设的市场分析
  • seo分析工具seo优化工作内容做什么
  • 查公司备案网站备案信息装饰公司门头
  • 有什么可以接单做设计的网站外贸建站推广