From 24806f339eb00bf3cd178829e19ba74264c3c125 Mon Sep 17 00:00:00 2001
From: Thibaut ROMAIN <thibaut.romain@cs-soprasteria.com>
Date: Fri, 30 Aug 2024 10:10:02 +0200
Subject: [PATCH] Fix remaining vectordata Tests and fix CI warnings

---
 .gitlab-ci.yml                                               | 2 +-
 CI/headers_check.py                                          | 1 +
 CI/{ubuntu-20.04-fast.cmake => ubuntu-22.04-fast.cmake}      | 0
 CI/{ubuntu-20.04-gcc.cmake => ubuntu-22.04-gcc.cmake}        | 0
 .../OTB-Applications/Files/utTvConcatenateVectorData.dbf     | 4 ++--
 .../OTB-Applications/Files/utTvConcatenateVectorData.prj     | 1 +
 .../include/otbConcatenateVectorDataFilter.hxx               | 5 +++--
 7 files changed, 8 insertions(+), 5 deletions(-)
 rename CI/{ubuntu-20.04-fast.cmake => ubuntu-22.04-fast.cmake} (100%)
 rename CI/{ubuntu-20.04-gcc.cmake => ubuntu-22.04-gcc.cmake} (100%)
 create mode 100644 Data/Baseline/OTB-Applications/Files/utTvConcatenateVectorData.prj

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c1d80ca378..fbf6977143 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -126,7 +126,7 @@ fast-build:
     - export GIT_LFS_SKIP_SMUDGE=1
     - git checkout -f -q $CI_COMMIT_SHA
   script:
-    - ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-22.04-fast -Dci_skip_testing:BOOL=ON
+    - ctest -V -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-22.04-fast
     - ccache -s
 
 legal-check:
diff --git a/CI/headers_check.py b/CI/headers_check.py
index 3fa8de252d..69677094af 100755
--- a/CI/headers_check.py
+++ b/CI/headers_check.py
@@ -138,6 +138,7 @@ excludedfiles = set([
     './Modules/Visualization/Ice/README',
     './Modules/Core/Wrappers/SWIG/src/numpy.i',
     './Modules/Core/Wrappers/SWIG/src/python/__init__.py',
+    './Modules/Core/Common/include/otbCastImageFilter.h'
     './Packaging/Files/OTB Project.zip',
     './Packaging/Files/template.app/Contents/Info.plist',
     './Packaging/LICENSE',
diff --git a/CI/ubuntu-20.04-fast.cmake b/CI/ubuntu-22.04-fast.cmake
similarity index 100%
rename from CI/ubuntu-20.04-fast.cmake
rename to CI/ubuntu-22.04-fast.cmake
diff --git a/CI/ubuntu-20.04-gcc.cmake b/CI/ubuntu-22.04-gcc.cmake
similarity index 100%
rename from CI/ubuntu-20.04-gcc.cmake
rename to CI/ubuntu-22.04-gcc.cmake
diff --git a/Data/Baseline/OTB-Applications/Files/utTvConcatenateVectorData.dbf b/Data/Baseline/OTB-Applications/Files/utTvConcatenateVectorData.dbf
index fb9bc594ea..2c8e54fe13 100644
--- a/Data/Baseline/OTB-Applications/Files/utTvConcatenateVectorData.dbf
+++ b/Data/Baseline/OTB-Applications/Files/utTvConcatenateVectorData.dbf
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:ccddb00be6356a07895f6f6fef3b958196226b4a470b62dacd8bee3dd2112213
-size 136403
+oid sha256:b0494b65fd35a998a565d88a9dd0287cb1bde66ac3447e272e45894321835571
+size 136404
diff --git a/Data/Baseline/OTB-Applications/Files/utTvConcatenateVectorData.prj b/Data/Baseline/OTB-Applications/Files/utTvConcatenateVectorData.prj
new file mode 100644
index 0000000000..f45cbadf00
--- /dev/null
+++ b/Data/Baseline/OTB-Applications/Files/utTvConcatenateVectorData.prj
@@ -0,0 +1 @@
+GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
\ No newline at end of file
diff --git a/Modules/Core/VectorDataManipulation/include/otbConcatenateVectorDataFilter.hxx b/Modules/Core/VectorDataManipulation/include/otbConcatenateVectorDataFilter.hxx
index 86b73f0b6e..e5c57a8839 100644
--- a/Modules/Core/VectorDataManipulation/include/otbConcatenateVectorDataFilter.hxx
+++ b/Modules/Core/VectorDataManipulation/include/otbConcatenateVectorDataFilter.hxx
@@ -86,8 +86,9 @@ void ConcatenateVectorDataFilter<TVectorData>::GenerateData()
   auto outputPtr = this->GetOutput();
   auto inputPtr = this->GetInput(0);
 
-  typename DataNodeType::Pointer outputDocument = inputPtr->GetChildrenList(inputPtr->GetRoot()).at(0);
-  outputPtr->Add(outputDocument,outputPtr->GetRoot());
+  outputPtr->Graft(inputPtr);
+  typename DataNodeType::Pointer outputDocument = outputPtr->GetChildrenList(outputPtr->GetRoot()).at(0);
+  //outputPtr->Add(outputDocument,outputPtr->GetRoot());
   // Adding the layer to the data tree
   //   this->GetOutput()->Add(m_Document, outputRoot);
   //   this->GetOutput()->Add(m_Folder, m_Document);
-- 
GitLab