vector.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. G_debug(1, "Nviz::SetVectorMode(): id=%d, color=%s, width=%d, flat=%d",
  27. id, color_str, width, flat);
  28. color = Nviz_color_from_str(color_str);
  29. /* use memory by default */
  30. if (GV_set_vectmode(id, 1, color, width, flat) < 0)
  31. return 0;
  32. return 1;
  33. }
  34. /**
  35. \brief Set vector height above surface
  36. \param id vector set id
  37. \param height
  38. \return 1 on success
  39. \return 0 on failure
  40. */
  41. int Nviz::SetVectorHeight(int id, float height)
  42. {
  43. if(!GV_vect_exists(id))
  44. return 0;
  45. G_debug(1, "Nviz::SetVectorHeight(): id=%d, height=%f",
  46. id, height);
  47. GV_set_trans(id, 0.0, 0.0, height);
  48. return 1;
  49. }