g.gui.iclass.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env python
  2. ############################################################################
  3. #
  4. # MODULE: g.gui.iclass
  5. # AUTHOR(S): Anna Kratochvilova, Vaclav Petras
  6. # PURPOSE: The Map Swipe is a wxGUI component which allows the user to
  7. # interactively compare two maps
  8. # COPYRIGHT: (C) 2012 by Anna Kratochvilova, and the GRASS Development Team
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. ############################################################################
  21. #%module
  22. #% label: Tool for supervised classification of imagery data.
  23. #% description: Generates spectral signatures for an image by allowing the user to outline regions of interest.
  24. #%end
  25. import os
  26. import sys
  27. import wx
  28. import gettext
  29. import grass.script as grass
  30. if __name__ == '__main__':
  31. sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
  32. from core.settings import UserSettings
  33. from core.giface import StandaloneGrassInterface
  34. from iclass.frame import IClassMapFrame
  35. def main():
  36. # define display driver
  37. driver = UserSettings.Get(group = 'display', key = 'driver', subkey = 'type')
  38. if driver == 'png':
  39. os.environ['GRASS_RENDER_IMMEDIATE'] = 'png'
  40. else:
  41. os.environ['GRASS_RENDER_IMMEDIATE'] = 'cairo'
  42. # launch application
  43. app = wx.PySimpleApp()
  44. wx.InitAllImageHandlers()
  45. # show main frame
  46. frame = IClassMapFrame(parent = None, giface = StandaloneGrassInterface())
  47. frame.Show()
  48. app.MainLoop()
  49. if __name__ == '__main__':
  50. gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
  51. options, flags = grass.parser()
  52. main()