Commit c68694e2 authored by Otmane Lahlou's avatar Otmane Lahlou

ENH: add method in the pixelDescription action handler to disable coordinates...

ENH: add method in the pixelDescription action handler to disable coordinates to placename computation
parent 273f4b2f
......@@ -157,6 +157,9 @@ public:
m_RenderingFunction->SetParameters(param);
}
}
std::cout <<"left Abcisse : "<< m_LeftAsymptote->GetAbcisse()
<< " right abisse : "<< m_RightAsymptote->GetAbcisse()
<< std::endl;
return true;
}
}
......
......@@ -182,7 +182,7 @@ public:
virtual void Render();
/** Get the pixel description */
virtual std::string GetPixelDescription(const IndexType& index);
virtual std::string GetPixelDescription(const IndexType& index, bool getPlaceName = true);
/** Get the pixel location */
virtual PointType GetPixelLocation(const IndexType& index);
......
......@@ -263,7 +263,7 @@ ImageLayer<TImage, TOutputImage>
template <class TImage, class TOutputImage>
std::string
ImageLayer<TImage, TOutputImage>
::GetPixelDescription(const IndexType& index)
::GetPixelDescription(const IndexType& index, bool getPlaceName)
{
//FIXME only if necessary
this->UpdateListSample();
......@@ -307,21 +307,25 @@ ImageLayer<TImage, TOutputImage>
if (m_Transform->GetTransformAccuracy() == Projection::PRECISE) oss << "(precise location)" << std::endl;
if (m_Transform->GetTransformAccuracy() == Projection::ESTIMATE) oss << "(estimated location)" << std::endl;
// We do not want to refresh the location if we are pointing in the scroll view
if (m_Image->GetBufferedRegion().IsInside(index))
// Get the placeName if asked for
if (getPlaceName)
{
if (m_CoordinateToName->SetLonLat(point))
// We do not want to refresh the location if we are pointing in the scroll view
if (m_Image->GetBufferedRegion().IsInside(index))
{
m_CoordinateToName->Evaluate();
if (m_CoordinateToName->SetLonLat(point))
{
m_CoordinateToName->Evaluate();
}
}
}
m_PlaceName = m_CoordinateToName->GetPlaceName();
m_CountryName = m_CoordinateToName->GetCountryName();
m_PlaceName = m_CoordinateToName->GetPlaceName();
m_CountryName = m_CoordinateToName->GetCountryName();
if (m_PlaceName != "") oss << otbGetTextMacro("Near") << " " << m_PlaceName << std::endl;
if (m_CountryName != "") oss << " " << otbGetTextMacro("in") << " " << m_CountryName << std::endl;
if (m_PlaceName != "") oss << otbGetTextMacro("Near") << " " << m_PlaceName << std::endl;
if (m_CountryName != "") oss << " " << otbGetTextMacro("in") << " " << m_CountryName << std::endl;
}
}
else
{
......
......@@ -69,7 +69,7 @@ public:
virtual void Render() = 0;
/** Get the pixel description */
virtual std::string GetPixelDescription(const IndexType& index) = 0;
virtual std::string GetPixelDescription(const IndexType& index, bool getPlaceName = true) = 0;
/** Get the pixel value in TLayerValuePrecision type */
virtual LayerValueType GetValueAtIndex(const IndexType& index) = 0;
......
......@@ -114,7 +114,7 @@ public:
index += m_Offset;
// Communicate new index to model
m_Model->UpdatePixelDescription(index);
m_Model->UpdatePixelDescription(index, m_UsePlaceName);
return true;
break;
......@@ -141,9 +141,14 @@ public:
itkSetMacro(Offset, OffsetType);
itkGetMacro(Offset, OffsetType);
/** Get PlaceName flag */
itkSetMacro(UsePlaceName, bool);
itkGetMacro(UsePlaceName, bool);
protected:
/** Constructor */
PixelDescriptionActionHandler() : m_View(), m_Model()
PixelDescriptionActionHandler() : m_View(), m_Model(),
m_UsePlaceName(true)
{
m_Offset.Fill(0);
}
......@@ -169,6 +174,9 @@ private:
// Pointer to the model
ModelPointerType m_Model;
// Flag to get the placename
bool m_UsePlaceName;
}; // end class
} // end namespace otb
#endif
......@@ -66,7 +66,7 @@ public:
void ClearPixelDescription();
/** Update the pixel description */
void UpdatePixelDescription(const IndexType& index);
void UpdatePixelDescription(const IndexType& index, bool usePlaceName = true);
protected:
/** Constructor */
......
......@@ -47,7 +47,7 @@ PixelDescriptionModel<TOutputImage>
template <class TOutputImage>
void
PixelDescriptionModel<TOutputImage>
::UpdatePixelDescription(const IndexType& index)
::UpdatePixelDescription(const IndexType& index, bool usePlaceName)
{
// The output stringstream
std::ostringstream oss;
......@@ -60,7 +60,7 @@ PixelDescriptionModel<TOutputImage>
if (it.Get()->GetVisible())
{
// Get the pixel description
oss << it.Get()->GetPixelDescription(index) << std::endl;
oss << it.Get()->GetPixelDescription(index, usePlaceName) << std::endl;
}
}
m_PixelDescription = oss.str();
......
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