From 1d89b372df9ede14509c701087fcd368bb8e10bc Mon Sep 17 00:00:00 2001 From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org> Date: Mon, 23 Mar 2009 10:35:26 +0800 Subject: [PATCH] ENH: VectorDataExtractROI uses polyline methods for boundingRegions --- Code/Common/otbRemoteSensingRegion.h | 18 +++++++++++++++++- Code/Common/otbVectorDataExtractROI.txx | 6 ++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Code/Common/otbRemoteSensingRegion.h b/Code/Common/otbRemoteSensingRegion.h index 6dbf7b0dec..ac691e26df 100644 --- a/Code/Common/otbRemoteSensingRegion.h +++ b/Code/Common/otbRemoteSensingRegion.h @@ -23,6 +23,7 @@ #include "itkContinuousIndex.h" #include "itkRegion.h" #include "otbImageKeywordlist.h" +#include "itkImageRegion.h" namespace otb { @@ -36,6 +37,9 @@ namespace otb * corner of the image, the size is the lengths of the image in each of * the topological directions.) * + * As the size and origin can be given in various system coordinates, they contain + * double values (through the use of an itk::ContinuousIndex). + * * To be flexible enough, the region also contain information about the projection * in which this information is given. It can be a cartographic projection, but also * a sensor model projection (hence making it useful also with non-orthorectified @@ -45,7 +49,7 @@ namespace otb */ template <class TType> - class ITK_EXPORT RemoteSensingRegion : public itk::Region + class ITK_EXPORT RemoteSensingRegion : public itk::ImageRegion<2> { public: /** Standard class typedefs. */ @@ -89,6 +93,18 @@ public: m_Index.Fill(0.); } + + /** Constructor. RemoteSensingRegion is a lightweight object that is not reference + * counted, so the constructor is public. Default dimension is 2. */ + RemoteSensingRegion(const itk::ImageRegion<2>& region) + { + m_InputProjectionRef = ""; + m_Size[0] = region.GetSize()[0]; + m_Size[1] = region.GetSize()[1]; + m_Index[0] = region.GetIndex()[0]; + m_Index[1] = region.GetIndex()[1]; + } + /** Destructor. RemoteSensingRegion is a lightweight object that is not reference * counted, so the destructor is public. */ virtual ~RemoteSensingRegion(){}; diff --git a/Code/Common/otbVectorDataExtractROI.txx b/Code/Common/otbVectorDataExtractROI.txx index af059b9768..22801bc4ad 100644 --- a/Code/Common/otbVectorDataExtractROI.txx +++ b/Code/Common/otbVectorDataExtractROI.txx @@ -246,7 +246,8 @@ bool VectorDataExtractROI<TVectorData> ::IsPolygonIntersectionNotNull(PolygonPointerType polygon) { - RegionType region = ComputeVertexListBoudingRegion(polygon->GetVertexList()); +// RegionType region = ComputeVertexListBoudingRegion(polygon->GetVertexList()); + RegionType region(polygon->GetBoundingRegion()); return region.Crop(m_GeoROI); } @@ -258,7 +259,8 @@ bool VectorDataExtractROI<TVectorData> ::IsLineIntersectionNotNull(LinePointerType line) { - RegionType region = ComputeVertexListBoudingRegion(line->GetVertexList()); +// RegionType region = ComputeVertexListBoudingRegion(line->GetVertexList()); + RegionType region(line->GetBoundingRegion()); return region.Crop(m_GeoROI); } -- GitLab