| | 172 | }, |
|---|
| | 173 | |
|---|
| | 174 | /** |
|---|
| | 175 | * Method: recenterOnBbox |
|---|
| | 176 | * Recenters on given bounds |
|---|
| | 177 | * |
|---|
| | 178 | * Parameters: |
|---|
| | 179 | * {<OpenLayers.Bounds>} - bbox |
|---|
| | 180 | */ |
|---|
| | 181 | recenterOnBbox: function(bbox) { |
|---|
| | 182 | if (this.showCenter) { |
|---|
| | 183 | // display a symbol on the center point of the bbox |
|---|
| | 184 | var lonlat = bbox.getCenterLonLat(); |
|---|
| | 185 | this.showCenter(lonlat.lon, lonlat.lat); |
|---|
| | 186 | } |
|---|
| | 187 | |
|---|
| | 188 | this.map.zoomToExtent(bbox, true); |
|---|
| | 189 | }, |
|---|
| | 190 | |
|---|
| | 191 | /** |
|---|
| | 192 | * Method: showCenter |
|---|
| | 193 | * Materializes new center with a cross |
|---|
| | 194 | * |
|---|
| | 195 | * Parameters: |
|---|
| | 196 | * {Float} - easting coordinate |
|---|
| | 197 | * {Float} - northing coordinate |
|---|
| | 198 | */ |
|---|
| | 199 | showCenter: function(x, y) { |
|---|
| | 200 | this.prepareVectorLayer(); |
|---|
| | 201 | |
|---|
| | 202 | var features = [ |
|---|
| | 203 | new OpenLayers.Feature.Vector( |
|---|
| | 204 | new OpenLayers.Geometry.Point(x, y), { |
|---|
| | 205 | type: 'cross' |
|---|
| | 206 | } |
|---|
| | 207 | ) |
|---|
| | 208 | ]; |
|---|
| | 209 | |
|---|
| | 210 | this.vectorLayer.addFeatures(features); |
|---|