From 25c2af04b1270bb6bc366df5ac60f38b180c0e93 Mon Sep 17 00:00:00 2001
From: rinkk <karsten.rink@ufz.de>
Date: Mon, 25 Apr 2016 14:55:44 +0200
Subject: [PATCH] replaced ProjectData with new container object
 DataExplorerProject

---
 Applications/DataExplorer/DataExplorer.cmake       |  1 +
 .../DataView/MeshElementRemovalDialog.cpp          |  2 +-
 .../DataView/MeshElementRemovalDialog.h            |  6 +++---
 Applications/DataExplorer/DataView/MshModel.cpp    |  3 +--
 Applications/DataExplorer/DataView/MshModel.h      |  8 +++++---
 Applications/DataExplorer/main.cpp                 |  2 ++
 Applications/DataExplorer/mainwindow.cpp           | 14 ++------------
 Applications/DataExplorer/mainwindow.h             |  4 ++--
 CMakeLists.txt                                     |  1 +
 9 files changed, 18 insertions(+), 23 deletions(-)

diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake
index d6fd25590c0..5bfac32991b 100644
--- a/Applications/DataExplorer/DataExplorer.cmake
+++ b/Applications/DataExplorer/DataExplorer.cmake
@@ -53,6 +53,7 @@ target_link_libraries(DataExplorer
 	Qt4::QtXml
 	Qt4::QtNetwork
 	ApplicationsLib
+	DataHolderLib
 	FileIO
 	QtDataView
 	QtDiagramView
diff --git a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp
index 688b5088226..355031118db 100644
--- a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp
+++ b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp
@@ -26,7 +26,7 @@
 #include <QListWidgetItem>
 
 /// Constructor
-MeshElementRemovalDialog::MeshElementRemovalDialog(const ProjectData &project, QDialog* parent)
+MeshElementRemovalDialog::MeshElementRemovalDialog(const DataExplorerProject &project, QDialog* parent)
 	: QDialog(parent), _project(project), _currentIndex(0), _aabbIndex(std::numeric_limits<unsigned>::max()), _matIDIndex(std::numeric_limits<unsigned>::max())
 {
 	setupUi(this);
diff --git a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.h b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.h
index 6589ddef53e..1a84dc9b770 100644
--- a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.h
+++ b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.h
@@ -19,7 +19,7 @@
 #include <QDialog>
 
 #ifndef Q_MOC_RUN  // See: https://bugreports.qt-project.org/browse/QTBUG-22829
-#include "Applications/ApplicationsLib/ProjectData.h"
+#include "DataHolderLib/DataExplorerProject.h"
 #endif
 
 class Node;
@@ -32,7 +32,7 @@ class MeshElementRemovalDialog : public QDialog, private Ui_MeshElementRemoval
 	Q_OBJECT
 
 public:
-	MeshElementRemovalDialog(const ProjectData &project, QDialog* parent = 0);
+	MeshElementRemovalDialog(const DataExplorerProject &project, QDialog* parent = 0);
 	~MeshElementRemovalDialog(void);
 
 private slots:
@@ -50,7 +50,7 @@ private slots:
 	void reject();
 
 private:
-	const ProjectData& _project;
+	const DataExplorerProject& _project;
 	unsigned _currentIndex, _aabbIndex, _matIDIndex;
 	std::array<bool, 6> aabb_edits;
 
diff --git a/Applications/DataExplorer/DataView/MshModel.cpp b/Applications/DataExplorer/DataView/MshModel.cpp
index 41f3cb371fb..e9d94faf872 100644
--- a/Applications/DataExplorer/DataView/MshModel.cpp
+++ b/Applications/DataExplorer/DataView/MshModel.cpp
@@ -30,12 +30,11 @@
 // MeshLib
 #include "MeshLib/Node.h"
 #include "Elements/Element.h"
-#include "MeshEnums.h"
 
 const QVariant MshModel::element_str = "Element";
 const std::map<MeshLib::MeshElemType, QVariant> MshModel::elem_type_map = MshModel::createMeshElemTypeMap();
 
-MshModel::MshModel(ProjectData &project, QObject* parent /*= 0*/ )
+MshModel::MshModel(DataExplorerProject &project, QObject* parent /*= 0*/ )
 	: TreeModel(parent), _project(project)
 {
 	delete _rootItem;
diff --git a/Applications/DataExplorer/DataView/MshModel.h b/Applications/DataExplorer/DataView/MshModel.h
index fd2fd4a4d98..848fd83545d 100644
--- a/Applications/DataExplorer/DataView/MshModel.h
+++ b/Applications/DataExplorer/DataView/MshModel.h
@@ -17,9 +17,11 @@
 
 // ** INCLUDES **
 #ifndef Q_MOC_RUN  // See: https://bugreports.qt-project.org/browse/QTBUG-22829
-#include "Applications/ApplicationsLib/ProjectData.h"
+#include "DataHolderLib/DataExplorerProject.h"
 #endif
 
+#include "MeshLib/MeshEnums.h"
+
 #include "TreeModel.h"
 
 namespace MeshLib {
@@ -36,7 +38,7 @@ class MshModel : public TreeModel
 	Q_OBJECT
 
 public:
-	MshModel(ProjectData &project, QObject* parent = 0);
+	MshModel(DataExplorerProject &project, QObject* parent = 0);
 
 	/// Returns the number of columns used for the data list
 	int columnCount(const QModelIndex& parent = QModelIndex()) const;
@@ -67,7 +69,7 @@ private:
 
 	/// Checks if the name of the mesh is already exists, if so it generates a unique name.
 	//bool isUniqueMeshName(std::string &name);
-	ProjectData& _project;
+	DataExplorerProject& _project;
 
 	/// Creates a static map of all element type name-strings in QVariant format
 	static std::map<MeshLib::MeshElemType, QVariant> createMeshElemTypeMap();
diff --git a/Applications/DataExplorer/main.cpp b/Applications/DataExplorer/main.cpp
index 46e186f1eb8..089c4279f97 100644
--- a/Applications/DataExplorer/main.cpp
+++ b/Applications/DataExplorer/main.cpp
@@ -14,6 +14,8 @@ FbxManager* lSdkManager = NULL;
 FbxScene* lScene = NULL;
 #endif
 
+#include <vtkSmartPointer.h>
+
 #include "BaseLib/BuildInfo.h"
 #include "VtkVis/VtkConsoleOutputWindow.h"
 
diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp
index 7adef2343e9..86cadd3a068 100644
--- a/Applications/DataExplorer/mainwindow.cpp
+++ b/Applications/DataExplorer/mainwindow.cpp
@@ -420,12 +420,7 @@ void MainWindow::save()
 
 	if (fi.suffix().toLower() == "gsp")
 	{
-		XmlGspInterface xml(*_project.getGEOObjects(),
-		                    _project.getMeshObjects(),
-		                    [this](MeshLib::Mesh* const mesh)
-		                    {
-			                    _project.addMesh(mesh);
-		                    });
+		XmlGspInterface xml(_project);
 		xml.writeToFile(fileName.toStdString());
 	}
 	else if (fi.suffix().toLower() == "geo")
@@ -472,12 +467,7 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName)
 		}
 		else if (fi.suffix().toLower() == "gsp")
 		{
-			XmlGspInterface xml(*_project.getGEOObjects(),
-			                    _project.getMeshObjects(),
-			                    [this](MeshLib::Mesh* const mesh)
-			                    {
-				                    _project.addMesh(mesh);
-			                    });
+			XmlGspInterface xml(_project);
 			if (xml.readFile(fileName))
 			{
 				_meshModel->updateModel();
diff --git a/Applications/DataExplorer/mainwindow.h b/Applications/DataExplorer/mainwindow.h
index 3babcd65049..467369d6aba 100644
--- a/Applications/DataExplorer/mainwindow.h
+++ b/Applications/DataExplorer/mainwindow.h
@@ -18,7 +18,7 @@
 #include <memory>
 
 #ifndef Q_MOC_RUN  // See: https://bugreports.qt-project.org/browse/QTBUG-22829
-#include "Applications/ApplicationsLib/ProjectData.h"
+#include "DataHolderLib/DataExplorerProject.h"
 #endif
 
 #include "ImportFileTypes.h"
@@ -127,7 +127,7 @@ private:
 	void writeSettings();
 	QString getLastUsedDir();
 	
-	ProjectData _project;
+	DataExplorerProject _project;
 	std::unique_ptr<MshModel> _meshModel;
 	std::unique_ptr<ElementTreeModel> _elementModel;
 	std::unique_ptr<TreeModel> _processModel;
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 95168f728d4..7fcb8a3eef7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -195,6 +195,7 @@ add_subdirectory( BaseLib )
 if(TARGET Boost)
 	add_dependencies(BaseLib Boost)
 endif()
+add_subdirectory( DataHolderLib )
 add_subdirectory( FileIO )
 add_subdirectory( GeoLib )
 add_subdirectory( InSituLib )
-- 
GitLab