2

Is there a good way to integrate a google map to the apache openmeetings 2.0? I search it and find use about openlaszlo http://code.google.com/p/openlaszloincubator/source/browse/trunk/googlemapsonlaszlo/?r=32#googlemapsonlaszlo%253Fstate%253Dclosed and the site http://code.google.com/p/openmeetings/source/browse/trunk/singlewebapp/WebContent/lps/components/incubator/googlemap.lzx?r=3529 which don't base on openmeetings 2.0! Does any one realize it?

raju-bitter
  • 8,906
  • 4
  • 42
  • 53
feythin
  • 41
  • 7

1 Answers1

2

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 Maps example

raju-bitter
  • 8,906
  • 4
  • 42
  • 53
  • thx, Raju Bitter! I write a lzx file . when it show the window ,it can't load the html. and show the warning "WARNING @extensions/html.lzx≈29: reference to undefined property '[]' " is there anything I did wrong? – feythin Nov 14 '12 at 03:26
  • I added an example LZX application with corresponding HTML file containing the Google Maps code to my answer. – raju-bitter Nov 14 '12 at 14:27
  • thx for your suggestion! The code what you give above in LZX file have a canvas tag.the openmeetings only have only have one canvas tag which in the main.lzx. so my question is how to intergrate it into the openmeetings application not open a new one! thx! – feythin Nov 15 '12 at 02:08
  • As we know that the whiteboard is shared that any one in the room can see it .is there a possible the we share the gmaps for everyone? so that we can scrawl on the map . – feythin Nov 15 '12 at 03:02
  • For the OpenMeetings whiteboard integration, it's probably better to ask the question in the OpenMeetings developer mailing list. Integrating this LZX code into an existing canvas is simple copy and paste, I don't know what the dependencies for the whiteboard are. If you want to draw on the map, there's a technical limitation with iFrames and Flash movies, since you cannot place Flash views over the iFrame content. As a workaround, you could use the Static Maps API https://developers.google.com/maps/documentation/staticmaps/ and set the image as a resource of a view in OpenLaszlo. – raju-bitter Nov 15 '12 at 19:06
  • I put the html file(gmaps.html) together with the LZX file in the same folder,and set the html tag src value gmaps.html ,but it also show the warning @extensions/html.lzx≈29: reference to undefined property '[]'. and can't show the map. – feythin Nov 16 '12 at 03:36
  • Which version of OpenLaszlo are you using? I'm using 5.0 trunk, and I've tested with Chrome and Firefox, haven't tested with IE. – raju-bitter Nov 16 '12 at 10:44
  • openlaszlo-4.9.0 ,it work fine in Openlaszlo app,but doesn't work in openmeetings2,I think may be the openmeetings problems~ – feythin Nov 16 '12 at 11:36
  • hi,raju-bitter!I run the this http://localhost:8080/openlaszlo-4.9.0/examples/googlemap/showmap.lzx it work fine,however I compile the lzx file to swf with swf8 SOLO ,and run this http://localhost:8080/openlaszlo4.9.0/examples/googlemap/showmap.lzx.swf8.swf?lzproxied=false it show the warning WARNING @extensions/html.lzx≈29: reference to undefined property '[]' WARNING: create undefined – feythin Nov 20 '12 at 03:25
  • That sounds like you are generating the SWF8 SOLO swf file and load it into the browser. That's not going to work. You HAVE to use a valid embedding HTML page, e.g. the one generate when you compile the application using `your_lzx_file.lzx?lzr=swf8&proxied=false&lzt=html`. Open the HTML source code and save the file, open it again in the browser and the application will work without problems. I've tested with WinXP/IE8, and Chrome on Linux on windows. – raju-bitter Nov 20 '12 at 08:54