gui_graphline.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef _XBOX
  2. #include "gui_graphline.h"
  3. GUIGraphLine::GUIGraphLine (const Vector& begin, const Vector& end) : Points(_FL_)
  4. {
  5. bNegative = false;
  6. LastMinimalPoint = -1;
  7. bActive = false;
  8. SelectedPoint = -1;
  9. color = 0xFFFF0000;
  10. Points.Add(begin);
  11. Points.Add(end);
  12. }
  13. GUIGraphLine::~GUIGraphLine ()
  14. {
  15. Points.DelAll();
  16. }
  17. void GUIGraphLine::systemClear ()
  18. {
  19. Points.DelAll();
  20. }
  21. void GUIGraphLine::Insert (int num, const Vector& newpoint)
  22. {
  23. //Vector newVec = newpoint;
  24. //Points.Insert(num, newVec);
  25. Points.Insert(newpoint, num);
  26. }
  27. void GUIGraphLine::Add (const Vector& newpoint)
  28. {
  29. //*(Points.Add()) = newpoint;
  30. Points.Add(newpoint);
  31. }
  32. int GUIGraphLine::GetCount ()
  33. {
  34. return Points.Size();
  35. }
  36. void GUIGraphLine::Zero ()
  37. {
  38. /*
  39. int count = Points.Size();
  40. for (int n = 1; n < count-1; n++)
  41. {
  42. Points.DelIndex(1);
  43. }
  44. count = Points.Size();
  45. for ( n = 0; n < count; n++)
  46. {
  47. Points[n].y = 0.0f;
  48. }
  49. */
  50. Points.DelAll();
  51. Points.Add(Vector(0.0f, 0.0f, 0.0f));
  52. Points.Add(Vector(999999.0f, 0.0f, 0.0f));
  53. }
  54. void GUIGraphLine::Remove (int num)
  55. {
  56. int total = GetCount();
  57. if (total <= 2) return;
  58. if (num == 0) return;
  59. if (num == (total-1)) return;
  60. Points.DelIndex(num);
  61. }
  62. const Vector& GUIGraphLine::GetPoint (int num)
  63. {
  64. return Points[num];
  65. }
  66. void GUIGraphLine::Change (int num, const Vector& newpoint)
  67. {
  68. Points[num] = newpoint;
  69. }
  70. void GUIGraphLine::Clear ()
  71. {
  72. Points.DelAll();
  73. }
  74. void GUIGraphLine::Copy (GUIGraphLine* src)
  75. {
  76. Clear ();
  77. for (int n = 0; n < src->GetCount(); n++)
  78. {
  79. Vector srcpt = src->GetPoint(n);
  80. Add (srcpt);
  81. }
  82. }
  83. void GUIGraphLine::SetSize (DWORD count)
  84. {
  85. Points.DelAll();
  86. for (DWORD n = 0; n < count; n++) Points.Add();
  87. }
  88. #endif