Changeset 1674
- Timestamp:
- 02/10/09 14:26:53 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/MapFish/client/mfbase/mapfish/widgets/recenter/Base.js
r1340 r1674 175 175 fieldLabel: OpenLayers.i18n('mf.print.scale'), 176 176 typeAhead: false, 177 value: this.scales[this.defaultZoom] || this.scales[0], 177 178 mode: 'local', 178 179 id: 'scale_' + this.getId(), … … 209 210 // use default zoom level if provided in widget config, 210 211 // else keep current zoom level 211 zoom = zoom || this.defaultZoom || this.map.getZoom(); 212 if (typeof(zoom) == 'undefined') { 213 zoom = (typeof(this.defaultZoom) != 'undefined') 214 ? this.defaultZoom : this.map.getZoom() 215 } 212 216 213 217 if (this.showCenter) { … … 215 219 this.showCenterMark(x, y); 216 220 } 217 221 218 222 this.map.setCenter(new OpenLayers.LonLat(x, y), zoom); 223 }, 224 225 /** 226 * Method: recenterOnBbox 227 * Recenters on given bounds 228 * 229 * Parameters: 230 * bbox - {<OpenLayers.Bounds>} 231 */ 232 recenterOnBbox: function(bbox) { 233 if (this.showCenter) { 234 // display a symbol on the center point of the bbox 235 var lonlat = bbox.getCenterLonLat(); 236 this.showCenterMark(lonlat.lon, lonlat.lat); 237 } 238 239 this.map.zoomToExtent(bbox); 240 }, 241 242 /** 243 * Method: recenterOnGeometry 244 * Recenters on given geometry 245 * 246 * Parameters: 247 * geometry - {<OpenLayers.Geometry>} 248 */ 249 recenterOnGeometry: function(geometry) { 250 if (geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { 251 this.recenterOnCoords(geometry.x, geometry.y); 252 } else { 253 this.recenterOnBbox(geometry.getBounds()); 254 } 219 255 }, 220 256 … … 233 269 new OpenLayers.Feature.Vector( 234 270 new OpenLayers.Geometry.Point(x, y), 235 { type: 'cross' }271 { type: this.symbol || 'cross' } 236 272 ) 237 273 ]; … … 250 286 } else { 251 287 var styles = new OpenLayers.StyleMap({ 252 "default": {288 "default": OpenLayers.Util.extend({ 253 289 graphicName: "${type}", // retrieved from symbol type attribute 254 290 pointRadius: 10, 255 291 fillColor: "red", 256 292 fillOpacity: 1 257 } 293 }, this.centerMarkStyles) 258 294 }); 259 295
