Skip to content
Snippets Groups Projects
Commit 7e3d6950 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

BUG: boundingRegion for polyline should be double precision

parent 7db7f879
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ PURPOSE. See the above copyright notices for more information.
#include "itkPolyLineParametricPath.h"
#include "itkMetaDataObject.h"
#include "itkImageRegion.h"
#include "otbRemoteSensingRegion.h"
#include "otbMacro.h"
namespace otb
......@@ -58,7 +59,8 @@ template < class TValue,unsigned int VDimension=2>
typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
typedef typename VertexListType::ConstIterator VertexListConstIteratorType;
typedef itk::ImageRegion<2> RegionType;
// typedef itk::ImageRegion<2> RegionType;
typedef otb::RemoteSensingRegion<double> RegionType;
typedef typename RegionType::SizeType SizeType;
typedef typename RegionType::IndexType IndexType;
......
......@@ -144,20 +144,21 @@ PolyLineParametricPathWithValue<TValue,VDimension>
VertexListConstIteratorType it = this->GetVertexList()->Begin();
long int x,y;
double x = 0.0;
double y = 0.0;
if (this->GetVertexList()->Size()>0)
{
x = static_cast<long int>(it.Value()[0]);
y = static_cast<long int>(it.Value()[1]);
x = static_cast<double>(it.Value()[0]);
y = static_cast<double>(it.Value()[1]);
index[0] = x;
index[1] = y;
++it;
while (it != this->GetVertexList()->End())
{
x = static_cast<long int>(it.Value()[0]);
y = static_cast<long int>(it.Value()[1]);
x = static_cast<double>(it.Value()[0]);
y = static_cast<double>(it.Value()[1]);
// Index search
if ( x < index[0] )
......@@ -185,7 +186,7 @@ PolyLineParametricPathWithValue<TValue,VDimension>
size[1] = maxId[1] - index[1];
}
m_BoundingRegion.SetSize(size);
m_BoundingRegion.SetIndex(index);
m_BoundingRegion.SetOrigin(index);
m_BoundingRegionIsValid = true;
}
......
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