973 |
ID_UTM_PROPOSE_ZONE_DIALOG_TAKE = 4001 |
ID_UTM_PROPOSE_ZONE_DIALOG_TAKE = 4001 |
974 |
ID_UTM_PROPOSE_ZONE_DIALOG_CANCEL = 4002 |
ID_UTM_PROPOSE_ZONE_DIALOG_CANCEL = 4002 |
975 |
class UTMProposeZoneDialog(wxDialog): |
class UTMProposeZoneDialog(wxDialog): |
976 |
|
|
977 |
"""Propose a sensible Zone considering the current map extent.""" |
"""Propose a sensible Zone considering the current map extent.""" |
978 |
|
|
979 |
def __init__(self, parent, (x, y, x2, y2)): |
def __init__(self, parent, (x, y, x2, y2)): |
980 |
wxDialog.__init__(self, parent, -1, _("Projection: Propose UTM Zone"), |
wxDialog.__init__(self, parent, -1, _("Projection: Propose UTM Zone"), |
981 |
wxDefaultPosition, wxSize(200, 100)) |
wxDefaultPosition, wxSize(200, 100)) |
985 |
center = (x2 - x) / 2 + x |
center = (x2 - x) / 2 + x |
986 |
self.proposedZone = int(center / 6 + 1) |
self.proposedZone = int(center / 6 + 1) |
987 |
self.dialogLayout() |
self.dialogLayout() |
988 |
|
|
989 |
def dialogLayout(self): |
def dialogLayout(self): |
990 |
topBox = wxBoxSizer(wxVERTICAL) |
topBox = wxBoxSizer(wxVERTICAL) |
991 |
|
|
992 |
textBox = wxBoxSizer(wxVERTICAL) |
textBox = wxBoxSizer(wxVERTICAL) |
993 |
textBox.Add(wxStaticText(self, -1, _("The current map extent center " + |
textBox.Add(wxStaticText(self, -1, _("The current map extent center " |
994 |
"lies in UTM Zone")), |
"lies in UTM Zone")), |
995 |
0, wxALIGN_CENTER|wxALL, 4) |
0, wxALIGN_CENTER|wxALL, 4) |
996 |
textBox.Add(wxStaticText(self, -1, str(self.proposedZone)), |
textBox.Add(wxStaticText(self, -1, str(self.proposedZone)), |
997 |
0, wxALIGN_CENTER|wxALL, 4) |
0, wxALIGN_CENTER|wxALL, 4) |
998 |
|
|
999 |
topBox.Add(textBox, 1, wxEXPAND|wxALL, 4) |
topBox.Add(textBox, 1, wxEXPAND|wxALL, 4) |
1000 |
|
|
1001 |
buttonBox = wxBoxSizer(wxHORIZONTAL) |
buttonBox = wxBoxSizer(wxHORIZONTAL) |
1002 |
buttonBox.Add(wxButton(self, ID_UTM_PROPOSE_ZONE_DIALOG_TAKE, |
buttonBox.Add(wxButton(self, ID_UTM_PROPOSE_ZONE_DIALOG_TAKE, |
1003 |
_("Take")), 0, wxALL, 4) |
_("Take")), 0, wxALL, 4) |
1006 |
topBox.Add(buttonBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10) |
topBox.Add(buttonBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10) |
1007 |
EVT_BUTTON(self, ID_UTM_PROPOSE_ZONE_DIALOG_TAKE, self.OnTake) |
EVT_BUTTON(self, ID_UTM_PROPOSE_ZONE_DIALOG_TAKE, self.OnTake) |
1008 |
EVT_BUTTON(self, ID_UTM_PROPOSE_ZONE_DIALOG_CANCEL, self.OnCancel) |
EVT_BUTTON(self, ID_UTM_PROPOSE_ZONE_DIALOG_CANCEL, self.OnCancel) |
1009 |
|
|
1010 |
self.SetAutoLayout(True) |
self.SetAutoLayout(True) |
1011 |
self.SetSizer(topBox) |
self.SetSizer(topBox) |
1012 |
topBox.Fit(self) |
topBox.Fit(self) |
1013 |
topBox.SetSizeHints(self) |
topBox.SetSizeHints(self) |
1014 |
|
|
1015 |
def OnTake(self, event): |
def OnTake(self, event): |
1016 |
self.EndModal(wxID_OK) |
self.EndModal(wxID_OK) |
1017 |
|
|
1018 |
def OnCancel(self, event): |
def OnCancel(self, event): |
1019 |
self.EndModal(wxID_CANCEL) |
self.EndModal(wxID_CANCEL) |
1020 |
|
|