src/pyams_gis/interfaces/configuration.py
changeset 72 032947e7ef0c
parent 0 c73bb834ccbe
child 78 808bd0bc9d86
--- a/src/pyams_gis/interfaces/configuration.py	Wed Jan 27 15:35:38 2021 +0100
+++ b/src/pyams_gis/interfaces/configuration.py	Wed Jan 27 15:36:14 2021 +0100
@@ -10,18 +10,14 @@
 # FOR A PARTICULAR PURPOSE.
 #
 
-__docformat__ = 'restructuredtext'
+from zope.interface import Interface
+from zope.schema import Bool, Choice, Int, List
+
+from pyams_gis.interfaces import LAYER_CRS, LAYER_CRS_VOCABULARY, WGS84WM
+from pyams_gis.schema import GeoAreaField, GeoPointField
 
 
-# import standard library
-
-# import interfaces
-from pyams_gis.interfaces import LAYER_CRS, LAYER_CRS_VOCABULARY, WGS84WM
-
-# import packages
-from pyams_gis.schema import GeoPointField, GeoAreaField
-from zope.interface import Interface
-from zope.schema import Choice, Bool, Int, List
+__docformat__ = 'restructuredtext'
 
 from pyams_gis import _
 
@@ -40,6 +36,28 @@
                   value_type=Choice(vocabulary='PyAMS map layers'),
                   required=False)
 
+    auto_adjust = Bool(title=_("Adjust bounds to markers layer"),
+                       description=_("If 'yes', map area will be automatically adjusted "
+                                     "to markers layer(s), if any"),
+                       required=True,
+                       default=True)
+
+    initial_center = GeoPointField(title=_("Initial center"),
+                                   description=_("Initial map location center"),
+                                   required=False)
+
+    zoom_level = Int(title=_("Initial zoom level"),
+                     description=_("Zoom level at which to display map, if auto-adjust is "
+                                   "disabled or if there is only one marker"),
+                     min=0,
+                     max=18,
+                     required=False)
+
+    initial_bounds = GeoAreaField(title=_("Initial bounds"),
+                                  description=_("Initial map location bounds, if auto-adjust or "
+                                                "initial center are disabled"),
+                                  required=False)
+
     attribution_control = Bool(title=_("Attribution control?"),
                                description=_("If 'yes', an attribution control is added to map"),
                                required=True,
@@ -55,28 +73,15 @@
                          required=True,
                          default=False)
 
-    initial_center = GeoPointField(title=_("Initial center"),
-                                   description=_("Initial map location center"),
-                                   required=False)
-
-    zoom_level = Int(title=_("Initial zoom level"),
-                     description=_("Zoom level at which to display map"),
-                     min=0,
-                     max=18,
-                     required=False)
-
-    initial_bounds = GeoAreaField(title=_("Initial bounds"),
-                                  description=_("Initial map location bounds"),
-                                  required=False)
-
     keyboard = Bool(title=_("Keyboard navigation?"),
-                    description=_("If 'yes', makes the map focusable and allows users to navigate with "
-                                  "keyboard arrows and +/- keys"),
+                    description=_("If 'yes', makes the map focusable and allows users to "
+                                  "navigate with keyboard arrows and +/- keys"),
                     required=True,
                     default=True)
 
     scroll_wheel_zoom = Bool(title=_("Scroll wheel zoom?"),
-                             description=_("If 'yes', the map can be zoomed using the mouse wheel"),
+                             description=_("If 'yes', the map can be zoomed using the mouse "
+                                           "wheel"),
                              required=True,
                              default=True)