Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 使用Atmosphere.js数据过滤gmap标记_Google Maps_Primefaces_Google Maps Markers_Publish Subscribe_Atmosphere.js - Fatal编程技术网

Google maps 使用Atmosphere.js数据过滤gmap标记

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

我想用类似Atmosphere.js的推送消息在谷歌地图上设置标记的位置。我可以将新的LatLng数据发送到页面,我可以过滤公司(比如subscribe),但我不知道如何过滤正确的标记来设置它的新位置。哪条路最好。我需要你的建议

    <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&amp;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;
}