openlayer封装集成vue_pSty.js

import $ from 'jquery'
import {o} from './pObj'

var sty = window.sty
if (!window.sty) {
window.sty = {}
sty = function () {

}
}


///95598工單
sty.prototype.orderSty9598 = function (feature) {
return new ol.style.Style({ //style样式
image: new ol.style.Circle({ //设置填充
radius: 8, //5为像素
fill: new ol.style.Fill({
color: 'rgba(1,179,219,1)'///rgba(113,182,215,1)
}),
stroke: new ol.style.Stroke({
color: 'rgba(0,171,255,0.45)',
width: 12
})
}),
zIndex: 1000
})
// } else {
// return null;
// }
}
sty.prototype.peoStyleFun = function (feature) {
if (o.peopleShow) {
return new ol.style.Style({
image: new ol.style.Icon({
src: require("../img/allPup/gz.png"),
scale: 0.9,
anchor: [0.5, 0.8],
}),
});
} else {
return null;
}
}

 

//省 边界高亮样式
sty.prototype.styleFunctionp = function (feature, resolution) {
if (resolution < 301) {
return null
}
var isHigh = feature.get('MOUSEHIGHLIGHT')
var fill = new ol.style.Fill({
color: [244, 244, 244, 0.1]
})
var stroke = new ol.style.Stroke({
color: [255, 255, 255, 0.1],
width: 0.1
})
if (isHigh == 1) {
fill = new ol.style.Fill({
color: [0, 143, 139, 0.1]
})
stroke = new ol.style.Stroke({
color: [0, 143, 139, 1],
width: 2
})
}
return new ol.style.Style({
stroke: stroke,
fill: fill
})
}
//市 边界高亮样式
sty.prototype.styleFunctionm = function (feature, resolution) {
if (resolution > 300 || resolution < 184) {
return null
}
var isHigh = feature.get('MOUSEHIGHLIGHT')
var fill = new ol.style.Fill({
color: [244, 244, 244, 0.1]
})
var stroke = new ol.style.Stroke({
color: [255, 255, 255, 0.1],
width: 0.1
})
if (isHigh == 1) {
fill = new ol.style.Fill({
color: [0, 143, 139, 0.1]
})
stroke = new ol.style.Stroke({
color: [0, 143, 139, 1],
width: 2
})
}
return new ol.style.Style({
stroke: stroke,
fill: fill
})
}
//区县 边界高亮样式
sty.prototype.styleFunctionc = function (feature, resolution) {
if (resolution > 290 || resolution < 140) {
return null;
}
var isHigh = feature.get("MOUSEHIGHLIGHT");
var fill = new ol.style.Fill({
color: [244, 244, 244, 0.1]
});
var stroke = new ol.style.Stroke({
color: [255, 255, 255, 0.1],
width: 0.1
});
if (isHigh == 1) {
fill = new ol.style.Fill({
color: [0, 143, 139, 0.1]
});
stroke = new ol.style.Stroke({
color: [0, 143, 139, 1],
width: 2
});
}
return new ol.style.Style({
stroke: stroke,
fill: fill
})
};
//边界高亮样式
sty.prototype.styleFunctioncs = function (feature, resolution) {
if (resolution > 290 || resolution < 10) {
return null;
}
var isHigh = feature.get("MOUSEHIGHLIGHT");
var fill = new ol.style.Fill({
color: [240, 240, 240, 0.1]
});
var stroke = new ol.style.Stroke({
color: [0, 143, 139, 1],
width: 2
});
if (isHigh == 1) {
fill = new ol.style.Fill({
color: [240, 240, 240, 0.1]
});
stroke = new ol.style.Stroke({
color: [0, 143, 139, 1],
width: 2
});
}
return new ol.style.Style({
stroke: stroke,
fill: fill
})
};
//设置鼠标光标样式
//cursorType:0默认箭头形,1手型
sty.prototype.setMouseIcon = function (divElement, cursorType) {
//获取地图控件所在的div元素
if (cursorType == 1) {
$(divElement).css('cursor', 'pointer')
} else {
$(divElement).css('cursor', 'default')
}
}

var s = new sty()
export {s}

posted @ 2023-03-03 10:30  A影子放風箏  阅读(27)  评论(0)    收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css