Fixed #9299 -- Made default zoom level for points in the admin more sensible. Thanks to oyvind for ticket and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10635 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
66db0b43ad
commit
1269f9a3e9
|
@ -33,6 +33,7 @@ class GeoModelAdmin(ModelAdmin):
|
||||||
map_srid = 4326
|
map_srid = 4326
|
||||||
map_template = 'gis/admin/openlayers.html'
|
map_template = 'gis/admin/openlayers.html'
|
||||||
openlayers_url = 'http://openlayers.org/api/2.7/OpenLayers.js'
|
openlayers_url = 'http://openlayers.org/api/2.7/OpenLayers.js'
|
||||||
|
point_zoom = num_zoom - 6
|
||||||
wms_url = 'http://labs.metacarta.com/wms/vmap0'
|
wms_url = 'http://labs.metacarta.com/wms/vmap0'
|
||||||
wms_layer = 'basic'
|
wms_layer = 'basic'
|
||||||
wms_name = 'OpenLayers WMS'
|
wms_name = 'OpenLayers WMS'
|
||||||
|
@ -100,6 +101,7 @@ class GeoModelAdmin(ModelAdmin):
|
||||||
'scale_text' : self.scale_text,
|
'scale_text' : self.scale_text,
|
||||||
'map_width' : self.map_width,
|
'map_width' : self.map_width,
|
||||||
'map_height' : self.map_height,
|
'map_height' : self.map_height,
|
||||||
|
'point_zoom' : self.point_zoom,
|
||||||
'srid' : self.map_srid,
|
'srid' : self.map_srid,
|
||||||
'display_srid' : self.display_srid,
|
'display_srid' : self.display_srid,
|
||||||
'wms_url' : self.wms_url,
|
'wms_url' : self.wms_url,
|
||||||
|
@ -124,4 +126,5 @@ if gdal.HAS_GDAL:
|
||||||
map_srid = 900913
|
map_srid = 900913
|
||||||
max_extent = '-20037508,-20037508,20037508,20037508'
|
max_extent = '-20037508,-20037508,20037508,20037508'
|
||||||
max_resolution = 156543.0339
|
max_resolution = 156543.0339
|
||||||
|
point_zoom = num_zoom - 6
|
||||||
units = 'm'
|
units = 'm'
|
||||||
|
|
|
@ -127,6 +127,9 @@
|
||||||
}
|
}
|
||||||
// Zooming to the bounds.
|
// Zooming to the bounds.
|
||||||
{{ module }}.map.zoomToExtent(admin_geom.geometry.getBounds());
|
{{ module }}.map.zoomToExtent(admin_geom.geometry.getBounds());
|
||||||
|
if ({{ module }}.is_point){
|
||||||
|
{{ module }}.map.zoomTo({{ point_zoom }});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
{{ module }}.map.setCenter(new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }}), {{ default_zoom }});
|
{{ module }}.map.setCenter(new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }}), {{ default_zoom }});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue