/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/projdialog.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/projdialog.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1542 by bh, Fri Aug 1 16:13:49 2003 UTC revision 1566 by bh, Fri Aug 8 13:01:30 2003 UTC
# Line 2  Line 2 
2  # Authors:  # Authors:
3  # Jonathan Coles <[email protected]>  # Jonathan Coles <[email protected]>
4  # Frank Koormann <[email protected]>  # Frank Koormann <[email protected]>
5    # Jan-Oliver Wagner <[email protected]>
6  #  #
7  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
8  # Read the file COPYING coming with Thuban for details.  # Read the file COPYING coming with Thuban for details.
# Line 831  class UTMPanel(ProjPanel): Line 832  class UTMPanel(ProjPanel):
832          ProjPanel.Clear(self)          ProjPanel.Clear(self)
833    
834      def _OnPropose(self, event):      def _OnPropose(self, event):
835          UTMProposeZoneDialog          """Call the propose dialog.
836            If the receiver (e.g. the current map) has no bounding box,
837            inform the user accordingly.
838            """
839            bb = self.receiver.BoundingBox()
840            if bb is None:
841                dlg = wxMessageDialog(self,
842                        _("Can not propose: No bounding box found."),
843                        _("Projection: Propose UTM Zone"),
844                        wxOK | wxICON_INFORMATION)
845                dlg.CenterOnParent()
846                result = dlg.ShowModal()
847                dlg.Destroy()
848                return
849    
850          dlg = UTMProposeZoneDialog(self, self.receiver.BoundingBox())          dlg = UTMProposeZoneDialog(self, self.receiver.BoundingBox())
851          if dlg.ShowModal() == wxID_OK:          if dlg.ShowModal() == wxID_OK:
852              self.__zone.SetValue(dlg.GetProposedZone())              self.__zone.SetValue(dlg.GetProposedZone())
# Line 958  class GeoPanel(ProjPanel): Line 973  class GeoPanel(ProjPanel):
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))
982          self.parent = parent          self.parent = parent
         #x, y, x2, y2 = elf.parent.parent.map_bounding_box  
983          x = x + 180          x = x + 180
984          x2 = x2 + 180          x2 = x2 + 180
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)
# Line 992  class UTMProposeZoneDialog(wxDialog): Line 1006  class UTMProposeZoneDialog(wxDialog):
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    

Legend:
Removed from v.1542  
changed lines
  Added in v.1566

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26