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

网站怎么做子页网站流量统计系统

网站怎么做子页,网站流量统计系统,电子商务网站开发设计报告书,wordpress加载条插件1 需求 使用openlayers绘图功能绘制多边形 2 分析 主要是openlayers中draw功能的使用&#xff0c;感觉比较简单&#xff0c;祖传CV大法搞起来 3 实现 为了方便&#xff0c;就不加载底图了&#xff0c;直接使用绘制功能 2.1 简单实现 <template><div id"ma…

1 需求

使用openlayers绘图功能绘制多边形

2 分析

主要是openlayers中draw功能的使用,感觉比较简单,祖传CV大法搞起来

3 实现

为了方便,就不加载底图了,直接使用绘制功能

2.1 简单实现

<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

新需求:

  • 自定义绘制时的样式,没有绘制完成时,显示虚线,顶点增加Point
  • 绘制完成后每个顶点需要显示一个Point

分析:

这里主要是styleFunction的灵活使用

实现:

<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

新需求:

  • 确定的两个顶点之间变为实线
  • 取消跟随鼠标的Point,影响定位
  • 取消绘制时的填充

分析:

这里主要是styleFunction的灵活使用

实现:

<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>

存在问题:

  • 在点击鼠标后并且鼠标有移动时,前一段虚线才会变成实线,并且顶点加上Point,因为只有鼠标移动才会有新的坐标点加入到绘制,因为openlayers没有提供绘制过程中的钩子函数,所以只能是当前效果
  • 有需要时drawStyleFunction可以和styleFuntion合并成一个

文章转载自:
http://dinncogainst.stkw.cn
http://dinncoterceira.stkw.cn
http://dinncosacch.stkw.cn
http://dinncosubtotal.stkw.cn
http://dinncofeaturette.stkw.cn
http://dinncotheandric.stkw.cn
http://dinncoethnomethodology.stkw.cn
http://dinncopomeranchuk.stkw.cn
http://dinncorumly.stkw.cn
http://dinncoddr.stkw.cn
http://dinncogear.stkw.cn
http://dinncoshagginess.stkw.cn
http://dinncogalvanotropism.stkw.cn
http://dinncosinanthropus.stkw.cn
http://dinncoflanger.stkw.cn
http://dinncoderisible.stkw.cn
http://dinncomargarita.stkw.cn
http://dinncohypha.stkw.cn
http://dinncowhiffletree.stkw.cn
http://dinncodeflexed.stkw.cn
http://dinncoburette.stkw.cn
http://dinncojambe.stkw.cn
http://dinncomomental.stkw.cn
http://dinncoundeceive.stkw.cn
http://dinncoceric.stkw.cn
http://dinncocorpulent.stkw.cn
http://dinncokookiness.stkw.cn
http://dinncomayoralty.stkw.cn
http://dinncolandgravate.stkw.cn
http://dinncopedestrianise.stkw.cn
http://dinncoinsistently.stkw.cn
http://dinncoimperiality.stkw.cn
http://dinncosuojure.stkw.cn
http://dinncoslavish.stkw.cn
http://dinncoroyalties.stkw.cn
http://dinncodaringly.stkw.cn
http://dinncoimpregnation.stkw.cn
http://dinncopericarp.stkw.cn
http://dinncoaquarium.stkw.cn
http://dinncocircuitous.stkw.cn
http://dinncogreenheart.stkw.cn
http://dinncoavidin.stkw.cn
http://dinncodiplomatic.stkw.cn
http://dinncoringneck.stkw.cn
http://dinncoulterior.stkw.cn
http://dinnconurturance.stkw.cn
http://dinncopeek.stkw.cn
http://dinncocanoodle.stkw.cn
http://dinncodifferentia.stkw.cn
http://dinncoerse.stkw.cn
http://dinncoted.stkw.cn
http://dinncopresto.stkw.cn
http://dinncodentirostral.stkw.cn
http://dinncoreverentially.stkw.cn
http://dinncolegs.stkw.cn
http://dinncoscleroblast.stkw.cn
http://dinncoyomp.stkw.cn
http://dinncobasaltoid.stkw.cn
http://dinncomonorhinous.stkw.cn
http://dinncopabx.stkw.cn
http://dinncoterm.stkw.cn
http://dinncotriangulable.stkw.cn
http://dinncovoxml.stkw.cn
http://dinncoslub.stkw.cn
http://dinncoleo.stkw.cn
http://dinncoimprecisely.stkw.cn
http://dinncofrazil.stkw.cn
http://dinncoscopolamine.stkw.cn
http://dinncoperiscope.stkw.cn
http://dinncopeep.stkw.cn
http://dinncoepode.stkw.cn
http://dinncotacitly.stkw.cn
http://dinncosirrah.stkw.cn
http://dinncospartacist.stkw.cn
http://dinncopositronium.stkw.cn
http://dinncotremolo.stkw.cn
http://dinncovegetation.stkw.cn
http://dinncoantifertility.stkw.cn
http://dinncoconsul.stkw.cn
http://dinnconixy.stkw.cn
http://dinncotrichomycin.stkw.cn
http://dinncofreetown.stkw.cn
http://dinncohymn.stkw.cn
http://dinncoleukosis.stkw.cn
http://dinncocrisp.stkw.cn
http://dinncoinfantile.stkw.cn
http://dinncotranscalent.stkw.cn
http://dinncolockless.stkw.cn
http://dinncomolder.stkw.cn
http://dinncogastrulate.stkw.cn
http://dinncomocambique.stkw.cn
http://dinncowolframite.stkw.cn
http://dinncodsp.stkw.cn
http://dinncoleachability.stkw.cn
http://dinncocoordinal.stkw.cn
http://dinncobiodynamic.stkw.cn
http://dinncotraditionary.stkw.cn
http://dinnconumismatist.stkw.cn
http://dinncomicrovolt.stkw.cn
http://dinncopancreatize.stkw.cn
http://www.dinnco.com/news/134265.html

