/[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 760 by jonathan, Tue Apr 29 09:01:52 2003 UTC revision 1058 by frank, Tue May 27 11:30:29 2003 UTC
# Line 1  Line 1 
1  # Copyright (c) 2003 by Intevation GmbH  # Copyright (c) 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Jonathan Coles <[email protected]>  # Jonathan Coles <[email protected]>
4    # Frank Koormann <[email protected]>
5  #  #
6  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
7  # Read the file COPYING coming with Thuban for details.  # Read the file COPYING coming with Thuban for details.
8                                                                                                                                                                    
9  import os, sys  import os, sys, math
10  from wxPython.wx import *  from wxPython.wx import *
11    
12  from Thuban import _  from Thuban import _
# Line 14  from Thuban.Model.proj import Projection Line 15  from Thuban.Model.proj import Projection
15    
16  from Thuban.Model.resource import GetUserProjFiles, GetSystemProjFiles, \  from Thuban.Model.resource import GetUserProjFiles, GetSystemProjFiles, \
17                                    ReadProjFile, WriteProjFile                                    ReadProjFile, WriteProjFile
18  from Thuban.UI.dialogs import NonModalDialog  from Thuban.UI.dialogs import NonModalNonParentDialog
19    
20    
21  ID_PROJ_ADVANCED  = 4001  ID_PROJ_ADVANCED  = 4001
22  ID_PROJ_PROJCHOICE = 4002  ID_PROJ_PROJCHOICE = 4002
23  ID_PROJ_ADDTOLIST    = 4003  ID_PROJ_ADDTOLIST    = 4003
24  ID_PROJ_NEW       = 4004  ID_PROJ_NEW       = 4004
 ID_PROJ_TRY       = 4005  
25  ID_PROJ_REVERT    = 4006  ID_PROJ_REVERT    = 4006
 ID_PROJ_OK        = 4007  
 ID_PROJ_CLOSE     = 4008  
26  ID_PROJ_AVAIL     = 4009  ID_PROJ_AVAIL     = 4009
27  ID_PROJ_SAVE      = 4010  ID_PROJ_SAVE      = 4010
28  ID_PROJ_IMPORT    = 4011  ID_PROJ_IMPORT    = 4011
# Line 35  ID_PROJ_PROJNAME  = 4014 Line 33  ID_PROJ_PROJNAME  = 4014
33  CLIENT_PROJ = 0  CLIENT_PROJ = 0
34  CLIENT_PROJFILE = 1  CLIENT_PROJFILE = 1
35    
36  class ProjFrame(NonModalDialog):  class ProjFrame(NonModalNonParentDialog):
37    
38      def __init__(self, parent, name, title, receiver):      def __init__(self, parent, name, title, receiver):
39          """Initialize the projection dialog.          """Initialize the projection dialog.
# Line 59  class ProjFrame(NonModalDialog): Line 57  class ProjFrame(NonModalDialog):
57          self.projPanels.append(          self.projPanels.append(
58              ("latlong", _("Geographic"), GeoPanel))              ("latlong", _("Geographic"), GeoPanel))
59    
60          NonModalDialog.__init__(self, parent, name, title)          NonModalNonParentDialog.__init__(self, parent, name, title)
61          # originally generate by wxGlade          # originally generate by wxGlade
62          self.panel_1 = wxPanel(self, -1)          self.panel_1 = wxPanel(self, -1)
63          self.panel_edit = wxPanel(self, -1)          self.panel_edit = wxPanel(self, -1)
64          self.panel_buttons = wxPanel(self, -1)          self.label_5 = wxStaticText(self.panel_1, -1,
65          self.label_5 = wxStaticText(self.panel_1, -1, _("Available Projections:"))                          _("Available Projections:"))
66          self.availprojs = wxListBox(self.panel_1, ID_PROJ_AVAIL, style=wxLB_EXTENDED|wxLB_SORT)  
67            # Projection List specific actions (Import/Export/Remove)
68            self.button_import = wxButton(self.panel_1, ID_PROJ_IMPORT,
69                                          _("Import..."))
70            self.button_export = wxButton(self.panel_1, ID_PROJ_EXPORT,
71                                          _("Export..."))
72            self.button_remove = wxButton(self.panel_1, ID_PROJ_REMOVE,
73                                          _("Remove"))
74    
75            # The Projection List
76            self.availprojs = wxListBox(self.panel_1, ID_PROJ_AVAIL,
77                                        style=wxLB_EXTENDED|wxLB_SORT)
78          self.projfilepath = wxStaticText(self.panel_1, -1, "")          self.projfilepath = wxStaticText(self.panel_1, -1, "")
79    
80            # Projection Specific Entries (Name/Projection)
81          self.label_2 = wxStaticText(self.panel_edit, -1, _("Name:"))          self.label_2 = wxStaticText(self.panel_edit, -1, _("Name:"))
82          self.projname = wxTextCtrl(self.panel_edit, ID_PROJ_PROJNAME, "")          self.projname = wxTextCtrl(self.panel_edit, ID_PROJ_PROJNAME, "")
83          self.label_3 = wxStaticText(self.panel_edit, -1, _("Projection:"))          self.label_3 = wxStaticText(self.panel_edit, -1, _("Projection:"))
84          self.projchoice = wxChoice(self.panel_edit, ID_PROJ_PROJCHOICE)          self.projchoice = wxChoice(self.panel_edit, ID_PROJ_PROJCHOICE)
85          self.button_import = wxButton(self.panel_1, ID_PROJ_IMPORT, _("Import..."))  
86          self.button_export = wxButton(self.panel_1, ID_PROJ_EXPORT, _("Export..."))          # Projection Specific actions (New/Save/Add)
         self.button_remove = wxButton(self.panel_1, ID_PROJ_REMOVE, _("Remove"))  
87          self.button_new = wxButton(self.panel_edit, ID_PROJ_NEW, _("New"))          self.button_new = wxButton(self.panel_edit, ID_PROJ_NEW, _("New"))
         self.button_save = wxButton(self.panel_edit, ID_PROJ_SAVE,_("Save"))  
88          self.button_add = wxButton(self.panel_edit, ID_PROJ_ADDTOLIST,          self.button_add = wxButton(self.panel_edit, ID_PROJ_ADDTOLIST,
89                                        _("Add to List"))                                        _("Add to List"))
90          self.button_try = wxButton(self.panel_buttons, ID_PROJ_TRY, _("Try"))          self.button_save = wxButton(self.panel_edit, ID_PROJ_SAVE,_("Update"))
91          self.button_revert = wxButton(self.panel_buttons, ID_PROJ_REVERT, _("Revert"))  
92          self.button_ok = wxButton(self.panel_buttons, ID_PROJ_OK, _("OK"))          # Main Action buttons (Try/Revert/OK/Close)
93          self.button_close = wxButton(self.panel_buttons, ID_PROJ_CLOSE, _("Close"))          self.button_try = wxButton(self, wxID_APPLY, _("Try"))
94            self.button_revert = wxButton(self, ID_PROJ_REVERT,
95                                          _("Revert"))
96            self.button_ok = wxButton(self, wxID_OK, _("OK"))
97            self.button_ok.SetDefault()
98            self.button_close = wxButton(self, wxID_CANCEL,
99                                         _("Close"))
100    
101          self.__set_properties()          self.__set_properties()
102          self.__do_layout()          self.__do_layout()
# Line 90  class ProjFrame(NonModalDialog): Line 105  class ProjFrame(NonModalDialog):
105          self.originalProjection = self.receiver.GetProjection()          self.originalProjection = self.receiver.GetProjection()
106    
107          self.__DoOnProjAvail()          self.__DoOnProjAvail()
108            self.button_ok.SetFocus()
109            self.availprojs.SetFocus()
110                    
111          EVT_BUTTON(self, ID_PROJ_TRY, self._OnTry)          EVT_BUTTON(self, wxID_APPLY, self.OnApply)
112          EVT_BUTTON(self, ID_PROJ_REVERT, self._OnRevert)          EVT_BUTTON(self, ID_PROJ_REVERT, self._OnRevert)
113          EVT_BUTTON(self, ID_PROJ_OK, self._OnOK)          EVT_BUTTON(self, wxID_OK, self.OnOK)
114          EVT_BUTTON(self, ID_PROJ_CLOSE, self._OnClose)          EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)
115          EVT_CHOICE(self, ID_PROJ_PROJCHOICE, self._OnProjChoice)          EVT_CHOICE(self, ID_PROJ_PROJCHOICE, self._OnProjChoice)
116          EVT_LISTBOX(self, ID_PROJ_AVAIL, self._OnProjAvail)          EVT_LISTBOX(self, ID_PROJ_AVAIL, self._OnProjAvail)
117          EVT_BUTTON(self, ID_PROJ_IMPORT, self._OnImport)          EVT_BUTTON(self, ID_PROJ_IMPORT, self._OnImport)
# Line 107  class ProjFrame(NonModalDialog): Line 124  class ProjFrame(NonModalDialog):
124    
125          EVT_TEXT(self, ID_PROJ_PROJNAME, self._OnProjName)          EVT_TEXT(self, ID_PROJ_PROJNAME, self._OnProjName)
126    
127      def _OnTry(self, event):  
128        def OnApply(self, event):
129          self.__SetProjection()          self.__SetProjection()
130          self.haveTried = True          self.haveTried = True
131    
132        def OnOK(self, event):
133            self.__SetProjection()
134            self.Close()
135    
136        def OnCancel(self, event):
137            """Cancel just closes the dialog, but we call it cancel so we
138            can overload the functionality of wxDialog.
139            """
140            self.Close()
141    
142      def _OnRevert(self, event):      def _OnRevert(self, event):
143          if self.haveTried:          if self.haveTried:
144              self.receiver.SetProjection(self.originalProjection)              self.receiver.SetProjection(self.originalProjection)
145              self.haveTried = False              self.haveTried = False
146    
     def _OnOK(self, event):  
         self.__SetProjection()  
         self.Close()  
   
     def _OnClose(self, event):  
         self.Close()  
