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

ViewListenerCircles.h

Go to the documentation of this file.
00001 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00002 // Author: Richard van Balen
00003 #ifndef Impala_Application_TagsLife_ViewListenerCircles_h
00004 #define Impala_Application_TagsLife_ViewListenerCircles_h
00005 
00006 #include "OglGui/View.h"
00007 
00008 namespace Impala {
00009 namespace Application {
00010 namespace TagsLife {
00011 
00012 class ViewListenerCircles : public OglGui::ViewListener
00013 {
00014 public:
00015     ViewListenerCircles()
00016     {
00017         mColor = oglRED;
00018     }
00019 
00020     struct CircleInfo {
00021         CircleInfo(int cX, int cY, int cR)
00022         {
00023             x = cX; y = cY; r = cR;
00024         }
00025         int x;
00026         int y;
00027         int r;
00028     };
00029 
00030     void Color(ULONG col)
00031     {
00032         mColor = col;
00033     }
00034 
00035     void AddCircle(int x, int y, int r)
00036     {
00037         CircleInfo c(x,y,r);
00038         mCircles.push_back(c);
00039     }
00040 
00041     void Clear()
00042     {
00043         mCircles.clear();
00044     }
00045 
00046     virtual void
00047     OnDrawView(OglGui::View* view)
00048     {
00049         OGLIMAGE* oglIm = view->GetOGLIMAGE();
00050         if (!oglIm)
00051             return;
00052 
00053         OGC ogc;
00054         OGCSave(&ogc);
00055         glPushMatrix();
00056 
00057         viewSys.View2DImageTransform(view->GetOGLVIEW2D());
00058         SetSolidLineColor(mColor);
00059         SetLineWidth(1);
00060         for (int i=0; i<mCircles.size(); i++)
00061             DrawCircle(mCircles[i].x, mCircles[i].y, mCircles[i].r);
00062 
00063         glPopMatrix();
00064         OGCRestore(&ogc);
00065     }
00066 
00067 private:
00068     std::vector<CircleInfo> mCircles;
00069     ULONG                   mColor;
00070 };
00071 
00072 } // namespace TagsLife
00073 } // namespace Application
00074 } // namespace Impala
00075 
00076 #endif

Generated on Fri Mar 19 09:30:40 2010 for ImpalaSrc by  doxygen 1.5.1