/[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 1167 by jonathan, Thu Jun 12 12:42:34 2003 UTC revision 1549 by jan, Wed Aug 6 11:18:29 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.
9                                                                                    
10    """Projection dialog"""
11    
12    __version__ = "$Revision$"
13    # $Source$
14    # $Id$
15    
16  import os, sys, math  import os, sys, math
17  from wxPython.wx import *  from wxPython.wx import *
18    
# Line 129  class ProjFrame(NonModalNonParentDialog) Line 136  class ProjFrame(NonModalNonParentDialog)
136    
137          EVT_TEXT(self, ID_PROJ_PROJNAME, self._OnProjName)          EVT_TEXT(self, ID_PROJ_PROJNAME, self._OnProjName)
138    
   
139      def OnApply(self, event):      def OnApply(self, event):
140          self.__SetProjection()          self.__SetProjection()
141          self.haveTried = True          self.haveTried = True
# Line 149  class ProjFrame(NonModalNonParentDialog) Line 155  class ProjFrame(NonModalNonParentDialog)
155              self.receiver.SetProjection(self.originalProjection)              self.receiver.SetProjection(self.originalProjection)
156              self.haveTried = False              self.haveTried = False
157    
   
158      def _OnNew(self, event):      def _OnNew(self, event):
159    
160          # clear all selections          # clear all selections
# Line 373  class ProjFrame(NonModalNonParentDialog) Line 378  class ProjFrame(NonModalNonParentDialog)
378              if proj is None:              if proj is None:
379                  # user selected <None>                  # user selected <None>
380                  self.projname.Clear()                  self.projname.Clear()
381                                    self.projfilepath.SetLabel(_("Projection File: "))
382              else:              else:
383                            
384                  if projfile is not None:                  if projfile is not None:
385                      self.projfilepath.SetLabel(projfile.GetFilename())                      self.projfilepath.SetLabel(_("Projection File: ") +
386                            os.path.basename(projfile.GetFilename()))
387                  else:                  else:
388                      # only None if the currently used projection is selected                      # only None if the currently used projection is selected
389                      self.projfilepath.SetLabel("")                      self.projfilepath.SetLabel(_("Projection File: "))
390    
391                  self.projname.SetValue(proj.GetName())                  self.projname.SetValue(proj.GetName())
392    
# Line 565  class ProjFrame(NonModalNonParentDialog) Line 571  class ProjFrame(NonModalNonParentDialog)
571          grid_sizer_1.Add(20, 20, 0, wxEXPAND, 0)          grid_sizer_1.Add(20, 20, 0, wxEXPAND, 0)
572          grid_sizer_1.Add(self.availprojs, 1, wxALL|wxEXPAND|wxADJUST_MINSIZE, 4)          grid_sizer_1.Add(self.availprojs, 1, wxALL|wxEXPAND|wxADJUST_MINSIZE, 4)
573          grid_sizer_1.Add(sizer_15, 0, wxALL|wxEXPAND, 4)          grid_sizer_1.Add(sizer_15, 0, wxALL|wxEXPAND, 4)
574          grid_sizer_1.Add(self.projfilepath, 0, wxALL|wxADJUST_MINSIZE, 4)          grid_sizer_1.Add(self.projfilepath, 0, wxEXPAND|wxALL|wxADJUST_MINSIZE, 4)
575          grid_sizer_1.AddGrowableRow(1)          grid_sizer_1.AddGrowableRow(1)
576          grid_sizer_1.AddGrowableCol(0)          grid_sizer_1.AddGrowableCol(0)
577    
# Line 826  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 960  class UTMProposeZoneDialog(wxDialog): Line 980  class UTMProposeZoneDialog(wxDialog):
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

Legend:
Removed from v.1167  
changed lines
  Added in v.1549

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26