|
@@ -110,7 +110,8 @@
|
|
|
//新地图
|
|
|
var map = new AMap.Map('container', {
|
|
|
zoom: 4,
|
|
|
- mapStyle: "amap://styles/grey",
|
|
|
+ //mapStyle: "amap://styles/grey",
|
|
|
+ mapStyle: "amap://styles/8016abec658e1132508723183f848f14",
|
|
|
features: ['bg']
|
|
|
});
|
|
|
|
|
@@ -188,7 +189,7 @@
|
|
|
* 绘制一个蓝底白字的label替代聚合标注
|
|
|
*/
|
|
|
drawMyLabel: function(feature, dataItems) {
|
|
|
- if(dataItems.length != 0){
|
|
|
+ //if(dataItems.length != 0){
|
|
|
var pixelRatio = this.getPixelRatio(); //高清下存在比例放大
|
|
|
|
|
|
var containerPos = map.lngLatToContainer(feature.properties.centroid || feature.properties.center);
|
|
@@ -201,29 +202,38 @@
|
|
|
|
|
|
labelCtx.save();
|
|
|
|
|
|
- labelCtx.font = 12 * pixelRatio + 'px 微软雅黑';
|
|
|
+ labelCtx.font = 15 * pixelRatio + 'px 微软雅黑';
|
|
|
|
|
|
- var text = feature.properties.name + '\n' + dataItems.length + '';
|
|
|
+ var text = feature.properties.name ;//+ '\n' + dataItems.length;
|
|
|
|
|
|
var textMetrics = labelCtx.measureText(text);
|
|
|
|
|
|
var halfTxtWidth = textMetrics.width / 2;
|
|
|
|
|
|
- labelCtx.fillStyle = 'rgba(3 , 94 , 255 , 0.5)';//'#3366cc';
|
|
|
+ labelCtx.beginPath();
|
|
|
+ // labelCtx.fillStyle = 'rgba(3 , 94 , 255 , 0.5)';//'#3366cc';
|
|
|
+ labelCtx.fillStyle = 'rgba(12 , 239 , 231 , 0.8)';//'#3366cc';
|
|
|
//绘制一个蓝色背景
|
|
|
- labelCtx.fillRect(centerX - halfTxtWidth - 3 * pixelRatio,
|
|
|
- centerY - 11 * pixelRatio,
|
|
|
- textMetrics.width + 6 * pixelRatio,
|
|
|
- 22 * pixelRatio);
|
|
|
-
|
|
|
+ labelCtx.strokeStyle= "rgba(12 , 239 , 231 , 0.5)"
|
|
|
+ labelCtx.fillStyle = 'rgba(12 , 239 , 231 , 0.5)';
|
|
|
+ labelCtx.arc(centerX , centerY,
|
|
|
+ (textMetrics.width + 6 * pixelRatio) / 2,
|
|
|
+ 0*Math.PI,2*Math.PI,false);
|
|
|
+ labelCtx.closePath();
|
|
|
+ labelCtx.fill();
|
|
|
+ // labelCtx.fillRect(centerX - halfTxtWidth - 3 * pixelRatio,
|
|
|
+ // centerY - 11 * pixelRatio,
|
|
|
+ // textMetrics.width + 6 * pixelRatio,
|
|
|
+ // 22 * pixelRatio);
|
|
|
|
|
|
labelCtx.fillStyle = '#ffffff';
|
|
|
labelCtx.textBaseline = 'middle';
|
|
|
- labelCtx.stroke();
|
|
|
+ //labelCtx.stroke();
|
|
|
labelCtx.fillText(text, centerX - halfTxtWidth, centerY);
|
|
|
-
|
|
|
+ labelCtx.fillText(dataItems.length , centerX - 4, centerY + 15);
|
|
|
+ labelCtx.stroke();
|
|
|
labelCtx.restore();
|
|
|
- }
|
|
|
+ //}
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -247,7 +257,8 @@
|
|
|
featureClickToShowSub: true,
|
|
|
featureStyle: {
|
|
|
lineWidth: 2, //描边线宽
|
|
|
- strokeStyle: 'rgba(31, 119, 180, 0.8)', //描边色
|
|
|
+ // strokeStyle: 'rgba(0, 119, 180, 0.5)', //描边色
|
|
|
+ strokeStyle: 'rgba(75, 143, 239, 0.5)', //描边色
|
|
|
//鼠标Hover后的样式
|
|
|
hoverOptions: {
|
|
|
fillStyle: 'rgba(255,255,255,0.2)'
|