147    
148      def _OnNew(self, event):      def _OnNew(self, event):
149    
# Line 156  class ProjFrame(NonModalDialog): Line 178  class ProjFrame(NonModalDialog):
178                  WriteProjFile(projfile)                  WriteProjFile(projfile)
179              except IOError, (errno, errstr):              except IOError, (errno, errstr):
180                  self.__ShowError(projfile.GetFilename(), errstr)                  self.__ShowError(projfile.GetFilename(), errstr)
181              self.availprojs.SetClientData([newproj, projfile])              self.availprojs.SetClientData(sel[0], [newproj, projfile])
182    
183      def _OnAddToList(self, event):      def _OnAddToList(self, event):
184    
# Line 302  class ProjFrame(NonModalDialog): Line 324  class ProjFrame(NonModalDialog):
324              self.button_import.Enable(True)              self.button_import.Enable(True)
325              self.button_export.Enable(False)              self.button_export.Enable(False)
326              self.button_remove.Enable(False)              self.button_remove.Enable(False)
327                self.button_save.Enable(False)
328    
329          elif len(sel) == 1:          elif len(sel) == 1:
330    
# Line 456  class ProjFrame(NonModalDialog): Line 479  class ProjFrame(NonModalDialog):
479          self.availprojs.Clear()          self.availprojs.Clear()
480    
481          #          #
         # We add the current projection to the list first so that  
         # we are sure that it's at index 0. That way we can  
         # set the selection with confidence. The problem is the  
         # the list is automatically sorted when an item is appended  
         # and the index of where it was inserted is not returned.  
         #  
         proj = self.receiver.GetProjection()  
         if proj is not None:  
             self.availprojs.Append(_("%s (current)") % proj.GetName(),  
                                    [proj, None])  
             if selectCurrent:  
                 self.availprojs.SetSelection(0)  
                 self.availprojs.SetFirstItem(0)  
   
         #  
