
import { Feature } from "ol"
import { Circle as CircleStyle, Fill, Stroke, Style, Icon } from 'ol/style'
import { Draw, Modify, Snap } from 'ol/interaction'
import { Vector as VectorSource } from 'ol/source'
import { Vector as VectorLayer } from 'ol/layer'
import GeoJSON from "ol/format/GeoJSON"
import { boundingExtent } from 'ol/extent'
import { Point } from 'ol/geom'
`// 初始化
init (type) {
`//type为绘制类型``
//清除次图层
if (_that.iconLayer) {
}
// 移除绘制方法
Map.removeInteraction(_that.draw)
Map.removeInteraction(_that.snap)
// 创建矢量容器
_that.source = new VectorSource()
//创建矢量层
_that.iconLayer = new VectorLayer({
})
//创建绘制修改工具
const modify = new Modify({ source: _that.source })
//添加
Map.addInteraction(modify)
//绑定修改绘制图形触发事件
modify.on('modifyend', this.ModifyIconEnd)
//添加绘制工具
_that.addInteractions()
_that.draw = new Draw({
})
// 此方法用于保存拓扑关系
_that.snap = new Snap({ source: _that.source })
// 添加
Map.addInteraction(_that.draw)
Map.addInteraction(_that.snap)
// 监听绘制结束事件
_that.draw.on("drawend", (evt) =>{
// 获取绘制图形,其余同修改时处理数据
let featureGeoJson = new GeoJSON().writeFeature(evt.feature)
})
//图层添加至地图
Map.addLayer(_that.iconLayer)
},
//样式函数
styleFunction (feature) {
const styles = [
]
// 此处添加箭头样式,绘制线绘制箭头
if (this.type == 'LineString' &&this.operate == 'arrow') {
}
//返回样式
return styles
},
// 修改图形
ModifyIconEnd (evt) {
const _that = this
// 获取修改后的图形,并保存
let featureGeoJson = new GeoJSON().writeFeature(evt.features.array_[0])
this.featureData = featureGeoJson
//绘制为圆时,无法通过geoJson回显,获取半径和中点回显
if (_that.type == 'Circle') {
// 圆的半径换算
}
//绘制线段取绘制次序中点备用
else if (_that.type == 'LineString') {
}
//绘制区域时获取其中点
else if (_that.type == 'Polygon') {
//获取边界值
}
},
Arcgis把图片放在填充在地图里,教程如下。1.png加载到地图上是不可能的,图像本身是没有地理信息的。这里采用一种办法,在地图上创建一个图形图层,图形图层放一个矩形,给这个矩形用一个图片填充符号填充。
2.填充符号的大小调整:获取那个矩形,左上角和右上角的横行长度来调整图形填充符号的长度,左下角和左上角间的纵向长度来调整图形填充符号的宽度。
3.填充符号的偏移量:调整符号的偏移,防止图片的填充出现不在区域正中央。
把地图导入CAD中,最简便、快捷的方法是先使用截图工具截出你所要的地图,然后打开CAD软件,新建一个图纸,使用ctrl+V组合键,把地图粘贴到CAD软件中就可以了。图纸可以在CAD中任意地拖大或缩小。欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)