comparison gnv/src/main/webapp/scripts/viewport.jsp @ 973:1bb54da8c8ed

Added more resources which are required to use the ol-client properly gnv/trunk@1141 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 01 Jun 2010 14:15:10 +0000
parents a0e6566cd111
children 5779220ebb80
comparison
equal deleted inserted replaced
972:d0b187202f84 973:1bb54da8c8ed
88 mousePosition = new OpenLayers.Control.MousePosition(); 88 mousePosition = new OpenLayers.Control.MousePosition();
89 map.addControl(mousePosition); 89 map.addControl(mousePosition);
90 90
91 /* --------------------------------------------------------------------------- */ 91 /* --------------------------------------------------------------------------- */
92 92
93 // Scale Chooser
94 var scaleStore = new GeoExt.data.ScaleStore({map: map});
95 var zoomSelector = new Ext.form.ComboBox({
96 store: scaleStore,
97 emptyText: "Zoom Level",
98 tpl: '<tpl for="."><div class="x-combo-list-item">1 : {[parseInt(values.scale)]}</div></tpl>',
99 editable: false,
100 triggerAction: 'all', // needed so that the combo box doesn't filter by its current content
101 mode: 'local' // keep the combo box from forcing a lot of unneeded data refreshes
102 });
103
104 zoomSelector.on('select',
105 function(combo, record, index) {
106 map.zoomTo(record.data.level);
107 },
108 this
109 );
110
111 map.events.register('zoomend', this, function() {
112 var scale = scaleStore.queryBy(function(record){
113 return this.map.getZoom() == record.data.level;
114 });
115
116 if (scale.length > 0) {
117 scale = scale.items[0];
118 zoomSelector.setValue("1 : " + parseInt(scale.data.scale));
119 } else {
120 if (!zoomSelector.rendered) return;
121 zoomSelector.clearValue();
122 }
123 });
124
125
126 // create MapPanel 93 // create MapPanel
127 mapPanel = new GeoExt.MapPanel({ 94 mapPanel = new GeoExt.MapPanel({
128 border: true, 95 border: true,
129 title: "Karte mit GeoNames Suche",
130 region: "center", 96 region: "center",
131 map: map, 97 map: map,
132 layers: layers, 98 layers: layers
133 bbar: [zoomSelector] 99
134 }); 100 });
135 101
136 // map.setCenter(INITIAL_CENTER); 102 // map.setCenter(INITIAL_CENTER);
137 103
138 /* --------------------------- Layer Tree ----------------------------------- */ 104 /* --------------------------- Layer Tree ----------------------------------- */

http://dive4elements.wald.intevation.org