482          # the list can never be empty. there will always be          # the list can never be empty. there will always be
483          # at least this one item          # at least this one item
484          #          #
485          self.availprojs.Append("<None>", (None, None))          self.availprojs.Append("<None>", (None, None))
486    
         # proj is only None when <None> should be selected  
         if proj is None and selectCurrent:  
             self.availprojs.SetSelection(0)  
             self.availprojs.SetFirstItem(0)  
   
487          projfile = GetSystemProjFiles()          projfile = GetSystemProjFiles()
488          projfile = projfile[0]          projfile = projfile[0]
489          for proj in projfile.GetProjections():          for proj in projfile.GetProjections():
# Line 496  class ProjFrame(NonModalDialog): Line 499  class ProjFrame(NonModalDialog):
499          for proj, name, clazz in self.projPanels:          for proj, name, clazz in self.projPanels:
500              self.projchoice.Append(name, [clazz, None])              self.projchoice.Append(name, [clazz, None])
501    
502            #
503            # We add the current projection to the list at last.
504            # Since the list is resorted immediately a following FindString()
505            # determines the index correctly.
506            #
507            proj = self.receiver.GetProjection()
508            if proj is not None:
509                proj_item = _("%s (current)") % proj.GetName()
510                self.availprojs.Append(proj_item, [proj, None])
511                if selectCurrent:
512                    self.availprojs.SetSelection(
513                            self.availprojs.FindString(proj_item)
514                        )
515            else:
516                if selectCurrent:
517                    self.availprojs.SetSelection(
518                            self.availprojs.FindString("<None>")
519                        )
520                    
521    
522      def __set_properties(self):      def __set_properties(self):
523    
524          #self.availprojs.SetSelection(0)          #self.availprojs.SetSelection(0)
# Line 511  class ProjFrame(NonModalDialog): Line 534  class ProjFrame(NonModalDialog):
534          self.topBox = wxBoxSizer(wxVERTICAL)          self.topBox = wxBoxSizer(wxVERTICAL)
535          self.sizer_panel = wxBoxSizer(wxVERTICAL)          self.sizer_panel = wxBoxSizer(wxVERTICAL)
536          sizer_6 = wxBoxSizer(wxHORIZONTAL)          sizer_6 = wxBoxSizer(wxHORIZONTAL)
537            self.sizer_mainbttns = wxBoxSizer(wxHORIZONTAL)
538          self.sizer_mainctrls = wxBoxSizer(wxHORIZONTAL)          self.sizer_mainctrls = wxBoxSizer(wxHORIZONTAL)
539          self.sizer_edit = wxStaticBoxSizer(wxStaticBox(self.panel_edit, -1, _("Edit")), wxHORIZONTAL)          self.sizer_edit = wxStaticBoxSizer(wxStaticBox(self.panel_edit, -1, _("Edit")), wxHORIZONTAL)
540          sizer_11 = wxBoxSizer(wxVERTICAL)          sizer_11 = wxBoxSizer(wxVERTICAL)
# Line 538  class ProjFrame(NonModalDialog): Line 562  class ProjFrame(NonModalDialog):
562          sizer_13.Add(self.projname, 1, wxALL, 4)          sizer_13.Add(self.projname, 1, wxALL, 4)
563          self.sizer_projctrls.Add(sizer_13, 0, wxEXPAND, 0)          self.sizer_projctrls.Add(sizer_13, 0, wxEXPAND, 0)
564          sizer_14.Add(self.label_3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)          sizer_14.Add(self.label_3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
565          sizer_14.Add(self.projchoice, 1, wxALL|wxEXPAND|wxADJUST_MINSIZE, 4)          sizer_14.Add(self.projchoice, 1, wxALL|wxALIGN_CENTER_VERTICAL, 4)
566          self.sizer_projctrls.Add(sizer_14, 0, wxEXPAND, 0)          self.sizer_projctrls.Add(sizer_14, 0, wxEXPAND, 0)
567          self.sizer_edit.Add(self.sizer_projctrls, 1, wxEXPAND, 0)          self.sizer_edit.Add(self.sizer_projctrls, 1, wxEXPAND, 0)
568          sizer_11.Add(self.button_new, 0, wxALL|wxEXPAND, 4)          sizer_11.Add(self.button_new, 0, wxALL, 4)
569          sizer_11.Add(self.button_save, 0, wxALL|wxEXPAND, 4)          sizer_11.Add(self.button_add, 0, wxALL, 4)
570          sizer_11.Add(self.button_add, 0, wxALL|wxEXPAND, 4)          sizer_11.Add(20, 20, 0, wxEXPAND, 0)
571            sizer_11.Add(self.button_save, 0, wxALL|wxALIGN_BOTTOM, 4)
572          self.sizer_edit.Add(sizer_11, 0, wxALL|wxEXPAND, 4)          self.sizer_edit.Add(sizer_11, 0, wxALL|wxEXPAND, 4)
573    
574          sizer_6.Add(20, 20, 1, wxEXPAND, 0)          sizer_6.Add(self.button_try, 0, wxRIGHT| wxEXPAND, 10)
575          sizer_6.Add(self.button_try, 0, wxALL, 4)          sizer_6.Add(self.button_revert, 0, wxRIGHT| wxEXPAND, 10)
576          sizer_6.Add(20, 20, 1, 0, 0)          sizer_6.Add(self.button_ok, 0, wxRIGHT| wxEXPAND, 10)
577          sizer_6.Add(self.button_revert, 0, wxALL, 4)          sizer_6.Add(self.button_close, 0, wxRIGHT| wxEXPAND, 10)
         sizer_6.Add(20, 20, 1, 0, 0)  
         sizer_6.Add(self.button_ok, 0, wxALL, 4)  
         sizer_6.Add(20, 20, 1, 0, 0)  
         sizer_6.Add(self.button_close, 0, wxALL, 4)  
         sizer_6.Add(20, 20, 1, wxEXPAND, 0)  
578    
579          self.panel_1.SetAutoLayout(1)          self.panel_1.SetAutoLayout(1)
580          self.panel_1.SetSizer(grid_sizer_1)          self.panel_1.SetSizer(grid_sizer_1)
# Line 566  class ProjFrame(NonModalDialog): Line 586  class ProjFrame(NonModalDialog):
586          self.sizer_edit.Fit(self.panel_edit)          self.sizer_edit.Fit(self.panel_edit)
587          self.sizer_edit.SetSizeHints(self.panel_edit)          self.sizer_edit.SetSizeHints(self.panel_edit)
588    
         self.panel_buttons.SetAutoLayout(1)  
         self.panel_buttons.SetSizer(sizer_6)  
         sizer_6.Fit(self.panel_buttons)  
         sizer_6.SetSizeHints(self.panel_buttons)  
   
589          self.sizer_mainctrls.Add(self.panel_1, 0,          self.sizer_mainctrls.Add(self.panel_1, 0,
590              wxALL|wxEXPAND|wxADJUST_MINSIZE, 0)              wxALL|wxEXPAND|wxADJUST_MINSIZE, 0)
591          self.sizer_mainctrls.Add(self.panel_edit, 1,          self.sizer_mainctrls.Add(self.panel_edit, 1,
592              wxALL|wxEXPAND|wxADJUST_MINSIZE, 0)              wxALL|wxEXPAND|wxADJUST_MINSIZE, 0)
593    
594            self.sizer_mainbttns.Add(sizer_6, 0,
595                wxALL|wxEXPAND|wxADJUST_MINSIZE, 10)
596    
597          self.topBox.Add(self.sizer_mainctrls, 1, wxALL|wxEXPAND, 4)          self.topBox.Add(self.sizer_mainctrls, 1, wxALL|wxEXPAND, 4)
598          self.topBox.Add(self.panel_buttons, 0, wxEXPAND, 0)          self.topBox.Add(self.sizer_mainbttns, 0, wxALIGN_RIGHT|wxBOTTOM, 0)
599    
600          self.SetAutoLayout(1)          self.SetAutoLayout(1)
601          self.SetSizer(self.topBox)          self.SetSizer(self.topBox)
# Line 595  class ProjPanel(wxPanel): Line 613  class ProjPanel(wxPanel):
613          wxPanel.__init__(self, parent, -1)          wxPanel.__init__(self, parent, -1)
614    
615          self.__ellps = wxChoice(self, -1)          self.__ellps = wxChoice(self, -1)
616          self.ellpsData = [("bessel", _("Bessel 1841")),          self.ellpsData = [("airy"  , _("Airy")),
617                              ("bessel", _("Bessel 1841")),
618                            ("clrk66", _("Clarke 1866")),                            ("clrk66", _("Clarke 1866")),
619                            ("clrk80", _("Clarke 1880")),                            ("clrk80", _("Clarke 1880")),
620                            ("GRS80" , _("GRS 1980 (IUGG, 1980)")),                            ("GRS80" , _("GRS 1980 (IUGG, 1980)")),
# Line 611  class ProjPanel(wxPanel): Line 630  class ProjPanel(wxPanel):
630    
631          panelSizer = wxBoxSizer(wxVERTICAL)          panelSizer = wxBoxSizer(wxVERTICAL)
632    
         if childPanel is not None:  
             panelSizer.Add(childPanel, 0, wxALL|wxEXPAND, 4)  
               
633          sizer = wxBoxSizer(wxHORIZONTAL)          sizer = wxBoxSizer(wxHORIZONTAL)
634          sizer.Add(wxStaticText(self, -1, _("Ellipsoid:")), 0, wxALL, 4)          sizer.Add(wxStaticText(self, -1, _("Ellipsoid:")), 0,
635          sizer.Add(self.__ellps, 1, wxALL|wxEXPAND|wxADJUST_MINSIZE, 4)                                      wxALL|wxALIGN_CENTER_VERTICAL, 4)
636            sizer.Add(self.__ellps, 1, wxALL|wxALIGN_CENTER_VERTICAL, 4)
637          panelSizer.Add(sizer, 0, wxALL|wxEXPAND, 4)          panelSizer.Add(sizer, 0, wxALL|wxEXPAND, 4)
638    
639            if childPanel is not None:
640                panelSizer.Add(childPanel, 0, wxEXPAND, 0)
641                
642          self.SetAutoLayout(1)          self.SetAutoLayout(1)
643          self.SetSizer(panelSizer)          self.SetSizer(panelSizer)
644          panelSizer.Fit(self)          panelSizer.Fit(self)
# Line 684  class TMPanel(ProjPanel): Line 704  class TMPanel(ProjPanel):
704    
705          self.__latitude = wxTextCtrl(self, ID_TMPANEL_LAT)          self.__latitude = wxTextCtrl(self, ID_TMPANEL_LAT)
706          self.__longitude = wxTextCtrl(self, ID_TMPANEL_LONG)          self.__longitude = wxTextCtrl(self, ID_TMPANEL_LONG)
707            self.__scale = wxTextCtrl(self, ID_TMPANEL_SCALE)
708          self.__falseEast = wxTextCtrl(self, ID_TMPANEL_FASLE_EAST)          self.__falseEast = wxTextCtrl(self, ID_TMPANEL_FASLE_EAST)
709          self.__falseNorth = wxTextCtrl(self, ID_TMPANEL_FALSE_NORTH)          self.__falseNorth = wxTextCtrl(self, ID_TMPANEL_FALSE_NORTH)
         self.__scale = wxTextCtrl(self, ID_TMPANEL_SCALE)  
710    
711          self._DoLayout()          self._DoLayout()
712    
# Line 752  class UTMPanel(ProjPanel): Line 772  class UTMPanel(ProjPanel):
772          self.receiver = receiver          self.receiver = receiver
773    
774          self.__zone = wxSpinCtrl(self, ID_UTMPANEL_ZONE, "1", min=1, max=60)          self.__zone = wxSpinCtrl(self, ID_UTMPANEL_ZONE, "1", min=1, max=60)
775            self.__propButton = wxButton(self, ID_UTMPANEL_PROP, _("Propose"))
776          self.__south = wxCheckBox(self, ID_UTMPANEL_SOUTH,          self.__south = wxCheckBox(self, ID_UTMPANEL_SOUTH,
777                                    _("Southern Hemisphere"))                                    _("Southern Hemisphere"))
         self.__propButton = wxButton(self, ID_UTMPANEL_PROP, _("Propose"))  
778    
779          self._DoLayout()          self._DoLayout()
780    
# Line 874  class GeoPanel(ProjPanel): Line 894  class GeoPanel(ProjPanel):
894    
895      def __init__(self, parent, receiver):      def __init__(self, parent, receiver):
896          ProjPanel.__init__(self, parent)          ProjPanel.__init__(self, parent)
897          ProjPanel._DoLayout(self, None)  
898            self.__choices = [(_("Degrees"), "0.017453"),
899                              (_("Radians"), "1")]
900    
901            self.__scale = wxChoice(self, -1)
902            for choice, value in self.__choices:
903                self.__scale.Append(choice, value)
904    
905            self._DoLayout()
906    
907      def GetProjName(self):      def GetProjName(self):
908          return _("Geographic")          return _("Geographic")
909                    
910      def SetProjection(self, proj):      def SetProjection(self, proj):
911            value = proj.GetParameter("to_meter")
912            for i in range(len(self.__choices)):
913                choice, data = self.__choices[i]
914                if value == data:
915                    self.__scale.SetSelection(i)
916          ProjPanel.SetProjection(self, proj)          ProjPanel.SetProjection(self, proj)
917    
918      def GetParameters(self):      def GetParameters(self):
919          params = ["proj=latlong"]          params = ["proj=latlong",
920                      "to_meter=%s" % self.__scale.GetClientData(
921                                      self.__scale.GetSelection())]
922    
923          params.extend(ProjPanel.GetParameters(self))          params.extend(ProjPanel.GetParameters(self))
924          return params          return params
925    
926      def Clear(self):      def Clear(self):
927          ProjPanel.Clear(self)          ProjPanel.Clear(self)
928    
929        def _DoLayout(self):
930            sizer = wxBoxSizer(wxHORIZONTAL)
931    
932            sizer.Add(wxStaticText(self, -1, _("Source Data is in: ")),
933                      0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
934            sizer.Add(self.__scale, 1, wxEXPAND|wxALL, 4)
935    
936            self.__scale.SetSelection(0)
937    
938            ProjPanel._DoLayout(self, sizer)
939    
940    
941  ID_UTM_PROPOSE_ZONE_DIALOG_TAKE   = 4001  ID_UTM_PROPOSE_ZONE_DIALOG_TAKE   = 4001
942  ID_UTM_PROPOSE_ZONE_DIALOG_CANCEL = 4002  ID_UTM_PROPOSE_ZONE_DIALOG_CANCEL = 4002

Legend:
Removed from v.760  
changed lines
  Added in v.1058

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26