Commit 45157fa7 authored by Otmane Lahlou's avatar Otmane Lahlou

ENH : enhance the StandardViewer by using the packedWidgetManager

parent 0eb79781
......@@ -42,7 +42,8 @@
#include "otbVectorDataExtractROI.h"
#include "otbRemoteSensingRegion.h"
#include "otbImageWidgetPackedManager.h"
//#include "otbImageWidgetPackedManager.h"
#include "otbPackedWidgetManager.h"
namespace otb
{
......@@ -52,9 +53,9 @@ namespace otb
*
*/
template <class TImage, class TVectorData = VectorData<double> >
template <class TImage, class TVectorData = VectorData<double> , class TWidgetManager = otb::PackedWidgetManager>
class StandardImageViewer
: public itk::Object, public ImageWidgetPackedManager
: public itk::Object//, public ImageWidgetPackedManager
{
public:
/** Standard class typedefs */
......@@ -78,6 +79,10 @@ public:
typedef TVectorData VectorDataType;
typedef typename VectorDataType::Pointer VectorDataPointerType;
/** PackedWidgetManager */
typedef TWidgetManager WidgetManagerType;
typedef typename WidgetManagerType::Pointer WidgetManagerPointerType;
/** Output image type */
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef Image<RGBPixelType,2> OutputImageType;
......@@ -209,6 +214,9 @@ private:
/** Path to the DEMDirectory (used if a VectorData is rendered */
std::string m_DEMDirectory;
/** */
WidgetManagerPointerType m_DisplayWindow;
}; // end class
} // end namespace otb
......
......@@ -25,12 +25,12 @@
namespace otb
{
template <class TImage,class TVectorData>
StandardImageViewer<TImage,TVectorData>
template <class TImage,class TVectorData,class TWidgetManager>
StandardImageViewer<TImage,TVectorData,TWidgetManager>
::StandardImageViewer() : m_Label("Default label"), m_Image(), m_VectorData(),
m_ImageLayer(), m_RenderingModel(),m_PixelDescriptionModel(),
m_View(), m_PixelDescriptionView(), m_CurveWidget(),
m_Controller(), m_RenderingFunction()
m_ImageLayer(), m_RenderingModel(),m_PixelDescriptionModel(),
m_View(), m_PixelDescriptionView(), m_CurveWidget(),
m_Controller(), m_RenderingFunction(), m_DisplayWindow()
{
// Build a new rendering model
m_RenderingModel = RenderingModelType::New();
......@@ -88,29 +88,35 @@ StandardImageViewer<TImage,TVectorData>
arrowKeyMoveHandler->SetView(m_View);
m_Controller->AddActionHandler(arrowKeyMoveHandler);
m_FullGroup->add(m_View->GetFullWidget());
m_QuicklookGroup->add(m_View->GetScrollWidget());
m_ZoomGroup->add(m_View->GetZoomWidget());
m_HistogramsGroup->add(m_CurveWidget);
m_PixelInformationGroup->add(m_PixelDescriptionView->GetPixelDescriptionWidget());
m_View->GetZoomWidget()->resize(m_ZoomGroup->x(),m_ZoomGroup->y(),m_ZoomGroup->w(),m_ZoomGroup->h());
m_View->GetFullWidget()->resize(m_FullGroup->x(),m_FullGroup->y(),m_FullGroup->w(),m_FullGroup->h());
m_View->GetScrollWidget()->resize(m_QuicklookGroup->x(),m_QuicklookGroup->y(),m_QuicklookGroup->w(),m_QuicklookGroup->h());
m_CurveWidget->resize(m_HistogramsGroup->x(),m_HistogramsGroup->y(),m_HistogramsGroup->w(),m_HistogramsGroup->h());
m_PixelDescriptionView->GetPixelDescriptionWidget()->resize(m_PixelInformationGroup->x(),m_PixelInformationGroup->y(),m_PixelInformationGroup->w(),m_PixelInformationGroup->h());
/** Display Window*/
m_DisplayWindow = WidgetManagerType::New();
m_DisplayWindow->RegisterFullWidget(m_View->GetFullWidget());
m_DisplayWindow->RegisterScrollWidget(m_View->GetScrollWidget());
m_DisplayWindow->RegisterZoomWidget(m_View->GetZoomWidget());
m_DisplayWindow->RegisterPixelInformationWidget(m_PixelDescriptionView->GetPixelDescriptionWidget());
m_DisplayWindow->RegisterHistogramWidget(m_CurveWidget);
//m_FullGroup->add(m_View->GetFullWidget());
//m_QuicklookGroup->add(m_View->GetScrollWidget());
//m_ZoomGroup->add(m_View->GetZoomWidget());
//m_HistogramsGroup->add(m_CurveWidget);
//m_PixelInformationGroup->add(m_PixelDescriptionView->GetPixelDescriptionWidget());
//m_View->GetZoomWidget()->resize(m_ZoomGroup->x(),m_ZoomGroup->y(),m_ZoomGroup->w(),m_ZoomGroup->h());
//m_View->GetFullWidget()->resize(m_FullGroup->x(),m_FullGroup->y(),m_FullGroup->w(),m_FullGroup->h());
//m_View->GetScrollWidget()->resize(m_QuicklookGroup->x(),m_QuicklookGroup->y(),m_QuicklookGroup->w(),m_QuicklookGroup->h());
//m_CurveWidget->resize(m_HistogramsGroup->x(),m_HistogramsGroup->y(),m_HistogramsGroup->w(),m_HistogramsGroup->h());
//m_PixelDescriptionView->GetPixelDescriptionWidget()->resize(m_PixelInformationGroup->x(),m_PixelInformationGroup->y(),m_PixelInformationGroup->w(),m_PixelInformationGroup->h());
}
template <class TImage,class TVectorData>
StandardImageViewer<TImage,TVectorData>
template <class TImage,class TVectorData,class TWidgetManager>
StandardImageViewer<TImage,TVectorData,TWidgetManager>
::~StandardImageViewer()
{}
template <class TImage,class TVectorData>
template <class TImage,class TVectorData,class TWidgetManager>
void
StandardImageViewer<TImage,TVectorData>
StandardImageViewer<TImage,TVectorData,TWidgetManager>
::Update()
{
// First check if there is actually an input image
......@@ -207,7 +213,7 @@ StandardImageViewer<TImage,TVectorData>
}
// Generate the layer
ImageLayerGeneratorPointerType generator = ImageLayerGeneratorType::New();
ImageLayerGeneratorPointerType generator = ImageLayerGeneratorType::New();
generator->SetImage(m_Image);
FltkFilterWatcher qlwatcher(generator->GetResampler(),0,0,200,20,"Generating QuickLook ...");
generator->GenerateLayer();
......@@ -215,18 +221,19 @@ StandardImageViewer<TImage,TVectorData>
m_RenderingFunction = generator->GetDefaultRenderingFunction();
// Set the window and layer label
m_Window->label(m_Label.c_str());
//m_Window->label(m_Label.c_str());
m_ImageLayer->SetName(m_Label);
// Add the generated layer to the rendering model
m_RenderingModel->AddLayer(generator->GetLayer());
// Show everything
m_Window->show();
m_View->GetScrollWidget()->show();
m_View->GetFullWidget()->show();
m_View->GetZoomWidget()->show();
m_CurveWidget->show();
// m_Window->show();
// m_View->GetScrollWidget()->show();
// m_View->GetFullWidget()->show();
// m_View->GetZoomWidget()->show();
// m_CurveWidget->show();
m_DisplayWindow->Show();
// Update the rendering model
m_RenderingModel->Update();
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbPackedWidgetManager.h"
int otbPackedWidgetManagerNew( int argc, char * argv[] )
{
typedef otb::PackedWidgetManager PackedWidgetManagerType;
PackedWidgetManagerType::Pointer layer = PackedWidgetManagerType::New();
return EXIT_SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment