Google maps 使用Atmosphere.js数据过滤gmap标记
我想用类似Atmosphere.js的推送消息在谷歌地图上设置标记的位置。我可以将新的LatLng数据发送到页面,我可以过滤公司(比如subscribe),但我不知道如何过滤正确的标记来设置它的新位置。哪条路最好。我需要你的建议Google maps 使用Atmosphere.js数据过滤gmap标记,google-maps,primefaces,google-maps-markers,publish-subscribe,atmosphere.js,Google Maps,Primefaces,Google Maps Markers,Publish Subscribe,Atmosphere.js,我想用类似Atmosphere.js的推送消息在谷歌地图上设置标记的位置。我可以将新的LatLng数据发送到页面,我可以过滤公司(比如subscribe),但我不知道如何过滤正确的标记来设置它的新位置。哪条路最好。我需要你的建议 <ui:composition template="../template/template.xhtml"> <ui:define name="title"> <h:outputText value=""&g
<ui:composition template="../template/template.xhtml">
<ui:define name="title">
<h:outputText value=""></h:outputText>
</ui:define>
<ui:define name="body">
<h:form>
<p:remoteCommand name="updateList" update="gmap" process="@this"/>
<p:socket onMessage="handleMessage" channel="/refreshcordinates/#{haritaBean.companyId}" autoConnect="true"/>
<p:growl id="growl" life="3000" />
<p:gmap widgetVar="gMap" id="gmap" center="40.74634,30.67725" zoom="18" type="ROADMAP" style="width:100%;height:800px" model="#{haritaBean.GetCoordinates()}" streetView="true">
</p:gmap>
</h:form>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&key=myKey"></script>
<script type="text/javascript">
function handleMessage(data) {
var gMap = PF("gMap").getMap();
gMap.markers[0].setPosition(new google.maps.LatLng(parseFloat(data.lat), parseFloat(data.lng)));
</script>
</ui:define>
</ui:composition>
private MapModel simpleModel;
public MapModel GetCoordinates() {
simpleModel = new DefaultMapModel();
LatLng coord = new LatLng(40.74634, 30.67725);
LatLng coord1 = new LatLng(35.74634, 30.67725);
simpleModel.addOverlay(new Marker(coord, "Konyaalti", "zelenjava.png"));
simpleModel.addOverlay(new Marker(coord1, "Konyaalti","zelenjava.png"));
return simpleModel;
}