[OpenLayers-Commits] r11181 - in sandbox/bartvde/sencha/openlayers: examples examples/map examples/map/plugins lib lib/GeoExt lib/GeoExt/widgets

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Feb 21 09:03:26 EST 2011


Author: bartvde
Date: 2011-02-21 06:03:25 -0800 (Mon, 21 Feb 2011)
New Revision: 11181

Added:
   sandbox/bartvde/sencha/openlayers/examples/map/
   sandbox/bartvde/sencha/openlayers/examples/map/icon.png
   sandbox/bartvde/sencha/openlayers/examples/map/index.html
   sandbox/bartvde/sencha/openlayers/examples/map/index.js
   sandbox/bartvde/sencha/openlayers/examples/map/phone_startup.png
   sandbox/bartvde/sencha/openlayers/examples/map/plugins/
   sandbox/bartvde/sencha/openlayers/examples/map/plugins/GmapTracker.js
   sandbox/bartvde/sencha/openlayers/examples/map/plugins/GmapTraffic.js
   sandbox/bartvde/sencha/openlayers/examples/map/point.png
   sandbox/bartvde/sencha/openlayers/examples/map/shadow.png
   sandbox/bartvde/sencha/openlayers/examples/map/tablet_startup.png
   sandbox/bartvde/sencha/openlayers/lib/GeoExt/
   sandbox/bartvde/sencha/openlayers/lib/GeoExt/widgets/
   sandbox/bartvde/sencha/openlayers/lib/GeoExt/widgets/Map.js
Log:
work in progress

Added: sandbox/bartvde/sencha/openlayers/examples/map/icon.png
===================================================================
(Binary files differ)


Property changes on: sandbox/bartvde/sencha/openlayers/examples/map/icon.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/bartvde/sencha/openlayers/examples/map/index.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/examples/map/index.html	                        (rev 0)
+++ sandbox/bartvde/sencha/openlayers/examples/map/index.html	2011-02-21 14:03:25 UTC (rev 11181)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">	
+    <title>Map</title>
+	<link rel="stylesheet" href="../../resources/css/sencha-touch.css" type="text/css">
+    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
+	<script type="text/javascript" src="../../sencha-touch.js"></script>
+	<script type="text/javascript" src="plugins/GmapTracker.js"></script>
+	<script type="text/javascript" src="plugins/GmapTraffic.js"></script>
+	<script type="text/javascript" src="index.js"></script>
+</head>
+<body>
+</body>
+</html>

