00001
00002 #ifndef INCLUDED_VisionObjectEvent_h
00003 #define INCLUDED_VisionObjectEvent_h
00004
00005 #include "EventBase.h"
00006
00007
00008 class VisionObjectEvent : public EventBase {
00009 public:
00010
00011 VisionObjectEvent()
00012 : EventBase(EventBase::visObjEGID,(unsigned int)-1,EventBase::statusETID,0),_x1(0),_x2(0),_y1(0),_y2(0),
00013 _clipLeft(false), _clipRight(false), _clipTop(false), _clipBottom(false)
00014 {}
00015
00016
00017 VisionObjectEvent(EventTypeID_t tid, unsigned int sid)
00018 : EventBase(EventBase::visObjEGID,sid,tid,0),_x1(0),_x2(0),_y1(0),_y2(0),
00019 _clipLeft(false), _clipRight(false), _clipTop(false), _clipBottom(false)
00020 {}
00021
00022
00023 VisionObjectEvent(EventTypeID_t tid, unsigned int sid, float x1, float x2, float y1, float y2, float rx, float ry)
00024 : EventBase(EventBase::visObjEGID,sid,tid,0),_x1(x1),_x2(x2),_y1(y1),_y2(y2),
00025 _clipLeft(_x1<=-rx), _clipRight(_x2>=rx), _clipTop(_y1<=-ry), _clipBottom(_y2>=ry)
00026 {}
00027
00028
00029 virtual ~VisionObjectEvent() {}
00030
00031
00032 float getLeft() const { return _x1;}
00033 VisionObjectEvent& setLeft(float x1) { _x1=x1; return *this;}
00034
00035 float getRight() const { return _x2;}
00036 VisionObjectEvent& setRight(float x2) { _x2=x2; return *this;}
00037
00038 float getTop() const { return _y1;}
00039 VisionObjectEvent& setTop(float y1) { _y1=y1; return *this;}
00040
00041 float getBottom() const { return _y2;}
00042 VisionObjectEvent& setBottom(float y2) { _y2=y2; return *this;}
00043
00044
00045
00046 float getCenterX() const { return (_x1+_x2)/2; }
00047 float getCenterY() const { return (_y1+_y2)/2; }
00048 float getWidth() const { return _x2-_x1; }
00049 float getHeight() const { return _x2-_x1; }
00050 float getArea() const { return (_x2-_x1)*(_y2-_y1); }
00051
00052
00053
00054 bool isClippedLeft() const { return _clipLeft; }
00055 bool isClippedRight() const { return _clipRight; }
00056 bool isClippedTop() const { return _clipTop; }
00057 bool isClippedBottom() const {return _clipBottom; }
00058 void setClipping(bool left, bool right, bool top, bool bottom) { _clipLeft=left; _clipRight=right; _clipTop=top; _clipBottom=bottom; }
00059
00060
00061 virtual std::string getDescription(bool showTypeSpecific=true, unsigned int verbosity=0) const;
00062
00063 virtual unsigned int getBinSize() const;
00064 virtual unsigned int LoadBuffer(const char buf[], unsigned int len);
00065 virtual unsigned int SaveBuffer(char buf[], unsigned int len) const;
00066
00067 protected:
00068 float _x1;
00069 float _x2;
00070 float _y1;
00071 float _y2;
00072 bool _clipLeft;
00073 bool _clipRight;
00074 bool _clipTop;
00075 bool _clipBottom;
00076 };
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090 #endif