2 @package mapdisp.overlays
4 @brief Map display overlays - barscale and legend
7 - overlays::OverlayController
8 - overlays::BarscaleController
9 - overlays::LegendController
11 (C) 2006-2013 by the GRASS Development Team
13 This program is free software under the GNU General Public License
14 (>=v2). Read the file COPYING that comes with GRASS for details.
16 @author Anna Kratochvilova <kratochanna gmail.com>
20 """!Base class for decorations (barscale, legend) controller."""
32 if i.startswith(
"at="):
42 cmd = property(fset = SetCmd, fget = GetCmd)
50 coords = property(fset = SetCoords, fget = GetCoords)
55 pdcType = property(fget = GetPdcType)
60 name = property(fget = GetName)
65 id = property(fget = GetId)
73 propwin = property(fget = GetPropwin, fset = SetPropwin)
78 layer = property(fget = GetLayer)
81 if self.
_overlay and self._overlay.IsActive():
85 def Show(self, show = True):
86 """!Activate or deactivate overlay."""
90 self._overlay.SetActive(
True)
98 self._overlay.SetActive(
False)
101 self.
_overlay = self._renderer.AddOverlay(id = self._id, type = self._name,
102 command = self.
cmd, l_active =
False,
103 l_render =
False, l_hidden =
True)
107 self._renderer.ChangeOverlay(id = self._id, command = self.
_cmd,
113 OverlayController.__init__(self, renderer)
115 self.
_name =
'barscale'
122 OverlayController.__init__(self, renderer)
124 self.
_name =
'legend'
130 """!Resize legend according to given bbox coordinates."""
131 w = abs(begin[0] - end[0])
132 h = abs(begin[1] - end[1])
133 if begin[0] < end[0]:
137 if begin[1] < end[1]:
142 at = [(screenSize[1] - (y + h)) / float(screenSize[1]) * 100,
143 (screenSize[1] - y) / float(screenSize[1]) * 100,
144 x / float(screenSize[0]) * 100,
145 (x + w) / float(screenSize[0]) * 100]
146 atStr =
"at=%d,%d,%d,%d" % (at[0], at[1], at[2], at[3])
148 for i, subcmd
in enumerate(self.
_cmd):
149 if subcmd.startswith(
'at='):
def ResizeLegend
Resize legend according to given bbox coordinates.
def Show
Activate or deactivate overlay.
Base class for decorations (barscale, legend) controller.