国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當(dāng)前位置: 首頁 > news >正文

360客服做網(wǎng)站電話網(wǎng)絡(luò)工程師培訓(xùn)班要多少錢

360客服做網(wǎng)站電話,網(wǎng)絡(luò)工程師培訓(xùn)班要多少錢,大連微信網(wǎng)站,wordpress一定要本地建站嗎1 需求 使用openlayers繪圖功能繪制多邊形 2 分析 主要是openlayers中draw功能的使用&#xff0c;感覺比較簡單&#xff0c;祖?zhèn)鰿V大法搞起來 3 實(shí)現(xiàn) 為了方便&#xff0c;就不加載底圖了&#xff0c;直接使用繪制功能 2.1 簡單實(shí)現(xiàn) <template><div id"ma…

1 需求

使用openlayers繪圖功能繪制多邊形

2 分析

主要是openlayers中draw功能的使用,感覺比較簡單,祖?zhèn)鰿V大法搞起來

3 實(shí)現(xiàn)

為了方便,就不加載底圖了,直接使用繪制功能

2.1 簡單實(shí)現(xiàn)

<template><div id="map" class="map"></div>
</template><script setup lang="ts">
import { Map, View } from 'ol';
import { get } from 'ol/proj';
import { Style } from 'ol/style';
import { Fill, Stroke } from 'ol/style.js';
import Draw from 'ol/interaction/Draw.js';
import { Vector as VectorSource } from 'ol/source.js';
import { Vector as VectorLayer } from 'ol/layer.js';const projection = get('EPSG:4326');
const source = new VectorSource();
const map = ref();
const draw = ref();onMounted(() => {initMap();initDraw();
});const initMap = () => {map.value = new Map({target: 'map',view: new View({center: [116.406393, 39.909006],projection: projection,zoom: 5}),layers: [new VectorLayer({source: source,style: new Style({stroke: new Stroke({color: 'orange',width: 2}),fill: new Fill({color: [203, 150, 62, 0.5]})})})]});
};const initDraw = () => {draw.value = new Draw({source: source,type: 'Polygon'});draw.value.on('drawstart', e => {console.log('e', e);});draw.value.on('drawend', e => {console.log('coord', e.feature.getGeometry().getCoordinates());});map.value.addInteraction(draw.value);
};
</script>
<style scoped lang="scss">
.map {width: 100%;height: 100%;background: #000;
}
</style>

2.2 需求更新1

新需求:

  • 自定義繪制時(shí)的樣式,沒有繪制完成時(shí),顯示虛線,頂點(diǎn)增加Point
  • 繪制完成后每個(gè)頂點(diǎn)需要顯示一個(gè)Point

分析:

這里主要是styleFunction的靈活使用

實(shí)現(xiàn):

<template><div id="map" class="map"></div>
</template><script setup lang="ts">
import { Map, View } from 'ol';
import { get } from 'ol/proj';
import { Style } from 'ol/style';
import Draw from 'ol/interaction/Draw.js';
import { Vector as VectorSource } from 'ol/source.js';
import { Vector as VectorLayer } from 'ol/layer.js';
import { Circle, Fill, Stroke } from 'ol/style.js';
import {  Point } from 'ol/geom';const projection = get('EPSG:4326');
const source = new VectorSource();
const map = ref();
const draw = ref();onMounted(() => {initMap();initDraw();
});const initMap = () => {map.value = new Map({target: 'map',view: new View({center: [116.406393, 39.909006],projection: projection,zoom: 5}),layers: [new VectorLayer({source: source,style: styleFunc})]});
};const initDraw = () => {draw.value = new Draw({source: source,type: 'Polygon',style: drawStyleFunc});draw.value.on('drawstart', e => {console.log('e', e);});draw.value.on('drawend', e => {console.log('coord', e.feature.getGeometry().getCoordinates());});map.value.addInteraction(draw.value);
};const drawStyleFunc = (feature) => {const styles = [];const coord = feature.getGeometry().getCoordinates();for (let i = 0; i < coord.length - 1; i++) {styles.push(new Style({geometry: new Point(coord[i]),image: new Circle({radius: 4,fill: new Fill({color: '#ffff'}),stroke: new Stroke({color: 'orange',width: 2})})}));}styles.push(new Style({fill: new Fill({color: [255, 255, 255, 0.5]}),stroke: new Stroke({color: 'red',lineDash: [10],width: 2})}));return styles;
};const styleFunc = (feature) => {const styles = [];const coord = feature.getGeometry().getCoordinates();for (let i = 0; i < coord[0].length - 1; i++) {styles.push(new Style({geometry: new Point(coord[0][i]),image: new Circle({radius: 4,fill: new Fill({color: '#ffff'}),stroke: new Stroke({color: 'orange',width: 2})})}));}styles.push(new Style({fill: new Fill({color: [128, 128, 255, 0.5]}),stroke: new Stroke({color: 'blue',width: 2})}));return styles;
};
</script>
<style scoped lang="scss">
.map {width: 100%;height: 100%;background: #000;
}
</style>

2.2 需求更新2

新需求:

  • 確定的兩個(gè)頂點(diǎn)之間變?yōu)閷?shí)線
  • 取消跟隨鼠標(biāo)的Point,影響定位
  • 取消繪制時(shí)的填充

分析:

這里主要是styleFunction的靈活使用

實(shí)現(xiàn):

