i'm trying to figure out, how to set a marker programatoically via the pointSelectListener listener.
In my backing bean i used this code:
Code: Select all
public void onPointSelect(PointSelectEvent event) {
LatLng latlng = event.getLatLng();
Marker marker = new Marker(latlng);
model.addOverlay(marker);
addMessage(new FacesMessage(FacesMessage.SEVERITY_INFO, "Point and Marker selected and set", "Lat:" + latlng.getLat() + ", Lng:" + latlng.getLng()));
}
Code: Select all
<p:gmap center="41.381542, 2.122893" zoom="15" type="ROADMAP"
style="width:600px;height:400px" model="#{mapBean.model}"
stateChangeListener="#{mapBean.onStateChange}" onStateChangeUpdate="messages"
pointSelectListener="#{mapBean.onPointSelect}" onPointSelectUpdate="messages"
/>
Any hints? Is there a way, that i can even allow setting markers, or polygons via links? i mean one link "marker" the seconde linke "polygon". when i click "marker" i have the possibility to add markers do my map, if i click "polygon" i can add polygons to my map.
Greetings and thank you,
Ramo