| 149 | | var setToolbarContent = function() { |
| 150 | | |
| 151 | | toolbar.addControl( |
| 152 | | new OpenLayers.Control.ZoomToMaxExtent({ |
| 153 | | map: map, |
| 154 | | title: 'Zoom to maximum map extent' |
| 155 | | }), { |
| 156 | | iconCls: 'zoomfull', |
| 157 | | toggleGroup: 'map' |
| 158 | | } |
| 159 | | ); |
| 160 | | |
| 161 | | addSeparator(); |
| 162 | | |
| 163 | | toolbar.addControl( |
| 164 | | new OpenLayers.Control.ZoomBox({ |
| 165 | | title: 'Zoom in: click in the map or use the left mouse button and drag to create a rectangle' |
| 166 | | }), { |
| 167 | | iconCls: 'zoomin', |
| 168 | | toggleGroup: 'map' |
| 169 | | } |
| 170 | | ); |
| 171 | | |
| 172 | | toolbar.addControl( |
| 173 | | new OpenLayers.Control.ZoomBox({ |
| 174 | | out: true, |
| 175 | | title: 'Zoom out: click in the map or use the left mouse button and drag to create a rectangle' |
| 176 | | }), { |
| 177 | | iconCls: 'zoomout', |
| 178 | | toggleGroup: 'map' |
| 179 | | } |
| 180 | | ); |
| 181 | | |
| 182 | | toolbar.addControl( |
| 183 | | new OpenLayers.Control.DragPan({ |
| 184 | | isDefault: true, |
| 185 | | title: 'Pan map: keep the left mouse button pressed and drag the map' |
| 186 | | }), { |
| 187 | | iconCls: 'pan', |
| 188 | | toggleGroup: 'map' |
| 189 | | } |
| 190 | | ); |
| 191 | | |
| 192 | | addSeparator(); |
| 193 | | |
| 194 | | toolbar.addControl( |
| 195 | | new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Point, { |
| 196 | | title: 'Draw a point on the map' |
| 197 | | }), { |
| 198 | | iconCls: 'drawpoint', |
| 199 | | toggleGroup: 'map' |
| 200 | | } |
| 201 | | ); |
| 202 | | |
| 203 | | toolbar.addControl( |
| 204 | | new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Path, { |
| 205 | | title: 'Draw a linestring on the map' |
| 206 | | }), { |
| 207 | | iconCls: 'drawline', |
| 208 | | toggleGroup: 'map' |
| 209 | | } |
| 210 | | ); |
| 211 | | |
| 212 | | toolbar.addControl( |
| 213 | | new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Polygon, { |
| 214 | | title: 'Draw a polygon on the map' |
| 215 | | }), { |
| 216 | | iconCls: 'drawpolygon', |
| 217 | | toggleGroup: 'map' |
| 218 | | } |
| 219 | | ); |
| 220 | | |
| 221 | | addSeparator(); |
| 222 | | |
| 223 | | var nav = new OpenLayers.Control.NavigationHistory(); |
| 224 | | map.addControl(nav); |
| 225 | | nav.activate(); |
| 226 | | |
| 227 | | var buttonPrevious = new Ext.Toolbar.Button({ |
| 228 | | iconCls: 'back', |
| 229 | | tooltip: 'Previous view', |
| 230 | | disabled: true, |
| 231 | | handler: nav.previous.trigger |
| 232 | | }); |
| 233 | | |
| 234 | | var buttonNext = new Ext.Toolbar.Button({ |
| 235 | | iconCls: 'next', |
| 236 | | tooltip: 'Next view', |
| 237 | | disabled: true, |
| 238 | | handler: nav.next.trigger |
| 239 | | }); |
| 240 | | |
| 241 | | toolbar.add(buttonPrevious); |
| 242 | | toolbar.add(buttonNext); |
| 243 | | |
| 244 | | nav.previous.events.register( |
| 245 | | "activate", |
| 246 | | buttonPrevious, |
| 247 | | function() { |
| 248 | | this.setDisabled(false); |
| 249 | | } |
| 250 | | ); |
| 251 | | |
| 252 | | nav.previous.events.register( |
| 253 | | "deactivate", |
| 254 | | buttonPrevious, |
| 255 | | function() { |
| 256 | | this.setDisabled(true); |
| 257 | | } |
| 258 | | ); |
| 259 | | |
| 260 | | nav.next.events.register( |
| 261 | | "activate", |
| 262 | | buttonNext, |
| 263 | | function(){ |
| 264 | | this.setDisabled(false); |
| 265 | | } |
| 266 | | ); |
| 267 | | |
| 268 | | nav.next.events.register( |
| 269 | | "deactivate", |
| 270 | | buttonNext, |
| 271 | | function() { |
| 272 | | this.setDisabled(true); |
| 273 | | } |
| 274 | | ); |
| 275 | | |
| 276 | | addSeparator(); |
| 277 | | } |
| 278 | | |
| | 138 | var createToolbar = function() { |
| | 139 | var action; |
| | 140 | |
| | 141 | action = new GeoExt.Action({ |
| | 142 | control: new OpenLayers.Control.ZoomToMaxExtent(), |
| | 143 | map: map, |
| | 144 | iconCls: 'zoomfull', |
| | 145 | toggleGroup: 'map', |
| | 146 | tooltip: 'Zoom to full extent' |
| | 147 | }); |
| | 148 | |
| | 149 | toolbarItems.push(action); |
| | 150 | |
| | 151 | createSeparator(); |
| | 152 | |
| | 153 | action = new GeoExt.Action({ |
| | 154 | control: new OpenLayers.Control.ZoomBox(), |
| | 155 | tooltip: 'Zoom in: click in the map or use the left mouse button and drag to create a rectangle', |
| | 156 | map: map, |
| | 157 | iconCls: 'zoomin', |
| | 158 | toggleGroup: 'map' |
| | 159 | }); |
| | 160 | |
| | 161 | toolbarItems.push(action); |
| | 162 | |
| | 163 | action = new GeoExt.Action({ |
| | 164 | control: new OpenLayers.Control.ZoomBox({ |
| | 165 | out: true |
| | 166 | }), |
| | 167 | tooltip: 'Zoom out: click in the map or use the left mouse button and drag to create a rectangle', |
| | 168 | map: map, |
| | 169 | iconCls: 'zoomout', |
| | 170 | toggleGroup: 'map' |
| | 171 | }); |
| | 172 | |
| | 173 | toolbarItems.push(action); |
| | 174 | |
| | 175 | action = new GeoExt.Action({ |
| | 176 | control: new OpenLayers.Control.DragPan({ |
| | 177 | isDefault: true |
| | 178 | }), |
| | 179 | tooltip: 'Pan map: keep the left mouse button pressed and drag the map', |
| | 180 | map: map, |
| | 181 | iconCls: 'pan', |
| | 182 | toggleGroup: 'map' |
| | 183 | }); |
| | 184 | |
| | 185 | toolbarItems.push(action); |
| | 186 | |
| | 187 | createSeparator(); |
| | 188 | |
| | 189 | action = new GeoExt.Action({ |
| | 190 | control: new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Point), |
| | 191 | tooltip: 'Draw a point on the map', |
| | 192 | map: map, |
| | 193 | iconCls: 'drawpoint', |
| | 194 | toggleGroup: 'map' |
| | 195 | }); |
| | 196 | |
| | 197 | toolbarItems.push(action); |
| | 198 | |
| | 199 | |
| | 200 | action = new GeoExt.Action({ |
| | 201 | control: new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Path), |
| | 202 | tooltip: 'Draw a linestring on the map', |
| | 203 | map: map, |
| | 204 | iconCls: 'drawline', |
| | 205 | toggleGroup: 'map' |
| | 206 | }); |
| | 207 | |
| | 208 | toolbarItems.push(action); |
| | 209 | |
| | 210 | |
| | 211 | action = new GeoExt.Action({ |
| | 212 | control: new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Polygon), |
| | 213 | tooltip: 'Draw a polygon on the map', |
| | 214 | map: map, |
| | 215 | iconCls: 'drawpolygon', |
| | 216 | toggleGroup: 'map' |
| | 217 | }); |
| | 218 | |
| | 219 | toolbarItems.push(action); |
| | 220 | |
| | 221 | createSeparator(); |
| | 222 | |
| | 223 | ctrl = new OpenLayers.Control.NavigationHistory(); |
| | 224 | map.addControl(ctrl); |
| | 225 | |
| | 226 | action = new GeoExt.Action({ |
| | 227 | tooltip: "Previous view", |
| | 228 | control: ctrl.previous, |
| | 229 | iconCls: 'back', |
| | 230 | disabled: true |
| | 231 | }); |
| | 232 | toolbarItems.push(action); |
| | 233 | |
| | 234 | action = new GeoExt.Action({ |
| | 235 | tooltip: "Next view", |
| | 236 | control: ctrl.next, |
| | 237 | iconCls: 'next', |
| | 238 | disabled: true |
| | 239 | }); |
| | 240 | toolbarItems.push(action); |
| | 241 | |
| | 242 | createSeparator(); |
| | 243 | } |
| | 244 | |