Skip to content
Snippets Groups Projects
Commit 283713db authored by Karsten Rink's avatar Karsten Rink
Browse files

added to namespace and renamed class

parent 29d22120
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@
#include <QListWidgetItem>
/// Constructor
MeshElementRemovalDialog::MeshElementRemovalDialog(const DataExplorerProject &project, QDialog* parent)
MeshElementRemovalDialog::MeshElementRemovalDialog(DataHolderLib::Project const& project, QDialog* parent)
: QDialog(parent), _project(project), _currentIndex(0), _aabbIndex(std::numeric_limits<unsigned>::max()), _matIDIndex(std::numeric_limits<unsigned>::max())
{
setupUi(this);
......
......@@ -19,7 +19,7 @@
#include <QDialog>
#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
#include "DataHolderLib/DataExplorerProject.h"
#include "DataHolderLib/Project.h"
#endif
class Node;
......@@ -32,7 +32,7 @@ class MeshElementRemovalDialog : public QDialog, private Ui_MeshElementRemoval
Q_OBJECT
public:
MeshElementRemovalDialog(const DataExplorerProject &project, QDialog* parent = 0);
MeshElementRemovalDialog(DataHolderLib::Project const& project, QDialog* parent = 0);
~MeshElementRemovalDialog(void);
private slots:
......@@ -50,7 +50,7 @@ private slots:
void reject();
private:
const DataExplorerProject& _project;
DataHolderLib::Project const& _project;
unsigned _currentIndex, _aabbIndex, _matIDIndex;
std::array<bool, 6> aabb_edits;
......
......@@ -34,7 +34,7 @@
const QVariant MshModel::element_str = "Element";
const std::map<MeshLib::MeshElemType, QVariant> MshModel::elem_type_map = MshModel::createMeshElemTypeMap();
MshModel::MshModel(DataExplorerProject &project, QObject* parent /*= 0*/ )
MshModel::MshModel(DataHolderLib::Project &project, QObject* parent /*= 0*/ )
: TreeModel(parent), _project(project)
{
delete _rootItem;
......
......@@ -17,7 +17,7 @@
// ** INCLUDES **
#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
#include "DataHolderLib/DataExplorerProject.h"
#include "DataHolderLib/Project.h"
#endif
#include "MeshLib/MeshEnums.h"
......@@ -38,7 +38,7 @@ class MshModel : public TreeModel
Q_OBJECT
public:
MshModel(DataExplorerProject &project, QObject* parent = 0);
MshModel(DataHolderLib::Project &project, QObject* parent = 0);
/// Returns the number of columns used for the data list
int columnCount(const QModelIndex& parent = QModelIndex()) const;
......@@ -69,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);
DataExplorerProject& _project;
DataHolderLib::Project& _project;
/// Creates a static map of all element type name-strings in QVariant format
static std::map<MeshLib::MeshElemType, QVariant> createMeshElemTypeMap();
......
......@@ -18,7 +18,7 @@
#include <memory>
#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
#include "DataHolderLib/DataExplorerProject.h"
#include "DataHolderLib/Project.h"
#endif
#include "ImportFileTypes.h"
......@@ -127,7 +127,7 @@ private:
void writeSettings();
QString getLastUsedDir();
DataExplorerProject _project;
DataHolderLib::Project _project;
std::unique_ptr<MshModel> _meshModel;
std::unique_ptr<ElementTreeModel> _elementModel;
std::unique_ptr<TreeModel> _processModel;
......
......@@ -7,7 +7,7 @@
*
*/
#include "DataExplorerProject.h"
#include "Project.h"
#include <algorithm>
......@@ -19,27 +19,30 @@
#include "MeshLib/Mesh.h"
DataExplorerProject::~DataExplorerProject()
namespace DataHolderLib
{
Project::~Project()
{
for (MeshLib::Mesh* m : _mesh_vec)
delete m;
}
void DataExplorerProject::addMesh(MeshLib::Mesh* mesh)
void Project::addMesh(MeshLib::Mesh* mesh)
{
std::string name = mesh->getName();
isMeshNameUniqueAndProvideUniqueName(name);
getUniqueName(name);
mesh->setName(name);
_mesh_vec.push_back(mesh);
}
std::vector<MeshLib::Mesh*>::const_iterator DataExplorerProject::findMeshByName(
std::vector<MeshLib::Mesh*>::const_iterator Project::findMeshByName(
std::string const& name) const
{
return const_cast<DataExplorerProject&>(*this).findMeshByName(name);
return const_cast<Project&>(*this).findMeshByName(name);
}
std::vector<MeshLib::Mesh*>::iterator DataExplorerProject::findMeshByName(
std::vector<MeshLib::Mesh*>::iterator Project::findMeshByName(
std::string const& name)
{
return std::find_if(_mesh_vec.begin(), _mesh_vec.end(),
......@@ -49,13 +52,13 @@ std::vector<MeshLib::Mesh*>::iterator DataExplorerProject::findMeshByName(
});
}
const MeshLib::Mesh* DataExplorerProject::getMesh(const std::string &name) const
const MeshLib::Mesh* Project::getMesh(const std::string &name) const
{
std::vector<MeshLib::Mesh*>::const_iterator it = findMeshByName(name);
return (it == _mesh_vec.end() ? nullptr : *it);
}
bool DataExplorerProject::removeMesh(const std::string &name)
bool Project::removeMesh(const std::string &name)
{
bool mesh_found = false;
std::vector<MeshLib::Mesh*>::iterator it = findMeshByName(name);
......@@ -72,12 +75,12 @@ bool DataExplorerProject::removeMesh(const std::string &name)
return mesh_found;
}
bool DataExplorerProject::meshExists(const std::string &name) const
bool Project::meshExists(const std::string &name) const
{
return findMeshByName(name) != _mesh_vec.end();
}
bool DataExplorerProject::isMeshNameUniqueAndProvideUniqueName(std::string &name) const
bool Project::getUniqueName(std::string &name) const
{
int count(0);
bool isUnique(false);
......@@ -109,3 +112,5 @@ bool DataExplorerProject::isMeshNameUniqueAndProvideUniqueName(std::string &name
}
return isUnique;
}
} //namespace
......@@ -18,20 +18,23 @@ namespace MeshLib {
class Mesh;
}
namespace DataHolderLib
{
/**
* The ProjectData Object contains all the data needed for a certain project, i.e. all
* geometric data (stored in a GEOObjects-object), all the meshes, processes,
* and process variables.
*/
class DataExplorerProject final
class Project final
{
public:
/// Constructor
DataExplorerProject() = default;
Project() = default;
DataExplorerProject(DataExplorerProject&) = delete;
Project(Project&) = delete;
~DataExplorerProject();
~Project();
/// Returns the GEOObjects containing all points, polylines and surfaces.
GeoLib::GEOObjects& getGEOObjects() { return _geoObjects; }
......@@ -43,13 +46,13 @@ public:
/// Returns the mesh with the given name or a \c nullptr if the mesh was not
/// found.
const MeshLib::Mesh* getMesh(const std::string &name) const;
/// Returns all the meshes with their respective names
const std::vector<MeshLib::Mesh*>& getMeshObjects() const
{
return _mesh_vec;
}
/// Deletes all meshes with the given name and removes them from the list of
/// saved meshes. If any mesh was found for removal, true is returned and
/// false otherwise.
......@@ -59,7 +62,7 @@ private:
/// Checks if a mesh with the same name exists and provides a unique name in
/// case of already existing mesh. Returns true if the mesh name is unique.
/// Returns false and changes the provided name to a unique name otherwise.
bool isMeshNameUniqueAndProvideUniqueName(std::string &name) const;
bool getUniqueName(std::string &name) const;
/// Returns true if a mesh with the same name exists and false otherwise.
bool meshExists(const std::string &name) const;
......@@ -73,4 +76,6 @@ private:
std::vector<MeshLib::Mesh*> _mesh_vec;
};
} // namespace
#endif //DATAEXPLORERPROJECT_H_
......@@ -39,7 +39,7 @@
namespace FileIO
{
XmlGspInterface::XmlGspInterface(DataExplorerProject& project)
XmlGspInterface::XmlGspInterface(DataHolderLib::Project& project)
: XMLInterface(), XMLQtInterface(BaseLib::FileFinder().getPath("OpenGeoSysProject.xsd")),
_project(project)
{
......
......@@ -23,7 +23,7 @@
#include "../XMLInterface.h"
#include "XMLQtInterface.h"
#include "DataHolderLib/DataExplorerProject.h"
#include "DataHolderLib/Project.h"
namespace FileIO
{
......@@ -34,7 +34,7 @@ namespace FileIO
class XmlGspInterface : public XMLInterface, public XMLQtInterface
{
public:
XmlGspInterface(DataExplorerProject& project);
XmlGspInterface(DataHolderLib::Project &project);
virtual ~XmlGspInterface() {}
......@@ -51,7 +51,7 @@ protected:
private:
std::string _filename;
DataExplorerProject& _project;
DataHolderLib::Project& _project;
};
}
......
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