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

ENH: Speed up VectorDataProjection

parent d882af69
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,9 @@ public:
typedef typename OutputVectorDataType::DataNodePointerType OutputDataNodePointerType;
typedef typename OutputVectorDataType::DataTreePointerType OutputDataTreePointerType;
typedef typename OutputVectorDataType::DataTreeType::TreeNodeType InternalTreeNodeType;
typedef typename OutputDataNodeType::PointType PointType;
typedef typename OutputDataNodeType::LineType LineType;
......
......@@ -385,7 +385,8 @@ VectorDataProjectionFilter<TInputVectorData,TOutputVectorData>
InputTreeIteratorType it(inputPtr->GetDataTree());
OutputDataTreePointerType tree = outputPtr->GetDataTree();
OutputDataNodePointerType currentContainer;
typename InternalTreeNodeType::Pointer currentContainer;
typename InternalTreeNodeType::Pointer newContainer;
while (!it.IsAtEnd())//FIXME this VectorData tree processing would better be in a generic class
{
......@@ -397,63 +398,83 @@ VectorDataProjectionFilter<TInputVectorData,TOutputVectorData>
{
case ROOT:
{
tree->SetRoot(newDataNode);
currentContainer = newDataNode;
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
tree->SetRoot(newContainer);
currentContainer = newContainer;
break;
}
case DOCUMENT:
{
tree->Add(newDataNode,currentContainer);
currentContainer = newDataNode;
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
currentContainer = newContainer;
break;
}
case FOLDER:
{
tree->Add(newDataNode,currentContainer);
currentContainer = newDataNode;
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
currentContainer = newContainer;
break;
}
case FEATURE_POINT:
{
newDataNode->SetPoint(this->ReprojectPoint(dataNode->GetPoint()));
tree->Add(newDataNode,currentContainer);
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
break;
}
case FEATURE_LINE:
{
newDataNode->SetLine(this->ReprojectLine(dataNode->GetLine()));
tree->Add(newDataNode,currentContainer);
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
break;
}
case FEATURE_POLYGON:
{
newDataNode->SetPolygonExteriorRing(this->ReprojectPolygon(dataNode->GetPolygonExteriorRing()));
newDataNode->SetPolygonInteriorRings(this->ReprojectPolygonList(dataNode->GetPolygonInteriorRings()));
tree->Add(newDataNode,currentContainer);
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
break;
}
case FEATURE_MULTIPOINT:
{
tree->Add(newDataNode,currentContainer);
currentContainer = newDataNode;
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
currentContainer = newContainer;
break;
}
case FEATURE_MULTILINE:
{
tree->Add(newDataNode,currentContainer);
currentContainer = newDataNode;
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
currentContainer = newContainer;
break;
}
case FEATURE_MULTIPOLYGON:
{
tree->Add(newDataNode,currentContainer);
currentContainer = newDataNode;
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
currentContainer = newContainer;
break;
}
case FEATURE_COLLECTION:
{
tree->Add(newDataNode,currentContainer);
currentContainer = newDataNode;
newContainer = InternalTreeNodeType::New();
newContainer->Set(newDataNode);
currentContainer->AddChild(newContainer);
currentContainer = newContainer;
break;
}
}
......
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