简体   繁体   English

JSF PrimeFaces在Google地图上选择

[英]JSF PrimeFaces select on google map

Is it possible to select via mouse click a rectangle part of google map using JSF PimeFaces <p:gmap> or any other JSF solution and to get it top-left and bottom-right coordinates, like here in jQuery sample: http://jsfiddle.net/JsAJA/3/ 是否可以通过鼠标单击使用JSF PimeFaces <p:gmap>或任何其他JSF解决方案的Google地图的矩形部分进行选择并使其获得左上角和右下角的坐标,如jQuery示例中的此处所示: http:// jsfiddle.net/JsAJA/3/

在此处输入图片说明

I think that without using javascript it is impossible. 我认为,如果不使用JavaScript,那是不可能的。

You can access google map in primeface component in the JS and then manually add all listeners to handle with your rectangle: 您可以在JS的primeface组件中访问google map,然后手动添加所有侦听器以使用矩形进行处理:

//<![CDATA[
function initMap(){
    var map = gmtls.getMap();
    //and now add listeners like:
    google.maps.event.addListener(map, 'mousedown', function(mEvent) {
        //and body of the listener
    });   
}
//]]>

<h:body onload="initMap();">
    <center>
        <h:form>  
            <p:gmap widgetVar="gmtls" center="41.381542, 2.122893" zoom="15" type="hybrid" style="width:600px;height:400px" />
        </h:form>  
    </center>
</h:body>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM