vector.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. \file vector.cpp
  3. \brief Experimental C++ wxWidgets Nviz prototype -- vector mode and attributes
  4. Used by wxGUI Nviz extension.
  5. Copyright: (C) by the GRASS Development Team
  6. This program is free software under the GNU General Public
  7. License (>=v2). Read the file COPYING that comes with GRASS
  8. for details.
  9. \author Martin Landa <landa.martin gmail.com> (Google SoC 2008)
  10. \date 2008
  11. */
  12. #include "nviz.h"
  13. /**
  14. \brief Set mode of vector overlay
  15. \param id vector id
  16. \param color_str color string
  17. \param width line width
  18. \param flat
  19. */
  20. int Nviz::SetVectorLineMode(int id, const char *color_str,
  21. int width, int flat)
  22. {
  23. int color;
  24. if(!GV_vect_exists(id))
  25. return 0;
  26. color = Nviz_color_from_str(color_str);
  27. /* use memory by default */
  28. if (GV_set_vectmode(id, 1, color, width, flat) < 0)
  29. return 0;
  30. return 1;
  31. }
  32. /**
  33. \brief Set vector height above surface
  34. \param id vector set id
  35. \param height
  36. \return 1 on success
  37. \return 0 on failure
  38. */
  39. int Nviz::SetVectorHeight(int id, float height)
  40. {
  41. if(!GV_vect_exists(id))
  42. return 0;
  43. GV_set_trans(id, 0.0, 0.0, height);
  44. return 1;
  45. }