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

ViewListenerWithArrows.h

Go to the documentation of this file.
00001 #ifndef Impala_Visualization_ViewListenerWithArrows_h
00002 #define Impala_Visualization_ViewListenerWithArrows_h
00003 
00004 #include "Visualization/View.h"
00005 #include "Core/Geometry/ArrowRList.h"
00006 
00007 namespace Impala
00008 {
00009 namespace Visualization
00010 {
00011 
00012 
00013 class ViewListenerWithArrows : public OglGui::ViewListener
00014 {
00015 public:
00016 
00017     // elements in list denote centre of circles, in image coordinates
00018     // so view should contain an image!
00019     ViewListenerWithArrows(Core::Geometry::ArrowRList* aList,
00020                            ULONG color = oglRED)
00021     {
00022         mAList = aList;
00023         mColor = color;
00024     }
00025 
00026     virtual void
00027     OnDrawView(OglGui::View* view)
00028     {
00029         if (mAList->size() == 0)
00030             return;
00031 
00032         OGLIMAGE* oglIm = view->GetOGLIMAGE();
00033         if (!oglIm)
00034             return;
00035 
00036         OGC ogc;
00037         OGCSave(&ogc);
00038         glPushMatrix();
00039 
00040         viewSys.View2DImageTransform(view->GetOGLVIEW2D());
00041         SetSolidLineColor(mColor);
00042         SetLineWidth(1);
00043         for (Core::Geometry::ArrowRListCI a=mAList->begin() ; a!=mAList->end() ; a++)
00044         {
00045             DrawLine(a->mPX, oglIm->h - a->mPY, a->HeadX(), oglIm->h - a->HeadY());
00046             DrawLine(a->HeadX(), oglIm->h - a->HeadY(),
00047                      a->HeadLeftX(), oglIm->h - a->HeadLeftY());
00048             DrawLine(a->HeadX(), oglIm->h - a->HeadY(),
00049                      a->HeadRightX(), oglIm->h - a->HeadRightY());
00050         }
00051         glPopMatrix();
00052         OGCRestore(&ogc);
00053     }
00054 
00055 private:
00056 
00057     Core::Geometry::ArrowRList* mAList;
00058     ULONG                       mColor;
00059 
00060 };
00061 
00062 } // namespace Visualization
00063 } // namespace Impala
00064 
00065 #endif

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