VNMediaClientNET
ObjectsTracker.h
1 
13 #pragma once
14 #ifndef OBJECTS_TRACKER_H_
15 #define OBJECTS_TRACKER_H_
16 
20 #include <vector>
21 #include <string>
22 #include <map>
23 #include <set>
24 #include <boost/format.hpp>
25 #include <math.h>
26 
27 #include "AbstractObjectsTracker.h"
28 
29 #include "Graphics.h"
30 //#include "ZoomControl.h"
31 
32 #define OBJ_SEQUENCE_START_CODE 0x0A
33 #define OBJ_START_CODE 0x01
34 #define OBJ_DRAW_TYPE_START_CODE 0x02
35 #define OBJ_X_COORD_START_CODE 0x03
36 #define OBJ_Y_COORD_START_CODE 0x04
37 #define OBJ_HEIGHT_START_CODE 0x05
38 #define OBJ_WIDTH_START_CODE 0x06
39 #define OBJ_COLOR_START_CODE 0x07
40 #define OBJ_LINEWIDTH_START_CODE 0x08
41 #define OBJ_TEXT_START_CODE 0x09
42 #define OBJ_POLYDATA_START_CODE 0x0B
43 #define OBJ_ARROWHEADSIZE_START_CODE 0x0C
44 #define OBJ_SEQUENCE_END_START_CODE 0x7F
45 
46 #define OBJ_DRAW_TYPE_BOX 0x01
47 #define OBJ_DRAW_TYPE_MLINE 0x02
48 #define OBJ_DRAW_TYPE_TEXT 0x03
49 #define OBJ_DRAW_TYPE_TIMESTAMP 0x04
50 #define OBJ_DRAW_TYPE_POLYGON 0x05
51 #define OBJ_DRAW_TYPE_TRIPWIRE_ARROW 0x06
52 #define OBJ_DRAW_TYPE_ARROW 0x07
53 
54 #define METADATA_TAGID 0xffff
55 
56 typedef unsigned char byte;
57 
59 {
60 public:
61  ObjectsTracker(const std::string& Bitstream, const std::map< std::string, std::vector< std::string > >& VisibleMetadata);
62  //~ObjectsTracker();
63 
64  virtual void setObjectsData(const std::string& Bitstream, const std::map< std::string, std::vector< std::string > >& VisibleMetadata);
65 
69  virtual void parseAndDraw(Graphics* g2, const Rectangle2& dstRect, const Rectangle2& srcRect, float zoomFactor);
70 
71 private:
72  void log_warning( const std::string& message );
73 
74  void skipBits(const int bits);
75 
76  int showBits(const int bits);
77 
78  int getBits(const int n);
79 
80  std::string getText();
81 
82  void fillPolygonData();
83 
84  void drawObject(Graphics* g2);
85 
86 private:
87  std::string bitstream;
88  std::map< std::string, std::vector< std::string > > visibleMetadata;
89  int offset;
90  int length;
91  int bufa;
92  int bufb;
93  int position;
94 
95  //{{
96  int im_height;
97  //Rectangle2 screenRect;
98  //ZoomControl zoomControl;
99  //}}
100 
101  Rectangle2 dstRect;
102  Rectangle2 srcRect;
103  float zoomFactor;
104  float kW;
105  float kH;
106 
107  int objID;
108  int objDrawType;
109  int objXcoord;
110  int objYcoord;
111  int objWidth;
112  int objHeight;
113  int objColor;
114  int objLineWidth;
115  int arrowHead;
116  std::string text;
117  std::vector<int> xPoints;
118  std::vector<int> yPoints;
119  int nPoints;
120  float xTripPoints[2];
121  float yTripPoints[2];
122 };
123 //*/
124 
125 #endif
ObjectsTracker::parseAndDraw
virtual void parseAndDraw(Graphics *g2, const Rectangle2 &dstRect, const Rectangle2 &srcRect, float zoomFactor)
Definition: ObjectsTracker.cpp:154
ObjectsTracker::ObjectsTracker
ObjectsTracker(const std::string &Bitstream, const std::map< std::string, std::vector< std::string > > &VisibleMetadata)
Definition: ObjectsTracker.cpp:18
Rectangle2
Definition: Rectangle.h:18
Graphics
Definition: Graphics.h:68
AbstractObjectsTracker
Definition: AbstractObjectsTracker.h:25
ObjectsTracker
Definition: ObjectsTracker.h:59