src/pyams_gis/interfaces/configuration.py
changeset 72 032947e7ef0c
parent 0 c73bb834ccbe
child 78 808bd0bc9d86
equal deleted inserted replaced
71:8a73283378e1 72:032947e7ef0c
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
     9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
    10 # FOR A PARTICULAR PURPOSE.
    10 # FOR A PARTICULAR PURPOSE.
    11 #
    11 #
    12 
    12 
    13 __docformat__ = 'restructuredtext'
    13 from zope.interface import Interface
       
    14 from zope.schema import Bool, Choice, Int, List
       
    15 
       
    16 from pyams_gis.interfaces import LAYER_CRS, LAYER_CRS_VOCABULARY, WGS84WM
       
    17 from pyams_gis.schema import GeoAreaField, GeoPointField
    14 
    18 
    15 
    19 
    16 # import standard library
    20 __docformat__ = 'restructuredtext'
    17 
       
    18 # import interfaces
       
    19 from pyams_gis.interfaces import LAYER_CRS, LAYER_CRS_VOCABULARY, WGS84WM
       
    20 
       
    21 # import packages
       
    22 from pyams_gis.schema import GeoPointField, GeoAreaField
       
    23 from zope.interface import Interface
       
    24 from zope.schema import Choice, Bool, Int, List
       
    25 
    21 
    26 from pyams_gis import _
    22 from pyams_gis import _
    27 
    23 
    28 
    24 
    29 class IMapConfiguration(Interface):
    25 class IMapConfiguration(Interface):
    38     layers = List(title=_("Layers list"),
    34     layers = List(title=_("Layers list"),
    39                   description=_("List of available layers displayed into this map"),
    35                   description=_("List of available layers displayed into this map"),
    40                   value_type=Choice(vocabulary='PyAMS map layers'),
    36                   value_type=Choice(vocabulary='PyAMS map layers'),
    41                   required=False)
    37                   required=False)
    42 
    38 
       
    39     auto_adjust = Bool(title=_("Adjust bounds to markers layer"),
       
    40                        description=_("If 'yes', map area will be automatically adjusted "
       
    41                                      "to markers layer(s), if any"),
       
    42                        required=True,
       
    43                        default=True)
       
    44 
       
    45     initial_center = GeoPointField(title=_("Initial center"),
       
    46                                    description=_("Initial map location center"),
       
    47                                    required=False)
       
    48 
       
    49     zoom_level = Int(title=_("Initial zoom level"),
       
    50                      description=_("Zoom level at which to display map, if auto-adjust is "
       
    51                                    "disabled or if there is only one marker"),
       
    52                      min=0,
       
    53                      max=18,
       
    54                      required=False)
       
    55 
       
    56     initial_bounds = GeoAreaField(title=_("Initial bounds"),
       
    57                                   description=_("Initial map location bounds, if auto-adjust or "
       
    58                                                 "initial center are disabled"),
       
    59                                   required=False)
       
    60 
    43     attribution_control = Bool(title=_("Attribution control?"),
    61     attribution_control = Bool(title=_("Attribution control?"),
    44                                description=_("If 'yes', an attribution control is added to map"),
    62                                description=_("If 'yes', an attribution control is added to map"),
    45                                required=True,
    63                                required=True,
    46                                default=True)
    64                                default=True)
    47 
    65 
    53     layer_control = Bool(title=_("Layers control?"),
    71     layer_control = Bool(title=_("Layers control?"),
    54                          description=_("If 'yes', a layer selection control is added to map"),
    72                          description=_("If 'yes', a layer selection control is added to map"),
    55                          required=True,
    73                          required=True,
    56                          default=False)
    74                          default=False)
    57 
    75 
    58     initial_center = GeoPointField(title=_("Initial center"),
       
    59                                    description=_("Initial map location center"),
       
    60                                    required=False)
       
    61 
       
    62     zoom_level = Int(title=_("Initial zoom level"),
       
    63                      description=_("Zoom level at which to display map"),
       
    64                      min=0,
       
    65                      max=18,
       
    66                      required=False)
       
    67 
       
    68     initial_bounds = GeoAreaField(title=_("Initial bounds"),
       
    69                                   description=_("Initial map location bounds"),
       
    70                                   required=False)
       
    71 
       
    72     keyboard = Bool(title=_("Keyboard navigation?"),
    76     keyboard = Bool(title=_("Keyboard navigation?"),
    73                     description=_("If 'yes', makes the map focusable and allows users to navigate with "
    77                     description=_("If 'yes', makes the map focusable and allows users to "
    74                                   "keyboard arrows and +/- keys"),
    78                                   "navigate with keyboard arrows and +/- keys"),
    75                     required=True,
    79                     required=True,
    76                     default=True)
    80                     default=True)
    77 
    81 
    78     scroll_wheel_zoom = Bool(title=_("Scroll wheel zoom?"),
    82     scroll_wheel_zoom = Bool(title=_("Scroll wheel zoom?"),
    79                              description=_("If 'yes', the map can be zoomed using the mouse wheel"),
    83                              description=_("If 'yes', the map can be zoomed using the mouse "
       
    84                                            "wheel"),
    80                              required=True,
    85                              required=True,
    81                              default=True)
    86                              default=True)
    82 
    87 
    83     def get_configuration(self):
    88     def get_configuration(self):
    84         """Get map layers configuration"""
    89         """Get map layers configuration"""