简体   繁体   中英

Is there a good way to integrate a google map to the apache openmeetings 2.0?

有没有什么好办法把google map 集成到apache openmeetings 2.0? 我搜了一下,找到了openlaszlo http://code.google.com/p/openlaszloincubator/source/browse/trunk/googlemapsonlaszlo/?r=32 #googlemapsonlaszlo%253Fstate%253Dclosed和网站http://code.google.com/p/openmeetings/source/browse/trunk/singlewebapp/WebContent/lps/components/incubator/googlemap.lzx?r=3529没有基于openmeetings 2.0!有人实现了吗?

Google has deprecated the Google Maps Flash APIs in late 2011 .

"Consequently we have decided to deprecate the Maps API for Flash in order to focus our attention on the JavaScript Maps API v3 going forward. This means that although Maps API for Flash applications will continue to function in accordance with the deprecation policy given in the Maps API Terms of Service, no new features will be developed, and only critical bugs, regressions, and security issues will be fixed. We will continue to provide support to existing Google Maps API Premier customers using the Maps API for Flash, but will wind down Developer Relations involvement in the Maps API for Flash forum."

Therefore - if you are not already an existing Google Maps API Premier customer - you will not be able to utilize the Google Maps OpenLaszlo component in the incubator . You should instead use the Google JavaScript Maps API v3 . The map object can be integrated using the <html /> tag in the SWF runtime. If you only plan to use the DHTML runtime you could attach the map object directly to the display object of a view.

Since the current version of OpenMeetings still seems to use the SWF runtime as the default target runtime, that leaves you with the option of using an iFrame through the <html src="" /> tag.

Here is a simple example based on the code you had in your comment. The example uses two files: One LZX file, and one HTML file containing the Google Maps example. Here is the LZX code:

<canvas height="500">

  <class name="showGISWindow"
     extends="view"
     width="464" height="440">
    <method name="setLatLong" args="lat,lng">
        this.maps.callJavascript('centerMap(' + lat + ', ' + lng + ')' );
    </method>

    <button text="Show New York"
            align="center"
            onclick="parent.setLatLong(40.69847032728747, -73.9514422416687)" />

    <html name="maps" src="gmaps.html"
      x="15" y="45"
      width="${parent.width - 30}"
      height="${parent.height - 45}" />

  </class>

  <showGISWindow id="gis" x="10" y="10" />

</canvas>

And the corresponding gmaps.html page content, which is loaded into the iFrame:

<!DOCTYPE html>
<html>
  <head>
    <title>Google Maps JavaScript API v3 Example: Map Simple</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <style>
      html, body, #map_canvas {
        margin: 0;
        padding: 0;
        height: 100%;
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
    <script>
      var map;
      function initialize() {
        var mapOptions = {
          zoom: 8,
          center: new google.maps.LatLng(-34.397, 150.644),
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('map_canvas'),
            mapOptions);
      }

      function centerMap(lat, lng) {
        map.setCenter(new google.maps.LatLng(lat, lng));
        map.setZoom(11);
      }

      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </head>
  <body>
    <div id="map_canvas"></div>
  </body>
</html>

When the button is clicked, the OpenLaszlo apps calls the function centerMap(lat, lng) in the HTML page, and will center the map to New York. Here's a screenshot of the application in the SWF10 runtime:

OpenLaszlo Google 地图示例

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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