Added: sandbox/bartvde/sencha/openlayers/examples/map/index.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/examples/map/index.js	                        (rev 0)
+++ sandbox/bartvde/sencha/openlayers/examples/map/index.js	2011-02-21 14:03:25 UTC (rev 11181)
@@ -0,0 +1,125 @@
+Ext.setup({
+    tabletStartupScreen: 'tablet_startup.png',
+    phoneStartupScreen: 'phone_startup.png',
+    icon: 'icon.png',
+    glossOnIcon: false,
+    onReady: function() {
+
+        // The following is accomplished with the Google Map API
+        var position = new google.maps.LatLng(37.44885,-122.158592),  //Sencha HQ
+
+            infowindow = new google.maps.InfoWindow({
+                content: 'Sencha Touch HQ'
+            }),
+
+                //Tracking Marker Image
+                image = new google.maps.MarkerImage(
+                    'point.png',
+                    new google.maps.Size(32, 31),
+                    new google.maps.Point(0,0),
+                    new google.maps.Point(16, 31)
+                  ),
+
+                shadow = new google.maps.MarkerImage(
+                    'shadow.png',
+                    new google.maps.Size(64, 52),
+                    new google.maps.Point(0,0),
+                    new google.maps.Point(-5, 42)
+                  ),
+
+            trackingButton = Ext.create({
+               xtype   : 'button',
+               iconMask: true,
+               iconCls : 'locate'
+            } ),
+
+            toolbar = new Ext.Toolbar({
+                    dock: 'top',
+                    xtype: 'toolbar',
+                    ui : 'light',
+                    defaults: {
+                        iconMask: true
+                    },
+                    items : [
+                    {
+                      position : position,
+                      iconCls  : 'home',
+                      handler : function(){
+                      //disable tracking
+                          trackingButton.ownerCt.setActive(trackingButton, false);
+                          mapdemo.map.panTo(this.position);
+                      }
+                    },{
+                   xtype : 'segmentedbutton',
+                   allowMultiple : true,
+                   listeners : {
+                       toggle : function(buttons, button, active){
+                          if(button.iconCls == 'maps' ){
+                              mapdemo.traffic[active ? 'show' : 'hide']();
+                          }else if(button.iconCls == 'locate'){
+                              mapdemo.geo[active ? 'resumeUpdates' : 'suspendUpdates']();
+                          }
+                       }
+                   },
+                   items : [
+                        trackingButton,
+                            {
+                                   iconMask: true,
+                                   iconCls: 'maps'
+                                }
+                    ]
+                }]
+                });
+
+        mapdemo = new Ext.Map({
+
+            mapOptions : {
+                center : new google.maps.LatLng(37.381592, -122.135672),  //nearby San Fran
+                zoom : 12,
+                mapTypeId : google.maps.MapTypeId.ROADMAP,
+                navigationControl: true,
+                navigationControlOptions: {
+                        style: google.maps.NavigationControlStyle.DEFAULT
+                    }
+            },
+
+            plugins : [
+                new Ext.plugin.GMap.Tracker({
+                        trackSuspended : true,   //suspend tracking initially
+                        highAccuracy   : false,
+                        marker : new google.maps.Marker({
+                            position: position,
+                            title : 'My Current Location',
+                            shadow: shadow,
+                            icon  : image
+                          })
+                }),
+                new Ext.plugin.GMap.Traffic({ hidden : true })
+            ],
+
+            listeners : {
+                maprender : function(comp, map){
+                    var marker = new google.maps.Marker({
+                                     position: position,
+                                     title : 'Sencha HQ',
+                                     map: map
+                                });
+
+                                google.maps.event.addListener(marker, 'click', function() {
+                                     infowindow.open(map, marker);
+                                });
+
+                    setTimeout( function(){ map.panTo (position); } , 1000);
+                }
+
+            }
+        });
+
+        new Ext.Panel({
+            fullscreen: true,
+            dockedItems: [toolbar],
+            items: [mapdemo]
+        });
+
+    }
+});
\ No newline at end of file

Added: sandbox/bartvde/sencha/openlayers/examples/map/phone_startup.png
===================================================================
(Binary files differ)