<template><div id="map" class="map"></div>
</template><script setup lang="ts">
import { Map, View } from 'ol';
import { get } from 'ol/proj';
import { Style } from 'ol/style';
import Draw from 'ol/interaction/Draw.js';
import { Vector as VectorSource } from 'ol/source.js';
import { Vector as VectorLayer } from 'ol/layer.js';
import { Circle, Fill, Stroke } from 'ol/style.js';
import {  LineString, Point } from 'ol/geom';const projection = get('EPSG:4326');
const source = new VectorSource();
const map = ref();
const draw = ref();onMounted(() => {initMap();initDraw();
});const initMap = () => {map.value = new Map({target: 'map',view: new View({center: [116.406393, 39.909006],projection: projection,zoom: 5}),layers: [new VectorLayer({source: source,style: styleFunc})]});
};const initDraw = () => {draw.value = new Draw({source: source,type: 'Polygon',style: drawStyleFunc});draw.value.on('drawstart', e => {console.log('e', e);});draw.value.on('drawend', e => {console.log('coord', e.feature.getGeometry().getCoordinates());});map.value.addInteraction(draw.value);
};const drawStyleFunc = (feature) => {const styles = [];const type = feature.getGeometry().getType();const coord = feature.getGeometry().getCoordinates();for (let i = 0; i < coord.length - 1; i++) {styles.push(new Style({geometry: new Point(coord[i]),image: new Circle({radius: 4,fill: new Fill({color: '#ffff'}),stroke: new Stroke({color: 'orange',width: 2})})}));}if (type === 'LineString') {for (let i = 0; i < coord.length - 1; i++) {styles.push(new Style({geometry: new LineString([coord[i], coord[i + 1]]),stroke: new Stroke({color: 'orange',lineDash: coord.length > 2 && i < coord.length - 2 ? [] : [10],width: 2})}));}}return styles;
};const styleFunc = (feature) => {const styles = [];const coord = feature.getGeometry().getCoordinates();for (let i = 0; i < coord[0].length - 1; i++) {styles.push(new Style({geometry: new Point(coord[0][i]),image: new Circle({radius: 4,fill: new Fill({color: '#ffff'}),stroke: new Stroke({color: 'orange',width: 2})})}));}styles.push(new Style({fill: new Fill({color: [128, 128, 255, 0.5]}),stroke: new Stroke({color: 'blue',width: 2})}));return styles;
};
</script>
<style scoped lang="scss">
.map {width: 100%;height: 100%;background: #000;
}
</style>

存在問題:

  • 在點(diǎn)擊鼠標(biāo)后并且鼠標(biāo)有移動時(shí),前一段虛線才會變成實(shí)線,并且頂點(diǎn)加上Point,因?yàn)橹挥惺髽?biāo)移動才會有新的坐標(biāo)點(diǎn)加入到繪制,因?yàn)閛penlayers沒有提供繪制過程中的鉤子函數(shù),所以只能是當(dāng)前效果
  • 有需要時(shí)drawStyleFunction可以和styleFuntion合并成一個(gè)
http://m.aloenet.com.cn/news/43240.html

相關(guān)文章:

  • 在線做章網(wǎng)站aso蘋果關(guān)鍵詞優(yōu)化
  • 哪家建設(shè)網(wǎng)站長春網(wǎng)站建設(shè)平臺
  • 如何自己做攝影網(wǎng)站萬能搜索引擎網(wǎng)站
  • 微店網(wǎng)站鏈接怎么做seo外包是什么意思
  • 手工做衣服網(wǎng)站網(wǎng)站引流推廣怎么做
  • 手機(jī)h5制作小程序百度手機(jī)seo軟件
  • WordPress自定義計(jì)算小紅書seo排名
  • 重慶品牌網(wǎng)站建設(shè)電商自學(xué)網(wǎng)
  • wap手機(jī)網(wǎng)站源碼企業(yè)網(wǎng)站的作用有哪些
  • wordpress 更新很慢微信公眾號seo
  • 西安做的好的網(wǎng)站公司南昌seo全網(wǎng)營銷
  • 怎么創(chuàng)建網(wǎng)站 免費(fèi)的官網(wǎng)設(shè)計(jì)公司
  • 新企業(yè)在哪里做網(wǎng)站好關(guān)鍵詞推廣優(yōu)化排名品牌
  • wordpress文章頁面菜單優(yōu)化大師win7
  • 女女做的網(wǎng)站目前最新推廣平臺
  • 南通網(wǎng)站開發(fā)招聘按效果付費(fèi)的網(wǎng)絡(luò)推廣方式
  • html5手機(jī)網(wǎng)站開發(fā)區(qū)別百度快照推廣
  • 建設(shè)網(wǎng)站必備條件長春網(wǎng)站建設(shè)推廣
  • 大于二高端網(wǎng)站建設(shè)新手seo入門教程
  • 網(wǎng)站標(biāo)簽怎么做重慶網(wǎng)站網(wǎng)絡(luò)推廣
  • 淄博北京網(wǎng)站建設(shè)手機(jī)百度搜索引擎入口
  • 做網(wǎng)站收費(fèi)標(biāo)準(zhǔn)哪個(gè)平臺可以免費(fèi)打廣告
  • 網(wǎng)站在建設(shè)時(shí)不容忽略的一些細(xì)節(jié)最權(quán)威的排行榜網(wǎng)站
  • 網(wǎng)站建設(shè)中模板下載武漢百度開戶代理
  • 百度搜索不到asp做的網(wǎng)站天津搜狗seo推廣
  • 網(wǎng)站建設(shè)哪個(gè)空間比較好網(wǎng)站怎么優(yōu)化到首頁
  • 上海簡站商貿(mào)有限公司seo基礎(chǔ)理論
  • 做任務(wù)傭金網(wǎng)站源碼互聯(lián)網(wǎng)營銷培訓(xùn)平臺
  • 公眾號編輯 wordpress魔貝課凡seo
  • 聚美優(yōu)品網(wǎng)站怎么做的最新的即時(shí)比分