Changeset 320


Ignore:
Timestamp:
04/01/09 22:02:18 (8 years ago)
Author:
dwins
Message:

Merge from trunk, up to r319

Location:
sandbox/opengeo/geoexplorer
Files:
18 added
11 edited

Legend:

Unmodified
Added
Removed
  • sandbox/opengeo/geoexplorer/examples/mappanel-div.html

    r238 r320  
    11<html>
    2   <head>
    3     <script type="text/javascript" src="../../../openlayers/lib/OpenLayers.js"></script>
    4     <script type="text/javascript" src="../../../ext/2.2.1/adapter/ext/ext-base.js"></script>
    5     <script type="text/javascript" src="../../../ext/2.2.1/ext-all-debug.js"></script>
    6     <script type="text/javascript" src="../lib/GeoExt.js"></script>
    7 
    8     <link rel="stylesheet" type="text/css" href="../../../ext/2.2.1/resources/css/ext-all.css"></link>
    9 
    10     <script type="text/javascript">
    11 
    12     // this example shows the OpenLayerish way to create a map panel. See
    13     // mappanel-window.html for the ExtJSish way to do the same.
    14 
    15     var mapPanel;
    16    
    17     Ext.onReady(function() {
    18         var map = new OpenLayers.Map();
    19         var layer = new OpenLayers.Layer.WMS(
    20             "bluemarble",
    21             "http://sigma.openplans.org/geoserver/wms?",
    22             {layers: 'bluemarble'}
    23         );
    24         map.addLayer(layer);
    25 
    26         mapPanel = new GeoExt.MapPanel({
    27             title: "GeoExt MapPanel",
    28             renderTo: "mappanel",
    29             height: 400,
    30             width: 600,
    31             map: map,
    32             center: new OpenLayers.LonLat(5, 45),
    33             zoom: 4
    34         });
    35     });
    36 
    37     // functions for resizing the map panel
    38     function mapSizeUp() {
    39         var size = mapPanel.getSize();
    40         size.width += 40;
    41         size.height += 40;
    42         mapPanel.setSize(size);
    43     }
    44     function mapSizeDown() {
    45         var size = mapPanel.getSize();
    46         size.width -= 40;
    47         size.height -= 40;
    48         mapPanel.setSize(size);
    49     }
    50 
    51     </script>
    52        
    53   </head>
    54   <body>
    55     <div id="mappanel"></div>
    56     <input type="button" onclick="mapSizeUp()" value="bigger"></input>
    57     <input type="button" onclick="mapSizeDown()" value="smaller"></input>
    58   </body>
     2    <head>
     3        <link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css"></link>
     4        <link rel="stylesheet" type="text/css" href="../../ext/examples/shared/examples.css"></link>
     5        <script type="text/javascript" src="../../openlayers/lib/OpenLayers.js"></script>
     6        <script type="text/javascript" src="../../ext/adapter/ext/ext-base.js"></script>
     7        <script type="text/javascript" src="../../ext/ext-all.js"></script>
     8        <script type="text/javascript" src="../lib/GeoExt.js"></script>
     9        <script type="text/javascript" src="mappanel-div.js"></script>
     10    </head>
     11    <body>
     12        <h1>GeoExt.MapPanel with an Existing OpenLayers.Map</h1>
     13        <p>This example shows the how to create a MapPanel with a map that has
     14        already been created.  See <a href="mappanel-window.html">mappanel-window.html</a>
     15        for an example that creates the MapPanel without creating the map first.<p>
     16        <p>The js is not minified so it is readable. See <a href="mappanel-div.js">mappanel-div.js</a>.</p>
     17        <div id="mappanel"></div>
     18        <input type="button" onclick="mapSizeUp()" value="bigger"></input>
     19        <input type="button" onclick="mapSizeDown()" value="smaller"></input>
     20    </body>
    5921</html>
  • sandbox/opengeo/geoexplorer/examples/mappanel-window.html

    r238 r320  
    11<html>
    2   <head>
    3     <link rel="stylesheet" type="text/css" href="../../../ext/2.2.1/resources/css/ext-all.css"></link>
    4     <script type="text/javascript" src="../../../openlayers/lib/OpenLayers.js"></script>
    5     <script type="text/javascript" src="../../../ext/2.2.1/adapter/ext/ext-base.js"></script>
    6     <script type="text/javascript" src="../../../ext/2.2.1/ext-all-debug.js"></script>
    7     <script type="text/javascript" src="../lib/GeoExt.js"></script>
    8 
    9     <script type="text/javascript">
    10 
    11     // this example shows the Extish way to create a map panel. See
    12     // mappanel-div.html for the OpenLayerish way to do the same.
    13    
    14     var mapPanel;
    15    
    16     Ext.onReady(function() {
    17         new Ext.Window({
    18             title: "GeoExt MapPanel Window",
    19             height: 400,
    20             width: 600,
    21             layout: "fit",
    22             items: [{
    23                 xtype: "gx_mappanel",
    24                 id: "mappanel",
    25                 layers: [new OpenLayers.Layer.WMS(
    26                     "bluemarble",
    27                     "http://sigma.openplans.org/geoserver/wms?",
    28                     {layers: 'bluemarble'}
    29                 )],
    30                 extent: "-5,35,15,55"
    31             }]
    32         }).show();
    33        
    34         mapPanel = Ext.getCmp("mappanel");
    35     });
    36 
    37     </script>
    38   </head>
    39   <body>
    40   </body>
     2    <head>
     3        <link rel="stylesheet" type="text/css" href="../../ext/resources/css/ext-all.css"></link>
     4        <link rel="stylesheet" type="text/css" href="../../ext/examples/shared/examples.css"></link>
     5        <script type="text/javascript" src="../../openlayers/lib/OpenLayers.js"></script>
     6        <script type="text/javascript" src="../../ext/adapter/ext/ext-base.js"></script>
     7        <script type="text/javascript" src="../../ext/ext-all.js"></script>
     8        <script type="text/javascript" src="../lib/GeoExt.js"></script>       
     9        <script type="text/javascript" src="mappanel-window.js"></script>
     10    </head>
     11    <body>
     12        <h1>GeoExt.MapPanel in an Ext.Window</h1>
     13        <p>This example shows the how to place a MapPanel in another Ext container
     14        without creating a map first.  See <a href="mappanel-div.html">mappanel-div.html</a>
     15        for an example that creates the map before creating the map panel.<p>
     16        <p>The js is not minified so it is readable. See <a href="mappanel-window.js">mappanel-window.js</a>.</p>
     17    </body>
    4118</html>
  • sandbox/opengeo/geoexplorer/lib/GeoExt.js

    r264 r320  
    5959    if(!singleFile) {
    6060        var jsfiles = new Array(
     61            "GeoExt/data/FeatureRecord.js",
    6162            "GeoExt/data/FeatureReader.js",
    6263            "GeoExt/data/FeatureStoreMediator.js",
     
    6970            "GeoExt/data/WMSCapabilitiesStore.js",
    7071            "GeoExt/widgets/MapPanel.js",
     72            "GeoExt/widgets/Popup.js",
    7173            "GeoExt/widgets/tree/TristateCheckboxNode.js",
    7274            "GeoExt/widgets/tree/TristateCheckboxNodeUI.js",
  • sandbox/opengeo/geoexplorer/lib/GeoExt/data/FeatureReader.js

    r42 r320  
    1616 * You should have received a copy of the GNU General Public License
    1717 * along with GeoExt.  If not, see <http://www.gnu.org/licenses/>.
     18 */
     19
     20/**
     21 * @include GeoExt/data/FeatureRecord.js
    1822 */
    1923
     
    4751GeoExt.data.FeatureReader = function(meta, recordType) {
    4852    meta = meta || {};
     53    if(!(recordType instanceof Function)) {
     54        recordType = GeoExt.data.FeatureRecord.create(
     55            recordType || meta.fields || {});
     56    }
    4957    GeoExt.data.FeatureReader.superclass.constructor.call(
    50         this, meta, recordType || meta.fields
    51     );
     58        this, meta, recordType);
    5259};
    5360
  • sandbox/opengeo/geoexplorer/lib/GeoExt/data/LayerRecord.js

    r264 r320  
    1717 * Inherits from
    1818 * - {Ext.data.Record}
     19 */
     20/**
     21 * Constructor: GeoExt.data.LayerRecord
     22 *
     23 * Parameters:
     24 * data - {Object} data object for the record
     25 * id - {String} id of the record
    1926 */
    2027GeoExt.data.LayerRecord = Ext.data.Record.create([
     
    4552    }
    4653    return f;
    47 }
     54};
  • sandbox/opengeo/geoexplorer/lib/GeoExt/data/LayerStore.js

    r277 r320  
    99
    1010/**
    11  * Class: LayerStoreMixin
     11 * Class: GeoExt.data.LayerStoreMixin
    1212 * A store that synchronizes a layers array of an {OpenLayers.Map} with a
    1313 * layer store holding {<GeoExt.data.LayerRecord>} entries.
     
    2222 * (end)
    2323 *
    24  * For convenience, a {GeoExt.data.LayerStore} class is available as a
     24 * For convenience, a {<GeoExt.data.LayerStore>} class is available as a
    2525 * shortcut to the Ext.extend sequence in the above code snippet. The above
    2626 * is equivalent to:
     
    2929 *     map: myMap,
    3030 *     layers: myLayers
    31  * })
     31 * });
    3232 * (end)
    3333 */
     
    4848
    4949    /**
    50      * Constructor: GeoExt.data.LayerStore
     50     * Constructor: GeoExt.data.LayerStoreMixin
    5151     *
    5252     * Parameters:
     
    6666        config.reader = config.reader ||
    6767                        new GeoExt.data.LayerReader({}, config.recordType);
     68        var map = config.map instanceof GeoExt.MapPanel ?
     69                  config.map.map : config.map;
     70        delete config.map;
    6871        arguments.callee.superclass.constructor.call(this, config);
    69         var map = config.map instanceof GeoExt.MapPanel ?
    70             config.map.map : config.map;
    7172        if(map) {
    7273            // create a snapshop of the map's layers
     
    7980            }
    8081
    81             this.setMap(map);
     82            this.bind(map);
    8283            config.layers && map.addLayers(config.layers);
    8384        }
    8485    },
    85    
    86     /**
    87      * APIMethod: setMap
    88      *
    89      * Parameters:
    90      * map - {OpenLayers.Map}
    91      */
    92     setMap: function(map) {
    93         this.map = map;
    94         map.events.on({
    95             "addlayer": this.onAddLayer,
    96             "removelayer": this.onRemoveLayer,
    97             scope: this
    98         });
    99         this.on({
    100             "add": this.onAdd,
    101             "remove": this.onRemove,
    102             scope: this
    103         });
    104     },
    105    
     86
     87    /**
     88     * APIMethod: bind
     89     * Bind this store to a map instance, once bound the store
     90     * is synchronized with the map and vice-versa.
     91     *
     92     * Parameters:
     93     * map - {OpenLayers.Map} The map instance.
     94     */
     95    bind: function(map) {
     96        if(!this.map) {
     97            this.map = map;
     98            map.events.on({
     99                "addlayer": this.onAddLayer,
     100                "removelayer": this.onRemoveLayer,
     101                scope: this
     102            });
     103            this.on({
     104                "add": this.onAdd,
     105                "remove": this.onRemove,
     106                scope: this
     107            });
     108        }
     109    },
     110
     111    /**
     112     * APIMethod: unbind
     113     * Unbind this store from the map it is currently bound.
     114     */
     115    unbind: function() {
     116        if(this.map) {
     117            this.map.events.un({
     118                "addlayer": this.onAddLayer,
     119                "removelayer": this.onRemoveLayer,
     120                scope: this
     121            });
     122            this.un({
     123                "add": this.onAdd,
     124                "remove": this.onRemove,
     125                scope: this
     126            });
     127            this.map = null;
     128        }
     129    },
     130   
    106131    /**
    107132     * Method: onAddLayer
     
    167192/**
    168193 * Class: GeoExt.data.LayerStore
    169  * Default implementation of an {Ext.data.Store} enhanced with
     194 * Default implementation of an {Ext.data.Store} extended with
    170195 * {<GeoExt.data.LayerStoreMixin>}
     196 *
     197 * Inherits from:
     198 * - {Ext.data.Store}
     199 * - {<GeoExt.data.LayerStoreMixin>}
     200 */
     201/**
     202 * Constructor: GeoExt.data.LayerStore
     203 *
     204 * Parameters:
     205 * config - {Object} See {<GeoExt.data.LayerStoreMixin>} and
     206 * http://extjs.com/deploy/dev/docs/?class=Ext.data.Store for valid config
     207 *     options.
    171208 */
    172209GeoExt.data.LayerStore = Ext.extend(
  • sandbox/opengeo/geoexplorer/lib/GeoExt/widgets/MapPanel.js

    r277 r320  
    121121       
    122122        GeoExt.MapPanel.superclass.initComponent.call(this);       
     123    },
     124   
     125    /**
     126     * Method: updateMapSize
     127     * Tell the map that it needs to recaculate its size and position.
     128     */
     129    updateMapSize: function() {
     130        if(this.map) {
     131            this.map.updateSize();
     132        }
    123133    },
    124134   
     
    142152        }
    143153    },
     154   
     155    /**
     156     * Method: afterRender
     157     * Private method called after the panel has been rendered.
     158     */
     159    afterRender: function() {
     160        GeoExt.MapPanel.superclass.afterRender.apply(this, arguments);
     161        if(this.ownerCt) {
     162            this.ownerCt.on("move", this.updateMapSize, this);
     163        }
     164    },   
    144165
    145166    /**
     
    150171    onResize: function() {
    151172        GeoExt.MapPanel.superclass.onResize.apply(this, arguments);
    152         this.map.updateSize();
     173        this.updateMapSize();
     174    },
     175   
     176    /**
     177     * Method: onDestroy
     178     * Private method called during the destroy sequence.
     179     */
     180    onDestroy: function() {
     181        if(this.ownerCt) {
     182            this.ownerCt.un("move", this.updateMapSize, this);
     183        }
     184        GeoExt.MapPanel.superclass.onDestroy.apply(this, arguments);
    153185    }
    154186});
     
    169201}
    170202
     203/**
     204 * XType: gx_mappanel
     205 */
    171206Ext.reg('gx_mappanel', GeoExt.MapPanel);
  • sandbox/opengeo/geoexplorer/modifications.txt

    r286 r320  
    77 * Added examples of grid using WMSCapabilitiesStore (see #9)
    88 * Allow array extent or center in MapPanel (see #31)
     9 * Merge changes from trunk up to r319
    910
  • sandbox/opengeo/geoexplorer/resources/css/geoext-all-debug.css

    r277 r320  
    11@import "example.css";
    2 
     2@import "popup.css";
  • sandbox/opengeo/geoexplorer/tests/lib/GeoExt/data/FeatureReader.html

    r269 r320  
    1717            var fields = reader.recordType.prototype.fields;
    1818            // 2 tests
    19             t.eq(fields.items.length, 2, 'number of items is correct');
    20             t.ok(fields.items[0].name == 'foo' &&
    21                  fields.items[1].name == 'bar',
     19            t.eq(fields.items.length, 5, 'number of items is correct');
     20            t.ok(fields.items[3].name == 'foo' &&
     21                 fields.items[4].name == 'bar',
    2222                 'field values are correct');
    2323        }
  • sandbox/opengeo/geoexplorer/tests/list-tests.html

    r269 r320  
    11<ul id="testlist">
     2  <li>lib/GeoExt/data/FeatureRecord.html</li>
    23  <li>lib/GeoExt/data/FeatureReader.html</li>
    34  <li>lib/GeoExt/data/FeatureStoreMediator.html</li>
     
    89  <li>lib/GeoExt/data/ProtocolProxy.html</li>
    910  <li>lib/GeoExt/widgets/MapPanel.html</li>
     11  <li>lib/GeoExt/widgets/Popup.html</li>
    1012</ul>
Note: See TracChangeset for help on using the changeset viewer.