Google Maps Example : Using Latitudes and Longitudes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Google Maps Example : Using Latitudes and Longitudes

dario trussardi
Hi,

        i port some work based on GoogleMaps from seaside 2.8 to seaside 30.


        In the Pharo image based on GemTools-1.0b6 i  load the GoogleMaps-jgf.23.

        I update the GoogleMap class :

A) updateRoot: anHtmlRoot

        "anHtmlRoot javascript url: 'http://www.google.com/jsapi?key=' , GoogleMap apiKey." "The GoogleBar doesn't search with this library"
        anHtmlRoot javascript url: GMFileLibrary / 'googlemaps.js'.
        anHtmlRoot javascript url: PTDevelopmentLibrary /  'prototype.js'.  "SULibrary / 'prototype.js'."
        anHtmlRoot javascript url: SUDevelopmentLibrary / 'effects.js'.
        anHtmlRoot javascript url: SUDevelopmentLibrary / 'controls.js'.

        anHtmlRoot javascript
                url: 'http://maps.google.com/maps?file=api&v=2&key=' , GoogleMap apiKey , '&sensor=false';
                yourself.
        anHtmlRoot htmlAttributes
                at: 'xmlns:v' put: 'urn:schemas-microsoft-com:vml';
                yourself.
        anHtmlRoot bodyAttributes
                at: 'onunload' append: 'GUnload()' separator: ';';
                yourself.
 
B) renderOn: aRenderer

        | html session style |
        html := aRenderer.
        "html := WAAsyncRenderCanvas
                context: aRenderer context
                callbacks: (aRenderer context callbacksFor: self)."
        htmlID isNil ifTrue: [htmlID := html nextId].
        variable := (htmlID beginsWith: 'id')
                ifTrue: ['map' , (htmlID copyFrom: 3 to: htmlID size)]
                ifFalse: [htmlID].
        urlKey := html callbacks registerActionCallback: [self callback].
        actionURL := html context actionUrl printString.
        htmlClass = self defaultMapClass ifTrue: [style := 'height: 300px; width: 500px;'].
        html div
                id: htmlID;
                class: htmlClass;
                style: style;
                with: [
                        html
                                script: self mapScript;
                                html: '<noscript>The Google Map will not show because your browser does not support JavaScript!</noscript>';
                                yourself.
                ].
        (session := "port Sea 30 WACurrentSession"
                        WACurrentRequestContext value session ) notNil ifTrue: [
               
        " DTR port to seaside 30 session "
                html document addLoadScript:  self variable , 'Init()'.
        ].
 

I have some code based on Using Latitudes and Longitudes example with on: do: method

        ^GoogleMap new
                setCenter:  latRfr @ longRfr "45.5267 @ -122.8390" zoom: zoomRfr ;
                setUIToDefault;
                addScript: self markerScript;
                on: 'zoomEnd' do:[ :x :y :z |
                         'alert("Zoom from ' , x printString , ' to ' , y printString , ' (see GMUsingLatLong>>googleMap)");'.
                ];
                yourself.

Now i tested the Using Latitudes and Longitudes  example and the system after a zoomEnd

        open a dialogbox with:  

                readyState == 4 but xhr.status == 500


I think this is a problem.

Any pointers would be greatly appreciated !

        Dario