Property changes on: sandbox/bartvde/sencha/openlayers/examples/map/phone_startup.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/bartvde/sencha/openlayers/examples/map/plugins/GmapTracker.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/examples/map/plugins/GmapTracker.js	                        (rev 0)
+++ sandbox/bartvde/sencha/openlayers/examples/map/plugins/GmapTracker.js	2011-02-21 14:03:25 UTC (rev 11181)
@@ -0,0 +1,269 @@
+
+Ext.ns('Ext.plugin.GMap');
+
+Ext.plugin.GMap.Tracker = Ext.extend(Ext.util.Observable, {
+   
+    /**
+     * @cfg {Boolean} autoUpdate
+     * When set to true, continually monitor the location of the device
+     * and fire update events. (Defaults to true.)
+     */
+    autoUpdate: true,
+    
+    ptype : 'gmaptracker',
+    
+    /**
+     * @property trackSuspended
+     * @type Boolean
+     */
+    trackSuspended : false,
+    
+    /**
+     * @cfg {Boolean} highAccuracy <tt>true</tt> to enable highAccuracy position fixes (often required for
+     * simulators) To conserve battery life, this value defaults to false.
+     */
+    highAccuracy : false,
+    
+    /**
+     * @cfg {Boolean} updateInterval
+     * The autoUpdate polling interval. (Defaults to 90000.)
+     */
+    updateInterval : 90000,
+
+    /**
+     * @constructor
+     * @param config {Object}
+     */
+    constructor : function(config) {
+        Ext.apply(this, config || {});
+        
+        if (Ext.supports.GeoLocation) {
+            this.provider = this.provider || 
+                (navigator.geolocation ? navigator.geolocation : 
+                (window.google || {}).gears ? google.gears.factory.create('beta.geolocation') : null);            
+        }
+        
+        this.addEvents(
+            /**
+             * @event beforeupdate
+             * @param {Coordinates} coord A coordinate object as defined by the coords property. Will return false if geolocation is disabled or denied access.
+             * @param {Ext.util.GeoLocation} this
+             */
+        
+            'beforeupdate',
+            
+            /**
+	         * @event update
+	         * @param {Cooridinates} coord A coordinate object as defined by the coords property. Will return false if geolocation is disabled or denied access.
+	         * @param {Ext.util.GeoLocation} this
+	         */    
+            'update',
+           
+            /**
+             * @event exception Raised when an error occurs while attempting a positional fix
+             * @param {Ext.util.GeoLocation} this
+             * @param {Error/String} error
+             */
+            'exception'
+        );
+        
+        Ext.plugin.GMap.Tracker.superclass.constructor.call(this);
+
+        this.onError = Ext.createDelegate(this.onError, this);
+        this.onPosition = Ext.createDelegate(this.onPosition, this);
+        this.updateLocation = Ext.createDelegate(this.updateLocation, this);
+
+        if (this.autoUpdate) {
+            this.startUpdates();
+        }
+    },
+    
+    /**
+     * Initialize the plugin, binding to the host Ext.Map instance
+     * @param {Ext.Map} host
+     */
+    init : function(host){
+       if (host && typeof host.renderMap == 'function') {
+            this.host = host;
+            host.geo = this;
+            
+            Ext.apply(host, {
+                suspendUpdates : Ext.createDelegate(this.suspendUpdates, this),
+                resumeUpdates  : Ext.createDelegate(this.resumeUpdates, this),
+                setHighAccuracy  : Ext.createDelegate(this.setHighAccuracy, this)
+            });
+            
+            host.on({
+                maprender : this.onMapRender,
+                resize    : this.onResized,
+                scope     : this
+            });
+           
+            this.on('update', this.updateTrack, this);
+       }
+    },
+    
+    /**
+     * Toggles the highAccuracy setting for subsequent position fixes
+     * @param {Boolean} accuracy <tt>true</tt> to enable a high-accuracy position fix.
+     * @return {Ext.plugin.GMap.Tracker} this
+     */
+    setHighAccuracy : function(accuracy) {
+        var h = !!this.highAccuracy;
+        this.highAccuracy = !!accuracy;
+        if ( (h !== this.highAccuracy) && this.watchId) {
+            this.provider.clearWatch(this.watchId);
+            this.startUpdates();
+        }
+        return this;
+    },
+    
+    // @private      
+    startUpdates : function() {
+        if (Ext.supports.GeoLocation && 'watchPosition' in this.provider) {
+            this.watchId = this.provider.watchPosition(
+                this.onPosition, 
+                this.onError,
+                 {
+                    allowHighAccuracy: !!this.highAccuracy,
+                    maximumAge : this.updateInterval || 60000,
+                    gearsLocationProviderUrls: null
+                 }
+              );
+        }
+        else { 
+            this.updateLocation();
+            this.pollId = this.updateInterval ? setInterval( this.updateLocation , this.updateInterval ) : null;
+        }
+        return this;
+    },
+    
+    // @private    
+    updateTrack : function(tracker, coords) {
+        this.getMarker().setPosition(coords);
+        this.trackSuspended || this.host.update(coords);
+    },
+    
+    suspendUpdates : function() {
+        this.trackSuspended = true;
+    },
+    
+    resumeUpdates : function() {
+        this.trackSuspended = false;
+        this.updateTrack(this, this.coords);
+    },
+    
+    // @private    
+    onMapRender : function(host, map) {
+        var marker = this.getMarker();
+        if (marker) {
+            marker.setMap(map);
+        }
+    },
+    
+    // @private    
+    onResized : function( host, w, h) {
+        if (host.map) {
+            this.trackSuspended || this.host.update(this.coords);
+        }
+    },
+    
+    // @private
+    getMarker : function() {
+        var gm = (window.google || {}).maps;
+        if (gm && this.host && !this.marker) {
+            this.marker = new gm.Marker({
+                position : this.coords || this.host.mapOptions.center
+            });
+        }
+        return this.marker;
+    },
+
+    /**
+     * Returns cached coordinates, and updates if there are no cached coords yet.
+     */
+    getLocation : function(callback, scope) {
+        var me = this;
+        if (Ext.supports.GeoLocation && !me.coords) {
+            me.updateLocation(callback, scope);
+        }
+        else if (callback) {
+            setTimeout(function() {
+                callback.call(scope || me, Ext.supports.GeoLocation ? me.coords : null, me);
+            }, 0);
+        }
+    },
+
+    /**
+     * Forces an update of the coords.
+     */
+    updateLocation : function(callback, scope) {
+        var me = this;
+        if (Ext.supports.GeoLocation) {
+            me.fireEvent('beforeupdate', me);
+            me.provider.getCurrentPosition(
+                function(position) {
+                    me.onPosition(position);
+                    if (callback) {
+                        callback.call(scope || me, me.coords, me);
+                    }
+                }, 
+                me.onError,
+                {
+                    allowHighAccuracy: !!me.highAccuracy,
+                    maximumAge : me.updateInterval || 60000,
+                    gearsLocationProviderUrls: null
+                }
+             );
+        }
+        else {
+            setTimeout(function() {
+                me.onPosition();
+                if (callback) {
+                    callback.call(scope || me, null, me);
+                }
+            }, 0);
+        }
+    },
+    
+    // @private
+    onPosition : function(position) {
+        var me = this;
+        me.coords = me.parseCoords(position);
+        me.fireEvent('update', me, me.coords );
+    },
+    
+    // @private
+    onError : function(error) {
+        this.fireEvent('exception', this, error);
+    },
+
+    // @private
+    parseCoords : function(location, asObject) {
+        var coords = location && location.coords ?
+            {
+                latitude: location.coords.latitude,
+                longitude: location.coords.longitude,
+                original: location
+            } : this.coords;
+            
+        if (coords && asObject !== false && (window.google || {}).maps) {
+            coords = new google.maps.LatLng(coords.latitude, coords.longitude);
+        }
+        return (this.coords = coords);
+    },
+    
+    // @private
+    destroy : function() {
+       this.updateInterval = 0;
+       if (Ext.supports.GeoLocation && this.watchId) {
+            this.provider.clearWatch(this.watchId);
+       }
+       if (this.pollId) {
+            clearInterval(this.pollId);
+       }
+       this.provider = null;
+    }
+});
+
+Ext.preg('gmaptracker', Ext.plugin.GMap.Tracker);
\ No newline at end of file

Added: sandbox/bartvde/sencha/openlayers/examples/map/plugins/GmapTraffic.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/examples/map/plugins/GmapTraffic.js	                        (rev 0)
+++ sandbox/bartvde/sencha/openlayers/examples/map/plugins/GmapTraffic.js	2011-02-21 14:03:25 UTC (rev 11181)
@@ -0,0 +1,67 @@
+
+
+Ext.ns('Ext.plugin.GMap');
+
+Ext.plugin.GMap.Traffic = Ext.extend(Object, {
+
+    /**
+     * @property {Boolean} hidden
+     */
+    hidden : false,
+    
+    constructor : function(config){
+      Ext.apply(this, config || {});  
+    },
+    
+    /**
+     * Initialize the plugin, binding to the host Ext.Map instance
+     * @param {Ext.Map} host
+     */
+    init : function( host ) {
+        if (host && typeof host.renderMap == 'function') {
+            this.host = host;
+            host.traffic = this;
+            
+            host.on({
+                maprender : this.onMapRender,
+                scope     : this
+            });
+        }
+    },
+    
+    // @private    
+    onMapRender : function(host, map) {
+        var overlay = this.getOverlay();
+        if (overlay) {
+            this.hidden || overlay.setMap(map);
+        }
+    },
+    
+    getOverlay : function(map){
+        if(!this.overlay && (window.google || {}).maps){
+            this.overlay = new google.maps.TrafficLayer();
+        }
+        return this.overlay;
+    },
+    
+    show : function(){
+        var overlay = this.getOverlay();
+        if (this.host && this.host.map && overlay) {
+           overlay.setMap(this.host.map); 
+        }
+        this.hidden = false;
+        
+    },
+    
+    hide : function(){
+        var overlay = this.getOverlay();
+        if (overlay) {
+           overlay.setMap(null); 
+        }
+        this.hidden = true;
+    }
+    
+    
+});
+
+Ext.preg('gmaptraffic', Ext.plugin.GMap.Traffic);
\ No newline at end of file

Added: sandbox/bartvde/sencha/openlayers/examples/map/point.png
===================================================================
(Binary files differ)


Property changes on: sandbox/bartvde/sencha/openlayers/examples/map/point.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/bartvde/sencha/openlayers/examples/map/shadow.png
===================================================================
(Binary files differ)


