[Commits] r2683 - in sandbox/gxm/geoext/gxm: examples lib lib/data lib/data/model
commits at geoext.org
commits at geoext.org
Fri May 13 12:16:24 CEST 2011
Author: marcjansen
Date: 2011-05-13 12:16:24 +0200 (Fri, 13 May 2011)
New Revision: 2683
Added:
sandbox/gxm/geoext/gxm/lib/GXM.js
sandbox/gxm/geoext/gxm/lib/data/
sandbox/gxm/geoext/gxm/lib/data/LayerStore.js
sandbox/gxm/geoext/gxm/lib/data/model/
sandbox/gxm/geoext/gxm/lib/data/model/Layer.js
Modified:
sandbox/gxm/geoext/gxm/examples/simple.html
sandbox/gxm/geoext/gxm/lib/LayerList.js
sandbox/gxm/geoext/gxm/lib/MapPanel.js
Log:
- some refactoring and a start of LayerStore
- LayerList will have to be refactored to match the new design
- MapPanel will likely be changed to create the LayerStore on initialisation (as doies GeoExt)
- next week will focus on the store/model of layers
Modified: sandbox/gxm/geoext/gxm/examples/simple.html
===================================================================
--- sandbox/gxm/geoext/gxm/examples/simple.html 2011-05-12 18:55:26 UTC (rev 2682)
+++ sandbox/gxm/geoext/gxm/examples/simple.html 2011-05-13 10:16:24 UTC (rev 2683)
@@ -12,102 +12,115 @@
<link rel="stylesheet" href="../css/gxm.css" type="text/css">
<script type="text/javascript" src="../external/sencha-touch-1.1.0/sencha-touch.js"></script>
<script type="text/javascript" src="../external/OpenLayers.r11966/lib/OpenLayers.js?mobile"></script>
+
+ <script type="text/javascript" src="../lib/GXM.js"></script>
<script type="text/javascript" src="../lib/MapPanel.js"></script>
<script type="text/javascript" src="../lib/Button.js"></script>
<script type="text/javascript" src="../lib/SegmentedButton.js"></script>
+ <script type="text/javascript" src="../lib/data/model/Layer.js"></script>
+ <script type="text/javascript" src="../lib/data/LayerStore.js"></script>
<script type="text/javascript" src="../lib/LayerList.js"></script>
+
<script type="text/javascript">
+
+//TODO: remove eventually
+log = function(){
+ if ( console && console.log ) {
+ for (arg in arguments) {
+ console.log(arguments[arg]);
+ }
+ }
+};
+
Ext.setup({
onReady: function(){
var map = new OpenLayers.Map({
allOverlays: true,
controls: []
});
- var ol_wms = new OpenLayers.Layer.WMS("OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {
- layers: "basic"
- });
+ var ol_wms = new OpenLayers.Layer.WMS(
+ "OpenLayers WMS",
+ "http://vmap0.tiles.osgeo.org/wms/vmap0",
+ {
+ layers: "basic"
+ }
+ );
- // map.addControl(new OpenLayers.Control.ZoomIn())
-
map.addLayers([ol_wms]);
-// map.events.register('zoomend', null, function(){
-// log('zoomend-event in the map');
+/* ------------------------------------------------------------------
+ * Lazy loading of the mappanel
+ * ...with an existing OpenLayers.Map-object
+ * ------------------------------------------------------------------
+ */
+// var mapPanel = {
+// xtype: 'gxm_mappanel',
+// map: map
+// };
+// new Ext.Panel({
+// fullscreen: true,
+// items: [ mapPanel ]
// });
- // /* ------------------------------------------------------------------
- // * Lazy loading of the mappanel
- // * ...with an existing OpenLayers.Map-object
- // * ------------------------------------------------------------------
- // */
- // var mapPanel = {
- // xtype: 'gxm_mappanel',
- // map: map
- // };
- // new Ext.Panel({
- // fullscreen: true,
- // items: [ mapPanel ]
- // });
+/* ------------------------------------------------------------------
+ * Loading through instanciation of GXM.MapPanel
+ * ...with an existing OpenLayers.Map-object
+ * ------------------------------------------------------------------
+ */
+// var mapPanel = new GXM.MapPanel({
+// map: map
+// });
+/* ------------------------------------------------------------------
+ * Loading through instanciation of GXM.MapPanel
+ * ...without an existing OpenLayers.Map-object
+ * ------------------------------------------------------------------
+ */
+// var mapPanel = new GXM.MapPanel({
+// layers: [
+// ol_wms.clone()
+// ]
+// });
+/* ------------------------------------------------------------------
+ * using the center-property
+ * ... as string
+ * ------------------------------------------------------------------
+ */
+// var mapPanel = new GXM.MapPanel({
+// layers: [
+// ol_wms.clone()
+// ],
+// center: '7,51'
+// });
+/* ------------------------------------------------------------------
+ * using the center-property
+ * ... as array
+ * ------------------------------------------------------------------
+ */
+// var mapPanel = new GXM.MapPanel({
+// layers: [
+// ol_wms.clone()
+// ],
+// center: [ 7, 51 ]
+// });
- /* ------------------------------------------------------------------
- * Loading through instanciation of SpatialPinch.MapPanel
- * ...with an existing OpenLayers.Map-object
- * ------------------------------------------------------------------
- */
- // var mapPanel = new GXM.MapPanel({
- // map: map
- // });
- /* ------------------------------------------------------------------
- * Loading through instanciation of SpatialPinch.MapPanel
- * ...without an existing OpenLayers.Map-object
- * ------------------------------------------------------------------
- */
- // var mapPanel = new GXM.MapPanel({
- // layers: [
- // ol_wms.clone()
- // ]
- // });
- /* ------------------------------------------------------------------
- * using the center-property
- * ... as string
- * ------------------------------------------------------------------
- */
- // var mapPanel = new GXM.MapPanel({
- // layers: [
- // ol_wms.clone()
- // ],
- // center: '7,51'
- // });
- /* ------------------------------------------------------------------
- * using the center-property
- * ... as array
- * ------------------------------------------------------------------
- */
- // var mapPanel = new GXM.MapPanel({
- // layers: [
- // ol_wms.clone()
- // ],
- // center: [ 7, 51 ]
- // });
+/* ------------------------------------------------------------------
+ * using the extent-property
+ * ... with a string
+ * ------------------------------------------------------------------
+ */
+// var mapPanel = new GXM.MapPanel({
+// layers: [
+// ol_wms.clone()
+// ],
+// extent: '7,51,8,52'
+// });
- // /* ------------------------------------------------------------------
- // * using the extent-property
- // * ... with a string
- // * ------------------------------------------------------------------
- // */
- // var mapPanel = new GXM.MapPanel({
- // layers: [
- // ol_wms.clone()
- // ],
- // extent: '7,51,8,52'
- // });
-
- /* ------------------------------------------------------------------
- * using the gxm button
- * ... simple case with only one action (zoom in / out)
- * ------------------------------------------------------------------
- */
+/* ------------------------------------------------------------------
+ * using the gxm button
+ * ... simple case with only one action (zoom in / out)
+ * ------------------------------------------------------------------
+ */
// var zoomin = new OpenLayers.Control.ZoomIn();
// var zoomout = new OpenLayers.Control.ZoomOut();
//
@@ -147,11 +160,11 @@
-// /* ------------------------------------------------------------------
-// * using the gxm button
-// * ... more complicated: a kind of toggle button
-// * ------------------------------------------------------------------
-// */
+/* ------------------------------------------------------------------
+ * using the gxm button
+ * ... more complicated: a kind of toggle button
+ * ------------------------------------------------------------------
+ */
// var nav = new OpenLayers.Control.Navigation();
//
// var btnNavigation = {
@@ -181,11 +194,11 @@
// });
-// /* ------------------------------------------------------------------
-// * using the gxm buttons
-// * ... disabling / enabling inside group, the explicit way
-// * ------------------------------------------------------------------
-// */
+/* ------------------------------------------------------------------
+ * using the gxm buttons
+ * ... disabling / enabling inside group, the explicit way
+ * ------------------------------------------------------------------
+ */
//
//
// // create a vector layer for drawing
@@ -253,12 +266,12 @@
// zoom: 7
// });
-// /* ------------------------------------------------------------------
-// * using the gxm buttons
-// * ... disabling / enabling inside group, through the use of
-// * gxm_segmentedbutton
-// * ------------------------------------------------------------------
-// */
+/* ------------------------------------------------------------------
+ * using the gxm buttons
+ * ... disabling / enabling inside group, through the use of
+ * gxm_segmentedbutton
+ * ------------------------------------------------------------------
+ */
//
// // create a vector layer for drawing
// var vector = new OpenLayers.Layer.Vector('Vector Layer', {
@@ -317,11 +330,11 @@
// zoom: 7
// });
-// /* ------------------------------------------------------------------
-// * using the gxm buttons
-// * ... combination example with different segmented buttons
-// * ------------------------------------------------------------------
-// */
+/* ------------------------------------------------------------------
+ * using the gxm buttons
+ * ... combination example with different segmented buttons
+ * ------------------------------------------------------------------
+ */
//
// // create a vector layer for drawing
// var vector = new OpenLayers.Layer.Vector('Vector Layer', {
@@ -395,11 +408,11 @@
// });
-// /* ------------------------------------------------------------------
-// * using the gxm layerlist
-// * ... show / hide list on button click in overlay
-// * ------------------------------------------------------------------
-// */
+/* ------------------------------------------------------------------
+ * using the gxm layerlist
+ * ... show / hide list on button click in overlay
+ * ------------------------------------------------------------------
+ */
//
// var btnLayerlist = {
// xtype: 'button',
@@ -446,23 +459,6 @@
xtype: 'button',
text: 'Layerlist',
handler: function(){
- /*
- if (!this.popup) {
- this.popup = new Ext.Panel({
- floating: true,
- modal: true,
- centered: true,
- hideOnMaskTap: true,
- width: 240,
- items: [{
- xtype: 'gxm_layerlist',
- map: map
- }],
- scroll: 'vertical'
- });
- }
- this.popup.show('pop');
- */
vp.setActiveItem(1, 'slide');
}
};
@@ -509,7 +505,9 @@
layerPanel
]
});
- vp.setActiveItem(0);
+ vp.setActiveItem(0);
+
+
// DEBUG only
window.mapPanel = mapPanel;
window.map = mapPanel.map;
Added: sandbox/gxm/geoext/gxm/lib/GXM.js
===================================================================
--- sandbox/gxm/geoext/gxm/lib/GXM.js (rev 0)
+++ sandbox/gxm/geoext/gxm/lib/GXM.js 2011-05-13 10:16:24 UTC (rev 2683)
@@ -0,0 +1,6 @@
+Ext.ns('GXM');
+
+GXM = {
+ version: '0.0.1'
+};
+
Modified: sandbox/gxm/geoext/gxm/lib/LayerList.js
===================================================================
--- sandbox/gxm/geoext/gxm/lib/LayerList.js 2011-05-12 18:55:26 UTC (rev 2682)
+++ sandbox/gxm/geoext/gxm/lib/LayerList.js 2011-05-13 10:16:24 UTC (rev 2683)
@@ -1,3 +1,10 @@
+// requires model/Layer.js
+
+// needs refactoring:
+// - Layers go to the Mappanel as store
+// - this currently has a map but will soon need a layer store to work on
+//
+
GXM.LayerList = Ext.extend(Ext.List, {
map: null,
@@ -3,7 +10,4 @@
createStore: function(){
- Ext.regModel('Layer', {
- fields: ['id', 'name', 'visibility', 'zindex']
- });
var data = [];
Ext.each(this.map.layers, function(layer){
@@ -19,7 +23,7 @@
}
});
return new Ext.data.Store({
- model: 'Layer',
+ model: 'gxm_Layer',
sorters: 'zindex',
data: data
});
Modified: sandbox/gxm/geoext/gxm/lib/MapPanel.js
===================================================================
--- sandbox/gxm/geoext/gxm/lib/MapPanel.js 2011-05-12 18:55:26 UTC (rev 2682)
+++ sandbox/gxm/geoext/gxm/lib/MapPanel.js 2011-05-13 10:16:24 UTC (rev 2683)
@@ -1,16 +1,5 @@
Ext.ns('GXM');
-//TODO: move this to a single file
-GXM = {
- version: '0.0.1'
-};
-//TODO: remove eventually
-log = function(){
- for (arg in arguments) {
- console.log(arguments[arg]);
- }
-};
-
// mappanel
GXM.MapPanel = Ext.extend(Ext.Panel, {
map: null,
@@ -34,8 +23,28 @@
this.layers = [this.layers];
}
this.map.addLayers(this.layers);
+
}
+// // temp:
+// var s = new GXM.data.LayerStore({
+// data:this.map,
+// proxy: {
+// type: 'memory',
+// reader: {
+// type: 'json',
+// root: 'layers'
+// }
+// }
+// });
+// log(s);
+// new Ext.data.Store({
+// model: 'gxm_Layer',
+// sorters: 'zindex',
+// data: data
+// });
+//
+
// check config-property controls
if ( this.controls ) {
// normalize the case where this.controls was not an array but a control
Added: sandbox/gxm/geoext/gxm/lib/data/LayerStore.js
===================================================================
--- sandbox/gxm/geoext/gxm/lib/data/LayerStore.js (rev 0)
+++ sandbox/gxm/geoext/gxm/lib/data/LayerStore.js 2011-05-13 10:16:24 UTC (rev 2683)
@@ -0,0 +1,8 @@
+Ext.ns("GXM.data");
+
+GXM.data.LayerStore = Ext.extend(Ext.data.Store, {
+ model: 'gxm_Layer'
+});
+
+Ext.reg('gxm_layerstore', GXM.data.LayerStore);
+
Added: sandbox/gxm/geoext/gxm/lib/data/model/Layer.js
===================================================================
--- sandbox/gxm/geoext/gxm/lib/data/model/Layer.js (rev 0)
+++ sandbox/gxm/geoext/gxm/lib/data/model/Layer.js 2011-05-13 10:16:24 UTC (rev 2683)
@@ -0,0 +1,3 @@
+Ext.regModel('gxm_Layer', {
+ fields: ['id', 'name', 'visibility', 'zindex']
+});
\ No newline at end of file
More information about the Commits
mailing list