Skip to content
Snippets Groups Projects
Commit b641daa8 authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

MRG

parent 834e47ac
Branches
Tags
No related merge requests found
...@@ -60,12 +60,13 @@ public: ...@@ -60,12 +60,13 @@ public:
typedef typename ViewType::ImageWidgetType::PointType PointType; typedef typename ViewType::ImageWidgetType::PointType PointType;
/** Curve Widget*/ /** Curve Widget*/
typedef Curves2DWidget CurveWidgetType; typedef Curves2DWidget CurveWidgetType;
typedef typename CurveWidgetType::Pointer CurveWidgetPointerType; typedef typename CurveWidgetType::Pointer CurveWidgetPointerType;
/** Rendering Function Type */ /** Rendering Function Type */
typedef TRenderingFunction SRenderingFunctionType; typedef TRenderingFunction RenderingFunctionType;
typedef typename SRenderingFunctionType::Pointer SRenderingFunctionPointerType; typedef typename RenderingFunctionType::Pointer RenderingFunctionPointerType;
typedef typename RenderingFunctionType::ParametersType ParametersType;
/** */ /** */
typedef VerticalAsymptoteCurve VerticalAsymptoteType; typedef VerticalAsymptoteCurve VerticalAsymptoteType;
...@@ -73,10 +74,9 @@ public: ...@@ -73,10 +74,9 @@ public:
/** Handle Boundaries translation /** Handle vertical asymptotes translation
* \param widgetId The id of the resized widget * \param widgetId The id of the handled Curve widget
* \param x new x location * \param event kind of event ot handle : FL_DRAG , FL_PUSH, FL_RELEASE
* \param y new y location
*/ */
virtual bool HandleWidgetEvent(std::string widgetId, int event) virtual bool HandleWidgetEvent(std::string widgetId, int event)
{ {
...@@ -99,8 +99,7 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event) ...@@ -99,8 +99,7 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event)
{ {
// Position Clicked // Position Clicked
double x = Fl::event_x(); double x = Fl::event_x();
//std::cout <<"I clicked in position " << x << "," << y << std::endl;
//typename SRenderingFunctionType::ParametersType param = m_RenderingFunction->GetParameters(); //typename SRenderingFunctionType::ParametersType param = m_RenderingFunction->GetParameters();
if ((vcl_abs(x-abcisseL)<50) || (vcl_abs(x-abcisseR)<50)) if ((vcl_abs(x-abcisseL)<50) || (vcl_abs(x-abcisseR)<50))
...@@ -118,6 +117,16 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event) ...@@ -118,6 +117,16 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event)
} }
case FL_RELEASE: case FL_RELEASE:
{ {
if(m_ModifyLeft || m_ModifyRight)
{
//
m_Model->Update();
//
/* m_View->GetScrollWidget()->redraw(); */
/* m_View->GetFullWidget()->redraw(); */
/* m_View->GetZoomWidget()->redraw(); */
}
m_ModifyLeft = false; m_ModifyLeft = false;
m_ModifyRight = false; m_ModifyRight = false;
return true; return true;
...@@ -131,9 +140,12 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event) ...@@ -131,9 +140,12 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event)
double tx = x - abcisseL; double tx = x - abcisseL;
m_LeftAsymptote->SetAbcisse(m_LeftAsymptote->GetAbcisse() + tx); m_LeftAsymptote->SetAbcisse(m_LeftAsymptote->GetAbcisse() + tx);
m_Curve->redraw(); m_Curve->redraw();
//Update The Rendering Function min and max // Update The Rendering Function min and max
//.... ParametersType param = m_RenderingFunction->GetParameters();
param.SetElement(2*m_Channel, m_LeftAsymptote->GetAbcisse() + tx);
param.SetElement(2*m_Channel, m_RightAsymptote->GetAbcisse());
m_RenderingFunction->SetParameters(param);
} }
if(m_ModifyRight) if(m_ModifyRight)
...@@ -141,11 +153,13 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event) ...@@ -141,11 +153,13 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event)
double tx = x - abcisseR; double tx = x - abcisseR;
m_RightAsymptote->SetAbcisse(m_RightAsymptote->GetAbcisse() + tx); m_RightAsymptote->SetAbcisse(m_RightAsymptote->GetAbcisse() + tx);
m_Curve->redraw(); m_Curve->redraw();
//Update The Rendering Function min and max // Update The Rendering Function min and max
//.... ParametersType param = m_RenderingFunction->GetParameters();
param.SetElement(2*m_Channel, m_LeftAsymptote->GetAbcisse());
param.SetElement(2*m_Channel, m_RightAsymptote->GetAbcisse()+tx);
m_RenderingFunction->SetParameters(param);
} }
return true; return true;
} }
} }
...@@ -167,17 +181,20 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event) ...@@ -167,17 +181,20 @@ virtual bool HandleWidgetEvent(std::string widgetId, int event)
/** Get The left asymptote*/ /** Get The left asymptote*/
itkSetObjectMacro(LeftAsymptote,VerticalAsymptoteType); itkSetObjectMacro(LeftAsymptote,VerticalAsymptoteType);
itkSetObjectMacro(RightAsymptote,VerticalAsymptoteType); itkSetObjectMacro(RightAsymptote,VerticalAsymptoteType);
/** Set/Get the rendering Function */ /** Set/Get the rendering Function */
itkSetObjectMacro(RenderingFunction , SRenderingFunctionType); itkSetObjectMacro(RenderingFunction , RenderingFunctionType);
/** Set/Get the channel dealed with in the image*/
itkSetMacro(Channel,unsigned int);
protected: protected:
/** Constructor */ /** Constructor */
HistogramActionHandler() : m_View(), m_Model(), m_RenderingFunction() HistogramActionHandler() : m_View(), m_Model(), m_RenderingFunction()
{ {
m_ModifyLeft = false; m_Channel = 0;
m_ModifyRight = false; m_ModifyLeft = false;
m_ModifyRight = false;
} }
/** Destructor */ /** Destructor */
...@@ -202,17 +219,19 @@ private: ...@@ -202,17 +219,19 @@ private:
CurveWidgetPointerType m_Curve; CurveWidgetPointerType m_Curve;
// StandardRenderingFunction // StandardRenderingFunction
SRenderingFunctionPointerType m_RenderingFunction; RenderingFunctionPointerType m_RenderingFunction;
// Left And Rigth Asymptote // Left And Rigth Asymptote
VerticalAsymptotePointerType m_LeftAsymptote; VerticalAsymptotePointerType m_LeftAsymptote;
VerticalAsymptotePointerType m_RightAsymptote; VerticalAsymptotePointerType m_RightAsymptote;
// Flags
bool m_ModifyLeft ; bool m_ModifyLeft ;
bool m_ModifyRight; bool m_ModifyRight;
//Channel we're dealing handling
unsigned int m_Channel;
}; // end class }; // end class
} // end namespace otb } // end namespace otb
#endif #endif
......
...@@ -103,10 +103,19 @@ ImageLayer<TImage,TOutputImage> ...@@ -103,10 +103,19 @@ ImageLayer<TImage,TOutputImage>
// this->UpdateListSample(); // this->UpdateListSample();
// } // }
// Render quicklook // Render quicklook
if(this->GetHasQuicklook()) if(this->GetHasQuicklook())
{ {
itk::TimeProbe probe; itk::TimeProbe probe;
probe.Start(); probe.Start();
// Impacting modified on the the rendering function
if(m_RenderingFunction->GetMTime() > m_QuicklookRenderingFilter->GetOutput()->GetUpdateMTime())
{
m_QuicklookRenderingFilter->Modified();
}
m_QuicklookRenderingFilter->Update(); m_QuicklookRenderingFilter->Update();
this->SetRenderedQuicklook(m_QuicklookRenderingFilter->GetOutput()); this->SetRenderedQuicklook(m_QuicklookRenderingFilter->GetOutput());
probe.Stop(); probe.Stop();
...@@ -117,7 +126,13 @@ ImageLayer<TImage,TOutputImage> ...@@ -117,7 +126,13 @@ ImageLayer<TImage,TOutputImage>
{ {
itk::TimeProbe probe; itk::TimeProbe probe;
probe.Start(); probe.Start();
// std::cout<<"Extent: "<<this->GetExtent()<<" Largest: "<<m_Image->GetLargestPossibleRegion()<<" ExtractRegion: "<<this->GetExtractRegion()<<std::endl;
// Impacting modified on the the rendering function
if(m_RenderingFunction->GetMTime() > m_ExtractRenderingFilter->GetOutput()->GetUpdateMTime())
{
m_ExtractRenderingFilter->Modified();
}
m_ExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetExtractRegion()); m_ExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetExtractRegion());
m_ExtractRenderingFilter->Update(); m_ExtractRenderingFilter->Update();
this->SetRenderedExtract(m_ExtractRenderingFilter->GetOutput()); this->SetRenderedExtract(m_ExtractRenderingFilter->GetOutput());
...@@ -135,6 +150,12 @@ ImageLayer<TImage,TOutputImage> ...@@ -135,6 +150,12 @@ ImageLayer<TImage,TOutputImage>
{ {
itk::TimeProbe probe; itk::TimeProbe probe;
probe.Start(); probe.Start();
// Impacting modified on the the rendering function
if(m_RenderingFunction->GetMTime() > m_ScaledExtractRenderingFilter->GetOutput()->GetUpdateMTime())
{
m_ScaledExtractRenderingFilter->Modified();
}
m_ScaledExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetScaledExtractRegion()); m_ScaledExtractRenderingFilter->GetOutput()->SetRequestedRegion(this->GetScaledExtractRegion());
m_ScaledExtractRenderingFilter->Update(); m_ScaledExtractRenderingFilter->Update();
this->SetRenderedScaledExtract(m_ScaledExtractRenderingFilter->GetOutput()); this->SetRenderedScaledExtract(m_ScaledExtractRenderingFilter->GetOutput());
......
...@@ -202,8 +202,8 @@ public: ...@@ -202,8 +202,8 @@ public:
if (this->GetHistogramList().IsNull()) if (this->GetHistogramList().IsNull())
{ {
this->RenderHistogram(); this->RenderHistogram();
// itkExceptionMacro( << "To Compute min/max automatically, Histogram should be " // itkExceptionMacro( << "To Compute min/max automatically, Histogram should be "
// <<"provided to the rendering function with SetHistogramList()" ); // <<"provided to the rendering function with SetHistogramList()" );
} }
for(unsigned int comp = 0; comp < nbComps;++comp) for(unsigned int comp = 0; comp < nbComps;++comp)
{ {
...@@ -314,7 +314,7 @@ public: ...@@ -314,7 +314,7 @@ public:
*/ */
virtual ParametersType GetParameters() virtual ParametersType GetParameters()
{ {
unsigned int nbBands = m_TransferedMaximum.size(); unsigned int nbBands = m_Minimum.size();/*TransferedMaximum*/
ParametersType param; ParametersType param;
param.SetSize(2*nbBands); param.SetSize(2*nbBands);
...@@ -322,9 +322,9 @@ public: ...@@ -322,9 +322,9 @@ public:
for(unsigned int i = 0; i< nbBands ; i++) for(unsigned int i = 0; i< nbBands ; i++)
{ {
// Min Band // Min Band
param.SetElement(2*i,m_TransferedMinimum[i]); param.SetElement(2*i,/*TransferedMinimum*/m_Minimum[i]);
// Max Band // Max Band
param.SetElement(2*i+1,m_TransferedMaximum[i]); param.SetElement(2*i+1,/*TransferedMaximum*/m_Maximum[i]);
} }
return param; return param;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment