You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.7 KiB

7 years ago
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
7 years ago
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __SHADOW_MASKS_HEADER__
  2. #define __SHADOW_MASKS_HEADER__
  3. #include "../../components/base/basicTypes.h"
  4. #include "../../hardware/soc/general/3DLRF.h"
  5. #include "../../components/base/basicLogCollection.h"
  6. #if defined( WIN32 ) || defined( __GUI__ )
  7. #include "../../gui/gui.h"
  8. #endif
  9. typedef struct{
  10. private:
  11. int16_t m_x;
  12. int16_t m_y;
  13. public:
  14. void setX( int a ){
  15. m_x = a;
  16. };
  17. void setY( int a ){
  18. m_y = a;
  19. };
  20. int16_t x( void ){ return m_x; };
  21. int16_t y( void ){ return m_y; };
  22. } simplePoint;
  23. #if defined( WIN32 ) || defined( __GUI__ )
  24. typedef struct{
  25. uint8_t color[3];
  26. QPoint *points;
  27. uint16_t count;
  28. } simplePolygone;
  29. typedef std::vector<simplePolygone *> vectorMasking;
  30. typedef std::vector<QPolygon *> vectorQPoly;
  31. #else
  32. typedef struct{
  33. uint8_t color[3];
  34. simplePoint *points;
  35. uint16_t count;
  36. } simplePolygone;
  37. typedef std::vector<simplePolygone *> vectorMasking;
  38. #endif
  39. typedef struct{
  40. uint16_t start;
  41. uint16_t stop;
  42. } raySegment;
  43. typedef struct{
  44. uint16_t column;
  45. uint16_t count;
  46. raySegment *zones;
  47. } rawRay;
  48. typedef std::vector<rawRay *> vectorZoneMask;
  49. class ShadowMask{
  50. private:
  51. basicLogCollection *m_pLog;
  52. vectorZoneMask m_vZoneMask;
  53. bool m_bActive;
  54. vectorMasking m_vVectorMask;
  55. bool m_bRasterized;
  56. #if defined( WIN32 ) || defined( __GUI__ )
  57. CSTR m_pRasterFileName;
  58. CSTR m_pVertexFileName;
  59. #endif
  60. public:
  61. ShadowMask();
  62. ~ShadowMask();
  63. #if defined( WIN32 ) || defined( __GUI__ )
  64. bool loadRastered(CSTR fName = NULL);
  65. bool saveRastered(CSTR fName = NULL);
  66. #endif
  67. #if defined( __linux__ ) && !defined( __GUI__ )
  68. bool saveVertexes(CSTR fName = NULL);
  69. bool loadVertexes(CSTR fName = NULL);
  70. #endif
  71. bool getMPoly( vectorMasking &VM );
  72. bool getZoneMask(vectorZoneMask &ZM);
  73. simplePolygone *getPoly(int id);
  74. bool addPoly( simplePolygone *SP );
  75. bool clear( void );
  76. bool deletePoly( int ID );
  77. uint8_t getPolyCount( void ){ return ( m_vVectorMask.size() & 0xFF ); };
  78. uint16_t getRayCount( void ){ return ( m_vZoneMask.size() & 0xFFFF ); };
  79. #if defined( WIN32 ) || defined( __GUI__ )
  80. bool rasterizeVertexes( void );
  81. bool getQPoly( vectorQPoly &VM );
  82. bool addVertex( uint16_t polyID, QPoint SP );
  83. bool addVertex( uint16_t polyID, uint32_t SP ); // Binary Data to Vertex
  84. #endif
  85. bool isOutside( uint16_t x, uint16_t y );
  86. bool isOutside( simplePoint );
  87. bool isActive( void ){ return m_bActive; };
  88. void setActive( bool tVal );
  89. bool addRay( uint16_t column, raySegment RS );
  90. bool addRay( uint16_t column, uint32_t RS ); // Binary Data to RaySegment
  91. };
  92. #endif