|
1 # |
|
2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net> |
|
3 # All Rights Reserved. |
|
4 # |
|
5 # This software is subject to the provisions of the Zope Public License, |
|
6 # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
|
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
|
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
|
10 # FOR A PARTICULAR PURPOSE. |
|
11 # |
|
12 |
|
13 __docformat__ = 'restructuredtext' |
|
14 |
|
15 |
|
16 # import standard library |
|
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 |
|
26 from pyams_gis import _ |
|
27 |
|
28 |
|
29 class IMapConfiguration(Interface): |
|
30 """Map configuration interface""" |
|
31 |
|
32 crs = Choice(title=_("CRS"), |
|
33 description=_("Coordinates reference system to use for the map"), |
|
34 vocabulary=LAYER_CRS_VOCABULARY, |
|
35 default=LAYER_CRS[WGS84WM], |
|
36 required=True) |
|
37 |
|
38 layers = List(title=_("Layers list"), |
|
39 description=_("List of available layers displayed into this map"), |
|
40 value_type=Choice(vocabulary='PyAMS map layers'), |
|
41 required=False) |
|
42 |
|
43 attribution_control = Bool(title=_("Attribution control?"), |
|
44 description=_("If 'yes', an attribution control is added to map"), |
|
45 required=True, |
|
46 default=True) |
|
47 |
|
48 zoom_control = Bool(title=_("Zoom control?"), |
|
49 description=_("If 'yes', a zoom control is added to map"), |
|
50 required=True, |
|
51 default=True) |
|
52 |
|
53 layer_control = Bool(title=_("Layers control?"), |
|
54 description=_("If 'yes', a layer selection control is added to map"), |
|
55 required=True, |
|
56 default=False) |
|
57 |
|
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?"), |
|
73 description=_("If 'yes', makes the map focusable and allows users to navigate with " |
|
74 "keyboard arrows and +/- keys"), |
|
75 required=True, |
|
76 default=True) |
|
77 |
|
78 scroll_wheel_zoom = Bool(title=_("Scroll wheel zoom?"), |
|
79 description=_("If 'yes', the map can be zoomed using the mouse wheel"), |
|
80 required=True, |
|
81 default=True) |
|
82 |
|
83 def get_configuration(self): |
|
84 """Get map layers configuration""" |
|
85 |
|
86 |
|
87 class IMapConfigurationTarget(Interface): |
|
88 """Map configuration target marker interface""" |