小编Kir*_*k g的帖子

鼠标右键单击Openlayer 3

是否可以在Openlayer3上获得鼠标右键单击事件?如果是这样,我如何获得右键单击位置的纬度和经度.

我通过以下方式获得了右键单击事件

map.getViewport().addEventListener('contextmenu', function (evt) {

});
Run Code Online (Sandbox Code Playgroud)

如何获得右键点的纬度和经度?

mouseevent coordinates openlayers-3 ol3-google-maps

4
推荐指数
1
解决办法
1786
查看次数

如何在Openlayer 3的层中添加Custom Html dom元素

我使用过Google api Overlayviews.我能够使用像素值在latlng位置添加带有html div元素的自定义叠加层.

USGSOverlay.prototype.draw = function() {
var overlayProjection = this.getProjection();
var sw = overlayProjection.fromLatLngToDivPixel(this.bounds_.getSouthWest());
var ne = overlayProjection.fromLatLngToDivPixel(this.bounds_.getNorthEast());
var div = this.div_;
div.style.left = sw.x + 'px';
div.style.top = ne.y + 'px';
div.style.width = (ne.x - sw.x) + 'px';
 div.style.height = (sw.y - ne.y) + 'px';
      };
Run Code Online (Sandbox Code Playgroud)

现在我正在使用OpenLayer 3.是否有任何选项可以使用像素值在特定位置添加自定义div元素(如标记).每次放大或缩小地图时,我都可以找到像素位置并更新div元素的顶部和左侧,使其看起来位于正确的位置.在OpenLayer3中是否有任何可能.

custom-overlay openlayers-3 custom-element

3
推荐指数
1
解决办法
1797
查看次数

用C语言格式化浮点值

我需要打印.50.5使用printfC语言的语句.可以使用以下代码轻松完成.

printf("%03f", myfloatvalue);
Run Code Online (Sandbox Code Playgroud)

但情况myfloatvalue是动态的.所以,我不知道它是否是一个3字符数,也可能是.5.56.567.在上述情况下,我需要打印的0.5,0.560.567.

c printf output-formatting

1
推荐指数
1
解决办法
375
查看次数