Skip to content
Snippets Groups Projects
Commit e8d0d07a authored by Julien Michel's avatar Julien Michel
Browse files

ENH: (Visu Refactoring) Adding a list of GlComponents to render

parent 56e8f7f6
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@
#include "itkRGBPixel.h"
#include "itkFixedArray.h"
#include "otbGlComponent.h"
#include "otbObjectList.h"
namespace otb
{
......@@ -70,6 +70,9 @@ public:
typedef typename AffineTransformType::Pointer AffineTransformPointerType;
typedef typename GlComponentType::VectorType VectorType;
typedef typename GlComponentType::PointType PointType;
typedef ObjectList<GlComponentType> GlComponentListType;
typedef typename GlComponentListType::Pointer GlComponentListPointerType;
typedef typename GlComponentListType::Iterator GlComponentIteratorType;
/** Reads the OpenGl buffer from an image pointer
* \param image The image pointer,
......@@ -106,6 +109,32 @@ public:
itkGetObjectMacro(ImageToScreenTransform,AffineTransformType);
itkGetObjectMacro(ScreenToImageTransform,AffineTransformType);
/** Add a GlComponent */
unsigned int AddGlComponent(const GlComponent * glComponent)
{
m_GlComponents->PushBack(glComponent);
return m_GlComponents->Size()-1;
}
/** Remove a GlComponent */
void RemoveGlComponent(unsigned int index)
{
m_GlComponents->Erase(index);
}
/** Clear the GlComponent list */
void ClearGlComponents()
{
m_GlComponents->Clear();
}
/** Get the number of GlComponent */
unsigned int GetNumberOfGlComponents()
{
return m_GlComponents->Size();
}
protected:
/** Constructor */
ImageWidget();
......@@ -173,6 +202,9 @@ private:
AffineTransformPointerType m_ImageToScreenTransform;
AffineTransformPointerType m_ScreenToImageTransform;
/** Addtionnal Gl components */
GlComponentListPointerType m_GlComponents;
}; // end class
} // end namespace otb
......
......@@ -27,7 +27,8 @@ template <class TInputImage>
ImageWidget<TInputImage>
::ImageWidget() : m_IsotropicZoom(1.0), m_OpenGlBuffer(NULL), m_OpenGlBufferedRegion(),
m_Rectangle(),m_DisplayRectangle(false),m_RectangleColor(), m_Extent(),
m_SubsamplingRate(1), m_ImageToScreenTransform(),m_ScreenToImageTransform()
m_SubsamplingRate(1), m_ImageToScreenTransform(),m_ScreenToImageTransform(),
m_GlComponents()
{
// Default color for rectangle
m_RectangleColor.Fill(0.);
......@@ -37,6 +38,9 @@ ImageWidget<TInputImage>
// Initialize space to screen transform and inverse
m_ImageToScreenTransform = AffineTransformType::New();
m_ScreenToImageTransform = AffineTransformType::New();
// Initialize the components list
m_GlComponents = GlComponentListType::New();
}
template <class TInputImage>
......@@ -215,6 +219,16 @@ ImageWidget<TInputImage>
glDisable(GL_TEXTURE_2D);
}
// Render additionnal GlComponents
for(GlComponentIteratorType it = m_GlComponents->Begin();
it!=m_GlComponents->End();++it)
{
if(it.Get()->GetVisible())
{
it.Get()->Render(m_Extent,m_ImageToScreenTransform);
}
}
// // Draw the rectangle if necessary
// if(m_DisplayRectangle)
// {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment