g.gui.gcp.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/usr/bin/env python
  2. ############################################################################
  3. #
  4. # MODULE: GCP Manager
  5. # AUTHOR(S): Markus Metz
  6. # PURPOSE: Georectification and Ground Control Points management.
  7. # COPYRIGHT: (C) 2012 by Markus Metz, and the GRASS Development Team
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. ############################################################################
  20. #%module
  21. #% description: Georectifies a map and allows to manage Ground Control Points.
  22. #% keywords: general
  23. #% keywords: GUI
  24. #% keywords: georectification
  25. #%end
  26. """
  27. Module to run GCP management tool as stadalone application.
  28. @author Vaclav Petras <wenzeslaus gmail.com> (standalone module)
  29. """
  30. import os
  31. import sys
  32. import wx
  33. import grass.script as grass
  34. # adding a path to wxGUI modules
  35. if __name__ == '__main__':
  36. WXGUIBASE = os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython')
  37. if WXGUIBASE not in sys.path:
  38. sys.path.append(WXGUIBASE)
  39. from core.settings import UserSettings
  40. from core.globalvar import CheckWxVersion
  41. from core.giface import StandaloneGrassInterface
  42. from core.utils import GuiModuleMain
  43. from gcp.manager import GCPWizard
  44. def main():
  45. """!Sets the GRASS display driver
  46. @todo use command line options as an alternative to wizard
  47. """
  48. driver = UserSettings.Get(group='display', key='driver', subkey='type')
  49. if driver == 'png':
  50. os.environ['GRASS_RENDER_IMMEDIATE'] = 'png'
  51. else:
  52. os.environ['GRASS_RENDER_IMMEDIATE'] = 'cairo'
  53. app = wx.PySimpleApp()
  54. if not CheckWxVersion([2, 9]):
  55. wx.InitAllImageHandlers()
  56. wizard = GCPWizard(parent=None, giface=StandaloneGrassInterface())
  57. app.MainLoop()
  58. if __name__ == '__main__':
  59. options, flags = grass.parser()
  60. GuiModuleMain(main)