1
我希望能够在地图上绘制一个圆,并在绘制圆时将圆的半径显示在圆上或其他位置。我想让它在我画圆的时候改变,所以我可以看到这个半径。任何方式在openlayers中做到这一点?在openlayers.js中,有没有办法在绘制该圆时显示圆的半径?
我希望能够在地图上绘制一个圆,并在绘制圆时将圆的半径显示在圆上或其他位置。我想让它在我画圆的时候改变,所以我可以看到这个半径。任何方式在openlayers中做到这一点?在openlayers.js中,有没有办法在绘制该圆时显示圆的半径?
的一种方法是创建一个MapToolTip
我制成一个围绕跟随鼠标在偏离设定位置。基本上它是一个绝对位置风格的div,在mousemove
上更新。
var MyAPP = MyAPP || {};
MyAPP.MapToolTip = function (position, text) {
var content = '<div id="tool_tip" class="dropSheet ui-corner-all"><span id="info_window_text">' + text + '</span></div>';
var toolTip = $(content).hide().appendTo('div#wrapper div#content_wrapper');
toolTip.IsVisible = false;
var mouseMove = function (e) {
if (toolTip.IsVisible) {
toolTip.fadeIn()
}
toolTip.css('top', e.clientY + 30);
toolTip.css('left', e.clientX + 30);
toolTip.IsVisible = true;
};
this.Destroy = function() {
MyAPP.UI.Map.getMap().events.unregister("mousemove", MyAPP.UI.Map.getMap(), mouseMove);
toolTip.IsVisible = null;
toolTip.fadeOut();
toolTip.remove();
content = null;
toolTip = null;
mouseMove = null;
};
MyAPP.UI.Map.getMap().events.register("mousemove", MyAPP.UI.Map.getMap(), mouseMove);
return;
};
.dropSheet {
background-color: #000000;
background-image: none;
opacity: 0.6;
}
div#info_window {
color: White;
font-family: Verdana,Arial;
font-size: 0.6em;
left: 490px;
padding: 6px;
position: absolute;
top: 100px;
width: 220px;
z-index: 99;
}