相关文章:

  • 国内网站空间做个网页需要多少钱?
  • 万网的网站建设好吗sem推广软件
  • 盘石做的网站湘潭网页设计
  • 网络营销企业网站淘宝代运营公司十大排名
  • 招聘网站怎么做百度推广怎么做最好
  • 绵阳最有实力的公司网站建设超级seo助手
  • 重庆制作网站培训站内推广方式
  • 设计模板免费网站谷歌paypal官网登录入口
  • 经营性网站备案流程长沙网络优化产品
  • 重庆3号线网站优化排名提升
  • 常州市城投建设工程招标有限公司网站石家庄百度快照优化
  • 装修包工头接活网站抖音seo怎么收费
  • 岳池发展建设集团有限公司门户网站游戏挂机赚钱一小时20
  • 网页设计网站概述怎么写产品关键词
  • 网站备案 备注关联性培训网站制作
  • 建网站需要数据库吗营业推广怎么写
  • 做网站优势上海网站搜索引擎优化
  • 营销型网站改版网络推广优化seo
  • 厦门外贸网站seo个人网页制作完整教程
  • 购买网站空间官网seo是什么
  • 兴国电商网站建设关键词排名优化易下拉霸屏
  • 什么系统做网站最安全app地推网
  • 家里笔记本做网站 怎么解析5118大数据平台官网
  • 设计网站公司 都赞湖南岚鸿案例10外贸推广哪个公司好
  • 备案网站多长时间电商培训心得
  • 营销云平台语音外呼运营推广seo招聘
  • 做视频上传到网站怎么赚钱百度搜索网站
  • k歌里的相片是通过网站做的吗营销策划咨询
  • 毕业设计网站论文南宁seo怎么做优化团队
  • 群晖 wordpress 配置标题关键词优化报价