Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

VxRectangle.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_Geometry_VxRectangle_h
00002 #define Impala_Core_Geometry_VxRectangle_h
00003 
00004 #include <string>
00005 #include "Core/Geometry/Rectangle.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Core
00010 {
00011 namespace Geometry
00012 {
00013 
00014 
00015 // Video rectangle (+ annotation)
00016 class VxRectangle
00017 {
00018 public:
00019 
00020     std::string mVideoName; // dbFile
00021     std::string mSection; // dbSection
00022     std::string mDir; // dbDir
00023     int         mStartFrame;
00024     int         mEndFrame;
00025     Rectangle   mRect;
00026     std::string mAnno;
00027     std::string mExtra;
00028 
00029     int
00030     operator==(const VxRectangle& r) const
00031     {
00032         return ((mVideoName == r.mVideoName) && (mSection == r.mSection) &&
00033                 (mDir == r.mDir) && (mStartFrame == r.mStartFrame) &&
00034                 (mEndFrame == r.mEndFrame) && (mRect == r.mRect) &&
00035                 (mAnno == r.mAnno) && (mExtra == r.mExtra));
00036     }
00037 
00047     bool
00048     EqualInTime(const VxRectangle& v) const
00049     {
00050         return ((mStartFrame == v.mStartFrame) &&
00051                 (mEndFrame   == v.mEndFrame) &&
00052                 (mVideoName  == v.mVideoName));
00053     }
00054 
00055     bool
00056     MeetsInTime(const VxRectangle& v) const
00057     {
00058         return ((mEndFrame  == v.mStartFrame + 1) &&
00059                 (mVideoName == v.mVideoName));
00060     }
00061 
00062     bool
00063     BeforeInTime(const VxRectangle& v) const
00064     {
00065         return ((mEndFrame < v.mStartFrame) && !MeetsInTime(v));
00066     }
00067 
00068     bool
00069     OverlapsInTime(const VxRectangle& v) const
00070     {
00071         return ((mStartFrame <  v.mStartFrame) &&
00072                 (mEndFrame   >= v.mStartFrame) &&
00073                 (mEndFrame   <  v.mEndFrame)   &&
00074                 (mVideoName  == v.mVideoName));
00075     }
00076 
00077     bool
00078     During(const VxRectangle& v) const
00079     {
00080         return (!EqualInTime(v) &&
00081                 (mStartFrame >= v.mStartFrame) &&
00082                 (mEndFrame   <= v.mEndFrame) &&
00083                 (mVideoName  == v.mVideoName));
00084     }
00085 
00086     bool
00087     ContainsInTime(const VxRectangle& v) const
00088     {
00089         return (v.During(*this));
00090     }
00091 
00092     bool
00093     MeetsAnywhereInTime(const VxRectangle& v) const
00094     {
00095         return (MeetsInTime(v) || v.MeetsInTime(*this));
00096     }
00097 
00098     bool
00099     BeforeAfterInTime(const VxRectangle& v) const
00100     {
00101         return (BeforeInTime(v) || v.BeforeInTime(*this));
00102     }
00103 
00104     bool
00105     OverlapsAnywhereInTime(const VxRectangle& v) const
00106     {
00107         return (OverlapsInTime(v) || v.OverlapsInTime(*this));
00108     }
00109 
00110 };
00111 
00112 inline std::ostream&
00113 operator<<(std::ostream& os, const VxRectangle& r)
00114 {
00115     os << "anno=\"" << r.mAnno << "\", frames: " << r.mStartFrame
00116        << " to " << r.mEndFrame << ", rect=" << r.mRect << ", extra="
00117        << r.mExtra << std::endl;
00118     return os;
00119 }
00120 
00121 } // namespace Geometry
00122 } // namespace Core
00123 } // namespace Impala
00124 
00125 #endif

Generated on Fri Mar 19 09:31:10 2010 for ImpalaSrc by  doxygen 1.5.1