21 #ifndef otbPolyLineParametricPathWithValue_hxx
22 #define otbPolyLineParametricPathWithValue_hxx
26 #include "itkNumericTraits.h"
33 template <
class TValue,
unsigned int VDimension>
35 : m_Key(
"Value"), m_Length(-1.0), m_LengthIsValid(false), m_BoundingRegion(), m_BoundingRegionIsValid(false)
37 itk::MetaDataDictionary& dict = this->GetMetaDataDictionary();
39 itk::EncapsulateMetaData<ValueType>(dict, m_Key, itk::NumericTraits<ValueType>::ZeroValue(v));
43 template <
class TValue,
unsigned int VDimension>
46 Superclass::AddVertex(vertex);
50 template <
class TValue,
unsigned int VDimension>
60 template <
class TValue,
unsigned int VDimension>
66 if (this->GetVertexList()->Size() > 1)
73 while (it != this->GetVertexList()->End())
78 for (
unsigned int i = 0; i < VDimension; ++i)
80 accum += (pt1[i] - pt2[i]) * (pt1[i] - pt2[i]);
82 length += std::sqrt(accum);
92 m_LengthIsValid =
true;
98 template <
class TValue,
unsigned int VDimension>
101 Superclass::PrintSelf(os, indent);
103 while (it != this->GetVertexList()->End())
105 os << it.Value() <<
" - ";
112 template <
class TValue,
unsigned int VDimension>
115 if (!m_BoundingRegionIsValid)
117 ComputeBoundingRegion();
119 return m_BoundingRegion;
125 template <
class TValue,
unsigned int VDimension>
142 if (this->GetVertexList()->Size() > 0)
144 x =
static_cast<double>(it.Value()[0]);
145 y =
static_cast<double>(it.Value()[1]);
152 while (it != this->GetVertexList()->End())
154 x =
static_cast<double>(it.Value()[0]);
155 y =
static_cast<double>(it.Value()[1]);
179 size[0] = maxId[0] - index[0];
180 size[1] = maxId[1] - index[1];
182 m_BoundingRegion.SetSize(size);
183 m_BoundingRegion.SetOrigin(index);
184 m_BoundingRegionIsValid =
true;
187 template <
class TValue,
unsigned int VDimension>
190 m_LengthIsValid =
false;
191 m_BoundingRegionIsValid =
false;