From 5785e3d616ac9e5305e360953c4352a406ebf1e7 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@orfeo-toolbox.org>
Date: Wed, 25 Jan 2012 13:36:01 +0100
Subject: [PATCH] BUG: Fixing bug 497: Wrong order in VectorData creation (node
 folder before node document) resulting in VectorData that can not be written
 in KML

---
 Code/BasicFilters/otbConcatenateVectorDataFilter.txx | 4 ++--
 Code/Common/otbPersistentImageToVectorDataFilter.txx | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Code/BasicFilters/otbConcatenateVectorDataFilter.txx b/Code/BasicFilters/otbConcatenateVectorDataFilter.txx
index efe82d04e6..7511fbf10a 100644
--- a/Code/BasicFilters/otbConcatenateVectorDataFilter.txx
+++ b/Code/BasicFilters/otbConcatenateVectorDataFilter.txx
@@ -85,8 +85,8 @@ ConcatenateVectorDataFilter<TVectorData>
   typename DataNodeType::Pointer outputRoot = this->GetOutput()->GetDataTree()->GetRoot()->Get();
   
   // Adding the layer to the data tree
-  this->GetOutput()->GetDataTree()->Add(m_Folder, outputRoot);
-  this->GetOutput()->GetDataTree()->Add(m_Document , m_Folder);
+  this->GetOutput()->GetDataTree()->Add(m_Document, outputRoot);
+  this->GetOutput()->GetDataTree()->Add(m_Folder, m_Document);
   
   // Retrieve all the inputs
   for(unsigned int idx = 0; idx < this->GetNumberOfInputs(); ++idx)
diff --git a/Code/Common/otbPersistentImageToVectorDataFilter.txx b/Code/Common/otbPersistentImageToVectorDataFilter.txx
index 2316d3aed8..4c5b257c1e 100644
--- a/Code/Common/otbPersistentImageToVectorDataFilter.txx
+++ b/Code/Common/otbPersistentImageToVectorDataFilter.txx
@@ -69,8 +69,8 @@ PersistentImageToVectorDataFilter<TImage, TOutputVectorData>
   DataNodePointerType document = DataNodeType::New();
   document->SetNodeType(otb::DOCUMENT);
 
-  this->GetOutputVectorData()->GetDataTree()->Add(folder, this->GetOutputVectorData()->GetDataTree()->GetRoot()->Get());
-  this->GetOutputVectorData()->GetDataTree()->Add(document , folder);
+  this->GetOutputVectorData()->GetDataTree()->Add(document, this->GetOutputVectorData()->GetDataTree()->GetRoot()->Get());
+  this->GetOutputVectorData()->GetDataTree()->Add(folder , document);
 }
 
 template<class TImage, class TOutputVectorData>
-- 
GitLab