00001 #ifndef Impala_Visualization_ViewListenerWithCircles_h 00002 #define Impala_Visualization_ViewListenerWithCircles_h 00003 00004 #include "Visualization/View.h" 00005 #include "Core/Geometry/PointZList.h" 00006 00007 namespace Impala 00008 { 00009 namespace Visualization 00010 { 00011 00012 00013 class ViewListenerWithCircles : 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 ViewListenerWithCircles(Core::Geometry::PointZList* pList, int radius, 00020 ULONG color = oglRED, bool fill = true) 00021 { 00022 mPList = pList; 00023 mRadius = radius; 00024 mColor = color; 00025 mFill = fill; 00026 } 00027 00028 virtual void 00029 OnDrawView(OglGui::View* view) 00030 { 00031 if (mPList->size() == 0) 00032 return; 00033 00034 OGLIMAGE* oglIm = view->GetOGLIMAGE(); 00035 if (!oglIm) 00036 return; 00037 00038 OGC ogc; 00039 OGCSave(&ogc); 00040 glPushMatrix(); 00041 00042 viewSys.View2DImageTransform(view->GetOGLVIEW2D()); 00043 if (mFill) 00044 SetSolidFillColor(mColor); 00045 else 00046 SetSolidLineColor(mColor); 00047 SetLineWidth(1); 00048 for (Core::Geometry::PointZListCI p=mPList->begin() ; p!=mPList->end() ; p++) 00049 { 00050 if (mFill) 00051 FillCircle(p->mX, oglIm->h - p->mY, mRadius); 00052 else 00053 DrawCircle(p->mX, oglIm->h - p->mY, mRadius); 00054 } 00055 glPopMatrix(); 00056 OGCRestore(&ogc); 00057 } 00058 00059 private: 00060 00061 Core::Geometry::PointZList* mPList; 00062 int mRadius; 00063 ULONG mColor; 00064 bool mFill; 00065 00066 }; 00067 00068 } // namespace Visualization 00069 } // namespace Impala 00070 00071 #endif