From 0b4cb511de210627e4b07cc4ad0bdef1b236833c Mon Sep 17 00:00:00 2001 From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org> Date: Wed, 17 Sep 2008 17:05:10 +0000 Subject: [PATCH] ENH: Handling path drawing --- Code/Visu/otbImageViewerBase.h | 13 +++++++++++++ Code/Visu/otbImageViewerBase.txx | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Code/Visu/otbImageViewerBase.h b/Code/Visu/otbImageViewerBase.h index 857b2ba714..462d120140 100644 --- a/Code/Visu/otbImageViewerBase.h +++ b/Code/Visu/otbImageViewerBase.h @@ -27,6 +27,7 @@ PURPOSE. See the above copyright notices for more information. #include "otbStreamingShrinkImageFilter.h" #include "otbImageWidgetBoxForm.h" #include "otbImageWidgetPolygonForm.h" +#include "otbImageWidgetPolylineForm.h" #include "otbImageWidgetCircleForm.h" #include "itkListSample.h" #include "otbObjectList.h" @@ -165,6 +166,14 @@ namespace otb typedef typename ImageWidgetCircleFormType::Pointer ImageWidgetCircleFormPointerType; typedef std::map<LabelType,ColorType> ROIColorMapType; + typedef otb::PolyLineParametricPathWithValue<double,2> PathType; + typedef typename PathType::VertexListIteratorType PathIteratorType; + typedef otb::ObjectList<PathType> PathListType; + typedef typename PathListType::Pointer PathListPointerType; + typedef typename PathListType::Iterator PathListIteratorType; + typedef ImageWidgetPolylineForm<double> ImageWidgetPolylineFormType; + typedef typename ImageWidgetPolylineFormType::Pointer ImageWidgetPolylineFormPointerType; + /// Accessors itkGetMacro(Built,bool); itkGetMacro(ShrinkFactor,unsigned int); @@ -184,6 +193,8 @@ namespace otb itkGetMacro(UseScroll,bool); itkGetObjectMacro(PolygonROIList, PolygonListType); itkSetObjectMacro(PolygonROIList, PolygonListType); + itkGetObjectMacro(PathList, PathListType); + itkSetObjectMacro(PathList, PathListType); itkGetObjectMacro(InterfaceBoxesList,FormListType); itkSetObjectMacro(InterfaceBoxesList,FormListType); itkSetMacro(InterfaceBoxesColor,ColorType); @@ -473,6 +484,8 @@ namespace otb OffsetListType m_LinkedViewerOffsetList; /// PolygonList PolygonListPointerType m_PolygonROIList; + /// PathList + PathListPointerType m_PathList; /// Interface boxes FormListPointerType m_InterfaceBoxesList; /// Next ROI color diff --git a/Code/Visu/otbImageViewerBase.txx b/Code/Visu/otbImageViewerBase.txx index 18213d2436..1a9723d5d5 100644 --- a/Code/Visu/otbImageViewerBase.txx +++ b/Code/Visu/otbImageViewerBase.txx @@ -60,6 +60,7 @@ namespace otb m_LinkedViewerList = ViewerListType::New(); m_Updating = false; m_PolygonROIList = PolygonListType::New(); + m_PathList = PathListType::New(); m_InterfaceBoxesList = FormListType::New(); m_ShowFullWidget = true; m_ShowScrollWidget = true; @@ -565,6 +566,19 @@ namespace otb new_list->PushBack(new_poly); } + for(PathListIteratorType it2 = m_PathList->Begin(); + it2!=m_PathList->End();++it2) + { + ImageWidgetPolylineFormPointerType new_line = ImageWidgetPolylineFormType::New(); + new_line->SetPolyline(it2.Get()); +// new_line->SetInternalValueToAlphaChannel(true); + + new_line->SetColor(m_DefaultROIColor); + + new_list->PushBack(new_line); + } + + if(m_UseScroll) { m_ScrollWidget->SetFormListOverlay(new_list); -- GitLab