|
@@ -840,8 +840,7 @@ class Mapinfo(InstructionObject):
|
|
|
self.type = 'mapinfo'
|
|
|
# default values
|
|
|
self.defaultInstruction = dict(unit = 'inch', where = (0, 0),
|
|
|
- font = 'Helvetica', fontsize = 10, color = 'black', background = 'none',
|
|
|
- #font = 'Sans', fontsize = 10, color = '0:0:0', background = 'none',
|
|
|
+ font = 'Helvetica', fontsize = 10, color = '0:0:0', background = 'none',
|
|
|
border = 'none', rect = None)
|
|
|
# current values
|
|
|
self.instruction = dict(self.defaultInstruction)
|
|
@@ -2838,7 +2837,6 @@ class VectorPanel(wx.Panel):
|
|
|
|
|
|
vector.SetInstruction({'list': deepcopy(self.vectorList)})
|
|
|
|
|
|
-
|
|
|
# save new vectors
|
|
|
for item in self.vectorList:
|
|
|
id = item[2]
|
|
@@ -2856,6 +2854,7 @@ class VectorPanel(wx.Panel):
|
|
|
|
|
|
if 'map' in self.parent.parent.openDialogs:
|
|
|
self.parent.parent.openDialogs['map'].updateDialog()
|
|
|
+
|
|
|
return True
|
|
|
|
|
|
class RasterDialog(PsmapDialog):
|
|
@@ -4145,9 +4144,6 @@ class LegendDialog(PsmapDialog):
|
|
|
|
|
|
fontSizer.Add(item = flexSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 1)
|
|
|
border.Add(item = fontSizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 5)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
# some enable/disable methods
|
|
|
|
|
@@ -4233,8 +4229,7 @@ class LegendDialog(PsmapDialog):
|
|
|
|
|
|
self.rSizeGBSizer.Add(self.panelRaster.heightOrColumnsCtrl, pos = (1,1), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
self.panelRaster.Layout()
|
|
|
- self.panelRaster.Fit()
|
|
|
-
|
|
|
+ self.panelRaster.Fit()
|
|
|
|
|
|
def OnRange(self, event):
|
|
|
if not self.range.GetValue():
|
|
@@ -4349,13 +4344,7 @@ class LegendDialog(PsmapDialog):
|
|
|
# font
|
|
|
self.rLegendDict['font'] = self.panelRaster.font['fontCtrl'].GetStringSelection()
|
|
|
self.rLegendDict['fontsize'] = self.panelRaster.font['fontSizeCtrl'].GetValue()
|
|
|
-## font = self.panelRaster.font['fontCtrl'].GetSelectedFont()
|
|
|
-## self.rLegendDict['font'] = font.GetFaceName()
|
|
|
-## self.rLegendDict['fontsize'] = font.GetPointSize()
|
|
|
color = self.panelRaster.font['colorCtrl'].GetColour()
|
|
|
-## if color.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
|
|
|
-## self.rLegendDict['color'] = color.GetAsString(wx.C2S_NAME)
|
|
|
-## else:
|
|
|
self.rLegendDict['color'] = convertRGB(color)
|
|
|
|
|
|
# position
|
|
@@ -4469,8 +4458,6 @@ class LegendDialog(PsmapDialog):
|
|
|
# font
|
|
|
self.vLegendDict['font'] = self.panelVector.font['fontCtrl'].GetStringSelection()
|
|
|
self.vLegendDict['fontsize'] = self.panelVector.font['fontSizeCtrl'].GetValue()
|
|
|
-## self.vLegendDict['font'] = font.GetFaceName()
|
|
|
-## self.vLegendDict['fontsize'] = font.GetPointSize()
|
|
|
dc = wx.PaintDC(self)
|
|
|
font = dc.GetFont()
|
|
|
dc.SetFont(wx.Font(pointSize = self.vLegendDict['fontsize'], family = font.GetFamily(),
|
|
@@ -4499,16 +4486,11 @@ class LegendDialog(PsmapDialog):
|
|
|
#border
|
|
|
if self.borderCheck.GetValue():
|
|
|
color = self.borderColorCtrl.GetColour()
|
|
|
-## if color.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
|
|
|
-## self.vLegendDict['border'] = color.GetAsString(wx.C2S_NAME)
|
|
|
-## else:
|
|
|
self.vLegendDict['border'] = convertRGB(color)
|
|
|
|
|
|
else:
|
|
|
self.vLegendDict['border'] = 'none'
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
if not self.id[1] in self.instruction:
|
|
|
vectorLegend = VectorLegend(self.id[1])
|
|
|
self.instruction.AddInstruction(vectorLegend)
|
|
@@ -4590,7 +4572,6 @@ class MapinfoDialog(PsmapDialog):
|
|
|
else:
|
|
|
self.id = wx.NewId()
|
|
|
self.mapinfo = Mapinfo(self.id)
|
|
|
-
|
|
|
self.mapinfoDict = self.mapinfo.GetInstruction()
|
|
|
page = self.instruction.FindInstructionByType('page').GetInstruction()
|
|
|
self.mapinfoDict['where'] = page['Left'], page['Top']
|
|
@@ -4634,11 +4615,6 @@ class MapinfoDialog(PsmapDialog):
|
|
|
|
|
|
self.AddFont(parent = panel, dialogDict = self.mapinfoDict)#creates font color too, used below
|
|
|
|
|
|
-## gridBagSizer.Add(panel.font['fontLabel'], pos = (0,0), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
-## gridBagSizer.Add(panel.font['fontCtrl'], pos = (0,1), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
-## gridBagSizer.Add(panel.font['colorLabel'], pos = (1,0), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
-## gridBagSizer.Add(panel.font['colorCtrl'], pos = (1,1), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
-
|
|
|
gridBagSizer.Add(panel.font['fontLabel'], pos = (0,0), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
gridBagSizer.Add(panel.font['fontCtrl'], pos = (0,1), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
gridBagSizer.Add(panel.font['fontSizeLabel'], pos = (1,0), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
@@ -4668,7 +4644,6 @@ class MapinfoDialog(PsmapDialog):
|
|
|
self.colors['borderColor'].SetColour(convertRGB(self.mapinfoDict['border']))
|
|
|
else:
|
|
|
self.colors['borderCtrl'].SetValue(False)
|
|
|
- self.colors['borderColor'].SetColour('white')
|
|
|
|
|
|
if self.mapinfoDict['background'] == None:
|
|
|
self.mapinfoDict['background'] == 'none'
|
|
@@ -4677,8 +4652,7 @@ class MapinfoDialog(PsmapDialog):
|
|
|
self.colors['backgroundColor'].SetColour(convertRGB(self.mapinfoDict['background']))
|
|
|
else:
|
|
|
self.colors['backgroundCtrl'].SetValue(False)
|
|
|
- self.colors['backgroundColor'].SetColour('white')
|
|
|
-
|
|
|
+
|
|
|
flexSizer.Add(self.colors['borderCtrl'], proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
flexSizer.Add(self.colors['borderColor'], proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
flexSizer.Add(self.colors['backgroundCtrl'], proportion = 0, flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
@@ -4689,7 +4663,6 @@ class MapinfoDialog(PsmapDialog):
|
|
|
|
|
|
panel.SetSizer(border)
|
|
|
|
|
|
-
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnIsBorder, self.colors['borderCtrl'])
|
|
|
self.Bind(wx.EVT_CHECKBOX, self.OnIsBackground, self.colors['backgroundCtrl'])
|
|
|
|
|
@@ -4715,6 +4688,7 @@ class MapinfoDialog(PsmapDialog):
|
|
|
#units
|
|
|
currUnit = self.panel.units['unitsCtrl'].GetStringSelection()
|
|
|
self.mapinfoDict['unit'] = currUnit
|
|
|
+
|
|
|
# position
|
|
|
if self.panel.position['xCtrl'].GetValue():
|
|
|
x = self.panel.position['xCtrl'].GetValue()
|
|
@@ -4729,33 +4703,23 @@ class MapinfoDialog(PsmapDialog):
|
|
|
x = self.unitConv.convert(value = float(self.panel.position['xCtrl'].GetValue()), fromUnit = currUnit, toUnit = 'inch')
|
|
|
y = self.unitConv.convert(value = float(self.panel.position['yCtrl'].GetValue()), fromUnit = currUnit, toUnit = 'inch')
|
|
|
self.mapinfoDict['where'] = (x, y)
|
|
|
+
|
|
|
# font
|
|
|
self.mapinfoDict['font'] = self.panel.font['fontCtrl'].GetStringSelection()
|
|
|
self.mapinfoDict['fontsize'] = self.panel.font['fontSizeCtrl'].GetValue()
|
|
|
-## font = self.panel.font['fontCtrl'].GetSelectedFont()
|
|
|
-## self.mapinfoDict['font'] = font.GetFaceName()
|
|
|
-## self.mapinfoDict['fontsize'] = font.GetPointSize()
|
|
|
+
|
|
|
#colors
|
|
|
color = self.panel.font['colorCtrl'].GetColour()
|
|
|
-## if color.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
|
|
|
-## self.mapinfoDict['color'] = color.GetAsString(wx.C2S_NAME)
|
|
|
-## else:
|
|
|
self.mapinfoDict['color'] = convertRGB(color)
|
|
|
|
|
|
if self.colors['backgroundCtrl'].GetValue():
|
|
|
background = self.colors['backgroundColor'].GetColour()
|
|
|
-## if background.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
|
|
|
-## self.mapinfoDict['background'] = background.GetAsString(wx.C2S_NAME)
|
|
|
-## else:
|
|
|
self.mapinfoDict['background'] = convertRGB(background)
|
|
|
else:
|
|
|
self.mapinfoDict['background'] = 'none'
|
|
|
|
|
|
if self.colors['borderCtrl'].GetValue():
|
|
|
border = self.colors['borderColor'].GetColour()
|
|
|
-## if border.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
|
|
|
-## self.mapinfoDict['border'] = border.GetAsString(wx.C2S_NAME)
|
|
|
-## else:
|
|
|
self.mapinfoDict['border'] = convertRGB(border)
|
|
|
else:
|
|
|
self.mapinfoDict['border'] = 'none'
|
|
@@ -4763,15 +4727,17 @@ class MapinfoDialog(PsmapDialog):
|
|
|
# estimation of size
|
|
|
self.mapinfoDict['rect'] = self.mapinfo.EstimateRect(self.mapinfoDict)
|
|
|
|
|
|
-
|
|
|
if self.id not in self.instruction:
|
|
|
mapinfo = Mapinfo(self.id)
|
|
|
self.instruction.AddInstruction(mapinfo)
|
|
|
+
|
|
|
self.instruction[self.id].SetInstruction(self.mapinfoDict)
|
|
|
|
|
|
if self.id not in self.parent.objectId:
|
|
|
self.parent.objectId.append(self.id)
|
|
|
|
|
|
+ self.updateDialog()
|
|
|
+
|
|
|
return True
|
|
|
|
|
|
def updateDialog(self):
|
|
@@ -4782,9 +4748,7 @@ class MapinfoDialog(PsmapDialog):
|
|
|
y = self.unitConv.convert(value = y, fromUnit = 'inch', toUnit = currUnit)
|
|
|
self.panel.position['xCtrl'].SetValue("%5.3f" % x)
|
|
|
self.panel.position['yCtrl'].SetValue("%5.3f" % y)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
class ScalebarDialog(PsmapDialog):
|
|
|
"""!Dialog for scale bar"""
|
|
|
def __init__(self, parent, id, settings):
|
|
@@ -4800,8 +4764,6 @@ class ScalebarDialog(PsmapDialog):
|
|
|
page = self.instruction.FindInstructionByType('page').GetInstruction()
|
|
|
self.scalebarDict['where'] = page['Left'], page['Top']
|
|
|
|
|
|
-
|
|
|
-
|
|
|
self.panel = self._scalebarPanel()
|
|
|
|
|
|
self._layout(self.panel)
|
|
@@ -5106,7 +5068,6 @@ class TextDialog(PsmapDialog):
|
|
|
sizer.Add(self.textCtrl, proportion = 1, flag = wx.ALIGN_CENTER_VERTICAL|wx.ALL, border = 5)
|
|
|
border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 5)
|
|
|
|
|
|
-
|
|
|
#font
|
|
|
|
|
|
box = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Font settings"))
|
|
@@ -5145,19 +5106,21 @@ class TextDialog(PsmapDialog):
|
|
|
self.effect['borderColor'] = wx.ColourPickerCtrl(panel, id = wx.ID_ANY)
|
|
|
self.effect['borderWidth'] = wx.SpinCtrl(panel, id = wx.ID_ANY, size = self.spinCtrlSize, min = 1, max = 25, initial = 1)
|
|
|
self.effect['borderWidthLabel'] = wx.StaticText(panel, id = wx.ID_ANY, label = _("Width (pts):"))
|
|
|
+
|
|
|
#set values
|
|
|
- if self.textDict['background'] != 'none':
|
|
|
+ if self.textDict['background'] == None:
|
|
|
+ self.textDict['background'] = 'none'
|
|
|
+ elif self.textDict['background'] != 'none':
|
|
|
self.effect['backgroundCtrl'].SetValue(True)
|
|
|
+ self.effect['backgroundColor'].SetColour(convertRGB(self.textDict['background']))
|
|
|
else:
|
|
|
self.effect['backgroundCtrl'].SetValue(False)
|
|
|
|
|
|
- if self.textDict['background'] != 'none':
|
|
|
- self.effect['backgroundColor'].SetColour(convertRGB(self.textDict['background']))
|
|
|
- else:
|
|
|
- self.effect['backgroundColor'].SetColour('white')
|
|
|
-
|
|
|
- if self.textDict['hcolor'] != 'none':
|
|
|
+ if self.textDict['hcolor'] == None:
|
|
|
+ self.textDict['hcolor'] = 'none'
|
|
|
+ elif self.textDict['hcolor'] != 'none':
|
|
|
self.effect['highlightCtrl'].SetValue(True)
|
|
|
+ self.effect['highlightColor'].SetColour(convertRGB(self.textDict['hcolor']))
|
|
|
else:
|
|
|
self.effect['highlightCtrl'].SetValue(False)
|
|
|
|
|
@@ -5167,15 +5130,14 @@ class TextDialog(PsmapDialog):
|
|
|
self.effect['highlightColor'].SetColour(convertRGB('grey'))
|
|
|
|
|
|
self.effect['highlightWidth'].SetValue(float(self.textDict['hwidth']))
|
|
|
- if self.textDict['border'] != 'none':
|
|
|
+
|
|
|
+ if self.textDict['border'] == None:
|
|
|
+ self.textDict['border'] = 'none'
|
|
|
+ elif self.textDict['border'] != 'none':
|
|
|
self.effect['borderCtrl'].SetValue(True)
|
|
|
- else:
|
|
|
- self.effect['borderCtrl'].SetValue(False)
|
|
|
-
|
|
|
- if self.textDict['border'] != 'none':
|
|
|
self.effect['borderColor'].SetColour(convertRGB(self.textDict['border']))
|
|
|
else:
|
|
|
- self.effect['borderColor'].SetColour('black')
|
|
|
+ self.effect['borderCtrl'].SetValue(False)
|
|
|
|
|
|
self.effect['borderWidth'].SetValue(float(self.textDict['width']))
|
|
|
|
|
@@ -5200,6 +5162,7 @@ class TextDialog(PsmapDialog):
|
|
|
|
|
|
panel.SetSizer(border)
|
|
|
panel.Fit()
|
|
|
+
|
|
|
return panel
|
|
|
|
|
|
def _positionPanel(self, notebook):
|
|
@@ -5243,11 +5206,9 @@ class TextDialog(PsmapDialog):
|
|
|
self.gridBagSizerP.Add(panel.position['yCtrl'], pos = (2,1), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
self.gridBagSizerP.Add(panel.position['comment'], pos = (3,0), span = (1,2), flag = wx.ALIGN_BOTTOM, border = 0)
|
|
|
|
|
|
-
|
|
|
sizerP.Add(self.gridBagSizerP, proportion = 1, flag = wx.EXPAND|wx.ALL, border = 5)
|
|
|
gridBagSizer.Add(sizerP, pos = (2,0),span = (1,1), flag = wx.ALIGN_CENTER_HORIZONTAL|wx.EXPAND, border = 0)
|
|
|
|
|
|
-
|
|
|
# second box - map coordinates
|
|
|
box2 = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = "")
|
|
|
sizerM = wx.StaticBoxSizer(box2, wx.VERTICAL)
|
|
@@ -5263,7 +5224,6 @@ class TextDialog(PsmapDialog):
|
|
|
self.eastingCtrl.SetValue(str(east))
|
|
|
self.northingCtrl.SetValue(str(north))
|
|
|
|
|
|
-
|
|
|
self.gridBagSizerM.Add(self.eastingLabel, pos = (0,0), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
self.gridBagSizerM.Add(self.northingLabel, pos = (1,0), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
|
self.gridBagSizerM.Add(self.eastingCtrl, pos = (0,1), flag = wx.ALIGN_CENTER_VERTICAL, border = 0)
|
|
@@ -5308,8 +5268,7 @@ class TextDialog(PsmapDialog):
|
|
|
self.radio[-1].SetValue(False)
|
|
|
flexSizer.Add(self.radio[-1], proportion = 0, flag = wx.ALIGN_CENTER, border = 0)
|
|
|
self.FindWindowByName(self.textDict['ref']).SetValue(True)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
sizerR.Add(flexSizer, proportion = 1, flag = wx.EXPAND, border = 0)
|
|
|
gridBagSizer.Add(sizerR, pos = (3,1), flag = wx.ALIGN_LEFT|wx.EXPAND, border = 0)
|
|
|
|
|
@@ -5362,6 +5321,7 @@ class TextDialog(PsmapDialog):
|
|
|
widget.GetWindow().Enable()
|
|
|
for widget in self.gridBagSizerP.GetChildren():
|
|
|
widget.GetWindow().Disable()
|
|
|
+
|
|
|
def OnBackground(self, event):
|
|
|
if self.effect['backgroundCtrl'].GetValue():
|
|
|
self.effect['backgroundColor'].Enable()
|
|
@@ -5402,14 +5362,9 @@ class TextDialog(PsmapDialog):
|
|
|
#font
|
|
|
self.textDict['font'] = self.textPanel.font['fontCtrl'].GetStringSelection()
|
|
|
self.textDict['fontsize'] = self.textPanel.font['fontSizeCtrl'].GetValue()
|
|
|
-## font = self.textPanel.font['fontCtrl'].GetSelectedFont()
|
|
|
-## self.textDict['font'] = font.GetFaceName()
|
|
|
-## self.textDict['fontsize'] = font.GetPointSize()
|
|
|
color = self.textPanel.font['colorCtrl'].GetColour()
|
|
|
-## if color.GetAsString(wx.C2S_NAME) in PSMAP_COLORS:
|
|
|
-## self.textDict['color'] = color.GetAsString(wx.C2S_NAME)
|
|
|
-## else:
|
|
|
self.textDict['color'] = convertRGB(color)
|
|
|
+
|
|
|
#effects
|
|
|
if self.effect['backgroundCtrl'].GetValue():
|
|
|
background = self.effect['backgroundColor'].GetColour()
|
|
@@ -5436,6 +5391,7 @@ class TextDialog(PsmapDialog):
|
|
|
#offset
|
|
|
self.textDict['xoffset'] = self.xoffCtrl.GetValue()
|
|
|
self.textDict['yoffset'] = self.yoffCtrl.GetValue()
|
|
|
+
|
|
|
#position
|
|
|
if self.paperPositionCtrl.GetValue():
|
|
|
self.textDict['XY'] = True
|
|
@@ -5487,6 +5443,8 @@ class TextDialog(PsmapDialog):
|
|
|
if self.id not in self.parent.objectId:
|
|
|
self.parent.objectId.append(self.id)
|
|
|
|
|
|
+# self.updateDialog()
|
|
|
+
|
|
|
return True
|
|
|
|
|
|
def updateDialog(self):
|
|
@@ -5502,7 +5460,6 @@ class TextDialog(PsmapDialog):
|
|
|
e, n = self.textDict['east'], self.textDict['north']
|
|
|
self.eastingCtrl.SetValue(str(self.textDict['east']))
|
|
|
self.northingCtrl.SetValue(str(self.textDict['north']))
|
|
|
-
|
|
|
|
|
|
def convertRGB(rgb):
|
|
|
"""!Converts wx.Colour(r,g,b,a) to string 'r:g:b' or named color,
|