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

ENH: VectorDataExtractROI Test parameters

parent d36f2a8d
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,10 @@ VectorDataExtractROI<TVectorData> ...@@ -64,7 +64,10 @@ VectorDataExtractROI<TVectorData>
typename VectorDataType::Pointer output = this->GetOutput(); typename VectorDataType::Pointer output = this->GetOutput();
/** put this here*/ /** put this here*/
output->SetProjectionRef(input->GetProjectionRef()); if(!input->GetProjectionRef().empty())
output->SetProjectionRef(input->GetProjectionRef());
else
if(!input) if(!input)
return; return;
...@@ -93,7 +96,9 @@ VectorDataExtractROI<TVectorData> ...@@ -93,7 +96,9 @@ VectorDataExtractROI<TVectorData>
DataNodePointerType newDataNodeFolder = DataNodeType::New(); DataNodePointerType newDataNodeFolder = DataNodeType::New();
DataNodePointerType newDataNodeMultiPolygon = DataNodeType::New(); DataNodePointerType newDataNodeMultiPolygon = DataNodeType::New();
DataNodePointerType newDataNodeMultiLine = DataNodeType::New(); DataNodePointerType newDataNodeMultiLine = DataNodeType::New();
DataNodePointerType newDataNodeMultiFeature = DataNodeType::New();
/** Walking trough the input vector data */ /** Walking trough the input vector data */
typedef itk::PreOrderTreeIterator<DataTreeType> TreeIteratorType; typedef itk::PreOrderTreeIterator<DataTreeType> TreeIteratorType;
TreeIteratorType it(input->GetDataTree()); TreeIteratorType it(input->GetDataTree());
...@@ -144,6 +149,12 @@ VectorDataExtractROI<TVectorData> ...@@ -144,6 +149,12 @@ VectorDataExtractROI<TVectorData>
currentContainer = newDataNodeFolder; currentContainer = newDataNodeFolder;
newFolder = false; newFolder = false;
} }
if(newMultiFeature)
{
tree->Add(newDataNodeMultiFeature,currentContainer);
currentContainer = newDataNodeMultiFeature;
newMultiFeature = false;
}
newDataNode->SetNodeType(dataNode->GetNodeType()); newDataNode->SetNodeType(dataNode->GetNodeType());
newDataNode->SetNodeId(dataNode->GetNodeId()); newDataNode->SetNodeId(dataNode->GetNodeId());
newDataNode->SetPoint(dataNode->GetPoint()); newDataNode->SetPoint(dataNode->GetPoint());
...@@ -164,8 +175,8 @@ VectorDataExtractROI<TVectorData> ...@@ -164,8 +175,8 @@ VectorDataExtractROI<TVectorData>
} }
if(newMultiFeature) if(newMultiFeature)
{ {
tree->Add(newDataNodeMultiLine,currentContainer); tree->Add(newDataNodeMultiFeature ,currentContainer);
currentContainer = newDataNodeMultiLine; currentContainer = newDataNodeMultiFeature ;
newMultiFeature = false; newMultiFeature = false;
} }
newDataNode->SetNodeType(dataNode->GetNodeType()); newDataNode->SetNodeType(dataNode->GetNodeType());
...@@ -185,10 +196,11 @@ VectorDataExtractROI<TVectorData> ...@@ -185,10 +196,11 @@ VectorDataExtractROI<TVectorData>
currentContainer = newDataNodeFolder; currentContainer = newDataNodeFolder;
newFolder = false; newFolder = false;
} }
if(newMultiFeature) if(newMultiFeature)
{ {
tree->Add(newDataNodeMultiPolygon,currentContainer); tree->Add(newDataNodeMultiFeature,currentContainer);
currentContainer = newDataNodeMultiPolygon; currentContainer = newDataNodeMultiFeature ;
newMultiFeature = false; newMultiFeature = false;
} }
...@@ -202,23 +214,24 @@ VectorDataExtractROI<TVectorData> ...@@ -202,23 +214,24 @@ VectorDataExtractROI<TVectorData>
} }
case FEATURE_MULTIPOINT: case FEATURE_MULTIPOINT:
{ {
newDataNode->SetNodeType(dataNode->GetNodeType()); newDataNodeMultiFeature->SetNodeType(dataNode->GetNodeType());
newDataNode->SetNodeId(dataNode->GetNodeId()); newDataNodeMultiFeature ->SetNodeId(dataNode->GetNodeId());
tree->Add(newDataNode,currentContainer); newMultiFeature = true;
currentContainer = newDataNode;
break; break;
} }
case FEATURE_MULTILINE: case FEATURE_MULTILINE:
{ {
newDataNodeMultiLine->SetNodeType(dataNode->GetNodeType()); newDataNodeMultiFeature ->SetNodeType(dataNode->GetNodeType());
newDataNodeMultiLine->SetNodeId(dataNode->GetNodeId()); newDataNodeMultiFeature ->SetNodeId(dataNode->GetNodeId());
newMultiFeature = true; newMultiFeature = true;
break; break;
} }
case FEATURE_MULTIPOLYGON: case FEATURE_MULTIPOLYGON:
{ {
newDataNodeMultiPolygon->SetNodeType(dataNode->GetNodeType()); newDataNodeMultiFeature ->SetNodeType(dataNode->GetNodeType());
newDataNodeMultiPolygon->SetNodeId(dataNode->GetNodeId()); newDataNodeMultiFeature->SetNodeId(dataNode->GetNodeId());
newMultiFeature = true; newMultiFeature = true;
break; break;
} }
...@@ -316,6 +329,7 @@ VectorDataExtractROI<TVectorData> ...@@ -316,6 +329,7 @@ VectorDataExtractROI<TVectorData>
/** INVERSE : From long/lat to InputVectorData projection*/ /** INVERSE : From long/lat to InputVectorData projection*/
typedef otb::GenericMapProjection<otb::FORWARD> InverseMapProjectionType; typedef otb::GenericMapProjection<otb::FORWARD> InverseMapProjectionType;
InverseMapProjectionType::Pointer mapInverseTransform = InverseMapProjectionType::New(); InverseMapProjectionType::Pointer mapInverseTransform = InverseMapProjectionType::New();
if(this->GetInput()->GetProjectionRef().empty()) if(this->GetInput()->GetProjectionRef().empty())
{ {
std::string inputProjectionRef = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]"; std::string inputProjectionRef = "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.017453292519943295]]";
......
...@@ -138,7 +138,8 @@ ADD_TEST(coTvVectorDataExtractROI ${COMMON_TESTS2} ...@@ -138,7 +138,8 @@ ADD_TEST(coTvVectorDataExtractROI ${COMMON_TESTS2}
otbVectorDataExtractROI otbVectorDataExtractROI
${INPUTDATA}/ToulousePoints-examples.shp #${LARGEDATA}/TOULOUSE/QuickBird/GIS_FILES/000000128955_01_ORDER_SHAPE.shp ${INPUTDATA}/ToulousePoints-examples.shp #${LARGEDATA}/TOULOUSE/QuickBird/GIS_FILES/000000128955_01_ORDER_SHAPE.shp
${TEMP}/coVectorDataExtractROIOutput.shp ${TEMP}/coVectorDataExtractROIOutput.shp
1.588 48.2544 1.2222 1.33001 374369.48850211215904 4828951.58612491376698 # Origin of the CartoRegion
1000.25 25000.2 # Size of the Cartoregion
) )
# ------- otb::MultiChannelExtractROI ------------------------------ # ------- otb::MultiChannelExtractROI ------------------------------
......
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