Property changes on: sandbox/bartvde/sencha/openlayers/examples/map/shadow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/bartvde/sencha/openlayers/examples/map/tablet_startup.png
===================================================================
(Binary files differ)


Property changes on: sandbox/bartvde/sencha/openlayers/examples/map/tablet_startup.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/bartvde/sencha/openlayers/lib/GeoExt/widgets/Map.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/GeoExt/widgets/Map.js	                        (rev 0)
+++ sandbox/bartvde/sencha/openlayers/lib/GeoExt/widgets/Map.js	2011-02-21 14:03:25 UTC (rev 11181)
@@ -0,0 +1,269 @@
+/**
+ * @class GeoExt.Map
+ * @extends Ext.Component
+ *
+ * <p>Wraps an OpenLayers Map in an Ext.Component for mobile devices.<br/>
+ * http://www.openlayers.org</p>
+ *
+ * <h2>Example code:</h2>
+ * <pre><code>
+var pnl = new Ext.Panel({
+    fullscreen: true,
+    items     : [
+        {
+            xtype             : 'gx_map',
+            useCurrentLocation: true
+        }
+    ]
+});</code></pre>
+ * @xtype map
+ */
+
+Ext.ns('GeoExt');
+
+GeoExt.Map = Ext.extend(Ext.Component, {
+    /**
+     * @cfg {String} baseCls
+     * The base CSS class to apply to the Maps's element (defaults to <code>'x-map'</code>).
+     */
+    baseCls: 'x-map',
+
+    /**
+     * @cfg {Boolean} useCurrentLocation
+     * Pass in true to center the map based on the geolocation coordinates.
+     */
+    useCurrentLocation: false,
+    
+    monitorResize : true,
+
+    /**
+     * @cfg {Object} mapOptions
+     * MapOptions as specified by the OpenLayers documentation:
+     * http://dev.openlayers.org/apidocs/files/OpenLayers-js.html
+     */
+
+    /**
+     * @type {OpenLayers.Map}
+     * The wrapped map.
+     */
+    map: null,
+
+    /**
+     * @type {Ext.util.GeoLocation}
+     */
+    geo: null,
+
+    /**
+     * @cfg {Boolean} maskMap
+     * Masks the map (Defaults to false)
+     */
+    maskMap: false,
+    /**
+     * @cfg {Strng} maskMapCls
+     * CSS class to add to the map when maskMap is set to true.
+     */
+    maskMapCls: 'x-mask-map',
+
+
+    initComponent : function() {
+        this.mapOptions = this.mapOptions || {};
+        
+        this.scroll = false;
+        
+        if(!(window.OpenLayers){
+            this.html = 'OpenLayers API is required';   
+        }
+        else if (this.useCurrentLocation) {
+            this.geo = this.geo || new Ext.util.GeoLocation({autoLoad: false});
+            this.geo.on({
+                locationupdate : this.onGeoUpdate,
+                locationerror : this.onGeoError, 
+                scope : this
+            });
+        }
+        
+        GeoExt.Map.superclass.initComponent.call(this);
+                
+        this.addEvents ( 
+            /**
+             * @event maprender
+             * @param {GeoExt.Map} this
+             * @param {OpenLayers.Map} map The rendered OpenLayers.Map instance
+             */     
+            'maprender',
+        
+            /**
+             * @event centerchange
+             * @param {GeoExt.Map} this
+             * @param {OpenLayers.Map} map The rendered OpenLayers.Map instance
+             * @param {OpenLayers.LonLat} center The current LonLat center of the map
+             */     
+            'centerchange',
+            
+            /**
+             * @event zoomchange
+             * @param {GeoExt.Map} this
+             * @param {OpenLayers.Map} map The OpenLayers.Map instance
+             * @param {Number} zoomLevel The current zoom level of the map
+             */     
+            'zoomchange'
+        );
+        
+        if (this.geo){
+            this.on({
+                activate: this.onUpdate,
+                scope: this,
+                single: true
+            });
+            this.geo.updateLocation();
+        }
+        
+    },
+    
+    // @private    
+    onRender : function(container, position) {
+        GeoExt.Map.superclass.onRender.apply(this, arguments);
+        this.el.setDisplayMode(Ext.Element.OFFSETS);        
+    },
+    
+     // @private
+    afterRender : function() {
+        GeoExt.Map.superclass.afterRender.apply(this, arguments);
+        this.renderMap();
+    },
+    
+    // @private
+    onResize : function( w, h) {
+        GeoExt.Map.superclass.onResize.apply(this, arguments);
+        if (this.map) {
+            this.map.updateSize();
+        }
+    },
+    
+    afterComponentLayout : function() {
+        if (this.maskMap && !this.mask) {
+            this.el.mask(null, this.maskMapCls);
+            this.mask = true;
+        }
+    },
+    
+    renderMap : function(){
+        var me = this;
+        
+        Ext.applyIf(me.mapOptions, {
+                center: new OpenLayers.LonLat(37.381592, -122.135672), // Palo Alto
+                zoom: 12
+            });
+            
+            if (me.maskMap && !me.mask) {
+                me.el.mask(null, this.maskMapCls);
+                me.mask = true;
+            }
+    
+            if (me.el && me.el.dom && me.el.dom.firstChild) {
+                Ext.fly(me.el.dom.firstChild).remove();
+            }
+        
+            if (me.map) {
+                me.map.destroy();
+            }
+            
+            me.map = new OpenLayers.Map(me.el.dom, me.mapOptions);
+
+            me.map.events.register("zoomend", me.map, Ext.createDelegate(me.onZoom, me));
+            me.map.events.register("moveend", me.map, Ext.createDelegate(me.onCenterChange, me)); 
+            
+            me.fireEvent('maprender', me, me.map);
+        
+    },
+
+    onGeoUpdate : function(coords) {
+        var center;
+        if (coords) {
+            center = this.mapOptions.center = new OpenLayers.LonLat(coords.latitude, coords.longitude);
+        }
+        
+        if (this.rendered) {
+            this.update(center);
+        }
+        else {
+            this.on('activate', this.onUpdate, this, {single: true, data: center});
+        }
+    },
+    
+    onGeoError : function(geo){
+          
+    },
+
+    onUpdate : function(map, e, options) {
+        this.update((options || {}).data);
+    },
+    
+    
+    /**
+     * Moves the map center to the designated coordinates hash of the form:
+<code><pre>
+ { latitude : 37.381592,
+  longitude : -122.135672
+  }</pre></code>
+     * or an OpenLayers.LonLat object representing to the target location. 
+     * @param {Object/OpenLayers.LonLat} coordinates Object representing the desired Latitude and
+     * longitude upon which to center the map
+     */
+    update : function(coordinates) {
+        var me = this;
+
+        coordinates = coordinates || me.coords || new OpenLayers.LonLat(37.381592, -122.135672);
+            
+        if (coordinates && !(coordinates instanceof OpenLayers.LonLat) && 'longitude' in coordinates) {
+            coordinates = new OpenLayers.LonLat(coordinates.latitude, coordinates.longitude);
+        }
+            
+        if (!me.hidden && me.rendered) {
+            me.map || me.renderMap();
+            if (me.map && coordinates instanceof OpenLayers.LonLat) {
+               me.map.panTo(coordinates);
+            }
+        }
+        else {
+            me.on('activate', me.onUpdate, me, {single: true, data: coordinates});
+        }
+    },
+    
+    // @private
+    onZoom  : function() {
+        this.mapOptions.zoom = (this.map && this.map.getZoom 
+            ? this.map.getZoom() 
+            : this.mapOptions.zoom) || 10 ;
+            
+        this.fireEvent('zoomchange', this, this.map, this.mapOptions.zoom);
+    },
+    
+    // @private
+    onCenterChange : function(){
+       this.mapOptions.center = this.map && this.map.getCenter 
+            ? this.map.getCenter() 
+            : this.mapOptions.center;
+        
+       this.fireEvent('centerchange', this, this.map, this.mapOptions.center);
+       
+    },
+    
+    getState : function(){
+        return this.mapOptions;  
+    },
+    
+    // @private    
+    onDestroy : function() {
+        Ext.destroy(this.geo);
+        if (this.maskMap && this.mask) {
+            this.el.unmask();
+        }
+        if (this.map && (window.OpenLayers)) {
+            this.map.destroy();
+        }
+        GeoExt.Map.superclass.onDestroy.call(this);
+    }
+});
+
+Ext.reg('gx_map', GeoExt.Map);



More information about the Commits mailing list