From c8975870b83df1f8f15c034328e7471ca63e7f83 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Tue, 14 Aug 2012 14:13:22 +0200 Subject: [PATCH] Fixed include directories and namespaces. E.g. Base => BaseLib --- CMakeLists.txt | 6 + FileIO/XmlIO/XmlStnInterface.h | 4 +- Gui/CMakeLists.txt | 2 +- Gui/DataExplorer.cmake | 58 ++-- Gui/DataView/BaseItem.h | 6 +- Gui/DataView/CMakeLists.txt | 35 +-- Gui/DataView/ColorTableModel.cpp | 6 +- Gui/DataView/ColorTableModel.h | 4 +- Gui/DataView/CondItem.h | 2 +- Gui/DataView/CondObjectListItem.h | 2 +- Gui/DataView/ConditionWriterDialog.cpp | 10 +- Gui/DataView/ConditionWriterDialog.h | 2 +- Gui/DataView/DataView.cpp | 6 +- Gui/DataView/DataView.h | 6 +- Gui/DataView/DatabaseConnection.cpp | 44 +-- Gui/DataView/DatabaseConnection.h | 8 +- Gui/DataView/DiagramView/CMakeLists.txt | 14 +- Gui/DataView/DiagramView/DetailWindow.cpp | 2 +- Gui/DataView/DiagramView/DiagramList.cpp | 10 +- .../DiagramView/DiagramPrefsDialog.cpp | 4 +- Gui/DataView/DiagramView/DiagramPrefsDialog.h | 6 +- Gui/DataView/DirectConditionGenerator.cpp | 2 +- Gui/DataView/ElementTreeModel.cpp | 4 +- Gui/DataView/FEMConditionSetupDialog.cpp | 36 +-- Gui/DataView/FEMConditionSetupDialog.h | 10 +- Gui/DataView/GEOModels.cpp | 90 +++---- Gui/DataView/GEOModels.h | 28 +- Gui/DataView/GMSHPrefsDialog.cpp | 4 +- Gui/DataView/GMSHPrefsDialog.h | 4 +- Gui/DataView/GeoObjectListItem.h | 16 +- Gui/DataView/GeoTreeItem.h | 6 +- Gui/DataView/GeoTreeModel.cpp | 82 +++--- Gui/DataView/GeoTreeModel.h | 24 +- Gui/DataView/GeoTreeView.cpp | 10 +- Gui/DataView/GeoTreeView.h | 6 +- Gui/DataView/LineEditDialog.cpp | 2 +- Gui/DataView/LineEditDialog.h | 4 +- Gui/DataView/LinearEditDialog.cpp | 2 +- Gui/DataView/LinearEditDialog.h | 6 +- Gui/DataView/ListPropertiesDialog.cpp | 10 +- Gui/DataView/ListPropertiesDialog.h | 2 +- Gui/DataView/ModelTreeItem.h | 6 +- Gui/DataView/MshLayerMapper.cpp | 18 +- Gui/DataView/ProcessModel.cpp | 24 +- Gui/DataView/ProcessModel.h | 4 +- Gui/DataView/SelectMeshDialog.cpp | 4 +- Gui/DataView/SelectMeshDialog.h | 10 +- Gui/DataView/SetNameDialog.cpp | 2 +- Gui/DataView/SetNameDialog.h | 10 +- Gui/DataView/StationTreeModel.cpp | 14 +- Gui/DataView/StationTreeModel.h | 8 +- Gui/DataView/StationTreeView.cpp | 16 +- Gui/DataView/StratView/CMakeLists.txt | 10 +- Gui/DataView/StratView/StratBar.cpp | 12 +- Gui/DataView/StratView/StratBar.h | 10 +- Gui/DataView/StratView/StratScene.cpp | 12 +- Gui/DataView/StratView/StratScene.h | 13 +- Gui/DataView/StratView/StratView.cpp | 4 +- Gui/DataView/StratView/StratView.h | 6 +- Gui/DataView/StratView/StratWindow.cpp | 4 +- Gui/DataView/StratView/StratWindow.h | 6 +- Gui/OpenSG/CMakeLists.txt | 2 +- Gui/Vrpn/CMakeLists.txt | 8 +- Gui/VtkAct/CMakeLists.txt | 14 +- Gui/VtkVis/CMakeLists.txt | 26 +- Gui/VtkVis/VisPrefsDialog.h | 4 +- Gui/VtkVis/VtkColorLookupTable.h | 2 +- Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp | 18 +- Gui/VtkVis/VtkCompositeGeoObjectFilter.h | 2 +- Gui/VtkVis/VtkConditionSource.cpp | 42 +-- Gui/VtkVis/VtkConditionSource.h | 4 +- Gui/VtkVis/VtkMeshConverter.cpp | 12 +- Gui/VtkVis/VtkMeshSource.cpp | 8 +- Gui/VtkVis/VtkPointsSource.cpp | 10 +- Gui/VtkVis/VtkPointsSource.h | 4 +- Gui/VtkVis/VtkPolylinesSource.cpp | 10 +- Gui/VtkVis/VtkPolylinesSource.h | 4 +- Gui/VtkVis/VtkStationSource.cpp | 28 +- Gui/VtkVis/VtkStationSource.h | 8 +- Gui/VtkVis/VtkSurfacesSource.cpp | 8 +- Gui/VtkVis/VtkSurfacesSource.h | 4 +- Gui/VtkVis/VtkTextureOnSurfaceFilter.cpp | 6 +- Gui/VtkVis/VtkVisPipeline.cpp | 10 +- Gui/VtkVis/VtkVisPipeline.h | 10 +- Gui/VtkVis/VtkVisTabWidget.cpp | 2 +- Gui/mainwindow.cpp | 88 +++--- Gui/mainwindow.h | 6 +- SimpleTests/MatrixTests/CMakeLists.txt | 2 +- SimpleTests/MeshTests/CMakeLists.txt | 8 +- Utils/FileConverter/CMakeLists.txt | 124 +++++++++ Utils/FileConverter/ConvertGliToVtk.cpp | 94 +++++++ Utils/FileConverter/ConvertSHPToGLI.cpp | 255 ++++++++++++++++++ Utils/FileConverter/ConvertVtkToOsg.cpp | 202 ++++++++++++++ Utils/FileConverter/GMSH2OGS.cpp | 80 ++++++ .../OGSFileConverter/CMakeLists.txt | 89 ++++++ .../OGSFileConverter/ConversionTools.cpp | 136 ++++++++++ .../OGSFileConverter/ConversionTools.h | 28 ++ .../OGSFileConverter/FileList.ui | 154 +++++++++++ .../OGSFileConverter/FileListDialog.cpp | 86 ++++++ .../OGSFileConverter/FileListDialog.h | 50 ++++ .../OGSFileConverter/OGSFileConverter.cpp | 217 +++++++++++++++ .../OGSFileConverter/OGSFileConverter.h | 41 +++ .../OGSFileConverter/OGSFileConverter.ui | 87 ++++++ Utils/FileConverter/OGSFileConverter/main.cpp | 15 ++ .../FileConverter/generateBCFromPolyline.cpp | 108 ++++++++ Utils/FileConverter/generateBCandGLI.cpp | 120 +++++++++ .../generateMatPropsFromMatID.cpp | 58 ++++ scripts/cmake/Find.cmake | 43 +++ scripts/cmake/FindLibGeoTiff.cmake | 43 +++ scripts/cmake/FindLibTiff.cmake | 42 +++ 110 files changed, 2641 insertions(+), 559 deletions(-) create mode 100644 Utils/FileConverter/CMakeLists.txt create mode 100644 Utils/FileConverter/ConvertGliToVtk.cpp create mode 100644 Utils/FileConverter/ConvertSHPToGLI.cpp create mode 100644 Utils/FileConverter/ConvertVtkToOsg.cpp create mode 100644 Utils/FileConverter/GMSH2OGS.cpp create mode 100644 Utils/FileConverter/OGSFileConverter/CMakeLists.txt create mode 100644 Utils/FileConverter/OGSFileConverter/ConversionTools.cpp create mode 100644 Utils/FileConverter/OGSFileConverter/ConversionTools.h create mode 100644 Utils/FileConverter/OGSFileConverter/FileList.ui create mode 100644 Utils/FileConverter/OGSFileConverter/FileListDialog.cpp create mode 100644 Utils/FileConverter/OGSFileConverter/FileListDialog.h create mode 100644 Utils/FileConverter/OGSFileConverter/OGSFileConverter.cpp create mode 100644 Utils/FileConverter/OGSFileConverter/OGSFileConverter.h create mode 100644 Utils/FileConverter/OGSFileConverter/OGSFileConverter.ui create mode 100644 Utils/FileConverter/OGSFileConverter/main.cpp create mode 100644 Utils/FileConverter/generateBCFromPolyline.cpp create mode 100644 Utils/FileConverter/generateBCandGLI.cpp create mode 100644 Utils/FileConverter/generateMatPropsFromMatID.cpp create mode 100644 scripts/cmake/FindLibGeoTiff.cmake create mode 100644 scripts/cmake/FindLibTiff.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bec8309744..4571173b771 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,8 @@ IF (OGS_BUILD_INFO) ADD_DEFINITIONS (-DOGS_BUILD_INFO) ENDIF (OGS_BUILD_INFO) +OPTION(OGS_BUILD_GUI "Should the Data Explorer be built?" OFF) + OPTION(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF) ###################### @@ -60,5 +62,9 @@ ADD_SUBDIRECTORY( SimpleTests/MeshTests ) IF(NOT MSVC AND BLAS_FOUND AND LAPACK_FOUND) ADD_SUBDIRECTORY( SimpleTests/SolverTests ) ENDIF() +IF(OGS_BUILD_GUI) + ADD_DEFINITIONS(-DOGS_USE_QT) + ADD_SUBDIRECTORY(Gui) +ENDIF() CONFIGURE_FILE (BaseLib/BuildInfo.h.in ${PROJECT_BINARY_DIR}/BaseLib/BuildInfo.h) diff --git a/FileIO/XmlIO/XmlStnInterface.h b/FileIO/XmlIO/XmlStnInterface.h index b8d3b47f38c..9c141cecc14 100644 --- a/FileIO/XmlIO/XmlStnInterface.h +++ b/FileIO/XmlIO/XmlStnInterface.h @@ -43,7 +43,7 @@ protected: int write(std::ostream& stream); private: - /// Reads GEOLIB::Station- or StationBorehole-objects from an xml-file + /// Reads GeoLib::Station- or StationBorehole-objects from an xml-file void readStations ( const QDomNode &stationsRoot, std::vector<GeoLib::Point*>* stations, const std::string &station_file_name); /// Writes borehole-specific data to a station-xml-file. @@ -54,7 +54,7 @@ private: /// Reads the stratigraphy of a borehole from an xml-file void readStratigraphy( const QDomNode &stratRoot, GeoLib::StationBorehole* borehole ); - /// Reads GEOLIB::Station- or StationBorehole-objects from an xml-file using the RapidXML parser + /// Reads GeoLib::Station- or StationBorehole-objects from an xml-file using the RapidXML parser void rapidReadStations(const rapidxml::xml_node<>* station_root, std::vector<GeoLib::Point*> *stations, const std::string &file_name); /// Reads the stratigraphy of a borehole from an xml-file using the RapidXML parser diff --git a/Gui/CMakeLists.txt b/Gui/CMakeLists.txt index 88fdb47082f..eaa14c95138 100644 --- a/Gui/CMakeLists.txt +++ b/Gui/CMakeLists.txt @@ -18,4 +18,4 @@ ENDIF (OGS_USE_OPENSG) IF(VRPN_FOUND AND OGS_USE_VRPN) ADD_SUBDIRECTORY( Vrpn ) ENDIF() -ADD_SUBDIRECTORY( Gui ) +INCLUDE( DataExplorer.cmake ) diff --git a/Gui/DataExplorer.cmake b/Gui/DataExplorer.cmake index 5ea553cc89a..4d0a78ad635 100644 --- a/Gui/DataExplorer.cmake +++ b/Gui/DataExplorer.cmake @@ -1,17 +1,17 @@ # Source files SET( SOURCES mainwindow.cpp - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter/OGSFileConverter.cpp - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter/FileListDialog.cpp - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter/ConversionTools.cpp + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter/OGSFileConverter.cpp + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter/FileListDialog.cpp + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter/ConversionTools.cpp ) # Moc Header files SET( MOC_HEADERS mainwindow.h - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter/OGSFileConverter.h - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter/FileListDialog.h - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter/ConversionTools.h + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter/OGSFileConverter.h + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter/FileListDialog.h + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter/ConversionTools.h ) # Header files @@ -22,8 +22,8 @@ SET( HEADERS # UI files SET( UIS mainwindow.ui - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter/OGSFileConverter.ui - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter/FileList.ui + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter/OGSFileConverter.ui + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter/FileList.ui ) @@ -38,27 +38,27 @@ INCLUDE( ${VTK_USE_FILE} ) # Include the headers which are generated by uic and moc # and include additional header INCLUDE_DIRECTORIES( - ${CMAKE_BINARY_DIR}/Qt/Base - ${CMAKE_BINARY_DIR}/Qt/Gui - ${CMAKE_BINARY_DIR}/Qt/DataView - ${CMAKE_BINARY_DIR}/Qt/DataView/StratView - ${CMAKE_BINARY_DIR}/Qt/DataView/DiagramView - ${CMAKE_BINARY_DIR}/Qt/VtkVis - ${CMAKE_BINARY_DIR}/Qt/VtkAct - ${CMAKE_SOURCE_DIR}/Base + ${CMAKE_BINARY_DIR}/Gui/Base + ${CMAKE_BINARY_DIR}/Gui/Gui + ${CMAKE_BINARY_DIR}/Gui/DataView + ${CMAKE_BINARY_DIR}/Gui/DataView/StratView + ${CMAKE_BINARY_DIR}/Gui/DataView/DiagramView + ${CMAKE_BINARY_DIR}/Gui/VtkVis + ${CMAKE_BINARY_DIR}/Gui/VtkAct + ${CMAKE_SOURCE_DIR}/BaseLib ${CMAKE_SOURCE_DIR}/MathLib - ${CMAKE_SOURCE_DIR}/GEO + ${CMAKE_SOURCE_DIR}/GeoLib ${CMAKE_SOURCE_DIR}/FileIO - ${CMAKE_SOURCE_DIR}/MSH - ${CMAKE_SOURCE_DIR}/MSHGEOTOOLS - ${CMAKE_SOURCE_DIR}/FEM - ${CMAKE_SOURCE_DIR}/Qt/Base - ${CMAKE_SOURCE_DIR}/Qt/DataView - ${CMAKE_SOURCE_DIR}/Qt/DataView/StratView - ${CMAKE_SOURCE_DIR}/Qt/DataView/DiagramView - ${CMAKE_SOURCE_DIR}/Qt/VtkVis - ${CMAKE_SOURCE_DIR}/Qt/VtkAct - ${CMAKE_SOURCE_DIR}/UTL/FileConverter/OGSFileConverter + ${CMAKE_SOURCE_DIR}/MeshLib + ${CMAKE_SOURCE_DIR}/MeshLibGEOTOOLS + ${CMAKE_SOURCE_DIR}/FemLib + ${CMAKE_SOURCE_DIR}/Gui/Base + ${CMAKE_SOURCE_DIR}/Gui/DataView + ${CMAKE_SOURCE_DIR}/Gui/DataView/StratView + ${CMAKE_SOURCE_DIR}/Gui/DataView/DiagramView + ${CMAKE_SOURCE_DIR}/Gui/VtkVis + ${CMAKE_SOURCE_DIR}/Gui/VtkAct + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter ) IF (Shapelib_FOUND) @@ -126,12 +126,12 @@ ENDIF() # OGS_BUILD_INFO ### OpenSG support ### IF (OGS_USE_OPENSG) USE_OPENSG(ogs-gui) - INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Qt/OpenSG ) + INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Gui/OpenSG ) TARGET_LINK_LIBRARIES( ogs-gui OgsOpenSG ) ENDIF (OGS_USE_OPENSG) IF(OGS_USE_VRPN) - INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Qt/Vrpn ${CMAKE_BINARY_DIR}/Qt/Vrpn ) + INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Gui/Vrpn ${CMAKE_BINARY_DIR}/Gui/Vrpn ) TARGET_LINK_LIBRARIES( ogs-gui ${VRPN_LIBRARIES} OgsVrpn ) ENDIF() diff --git a/Gui/DataView/BaseItem.h b/Gui/DataView/BaseItem.h index 08c4722eb82..c58992a0667 100644 --- a/Gui/DataView/BaseItem.h +++ b/Gui/DataView/BaseItem.h @@ -21,7 +21,7 @@ class BaseItem { public: - BaseItem(const QString &listName, const std::vector<GEOLIB::Point*>* stations = NULL ) + BaseItem(const QString &listName, const std::vector<GeoLib::Point*>* stations = NULL ) : _stations(stations), _vtkSource(VtkStationSource::New()) { // create the vtk-object for 3d-visualisation of this list @@ -40,14 +40,14 @@ public: /// Sets the model index void setModelIndex( QModelIndex index ) { _modelIndex = index; } - const std::vector<GEOLIB::Point*>* getStations() { return _stations; } + const std::vector<GeoLib::Point*>* getStations() { return _stations; } /// Returns the Vtk polydata source object vtkPolyDataAlgorithm* vtkSource() const { return _vtkSource; } private: QModelIndex _modelIndex; - const std::vector<GEOLIB::Point*>* _stations; + const std::vector<GeoLib::Point*>* _stations; /// The Vtk data source object. This is the starting point for a Vtk data /// visualization pipeline. diff --git a/Gui/DataView/CMakeLists.txt b/Gui/DataView/CMakeLists.txt index edbd1f66344..0c272640b85 100644 --- a/Gui/DataView/CMakeLists.txt +++ b/Gui/DataView/CMakeLists.txt @@ -35,7 +35,7 @@ set( SOURCES SetNameDialog.cpp StationTabWidget.cpp StationTreeModel.cpp - StationTreeView.cpp + StationTreeView.cpp ) # Moc Header files @@ -78,14 +78,14 @@ set( MOC_HEADERS set( HEADERS BaseItem.h CondItem.h - DirectConditionGenerator.h + DirectConditionGenerator.h CondObjectListItem.h GeoObjectListItem.h GeoTreeItem.h ModelTreeItem.h MshItem.h MshLayerMapper.h - ProcessItem.h + ProcessItem.h ) # UI files @@ -130,22 +130,23 @@ qt4_wrap_cpp( MOC_SOURCES ${MOC_HEADERS} ) # Include the headers which are generated by uic and moc # and include additional header include_directories( - ${CMAKE_BINARY_DIR}/Qt/Base - ${CMAKE_BINARY_DIR}/Qt/DataView - ${CMAKE_BINARY_DIR}/Qt/DataView/DiagramView - ${CMAKE_BINARY_DIR}/Qt/DataView/StratView - - ${CMAKE_SOURCE_DIR}/Base + ${CMAKE_BINARY_DIR}/Gui/Base + ${CMAKE_BINARY_DIR}/Gui/DataView + ${CMAKE_BINARY_DIR}/Gui/DataView/DiagramView + ${CMAKE_BINARY_DIR}/Gui/DataView/StratView + + ${CMAKE_SOURCE_DIR}/BaseLib ${CMAKE_SOURCE_DIR}/MathLib - ${CMAKE_SOURCE_DIR}/GEO - ${CMAKE_SOURCE_DIR}/MSH - ${CMAKE_SOURCE_DIR}/FEM + ${CMAKE_SOURCE_DIR}/GeoLib + ${CMAKE_SOURCE_DIR}/OGS + ${CMAKE_SOURCE_DIR}/MeshLib + ${CMAKE_SOURCE_DIR}/FemLib ${CMAKE_SOURCE_DIR}/FileIO - ${CMAKE_SOURCE_DIR}/Qt/Base - ${CMAKE_SOURCE_DIR}/Qt/DataView - ${CMAKE_SOURCE_DIR}/Qt/DataView/DiagramView - ${CMAKE_SOURCE_DIR}/Qt/DataView/StratView - ${CMAKE_SOURCE_DIR}/Qt/VtkVis + ${CMAKE_SOURCE_DIR}/Gui/Base + ${CMAKE_SOURCE_DIR}/Gui/DataView + ${CMAKE_SOURCE_DIR}/Gui/DataView/DiagramView + ${CMAKE_SOURCE_DIR}/Gui/DataView/StratView + ${CMAKE_SOURCE_DIR}/Gui/VtkVis ) IF(VRPN_FOUND) diff --git a/Gui/DataView/ColorTableModel.cpp b/Gui/DataView/ColorTableModel.cpp index 98d5a2c9f82..01a933e8a56 100644 --- a/Gui/DataView/ColorTableModel.cpp +++ b/Gui/DataView/ColorTableModel.cpp @@ -8,7 +8,7 @@ #include "ColorTableModel.h" -ColorTableModel::ColorTableModel( const std::map<std::string, GEOLIB::Color*> &colorLookupTable, +ColorTableModel::ColorTableModel( const std::map<std::string, GeoLib::Color*> &colorLookupTable, QObject* parent /*= 0*/ ) { Q_UNUSED(parent) @@ -71,12 +71,12 @@ QVariant ColorTableModel::data( const QModelIndex& index, int role ) const return QVariant(); } -bool ColorTableModel::buildTable(const std::map<std::string, GEOLIB::Color*> &colorLookupTable) +bool ColorTableModel::buildTable(const std::map<std::string, GeoLib::Color*> &colorLookupTable) { int count = 0; beginInsertRows(QModelIndex(), 0, colorLookupTable.size() - 1); - for (std::map<std::string, GEOLIB::Color*>::const_iterator it = colorLookupTable.begin(); + for (std::map<std::string, GeoLib::Color*>::const_iterator it = colorLookupTable.begin(); it != colorLookupTable.end(); ++it) { QColor color((*(it->second))[0], (*(it->second))[1], (*(it->second))[2]); diff --git a/Gui/DataView/ColorTableModel.h b/Gui/DataView/ColorTableModel.h index 37debb21043..b0f064be4ac 100644 --- a/Gui/DataView/ColorTableModel.h +++ b/Gui/DataView/ColorTableModel.h @@ -18,7 +18,7 @@ class ColorTableModel : public QAbstractTableModel Q_OBJECT public: - ColorTableModel( const std::map<std::string, GEOLIB::Color*> &colorLookupTable, + ColorTableModel( const std::map<std::string, GeoLib::Color*> &colorLookupTable, QObject* parent = 0 ); ~ColorTableModel(); @@ -36,7 +36,7 @@ public: int role /*= Qt::DisplayRole*/ ) const; private: - bool buildTable( const std::map<std::string, GEOLIB::Color*> &colorLookupTable ); + bool buildTable( const std::map<std::string, GeoLib::Color*> &colorLookupTable ); QList< QPair<QString, QColor> > _listOfPairs; }; diff --git a/Gui/DataView/CondItem.h b/Gui/DataView/CondItem.h index d03d4a27dbd..ad6891f3585 100644 --- a/Gui/DataView/CondItem.h +++ b/Gui/DataView/CondItem.h @@ -29,7 +29,7 @@ public: const FEMCondition* getItem() { return _item; } /// Returns the geo-object on which the condition is placed. - const GEOLIB::GeoObject* getGeoObject() { return this->getGeoObject(); } + const GeoLib::GeoObject* getGeoObject() { return this->getGeoObject(); } private: const FEMCondition* _item; diff --git a/Gui/DataView/CondObjectListItem.h b/Gui/DataView/CondObjectListItem.h index 4ab7b837428..2f3b39c05cd 100644 --- a/Gui/DataView/CondObjectListItem.h +++ b/Gui/DataView/CondObjectListItem.h @@ -29,7 +29,7 @@ public: CondObjectListItem(const QList<QVariant> &data, TreeItem* parent, FEMCondition* cond, - const std::vector<GEOLIB::Point*>* points) + const std::vector<GeoLib::Point*>* points) : TreeItem(data, parent), _vtkSource(VtkConditionSource::New()), _type(cond->getCondType()), _cond_vec(new std::vector<FEMCondition*>) { diff --git a/Gui/DataView/ConditionWriterDialog.cpp b/Gui/DataView/ConditionWriterDialog.cpp index 3480132224f..93dccda0fa7 100644 --- a/Gui/DataView/ConditionWriterDialog.cpp +++ b/Gui/DataView/ConditionWriterDialog.cpp @@ -11,7 +11,7 @@ #include <QFileInfo> #include <QSettings> -ConditionWriterDialog::ConditionWriterDialog(const GEOLIB::GEOObjects *geo_objects, QDialog* parent) +ConditionWriterDialog::ConditionWriterDialog(const GeoLib::GEOObjects *geo_objects, QDialog* parent) : QDialog(parent) { setupUi(this); @@ -70,13 +70,13 @@ void ConditionWriterDialog::accept() FEMCondition::CondType cond_type(FEMCondition::UNSPECIFIED);; switch (this->condTypeBox->currentIndex()) { - case 0: + case 0: cond_type = FEMCondition::UNSPECIFIED; break; - case 1: + case 1: cond_type = FEMCondition::BOUNDARY_CONDITION; break; - case 2: + case 2: cond_type = FEMCondition::INITIAL_CONDITION; break; - case 3: + case 3: cond_type = FEMCondition::SOURCE_TERM; break; default: std::cout << "Error in ConditionWriterDialog..." << std::endl; diff --git a/Gui/DataView/ConditionWriterDialog.h b/Gui/DataView/ConditionWriterDialog.h index 399ee350dcf..6704dd012a5 100644 --- a/Gui/DataView/ConditionWriterDialog.h +++ b/Gui/DataView/ConditionWriterDialog.h @@ -20,7 +20,7 @@ class ConditionWriterDialog : public QDialog, private Ui_ConditionWriter Q_OBJECT public: - ConditionWriterDialog(const GEOLIB::GEOObjects* geoObjects, QDialog* parent = 0); + ConditionWriterDialog(const GeoLib::GEOObjects* geoObjects, QDialog* parent = 0); ~ConditionWriterDialog(void); private slots: diff --git a/Gui/DataView/DataView.cpp b/Gui/DataView/DataView.cpp index c1802a5551b..d6352b9bc65 100644 --- a/Gui/DataView/DataView.cpp +++ b/Gui/DataView/DataView.cpp @@ -106,7 +106,7 @@ void DataView::openMshEditDialog() static_cast<MshModel*>(this->model())->getMesh(index)->getCFEMesh(); MshEditDialog meshEdit(mesh); - connect(&meshEdit, SIGNAL(mshEditFinished(MeshLib::CFEMesh*, std::string &)), + connect(&meshEdit, SIGNAL(mshEditFinished(MeshLib::CFEMesh*, std::string &)), model, SLOT(addMesh(MeshLib::CFEMesh*, std::string &))); meshEdit.exec(); } @@ -145,7 +145,7 @@ void DataView::addDIRECTSourceTerms() { QModelIndex index = this->selectionModel()->currentIndex(); const GridAdapter* grid = static_cast<MshModel*>(this->model())->getMesh(index); - emit requestCondSetupDialog(grid->getName(), GEOLIB::INVALID, 0, false); + emit requestCondSetupDialog(grid->getName(), GeoLib::INVALID, 0, false); } @@ -153,7 +153,7 @@ void DataView::loadDIRECTSourceTerms() { QModelIndex index = this->selectionModel()->currentIndex(); const GridAdapter* grid = static_cast<MshModel*>(this->model())->getMesh(index); - const std::vector<GEOLIB::Point*>* points = grid->getNodes(); + const std::vector<GeoLib::Point*>* points = grid->getNodes(); emit requestDIRECTSourceTerms(grid->getName(), points); } diff --git a/Gui/DataView/DataView.h b/Gui/DataView/DataView.h index 215320a91dc..e45b623969a 100644 --- a/Gui/DataView/DataView.h +++ b/Gui/DataView/DataView.h @@ -18,7 +18,7 @@ namespace MeshLib class CFEMesh; } /* - namespace GEOLIB { + namespace GeoLib { class Point; } */ @@ -78,9 +78,9 @@ private slots: signals: void qualityCheckRequested(VtkMeshSource*); - void requestCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, const size_t, bool on_points); + void requestCondSetupDialog(const std::string&, const GeoLib::GEOTYPE, const size_t, bool on_points); void requestMeshRemoval(const QModelIndex&); - void requestDIRECTSourceTerms(const std::string, const std::vector<GEOLIB::Point*>*); + void requestDIRECTSourceTerms(const std::string, const std::vector<GeoLib::Point*>*); void saveMeshAction(); /* diff --git a/Gui/DataView/DatabaseConnection.cpp b/Gui/DataView/DatabaseConnection.cpp index 73cd556317a..7075584aa41 100644 --- a/Gui/DataView/DatabaseConnection.cpp +++ b/Gui/DataView/DatabaseConnection.cpp @@ -18,7 +18,7 @@ #include <iostream> /// The OGS5-Connection to a database -DatabaseConnection::DatabaseConnection(GEOLIB::GEOObjects* geoObjects, +DatabaseConnection::DatabaseConnection(GeoLib::GEOObjects* geoObjects, QObject* parent) : QObject(parent), _geoObjects(geoObjects) { } @@ -183,7 +183,7 @@ int DatabaseConnection::loadStationList(int listID) { QSqlQuery query, stnQuery; QString stationName; - std::vector<GEOLIB::Point*>* stations = new std::vector<GEOLIB::Point*>; + std::vector<GeoLib::Point*>* stations = new std::vector<GeoLib::Point*>; query.exec( "select stationtype from geosysstationtypes where listid=" + @@ -191,9 +191,9 @@ int DatabaseConnection::loadStationList(int listID) if (query.next()) { - GEOLIB::Station::StationType type = - static_cast<GEOLIB::Station::StationType>(query.value(0).toInt()); - if (type == GEOLIB::Station::BOREHOLE) + GeoLib::Station::StationType type = + static_cast<GeoLib::Station::StationType>(query.value(0).toInt()); + if (type == GeoLib::Station::BOREHOLE) query.exec( "select c.catname, l.listname from lists l, categories c, boreholes b where c.catid=l.catid and l.listid=b.listid and l.listid=" + QString::number(listID)); @@ -207,7 +207,7 @@ int DatabaseConnection::loadStationList(int listID) QString listName = (query.value(0)).toString() + " (" + (query.value(1)).toString() + ")"; - if (type == GEOLIB::Station::BOREHOLE) + if (type == GeoLib::Station::BOREHOLE) stnQuery.exec( "select s.stationid, s.name, s.x, s.y, s.z, b.bdepth, to_char(b.bdate, 'YYYY-MM-DD') from stations s, boreholes b where s.listid=b.listid and s.stationid=b.stationid and s.listid=" + QString::number(listID) + " order by stationid"); @@ -223,9 +223,9 @@ int DatabaseConnection::loadStationList(int listID) stationName = "Station" + stnQuery.value(0).toString(); - GEOLIB::Station* newStation; - if (type == GEOLIB::Station::BOREHOLE) - newStation = GEOLIB::StationBorehole::createStation( + GeoLib::Station* newStation; + if (type == GeoLib::Station::BOREHOLE) + newStation = GeoLib::StationBorehole::createStation( stationName.toStdString(), stnQuery.value(2).toDouble(), stnQuery.value(3).toDouble(), @@ -233,7 +233,7 @@ int DatabaseConnection::loadStationList(int listID) stnQuery.value(5).toDouble(), stnQuery.value(6).toString().toStdString()); else - newStation = GEOLIB::Station::createStation( + newStation = GeoLib::Station::createStation( stationName.toStdString(), stnQuery.value(2).toDouble(), stnQuery.value(3).toDouble(), @@ -242,7 +242,7 @@ int DatabaseConnection::loadStationList(int listID) stations->push_back(newStation); } - if (type == GEOLIB::Station::BOREHOLE) + if (type == GeoLib::Station::BOREHOLE) //addStratigraphy(listID, _geoObjects->getStationVec(listName.toStdString())); addStratigraphy(listID, stations); @@ -276,7 +276,7 @@ int DatabaseConnection::loadStationList(int listID) * \param stations List of station objects for which stratigraphy data will be provided * \return 1 if there were no errors, 0 and an error message otherwise. */ -int DatabaseConnection::addStratigraphy(int listID, std::vector<GEOLIB::Point*>* stations) +int DatabaseConnection::addStratigraphy(int listID, std::vector<GeoLib::Point*>* stations) { if (_db.open()) { @@ -286,14 +286,14 @@ int DatabaseConnection::addStratigraphy(int listID, std::vector<GEOLIB::Point*>* for (size_t i = 0; i < size; i++) { int count = 1; - GEOLIB::StationBorehole* newStation = - static_cast<GEOLIB::StationBorehole*>((*stations)[i]); + GeoLib::StationBorehole* newStation = + static_cast<GeoLib::StationBorehole*>((*stations)[i]); strat.exec( "select s.layerid, s.thickness, s.strat from stations t, stratigraphies s where s.listid=" + QString::number( listID) + " and s.listid=t.listid and s.stationid=t.stationid and t.name='" + - QString::fromStdString(static_cast<GEOLIB::Station*>((*stations)[i]) + QString::fromStdString(static_cast<GeoLib::Station*>((*stations)[i]) -> getName()) + "' order by layerid"); @@ -308,7 +308,7 @@ int DatabaseConnection::addStratigraphy(int listID, std::vector<GEOLIB::Point*>* else std::cout << "DatabaseConnection::addStratigraphy - Station " << - static_cast<GEOLIB::Station*>((*stations)[i])->getName() << + static_cast<GeoLib::Station*>((*stations)[i])->getName() << ": Stratigraphy incomplete...\n"; count++; } @@ -528,7 +528,7 @@ int DatabaseConnection::loadValues(const int &listID, int DatabaseConnection::addListToDB(std::string path, std::string listName, std::string catName, - GEOLIB::Station::StationType type) + GeoLib::Station::StationType type) { if (_db.open()) { @@ -581,7 +581,7 @@ int DatabaseConnection::addListToDB(std::string path, listID) + ", '" + QString::fromStdString( listName) + "', " + QString::number(catID) + ", 0)"); - if (type == GEOLIB::Station::BOREHOLE) + if (type == GeoLib::Station::BOREHOLE) query.exec( "insert into geosysstationtypes values (" + QString::number( listID) + ", 2)"); @@ -591,7 +591,7 @@ int DatabaseConnection::addListToDB(std::string path, /* read all stations */ while ( getline(in, line) ) { - if (type == GEOLIB::Station::BOREHOLE) + if (type == GeoLib::Station::BOREHOLE) status = addBoreholeToDB(listID, stationID, line); else status = addStationToDB(listID, stationID, line); @@ -634,7 +634,7 @@ int DatabaseConnection::addListToDB(std::string path, bool DatabaseConnection::addStationToDB(int listID, int stationID, std::string line) { QSqlQuery query; - GEOLIB::Station* station = GEOLIB::Station::createStation(line); + GeoLib::Station* station = GeoLib::Station::createStation(line); query.prepare("insert into stations values(:listid, :stationid, :stationname, :x, :y, :z)"); query.bindValue(":listid", listID); query.bindValue(":stationid", stationID); @@ -655,7 +655,7 @@ bool DatabaseConnection::addStationToDB(int listID, int stationID, std::string l bool DatabaseConnection::addBoreholeToDB(int listID, int stationID, std::string line) { QSqlQuery query; - GEOLIB::StationBorehole* station = GEOLIB::StationBorehole::createStation(line); + GeoLib::StationBorehole* station = GeoLib::StationBorehole::createStation(line); if (addStationToDB(listID, stationID, line)) { @@ -664,7 +664,7 @@ bool DatabaseConnection::addBoreholeToDB(int listID, int stationID, std::string query.bindValue(":listid", listID); query.bindValue(":stationid", stationID); query.bindValue(":bdepth", station->getDepth()); - QString sDate = QString::fromStdString(date2string(station->getDate())); + QString sDate = QString::fromStdString(BaseLib::date2string(station->getDate())); query.bindValue(":bdate", sDate); return query.exec(); } diff --git a/Gui/DataView/DatabaseConnection.h b/Gui/DataView/DatabaseConnection.h index 06728a899bb..4819bf7d9a4 100644 --- a/Gui/DataView/DatabaseConnection.h +++ b/Gui/DataView/DatabaseConnection.h @@ -21,7 +21,7 @@ class DatabaseConnection : public QObject Q_OBJECT public: - DatabaseConnection(GEOLIB::GEOObjects* geoObjects, QObject* parent = 0); + DatabaseConnection(GeoLib::GEOObjects* geoObjects, QObject* parent = 0); ~DatabaseConnection(); int dbConnect(); @@ -58,21 +58,21 @@ public slots: private: void databaseError(); - int addStratigraphy(int listID, std::vector<GEOLIB::Point*>* stations); + int addStratigraphy(int listID, std::vector<GeoLib::Point*>* stations); bool commitTransaction(QSqlQuery query); //data-insert functions -- be careful! int addListToDB(std::string path, std::string listName, std::string catName, - GEOLIB::Station::StationType type); + GeoLib::Station::StationType type); bool addStationToDB(int listID, int stationID, std::string line); bool addBoreholeToDB(int listID, int stationID, std::string line); int addStratigraphyToDB(std::string path, int listID); int addMeasuredValuesToDB(std::string path, int listID, int stationID); QSqlDatabase _db; - GEOLIB::GEOObjects* _geoObjects; + GeoLib::GEOObjects* _geoObjects; signals: void listLoaded(QString listName); diff --git a/Gui/DataView/DiagramView/CMakeLists.txt b/Gui/DataView/DiagramView/CMakeLists.txt index a7f258c7ccc..37f84af2af9 100644 --- a/Gui/DataView/DiagramView/CMakeLists.txt +++ b/Gui/DataView/DiagramView/CMakeLists.txt @@ -39,13 +39,13 @@ qt4_wrap_cpp( MOC_SOURCES ${MOC_HEADERS} ) # Include the headers which are generated by uic and moc # and include additional header include_directories( - ${CMAKE_SOURCE_DIR}/Qt/DataView/DiagramView - ${CMAKE_BINARY_DIR}/Qt/DataView/DiagramView - ${CMAKE_BINARY_DIR}/Qt/DataView - ${CMAKE_SOURCE_DIR}/Base - ${CMAKE_SOURCE_DIR}/GEO - ${CMAKE_SOURCE_DIR}/Qt/Base - ${CMAKE_SOURCE_DIR}/Qt/DataView + ${CMAKE_SOURCE_DIR}/Gui/DataView/DiagramView + ${CMAKE_BINARY_DIR}/Gui/DataView/DiagramView + ${CMAKE_BINARY_DIR}/Gui/DataView + ${CMAKE_SOURCE_DIR}/BaseLib + ${CMAKE_SOURCE_DIR}/GeoLib + ${CMAKE_SOURCE_DIR}/Gui/Base + ${CMAKE_SOURCE_DIR}/Gui/DataView ${CMAKE_SOURCE_DIR}/MathLib ) diff --git a/Gui/DataView/DiagramView/DetailWindow.cpp b/Gui/DataView/DiagramView/DetailWindow.cpp index 48b9a344a48..e5dc993b462 100644 --- a/Gui/DataView/DiagramView/DetailWindow.cpp +++ b/Gui/DataView/DiagramView/DetailWindow.cpp @@ -115,7 +115,7 @@ void DetailWindow::resizeWindow() void DetailWindow::addList(DiagramList* list) { - GEOLIB::Color* c = GEOLIB::getRandomColor(); + GeoLib::Color* c = GeoLib::getRandomColor(); QColor colour((*c)[0], (*c)[1], (*c)[2]); delete c; this->addList(list, colour); diff --git a/Gui/DataView/DiagramView/DiagramList.cpp b/Gui/DataView/DiagramView/DiagramList.cpp index d74f4180208..882b747dd53 100644 --- a/Gui/DataView/DiagramView/DiagramList.cpp +++ b/Gui/DataView/DiagramView/DiagramList.cpp @@ -232,10 +232,10 @@ int DiagramList::readList(const SensorData* data, std::vector<DiagramList*> &lis bool is_date (false); - if (!(int2date(time_steps[0])).empty()) + if (!(BaseLib::int2date(time_steps[0])).empty()) is_date = true; - + size_t nValues (time_steps.size()); for (int i = 0; i < nLists; i++) @@ -250,12 +250,12 @@ int DiagramList::readList(const SensorData* data, std::vector<DiagramList*> &lis if (is_date) { l->setXUnit("day"); - QDateTime startDate(getDateTime(QString::fromStdString(int2date(time_steps[0])))); + QDateTime startDate(getDateTime(QString::fromStdString(BaseLib::int2date(time_steps[0])))); lists[i]->setStartDate(startDate); int numberOfSecs(0); for (size_t j = 0; j < nValues; j++) { - numberOfSecs = startDate.secsTo(getDateTime(QString::fromStdString(int2date(time_steps[j])))); + numberOfSecs = startDate.secsTo(getDateTime(QString::fromStdString(BaseLib::int2date(time_steps[j])))); lists[i]->addNextPoint(numberOfSecs, (*time_series)[j]); } } @@ -267,7 +267,7 @@ int DiagramList::readList(const SensorData* data, std::vector<DiagramList*> &lis } lists[i]->update(); - } + } return nLists; } diff --git a/Gui/DataView/DiagramView/DiagramPrefsDialog.cpp b/Gui/DataView/DiagramView/DiagramPrefsDialog.cpp index 13d47bf19d8..552244a933c 100644 --- a/Gui/DataView/DiagramView/DiagramPrefsDialog.cpp +++ b/Gui/DataView/DiagramView/DiagramPrefsDialog.cpp @@ -14,7 +14,7 @@ #include <QFileDialog> #include <QMessageBox> -DiagramPrefsDialog::DiagramPrefsDialog(const GEOLIB::Station* stn, +DiagramPrefsDialog::DiagramPrefsDialog(const GeoLib::Station* stn, const QString &listName, DatabaseConnection* db, QDialog* parent) @@ -45,7 +45,7 @@ DiagramPrefsDialog::DiagramPrefsDialog(const GEOLIB::Station* stn, } } -DiagramPrefsDialog::DiagramPrefsDialog(GEOLIB::Station* stn, QDialog* parent) +DiagramPrefsDialog::DiagramPrefsDialog(GeoLib::Station* stn, QDialog* parent) : QDialog(parent), _window(NULL) { setupUi(this); diff --git a/Gui/DataView/DiagramView/DiagramPrefsDialog.h b/Gui/DataView/DiagramView/DiagramPrefsDialog.h index ed683b1aa24..45a6ee9176a 100644 --- a/Gui/DataView/DiagramView/DiagramPrefsDialog.h +++ b/Gui/DataView/DiagramView/DiagramPrefsDialog.h @@ -14,7 +14,7 @@ class DetailWindow; class DiagramList; class QCheckBox; -namespace GEOLIB +namespace GeoLib { class Station; } @@ -41,7 +41,7 @@ public: * \param db The database connection were the diagram-related data can be found * \param parent The parent QDialog. */ - DiagramPrefsDialog(const GEOLIB::Station* stn, + DiagramPrefsDialog(const GeoLib::Station* stn, const QString &listName, DatabaseConnection* db, QDialog* parent = 0); @@ -51,7 +51,7 @@ public: * \param stn The station object associated the diagram. * \param parent The parent QDialog. */ - DiagramPrefsDialog(GEOLIB::Station* stn, QDialog* parent = 0); + DiagramPrefsDialog(GeoLib::Station* stn, QDialog* parent = 0); /** * Opens a new dialog and automatically reads data from the specified file. The diagram is not associated diff --git a/Gui/DataView/DirectConditionGenerator.cpp b/Gui/DataView/DirectConditionGenerator.cpp index ff691b09599..6e92cfd98c2 100644 --- a/Gui/DataView/DirectConditionGenerator.cpp +++ b/Gui/DataView/DirectConditionGenerator.cpp @@ -26,7 +26,7 @@ const std::vector< std::pair<size_t,double> >& DirectConditionGenerator::directT return _direct_values; } - const std::vector<GEOLIB::PointWithID*> surface_nodes ( MshEditor::getSurfaceNodes(mesh) ); + const std::vector<GeoLib::PointWithID*> surface_nodes ( MshEditor::getSurfaceNodes(mesh) ); //std::vector<MeshLib::CNode*> nodes = mesh.nod_vector; const size_t nNodes(surface_nodes.size()); _direct_values.reserve(nNodes); diff --git a/Gui/DataView/ElementTreeModel.cpp b/Gui/DataView/ElementTreeModel.cpp index 3b73f842ee0..13fd9fe8572 100644 --- a/Gui/DataView/ElementTreeModel.cpp +++ b/Gui/DataView/ElementTreeModel.cpp @@ -54,10 +54,10 @@ void ElementTreeModel::setElement(const GridAdapter* grid, const size_t elem_ind TreeItem* nodeListItem = new TreeItem(nodeListData, elemItem); elemItem->appendChild(nodeListItem); - const std::vector<GEOLIB::Point*>* nodes_vec = grid->getNodes(); + const std::vector<GeoLib::Point*>* nodes_vec = grid->getNodes(); for (size_t i = 0; i < elem->nodes.size(); i++) { - const GEOLIB::Point* pnt = (*nodes_vec)[elem->nodes[i]]; + const GeoLib::Point* pnt = (*nodes_vec)[elem->nodes[i]]; QList<QVariant> nodeData; nodeData << "Node " + QString::number(elem->nodes[i]) << QString::number((*pnt)[0]) << QString::number((*pnt)[1]) << diff --git a/Gui/DataView/FEMConditionSetupDialog.cpp b/Gui/DataView/FEMConditionSetupDialog.cpp index 463174cebe0..a9d96b526b6 100644 --- a/Gui/DataView/FEMConditionSetupDialog.cpp +++ b/Gui/DataView/FEMConditionSetupDialog.cpp @@ -17,9 +17,9 @@ #include "SourceTerm.h" FEMConditionSetupDialog::FEMConditionSetupDialog(const std::string &associated_geometry, - const GEOLIB::GEOTYPE type, + const GeoLib::GEOTYPE type, const std::string &geo_name, - const GEOLIB::GeoObject* const geo_object, + const GeoLib::GeoObject* const geo_object, bool on_points, QDialog* parent) : QDialog(parent), _cond(associated_geometry, FEMCondition::UNSPECIFIED), _set_on_points(on_points), @@ -46,7 +46,7 @@ FEMConditionSetupDialog::FEMConditionSetupDialog(const std::string &name, const : QDialog(parent), _cond(name, FEMCondition::UNSPECIFIED), _set_on_points(false), _combobox(NULL), directButton(NULL), _mesh(mesh), _first_value_validator(NULL) { - _cond.setGeoType(GEOLIB::INVALID); + _cond.setGeoType(GeoLib::INVALID); _cond.setGeoName(name); _cond.setGeoObj(NULL); @@ -63,10 +63,10 @@ FEMConditionSetupDialog::~FEMConditionSetupDialog() void FEMConditionSetupDialog::setupDialog() { - if (_cond.getGeoType() != GEOLIB::INVALID) + if (_cond.getGeoType() != GeoLib::INVALID) { this->disTypeBox->addItem("Constant (Dirichlet)"); - if (_cond.getGeoType() == GEOLIB::POLYLINE) + if (_cond.getGeoType() == GeoLib::POLYLINE) this->disTypeBox->addItem("Linear (Dirichlet)"); if (this->_set_on_points) @@ -121,7 +121,7 @@ void FEMConditionSetupDialog::setValuesFromCond() on_condTypeBox_currentIndexChanged(2); } - if (_cond.getGeoType() != GEOLIB::INVALID) + if (_cond.getGeoType() != GeoLib::INVALID) { if (_cond.getProcessDistributionType() == FiniteElement::CONSTANT || _cond.getProcessDistributionType() == FiniteElement::CONSTANT_NEUMANN) { @@ -146,7 +146,7 @@ void FEMConditionSetupDialog::accept() _cond.setProcessType(static_cast<FiniteElement::ProcessType>(this->processTypeBox->currentIndex() + 1)); _cond.setProcessPrimaryVariable(static_cast<FiniteElement::PrimaryVariable>(this->pvTypeBox->currentIndex() + 1)); - if (_cond.getGeoType() != GEOLIB::INVALID) + if (_cond.getGeoType() != GeoLib::INVALID) { if (condTypeBox->currentIndex()>1) { @@ -200,14 +200,14 @@ void FEMConditionSetupDialog::on_condTypeBox_currentIndexChanged(int index) //if (index==1) // this->geoNameBox->addItem("Domain"); // remove "Domain" if IC is unselected - if (_cond.getGeoType() != GEOLIB::INVALID) + if (_cond.getGeoType() != GeoLib::INVALID) { if (index>1) // source terms selected { while (this->disTypeBox->count()>0) this->disTypeBox->removeItem(0); this->disTypeBox->addItem("Constant (Neumann)"); - if (_cond.getGeoType() == GEOLIB::POLYLINE) + if (_cond.getGeoType() == GeoLib::POLYLINE) this->disTypeBox->addItem("Linear (Neumann)"); } else @@ -215,7 +215,7 @@ void FEMConditionSetupDialog::on_condTypeBox_currentIndexChanged(int index) while (this->disTypeBox->count()>0) this->disTypeBox->removeItem(0); this->disTypeBox->addItem("Constant (Dirichlet)"); - if (_cond.getGeoType() == GEOLIB::POLYLINE) + if (_cond.getGeoType() == GeoLib::POLYLINE) this->disTypeBox->addItem("Linear (Dirichlet)"); } } @@ -245,7 +245,7 @@ void FEMConditionSetupDialog::directButton_pressed() { if (this->_mesh == NULL) { - const GEOLIB::Polyline* line = dynamic_cast<const GEOLIB::Polyline*>(_cond.getGeoObj()); + const GeoLib::Polyline* line = dynamic_cast<const GeoLib::Polyline*>(_cond.getGeoObj()); const std::vector<size_t> nodes = _cond.getDisNodes(); const std::vector<double> values = _cond.getDisValues(); LinearEditDialog dlg(*line, nodes, values); @@ -292,15 +292,15 @@ FEMCondition* FEMConditionSetupDialog::typeCast(const FEMCondition &cond) void FEMConditionSetupDialog::copyCondOnPoints() { std::vector<FEMCondition*> conditions; - if (_cond.getGeoType() == GEOLIB::POLYLINE) + if (_cond.getGeoType() == GeoLib::POLYLINE) { - const GEOLIB::Polyline* ply = dynamic_cast<const GEOLIB::Polyline*>(_cond.getGeoObj()); + const GeoLib::Polyline* ply = dynamic_cast<const GeoLib::Polyline*>(_cond.getGeoObj()); size_t nPoints = ply->getNumberOfPoints(); for (size_t i=0; i<nPoints; i++) { FEMCondition* cond = new FEMCondition(_cond); cond->setGeoObj(NULL); - cond->setGeoType(GEOLIB::POINT); + cond->setGeoType(GeoLib::POINT); cond->setGeoName(_cond.getAssociatedGeometryName() + "_Point" + number2str(ply->getPointID(i))); cond->clearDisValues(); cond->setConstantDisValue((*ply->getPoint(i))[2]); @@ -308,18 +308,18 @@ void FEMConditionSetupDialog::copyCondOnPoints() } emit createFEMCondition(conditions); } - else if (_cond.getGeoType() == GEOLIB::SURFACE) + else if (_cond.getGeoType() == GeoLib::SURFACE) { - const GEOLIB::Surface* sfc = dynamic_cast<const GEOLIB::Surface*>(_cond.getGeoObj()); + const GeoLib::Surface* sfc = dynamic_cast<const GeoLib::Surface*>(_cond.getGeoObj()); size_t nTriangles = sfc->getNTriangles(); for (size_t i=0; i<nTriangles; i++) { - const GEOLIB::Triangle* tri = (*sfc)[i]; + const GeoLib::Triangle* tri = (*sfc)[i]; for (size_t j=0; j<3; j++) { FEMCondition* cond = new FEMCondition(_cond); cond->setGeoObj(NULL); - cond->setGeoType(GEOLIB::POINT); + cond->setGeoType(GeoLib::POINT); cond->setGeoName(_cond.getAssociatedGeometryName() + "_Point" + number2str((*tri)[j])); cond->clearDisValues(); cond->setConstantDisValue((*tri->getPoint(j))[2]); diff --git a/Gui/DataView/FEMConditionSetupDialog.h b/Gui/DataView/FEMConditionSetupDialog.h index 84453433e5b..89e6e2bf277 100644 --- a/Gui/DataView/FEMConditionSetupDialog.h +++ b/Gui/DataView/FEMConditionSetupDialog.h @@ -15,7 +15,7 @@ class QComboBox; class QPushButton; class StrictDoubleValidator; -namespace GEOLIB { +namespace GeoLib { class GeoObject; } @@ -33,10 +33,10 @@ class FEMConditionSetupDialog : public QDialog, private Ui_FEMConditionSetup public: /// Constructor for creating a new FEM condition. - FEMConditionSetupDialog(const std::string &associated_geometry, - const GEOLIB::GEOTYPE type, - const std::string &geo_name, - const GEOLIB::GeoObject* const geo_object, + FEMConditionSetupDialog(const std::string &associated_geometry, + const GeoLib::GEOTYPE type, + const std::string &geo_name, + const GeoLib::GeoObject* const geo_object, bool on_points = false, QDialog* parent = 0); diff --git a/Gui/DataView/GEOModels.cpp b/Gui/DataView/GEOModels.cpp index ae9314fe023..b6aab8201b9 100644 --- a/Gui/DataView/GEOModels.cpp +++ b/Gui/DataView/GEOModels.cpp @@ -28,30 +28,30 @@ GEOModels::~GEOModels() delete _geoModel; } -void GEOModels::removeGeometry(std::string geo_name, GEOLIB::GEOTYPE type) +void GEOModels::removeGeometry(std::string geo_name, GeoLib::GEOTYPE type) { - if (type == GEOLIB::INVALID || type == GEOLIB::SURFACE) + if (type == GeoLib::INVALID || type == GeoLib::SURFACE) this->removeSurfaceVec(geo_name); - if (type == GEOLIB::INVALID || type == GEOLIB::POLYLINE) + if (type == GeoLib::INVALID || type == GeoLib::POLYLINE) this->removePolylineVec(geo_name); - if (type == GEOLIB::INVALID || type == GEOLIB::POINT) + if (type == GeoLib::INVALID || type == GeoLib::POINT) this->removePointVec(geo_name); } -void GEOModels::addPointVec( std::vector<GEOLIB::Point*>* points, +void GEOModels::addPointVec( std::vector<GeoLib::Point*>* points, std::string &name, std::map<std::string, size_t>* name_pnt_id_map, double eps) { GEOObjects::addPointVec(points, name, name_pnt_id_map, eps); _geoModel->addPointList(QString::fromStdString(name), this->getPointVecObj(name)); - emit geoDataAdded(_geoModel, name, GEOLIB::POINT); + emit geoDataAdded(_geoModel, name, GeoLib::POINT); } -bool GEOModels::appendPointVec(const std::vector<GEOLIB::Point*> &points, +bool GEOModels::appendPointVec(const std::vector<GeoLib::Point*> &points, const std::string &name, std::vector<size_t>* ids) { - bool ret (GEOLIB::GEOObjects::appendPointVec (points, name, ids)); + bool ret (GeoLib::GEOObjects::appendPointVec (points, name, ids)); // TODO import new points into geo-treeview return ret; } @@ -60,8 +60,8 @@ bool GEOModels::removePointVec( const std::string &name ) { if (!isPntVecUsed(name)) { - emit geoDataRemoved(_geoModel, name, GEOLIB::POINT); - this->_geoModel->removeGeoList(name, GEOLIB::POINT); + emit geoDataRemoved(_geoModel, name, GeoLib::POINT); + this->_geoModel->removeGeoList(name, GeoLib::POINT); return GEOObjects::removePointVec(name); } std::cout << @@ -70,7 +70,7 @@ bool GEOModels::removePointVec( const std::string &name ) return false; } -void GEOModels::addStationVec( std::vector<GEOLIB::Point*>* stations, +void GEOModels::addStationVec( std::vector<GeoLib::Point*>* stations, std::string &name) { GEOObjects::addStationVec(stations, name); @@ -82,7 +82,7 @@ void GEOModels::addStationVec( std::vector<GEOLIB::Point*>* stations, void GEOModels::filterStationVec(const std::string &name, const std::vector<PropertyBounds> &bounds) { emit stationVectorRemoved(_stationModel, name); - const std::vector<GEOLIB::Point*>* stations (GEOObjects::getStationVec(name)); + const std::vector<GeoLib::Point*>* stations (GEOObjects::getStationVec(name)); _stationModel->filterStations(name, stations, bounds); emit stationVectorAdded(_stationModel, name); } @@ -94,7 +94,7 @@ bool GEOModels::removeStationVec( const std::string &name ) return GEOObjects::removeStationVec(name); } -void GEOModels::addPolylineVec( std::vector<GEOLIB::Polyline*>* lines, +void GEOModels::addPolylineVec( std::vector<GeoLib::Polyline*>* lines, const std::string &name, std::map<std::string,size_t>* ply_names ) { @@ -103,13 +103,13 @@ void GEOModels::addPolylineVec( std::vector<GEOLIB::Polyline*>* lines, return; _geoModel->addPolylineList(QString::fromStdString(name), this->getPolylineVecObj(name)); - emit geoDataAdded(_geoModel, name, GEOLIB::POLYLINE); + emit geoDataAdded(_geoModel, name, GeoLib::POLYLINE); } -bool GEOModels::appendPolylineVec(const std::vector<GEOLIB::Polyline*> &polylines, +bool GEOModels::appendPolylineVec(const std::vector<GeoLib::Polyline*> &polylines, const std::string &name) { - bool ret (GEOLIB::GEOObjects::appendPolylineVec (polylines, name)); + bool ret (GeoLib::GEOObjects::appendPolylineVec (polylines, name)); this->_geoModel->appendPolylines(name, this->getPolylineVecObj(name)); return ret; @@ -117,12 +117,12 @@ bool GEOModels::appendPolylineVec(const std::vector<GEOLIB::Polyline*> &polyline bool GEOModels::removePolylineVec( const std::string &name ) { - emit geoDataRemoved(_geoModel, name, GEOLIB::POLYLINE); - this->_geoModel->removeGeoList(name, GEOLIB::POLYLINE); + emit geoDataRemoved(_geoModel, name, GeoLib::POLYLINE); + this->_geoModel->removeGeoList(name, GeoLib::POLYLINE); return GEOObjects::removePolylineVec (name); } -void GEOModels::addSurfaceVec( std::vector<GEOLIB::Surface*>* surfaces, +void GEOModels::addSurfaceVec( std::vector<GeoLib::Surface*>* surfaces, const std::string &name, std::map<std::string,size_t>* sfc_names ) { @@ -131,19 +131,19 @@ void GEOModels::addSurfaceVec( std::vector<GEOLIB::Surface*>* surfaces, return; _geoModel->addSurfaceList(QString::fromStdString(name), this->getSurfaceVecObj(name)); - emit geoDataAdded(_geoModel, name, GEOLIB::SURFACE); + emit geoDataAdded(_geoModel, name, GeoLib::SURFACE); } -bool GEOModels::appendSurfaceVec(const std::vector<GEOLIB::Surface*> &surfaces, +bool GEOModels::appendSurfaceVec(const std::vector<GeoLib::Surface*> &surfaces, const std::string &name) { - bool ret (GEOLIB::GEOObjects::appendSurfaceVec (surfaces, name)); + bool ret (GeoLib::GEOObjects::appendSurfaceVec (surfaces, name)); if (ret) this->_geoModel->appendSurfaces(name, this->getSurfaceVecObj(name)); else { - std::vector<GEOLIB::Surface*>* sfc = new std::vector<GEOLIB::Surface*>; + std::vector<GeoLib::Surface*>* sfc = new std::vector<GeoLib::Surface*>; for (size_t i = 0; i < surfaces.size(); i++) sfc->push_back(surfaces[i]); this->addSurfaceVec(sfc, name); @@ -154,8 +154,8 @@ bool GEOModels::appendSurfaceVec(const std::vector<GEOLIB::Surface*> &surfaces, bool GEOModels::removeSurfaceVec( const std::string &name ) { - emit geoDataRemoved(_geoModel, name, GEOLIB::SURFACE); - this->_geoModel->removeGeoList(name, GEOLIB::SURFACE); + emit geoDataRemoved(_geoModel, name, GeoLib::SURFACE); + this->_geoModel->removeGeoList(name, GeoLib::SURFACE); return GEOObjects::removeSurfaceVec (name); } @@ -166,33 +166,33 @@ void GEOModels::connectPolylineSegments(const std::string &geoName, bool closePly, bool triangulatePly) { - GEOLIB::PolylineVec* plyVec = this->getPolylineVecObj(geoName); + GeoLib::PolylineVec* plyVec = this->getPolylineVecObj(geoName); if (plyVec) { - const std::vector<GEOLIB::Polyline*>* polylines = plyVec->getVector(); - std::vector<GEOLIB::Polyline*> ply_list; + const std::vector<GeoLib::Polyline*>* polylines = plyVec->getVector(); + std::vector<GeoLib::Polyline*> ply_list; for (size_t i = 0; i < indexlist.size(); i++) ply_list.push_back( (*polylines)[indexlist[i]] ); // connect polylines - GEOLIB::Polyline* new_line = GEOLIB::Polyline::constructPolylineFromSegments( + GeoLib::Polyline* new_line = GeoLib::Polyline::constructPolylineFromSegments( ply_list, proximity); if (new_line) { // insert result in a new vector of polylines (because the GEOObjects::appendPolylines()-method requires a vector) - std::vector<GEOLIB::Polyline*> connected_ply; + std::vector<GeoLib::Polyline*> connected_ply; if (closePly) { - new_line = GEOLIB::Polyline::closePolyline(*new_line); + new_line = GeoLib::Polyline::closePolyline(*new_line); if (triangulatePly) { - std::vector<GEOLIB::Surface*> new_sfc; - new_sfc.push_back(GEOLIB::Surface::createSurface(*new_line)); + std::vector<GeoLib::Surface*> new_sfc; + new_sfc.push_back(GeoLib::Surface::createSurface(*new_line)); this->appendSurfaceVec(new_sfc, geoName); } } @@ -210,36 +210,36 @@ void GEOModels::connectPolylineSegments(const std::string &geoName, } -void GEOModels::addNameForElement(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id, std::string new_name) +void GEOModels::addNameForElement(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, size_t id, std::string new_name) { - if (object_type == GEOLIB::POINT) + if (object_type == GeoLib::POINT) this->getPointVecObj(geometry_name)->setNameForElement(id, new_name); - else if (object_type == GEOLIB::POLYLINE) + else if (object_type == GeoLib::POLYLINE) this->getPolylineVecObj(geometry_name)->setNameForElement(id, new_name); - else if (object_type == GEOLIB::SURFACE) + else if (object_type == GeoLib::SURFACE) this->getSurfaceVecObj(geometry_name)->setNameForElement(id, new_name); else std::cout << "Error in GEOModels::addNameForElement() - Unknown GEOTYPE..." << std::endl; } -void GEOModels::addNameForObjectPoints(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, const std::string &geo_object_name, const std::string &new_name) +void GEOModels::addNameForObjectPoints(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, const std::string &geo_object_name, const std::string &new_name) { - const GEOLIB::GeoObject* obj = this->getGEOObject(geometry_name, object_type, geo_object_name); - GEOLIB::PointVec* pnt_vec = this->getPointVecObj(geometry_name); - if (object_type == GEOLIB::POLYLINE) + const GeoLib::GeoObject* obj = this->getGEOObject(geometry_name, object_type, geo_object_name); + GeoLib::PointVec* pnt_vec = this->getPointVecObj(geometry_name); + if (object_type == GeoLib::POLYLINE) { - const GEOLIB::Polyline* ply = dynamic_cast<const GEOLIB::Polyline*>(obj); + const GeoLib::Polyline* ply = dynamic_cast<const GeoLib::Polyline*>(obj); size_t nPoints = ply->getNumberOfPoints(); for (size_t i=0; i<nPoints; i++) pnt_vec->setNameForElement(ply->getPointID(i), new_name + "_Point" + number2str(ply->getPointID(i))); } - else if (object_type == GEOLIB::SURFACE) + else if (object_type == GeoLib::SURFACE) { - const GEOLIB::Surface* sfc = dynamic_cast<const GEOLIB::Surface*>(obj); + const GeoLib::Surface* sfc = dynamic_cast<const GeoLib::Surface*>(obj); size_t nTriangles = sfc->getNTriangles(); for (size_t i=0; i<nTriangles; i++) { - const GEOLIB::Triangle* tri = (*sfc)[i]; + const GeoLib::Triangle* tri = (*sfc)[i]; pnt_vec->setNameForElement((*tri)[0], new_name + "_Point" + number2str((*tri)[0])); pnt_vec->setNameForElement((*tri)[1], new_name + "_Point" + number2str((*tri)[1])); pnt_vec->setNameForElement((*tri)[2], new_name + "_Point" + number2str((*tri)[2])); diff --git a/Gui/DataView/GEOModels.h b/Gui/DataView/GEOModels.h index b90689c32c9..766b294fb61 100644 --- a/Gui/DataView/GEOModels.h +++ b/Gui/DataView/GEOModels.h @@ -22,11 +22,11 @@ class TreeModel; /** * \brief GEOModels connects the data management class GEOObjects and the GUI. - * It inherits from GEOLIB::GEOObjects and additionally emits signals when + * It inherits from GeoLib::GEOObjects and additionally emits signals when * data objects are modified. The GUI connects to these signals. Model instances * are created for every data object. */ -class GEOModels : public QObject, public GEOLIB::GEOObjects +class GEOModels : public QObject, public GeoLib::GEOObjects { Q_OBJECT @@ -39,44 +39,44 @@ public: public slots: /// Removes all parts (points, lines, surfaces) of the geometry with the given name. - virtual void removeGeometry(std::string geo_name, GEOLIB::GEOTYPE type); + virtual void removeGeometry(std::string geo_name, GeoLib::GEOTYPE type); - virtual void addPointVec(std::vector<GEOLIB::Point*>* points, + virtual void addPointVec(std::vector<GeoLib::Point*>* points, std::string &name, std::map<std::string, size_t>* name_pnt_id_map = NULL, double eps = sqrt(std::numeric_limits<double>::min())); - virtual bool appendPointVec(const std::vector<GEOLIB::Point*> &points, + virtual bool appendPointVec(const std::vector<GeoLib::Point*> &points, const std::string &name, std::vector<size_t>* ids = NULL); virtual bool removePointVec(const std::string &name); - virtual void addStationVec(std::vector<GEOLIB::Point*>* stations, + virtual void addStationVec(std::vector<GeoLib::Point*>* stations, std::string &name); void filterStationVec(const std::string &name, const std::vector<PropertyBounds> &bounds); virtual bool removeStationVec(const std::string &name); - virtual void addPolylineVec(std::vector<GEOLIB::Polyline*>* lines, + virtual void addPolylineVec(std::vector<GeoLib::Polyline*>* lines, const std::string &name, std::map<std::string,size_t>* ply_names = NULL); - virtual bool appendPolylineVec(const std::vector<GEOLIB::Polyline*> &polylines, + virtual bool appendPolylineVec(const std::vector<GeoLib::Polyline*> &polylines, const std::string &name); virtual bool removePolylineVec(const std::string &name); - virtual void addSurfaceVec(std::vector<GEOLIB::Surface*>* surfaces, + virtual void addSurfaceVec(std::vector<GeoLib::Surface*>* surfaces, const std::string &name, std::map<std::string,size_t>* sfc_names = NULL); /// @brief /// @param surfaces The surface vector. - virtual bool appendSurfaceVec(const std::vector<GEOLIB::Surface*> &surfaces, + virtual bool appendSurfaceVec(const std::vector<GeoLib::Surface*> &surfaces, const std::string &name); virtual bool removeSurfaceVec(const std::string &name); /// Adds the name 'new_name' for the geo-object specified by the parameters - void addNameForElement(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id, std::string new_name); + void addNameForElement(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, size_t id, std::string new_name); /// Adds a generic name to all points that are part of the specified geo-object - void addNameForObjectPoints(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, const std::string &geo_object_name, const std::string &new_name); + void addNameForObjectPoints(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, const std::string &geo_object_name, const std::string &new_name); /// Calls all necessary functions to connect polyline-segments and update all views and windows. void connectPolylineSegments(const std::string &geoName, @@ -93,8 +93,8 @@ protected: private: signals: - void geoDataAdded(GeoTreeModel*, std::string, GEOLIB::GEOTYPE); - void geoDataRemoved(GeoTreeModel*, std::string, GEOLIB::GEOTYPE); + void geoDataAdded(GeoTreeModel*, std::string, GeoLib::GEOTYPE); + void geoDataRemoved(GeoTreeModel*, std::string, GeoLib::GEOTYPE); void stationVectorAdded(StationTreeModel* model, std::string name); void stationVectorRemoved(StationTreeModel* model, std::string name); diff --git a/Gui/DataView/GMSHPrefsDialog.cpp b/Gui/DataView/GMSHPrefsDialog.cpp index 9b4e5dde61f..144b4859ab0 100644 --- a/Gui/DataView/GMSHPrefsDialog.cpp +++ b/Gui/DataView/GMSHPrefsDialog.cpp @@ -17,11 +17,11 @@ #include "OGSError.h" -GMSHPrefsDialog::GMSHPrefsDialog(const GEOLIB::GEOObjects* geoObjects, QDialog* parent) +GMSHPrefsDialog::GMSHPrefsDialog(const GeoLib::GEOObjects* geoObjects, QDialog* parent) : QDialog(parent), _allGeo(new QStringListModel), _selGeo(new QStringListModel) { setupUi(this); - + // default parameters this->param1->setText("2"); this->param2->setText("0.3"); diff --git a/Gui/DataView/GMSHPrefsDialog.h b/Gui/DataView/GMSHPrefsDialog.h index 98b9ce5c2ae..6773c1a5108 100644 --- a/Gui/DataView/GMSHPrefsDialog.h +++ b/Gui/DataView/GMSHPrefsDialog.h @@ -11,7 +11,7 @@ class QStringListModel; -namespace GEOLIB +namespace GeoLib { class GEOObjects; } @@ -24,7 +24,7 @@ class GMSHPrefsDialog : public QDialog, private Ui_GMSHPrefs Q_OBJECT public: - GMSHPrefsDialog(const GEOLIB::GEOObjects* geoObjects, QDialog* parent = 0); + GMSHPrefsDialog(const GeoLib::GEOObjects* geoObjects, QDialog* parent = 0); ~GMSHPrefsDialog(void); private: diff --git a/Gui/DataView/GeoObjectListItem.h b/Gui/DataView/GeoObjectListItem.h index 19a848ff6ce..7ed4124e7ca 100644 --- a/Gui/DataView/GeoObjectListItem.h +++ b/Gui/DataView/GeoObjectListItem.h @@ -28,8 +28,8 @@ public: /// Constructor for the TreeItem specifying the "Points"-subtree of a geometry. GeoObjectListItem(const QList<QVariant> &data, TreeItem* parent, - const std::vector<GEOLIB::Point*>* geo_data = NULL, - GEOLIB::GEOTYPE type = GEOLIB::POINT) + const std::vector<GeoLib::Point*>* geo_data = NULL, + GeoLib::GEOTYPE type = GeoLib::POINT) : TreeItem(data, parent), _vtkSource(VtkPointsSource::New()), _type(type) { QString geo_name = parent->data(0).toString(); @@ -40,8 +40,8 @@ public: /// Constructor for the TreeItem specifying the "Polylines"-subtree of a geometry. GeoObjectListItem(const QList<QVariant> &data, TreeItem* parent, - const std::vector<GEOLIB::Polyline*>* geo_data = NULL, - GEOLIB::GEOTYPE type = GEOLIB::POLYLINE) + const std::vector<GeoLib::Polyline*>* geo_data = NULL, + GeoLib::GEOTYPE type = GeoLib::POLYLINE) : TreeItem(data, parent), _vtkSource(VtkPolylinesSource::New()), _type(type) { QString geo_name = parent->data(0).toString(); @@ -52,8 +52,8 @@ public: /// Constructor for the TreeItem specifying the "Surfaces"-subtree of a geometry. GeoObjectListItem(const QList<QVariant> &data, TreeItem* parent, - const std::vector<GEOLIB::Surface*>* geo_data = NULL, - GEOLIB::GEOTYPE type = GEOLIB::SURFACE) + const std::vector<GeoLib::Surface*>* geo_data = NULL, + GeoLib::GEOTYPE type = GeoLib::SURFACE) : TreeItem(data, parent), _vtkSource(VtkSurfacesSource::New()), _type(type) { QString geo_name = parent->data(0).toString(); @@ -67,7 +67,7 @@ public: } /// Returns the type of geo-objects contained in the subtree of this item. - GEOLIB::GEOTYPE getType() { return _type; } + GeoLib::GEOTYPE getType() { return _type; } /// Returns the Vtk polydata source object vtkPolyDataAlgorithm* vtkSource() const { return _vtkSource; } @@ -77,7 +77,7 @@ private: /// visualization pipeline. vtkPolyDataAlgorithm* _vtkSource; - GEOLIB::GEOTYPE _type; + GeoLib::GEOTYPE _type; }; #endif //GEOOBJECTLISTITEM_H diff --git a/Gui/DataView/GeoTreeItem.h b/Gui/DataView/GeoTreeItem.h index b9e091d79af..5cfdb2b1ab0 100644 --- a/Gui/DataView/GeoTreeItem.h +++ b/Gui/DataView/GeoTreeItem.h @@ -26,14 +26,14 @@ public: */ GeoTreeItem(const QList<QVariant> &data, TreeItem* parent, - const GEOLIB::GeoObject* item = NULL) : TreeItem(data, parent), _item(item) {} + const GeoLib::GeoObject* item = NULL) : TreeItem(data, parent), _item(item) {} ~GeoTreeItem() {} /// Returns the geo-object associated with this item (i.e. a point, polyline or surface). - const GEOLIB::GeoObject* getGeoObject() const { return _item; } + const GeoLib::GeoObject* getGeoObject() const { return _item; } private: - const GEOLIB::GeoObject* _item; + const GeoLib::GeoObject* _item; }; #endif //GEOTREEITEM_H diff --git a/Gui/DataView/GeoTreeModel.cpp b/Gui/DataView/GeoTreeModel.cpp index 3f48f3c4094..13b1df5f7dc 100644 --- a/Gui/DataView/GeoTreeModel.cpp +++ b/Gui/DataView/GeoTreeModel.cpp @@ -24,9 +24,9 @@ GeoTreeModel::~GeoTreeModel() { } -void GeoTreeModel::addPointList(QString geoName, const GEOLIB::PointVec* pointVec) +void GeoTreeModel::addPointList(QString geoName, const GeoLib::PointVec* pointVec) { - const std::vector<GEOLIB::Point*>* points = pointVec->getVector(); + const std::vector<GeoLib::Point*>* points = pointVec->getVector(); QList<QVariant> geoData; geoData << QVariant(geoName) << "" << "" << "" << ""; @@ -36,14 +36,14 @@ void GeoTreeModel::addPointList(QString geoName, const GEOLIB::PointVec* pointVe QList<QVariant> pointData; pointData << "Points" << "" << "" << "" << ""; - GeoObjectListItem* pointList = new GeoObjectListItem(pointData, geo, points, GEOLIB::POINT); + GeoObjectListItem* pointList = new GeoObjectListItem(pointData, geo, points, GeoLib::POINT); geo->appendChild(pointList); size_t nPoints = points->size(); for (size_t j = 0; j < nPoints; j++) { - const GEOLIB::Point &pnt(*(*points)[j]); + const GeoLib::Point &pnt(*(*points)[j]); std::string pnt_name(""); pointVec->getNameOfElementByID(j, pnt_name); QList<QVariant> pnt_data; @@ -52,7 +52,7 @@ void GeoTreeModel::addPointList(QString geoName, const GEOLIB::PointVec* pointVe << QString::number(pnt[1], 'f') << QString::number(pnt[2], 'f') << QString::fromStdString(pnt_name); - GeoTreeItem* point(new GeoTreeItem(pnt_data, pointList, static_cast<const GEOLIB::Point*>(&pnt))); + GeoTreeItem* point(new GeoTreeItem(pnt_data, pointList, static_cast<const GeoLib::Point*>(&pnt))); pointList->appendChild(point); } @@ -62,7 +62,7 @@ void GeoTreeModel::addPointList(QString geoName, const GEOLIB::PointVec* pointVe reset(); } -void GeoTreeModel::addPolylineList(QString geoName, const GEOLIB::PolylineVec* polylineVec) +void GeoTreeModel::addPolylineList(QString geoName, const GeoLib::PolylineVec* polylineVec) { int nLists = _rootItem->childCount(); TreeItem* geo(NULL); @@ -74,22 +74,22 @@ void GeoTreeModel::addPolylineList(QString geoName, const GEOLIB::PolylineVec* p if (geo == NULL) { - std::cout << "GeoTreeModel::addPolylineList() - Error: No corresponding geometry found..." + std::cout << "GeoTreeModel::addPolylineList() - Error: No corresponding geometry found..." << std::endl; return; } - const std::vector<GEOLIB::Polyline*>* lines = polylineVec->getVector(); + const std::vector<GeoLib::Polyline*>* lines = polylineVec->getVector(); QList<QVariant> plyData; plyData << "Polylines" << "" << "" << ""; - GeoObjectListItem* plyList = new GeoObjectListItem(plyData, geo, lines, GEOLIB::POLYLINE); + GeoObjectListItem* plyList = new GeoObjectListItem(plyData, geo, lines, GeoLib::POLYLINE); geo->appendChild(plyList); this->addChildren(plyList, polylineVec, 0, lines->size()); reset(); } -void GeoTreeModel::appendPolylines(const std::string &name, const GEOLIB::PolylineVec* polylineVec) +void GeoTreeModel::appendPolylines(const std::string &name, const GeoLib::PolylineVec* polylineVec) { for (size_t i = 0; i < _lists.size(); i++) { @@ -98,7 +98,7 @@ void GeoTreeModel::appendPolylines(const std::string &name, const GEOLIB::Polyli { GeoObjectListItem* parent = static_cast<GeoObjectListItem*>(_lists[i]->child(j)); - if (GEOLIB::POLYLINE == parent->getType()) + if (GeoLib::POLYLINE == parent->getType()) { this->addChildren(parent, polylineVec, parent->childCount(), @@ -113,11 +113,11 @@ void GeoTreeModel::appendPolylines(const std::string &name, const GEOLIB::Polyli } void GeoTreeModel::addChildren(GeoObjectListItem* plyList, - const GEOLIB::PolylineVec* polyline_vec, + const GeoLib::PolylineVec* polyline_vec, size_t start_index, size_t end_index) { - const std::vector<GEOLIB::Polyline*> lines = *(polyline_vec->getVector()); + const std::vector<GeoLib::Polyline*> lines = *(polyline_vec->getVector()); for (size_t i = start_index; i < end_index; i++) { @@ -127,18 +127,18 @@ void GeoTreeModel::addChildren(GeoObjectListItem* plyList, line_data << "Line " + QString::number(i) << QString::fromStdString(ply_name) << "" << ""; else line_data << "Line " + QString::number(i) << "" << "" << ""; - const GEOLIB::Polyline &line(*(lines[i])); + const GeoLib::Polyline &line(*(lines[i])); GeoTreeItem* lineItem(new GeoTreeItem(line_data, plyList, &line)); plyList->appendChild(lineItem); int nPoints = static_cast<int>(lines[i]->getNumberOfPoints()); for (int j = 0; j < nPoints; j++) { - const GEOLIB::Point pnt(*(line[j])); + const GeoLib::Point pnt(*(line[j])); QList<QVariant> pnt_data; pnt_data << static_cast<int>(line.getPointID(j)) - << QString::number(pnt[0], 'f') - << QString::number(pnt[1], 'f') + << QString::number(pnt[0], 'f') + << QString::number(pnt[1], 'f') << QString::number(pnt[2], 'f'); TreeItem* child(new TreeItem(pnt_data, lineItem)); lineItem->appendChild(child); @@ -147,7 +147,7 @@ void GeoTreeModel::addChildren(GeoObjectListItem* plyList, std::cout << end_index - start_index << " polylines added." << std::endl; } -void GeoTreeModel::addSurfaceList(QString geoName, const GEOLIB::SurfaceVec* surfaceVec) +void GeoTreeModel::addSurfaceList(QString geoName, const GeoLib::SurfaceVec* surfaceVec) { int nLists = _rootItem->childCount(); TreeItem* geo(NULL); @@ -159,23 +159,23 @@ void GeoTreeModel::addSurfaceList(QString geoName, const GEOLIB::SurfaceVec* sur if (geo == NULL) { - std::cout << "GeoTreeModel::addSurfaceList() - Error: No corresponding geometry found..." + std::cout << "GeoTreeModel::addSurfaceList() - Error: No corresponding geometry found..." << std::endl; return; } - const std::vector<GEOLIB::Surface*>* surfaces = surfaceVec->getVector(); + const std::vector<GeoLib::Surface*>* surfaces = surfaceVec->getVector(); QList<QVariant> sfcData; sfcData << "Surfaces" << "" << "" << ""; - GeoObjectListItem* sfcList = new GeoObjectListItem(sfcData, geo, surfaces, GEOLIB::SURFACE); + GeoObjectListItem* sfcList = new GeoObjectListItem(sfcData, geo, surfaces, GeoLib::SURFACE); geo->appendChild(sfcList); this->addChildren(sfcList, surfaceVec, 0, surfaces->size()); reset(); } -void GeoTreeModel::appendSurfaces(const std::string &name, GEOLIB::SurfaceVec* surfaceVec) +void GeoTreeModel::appendSurfaces(const std::string &name, GeoLib::SurfaceVec* surfaceVec) { for (size_t i = 0; i < _lists.size(); i++) { @@ -185,7 +185,7 @@ void GeoTreeModel::appendSurfaces(const std::string &name, GEOLIB::SurfaceVec* s for (int j = 0; j < nChildren; j++) { GeoObjectListItem* parent = static_cast<GeoObjectListItem*>(_lists[i]->child(j)); - if (GEOLIB::SURFACE == parent->getType()) + if (GeoLib::SURFACE == parent->getType()) { this->addChildren(parent, surfaceVec, parent->childCount(), @@ -201,13 +201,13 @@ void GeoTreeModel::appendSurfaces(const std::string &name, GEOLIB::SurfaceVec* s } void GeoTreeModel::addChildren(GeoObjectListItem* sfcList, - const GEOLIB::SurfaceVec* surface_vec, + const GeoLib::SurfaceVec* surface_vec, size_t start_index, size_t end_index) { - const std::vector<GEOLIB::Surface*>* surfaces = surface_vec->getVector(); + const std::vector<GeoLib::Surface*>* surfaces = surface_vec->getVector(); - const std::vector<GEOLIB::Point*> &nodesVec(*((*surfaces)[start_index]->getPointVec())); + const std::vector<GeoLib::Point*> &nodesVec(*((*surfaces)[start_index]->getPointVec())); for (size_t i = start_index; i < end_index; i++) { QList<QVariant> surface; @@ -215,7 +215,7 @@ void GeoTreeModel::addChildren(GeoObjectListItem* sfcList, surface_vec->getNameOfElementByID(i, sfc_name); surface << "Surface " + QString::number(i) << QString::fromStdString(sfc_name) << "" << ""; - const GEOLIB::Surface &sfc(*(*surfaces)[i]); + const GeoLib::Surface &sfc(*(*surfaces)[i]); GeoTreeItem* surfaceItem(new GeoTreeItem(surface, sfcList, &sfc)); sfcList->appendChild(surfaceItem); @@ -223,9 +223,9 @@ void GeoTreeModel::addChildren(GeoObjectListItem* sfcList, for (int j = 0; j < nElems; j++) { QList<QVariant> elem; - const GEOLIB::Triangle &triangle(*sfc[j]); - elem << j << static_cast<int>(triangle[0]) - << static_cast<int>(triangle[1]) + const GeoLib::Triangle &triangle(*sfc[j]); + elem << j << static_cast<int>(triangle[0]) + << static_cast<int>(triangle[1]) << static_cast<int>(triangle[2]); TreeItem* child(new TreeItem(elem, surfaceItem)); surfaceItem->appendChild(child); @@ -233,10 +233,10 @@ void GeoTreeModel::addChildren(GeoObjectListItem* sfcList, for (int k = 0; k < 3; k++) { QList<QVariant> node; - const GEOLIB::Point &pnt(*(nodesVec[triangle[k]])); - node << static_cast<int>(triangle[k]) - << QString::number(pnt[0], 'f') - << QString::number(pnt[1], 'f') + const GeoLib::Point &pnt(*(nodesVec[triangle[k]])); + node << static_cast<int>(triangle[k]) + << QString::number(pnt[0], 'f') + << QString::number(pnt[1], 'f') << QString::number(pnt[2], 'f'); TreeItem* nchild(new TreeItem(node, child)); child->appendChild(nchild); @@ -249,7 +249,7 @@ void GeoTreeModel::addChildren(GeoObjectListItem* sfcList, /** * Removes the TreeItem with the given name including all its children */ -void GeoTreeModel::removeGeoList(const std::string &name, GEOLIB::GEOTYPE type) +void GeoTreeModel::removeGeoList(const std::string &name, GeoLib::GEOTYPE type) { for (size_t i = 0; i < _lists.size(); i++) if ( name.compare( _lists[i]->data(0).toString().toStdString() ) == 0 ) @@ -271,7 +271,7 @@ void GeoTreeModel::removeGeoList(const std::string &name, GEOLIB::GEOTYPE type) } } -vtkPolyDataAlgorithm* GeoTreeModel::vtkSource(const std::string &name, GEOLIB::GEOTYPE type) const +vtkPolyDataAlgorithm* GeoTreeModel::vtkSource(const std::string &name, GeoLib::GEOTYPE type) const { size_t nLists = _lists.size(); for (size_t i = 0; i < nLists; i++) @@ -288,24 +288,24 @@ vtkPolyDataAlgorithm* GeoTreeModel::vtkSource(const std::string &name, GEOLIB::G return NULL; } -void GeoTreeModel::setNameForItem(const std::string &name, GEOLIB::GEOTYPE type, size_t id, std::string item_name) +void GeoTreeModel::setNameForItem(const std::string &name, GeoLib::GEOTYPE type, size_t id, std::string item_name) { int type_idx(0); int col_idx(1); switch(type) { - case GEOLIB::POINT: + case GeoLib::POINT: type_idx = 0; col_idx = 4; // for points the name is at a different position break; - case GEOLIB::POLYLINE: + case GeoLib::POLYLINE: type_idx = 1; break; - case GEOLIB::SURFACE: + case GeoLib::SURFACE: type_idx = 2; break; - case GEOLIB::VOLUME: + case GeoLib::VOLUME: type_idx = 3; break; default: diff --git a/Gui/DataView/GeoTreeModel.h b/Gui/DataView/GeoTreeModel.h index 8da296ec245..283cace1700 100644 --- a/Gui/DataView/GeoTreeModel.h +++ b/Gui/DataView/GeoTreeModel.h @@ -15,7 +15,7 @@ #include "TreeModel.h" #include <vtkPolyDataAlgorithm.h> -namespace GEOLIB +namespace GeoLib { class GeoObject; } @@ -42,24 +42,24 @@ public: * \param geoName Name of the new subtree. If no name is given a default name is assigned. * \param pointVec The list of points to be added as children of that subtree (no geometry can be added with a set of points!) */ - void addPointList(QString geoName, const GEOLIB::PointVec* pointVec); + void addPointList(QString geoName, const GeoLib::PointVec* pointVec); /// Adds a subtree "Polylines" to an existing geometry with the given name. - void addPolylineList(QString geoName, const GEOLIB::PolylineVec* polylineVec); + void addPolylineList(QString geoName, const GeoLib::PolylineVec* polylineVec); /// Appends polylines to the "Polyline"-subtree - void appendPolylines(const std::string &name, const GEOLIB::PolylineVec* polylineVec); + void appendPolylines(const std::string &name, const GeoLib::PolylineVec* polylineVec); /// Adds a subtree "Surfaces" to an existing geometry with the given name. - void addSurfaceList(QString geoName, const GEOLIB::SurfaceVec* surfaceVec); + void addSurfaceList(QString geoName, const GeoLib::SurfaceVec* surfaceVec); /// Appends surfaces to the "Surface"-subtree - void appendSurfaces(const std::string &name, GEOLIB::SurfaceVec* surfaceVec); + void appendSurfaces(const std::string &name, GeoLib::SurfaceVec* surfaceVec); /// Returns a list of all existing geometries. const std::vector<GeoTreeItem*> &getLists() { return _lists; } /** * Removes a geometry (points, polylines & surfaces) or just a specified subtree indicated by type. * Note that points cannot be deleted as long as other objects exist that depend on them. */ - void removeGeoList(const std::string &name, GEOLIB::GEOTYPE type = GEOLIB::INVALID); + void removeGeoList(const std::string &name, GeoLib::GEOTYPE type = GeoLib::INVALID); - void setNameForItem(const std::string &name, GEOLIB::GEOTYPE type, size_t id, std::string item_name); + void setNameForItem(const std::string &name, GeoLib::GEOTYPE type, size_t id, std::string item_name); /* * Returns the geo-object specified by the given index. @@ -67,21 +67,21 @@ public: * \param listName Here, the method will put the name of the geometry this object belongs to. * \return A geo-object (Point / Polyline / Surface) */ - //const GEOLIB::GeoObject* objectFromIndex( const QModelIndex& index, QString &geoName ) const; + //const GeoLib::GeoObject* objectFromIndex( const QModelIndex& index, QString &geoName ) const; /// Returns the vtk-object indicated by type of the geometry indicated by name. - vtkPolyDataAlgorithm* vtkSource(const std::string &name, GEOLIB::GEOTYPE type) const; + vtkPolyDataAlgorithm* vtkSource(const std::string &name, GeoLib::GEOTYPE type) const; private: /// Adds children to the "Polylines" node void addChildren(GeoObjectListItem* plyList, - const GEOLIB::PolylineVec* polyline_vec, + const GeoLib::PolylineVec* polyline_vec, size_t start_index, size_t end_index); /// Adds children to the "Surfaces" node void addChildren(GeoObjectListItem* sfcList, - const GEOLIB::SurfaceVec* surface_vec, + const GeoLib::SurfaceVec* surface_vec, size_t start_index, size_t end_index); diff --git a/Gui/DataView/GeoTreeView.cpp b/Gui/DataView/GeoTreeView.cpp index 1623bc19bdc..9231d1c89cf 100644 --- a/Gui/DataView/GeoTreeView.cpp +++ b/Gui/DataView/GeoTreeView.cpp @@ -75,7 +75,7 @@ void GeoTreeView::contextMenuEvent( QContextMenuEvent* event ) if (list != NULL) { QAction* connectPlyAction(NULL); - if (list->getType() == GEOLIB::POLYLINE) + if (list->getType() == GeoLib::POLYLINE) { connectPlyAction = menu.addAction("Connect Polylines..."); connect(connectPlyAction, SIGNAL(triggered()), this, @@ -103,7 +103,7 @@ void GeoTreeView::contextMenuEvent( QContextMenuEvent* event ) connect(addCondAction, SIGNAL(triggered()), this, SLOT(setObjectAsCondition())); connect(addNameAction, SIGNAL(triggered()), this, SLOT(setNameForElement())); - if (parent->getType() == GEOLIB::POINT) + if (parent->getType() == GeoLib::POINT) addCondPointAction->setEnabled(false); else connect(addCondPointAction, SIGNAL(triggered()), this, SLOT(setObjectPointsAsCondition())); @@ -147,7 +147,7 @@ void GeoTreeView::removeList() emit listRemoved((item->parentItem()->data( 0).toString()).toStdString(), list->getType()); else - emit listRemoved((item->data(0).toString()).toStdString(), GEOLIB::INVALID); + emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::INVALID); } void GeoTreeView::setElementAsCondition(bool set_on_points) @@ -155,7 +155,7 @@ void GeoTreeView::setElementAsCondition(bool set_on_points) const TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem( this->selectionModel()->currentIndex()); const size_t id = item->row(); - const GEOLIB::GEOTYPE type = static_cast<GeoObjectListItem*>(item->parentItem())->getType(); + const GeoLib::GEOTYPE type = static_cast<GeoObjectListItem*>(item->parentItem())->getType(); const std::string geometry_name = item->parentItem()->parentItem()->data(0).toString().toStdString(); emit requestCondSetupDialog(geometry_name, type, id, set_on_points); } @@ -165,7 +165,7 @@ void GeoTreeView::setNameForElement() const TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem( this->selectionModel()->currentIndex()); const size_t id = item->row(); - const GEOLIB::GEOTYPE type = static_cast<GeoObjectListItem*>(item->parentItem())->getType(); + const GeoLib::GEOTYPE type = static_cast<GeoObjectListItem*>(item->parentItem())->getType(); const std::string geometry_name = item->parentItem()->parentItem()->data(0).toString().toStdString(); emit requestNameChangeDialog(geometry_name, type, id); } diff --git a/Gui/DataView/GeoTreeView.h b/Gui/DataView/GeoTreeView.h index 376d2f9080b..3b5d942c392 100644 --- a/Gui/DataView/GeoTreeView.h +++ b/Gui/DataView/GeoTreeView.h @@ -62,12 +62,12 @@ signals: void geoItemSelected(const vtkPolyDataAlgorithm*, int); void removeGeoItemSelection(); //void itemSelectionChanged(const QItemSelection & selected, const QItemSelection & deselected); - void listRemoved(std::string name, GEOLIB::GEOTYPE); + void listRemoved(std::string name, GeoLib::GEOTYPE); void loadFEMCondFileRequested(std::string); void saveToFileRequested(QString, QString) const; - void requestCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, const size_t, bool on_points); + void requestCondSetupDialog(const std::string&, const GeoLib::GEOTYPE, const size_t, bool on_points); void requestLineEditDialog(const std::string&); - void requestNameChangeDialog(const std::string&, const GEOLIB::GEOTYPE, const size_t); + void requestNameChangeDialog(const std::string&, const GeoLib::GEOTYPE, const size_t); //void saveFEMConditionsRequested(QString, QString); }; diff --git a/Gui/DataView/LineEditDialog.cpp b/Gui/DataView/LineEditDialog.cpp index a063e471a88..814144517a5 100644 --- a/Gui/DataView/LineEditDialog.cpp +++ b/Gui/DataView/LineEditDialog.cpp @@ -8,7 +8,7 @@ #include <QStringList> #include <QStringListModel> -LineEditDialog::LineEditDialog(const GEOLIB::PolylineVec &ply_vec, QDialog* parent) +LineEditDialog::LineEditDialog(const GeoLib::PolylineVec &ply_vec, QDialog* parent) : QDialog(parent), _allPly(new QStringListModel), _selPly(new QStringListModel), _geoName(ply_vec.getName()) { diff --git a/Gui/DataView/LineEditDialog.h b/Gui/DataView/LineEditDialog.h index 048be457e34..f5729fa3967 100644 --- a/Gui/DataView/LineEditDialog.h +++ b/Gui/DataView/LineEditDialog.h @@ -23,7 +23,7 @@ class LineEditDialog : public QDialog, private Ui_LineEdit Q_OBJECT public: - LineEditDialog(const GEOLIB::PolylineVec &ply_vec, QDialog* parent = 0); + LineEditDialog(const GeoLib::PolylineVec &ply_vec, QDialog* parent = 0); ~LineEditDialog(void); private: @@ -53,7 +53,7 @@ signals: std::string, bool, bool); - void triangulateSurface(const GEOLIB::Polyline); + void triangulateSurface(const GeoLib::Polyline); }; #endif //LINEEDITDIALOG_H diff --git a/Gui/DataView/LinearEditDialog.cpp b/Gui/DataView/LinearEditDialog.cpp index f23b82573f5..5fac3f7ff03 100644 --- a/Gui/DataView/LinearEditDialog.cpp +++ b/Gui/DataView/LinearEditDialog.cpp @@ -5,7 +5,7 @@ #include "LinearEditDialog.h" -LinearEditDialog::LinearEditDialog(const GEOLIB::Polyline &line, const std::vector<size_t> &dis_nodes, const std::vector<double> &dis_values, QDialog* parent) +LinearEditDialog::LinearEditDialog(const GeoLib::Polyline &line, const std::vector<size_t> &dis_nodes, const std::vector<double> &dis_values, QDialog* parent) : QDialog(parent), _line(line) { setupUi(this); diff --git a/Gui/DataView/LinearEditDialog.h b/Gui/DataView/LinearEditDialog.h index 41fde93c145..39dde70d11d 100644 --- a/Gui/DataView/LinearEditDialog.h +++ b/Gui/DataView/LinearEditDialog.h @@ -19,13 +19,13 @@ class LinearEditDialog : public QDialog, private Ui_LinearEdit Q_OBJECT public: - LinearEditDialog(const GEOLIB::Polyline &line, const std::vector<size_t> &dis_nodes, const std::vector<double> &dis_values, QDialog* parent = 0); + LinearEditDialog(const GeoLib::Polyline &line, const std::vector<size_t> &dis_nodes, const std::vector<double> &dis_values, QDialog* parent = 0); ~LinearEditDialog(void); private: void setupDialog(const std::vector<size_t> &dis_nodes, const std::vector<double> &dis_values); - const GEOLIB::Polyline _line; + const GeoLib::Polyline _line; private slots: void on_comboBox_currentIndexChanged(int index); @@ -35,7 +35,7 @@ private slots: /// Instructions if the Cancel-Button has been pressed. void reject(); - + signals: void transmitDisValues(std::vector< std::pair<size_t,double> >); }; diff --git a/Gui/DataView/ListPropertiesDialog.cpp b/Gui/DataView/ListPropertiesDialog.cpp index 8c34807388b..eec0926d0c6 100644 --- a/Gui/DataView/ListPropertiesDialog.cpp +++ b/Gui/DataView/ListPropertiesDialog.cpp @@ -42,10 +42,10 @@ void ListPropertiesDialog::setupDialog() int i = 0; double minVal = 0, maxVal = 0; - const std::vector<GEOLIB::Point*>* stations ( _geoModels->getStationVec(_listName)); + const std::vector<GeoLib::Point*>* stations ( _geoModels->getStationVec(_listName)); std::map<std::string, - double> properties = static_cast<GEOLIB::Station*>((*stations)[0])->getProperties(); + double> properties = static_cast<GeoLib::Station*>((*stations)[0])->getProperties(); QGridLayout* layout = new QGridLayout; setWindowTitle("List Properties"); @@ -88,7 +88,7 @@ void ListPropertiesDialog::setupDialog() setLayout(layout); } -int ListPropertiesDialog::getPropertyBounds(const std::vector<GEOLIB::Point*>* stations, +int ListPropertiesDialog::getPropertyBounds(const std::vector<GeoLib::Point*>* stations, const std::string &prop, double &minVal, double &maxVal) @@ -96,14 +96,14 @@ int ListPropertiesDialog::getPropertyBounds(const std::vector<GEOLIB::Point*>* s if (!stations->empty()) { std::map<std::string, double> properties ( - static_cast<GEOLIB::Station*>((*stations)[0])->getProperties()); + static_cast<GeoLib::Station*>((*stations)[0])->getProperties()); minVal = properties[prop]; maxVal = properties[prop]; size_t size = stations->size(); for (size_t i = 1; i < size; i++) { - properties = static_cast<GEOLIB::Station*>((*stations)[i])->getProperties(); + properties = static_cast<GeoLib::Station*>((*stations)[i])->getProperties(); if (minVal > properties[prop]) minVal = properties[prop]; if (maxVal < properties[prop]) diff --git a/Gui/DataView/ListPropertiesDialog.h b/Gui/DataView/ListPropertiesDialog.h index 540af179e55..1aba2010a5f 100644 --- a/Gui/DataView/ListPropertiesDialog.h +++ b/Gui/DataView/ListPropertiesDialog.h @@ -30,7 +30,7 @@ public: ~ListPropertiesDialog(); private: - int getPropertyBounds(const std::vector<GEOLIB::Point*>* stations, + int getPropertyBounds(const std::vector<GeoLib::Point*>* stations, const std::string &prop, double &minVal, double &maxVal); diff --git a/Gui/DataView/ModelTreeItem.h b/Gui/DataView/ModelTreeItem.h index 9f149aefc61..ed51ba404fe 100644 --- a/Gui/DataView/ModelTreeItem.h +++ b/Gui/DataView/ModelTreeItem.h @@ -28,20 +28,20 @@ public: ~ModelTreeItem() { delete _item; } /// Returns the station object from which this item has been constructed - GEOLIB::Station* getStation() { return _stn; } + GeoLib::Station* getStation() { return _stn; } /// Returns the BaseItem associated with this item BaseItem* getItem() const; /// Associates a station object with this item - void setStation(GEOLIB::Station* stn) { _stn = stn; } + void setStation(GeoLib::Station* stn) { _stn = stn; } /// Associates a BaseItem with this item void setItem( BaseItem* item ) { _item = item; } private: BaseItem* _item; - GEOLIB::Station* _stn; + GeoLib::Station* _stn; }; #endif //QMODELTREEITEM_H diff --git a/Gui/DataView/MshLayerMapper.cpp b/Gui/DataView/MshLayerMapper.cpp index 31cdd370a68..71a19184a4e 100644 --- a/Gui/DataView/MshLayerMapper.cpp +++ b/Gui/DataView/MshLayerMapper.cpp @@ -44,8 +44,8 @@ MeshLib::CFEMesh* MshLayerMapper::CreateLayers(const MeshLib::CFEMesh* mesh, { const double* coords = mesh->nod_vector[i]->getData(); new_mesh->nod_vector.push_back( new MeshLib::CNode(node_offset + i, - coords[0], - coords[1], + coords[0], + coords[1], coords[2]-z_offset) ); } @@ -148,7 +148,7 @@ int MshLayerMapper::LayerMapping(MeshLib::CFEMesh* new_mesh, const size_t yIdx (static_cast<size_t>(floor(yPos))); // deviation of mesh node from centre of raster cell ( in [-1:1) because it is normalised by delta/2 ) - const double xShift = (xPos-xIdx-half_delta)/half_delta; + const double xShift = (xPos-xIdx-half_delta)/half_delta; const double yShift = (yPos-yIdx-half_delta)/half_delta; const int xShiftIdx = (xShift>=0) ? ceil(xShift) : floor(xShift); @@ -266,7 +266,7 @@ MeshLib::CFEMesh* MshLayerMapper::blendLayersWithSurface(MeshLib::CFEMesh* mesh, const size_t nNodesPerLayer = nNodes / (nLayers+1); std::vector<bool> is_surface_node(nNodes, false); std::vector<bool> nodes_below_surface(nNodes, false); - + // check if bottom layer nodes are below DEM const size_t bottom_firstNode = nLayers * nNodesPerLayer; const size_t bottom_lastNode = bottom_firstNode + nNodesPerLayer; @@ -312,16 +312,16 @@ MeshLib::CFEMesh* MshLayerMapper::blendLayersWithSurface(MeshLib::CFEMesh* mesh, } } - std::vector<GEOLIB::Point*> *nodes = new std::vector<GEOLIB::Point*>; + std::vector<GeoLib::Point*> *nodes = new std::vector<GeoLib::Point*>; std::vector<int> node_index_map(nNodes, -1); size_t node_count(0); for (size_t j=0; j<nNodes; j++) { if (nodes_below_surface[j]) { - nodes->push_back(new GEOLIB::Point(mesh->nod_vector[j]->getData())); + nodes->push_back(new GeoLib::Point(mesh->nod_vector[j]->getData())); node_index_map[j]=node_count++; - } + } } const size_t nElems = mesh->ele_vector.size(); @@ -329,11 +329,11 @@ MeshLib::CFEMesh* MshLayerMapper::blendLayersWithSurface(MeshLib::CFEMesh* mesh, for (size_t j=0; j<nElems; j++) { const MeshLib::CElem* elem = mesh->ele_vector[j]; - + size_t count(0); for (size_t i=0; i<6; i++) // check top surface of prism if (nodes_below_surface[elem->GetNodeIndex(i)]) count++; - + if (count==6) // copy prism elements if all six nodes are valid { GridAdapter::Element* prism = new GridAdapter::Element; diff --git a/Gui/DataView/ProcessModel.cpp b/Gui/DataView/ProcessModel.cpp index 806c6f7b179..ed98be29a2f 100644 --- a/Gui/DataView/ProcessModel.cpp +++ b/Gui/DataView/ProcessModel.cpp @@ -53,7 +53,7 @@ void ProcessModel::addConditionItem(FEMCondition* c) condParent->addCondition(c); QList<QVariant> condData; - condData << QString::fromStdString(c->getGeoName()) + condData << QString::fromStdString(c->getGeoName()) << QString::fromStdString(c->getGeoTypeAsString()); CondItem* condItem = new CondItem(condData, condParent, c); condParent->appendChild(condItem); @@ -96,11 +96,11 @@ void ProcessModel::addConditionItem(FEMCondition* c) void ProcessModel::addCondition(FEMCondition* condition) { - bool is_domain = (condition->getGeoType() == GEOLIB::GEODOMAIN) ? true : false; + bool is_domain = (condition->getGeoType() == GeoLib::GEODOMAIN) ? true : false; // HACK: direct source terms are not domain conditions but they also don't contain geo-object-names if (condition->getProcessDistributionType() == FiniteElement::DIRECT) is_domain = true; - const GEOLIB::GeoObject* object = condition->getGeoObj(); + const GeoLib::GeoObject* object = condition->getGeoObj(); if (object == NULL) { object = _project.getGEOObjects()->getGEOObject( @@ -116,7 +116,7 @@ void ProcessModel::addCondition(FEMCondition* condition) } else std::cout << "Error in ProcessModel::addConditions() - Specified geometrical object \"" - << condition->getGeoName() << "\" not found in associated geometry..." + << condition->getGeoName() << "\" not found in associated geometry..." << std::endl; } @@ -140,8 +140,8 @@ ProcessItem* ProcessModel::addProcess(ProcessInfo *pcs) } else { - std::cout << "Warning in ProcessModel::addProcess() - " - << FiniteElement::convertProcessTypeToString(pcs->getProcessType()) + std::cout << "Warning in ProcessModel::addProcess() - " + << FiniteElement::convertProcessTypeToString(pcs->getProcessType()) << " already exists." << std::endl; return NULL; } @@ -173,7 +173,7 @@ void ProcessModel::removeFEMConditions(const FiniteElement::ProcessType pcs_type void ProcessModel::removeProcess(const FiniteElement::ProcessType type) { this->removeFEMConditions(type, "", FEMCondition::UNSPECIFIED); - + const ProcessItem* processParent = this->getProcessParent(type); if (processParent) { @@ -194,16 +194,16 @@ void ProcessModel::removeAllProcesses() } int ProcessModel::getGEOIndex(const std::string &geo_name, - GEOLIB::GEOTYPE type, + GeoLib::GEOTYPE type, const std::string &obj_name) const { bool exists(false); size_t idx(0); - if (type == GEOLIB::POINT) + if (type == GeoLib::POINT) exists = this->_project.getGEOObjects()->getPointVecObj(geo_name)->getElementIDByName(obj_name, idx); - else if (type == GEOLIB::POLYLINE) + else if (type == GeoLib::POLYLINE) exists = this->_project.getGEOObjects()->getPolylineVecObj(geo_name)->getElementIDByName(obj_name,idx); - else if (type == GEOLIB::SURFACE) + else if (type == GeoLib::SURFACE) exists = this->_project.getGEOObjects()->getSurfaceVecObj(geo_name)->getElementIDByName(obj_name,idx); if (exists) @@ -236,7 +236,7 @@ CondObjectListItem* ProcessModel::createCondParent(ProcessItem* parent, FEMCondi QList<QVariant> condData; condData << condType << ""; - const std::vector<GEOLIB::Point*>* pnts = _project.getGEOObjects()->getPointVec(cond->getAssociatedGeometryName()); + const std::vector<GeoLib::Point*>* pnts = _project.getGEOObjects()->getPointVec(cond->getAssociatedGeometryName()); if (pnts) { CondObjectListItem* cond_list = new CondObjectListItem(condData, parent, cond, pnts); diff --git a/Gui/DataView/ProcessModel.h b/Gui/DataView/ProcessModel.h index ff445aaa286..0f98a59882d 100644 --- a/Gui/DataView/ProcessModel.h +++ b/Gui/DataView/ProcessModel.h @@ -15,7 +15,7 @@ class ProcessItem; class CondObjectListItem; class vtkPolyDataAlgorithm; -namespace GEOLIB +namespace GeoLib { class GeoObject; } @@ -77,7 +77,7 @@ private: /// Returns the index of a geometric item of the given name and type for the associated geometry. int getGEOIndex(const std::string &geo_name, - GEOLIB::GEOTYPE type, + GeoLib::GEOTYPE type, const std::string &obj_name) const; ProjectData& _project; diff --git a/Gui/DataView/SelectMeshDialog.cpp b/Gui/DataView/SelectMeshDialog.cpp index 7d80b9820d6..32dd7890545 100644 --- a/Gui/DataView/SelectMeshDialog.cpp +++ b/Gui/DataView/SelectMeshDialog.cpp @@ -11,7 +11,7 @@ #include <QComboBox> #include <QVBoxLayout> -SelectMeshDialog::SelectMeshDialog(const GEOLIB::GeoObject* geo_object, const std::list<std::string> &msh_names, QDialog* parent) : +SelectMeshDialog::SelectMeshDialog(const GeoLib::GeoObject* geo_object, const std::list<std::string> &msh_names, QDialog* parent) : QDialog(parent), _geo_object(geo_object) { setupDialog(msh_names); @@ -51,7 +51,7 @@ void SelectMeshDialog::setupDialog(const std::list<std::string> &msh_names) void SelectMeshDialog::accept() { - //emit requestNameChange(_parent_name, GEOLIB::convertGeoType(_object_type_name), _id, _new_name->text().toStdString()); + //emit requestNameChange(_parent_name, GeoLib::convertGeoType(_object_type_name), _id, _new_name->text().toStdString()); this->done(QDialog::Accepted); } diff --git a/Gui/DataView/SelectMeshDialog.h b/Gui/DataView/SelectMeshDialog.h index a64cf195e6d..58268415fb4 100644 --- a/Gui/DataView/SelectMeshDialog.h +++ b/Gui/DataView/SelectMeshDialog.h @@ -8,7 +8,7 @@ #include <QDialog> -namespace GEOLIB { +namespace GeoLib { class GeoObject; } @@ -26,8 +26,8 @@ class SelectMeshDialog : public QDialog public: /// Constructor - SelectMeshDialog(const GEOLIB::GeoObject* geo_object, - const std::list<std::string> &msh_names, + SelectMeshDialog(const GeoLib::GeoObject* geo_object, + const std::list<std::string> &msh_names, QDialog* parent = 0); ~SelectMeshDialog(); @@ -40,7 +40,7 @@ private: QLabel* _txt_label; QComboBox* _msh_names; QVBoxLayout* _layout; - const GEOLIB::GeoObject* _geo_object; + const GeoLib::GeoObject* _geo_object; private slots: @@ -51,7 +51,7 @@ private slots: void reject(); signals: - //void requestNameChange(const std::string&, const GEOLIB::GEOTYPE, size_t, std::string); + //void requestNameChange(const std::string&, const GeoLib::GEOTYPE, size_t, std::string); }; #endif //SELECTMESHDIALOG_H diff --git a/Gui/DataView/SetNameDialog.cpp b/Gui/DataView/SetNameDialog.cpp index 2f0ffb19468..ad15a93b53c 100644 --- a/Gui/DataView/SetNameDialog.cpp +++ b/Gui/DataView/SetNameDialog.cpp @@ -47,7 +47,7 @@ void SetNameDialog::setupDialog(const std::string &old_name) void SetNameDialog::accept() { - emit requestNameChange(_parent_name, GEOLIB::convertGeoType(_object_type_name), _id, _new_name->text().toStdString()); + emit requestNameChange(_parent_name, GeoLib::convertGeoType(_object_type_name), _id, _new_name->text().toStdString()); this->done(QDialog::Accepted); } diff --git a/Gui/DataView/SetNameDialog.h b/Gui/DataView/SetNameDialog.h index 9b95132d410..b55a8318ab3 100644 --- a/Gui/DataView/SetNameDialog.h +++ b/Gui/DataView/SetNameDialog.h @@ -24,10 +24,10 @@ class SetNameDialog : public QDialog public: /// Constructor - SetNameDialog(const std::string &parent_name, - const std::string &object_type_name, - size_t id, - const std::string &old_name, + SetNameDialog(const std::string &parent_name, + const std::string &object_type_name, + size_t id, + const std::string &old_name, QDialog* parent = 0); ~SetNameDialog(); @@ -53,7 +53,7 @@ private slots: void reject(); signals: - void requestNameChange(const std::string&, const GEOLIB::GEOTYPE, size_t, std::string); + void requestNameChange(const std::string&, const GeoLib::GEOTYPE, size_t, std::string); }; #endif //SETNAMEDIALOG_H diff --git a/Gui/DataView/StationTreeModel.cpp b/Gui/DataView/StationTreeModel.cpp index 9f206c5b6e0..204e0545f6d 100644 --- a/Gui/DataView/StationTreeModel.cpp +++ b/Gui/DataView/StationTreeModel.cpp @@ -85,7 +85,7 @@ QModelIndex StationTreeModel::index( int row, int column, * \param listName Here, the method will put the name of the list this station belongs to. * \return The station object associated with the tree item */ -GEOLIB::Station* StationTreeModel::stationFromIndex( const QModelIndex& index, +GeoLib::Station* StationTreeModel::stationFromIndex( const QModelIndex& index, QString &listName ) const { if (index.isValid()) @@ -113,7 +113,7 @@ vtkPolyDataAlgorithm* StationTreeModel::vtkSource(const std::string &name) const * \param listName Name of the new subtree. If no name is given a default name is assigned. * \param stations The list with stations to be added as children of that subtree */ -void StationTreeModel::addStationList(QString listName, const std::vector<GEOLIB::Point*>* stations) +void StationTreeModel::addStationList(QString listName, const std::vector<GeoLib::Point*>* stations) { QList<QVariant> grpName; if (listName.compare("") == 0) // if no name is given a default name is assigned @@ -134,7 +134,7 @@ void StationTreeModel::addStationList(QString listName, const std::vector<GEOLIB for (int i = 0; i < vectorSize; i++) { QList<QVariant> stn; - stn.push_back(QVariant(QString::fromStdString(static_cast<GEOLIB::Station*>((* + stn.push_back(QVariant(QString::fromStdString(static_cast<GeoLib::Station*>((* stations) [i])-> getName()))); @@ -143,7 +143,7 @@ void StationTreeModel::addStationList(QString listName, const std::vector<GEOLIB stn.push_back(QVariant(QString::number((*(*stations)[i])[2],'f'))); ModelTreeItem* child = new ModelTreeItem(stn, group); - child->setStation(static_cast<GEOLIB::Station*>((*stations)[i])); + child->setStation(static_cast<GeoLib::Station*>((*stations)[i])); group->appendChild(child); } @@ -219,14 +219,14 @@ void StationTreeModel::removeStationList(const std::string &name) * If no station in the list fulfills the given description an error msg is given. */ void StationTreeModel::filterStations(const std::string &listName, - const std::vector<GEOLIB::Point*>* stations, + const std::vector<GeoLib::Point*>* stations, const std::vector<PropertyBounds> &bounds) { - std::vector<GEOLIB::Point*>* filteredStations = new std::vector<GEOLIB::Point*>; + std::vector<GeoLib::Point*>* filteredStations = new std::vector<GeoLib::Point*>; size_t vectorSize = stations->size(); for (size_t i = 0; i < vectorSize; i++) - if (static_cast<GEOLIB::Station*>((*stations)[i])->inSelection(bounds)) + if (static_cast<GeoLib::Station*>((*stations)[i])->inSelection(bounds)) filteredStations->push_back((*stations)[i]); if (filteredStations->empty()) diff --git a/Gui/DataView/StationTreeModel.h b/Gui/DataView/StationTreeModel.h index 4d0c5fe82d6..01d26228682 100644 --- a/Gui/DataView/StationTreeModel.h +++ b/Gui/DataView/StationTreeModel.h @@ -13,7 +13,7 @@ #include "TreeModel.h" #include <vtkPolyDataAlgorithm.h> -namespace GEOLIB +namespace GeoLib { class Station; class StationBorehole; @@ -38,16 +38,16 @@ public: StationTreeModel(QObject* parent = 0); ~StationTreeModel(); - void addStationList(QString listName, const std::vector<GEOLIB::Point*>* stations); + void addStationList(QString listName, const std::vector<GeoLib::Point*>* stations); void filterStations(const std::string &name, - const std::vector<GEOLIB::Point*>* stations, + const std::vector<GeoLib::Point*>* stations, const std::vector<PropertyBounds> &bounds); const std::vector<ModelTreeItem*> &getLists() { return _lists; } QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; //BaseItem* itemFromIndex( const QModelIndex& index ) const; void removeStationList(QModelIndex index); void removeStationList(const std::string &name); - GEOLIB::Station* stationFromIndex( const QModelIndex& index, QString &listName ) const; + GeoLib::Station* stationFromIndex( const QModelIndex& index, QString &listName ) const; vtkPolyDataAlgorithm* vtkSource(const std::string &name) const; private: diff --git a/Gui/DataView/StationTreeView.cpp b/Gui/DataView/StationTreeView.cpp index 376b76a67a7..3fffe37a191 100644 --- a/Gui/DataView/StationTreeView.cpp +++ b/Gui/DataView/StationTreeView.cpp @@ -89,7 +89,7 @@ void StationTreeView::contextMenuEvent( QContextMenuEvent* event ) if (static_cast<StationTreeModel*>(model())->stationFromIndex(index, temp_name)->type() == - GEOLIB::Station::BOREHOLE) + GeoLib::Station::BOREHOLE) { QAction* stratAction = menu.addAction("Display Stratigraphy..."); QAction* exportAction = menu.addAction("Export to GMS..."); @@ -118,13 +118,13 @@ void StationTreeView::displayStratigraphy() this->selectionModel()->currentIndex(), temp_name); // get color table (horrible way to do it but there you go ...) std::map<std::string, - GEOLIB::Color*> colorLookupTable = + GeoLib::Color*> colorLookupTable = static_cast<VtkStationSource*>(static_cast<StationTreeModel*>(model())->vtkSource( temp_name. toStdString())) ->getColorLookupTable(); StratWindow* stratView = - new StratWindow(static_cast<GEOLIB::StationBorehole*>(static_cast<StationTreeModel*>( + new StratWindow(static_cast<GeoLib::StationBorehole*>(static_cast<StationTreeModel*>( model()) ->stationFromIndex(index, temp_name)), @@ -172,7 +172,7 @@ void StationTreeView::exportStation() QString temp_name; std::vector<std::string> temp_soil_names; temp_soil_names.push_back(""); // soil name vector needs to be initialised - GMSInterface::writeBoreholeToGMS(static_cast<GEOLIB::StationBorehole*>(static_cast< + GMSInterface::writeBoreholeToGMS(static_cast<GeoLib::StationBorehole*>(static_cast< StationTreeModel *>( model())->stationFromIndex(index, @@ -204,7 +204,7 @@ void StationTreeView::showDiagramPrefsDialog() void StationTreeView::writeStratigraphiesAsImages(QString listName) { std::map<std::string, - GEOLIB::Color*> colorLookupTable = + GeoLib::Color*> colorLookupTable = static_cast<VtkStationSource*>(static_cast<StationTreeModel*>(model())->vtkSource( listName. toStdString())) @@ -215,13 +215,13 @@ void StationTreeView::writeStratigraphiesAsImages(QString listName) if ( listName.toStdString().compare( lists[i]->data(0).toString().toStdString() ) == 0 ) { - const std::vector<GEOLIB::Point*>* stations = + const std::vector<GeoLib::Point*>* stations = dynamic_cast<BaseItem*>(lists[i]->getItem())->getStations(); for (size_t i = 0; i < stations->size(); i++) { StratWindow* stratView = - new StratWindow(static_cast<GEOLIB::StationBorehole*>((* + new StratWindow(static_cast<GeoLib::StationBorehole*>((* stations) [i]), &colorLookupTable); @@ -229,7 +229,7 @@ void StationTreeView::writeStratigraphiesAsImages(QString listName) stratView->show(); stratView->stationView->saveAsImage( "c:/project/" + - QString::fromStdString(static_cast<GEOLIB::StationBorehole*>(( + QString::fromStdString(static_cast<GeoLib::StationBorehole*>(( * stations) [ diff --git a/Gui/DataView/StratView/CMakeLists.txt b/Gui/DataView/StratView/CMakeLists.txt index 52172483f51..25dbc9340d7 100644 --- a/Gui/DataView/StratView/CMakeLists.txt +++ b/Gui/DataView/StratView/CMakeLists.txt @@ -32,12 +32,12 @@ qt4_wrap_cpp( MOC_SOURCES ${MOC_HEADERS} ) # Include the headers which are generated by uic and moc # and include additional header include_directories( - ${CMAKE_SOURCE_DIR}/Qt/DataView/StratView - ${CMAKE_BINARY_DIR}/Qt/DataView/StratView - ${CMAKE_SOURCE_DIR}/Base - ${CMAKE_SOURCE_DIR}/GEO + ${CMAKE_SOURCE_DIR}/Gui/DataView/StratView + ${CMAKE_BINARY_DIR}/Gui/DataView/StratView + ${CMAKE_SOURCE_DIR}/BaseLib + ${CMAKE_SOURCE_DIR}/GeoLib ${CMAKE_SOURCE_DIR}/MathLib - ${CMAKE_SOURCE_DIR}/Qt/Base + ${CMAKE_SOURCE_DIR}/Gui/Base ) # Put moc files in a project folder diff --git a/Gui/DataView/StratView/StratBar.cpp b/Gui/DataView/StratView/StratBar.cpp index a49cfca9ced..060c2319611 100644 --- a/Gui/DataView/StratView/StratBar.cpp +++ b/Gui/DataView/StratView/StratBar.cpp @@ -6,8 +6,8 @@ #include "StratBar.h" #include <QPainter> -StratBar::StratBar(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors, +StratBar::StratBar(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors, QGraphicsItem* parent) : QGraphicsItem(parent), _station(station) { @@ -17,7 +17,7 @@ StratBar::StratBar(GEOLIB::StationBorehole* station, StratBar::~StratBar() { -// std::map<std::string, GEOLIB::Color*>::iterator it; +// std::map<std::string, GeoLib::Color*>::iterator it; // for (it = _stratColors.begin(); it != _stratColors.end(); it++) { // delete it->second; // } @@ -41,7 +41,7 @@ void StratBar::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, //painter->drawRect(_bar); //pen.setWidth(1); - std::vector<GEOLIB::Point*> profile = _station->getProfile(); + std::vector<GeoLib::Point*> profile = _station->getProfile(); std::vector<std::string> soilNames = _station->getSoilNames(); size_t nLayers = profile.size(); @@ -52,7 +52,7 @@ void StratBar::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, top += height; height = logHeight(((*(profile[i - 1]))[2] - (*(profile[i]))[2])); QRectF layer(0, top, BARWIDTH, height); - const GEOLIB::Color* c (GEOLIB::getColor(soilNames[i], _stratColors)); + const GeoLib::Color* c (GeoLib::getColor(soilNames[i], _stratColors)); QBrush brush(QColor((int)(*c)[0], (int)(*c)[1], (int)(*c)[2], @@ -68,7 +68,7 @@ void StratBar::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, double StratBar::totalLogHeight() const { double height = 0; - std::vector<GEOLIB::Point*> profile = _station->getProfile(); + std::vector<GeoLib::Point*> profile = _station->getProfile(); for (size_t i = 1; i < profile.size(); i++) height += ( log((*(profile[i - 1]))[2] - (*(profile[i]))[2] + 1) * 100 ); diff --git a/Gui/DataView/StratView/StratBar.h b/Gui/DataView/StratView/StratBar.h index 2bff5e45659..9c6b3c0f1fe 100644 --- a/Gui/DataView/StratView/StratBar.h +++ b/Gui/DataView/StratView/StratBar.h @@ -7,9 +7,11 @@ #define STRATBAR_H #include "Station.h" +#include "Color.h" #include <QGraphicsItem> #include <cmath> + /** * \brief A 2D bar visualisation of a borehole stratigraphy. * @@ -24,8 +26,8 @@ public: * \param stratColors A color map. * \param parent The parent QGraphicsItem. */ - StratBar(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors = NULL, + StratBar(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors = NULL, QGraphicsItem* parent = 0); ~StratBar(); @@ -48,8 +50,8 @@ private: /// The default width of the bar static const int BARWIDTH = 50; - GEOLIB::StationBorehole* _station; - std::map<std::string, GEOLIB::Color*> _stratColors; + GeoLib::StationBorehole* _station; + std::map<std::string, GeoLib::Color*> _stratColors; }; #endif //STRATBAR_H diff --git a/Gui/DataView/StratView/StratScene.cpp b/Gui/DataView/StratView/StratScene.cpp index c4bbe6477f7..5c10f8afa6f 100644 --- a/Gui/DataView/StratView/StratScene.cpp +++ b/Gui/DataView/StratView/StratScene.cpp @@ -13,8 +13,8 @@ #include "StratBar.h" #include "StratScene.h" -StratScene::StratScene(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors, +StratScene::StratScene(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors, QObject* parent) : QGraphicsScene(parent) { QRectF textBounds; @@ -58,7 +58,7 @@ StratScene::~StratScene() { } -void StratScene::addDepthLabels(std::vector<GEOLIB::Point*> profile, double offset) +void StratScene::addDepthLabels(std::vector<GeoLib::Point*> profile, double offset) { QRectF textBounds; double vertPos = MARGIN; @@ -85,7 +85,7 @@ QNonScalableGraphicsTextItem* StratScene::addNonScalableText(const QString &text } void StratScene::addSoilNameLabels(std::vector<std::string> soilNames, - std::vector<GEOLIB::Point*> profile, + std::vector<GeoLib::Point*> profile, double offset) { //QRectF textBounds; @@ -105,8 +105,8 @@ void StratScene::addSoilNameLabels(std::vector<std::string> soilNames, } } -StratBar* StratScene::addStratBar(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors) +StratBar* StratScene::addStratBar(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors) { StratBar* b = new StratBar(station, stratColors); addItem(b); diff --git a/Gui/DataView/StratView/StratScene.h b/Gui/DataView/StratView/StratScene.h index 1dd2b192e2b..af7251aeda1 100644 --- a/Gui/DataView/StratView/StratScene.h +++ b/Gui/DataView/StratView/StratScene.h @@ -7,6 +7,7 @@ #define STRATSCENE_H #include "Station.h" +#include "Color.h" #include <QGraphicsScene> class StratBar; @@ -19,8 +20,8 @@ class StratScene : public QGraphicsScene { public: /// Constructor - StratScene(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors = NULL, + StratScene(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors = NULL, QObject* parent = 0); ~StratScene(); @@ -29,7 +30,7 @@ public: private: /// Adds text labels indicating the depth at the beginning and end of each soil layer - void addDepthLabels(std::vector<GEOLIB::Point*> profile, double offset); + void addDepthLabels(std::vector<GeoLib::Point*> profile, double offset); /// Add a non-scalable text item to the scene. QNonScalableGraphicsTextItem* addNonScalableText(const QString &text, @@ -37,12 +38,12 @@ private: /// Adds text labels indicating the name of each soil layer void addSoilNameLabels(std::vector<std::string> soilNames, - std::vector<GEOLIB::Point*> profile, + std::vector<GeoLib::Point*> profile, double offset); /// Add a stratigraphy-bar to the scene. - StratBar* addStratBar(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors = NULL); + StratBar* addStratBar(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors = NULL); }; #endif //STRATSCENE_H diff --git a/Gui/DataView/StratView/StratView.cpp b/Gui/DataView/StratView/StratView.cpp index a3442d64196..2b00b95fac3 100644 --- a/Gui/DataView/StratView/StratView.cpp +++ b/Gui/DataView/StratView/StratView.cpp @@ -12,8 +12,8 @@ StratView::~StratView() delete _scene; } -void StratView::setStation(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors) +void StratView::setStation(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors) { _scene = new StratScene(station, stratColors); setScene(_scene); diff --git a/Gui/DataView/StratView/StratView.h b/Gui/DataView/StratView/StratView.h index 634a5da7f73..21078b3fd71 100644 --- a/Gui/DataView/StratView/StratView.h +++ b/Gui/DataView/StratView/StratView.h @@ -10,7 +10,7 @@ #include <QGraphicsView> #include <QtGui/QWidget> -namespace GEOLIB +namespace GeoLib { class StationBorehole; } @@ -29,8 +29,8 @@ public: ~StratView(); /// Sets the Borehole whose data should be visualised. - void setStation(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors = NULL); + void setStation(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors = NULL); /// Returns the height of the bounding rectangle of all objects within the scene. int getHeight() { return static_cast<int>((_scene->itemsBoundingRect()).height()); } diff --git a/Gui/DataView/StratView/StratWindow.cpp b/Gui/DataView/StratView/StratWindow.cpp index 51facd10aa2..5a6c0f60088 100644 --- a/Gui/DataView/StratView/StratWindow.cpp +++ b/Gui/DataView/StratView/StratWindow.cpp @@ -6,8 +6,8 @@ #include "Station.h" #include "StratWindow.h" -StratWindow::StratWindow(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors, +StratWindow::StratWindow(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors, QWidget* parent) : QWidget(parent) { setupUi(this); diff --git a/Gui/DataView/StratView/StratWindow.h b/Gui/DataView/StratView/StratWindow.h index e51c1ef48d5..7e0d0e89f51 100644 --- a/Gui/DataView/StratView/StratWindow.h +++ b/Gui/DataView/StratView/StratWindow.h @@ -9,7 +9,7 @@ #include "ui_StratWindow.h" #include <QWidget> -namespace GEOLIB +namespace GeoLib { class StationBorehole; } @@ -28,8 +28,8 @@ public: * \param stratColors A color map. * \param parent The parent QWidget. */ - StratWindow(GEOLIB::StationBorehole* station, - std::map<std::string, GEOLIB::Color*>* stratColors = NULL, + StratWindow(GeoLib::StationBorehole* station, + std::map<std::string, GeoLib::Color*>* stratColors = NULL, QWidget* parent = 0); ~StratWindow(void) { this->destroy(); } diff --git a/Gui/OpenSG/CMakeLists.txt b/Gui/OpenSG/CMakeLists.txt index 76558c93482..c3b338644e6 100644 --- a/Gui/OpenSG/CMakeLists.txt +++ b/Gui/OpenSG/CMakeLists.txt @@ -13,7 +13,7 @@ SET( HEADERS ### Include directories ### INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/Qt/OpenSG + ${CMAKE_SOURCE_DIR}/Gui/OpenSG ) ### Create the library ### diff --git a/Gui/Vrpn/CMakeLists.txt b/Gui/Vrpn/CMakeLists.txt index aa5cdcf8abd..7828b4e62bc 100644 --- a/Gui/Vrpn/CMakeLists.txt +++ b/Gui/Vrpn/CMakeLists.txt @@ -36,11 +36,11 @@ Qt4_WRAP_CPP( MOC_SOURCES ${MOC_HEADERS} ) ### Include directories ### INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/Qt/Vrpn - ${CMAKE_BINARY_DIR}/Qt/Vrpn + ${CMAKE_SOURCE_DIR}/Gui/Vrpn + ${CMAKE_BINARY_DIR}/Gui/Vrpn ${VRPN_INCLUDE_DIRS} - ${CMAKE_SOURCE_DIR}/Qt/VtkVis - ${CMAKE_BINARY_DIR}/Qt/VtkVis + ${CMAKE_SOURCE_DIR}/Gui/VtkVis + ${CMAKE_BINARY_DIR}/Gui/VtkVis ) # Put moc files in a project folder diff --git a/Gui/VtkAct/CMakeLists.txt b/Gui/VtkAct/CMakeLists.txt index a8606e0be72..70c0b11b427 100644 --- a/Gui/VtkAct/CMakeLists.txt +++ b/Gui/VtkAct/CMakeLists.txt @@ -30,16 +30,16 @@ source_group("Moc Files" REGULAR_EXPRESSION "moc_.*") qt4_wrap_cpp( MOC_SOURCES ${MOC_HEADERS} ) include_directories( - ${CMAKE_SOURCE_DIR}/Qt/VtkAct - ${CMAKE_BINARY_DIR}/Qt/VtkAct - ${CMAKE_SOURCE_DIR}/Base - ${CMAKE_SOURCE_DIR}/FEM - ${CMAKE_SOURCE_DIR}/GEO + ${CMAKE_SOURCE_DIR}/Gui/VtkAct + ${CMAKE_BINARY_DIR}/Gui/VtkAct + ${CMAKE_SOURCE_DIR}/BaseLib + ${CMAKE_SOURCE_DIR}/FemLib + ${CMAKE_SOURCE_DIR}/GeoLib ${CMAKE_SOURCE_DIR}/FileIO ${CMAKE_SOURCE_DIR}/FileIO/MeshIO - ${CMAKE_SOURCE_DIR}/MSH + ${CMAKE_SOURCE_DIR}/MeshLib ${CMAKE_SOURCE_DIR}/MathLib - ${CMAKE_SOURCE_DIR}/Qt/VtkVis + ${CMAKE_SOURCE_DIR}/Gui/VtkVis ) # Create the library diff --git a/Gui/VtkVis/CMakeLists.txt b/Gui/VtkVis/CMakeLists.txt index 822a84efcf5..91a6c51e72a 100644 --- a/Gui/VtkVis/CMakeLists.txt +++ b/Gui/VtkVis/CMakeLists.txt @@ -19,7 +19,7 @@ SET( SOURCES VtkCompositeImageToCylindersFilter.cpp VtkCompositeLineToTubeFilter.cpp VtkCompositePointToGlyphFilter.cpp - VtkCompositeSelectionFilter.cpp + VtkCompositeSelectionFilter.cpp VtkCompositeTextureOnSurfaceFilter.cpp VtkCompositeThresholdFilter.cpp VtkConditionSource.cpp @@ -128,18 +128,18 @@ QT4_WRAP_CPP( MOC_SOURCES ${MOC_HEADERS} ) INCLUDE( ${VTK_USE_FILE} ) INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/Qt/VtkVis - ${CMAKE_SOURCE_DIR}/Qt/VtkAct - ${CMAKE_BINARY_DIR}/Qt/VtkVis - ${CMAKE_SOURCE_DIR}/Base - ${CMAKE_SOURCE_DIR}/FEM - ${CMAKE_SOURCE_DIR}/GEO + ${CMAKE_SOURCE_DIR}/Gui/VtkVis + ${CMAKE_SOURCE_DIR}/Gui/VtkAct + ${CMAKE_BINARY_DIR}/Gui/VtkVis + ${CMAKE_SOURCE_DIR}/BaseLib + ${CMAKE_SOURCE_DIR}/FemLib + ${CMAKE_SOURCE_DIR}/GeoLib ${CMAKE_SOURCE_DIR}/MathLib ${CMAKE_SOURCE_DIR}/FileIO - ${CMAKE_SOURCE_DIR}/MSH - ${CMAKE_SOURCE_DIR}/Qt/Base - ${CMAKE_SOURCE_DIR}/Qt/DataView - ${CMAKE_BINARY_DIR}/Qt/DataView + ${CMAKE_SOURCE_DIR}/MeshLib + ${CMAKE_SOURCE_DIR}/Gui/Base + ${CMAKE_SOURCE_DIR}/Gui/DataView + ${CMAKE_BINARY_DIR}/Gui/DataView ) # Create the library @@ -161,10 +161,10 @@ TARGET_LINK_LIBRARIES( VtkVis ${QT_LIBRARIES} ) ADD_DEPENDENCIES(VtkVis QtDataView) IF(OGS_USE_VRPN) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Qt/Vrpn) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Gui/Vrpn) ENDIF() # OGS_USE_VRPN IF (OGS_USE_OPENSG) USE_OPENSG(VtkVis) - INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Qt/OpenSG ) + INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/Gui/OpenSG ) ENDIF (OGS_USE_OPENSG) diff --git a/Gui/VtkVis/VisPrefsDialog.h b/Gui/VtkVis/VisPrefsDialog.h index dd9fced3a2d..ffbf6bc5a15 100644 --- a/Gui/VtkVis/VisPrefsDialog.h +++ b/Gui/VtkVis/VisPrefsDialog.h @@ -47,8 +47,8 @@ protected slots: private: VtkVisPipeline* _vtkVisPipeline; VisualizationWidget* _visWidget; - GEOLIB::Point _above; - GEOLIB::Point _below; + GeoLib::Point _above; + GeoLib::Point _below; }; #endif //VISPREFSDIALOG_H diff --git a/Gui/VtkVis/VtkColorLookupTable.h b/Gui/VtkVis/VtkColorLookupTable.h index fd0d35c00a0..ceac2652840 100644 --- a/Gui/VtkVis/VtkColorLookupTable.h +++ b/Gui/VtkVis/VtkColorLookupTable.h @@ -16,7 +16,7 @@ /** * \brief Calculates and stores a colour lookup table. * - * Based on a start colour and an end colour, RGB-values are interpolated and stored in vector of GEOLIB::Color. If no + * Based on a start colour and an end colour, RGB-values are interpolated and stored in vector of GeoLib::Color. If no * colours are set, default values are used for start (blue) and end (red). The number of entries of the colour table can * be set in the constructor, the default value is 256. If additional colours are inserted into the table using setColor() * the interpolation will be calculated iteratively between set colour values. Interpolation can be linear (default) or diff --git a/Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp b/Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp index d586cd6cd51..f0e024c3a91 100644 --- a/Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp +++ b/Gui/VtkVis/VtkCompositeGeoObjectFilter.cpp @@ -21,7 +21,7 @@ #include <vtkPointData.h> VtkCompositeGeoObjectFilter::VtkCompositeGeoObjectFilter( vtkAlgorithm* inputAlgorithm ) - : VtkCompositeFilter(inputAlgorithm), _type(GEOLIB::POINT), _threshold(vtkThreshold::New()) + : VtkCompositeFilter(inputAlgorithm), _type(GeoLib::POINT), _threshold(vtkThreshold::New()) { if (inputAlgorithm->GetNumberOfInputPorts() && inputAlgorithm->GetNumberOfInputConnections(0)) { @@ -31,10 +31,10 @@ VtkCompositeGeoObjectFilter::VtkCompositeGeoObjectFilter( vtkAlgorithm* inputAlg { vtkAlgorithm* parentAlg = ao->GetProducer(); - if (dynamic_cast<VtkPolylinesSource*>(parentAlg) != NULL) - _type = GEOLIB::POLYLINE; - else if (dynamic_cast<VtkSurfacesSource*>(parentAlg) != NULL) - _type = GEOLIB::SURFACE; + if (dynamic_cast<VtkPolylinesSource*>(parentAlg) != NULL) + _type = GeoLib::POLYLINE; + else if (dynamic_cast<VtkSurfacesSource*>(parentAlg) != NULL) + _type = GeoLib::SURFACE; } } @@ -59,13 +59,13 @@ void VtkCompositeGeoObjectFilter::init() surface->SetInputConnection(_threshold->GetOutputPort()); VtkCompositeFilter* composite; - if (_type == GEOLIB::POINT) - { + if (_type == GeoLib::POINT) + { composite = new VtkCompositePointToGlyphFilter(surface); composite->SetUserProperty("Radius", this->GetInitialRadius()); _outputAlgorithm = composite->GetOutputAlgorithm(); } - else if (_type == GEOLIB::POLYLINE) + else if (_type == GeoLib::POLYLINE) { composite = new VtkCompositeLineToTubeFilter(surface); composite->SetUserProperty("Radius", this->GetInitialRadius()); @@ -77,7 +77,7 @@ void VtkCompositeGeoObjectFilter::init() } -void VtkCompositeGeoObjectFilter::SetIndex(size_t idx) +void VtkCompositeGeoObjectFilter::SetIndex(size_t idx) { _threshold->ThresholdBetween(idx, idx); } diff --git a/Gui/VtkVis/VtkCompositeGeoObjectFilter.h b/Gui/VtkVis/VtkCompositeGeoObjectFilter.h index 0ab513e3f04..a3ee33bc26b 100644 --- a/Gui/VtkVis/VtkCompositeGeoObjectFilter.h +++ b/Gui/VtkVis/VtkCompositeGeoObjectFilter.h @@ -32,7 +32,7 @@ public: private: float GetInitialRadius() const; - GEOLIB::GEOTYPE _type; + GeoLib::GEOTYPE _type; vtkThreshold* _threshold; }; diff --git a/Gui/VtkVis/VtkConditionSource.cpp b/Gui/VtkVis/VtkConditionSource.cpp index 1d26f5f595d..c5771637341 100644 --- a/Gui/VtkVis/VtkConditionSource.cpp +++ b/Gui/VtkVis/VtkConditionSource.cpp @@ -31,7 +31,7 @@ VtkConditionSource::VtkConditionSource() { this->SetNumberOfInputPorts(0); - const GEOLIB::Color* c = GEOLIB::getRandomColor(); + const GeoLib::Color* c = GeoLib::getRandomColor(); GetProperties()->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); } @@ -39,7 +39,7 @@ VtkConditionSource::~VtkConditionSource() { } -void VtkConditionSource::setData(const std::vector<GEOLIB::Point*>* points, +void VtkConditionSource::setData(const std::vector<GeoLib::Point*>* points, const std::vector<FEMCondition*>* conds) { _removable = false; // From VtkAlgorithmProperties @@ -114,19 +114,19 @@ int VtkConditionSource::RequestData( vtkInformation* request, vtkIdType dis_type_value(0); std::map<FiniteElement::DistributionType, vtkIdType>::const_iterator it(_dis_type_map.find(type)); - if (it == _dis_type_map.end()) + if (it == _dis_type_map.end()) { dis_type_value = static_cast<vtkIdType>(_dis_type_map.size()); _dis_type_map.insert(std::pair<FiniteElement::DistributionType, size_t>(type, dis_type_value)); } else dis_type_value = it->second; - if ((*_cond_vec)[n]->getGeoType() == GEOLIB::POINT) + if ((*_cond_vec)[n]->getGeoType() == GeoLib::POINT) { /* size_t nPoints = _points->size(); - const GEOLIB::Point* pnt = - static_cast<const GEOLIB::Point*>((*_cond_vec)[n]->getGeoObj()); + const GeoLib::Point* pnt = + static_cast<const GeoLib::Point*>((*_cond_vec)[n]->getGeoObj()); int id(-1); for (size_t i = 0; i < nPoints; i++) if ((*_points)[i] == pnt) @@ -134,9 +134,9 @@ int VtkConditionSource::RequestData( vtkInformation* request, id = static_cast<int>(i); //(this->getIndex(i, newPoints, scalars, idx_map)); vtkIdType vtk_id = static_cast<vtkIdType>(id); */ - const GEOLIB::Point* pnt = static_cast<const GEOLIB::Point*>((*_cond_vec)[n]->getGeoObj()); + const GeoLib::Point* pnt = static_cast<const GeoLib::Point*>((*_cond_vec)[n]->getGeoObj()); newPoints->InsertNextPoint(pnt->getData()); - + newVerts->InsertNextCell(1, &pnt_id); if (type == FiniteElement::CONSTANT || type == FiniteElement::CONSTANT_NEUMANN) scalars->InsertNextValue(dis_values[0]); @@ -152,16 +152,16 @@ int VtkConditionSource::RequestData( vtkInformation* request, << std::endl; */ } - else if ((*_cond_vec)[n]->getGeoType() == GEOLIB::POLYLINE) + else if ((*_cond_vec)[n]->getGeoType() == GeoLib::POLYLINE) { - const GEOLIB::Polyline* ply = static_cast<const GEOLIB::Polyline*>((*_cond_vec)[n]->getGeoObj()); + const GeoLib::Polyline* ply = static_cast<const GeoLib::Polyline*>((*_cond_vec)[n]->getGeoObj()); const int nPoints = ply->getNumberOfPoints(); newLines->InsertNextCell(nPoints); double value (0); for (int i = 0; i < nPoints; i++) { size_t point_index = ply->getPointID(i); - + newPoints->InsertNextPoint((*_points)[point_index]->getData()); newLines->InsertCellPoint(pnt_id); distypes->InsertNextValue(dis_type_value); @@ -177,17 +177,17 @@ int VtkConditionSource::RequestData( vtkInformation* request, } scalars->InsertNextValue(value); } - else + else scalars->InsertNextValue(0); pnt_id++; } } - else if ((*_cond_vec)[n]->getGeoType() == GEOLIB::SURFACE) + else if ((*_cond_vec)[n]->getGeoType() == GeoLib::SURFACE) { std::vector<int> point_idx_map(_points->size(), -1); - const GEOLIB::Surface* sfc = - static_cast<const GEOLIB::Surface*>((*_cond_vec)[n]->getGeoObj()); + const GeoLib::Surface* sfc = + static_cast<const GeoLib::Surface*>((*_cond_vec)[n]->getGeoObj()); const size_t nTriangles = sfc->getNTriangles(); @@ -196,7 +196,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, vtkPolygon* aPolygon = vtkPolygon::New(); aPolygon->GetPointIds()->SetNumberOfIds(3); - const GEOLIB::Triangle* triangle = (*sfc)[i]; + const GeoLib::Triangle* triangle = (*sfc)[i]; for (size_t j = 0; j < 3; j++) { size_t point_index ((*triangle)[j]); @@ -207,7 +207,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, newPoints->InsertNextPoint((*_points)[point_index]->getData()); aPolygon->GetPointIds()->SetId(j, pnt_id); distypes->InsertNextValue(dis_type_value); - + if (type == FiniteElement::CONSTANT || type == FiniteElement::CONSTANT_NEUMANN) scalars->InsertNextValue(dis_values[0]); else if (type == FiniteElement::LINEAR || type == FiniteElement::LINEAR_NEUMANN) @@ -231,7 +231,7 @@ int VtkConditionSource::RequestData( vtkInformation* request, } } // HACK: this is currently used when applying DIRECT conditions - else if ((*_cond_vec)[n]->getGeoType() == GEOLIB::INVALID) + else if ((*_cond_vec)[n]->getGeoType() == GeoLib::INVALID) { size_t nValues = dis_values.size(); for (size_t i=0; i<nValues; i++) @@ -245,10 +245,10 @@ int VtkConditionSource::RequestData( vtkInformation* request, } } // draw a bounding box in case of of the conditions is "domain" - else if ((*_cond_vec)[n]->getGeoType() == GEOLIB::GEODOMAIN) + else if ((*_cond_vec)[n]->getGeoType() == GeoLib::GEODOMAIN) { - GEOLIB::AABB bounding_box (_points); - std::vector<GEOLIB::Point> box; + GeoLib::AABB bounding_box (_points); + std::vector<GeoLib::Point> box; box.push_back(bounding_box.getMinPoint()); box.push_back(bounding_box.getMaxPoint()); diff --git a/Gui/VtkVis/VtkConditionSource.h b/Gui/VtkVis/VtkConditionSource.h index 04c15eba7bd..0ef0afee382 100644 --- a/Gui/VtkVis/VtkConditionSource.h +++ b/Gui/VtkVis/VtkConditionSource.h @@ -31,7 +31,7 @@ public: vtkTypeRevisionMacro(VtkConditionSource,vtkPolyDataAlgorithm); /// Sets the FEMCondition that need to be visualised. The geometry points array is needed because polylines and surfaces are linked to this data. - void setData(const std::vector<GEOLIB::Point*>* points, + void setData(const std::vector<GeoLib::Point*>* points, const std::vector<FEMCondition*>* conds); /// Prints its data on a stream. @@ -55,7 +55,7 @@ protected: private: //size_t getIndex(size_t idx, vtkSmartPointer<vtkPoints> newPoints, vtkSmartPointer<vtkDoubleArray> scalars, std::map<size_t, size_t> &idx_map); - const std::vector<GEOLIB::Point*>* _points; + const std::vector<GeoLib::Point*>* _points; const std::vector<FEMCondition*>* _cond_vec; std::map<FiniteElement::DistributionType, vtkIdType> _dis_type_map; }; diff --git a/Gui/VtkVis/VtkMeshConverter.cpp b/Gui/VtkVis/VtkMeshConverter.cpp index 1bb4c75c46a..7455a035c52 100644 --- a/Gui/VtkVis/VtkMeshConverter.cpp +++ b/Gui/VtkVis/VtkMeshConverter.cpp @@ -63,7 +63,7 @@ GridAdapter* VtkMeshConverter::convertImgToMesh(vtkImageData* img, { colour = pixelData->GetTuple2(img_idx); pixVal[index] = colour[0]; - + } else if (nTuple == 4) //RGBA { @@ -75,7 +75,7 @@ GridAdapter* VtkMeshConverter::convertImgToMesh(vtkImageData* img, std::cout << "Unsupported pixel composition!" << std::endl; return NULL; } - + visNodes[index] = (colour[nTuple-1] > 0); node_idx_map[index]=-1; } @@ -83,7 +83,7 @@ GridAdapter* VtkMeshConverter::convertImgToMesh(vtkImageData* img, visNodes[(i+2)*incHeight-1]=false; node_idx_map[(i+2)*incHeight-1]=-1; } - + GridAdapter* mesh = constructMesh(pixVal, node_idx_map, visNodes, origin, imgHeight, imgWidth, scalingFactor, elem_type, intensity_type); delete [] pixVal; @@ -138,7 +138,7 @@ GridAdapter* VtkMeshConverter::convertImgToMesh(const double* img, visNodes[(i+2)*incHeight-1]=false; node_idx_map[(i+2)*incHeight-1]=-1; } - + GridAdapter* mesh = constructMesh(pixVal, node_idx_map, visNodes, origin, imgHeight, imgWidth, scalingFactor, elem_type, intensity_type); delete [] pixVal; @@ -179,7 +179,7 @@ GridAdapter* VtkMeshConverter::constructMesh(const double* pixVal, if (set_node) { double zValue = (intensity_type == UseIntensityAs::ELEVATION) ? pixVal[index] : 0.0; - grid->addNode(new GEOLIB::Point(x_offset + (scalingFactor * j), + grid->addNode(new GeoLib::Point(x_offset + (scalingFactor * j), y_offset + (scalingFactor * i), zValue)); node_idx_map[index] = node_idx_count; @@ -245,7 +245,7 @@ GridAdapter* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* grid for (size_t i = 0; i < nNodes; i++) { coords = grid->GetPoints()->GetPoint(i); - mesh->addNode(new GEOLIB::Point(coords[0], coords[1], coords[2])); + mesh->addNode(new GeoLib::Point(coords[0], coords[1], coords[2])); } // set mesh elements diff --git a/Gui/VtkVis/VtkMeshSource.cpp b/Gui/VtkVis/VtkMeshSource.cpp index e1efddbc3ab..aaa710298cc 100644 --- a/Gui/VtkVis/VtkMeshSource.cpp +++ b/Gui/VtkVis/VtkMeshSource.cpp @@ -36,7 +36,7 @@ VtkMeshSource::VtkMeshSource() : _matName("MaterialIDs") _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); - const GEOLIB::Color* c = GEOLIB::getRandomColor(); + const GeoLib::Color* c = GeoLib::getRandomColor(); vtkProperty* vtkProps = GetProperties(); vtkProps->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); vtkProps->SetEdgeVisibility(1); @@ -53,7 +53,7 @@ void VtkMeshSource::PrintSelf( ostream& os, vtkIndent indent ) if (_grid == NULL) return; - const std::vector<GEOLIB::Point*>* nodes = _grid->getNodes(); + const std::vector<GeoLib::Point*>* nodes = _grid->getNodes(); const std::vector<GridAdapter::Element*>* elems = _grid->getElements(); if (nodes->empty() || elems->empty() ) return; @@ -61,7 +61,7 @@ void VtkMeshSource::PrintSelf( ostream& os, vtkIndent indent ) os << indent << "== VtkMeshSource ==" << "\n"; int i = 0; - for (std::vector<GEOLIB::Point*>::const_iterator it = nodes->begin(); + for (std::vector<GeoLib::Point*>::const_iterator it = nodes->begin(); it != nodes->end(); ++it) { os << indent << "Point " << i << " (" << (*it)[0] << ", " << (*it)[1] << ", " << @@ -90,7 +90,7 @@ int VtkMeshSource::RequestData( vtkInformation* request, if (_grid == NULL) return 0; - const std::vector<GEOLIB::Point*>* nodes = _grid->getNodes(); + const std::vector<GeoLib::Point*>* nodes = _grid->getNodes(); const std::vector<GridAdapter::Element*>* elems = _grid->getElements(); const size_t nPoints = nodes->size(); diff --git a/Gui/VtkVis/VtkPointsSource.cpp b/Gui/VtkVis/VtkPointsSource.cpp index 1850908209c..17d91d3fbe7 100644 --- a/Gui/VtkVis/VtkPointsSource.cpp +++ b/Gui/VtkVis/VtkPointsSource.cpp @@ -29,7 +29,7 @@ VtkPointsSource::VtkPointsSource() _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); - const GEOLIB::Color* c = GEOLIB::getRandomColor(); + const GeoLib::Color* c = GeoLib::getRandomColor(); GetProperties()->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); } @@ -43,7 +43,7 @@ void VtkPointsSource::PrintSelf( ostream& os, vtkIndent indent ) os << indent << "== VtkPointsSource ==" << "\n"; int i = 0; - for (std::vector<GEOLIB::Point*>::const_iterator it = _points->begin(); + for (std::vector<GeoLib::Point*>::const_iterator it = _points->begin(); it != _points->end(); ++it) { const double* coords = (*it)->getData(); @@ -78,7 +78,7 @@ int VtkPointsSource::RequestData( vtkInformation* request, vtkSmartPointer<vtkCellArray> newVerts = vtkSmartPointer<vtkCellArray>::New(); newPoints->Allocate(numPoints); newVerts->Allocate(numPoints); - + vtkSmartPointer<vtkIntArray> pointIDs = vtkSmartPointer<vtkIntArray>::New(); pointIDs->SetNumberOfComponents(1); pointIDs->SetName("PointIDs"); @@ -88,13 +88,13 @@ int VtkPointsSource::RequestData( vtkInformation* request, // Generate points and vertices int i = 0; - for (std::vector<GEOLIB::Point*>::const_iterator it = _points->begin(); + for (std::vector<GeoLib::Point*>::const_iterator it = _points->begin(); it != _points->end(); ++it) { double coords[3] = {(*(*it))[0], (*(*it))[1], (*(*it))[2]}; vtkIdType pid = newPoints->InsertNextPoint(coords); newVerts->InsertNextCell(1, &pid); - + pointIDs->InsertNextValue(i); i++; } diff --git a/Gui/VtkVis/VtkPointsSource.h b/Gui/VtkVis/VtkPointsSource.h index 4ac56bacfe6..2c43375df54 100644 --- a/Gui/VtkVis/VtkPointsSource.h +++ b/Gui/VtkVis/VtkPointsSource.h @@ -26,7 +26,7 @@ public: vtkTypeRevisionMacro(VtkPointsSource,vtkPolyDataAlgorithm); /// Sets the points as a vector - void setPoints(const std::vector<GEOLIB::Point*>* points) { _points = points; } + void setPoints(const std::vector<GeoLib::Point*>* points) { _points = points; } /// Prints its data on a stream. void PrintSelf(ostream& os, vtkIndent indent); @@ -47,7 +47,7 @@ protected: vtkInformationVector* outputVector); /// The points to visualize - const std::vector<GEOLIB::Point*>* _points; + const std::vector<GeoLib::Point*>* _points; private: }; diff --git a/Gui/VtkVis/VtkPolylinesSource.cpp b/Gui/VtkVis/VtkPolylinesSource.cpp index cc3aa88873d..e58ec2ce686 100644 --- a/Gui/VtkVis/VtkPolylinesSource.cpp +++ b/Gui/VtkVis/VtkPolylinesSource.cpp @@ -29,7 +29,7 @@ VtkPolylinesSource::VtkPolylinesSource() _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); - const GEOLIB::Color* c = GEOLIB::getRandomColor(); + const GeoLib::Color* c = GeoLib::getRandomColor(); GetProperties()->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); } @@ -44,14 +44,14 @@ void VtkPolylinesSource::PrintSelf( ostream& os, vtkIndent indent ) if (_polylines->size() == 0) return; - for (std::vector<GEOLIB::Polyline*>::const_iterator it = _polylines->begin(); + for (std::vector<GeoLib::Polyline*>::const_iterator it = _polylines->begin(); it != _polylines->end(); ++it) { os << indent << "== Polyline ==" << "\n"; int numPoints = (*it)->getNumberOfPoints(); for (int i = 0; i < numPoints; i++) { - const GEOLIB::Point* point = (**it)[i]; + const GeoLib::Point* point = (**it)[i]; const double* coords = point->getData(); os << indent << "Point " << i << " (" << coords[0] << ", " << coords[1] << ", " << coords[2] << ")\n"; @@ -94,7 +94,7 @@ int VtkPolylinesSource::RequestData( vtkInformation* request, plyIDs->SetName("PolylineIDs"); int lastMaxIndex = 0; - //for (std::vector<GEOLIB::Polyline*>::const_iterator it = _polylines->begin(); + //for (std::vector<GeoLib::Polyline*>::const_iterator it = _polylines->begin(); // it != _polylines->end(); ++it) for (size_t j = 0; j < _polylines->size(); j++) { @@ -104,7 +104,7 @@ int VtkPolylinesSource::RequestData( vtkInformation* request, // Generate points for (int i = 0; i < numPoints; i++) { - const GEOLIB::Point* point = (*(*_polylines)[j])[i]; + const GeoLib::Point* point = (*(*_polylines)[j])[i]; const double* coords = point->getData(); newPoints->InsertNextPoint(coords); } diff --git a/Gui/VtkVis/VtkPolylinesSource.h b/Gui/VtkVis/VtkPolylinesSource.h index 888f0b1297c..90510df50c9 100644 --- a/Gui/VtkVis/VtkPolylinesSource.h +++ b/Gui/VtkVis/VtkPolylinesSource.h @@ -26,7 +26,7 @@ public: vtkTypeRevisionMacro(VtkPolylinesSource,vtkPolyDataAlgorithm); /// Sets the polyline vector. - void setPolylines(const std::vector<GEOLIB::Polyline*>* polylines) { _polylines = polylines; } + void setPolylines(const std::vector<GeoLib::Polyline*>* polylines) { _polylines = polylines; } /// Prints its data on a stream. void PrintSelf(ostream& os, vtkIndent indent); @@ -47,7 +47,7 @@ protected: vtkInformationVector* outputVector); /// The polylines to visualize. - const std::vector<GEOLIB::Polyline*>* _polylines; + const std::vector<GeoLib::Polyline*>* _polylines; private: }; diff --git a/Gui/VtkVis/VtkStationSource.cpp b/Gui/VtkVis/VtkStationSource.cpp index ccf6bea5a92..53347708fd5 100644 --- a/Gui/VtkVis/VtkStationSource.cpp +++ b/Gui/VtkVis/VtkStationSource.cpp @@ -33,14 +33,14 @@ VtkStationSource::VtkStationSource() _removable = false; // From VtkAlgorithmProperties this->SetNumberOfInputPorts(0); - const GEOLIB::Color* c = GEOLIB::getRandomColor(); + const GeoLib::Color* c = GeoLib::getRandomColor(); GetProperties()->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); delete c; } VtkStationSource::~VtkStationSource() { - std::map<std::string, GEOLIB::Color*>::iterator it; + std::map<std::string, GeoLib::Color*>::iterator it; for (it = _colorLookupTable.begin(); it != _colorLookupTable.end(); ++it) delete it->second; } @@ -55,7 +55,7 @@ void VtkStationSource::PrintSelf( ostream& os, vtkIndent indent ) os << indent << "== VtkStationSource ==" << "\n"; int i = 0; - for (std::vector<GEOLIB::Point*>::const_iterator it = _stations->begin(); + for (std::vector<GeoLib::Point*>::const_iterator it = _stations->begin(); it != _stations->end(); ++it) { const double* coords = (*it)->getData(); @@ -80,17 +80,17 @@ int VtkStationSource::RequestData( vtkInformation* request, return 0; bool useStationValues(false); - double sValue=static_cast<GEOLIB::Station*>((*_stations)[0])->getStationValue(); + double sValue=static_cast<GeoLib::Station*>((*_stations)[0])->getStationValue(); for (size_t i = 1; i < nStations; i++) - if (static_cast<GEOLIB::Station*>((*_stations)[i])->getStationValue() != sValue) + if (static_cast<GeoLib::Station*>((*_stations)[i])->getStationValue() != sValue) { useStationValues = true; break; } bool isBorehole = - (static_cast<GEOLIB::Station*>((*_stations)[0])->type() == - GEOLIB::Station::BOREHOLE) ? true : false; + (static_cast<GeoLib::Station*>((*_stations)[0])->type() == + GeoLib::Station::BOREHOLE) ? true : false; vtkSmartPointer<vtkInformation> outInfo = outputVector->GetInformationObject(0); vtkSmartPointer<vtkPolyData> output = @@ -124,23 +124,23 @@ int VtkStationSource::RequestData( vtkInformation* request, size_t site_count(0); // Generate graphic objects - for (std::vector<GEOLIB::Point*>::const_iterator it = _stations->begin(); + for (std::vector<GeoLib::Point*>::const_iterator it = _stations->begin(); it != _stations->end(); ++it) { double coords[3] = { (*(*it))[0], (*(*it))[1], (*(*it))[2] }; vtkIdType sid = newStations->InsertNextPoint(coords); station_ids->InsertNextValue(site_count); if (useStationValues) - station_values->InsertNextValue(static_cast<GEOLIB::Station*>(*it)->getStationValue()); + station_values->InsertNextValue(static_cast<GeoLib::Station*>(*it)->getStationValue()); if (!isBorehole) newVerts->InsertNextCell(1, &sid); else { - std::vector<GEOLIB::Point*> profile = - static_cast<GEOLIB::StationBorehole*>(*it)->getProfile(); + std::vector<GeoLib::Point*> profile = + static_cast<GeoLib::StationBorehole*>(*it)->getProfile(); std::vector<std::string> soilNames = - static_cast<GEOLIB::StationBorehole*>(*it)->getSoilNames(); + static_cast<GeoLib::StationBorehole*>(*it)->getSoilNames(); const size_t nLayers = profile.size(); for (size_t i = 1; i < nLayers; i++) @@ -156,7 +156,7 @@ int VtkStationSource::RequestData( vtkInformation* request, lastMaxIndex++; strat_ids->InsertNextValue(this->GetIndexByName(soilNames[i])); if (useStationValues) - station_values->InsertNextValue(static_cast<GEOLIB::Station*>(*it)->getStationValue()); + station_values->InsertNextValue(static_cast<GeoLib::Station*>(*it)->getStationValue()); } lastMaxIndex++; } @@ -179,7 +179,7 @@ int VtkStationSource::RequestData( vtkInformation* request, } if (useStationValues) output->GetPointData()->AddArray(station_values); - + return 1; } diff --git a/Gui/VtkVis/VtkStationSource.h b/Gui/VtkVis/VtkStationSource.h index 41fa39f4f88..3c2495d2680 100644 --- a/Gui/VtkVis/VtkStationSource.h +++ b/Gui/VtkVis/VtkStationSource.h @@ -27,7 +27,7 @@ public: /// Returns the colour lookup table generated for boreholes. /// This method should only be called after the colour lookup table has actually been build (via RequestData() or setColorLookupTable()). const std::map<std::string, - GEOLIB::Color*>& getColorLookupTable() const { return _colorLookupTable; } + GeoLib::Color*>& getColorLookupTable() const { return _colorLookupTable; } /// Sets a predefined color lookup table for the colouring of borehole stratigraphies int setColorLookupTable(const std::string &filename) { return readColorLookupTable( @@ -35,7 +35,7 @@ public: filename); } /// Sets the stations as a vector - void setStations(const std::vector<GEOLIB::Point*>* stations) { _stations = stations; } + void setStations(const std::vector<GeoLib::Point*>* stations) { _stations = stations; } /// Prints its data on a stream. void PrintSelf(ostream& os, vtkIndent indent); @@ -56,11 +56,11 @@ protected: vtkInformationVector* outputVector); /// The stations to visualize - const std::vector<GEOLIB::Point*>* _stations; + const std::vector<GeoLib::Point*>* _stations; /// The colour table for stratigraphic data. This table is either set using the setColorLookupTable() method or is generated /// automatically with random colours while creating the VtkStationSource-object. - std::map<std::string, GEOLIB::Color*> _colorLookupTable; + std::map<std::string, GeoLib::Color*> _colorLookupTable; private: size_t GetIndexByName( std::string name ); diff --git a/Gui/VtkVis/VtkSurfacesSource.cpp b/Gui/VtkVis/VtkSurfacesSource.cpp index fc7c47b42b0..a0447cc6882 100644 --- a/Gui/VtkVis/VtkSurfacesSource.cpp +++ b/Gui/VtkVis/VtkSurfacesSource.cpp @@ -32,7 +32,7 @@ VtkSurfacesSource::VtkSurfacesSource() this->SetNumberOfInputPorts(0); //this->SetColorBySurface(true); - const GEOLIB::Color* c = GEOLIB::getRandomColor(); + const GeoLib::Color* c = GeoLib::getRandomColor(); vtkProperty* vtkProps = GetProperties(); vtkProps->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); vtkProps->SetEdgeVisibility(0); @@ -59,7 +59,7 @@ int VtkSurfacesSource::RequestData( vtkInformation* request, if (nSurfaces == 0) return 0; - const std::vector<GEOLIB::Point*>* surfacePoints = (*_surfaces)[0]->getPointVec(); + const std::vector<GeoLib::Point*>* surfacePoints = (*_surfaces)[0]->getPointVec(); size_t nPoints = surfacePoints->size(); vtkSmartPointer<vtkInformation> outInfo = outputVector->GetInformationObject(0); @@ -85,7 +85,7 @@ int VtkSurfacesSource::RequestData( vtkInformation* request, } vtkIdType count(0); - for (std::vector<GEOLIB::Surface*>::const_iterator it = _surfaces->begin(); + for (std::vector<GeoLib::Surface*>::const_iterator it = _surfaces->begin(); it != _surfaces->end(); ++it) { const size_t nTriangles = (*it)->getNTriangles(); @@ -95,7 +95,7 @@ int VtkSurfacesSource::RequestData( vtkInformation* request, vtkPolygon* aPolygon = vtkPolygon::New(); aPolygon->GetPointIds()->SetNumberOfIds(3); - const GEOLIB::Triangle* triangle = (**it)[i]; + const GeoLib::Triangle* triangle = (**it)[i]; for (size_t j = 0; j < 3; j++) aPolygon->GetPointIds()->SetId(j, ((*triangle)[2 - j])); newPolygons->InsertNextCell(aPolygon); diff --git a/Gui/VtkVis/VtkSurfacesSource.h b/Gui/VtkVis/VtkSurfacesSource.h index f9e57ad04cf..6a0c53ec509 100644 --- a/Gui/VtkVis/VtkSurfacesSource.h +++ b/Gui/VtkVis/VtkSurfacesSource.h @@ -27,7 +27,7 @@ public: vtkTypeRevisionMacro(VtkSurfacesSource,vtkPolyDataAlgorithm); /// Sets the surfaces vector - void setSurfaces(const std::vector<GEOLIB::Surface*>* surfaces) { _surfaces = surfaces; } + void setSurfaces(const std::vector<GeoLib::Surface*>* surfaces) { _surfaces = surfaces; } /// Prints its data on a stream. void PrintSelf(ostream& os, vtkIndent indent); @@ -53,7 +53,7 @@ protected: vtkInformationVector* outputVector); /// The surfaces to visualize - const std::vector<GEOLIB::Surface*>* _surfaces; + const std::vector<GeoLib::Surface*>* _surfaces; private: }; diff --git a/Gui/VtkVis/VtkTextureOnSurfaceFilter.cpp b/Gui/VtkVis/VtkTextureOnSurfaceFilter.cpp index e2721911148..365de8c7603 100644 --- a/Gui/VtkVis/VtkTextureOnSurfaceFilter.cpp +++ b/Gui/VtkVis/VtkTextureOnSurfaceFilter.cpp @@ -84,9 +84,9 @@ int VtkTextureOnSurfaceFilter::RequestData( vtkInformation* request, else { points->GetPoint(i-1, coords); - GEOLIB::Point* pnt = new GEOLIB::Point(coords); + GeoLib::Point* pnt = new GeoLib::Point(coords); points->GetPoint(i, coords); - GEOLIB::Point* pnt2 = new GEOLIB::Point(coords); + GeoLib::Point* pnt2 = new GeoLib::Point(coords); if (i<173) dist += sqrt(MathLib::sqrDist(pnt, pnt2)); else @@ -103,7 +103,7 @@ int VtkTextureOnSurfaceFilter::RequestData( vtkInformation* request, { double coords[3]; points->GetPoint(i, coords); - float newcoords[2] = { MathLib::normalize(min.first, max.first, coords[0]), + float newcoords[2] = { MathLib::normalize(min.first, max.first, coords[0]), MathLib::normalize(min.second,max.second, coords[1])}; textureCoordinates->InsertNextTuple(newcoords); } diff --git a/Gui/VtkVis/VtkVisPipeline.cpp b/Gui/VtkVis/VtkVisPipeline.cpp index 06929b79030..6d02de329ce 100644 --- a/Gui/VtkVis/VtkVisPipeline.cpp +++ b/Gui/VtkVis/VtkVisPipeline.cpp @@ -83,7 +83,7 @@ bool VtkVisPipeline::setData( const QModelIndex &index, const QVariant &value, return TreeModel::setData(index, value, role); } -void VtkVisPipeline::addLight(const GEOLIB::Point &pos) +void VtkVisPipeline::addLight(const GeoLib::Point &pos) { double lightPos[3]; for (std::list<vtkLight*>::iterator it = _lights.begin(); it != _lights.end(); ++it) @@ -98,7 +98,7 @@ void VtkVisPipeline::addLight(const GEOLIB::Point &pos) _lights.push_back(l); } -vtkLight* VtkVisPipeline::getLight(const GEOLIB::Point &pos) const +vtkLight* VtkVisPipeline::getLight(const GeoLib::Point &pos) const { double lightPos[3]; for (std::list<vtkLight*>::const_iterator it = _lights.begin(); it != _lights.end(); ++it) @@ -110,7 +110,7 @@ vtkLight* VtkVisPipeline::getLight(const GEOLIB::Point &pos) const return NULL; } -void VtkVisPipeline::removeLight(const GEOLIB::Point &pos) +void VtkVisPipeline::removeLight(const GeoLib::Point &pos) { double lightPos[3]; for (std::list<vtkLight*>::iterator it = _lights.begin(); it != _lights.end(); ++it) @@ -260,7 +260,7 @@ void VtkVisPipeline::setGlobalBackfaceCulling(bool enable) const void VtkVisPipeline::addPipelineItem(GeoTreeModel* model, const std::string &name, - GEOLIB::GEOTYPE type) + GeoLib::GEOTYPE type) { addPipelineItem(model->vtkSource(name, type)); } @@ -356,7 +356,7 @@ QModelIndex VtkVisPipeline::addPipelineItem( vtkAlgorithm* source, void VtkVisPipeline::removeSourceItem(GeoTreeModel* model, const std::string &name, - GEOLIB::GEOTYPE type) + GeoLib::GEOTYPE type) { for (int i = 0; i < _rootItem->childCount(); i++) { diff --git a/Gui/VtkVis/VtkVisPipeline.h b/Gui/VtkVis/VtkVisPipeline.h index 1594232a928..93152b70be3 100644 --- a/Gui/VtkVis/VtkVisPipeline.h +++ b/Gui/VtkVis/VtkVisPipeline.h @@ -52,13 +52,13 @@ public: bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); /// \brief Adds a light to the scene at the given coordinates. - void addLight(const GEOLIB::Point &pos); + void addLight(const GeoLib::Point &pos); /// \brief Returns a light (or NULL) for the given coordinates. - vtkLight* getLight(const GEOLIB::Point &pos) const; + vtkLight* getLight(const GeoLib::Point &pos) const; /// \brief Removes a light at the given coordinates (if possible). - void removeLight(const GEOLIB::Point &pos); + void removeLight(const GeoLib::Point &pos); /// \brief Returns the background-colour of the scene. const QColor getBGColor() const; @@ -88,7 +88,7 @@ public: public slots: /// \brief Adds the given Model to the pipeline. void addPipelineItem(MshModel* model, const QModelIndex &idx); - void addPipelineItem(GeoTreeModel* model, const std::string &name, GEOLIB::GEOTYPE type); + void addPipelineItem(GeoTreeModel* model, const std::string &name, GeoLib::GEOTYPE type); void addPipelineItem(ProcessModel* model, const FiniteElement::ProcessType pcs_type, FEMCondition::CondType cond_type); void addPipelineItem(StationTreeModel* model, const std::string &name); QModelIndex addPipelineItem(VtkVisPipelineItem* item, const QModelIndex &parent); @@ -98,7 +98,7 @@ public slots: /// \brief Removes the given Model (and all attached vtkAlgorithms) from the pipeline. void removeSourceItem(MshModel* model, const QModelIndex &idx); - void removeSourceItem(GeoTreeModel* model, const std::string &name, GEOLIB::GEOTYPE type); + void removeSourceItem(GeoTreeModel* model, const std::string &name, GeoLib::GEOTYPE type); void removeSourceItem(ProcessModel* model, const FiniteElement::ProcessType pcs_type, FEMCondition::CondType cond_type); void removeSourceItem(StationTreeModel* model, const std::string &name); diff --git a/Gui/VtkVis/VtkVisTabWidget.cpp b/Gui/VtkVis/VtkVisTabWidget.cpp index 2901f6de52f..12131eac942 100644 --- a/Gui/VtkVis/VtkVisTabWidget.cpp +++ b/Gui/VtkVis/VtkVisTabWidget.cpp @@ -132,7 +132,7 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) //VtkStationSource* test = dynamic_cast<VtkStationSource*>(_item->algorithm()); //if (test) //{ - // std::map<std::string, GEOLIB::Color> colors = test->getColorLookupTable(); + // std::map<std::string, GeoLib::Color> colors = test->getColorLookupTable(); // if (!colors.empty()) // { // ColorTableModel* ctm = new ColorTableModel(colors); diff --git a/Gui/mainwindow.cpp b/Gui/mainwindow.cpp index 61c277e1c4e..cd68e6bee07 100644 --- a/Gui/mainwindow.cpp +++ b/Gui/mainwindow.cpp @@ -152,23 +152,23 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) this, SLOT(showDiagramPrefsDialog(QModelIndex &))); // connect treeview to diagramview // geo model connects - connect(geoTabWidget->treeView, SIGNAL(listRemoved(std::string, GEOLIB::GEOTYPE)), - _geoModels, SLOT(removeGeometry(std::string, GEOLIB::GEOTYPE))); + connect(geoTabWidget->treeView, SIGNAL(listRemoved(std::string, GeoLib::GEOTYPE)), + _geoModels, SLOT(removeGeometry(std::string, GeoLib::GEOTYPE))); connect(geoTabWidget->treeView, SIGNAL(saveToFileRequested(QString, QString)), this, SLOT(writeGeometryToFile(QString, QString))); // save geometry to file connect(geoTabWidget->treeView, SIGNAL(requestLineEditDialog(const std::string &)), this, SLOT(showLineEditDialog(const std::string &))); // open line edit dialog - connect(geoTabWidget->treeView, SIGNAL(requestNameChangeDialog(const std::string&, const GEOLIB::GEOTYPE, size_t)), - this, SLOT(showGeoNameDialog(const std::string&, const GEOLIB::GEOTYPE, size_t))); - connect(geoTabWidget->treeView, SIGNAL(requestCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, size_t, bool)), - this, SLOT(showCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, size_t, bool))); + connect(geoTabWidget->treeView, SIGNAL(requestNameChangeDialog(const std::string&, const GeoLib::GEOTYPE, size_t)), + this, SLOT(showGeoNameDialog(const std::string&, const GeoLib::GEOTYPE, size_t))); + connect(geoTabWidget->treeView, SIGNAL(requestCondSetupDialog(const std::string&, const GeoLib::GEOTYPE, size_t, bool)), + this, SLOT(showCondSetupDialog(const std::string&, const GeoLib::GEOTYPE, size_t, bool))); connect(geoTabWidget->treeView, SIGNAL(loadFEMCondFileRequested(std::string)), this, SLOT(loadFEMConditions(std::string))); // add FEM Conditions //connect(geoTabWidget->treeView, SIGNAL(saveFEMConditionsRequested(QString, QString)), // this, SLOT(writeFEMConditionsToFile(QString, QString))); - connect(_geoModels, SIGNAL(geoDataAdded(GeoTreeModel *, std::string, GEOLIB::GEOTYPE)), + connect(_geoModels, SIGNAL(geoDataAdded(GeoTreeModel *, std::string, GeoLib::GEOTYPE)), this, SLOT(updateDataViews())); - connect(_geoModels, SIGNAL(geoDataRemoved(GeoTreeModel *, std::string, GEOLIB::GEOTYPE)), + connect(_geoModels, SIGNAL(geoDataRemoved(GeoTreeModel *, std::string, GeoLib::GEOTYPE)), this, SLOT(updateDataViews())); connect(geoTabWidget->treeView, SIGNAL(geoItemSelected(const vtkPolyDataAlgorithm*, int)), _vtkVisPipeline, SLOT(highlightGeoObject(const vtkPolyDataAlgorithm*, int))); @@ -183,10 +183,10 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) _elementModel, SLOT(clearView())); connect(mshTabWidget->treeView, SIGNAL(qualityCheckRequested(VtkMeshSource*)), this, SLOT(showMshQualitySelectionDialog(VtkMeshSource*))); - connect(mshTabWidget->treeView, SIGNAL(requestCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, size_t, bool)), - this, SLOT(showCondSetupDialog(const std::string&, const GEOLIB::GEOTYPE, size_t, bool))); - connect(mshTabWidget->treeView, SIGNAL(requestDIRECTSourceTerms(const std::string, const std::vector<GEOLIB::Point*>*)), - this, SLOT(loadDIRECTSourceTermsFromASCII(const std::string, const std::vector<GEOLIB::Point*>*))); + connect(mshTabWidget->treeView, SIGNAL(requestCondSetupDialog(const std::string&, const GeoLib::GEOTYPE, size_t, bool)), + this, SLOT(showCondSetupDialog(const std::string&, const GeoLib::GEOTYPE, size_t, bool))); + connect(mshTabWidget->treeView, SIGNAL(requestDIRECTSourceTerms(const std::string, const std::vector<GeoLib::Point*>*)), + this, SLOT(loadDIRECTSourceTermsFromASCII(const std::string, const std::vector<GeoLib::Point*>*))); // Setup connections for process model to GUI connect(modellingTabWidget->treeView, SIGNAL(conditionsRemoved(const FiniteElement::ProcessType, const std::string&, const FEMCondition::CondType)), @@ -199,10 +199,10 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) this, SLOT(showConditionWriterDialog())); // VisPipeline Connects - connect(_geoModels, SIGNAL(geoDataAdded(GeoTreeModel *, std::string, GEOLIB::GEOTYPE)), - _vtkVisPipeline, SLOT(addPipelineItem(GeoTreeModel *, std::string, GEOLIB::GEOTYPE))); - connect(_geoModels, SIGNAL(geoDataRemoved(GeoTreeModel *, std::string, GEOLIB::GEOTYPE)), - _vtkVisPipeline, SLOT(removeSourceItem(GeoTreeModel *, std::string, GEOLIB::GEOTYPE))); + connect(_geoModels, SIGNAL(geoDataAdded(GeoTreeModel *, std::string, GeoLib::GEOTYPE)), + _vtkVisPipeline, SLOT(addPipelineItem(GeoTreeModel *, std::string, GeoLib::GEOTYPE))); + connect(_geoModels, SIGNAL(geoDataRemoved(GeoTreeModel *, std::string, GeoLib::GEOTYPE)), + _vtkVisPipeline, SLOT(removeSourceItem(GeoTreeModel *, std::string, GeoLib::GEOTYPE))); connect(_processModel, SIGNAL(conditionAdded(ProcessModel *, const FiniteElement::ProcessType, const FEMCondition::CondType)), _vtkVisPipeline, SLOT(addPipelineItem(ProcessModel *, const FiniteElement::ProcessType, const FEMCondition::CondType))); @@ -344,13 +344,13 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) _visPrefsDialog = new VisPrefsDialog(_vtkVisPipeline, visualizationWidget); - // std::cout << "size of Point: " << sizeof (GEOLIB::Point) << std::endl; + // std::cout << "size of Point: " << sizeof (GeoLib::Point) << std::endl; // std::cout << "size of CGLPoint: " << sizeof (CGLPoint) << std::endl; // - // std::cout << "size of Polyline: " << sizeof (GEOLIB::Polyline) << std::endl; + // std::cout << "size of Polyline: " << sizeof (GeoLib::Polyline) << std::endl; // std::cout << "size of CGLPolyline: " << sizeof (CGLPolyline) << std::endl; // - // std::cout << "size of GEOLIB::Surface: " << sizeof (GEOLIB::Surface) << std::endl; + // std::cout << "size of GeoLib::Surface: " << sizeof (GeoLib::Surface) << std::endl; // std::cout << "size of Surface: " << sizeof (Surface) << std::endl; // // std::cout << "size of CCore: " << sizeof (MeshLib::CCore) << std::endl; @@ -635,8 +635,8 @@ void MainWindow::loadFile(const QString &fileName) // GMS borehole files else if (fi.suffix().toLower() == "txt") { - std::vector<GEOLIB::Point*>* boreholes = - new std::vector<GEOLIB::Point*>(); + std::vector<GeoLib::Point*>* boreholes = + new std::vector<GeoLib::Point*>(); std::string name = fi.baseName().toStdString(); if (GMSInterface::readBoreholesFromGMS(boreholes, fileName.toStdString())) @@ -1102,9 +1102,9 @@ void MainWindow::addFEMConditions(const std::vector<FEMCondition*> conditions) if (conditions[i]->getProcessDistributionType() == FiniteElement::DIRECT) { if (_meshModels->getMesh(conditions[i]->getAssociatedGeometryName()) != NULL) { - std::vector<GEOLIB::Point*> *points = GEOLIB::PointVec::deepcopy(_meshModels->getMesh(conditions[i]->getAssociatedGeometryName())->getNodes()); - GEOLIB::PointVec pnt_vec("MeshNodes", points); - std::vector<GEOLIB::Point*> *cond_points = pnt_vec.getSubset(conditions[i]->getDisNodes()); + std::vector<GeoLib::Point*> *points = GeoLib::PointVec::deepcopy(_meshModels->getMesh(conditions[i]->getAssociatedGeometryName())->getNodes()); + GeoLib::PointVec pnt_vec("MeshNodes", points); + std::vector<GeoLib::Point*> *cond_points = pnt_vec.getSubset(conditions[i]->getDisNodes()); std::string geo_name = conditions[i]->getGeoName(); this->_geoModels->addPointVec(cond_points, geo_name); conditions[i]->setGeoName(geo_name); // this might have been changed upon inserting it into geo_objects @@ -1132,7 +1132,7 @@ void MainWindow::addFEMConditions(const std::vector<FEMCondition*> conditions) } // Legacy function (only required for ascii st-files): reads values for 'direct' source terms -void MainWindow::loadDIRECTSourceTermsFromASCII(const std::string mshname, const std::vector<GEOLIB::Point*>* points) +void MainWindow::loadDIRECTSourceTermsFromASCII(const std::string mshname, const std::vector<GeoLib::Point*>* points) { std::string geo_name(mshname); @@ -1160,9 +1160,9 @@ void MainWindow::loadDIRECTSourceTermsFromASCII(const std::string mshname, const st->setGeoName(mshname); st->setDisValues(node_values); - std::vector<GEOLIB::Point*> *points2 = GEOLIB::PointVec::deepcopy(points); - GEOLIB::PointVec pnt_vec("MeshNodes", points2); - std::vector<GEOLIB::Point*> *cond_points = pnt_vec.getSubset(st->getDisNodes()); + std::vector<GeoLib::Point*> *points2 = GeoLib::PointVec::deepcopy(points); + GeoLib::PointVec pnt_vec("MeshNodes", points2); + std::vector<GeoLib::Point*> *cond_points = pnt_vec.getSubset(st->getDisNodes()); std::string geometry_name = st->getGeoName(); this->_geoModels->addPointVec(cond_points, geometry_name); this->_processModel->addCondition(st); @@ -1226,7 +1226,7 @@ void MainWindow::writeStationListToFile(QString listName, QString fileName) void MainWindow::exportBoreholesToGMS(std::string listName, std::string fileName) { - const std::vector<GEOLIB::Point*>* stations(_geoModels->getStationVec(listName)); + const std::vector<GeoLib::Point*>* stations(_geoModels->getStationVec(listName)); GMSInterface::writeBoreholesToGMS(stations, fileName); } @@ -1252,13 +1252,13 @@ void MainWindow::callGMSH(std::vector<std::string> & selectedGeometries, if (!fileName.isEmpty()) { if (param4 == -1) { // adaptive meshing selected - GMSHInterface gmsh_io(*(static_cast<GEOLIB::GEOObjects*> (_geoModels)), true, + GMSHInterface gmsh_io(*(static_cast<GeoLib::GEOObjects*> (_geoModels)), true, FileIO::GMSH::AdaptiveMeshDensity, param2, param3, param1, selectedGeometries); gmsh_io.setPrecision(20); gmsh_io.writeToFile(fileName.toStdString()); } else { // homogeneous meshing selected - GMSHInterface gmsh_io(*(static_cast<GEOLIB::GEOObjects*> (_geoModels)), true, + GMSHInterface gmsh_io(*(static_cast<GeoLib::GEOObjects*> (_geoModels)), true, FileIO::GMSH::FixedMeshDensity, param4, param3, param1, selectedGeometries); gmsh_io.setPrecision(20); @@ -1310,17 +1310,17 @@ void MainWindow::showConditionWriterDialog() void MainWindow::showDiagramPrefsDialog(QModelIndex &index) { QString listName; - GEOLIB::Station* stn = _geoModels->getStationModel()->stationFromIndex( + GeoLib::Station* stn = _geoModels->getStationModel()->stationFromIndex( index, listName); - if ((stn->type() == GEOLIB::Station::STATION) && stn->getSensorData()) + if ((stn->type() == GeoLib::Station::STATION) && stn->getSensorData()) { DiagramPrefsDialog* prefs ( new DiagramPrefsDialog(stn) ); //DiagramPrefsDialog* prefs = new DiagramPrefsDialog(stn, listName, _db); prefs->setAttribute(Qt::WA_DeleteOnClose); prefs->show(); } - if (stn->type() == GEOLIB::Station::BOREHOLE) + if (stn->type() == GeoLib::Station::BOREHOLE) OGSError::box("No time series data available for borehole."); } @@ -1348,22 +1348,22 @@ void MainWindow::showFileConverterDialog() dlg.exec(); } -void MainWindow::showGeoNameDialog(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id) +void MainWindow::showGeoNameDialog(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, size_t id) { std::string old_name = this->_geoModels->getElementNameByID(geometry_name, object_type, id); - SetNameDialog dlg(geometry_name, GEOLIB::convertGeoTypeToString(object_type), id, old_name); - connect(&dlg, SIGNAL(requestNameChange(const std::string&, const GEOLIB::GEOTYPE, size_t, std::string)), - this->_geoModels, SLOT(addNameForElement(const std::string&, const GEOLIB::GEOTYPE, size_t, std::string))); + SetNameDialog dlg(geometry_name, GeoLib::convertGeoTypeToString(object_type), id, old_name); + connect(&dlg, SIGNAL(requestNameChange(const std::string&, const GeoLib::GEOTYPE, size_t, std::string)), + this->_geoModels, SLOT(addNameForElement(const std::string&, const GeoLib::GEOTYPE, size_t, std::string))); dlg.exec(); static_cast<GeoTreeModel*>(this->geoTabWidget->treeView->model())->setNameForItem(geometry_name, object_type, id, this->_geoModels->getElementNameByID(geometry_name, object_type, id)); } -void MainWindow::showCondSetupDialog(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id, bool on_points) +void MainWindow::showCondSetupDialog(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, size_t id, bool on_points) { std::string geo_name(""); - if (object_type != GEOLIB::INVALID) + if (object_type != GeoLib::INVALID) geo_name = this->_geoModels->getElementNameByID(geometry_name, object_type, id); else geo_name = geometry_name; // in this case this is actually the mesh name @@ -1381,7 +1381,7 @@ void MainWindow::showCondSetupDialog(const std::string &geometry_name, const GEO if (on_points) this->_geoModels->addNameForObjectPoints(geometry_name, object_type, geo_name, geometry_name); - if (object_type != GEOLIB::INVALID) + if (object_type != GeoLib::INVALID) { FEMConditionSetupDialog dlg(geometry_name, object_type, geo_name, this->_geoModels->getGEOObject(geometry_name, object_type, geo_name), on_points); connect(&dlg, SIGNAL(createFEMCondition(std::vector<FEMCondition*>)), this, SLOT(addFEMConditions(std::vector<FEMCondition*>))); @@ -1440,15 +1440,15 @@ void MainWindow::FEMTestStart() _meshModels->addMesh(MshEditor::getMeshSurface(*_project.getMesh("Ammer-Homogen100m-Final")), name); /* - const std::vector<GEOLIB::Polyline*> *lines = this->_geoModels->getPolylineVec("WESS Rivers"); + const std::vector<GeoLib::Polyline*> *lines = this->_geoModels->getPolylineVec("WESS Rivers"); MeshLib::CFEMesh* mesh = const_cast<MeshLib::CFEMesh*>(_project.getMesh("Ammer-Homogen100m-Final")); std::vector<size_t> nodes; mesh->GetNODOnPLY((*lines)[0], nodes); - std::vector<GEOLIB::Point*> *points = new std::vector<GEOLIB::Point*>(nodes.size()); + std::vector<GeoLib::Point*> *points = new std::vector<GeoLib::Point*>(nodes.size()); for (size_t i=0; i<nodes.size(); i++) { - (*points)[i] = new GEOLIB::Point(mesh->nod_vector[nodes[i]]->getData()); + (*points)[i] = new GeoLib::Point(mesh->nod_vector[nodes[i]]->getData()); } std::string testpoints_name("testpoints"); _geoModels->addPointVec(points, testpoints_name); diff --git a/Gui/mainwindow.h b/Gui/mainwindow.h index 6da7ce35f67..f39928a1867 100644 --- a/Gui/mainwindow.h +++ b/Gui/mainwindow.h @@ -83,9 +83,9 @@ protected slots: void showAddPipelineFilterItemDialog(QModelIndex parentIndex); void showConditionWriterDialog(); /// Call dialog for creating or modifying FEM conditions. - void showCondSetupDialog(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id, bool on_points = false); + void showCondSetupDialog(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, size_t id, bool on_points = false); /// Allows setting the name for a geometric object - void showGeoNameDialog(const std::string &geometry_name, const GEOLIB::GEOTYPE object_type, size_t id); + void showGeoNameDialog(const std::string &geometry_name, const GeoLib::GEOTYPE object_type, size_t id); /// Calls the diagram prefs dialog from the Tools menu. void showDiagramPrefsDialog(); /// Calls the diagram prefs dialog from the station list (i.e. for a specific station). @@ -113,7 +113,7 @@ protected slots: void startPresentationMode(); void quitPresentationMode(); - void loadDIRECTSourceTermsFromASCII(const std::string name, const std::vector<GEOLIB::Point*>* points); //TODO put this in a better place + void loadDIRECTSourceTermsFromASCII(const std::string name, const std::vector<GeoLib::Point*>* points); //TODO put this in a better place private: QMenu* createImportFilesMenu(); diff --git a/SimpleTests/MatrixTests/CMakeLists.txt b/SimpleTests/MatrixTests/CMakeLists.txt index 896517076a3..dcd0dc51482 100644 --- a/SimpleTests/MatrixTests/CMakeLists.txt +++ b/SimpleTests/MatrixTests/CMakeLists.txt @@ -31,7 +31,7 @@ ADD_EXECUTABLE( MatVecMultPthreads ${HEADERS} ) SET_TARGET_PROPERTIES(MatVecMultPthreads PROPERTIES FOLDER SimpleTests) -TARGET_LINK_LIBRARIES(MatVecMultPthreads +TARGET_LINK_LIBRARIES(MatVecMultPthreads pthread BaseLib MathLib diff --git a/SimpleTests/MeshTests/CMakeLists.txt b/SimpleTests/MeshTests/CMakeLists.txt index 7640be288b8..4ce54caa20e 100644 --- a/SimpleTests/MeshTests/CMakeLists.txt +++ b/SimpleTests/MeshTests/CMakeLists.txt @@ -21,8 +21,8 @@ ADD_EXECUTABLE( MeshRead TARGET_LINK_LIBRARIES ( MeshRead MeshLib - FileIO - MathLib + FileIO + MathLib BaseLib GeoLib logog @@ -38,8 +38,8 @@ ADD_EXECUTABLE( CollapseMeshNodes TARGET_LINK_LIBRARIES ( CollapseMeshNodes MeshLib - FileIO - MathLib + FileIO + MathLib BaseLib GeoLib logog diff --git a/Utils/FileConverter/CMakeLists.txt b/Utils/FileConverter/CMakeLists.txt new file mode 100644 index 00000000000..86c19a276c0 --- /dev/null +++ b/Utils/FileConverter/CMakeLists.txt @@ -0,0 +1,124 @@ + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/Utils/FileConverter + ${CMAKE_SOURCE_DIR}/BaseLib + ${CMAKE_SOURCE_DIR}/GeoLib + ${CMAKE_SOURCE_DIR}/FileIO + ${CMAKE_SOURCE_DIR}/MathLib + ${CMAKE_SOURCE_DIR}/FemLib + ${CMAKE_SOURCE_DIR}/MeshLib + ${CMAKE_SOURCE_DIR}/Gui/OpenSG +) + +## Shape to GLI file converter ## +IF (Shapelib_FOUND) + + INCLUDE_DIRECTORIES (${Shapelib_INCLUDE_DIR}) + + # Create executables + ADD_EXECUTABLE( ConvertSHPToGLI ConvertSHPToGLI.cpp ) + SET_TARGET_PROPERTIES(ConvertSHPToGLI PROPERTIES FOLDER Utilities) + + TARGET_LINK_LIBRARIES( ConvertSHPToGLI + FEM + MSH + MSHGEOTOOLS + FileIO + GEO + MathLib + Base + OGSProject + ${Shapelib_LIBRARIES} + ${QT_LIBRARIES} + ) + + IF (OGS_PACKAGING) + INSTALL ( TARGETS ConvertSHPToGLI RUNTIME DESTINATION bin COMPONENT ConvertSHPToGLI ) + ENDIF (OGS_PACKAGING) + +ENDIF (Shapelib_FOUND) + +## VTK to OpenSG file converter ## +IF (OGS_USE_OPENSG AND VTK_FOUND AND Boost_FOUND) + + INCLUDE( ${VTK_USE_FILE} ) + + ADD_EXECUTABLE (ConvertVtkToOsg ConvertVtkToOsg.cpp) + SET_TARGET_PROPERTIES(ConvertVtkToOsg PROPERTIES FOLDER Utilities) + + USE_OPENSG ( ConvertVtkToOsg ) + INCLUDE_DIRECTORIES ( ${CMAKE_SOURCE_DIR}/Gui/OpenSG ${Boost_INCLUDE_DIRS} ) + TARGET_LINK_LIBRARIES ( ConvertVtkToOsg OgsOpenSG vtkRendering vtkIO ${Boost_LIBRARIES} ) + + IF (OGS_PACKAGING) + INSTALL ( TARGETS ConvertVtkToOsg RUNTIME DESTINATION bin COMPONENT ConvertVtkToOsg ) + ENDIF (OGS_PACKAGING) + +ENDIF () # OGS_USE_OPENSG AND VTK_FOUND AND Boost_FOUND + +## Gli to VTK file converter ## +IF(VTK_FOUND AND Boost_FOUND) + + INCLUDE( ${VTK_USE_FILE} ) + + ADD_EXECUTABLE (ConvertGliToVtk ConvertGliToVtk.cpp) + SET_TARGET_PROPERTIES(ConvertGliToVtk PROPERTIES FOLDER Utilities) + + INCLUDE_DIRECTORIES ( ${Boost_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/Gui/VtkVis ) + TARGET_LINK_LIBRARIES ( ConvertGliToVtk FileIO VtkVis vtkRendering vtkIO +boost_filesystem-mt boost_system-mt boost_regex-mt) + + IF (OGS_PACKAGING) + INSTALL ( TARGETS ConvertGliToVtk RUNTIME DESTINATION bin COMPONENT ConvertGliToVtk ) + ENDIF (OGS_PACKAGING) + +ENDIF() # VTK_FOUND AND Boost_FOUND + +IF (QT4_FOUND) + ADD_EXECUTABLE (generateBCandGLI generateBCandGLI.cpp ) + TARGET_LINK_LIBRARIES (generateBCandGLI + FEM + MSH + MSHGEOTOOLS + FileIO + GEO + MathLib + Base + OGSProject + ${QT_LIBRARIES} + ) + + ADD_EXECUTABLE (generateBCFromPolyline generateBCFromPolyline.cpp ) + TARGET_LINK_LIBRARIES (generateBCFromPolyline + FEM + MSH + MSHGEOTOOLS + FileIO + GEO + MathLib + Base + OGSProject + ${QT_LIBRARIES} + ) + + ADD_EXECUTABLE (generateMatPropsFromMatID generateMatPropsFromMatID.cpp ) + TARGET_LINK_LIBRARIES (generateMatPropsFromMatID + FEM + MSH + FileIO + Base + OGSProject + ${QT_LIBRARIES} + ) + + SET_TARGET_PROPERTIES(generateBCandGLI generateBCFromPolyline generateMatPropsFromMatID + PROPERTIES FOLDER Utilities) + +ENDIF () # QT4_FOUND + +ADD_EXECUTABLE (GMSH2OGS GMSH2OGS.cpp) +SET_TARGET_PROPERTIES(GMSH2OGS PROPERTIES FOLDER Utilities) +TARGET_LINK_LIBRARIES (GMSH2OGS + MSH + FileIO +) diff --git a/Utils/FileConverter/ConvertGliToVtk.cpp b/Utils/FileConverter/ConvertGliToVtk.cpp new file mode 100644 index 00000000000..4850fcd47ee --- /dev/null +++ b/Utils/FileConverter/ConvertGliToVtk.cpp @@ -0,0 +1,94 @@ +/** + * \file ConvertGliToVtk.cpp + * 06/05/2010 LB Initial implementation + * + * Implementation of ConvertGliToVtk utility + */ + +// for backward compatibility, see http://www.boost.org/doc/libs/1_48_0/libs/filesystem/v2/doc/index.htm +#define BOOST_FILESYSTEM_VERSION 2 + +// ** INCLUDES ** +#include "GEOObjects.h" +#include "OGSIOVer4.h" +#include "Point.h" +#include "VtkPointsSource.h" + +#include <boost/filesystem/operations.hpp> +#include <boost/regex.hpp> +#include <iostream> +#include <vector> + +#include <vtkPolyDataWriter.h> +#include <vtkSmartPointer.h> + +using namespace boost::filesystem; +using namespace std; +using namespace GeoLib; + +// Replace file extension +void replaceExt(string& s, const string& newExt) +{ + string::size_type i = s.rfind('.', s.length()); + if (i != string::npos) + s.replace(i + 1, newExt.length(), newExt); +} + +// Converts gli to vtk. (atm only points) +// No arguments: batch convert all gli files +// file argument: convert only the specified file +int main (int argc, char const* argv[]) +{ + vector<string> filenames; + if (argc == 2) + filenames.push_back(string(argv[1])); + + if (filenames.empty()) + { + const boost::regex e(".+\\.gli"); + directory_iterator end; + for (directory_iterator it("./"); it != end; ++it) + { + string curFile = it->path().filename(); // .string(); + + if (regex_match(curFile, e)) + filenames.push_back(curFile); + } + } + + vtkPolyDataWriter* writer = vtkPolyDataWriter::New(); + + for (vector<string>::const_iterator it = filenames.begin(); it != filenames.end(); ++it) + { + string filename(*it); + cout << "Opening file " << filename << " ... " << endl << flush; + + GeoLib::GEOObjects* geo (new GeoLib::GEOObjects); + std::string unique_name; + std::vector<std::string> error_strings; + FileIO::readGLIFileV4(filename, geo, unique_name, error_strings); + const std::vector< Point* >* pnts = geo->getPointVec(filename); + if (pnts) + { + string vtkFilename = filename; + replaceExt(vtkFilename, "vtk"); + + VtkPointsSource* vtkPoints = VtkPointsSource::New(); + vtkPoints->setPoints(pnts); + writer->SetInputConnection(vtkPoints->GetOutputPort()); + writer->SetFileName(vtkFilename.c_str()); + writer->Write(); + vtkPoints->Delete(); + } + + // TODO convert polylines and surfaces as well + + delete geo; + } + + writer->Delete(); // TODO crashes + + cout << "File conversion finished" << endl; + + return 0; +} diff --git a/Utils/FileConverter/ConvertSHPToGLI.cpp b/Utils/FileConverter/ConvertSHPToGLI.cpp new file mode 100644 index 00000000000..01fca740f28 --- /dev/null +++ b/Utils/FileConverter/ConvertSHPToGLI.cpp @@ -0,0 +1,255 @@ +/* + * ConvertSHPToGLI.cpp + * + * Created on: May 3, 2010 + * Author: TF + */ + +//ShapeLib includes +#include "shapefil.h" + +// STL +#include <fstream> +#include <iostream> +#include <vector> + +// Base +#include "StringTools.h" + +// FileIO +#include "XmlIO/XmlGmlInterface.h" +#include "XmlIO/XmlStnInterface.h" + +// GEO +#include "GEOObjects.h" +#include "Point.h" +#include "ProjectData.h" +#include "Station.h" + +#include "problem.h" +Problem* aproblem = NULL; + +void convertPoints (DBFHandle dbf_handle, + std::string const& out_fname, + size_t x_id, + size_t y_id, + size_t z_id, + std::vector<size_t> const& name_component_ids, + std::string& points_group_name, + bool station) +{ + int n_records (DBFGetRecordCount (dbf_handle)); + std::cout << "writing " << n_records << " records" << std::endl; + +// out << "#POINTS" << std::endl; +// +// for (int k(0); k<n_records; k++) { +// double x (DBFReadDoubleAttribute( dbf_handle, k, x_id)); +// double y (DBFReadDoubleAttribute( dbf_handle, k, y_id)); +// double z (0.0); +// if (z_id != std::numeric_limits<size_t>::max()) +// z = DBFReadDoubleAttribute( dbf_handle, k, z_id); +// out.precision (10); +// out.flags (std::ios::fixed); +// out << k << " " << x << " " << y << " " << z << std::flush; +// if (!name_component_ids.empty()) { +// out << " $NAME "; +// for (size_t j(0); j<name_component_ids.size(); j++) { +// if (name_component_ids[j] != std::numeric_limits<size_t>::max()) { +// std::string name (DBFReadStringAttribute( dbf_handle, k, name_component_ids[j])); +// out << name.c_str() << " "; +// } +// } +// } +// out << std::endl; +// } +// out << "#STOP" << std::endl; + + std::vector<GeoLib::Point*>* points (new std::vector<GeoLib::Point*>); + points->reserve (n_records); + + std::string name; + for (int k = 0; k < n_records; k++) { + double x(DBFReadDoubleAttribute(dbf_handle, k, x_id)); + double y(DBFReadDoubleAttribute(dbf_handle, k, y_id)); + double z(0.0); + if (z_id != std::numeric_limits<size_t>::max()) z = DBFReadDoubleAttribute(dbf_handle, k, + z_id); + + name = ""; + if (!name_component_ids.empty()) { + for (size_t j(0); j < name_component_ids.size(); j++) + if (name_component_ids[j] != std::numeric_limits<size_t>::max()) { + name += DBFReadStringAttribute(dbf_handle, k, name_component_ids[j]); + name += " "; + } + } else name = number2str(k); + + if (station) { + GeoLib::Station* pnt(GeoLib::Station::createStation(name, x, y, z)); + points->push_back(pnt); + } else { + GeoLib::Point* pnt(new GeoLib::Point(x, y, z)); + points->push_back(pnt); + } + } + + GeoLib::GEOObjects* geo_objs (new GeoLib::GEOObjects()); + if (station) + geo_objs->addStationVec(points, points_group_name); + else + geo_objs->addPointVec(points, points_group_name); + + std::string schema_name; + if (station) + schema_name = "OpenGeoSysSTN.xsd"; + else + schema_name = "OpenGeoSysGLI.xsd"; + ProjectData* project_data (new ProjectData); + project_data->setGEOObjects (geo_objs); + if (station) { + FileIO::XmlStnInterface xml (project_data, schema_name); + xml.setNameForExport(points_group_name); + xml.writeToFile(out_fname); + } else { + FileIO::XmlGmlInterface xml (project_data, schema_name); + xml.setNameForExport(points_group_name); + xml.writeToFile(out_fname); + } + + delete project_data; +} + +int main (int argc, char* argv[]) +{ + if (argc == 1) + { + std::cout << "Usage: " << argv[0] << " shape_file_name" << std::endl; + return -1; + } + + std::string fname (argv[1]); + + /* from SHPInterface.cpp */ + int shape_type, number_of_elements; + double padfMinBound[4], padfMaxBound[4]; + + SHPHandle hSHP = SHPOpen(fname.c_str(),"rb"); + SHPGetInfo( hSHP, &number_of_elements, &shape_type, padfMinBound, padfMaxBound ); + + if ((shape_type - 1) % 10 == 0) + std::cout << "shape file contains " << number_of_elements << " points" << std::endl; + if ( ((shape_type - 3) % 10 == 0 || (shape_type - 5) % 10 == 0)) + { + std::cout << "shape file contains " << number_of_elements << " polylines" << + std::endl; + std::cout << "this programm only handles point-input files" << std::endl; + SHPClose(hSHP); + return 0; + } + SHPClose(hSHP); + /* end from SHPInterface */ + + DBFHandle dbf_handle = DBFOpen(fname.c_str(),"rb"); + if(dbf_handle) + { + char* field_name (new char[256]); + int width(0), n_decimals(0); + size_t n_fields (DBFGetFieldCount(dbf_handle)); + std::cout << "************************************************" << std::endl; + std::cout << "field idx | name of field | data type of field " << std::endl; + for (size_t field_idx (0); field_idx < n_fields; field_idx++) + { + DBFGetFieldInfo( dbf_handle, field_idx, field_name, &width, &n_decimals); + if (field_idx < 10) + std::cout << " " << field_idx << " |" << std::flush; + else + std::cout << " " << field_idx << " |" << std::flush; + std::string field_name_str (field_name); + for (int k(0); k < (14 - (int)field_name_str.size()); k++) + std::cout << " "; + std::cout << field_name_str << " |" << std::flush; + + char native_field_type (DBFGetNativeFieldType (dbf_handle, field_idx)); + switch (native_field_type) + { + case 'C': + std::cout << " string" << std::endl; + break; + case 'F': + std::cout << " float" << std::endl; + break; + case 'N': + std::cout << " numeric" << std::endl; + break; + default: + std::cout << " n_decimal " << n_decimals << std::endl; + } + } + delete [] field_name; + std::cout << "************************************************" << std::endl; + + size_t x_id, y_id, z_id; + std::cout << + "please give the field idx that should be used for reading the x coordinate: " << + std::flush; + std::cin >> x_id; + std::cout << + "please give the field idx that should be used for reading the y coordinate: " << + std::flush; + std::cin >> y_id; + std::cout << + "please give the field idx that should be used for reading the z coordinate: " << + std::flush; + std::cin >> z_id; + if (z_id > n_fields) + z_id = std::numeric_limits<size_t>::max(); + + size_t n_name_components; + std::cout << "please give the number of fields that should be added to name: " << + std::flush; + std::cin >> n_name_components; + std::vector<size_t> name_component_ids (n_name_components, + std::numeric_limits<size_t>::max()); + if (n_name_components != 0) + for (size_t j(0); j < n_name_components; j++) + { + std::cout << + "- please give the field idx that should be used for reading the name: " + << std::flush; + std::cin >> name_component_ids[j]; + } + for (size_t j(0); j < n_name_components; j++) + if (name_component_ids[j] > n_fields) + name_component_ids[j] = std::numeric_limits<size_t>::max(); + + size_t station (0); + + std::cout << + "Should I read the information as GeoLib::Station (0) or as GeoLib::Point (1)? Please give the number: " + << std::flush; + std::cin >> station; + + std::string fname_base (fname); + if (station == 0) + fname += ".stn"; + else + fname += ".gml"; + + std::cout << "writing " << fname << " ... " << std::flush; + convertPoints (dbf_handle, + fname, + x_id, + y_id, + z_id, + name_component_ids, + fname_base, + station == 0 ? true : false); + DBFClose (dbf_handle); + std::cout << "ok" << std::endl; + } + else + std::cout << "error" << std::endl; + + return 0; +} diff --git a/Utils/FileConverter/ConvertVtkToOsg.cpp b/Utils/FileConverter/ConvertVtkToOsg.cpp new file mode 100644 index 00000000000..4a486fd167b --- /dev/null +++ b/Utils/FileConverter/ConvertVtkToOsg.cpp @@ -0,0 +1,202 @@ +/** + * \file ConvertVtkToOsg.cpp + * 25/10/2010 LB Initial implementation + * + * Implementation of ConvertVtkToOsg utility + */ + +// ** INCLUDES ** +#include "VtkOsgConverter.h" + +#include <iostream> + +#include <vtkActor.h> +#include <vtkDataSetMapper.h> +#include <vtkGenericDataObjectReader.h> +#include <vtkGeometryFilter.h> +#include <vtkImageDataGeometryFilter.h> +#include <vtkImageMapper.h> +#include <vtkPolyDataMapper.h> +#include <vtkPolyDataNormals.h> +#include <vtkSmartPointer.h> +#include <vtkXMLImageDataReader.h> +#include <vtkXMLPolyDataReader.h> +#include <vtkXMLRectilinearGridReader.h> +#include <vtkXMLStructuredGridReader.h> +#include <vtkXMLUnstructuredGridReader.h> + +#include <OpenSG/OSGSceneFileHandler.h> +#include <OpenSG/OSGSwitch.h> + +#include <boost/filesystem/operations.hpp> +#include <boost/regex.hpp> +#include <vector> +using namespace boost::filesystem; +using namespace std; + +// Replace file extension +void replaceExt(string& s, const string& newExt) +{ + string::size_type i = s.rfind('.', s.length()); + if (i != string::npos) + s.replace(i + 1, newExt.length(), newExt); +} + +// Get file extension +string getFileExt(const string& s) +{ + size_t i = s.rfind('.', s.length()); + if (i != string::npos) + return s.substr(i + 1, s.length() - i); + return ""; +} + +// No arguments: batch convert all vt* files +// switch argument: batch convert all vt* files into one osb file with a switch +// file argument: convert only the specified file +int main (int argc, char const* argv[]) +{ + vector<string> filenames; + bool useSwitch = false; + if (argc == 2) + { + if (string(argv[1]).find("switch") != string::npos) + useSwitch = true; + else + filenames.push_back(string(argv[1])); + } + + if (useSwitch || filenames.empty()) + { + const boost::regex e(".+\\.vt[a-z]"); + directory_iterator end; + for (directory_iterator it("./"); it != end; ++it) + { + string curFile = it->path().filename().string(); + if (regex_match(curFile, e)) + filenames.push_back(curFile); + } + } + + OSG::osgInit(0, NULL); + + vtkPolyDataMapper* mapper = vtkPolyDataMapper::New(); + OSG::NodePtr switchNode = OSG::Node::create(); + OSG::SwitchPtr switchCore = OSG::Switch::create(); + beginEditCP(switchCore); + switchCore->setChoice(0); + endEditCP(switchCore); + beginEditCP(switchNode); + switchNode->setCore(switchCore); + endEditCP(switchNode); + + for (vector<string>::const_iterator it = filenames.begin(); it != filenames.end(); ++it) + { + string filename(*it); + cout << "Opening file " << filename << " ... " << endl << flush; + string fileExt = getFileExt(filename); + + vtkXMLDataReader* reader = NULL; + vtkGenericDataObjectReader* oldStyleReader = NULL; + if (fileExt.find("vti") != string::npos) + { + reader = vtkXMLImageDataReader::New(); + vtkSmartPointer<vtkImageDataGeometryFilter> geoFilter = + vtkSmartPointer<vtkImageDataGeometryFilter>::New(); + geoFilter->SetInputConnection(reader->GetOutputPort()); + mapper->SetInputConnection(geoFilter->GetOutputPort()); + } + if (fileExt.find("vtr") != string::npos) + { + reader = vtkXMLRectilinearGridReader::New(); + vtkSmartPointer<vtkGeometryFilter> geoFilter = + vtkSmartPointer<vtkGeometryFilter>::New(); + geoFilter->SetInputConnection(reader->GetOutputPort()); + mapper->SetInputConnection(geoFilter->GetOutputPort()); + } + else if (fileExt.find("vts") != string::npos) + { + reader = vtkXMLStructuredGridReader::New(); + vtkSmartPointer<vtkGeometryFilter> geoFilter = + vtkSmartPointer<vtkGeometryFilter>::New(); + geoFilter->SetInputConnection(reader->GetOutputPort()); + mapper->SetInputConnection(geoFilter->GetOutputPort()); + } + else if (fileExt.find("vtp") != string::npos) + { + reader = vtkXMLPolyDataReader::New(); + mapper->SetInputConnection(reader->GetOutputPort()); + } + else if (fileExt.find("vtu") != string::npos) + { + reader = vtkXMLUnstructuredGridReader::New(); + vtkSmartPointer<vtkGeometryFilter> geoFilter = + vtkSmartPointer<vtkGeometryFilter>::New(); + geoFilter->SetInputConnection(reader->GetOutputPort()); + mapper->SetInputConnection(geoFilter->GetOutputPort()); + } + else if (fileExt.find("vtk") != string::npos) + { + oldStyleReader = vtkGenericDataObjectReader::New(); + oldStyleReader->SetFileName(filename.c_str()); + oldStyleReader->Update(); + if(oldStyleReader->IsFilePolyData()) + mapper->SetInputConnection(oldStyleReader->GetOutputPort()); + else + { + vtkSmartPointer<vtkGeometryFilter> geoFilter = + vtkSmartPointer<vtkGeometryFilter>::New(); + geoFilter->SetInputConnection(oldStyleReader->GetOutputPort()); + mapper->SetInputConnection(geoFilter->GetOutputPort()); + } + } + else + { + cout << "Not a valid vtk file ending (vti, vtr, vts, vtp, vtu, vtk)" << + endl; + return 1; + } + + if (fileExt.find("vtk") == string::npos) + { + reader->SetFileName(filename.c_str()); + reader->Update(); + } + + vtkActor* actor = vtkActor::New(); + actor->SetMapper(mapper); + + vtkOsgConverter converter(actor); + converter.SetVerbose(true); + //converter->SetMapper(mapper); + converter.WriteAnActor(); + OSG::NodePtr node = converter.GetOsgNode(); + replaceExt(filename, "osb"); + if (useSwitch) + { + beginEditCP(switchNode); + switchNode->addChild(node); + endEditCP(switchNode); + } + else + OSG::SceneFileHandler::the().write(node, filename.c_str()); + + if (reader) + reader->Delete(); + if (oldStyleReader) + oldStyleReader->Delete(); + } + if (useSwitch) + { + string filename(filenames[0]); + replaceExt(filename, "osb"); + OSG::SceneFileHandler::the().write(switchNode, filename.c_str()); + } + //mapper->Delete(); // TODO crashes + + OSG::osgExit(); + + cout << "File conversion finished" << endl; + + return 0; +} diff --git a/Utils/FileConverter/GMSH2OGS.cpp b/Utils/FileConverter/GMSH2OGS.cpp new file mode 100644 index 00000000000..51acd510aeb --- /dev/null +++ b/Utils/FileConverter/GMSH2OGS.cpp @@ -0,0 +1,80 @@ +/* + * GMSH2OGS.cpp + * + * Created on: Dec 13, 2011 + * Author: TF + */ + +/* + * mainExtractSurface.cpp + * + * Created on: Jan 26, 2011 + * Author: TF + */ + +// STL +#include <string> + +// FileIO +#include "MeshIO/GMSHInterface.h" +#include "MeshIO/OGSMeshIO.h" + +// MSH +#include "msh_lib.h" // for FEMRead +#include "msh_mesh.h" + +Problem* aproblem = NULL; + +int main (int argc, char* argv[]) +{ + if (argc < 5) + { + std::cout << "Usage: " << argv[0] << + " --mesh-in meshfile --mesh-out meshfile" << std::endl; + return -1; + } + + // *** read mesh + std::string tmp (argv[1]); + if (tmp.find ("--mesh-in") == std::string::npos) + { + std::cout << "could not find option --mesh-in" << std::endl; + return -1; + } + + tmp = argv[2]; + std::string file_base_name (tmp); + if (tmp.find (".msh") != std::string::npos) + file_base_name = tmp.substr (0, tmp.size() - 4); + + std::vector<MeshLib::CFEMesh*> mesh_vec; + FEMRead(file_base_name, mesh_vec); + if (mesh_vec.empty()) + { + std::cerr << "could not read mesh from file " << tmp << std::endl; + return -1; + } + MeshLib::CFEMesh* mesh (mesh_vec[mesh_vec.size() - 1]); + + // *** create new mesh + tmp = argv[3]; + if (tmp.find ("--mesh-out") == std::string::npos) + { + std::cout << "could not find option --mesh-out" << std::endl; + return -1; + } + + if (mesh->GetNodesNumber(false) == 0) { + mesh->setNumberOfNodesFromNodesVectorSize(); + } + + tmp = argv[4]; + std::cout << "writing mesh to file " << tmp << " ... " << std::flush; + FileIO::OGSMeshIO mesh_io; + mesh_io.setMesh(mesh); + mesh_io.writeToFile (tmp); + std::cout << "ok" << std::endl; + + delete mesh; + +} diff --git a/Utils/FileConverter/OGSFileConverter/CMakeLists.txt b/Utils/FileConverter/OGSFileConverter/CMakeLists.txt new file mode 100644 index 00000000000..0e5aca29871 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/CMakeLists.txt @@ -0,0 +1,89 @@ +# Specify minimum CMake version +cmake_minimum_required(VERSION 2.6) + +# Project name +project( OGSFileConverter ) + +# Source files +SET( SOURCES + ConversionTools.cpp + FileListDialog.cpp + OGSFileConverter.cpp +) + +# Moc Header files +SET( MOC_HEADERS + ConversionTools.h + FileListDialog.h + OGSFileConverter.h +) + +# Header files +SET( HEADERS + +) + +# UI files +SET( UIS + FileList.ui + OGSFileConverter.ui +) + +# Run Qts user interface compiler uic on .ui files +QT4_WRAP_UI( UI_HEADERS ${UIS} ) + +# Run Qts meta object compiler moc on header files +QT4_WRAP_CPP( MOC_SOURCES ${MOC_HEADERS} ) + +# Include the headers which are generated by uic and moc +# and include additional header +INCLUDE_DIRECTORIES( + ${CMAKE_BINARY_DIR}/UTL/FileConverter/OGSFileConverter + ${CMAKE_SOURCE_DIR}/Utils/FileConverter/OGSFileConverter + ${CMAKE_SOURCE_DIR}/BaseLib + ${CMAKE_SOURCE_DIR}/FemLib + ${CMAKE_SOURCE_DIR}/FileIO + ${CMAKE_SOURCE_DIR}/GeoLib + ${CMAKE_SOURCE_DIR}/MathLib + ${CMAKE_SOURCE_DIR}/MeshLib + ${CMAKE_SOURCE_DIR}/Gui/Base + ${CMAKE_SOURCE_DIR}/Gui/DataView +) + +# Put moc files in a project folder +SOURCE_GROUP("UI Files" REGULAR_EXPRESSION "\\w*\\.ui") +SOURCE_GROUP("Moc Files" REGULAR_EXPRESSION "moc_.*") + +# Create the library +ADD_EXECUTABLE( OGSFileConverter + main.cpp + ${SOURCES} + ${HEADERS} + ${MOC_HEADERS} + ${MOC_SOURCES} + ${UIS} +) + +TARGET_LINK_LIBRARIES( OGSFileConverter + ${QT_LIBRARIES} + FileIO + GEO + FEM + QtDataView +) + +# Find installed Qt4 libraries and headers +find_package( Qt4 REQUIRED ) + +# Adds useful macros and variables +# this is needed to correctly link the qt libraries through target_link_libraries +INCLUDE( ${QT_USE_FILE} ) + +# Set build configuration types +# "RelWithDebInfo" and "MinSizeRelease" can be added here +set ( CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE TYPE INTERNAL FORCE ) + +# Set build directories +# Binaries are created in /bin and libraries in /lib +set( EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin ) +set( LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib ) diff --git a/Utils/FileConverter/OGSFileConverter/ConversionTools.cpp b/Utils/FileConverter/OGSFileConverter/ConversionTools.cpp new file mode 100644 index 00000000000..7465d097d29 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/ConversionTools.cpp @@ -0,0 +1,136 @@ +/** + * \file ConversionTools.cpp + * 2012/04/11 KR Initial implementation + */ + +#include "ConversionTools.h" +#include "ProjectData.h" + +#include <iostream> +#include <fstream> + +// FEM Conditions +#include "BoundaryCondition.h" +#include "InitialCondition.h" +#include "SourceTerm.h" +#include "rf_bc_new.h" +#include "rf_ic_new.h" +#include "rf_st_new.h" +#include "FEMIO/BoundaryConditionIO.h" + +// Qt +#include <QFileInfo> + +void ConversionTools::getFEMConditionsFromASCIIFile(const QString &file_name, std::vector<FEMCondition*> &conditions) +{ + std::ifstream in(file_name.toStdString().data(), std::ios::in); + if (!in.good()) + { + std::cout << "Error in readASCIIConditionFile() - Could not open file." << std::endl; + return; + } + + QFileInfo fi(file_name); + GeoLib::GEOObjects geo_objects; + std::string geo_name(fi.baseName().toStdString() + ".gli"); + std::string file_path(fi.absolutePath().toStdString() + "/"); + FEMCondition::CondType type(FEMCondition::UNSPECIFIED); + std::string cond_tag(""); + if (fi.suffix().toLower() == "bc") + { + cond_tag = "#BOUNDARY_CONDITION"; + type = FEMCondition::BOUNDARY_CONDITION; + } + else if (fi.suffix().toLower() == "ic") + { + cond_tag = "#INITIAL_CONDITION"; + type = FEMCondition::INITIAL_CONDITION; + } + else if (fi.suffix().toLower() == "st") + { + cond_tag = "#SOURCE_TERM"; + type = FEMCondition::SOURCE_TERM; + } + + std::cout << "Reading " << fi.fileName().toStdString() << "..." << std::endl; + while (!in.eof()) + { + char buffer[256]; + in.getline(buffer, 256); + std::string line(buffer); + if (line.find("#STOP") != std::string::npos) + return; + if (line.find(cond_tag) != std::string::npos) + { + std::ios::pos_type position = in.tellg(); + if (type == FEMCondition::BOUNDARY_CONDITION) position = readBoundaryCondition(conditions, in, file_path, geo_objects, geo_name); + else if (type == FEMCondition::INITIAL_CONDITION) position = readInitialCondition(conditions, in, file_path, geo_objects, geo_name); + else if (type == FEMCondition::SOURCE_TERM) position = readSourceTerm(conditions, in, file_path, geo_objects, geo_name); + in.seekg(position, std::ios::beg); + } + } +} + +std::ios::pos_type ConversionTools::readBoundaryCondition(std::vector<FEMCondition*> &conditions, std::ifstream &in, const std::string &file_path, const GeoLib::GEOObjects &geo_objects, const std::string &geo_name) +{ + Q_UNUSED(file_path); + CBoundaryCondition* bc(new CBoundaryCondition()); + bool valid; + std::ios::pos_type position = bc->Read(&in, geo_objects, geo_name, valid); + conditions.push_back(new BoundaryCondition(*bc, geo_name)); + delete bc; + return position; +} + +std::ios::pos_type ConversionTools::readInitialCondition(std::vector<FEMCondition*> &conditions, std::ifstream &in, const std::string &file_path, const GeoLib::GEOObjects &geo_objects, const std::string &geo_name) +{ + Q_UNUSED(file_path); + CInitialCondition* ic = new CInitialCondition(); + std::ios::pos_type position = ic->Read(&in, geo_objects, geo_name); + conditions.push_back(new InitialCondition(*ic, geo_name)); + delete ic; + return position; +} + +std::ios::pos_type ConversionTools::readSourceTerm(std::vector<FEMCondition*> &conditions, std::ifstream &in, const std::string &file_path, const GeoLib::GEOObjects &geo_objects, const std::string &geo_name) +{ + CSourceTerm* st(new CSourceTerm()); + std::ios::pos_type position = st->Read(&in, geo_objects, geo_name); + conditions.push_back(new SourceTerm(*st, geo_name)); + + if (st->getProcessDistributionType() == FiniteElement::DIRECT) + conditions[conditions.size()-1]->setDisValues( ConversionTools::getDirectNodeValues(file_path + st->fname) ); + + delete st; + return position; +} + +std::vector< std::pair<size_t, double> > ConversionTools::getDirectNodeValues(std::string file_name) +{ + std::vector< std::pair<size_t, double> > node_values; + SourceTerm::getDirectNodeValues(file_name, node_values); + return node_values; +} + +int ConversionTools::writeDirectValues(const FEMCondition &condition, const std::string &direct_value_file) +{ + std::ofstream out(direct_value_file.c_str()); + if (!out.good()) + { + std::cout << "Error in writeDirectValues() - Could not open file." << std::endl; + return 0; + } + + const std::vector<size_t> dis_nodes = condition.getDisNodes(); + const std::vector<double> dis_values = condition.getDisValues(); + const size_t nValues(dis_nodes.size()); + + if (nValues != dis_values.size() || nValues==0) + return 0; + + for (size_t i=0; i<nValues; i++) + out << dis_nodes[i] << "\t" << dis_values[i] << std::endl; + + return 1; +} + diff --git a/Utils/FileConverter/OGSFileConverter/ConversionTools.h b/Utils/FileConverter/OGSFileConverter/ConversionTools.h new file mode 100644 index 00000000000..66c29104508 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/ConversionTools.h @@ -0,0 +1,28 @@ +/** + * \file ConversionTools.h + * 2012/04/11 KR Initial implementation + */ + +#ifndef CONVERSIONTOOLS_H +#define CONVERSIONTOOLS_H + +#include <vector> +#include <QString> + +#include "FEMCondition.h" + +class ConversionTools +{ +public: + static void getFEMConditionsFromASCIIFile(const QString &file_name, std::vector<FEMCondition*> &conditions); + static int writeDirectValues(const FEMCondition &condition, const std::string &direct_value_file); + +private: + static std::ios::pos_type readBoundaryCondition(std::vector<FEMCondition*> &conditions, std::ifstream &in, const std::string &file_path, const GeoLib::GEOObjects &geo_objects, const std::string &geo_name); + static std::ios::pos_type readInitialCondition (std::vector<FEMCondition*> &conditions, std::ifstream &in, const std::string &file_path, const GeoLib::GEOObjects &geo_objects, const std::string &geo_name); + static std::ios::pos_type readSourceTerm (std::vector<FEMCondition*> &conditions, std::ifstream &in, const std::string &file_path, const GeoLib::GEOObjects &geo_objects, const std::string &geo_name); + static std::vector< std::pair<size_t, double> > getDirectNodeValues(std::string file_name); + +}; + +#endif //CONVERSIONTOOLS_H diff --git a/Utils/FileConverter/OGSFileConverter/FileList.ui b/Utils/FileConverter/OGSFileConverter/FileList.ui new file mode 100644 index 00000000000..432fa3f4d47 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/FileList.ui @@ -0,0 +1,154 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>FileList</class> + <widget class="QDialog" name="FileList"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>FileList</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="5" column="1" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="addButton"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>+</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QPushButton" name="removeButton"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>-</string> + </property> + </widget> + </item> + <item row="3" column="2"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="4" column="1"> + <widget class="QLineEdit" name="lineEdit"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="saveLabel"> + <property name="text"> + <string>Save as:</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QPushButton" name="browseButton"> + <property name="minimumSize"> + <size> + <width>30</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>30</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="1" column="0" rowspan="3" colspan="2"> + <widget class="QListView" name="listView"/> + </item> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Add source files:</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>FileList</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel"> + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>FileList</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel"> + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/Utils/FileConverter/OGSFileConverter/FileListDialog.cpp b/Utils/FileConverter/OGSFileConverter/FileListDialog.cpp new file mode 100644 index 00000000000..520242b0d69 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/FileListDialog.cpp @@ -0,0 +1,86 @@ +/** + * \file FileListDialog.cpp + * 2012/04/04 KR Initial implementation + */ + +#include "FileListDialog.h" + +#include "StringTools.h" +#include <QFileDialog> +#include <QSettings> +#include <QFileInfo> + +FileListDialog::FileListDialog(FileType input, FileType output, QWidget* parent) +: QDialog(parent), _input_file_type(input), _output_file_type(output) +{ + setupUi(this); + this->listView->setModel(&_allFiles); +} + +FileListDialog::~FileListDialog() +{ +} + +void FileListDialog::on_addButton_pressed() +{ + QSettings settings("UFZ", "OpenGeoSys-5"); + QString fileName = QFileDialog::getOpenFileName( this, "Select data file to open", + settings.value("lastOpenedOgsFileDirectory").toString(), + this->getFileTypeString(_input_file_type)); + + if (!fileName.isEmpty()) + { + QDir dir = QDir(fileName); + settings.setValue("lastOpenedOgsFileDirectory", dir.absolutePath()); + QStringList list = _allFiles.stringList(); + list.append(fileName); + _allFiles.setStringList(list); + } +} + +void FileListDialog::on_removeButton_pressed() +{ + QModelIndexList selected = this->listView->selectionModel()->selectedIndexes(); + + for (QModelIndexList::iterator it = selected.begin(); it != selected.end(); ++it) + this->_allFiles.removeRow(it->row()); +} + +void FileListDialog::on_browseButton_pressed() +{ + QString guess_name(""); + if (!_allFiles.stringList().empty()) + guess_name = QString::fromStdString(BaseLib::getFileNameFromPath(_allFiles.stringList().at(0).toStdString())); + QSettings settings("UFZ", "OpenGeoSys-5"); + QFileInfo fi(settings.value("lastOpenedOgsFileDirectory").toString()); + QString fileName = QFileDialog::getSaveFileName( this, "Save as", + fi.absolutePath().append("/").append(guess_name), + this->getFileTypeString(_output_file_type)); + + if (!fileName.isEmpty()) + { + QDir dir = QDir(fileName); + settings.setValue("lastOpenedOgsFileDirectory", dir.absolutePath()); + this->lineEdit->setText(fileName); + } +} + +void FileListDialog::accept() +{ + emit fileLists(_allFiles.stringList(), lineEdit->text()); + this->done(QDialog::Accepted); +} + +void FileListDialog::reject() +{ + this->done(QDialog::Rejected); +} + +QString FileListDialog::getFileTypeString(FileType file_type) +{ + if (file_type==GML) return "OpenGeoSys geometry files (*.gml)"; + else if (file_type==CND) return "OpenGeoSys condition files (*.cnd)"; + else if (file_type==GLI) return "GeoSys geometry files (*.gli)"; + else if (file_type==BC) return "GeoSys boundary condition files (*.bc);; GeoSys initial condition files (*.ic);; GeoSys source term files (*.st)"; + else return "All files (*.*)"; +} \ No newline at end of file diff --git a/Utils/FileConverter/OGSFileConverter/FileListDialog.h b/Utils/FileConverter/OGSFileConverter/FileListDialog.h new file mode 100644 index 00000000000..3a90f33cee8 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/FileListDialog.h @@ -0,0 +1,50 @@ +/** + * \file FileListDialog.h + * 2012/04/04 KR Initial implementation + */ + +#ifndef FILELISTDIALOG_H +#define FILELISTDIALOG_H + +#include "ui_FileList.h" +#include <QDialog> +#include <QStringListModel> + +class FileListDialog : public QDialog, private Ui_FileList +{ + Q_OBJECT + +public: + enum FileType { + GML, // xml-geometries + CND, // xml-fem-conditions + GLI, // ascii-geometries + BC // ascii-fem-conditions + }; + + FileListDialog(FileType input, FileType output, QWidget* parent = NULL); + ~FileListDialog(void); + +private: + QString getFileTypeString(FileType file_type); + + QStringListModel _allFiles; + const FileType _input_file_type; + const FileType _output_file_type; + +private slots: + void on_addButton_pressed(); + void on_removeButton_pressed(); + void on_browseButton_pressed(); + + /// Instructions if the OK-Button has been pressed. + void accept(); + + /// Instructions if the Cancel-Button has been pressed. + void reject(); + +signals: + void fileLists(const QStringList, const QString); +}; + +#endif //FILELISTDIALOG_H diff --git a/Utils/FileConverter/OGSFileConverter/OGSFileConverter.cpp b/Utils/FileConverter/OGSFileConverter/OGSFileConverter.cpp new file mode 100644 index 00000000000..404ae5859a1 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/OGSFileConverter.cpp @@ -0,0 +1,217 @@ +/** + * \file OGSFileConverter.cpp + * 2012/04/04 KR Initial implementation + */ + +#include "OGSFileConverter.h" +#include "FileListDialog.h" +#include "ConversionTools.h" +#include "OGSError.h" + +#include <QFileInfo> + +// conversion includes +#include "ProjectData.h" +#include "GEOObjects.h" +#include "OGSIOVer4.h" +#include "XmlIO/XmlCndInterface.h" +#include "XmlIO/XmlGmlInterface.h" +#include "StringTools.h" + +// old condition objects +#include "BoundaryCondition.h" +#include "InitialCondition.h" +#include "SourceTerm.h" +#include "rf_bc_new.h" +#include "rf_ic_new.h" +#include "rf_st_new.h" + +OGSFileConverter::OGSFileConverter(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); +} + +OGSFileConverter::~OGSFileConverter() +{ +} + +void OGSFileConverter::convertGML2GLI(const QStringList &input, const QString &output) +{ + ProjectData project; + GeoLib::GEOObjects* geo_objects = new GeoLib::GEOObjects; + project.setGEOObjects(geo_objects); + + FileFinder fileFinder = createFileFinder(); + std::string schemaName(fileFinder.getPath("OpenGeoSysGLI.xsd")); + FileIO::XmlGmlInterface xml(&project, schemaName); + + for (QStringList::const_iterator it=input.begin(); it!=input.end(); ++it) + xml.readFile(*it); + + FileIO::writeAllDataToGLIFileV4(output.toStdString(), *geo_objects); + OGSError::box("File conversion finished"); +} + +void OGSFileConverter::convertGLI2GML(const QStringList &input, const QString &output) +{ + ProjectData project; + GeoLib::GEOObjects* geo_objects = new GeoLib::GEOObjects; + project.setGEOObjects(geo_objects); + + std::vector<std::string> merge_list; + for (QStringList::const_iterator it=input.begin(); it!=input.end(); ++it) + { + std::string unique_name; + std::vector<std::string> errors; + if (! FileIO::readGLIFileV4(it->toStdString(), geo_objects, unique_name, errors)) + { + for (size_t k(0); k<errors.size(); k++) + OGSError::box(QString::fromStdString(errors[k])); + } + else + merge_list.push_back(unique_name); + } + + if (!merge_list.empty()) + { + std::string merged_geo_name (merge_list[0]); + if (merge_list.size()>1) + { + merged_geo_name = BaseLib::getFileNameFromPath(output.toStdString()); + geo_objects->mergeGeometries(merge_list, merged_geo_name); + } + FileFinder fileFinder = createFileFinder(); + std::string schemaName(fileFinder.getPath("OpenGeoSysGLI.xsd")); + FileIO::XmlGmlInterface xml(&project, schemaName); + xml.setNameForExport(merged_geo_name); + xml.writeToFile(output.toStdString()); + } + OGSError::box("File conversion finished"); +} + +void OGSFileConverter::convertCND2BC(const QStringList &input, const QString &output) +{ + ProjectData project; + GeoLib::GEOObjects* geo_objects = new GeoLib::GEOObjects; + project.setGEOObjects(geo_objects); + + // HACK for enabling conversion of files without loading the associated geometry + std::vector<GeoLib::Point*> *fake_geo = new std::vector<GeoLib::Point*>; + fake_geo->push_back(new GeoLib::Point(0,0,0)); + std::string fake_name("conversionTestRun#1"); + geo_objects->addPointVec(fake_geo, fake_name); + + FileFinder fileFinder = createFileFinder(); + std::string schemaName(fileFinder.getPath("OpenGeoSysCond.xsd")); + FileIO::XmlCndInterface xml(&project, schemaName); + + std::vector<FEMCondition*> conditions; + + for (QStringList::const_iterator it=input.begin(); it!=input.end(); ++it) + xml.readFile(conditions, *it); + + if (!conditions.empty()) + { + project.addConditions(conditions); + QFileInfo fi(output); + FEMCondition::CondType type = FEMCondition::UNSPECIFIED; + if (fi.suffix().compare("bc") == 0) type = FEMCondition::BOUNDARY_CONDITION; + else if (fi.suffix().compare("ic") == 0) type = FEMCondition::INITIAL_CONDITION; + else if (fi.suffix().compare("st") == 0) type = FEMCondition::SOURCE_TERM; + + size_t count(0); + size_t nConds(conditions.size()); + for (size_t i=0; i<nConds; i++) + { + if (conditions[i]->getCondType() == type) + { + if (type == FEMCondition::BOUNDARY_CONDITION) + bc_list.push_back(new CBoundaryCondition(static_cast<BoundaryCondition*>(conditions[i]))); + else if (type == FEMCondition::INITIAL_CONDITION) + ic_vector.push_back(new CInitialCondition(static_cast<InitialCondition*>(conditions[i]))); + else if (type == FEMCondition::SOURCE_TERM) + st_vector.push_back(new CSourceTerm(static_cast<SourceTerm*>(conditions[i]))); + + if (conditions[i]->getProcessDistributionType() == FiniteElement::DIRECT) + { + std::string count_str (QString::number(count++).toStdString()); + std::string direct_value_file = fi.absolutePath().toStdString() + "/direct_values" + count_str + ".txt"; + st_vector[st_vector.size()-1]->fname = direct_value_file; + ConversionTools::writeDirectValues(*conditions[i], direct_value_file); + } + } + } + if (type == FEMCondition::BOUNDARY_CONDITION) + BCWrite(output.toStdString()); + else if (type == FEMCondition::INITIAL_CONDITION) + ICWrite(output.toStdString()); + else if (type == FEMCondition::SOURCE_TERM) + STWrite(output.toStdString()); + } + OGSError::box("File conversion finished"); +} + +void OGSFileConverter::convertBC2CND(const QStringList &input, const QString &output) +{ + ProjectData project; + std::vector<FEMCondition*> conditions; + for (QStringList::const_iterator it=input.begin(); it!=input.end(); ++it) + ConversionTools::getFEMConditionsFromASCIIFile(*it, conditions); + + if (!conditions.empty()) + { + project.addConditions(conditions); + FileFinder fileFinder = createFileFinder(); + std::string schemaName(fileFinder.getPath("OpenGeoSysCond.xsd")); + FileIO::XmlCndInterface xml(&project, schemaName); + xml.writeToFile(output.toStdString()); + } + OGSError::box("File conversion finished"); +} + +FileFinder OGSFileConverter::createFileFinder() +{ + FileFinder fileFinder; + fileFinder.addDirectory("."); + fileFinder.addDirectory(std::string(SOURCEPATH).append("/FileIO")); + return fileFinder; +} + +void OGSFileConverter::on_gml2gliButton_pressed() +{ + FileListDialog dlg(FileListDialog::GML, FileListDialog::GLI); + connect(&dlg, SIGNAL(fileLists(const QStringList, const QString)), + this, SLOT(convertGML2GLI(const QStringList, const QString))); + dlg.exec(); +} + +void OGSFileConverter::on_gli2gmlButton_pressed() +{ + FileListDialog dlg(FileListDialog::GLI, FileListDialog::GML); + connect(&dlg, SIGNAL(fileLists(const QStringList, const QString)), + this, SLOT(convertGLI2GML(const QStringList, const QString))); + dlg.exec(); +} + +void OGSFileConverter::on_bc2cndButton_pressed() +{ + FileListDialog dlg(FileListDialog::BC, FileListDialog::CND); + connect(&dlg, SIGNAL(fileLists(const QStringList, const QString)), + this, SLOT(convertBC2CND(const QStringList, const QString))); + dlg.exec(); +} + +void OGSFileConverter::on_cnd2bcButton_pressed() +{ + FileListDialog dlg(FileListDialog::CND, FileListDialog::BC); + connect(&dlg, SIGNAL(fileLists(const QStringList, const QString)), + this, SLOT(convertCND2BC(const QStringList, const QString))); + dlg.exec(); +} + +void OGSFileConverter::on_closeDialogButton_pressed() +{ + this->close(); +} + diff --git a/Utils/FileConverter/OGSFileConverter/OGSFileConverter.h b/Utils/FileConverter/OGSFileConverter/OGSFileConverter.h new file mode 100644 index 00000000000..1d5d44834a4 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/OGSFileConverter.h @@ -0,0 +1,41 @@ +/** + * \file OGSFileConverter.h + * 2012/04/04 KR Initial implementation + */ + +#ifndef OGSFILECONVERTER_H +#define OGSFILECONVERTER_H + +#include "ui_OGSFileConverter.h" +#include <QDialog> + +#include "FileFinder.h" + +class OGSFileConverter : public QDialog, private Ui_OGSFileConverter +{ + Q_OBJECT + +public: + OGSFileConverter(QWidget* parent = 0); + ~OGSFileConverter(void); + +private: + FileFinder createFileFinder(); + +private slots: + void convertGML2GLI(const QStringList &input, const QString &output); + void convertGLI2GML(const QStringList &input, const QString &output); + void convertCND2BC(const QStringList &input, const QString &output); + void convertBC2CND(const QStringList &input, const QString &output); + + void on_gml2gliButton_pressed(); + void on_gli2gmlButton_pressed(); + void on_bc2cndButton_pressed(); + void on_cnd2bcButton_pressed(); + void on_closeDialogButton_pressed(); + +signals: + +}; + +#endif //OGSFILECONVERTER_H diff --git a/Utils/FileConverter/OGSFileConverter/OGSFileConverter.ui b/Utils/FileConverter/OGSFileConverter/OGSFileConverter.ui new file mode 100644 index 00000000000..e02acdc3c40 --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/OGSFileConverter.ui @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>OGSFileConverter</class> + <widget class="QDialog" name="OGSFileConverter"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>246</width> + <height>342</height> + </rect> + </property> + <property name="windowTitle"> + <string>OGS File Converter</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QGroupBox" name="geometryBox"> + <property name="title"> + <string>Geometry</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QPushButton" name="gml2gliButton"> + <property name="text"> + <string>XML Geometry to ASCII Geometry</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="gli2gmlButton"> + <property name="text"> + <string>ASCII Geometry to XML Geometry</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="closeDialogButton"> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QGroupBox" name="conditionBox"> + <property name="title"> + <string>Conditions</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QPushButton" name="cnd2bcButton"> + <property name="text"> + <string>XML to ASCII-Conditions</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="bc2cndButton"> + <property name="text"> + <string>ASCII-Conditions to XML</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Utils/FileConverter/OGSFileConverter/main.cpp b/Utils/FileConverter/OGSFileConverter/main.cpp new file mode 100644 index 00000000000..914a388330a --- /dev/null +++ b/Utils/FileConverter/OGSFileConverter/main.cpp @@ -0,0 +1,15 @@ +#include "OGSFileConverter.h" +#include <QtGui/QApplication> + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv); + setlocale(LC_NUMERIC,"C"); + OGSFileConverter* fc = new OGSFileConverter(); + fc->setWindowTitle( fc->windowTitle() ); + fc->show(); + int returncode = app.exec(); + delete fc; + + return returncode; +} diff --git a/Utils/FileConverter/generateBCFromPolyline.cpp b/Utils/FileConverter/generateBCFromPolyline.cpp new file mode 100644 index 00000000000..80adc1c5350 --- /dev/null +++ b/Utils/FileConverter/generateBCFromPolyline.cpp @@ -0,0 +1,108 @@ +/* + * generateBCFromPolyline.cpp + * + * Created on: Mar 8, 2011 + * Author: TF + */ + +// GEO +#include "GEOObjects.h" +#include "PolylineVec.h" +#include "ProjectData.h" + +// FileIO +#include "XmlIO/XmlGmlInterface.h" + +#include "problem.h" +Problem* aproblem = NULL; + +#include <QString> + +int main (int argc, char* argv[]) +{ + if (argc == 1) + { + std::cout << "Usage: " << argv[0] << " gml-file" << std::endl; + std::cout << "\tgives you the name of all polylines in the file" << std::endl; + std::cout << "Usage: " << argv[0] << " gml-file polyline-to-convert" << std::endl; + std::cout << "\tcreates for the given polyline points boundary conditions" << + std::endl; + return -1; + } + GeoLib::GEOObjects* geo_objs (new GeoLib::GEOObjects); + std::string schema_name( + "/home/fischeth/workspace/OGS-FirstFloor/sources/FileIO/OpenGeoSysGLI.xsd"); + ProjectData* project_data (new ProjectData); + project_data->setGEOObjects (geo_objs); + FileIO::XmlGmlInterface xml(project_data, schema_name); + std::string fname (argv[1]); + xml.readFile(QString::fromStdString (fname)); + + std::vector<std::string> geo_names; + geo_objs->getGeometryNames (geo_names); + if (geo_names.empty ()) + { + std::cout << "no geometries found" << std::endl; + return -1; + } + const GeoLib::PolylineVec* ply_vec (geo_objs->getPolylineVecObj(geo_names[0])); + if (!ply_vec) + { + std::cout << "could not found polylines" << std::endl; + delete project_data; + return -1; + } + const size_t n_ply (ply_vec->size()); + + std::vector<size_t> ply_pnt_ids; + for (size_t k(0); k < n_ply; k++) + { + std::string ply_name; + if (ply_vec->getNameOfElementByID(k, ply_name)) + { + if (argc == 2) + std::cout << "polyline " << k << ": " << ply_name << std::endl; + else if (ply_name.find (argv[2]) != std::string::npos) + { + std::cout << "found polyline " << ply_name << std::endl; + GeoLib::Polyline const* ply (ply_vec->getElementByName(ply_name)); + const size_t n_ply_pnts (ply->getNumberOfPoints()); + for (size_t j(0); j < n_ply_pnts; j++) + ply_pnt_ids.push_back (ply->getPointID(j)); + } + } + } + + if (argc == 2) + return 0; + + std::vector<GeoLib::Point*> const* geo_pnts (geo_objs->getPointVec(geo_names[0])); + // write gli file and bc file + std::ofstream gli_out ("TB.gli"); + std::ofstream bc_out ("TB.bc"); + bc_out << "// file generated by " << argv[0] << std::endl; + if (gli_out && bc_out) + { + gli_out << "#POINTS" << std::endl; + for (size_t k(0); k < ply_pnt_ids.size(); k++) + { + gli_out << k << " " << *((*geo_pnts)[ply_pnt_ids[k]]) << " $NAME PLYPNT" << + argv[2] << k << std::endl; + // boundary condition + bc_out << "#BOUNDARY_CONDITION" << std::endl; + bc_out << "\t$PCS_TYPE" << std::endl << "\t\tGROUNDWATER_FLOW" << std::endl; + bc_out << "\t$PRIMARY_VARIABLE" << std::endl << "\t\tHEAD" << std::endl; + bc_out << "\t$GEO_TYPE" << std::endl << "\t\tPOINT PLYPNT" << argv[2] << + k << std::endl; + bc_out << "\t$DIS_TYPE" << std::endl << "\t\tCONSTANT " << + (*((*geo_pnts)[ply_pnt_ids[k]]))[2] << std::endl; + } + gli_out << "#STOP" << std::endl; + bc_out << "#STOP" << std::endl; + gli_out.close (); + bc_out.close (); + } + + delete project_data; +} + diff --git a/Utils/FileConverter/generateBCandGLI.cpp b/Utils/FileConverter/generateBCandGLI.cpp new file mode 100644 index 00000000000..b86bfe6dc0a --- /dev/null +++ b/Utils/FileConverter/generateBCandGLI.cpp @@ -0,0 +1,120 @@ +/* + * generateBCandGLI.cpp + * + * Created on: Mar 1, 2011 + * Author: TF + */ + +// GEO +#include "GEOObjects.h" +#include "ProjectData.h" +#include "SurfaceVec.h" + +// FileIO +#include "XmlIO/XmlGmlInterface.h" + +#include "problem.h" +Problem* aproblem = NULL; + +#include <algorithm> +#include <QString> + +int main (int argc, char* argv[]) +{ + if (argc == 1) + { + std::cout << "Usage: " << argv[0] << " gml-file" << std::endl; + return -1; + } + GeoLib::GEOObjects* geo_objs (new GeoLib::GEOObjects); + ProjectData* project_data (new ProjectData); + project_data->setGEOObjects (geo_objs); + std::string schema_name( + "/home/fischeth/workspace/OGS-FirstFloor/sources/FileIO/OpenGeoSysGLI.xsd"); + FileIO::XmlGmlInterface xml(project_data, schema_name); + std::string fname (argv[1]); + xml.readFile(QString::fromStdString (fname)); + + std::vector<std::string> geo_names; + geo_objs->getGeometryNames (geo_names); + if (geo_names.empty ()) + { + std::cout << "no geometries found" << std::endl; + return -1; + } + const GeoLib::SurfaceVec* sfc_vec (geo_objs->getSurfaceVecObj(geo_names[0])); + if (!sfc_vec) + { + std::cout << "could not found surfaces" << std::endl; + delete project_data; + return -1; + } + const size_t n_sfc (sfc_vec->size()); + + std::vector<size_t> sfc_pnt_ids; + for (size_t k(0); k < n_sfc; k++) + { + std::string sfc_name; + if (sfc_vec->getNameOfElementByID(k, sfc_name)) + if (sfc_name.find ("Terrain") != std::string::npos) + { + std::cout << k << ": " << sfc_name << std::endl; + GeoLib::Surface const* sfc (sfc_vec->getElementByName(sfc_name)); + const size_t n_triangles (sfc->getNTriangles()); + for (size_t j(0); j < n_triangles; j++) + { + GeoLib::Triangle const* tri ((*sfc)[j]); + for (size_t i(0); i < 3; i++) + sfc_pnt_ids.push_back ((*tri)[i]); + } + } + } + + // make entries unique + std::cout << "make points unique ... " << std::flush; + std::sort (sfc_pnt_ids.begin(), sfc_pnt_ids.end()); + std::vector<size_t>::iterator it (sfc_pnt_ids.begin()); + while (it != sfc_pnt_ids.end()) + { + std::vector<size_t>::iterator next (it); + next++; + if (next != sfc_pnt_ids.end()) + { + if (*it == *next) + it = sfc_pnt_ids.erase (it); + else + it++; + } + else + it++; + } + std::cout << "done" << std::endl; + + std::vector<GeoLib::Point*> const* geo_pnts (geo_objs->getPointVec(geo_names[0])); + // write gli file and bc file + std::ofstream gli_out ("TB.gli"); + std::ofstream bc_out ("TB.bc"); + bc_out << "// file generated by " << argv[0] << std::endl; + if (gli_out && bc_out) + { + gli_out << "#POINTS" << std::endl; + for (size_t k(0); k < sfc_pnt_ids.size(); k++) + { + gli_out << k << " " << *((*geo_pnts)[sfc_pnt_ids[k]]) << " $NAME " << k << + std::endl; + // boundary condition + bc_out << "#BOUNDARY_CONDITION" << std::endl; + bc_out << "\t$PCS_TYPE" << std::endl << "\t\tGROUNDWATER_FLOW" << std::endl; + bc_out << "\t$PRIMARY_VARIABLE" << std::endl << "\t\tHEAD" << std::endl; + bc_out << "\t$GEO_TYPE" << std::endl << "\t\tPOINT " << k << std::endl; + bc_out << "\t$DIS_TYPE" << std::endl << "\t\tCONSTANT " << + (*((*geo_pnts)[sfc_pnt_ids[k]]))[2] << std::endl; + } + gli_out << "#STOP" << std::endl; + bc_out << "#STOP" << std::endl; + gli_out.close (); + bc_out.close (); + } + + delete project_data; +} diff --git a/Utils/FileConverter/generateMatPropsFromMatID.cpp b/Utils/FileConverter/generateMatPropsFromMatID.cpp new file mode 100644 index 00000000000..a1820669d96 --- /dev/null +++ b/Utils/FileConverter/generateMatPropsFromMatID.cpp @@ -0,0 +1,58 @@ +/** + * \file generateMatPropsFromMatID.cpp + * 2011/12/19 KR Initial implementation + */ + +#include "GridAdapter.h" +#include "StringTools.h" + +int main (int argc, char* argv[]) +{ + if (argc == 1) + { + std::cout << "Usage: " << argv[0] << " <msh-file>" << std::endl; + std::cout << std::endl; + std::cout << "Creates a new file for material properties and sets the material ids in the msh-file to 0." << std::endl; + return -1; + } + + GridAdapter grid(argv[1]); + std::vector<GridAdapter::Element*> *elems = const_cast< std::vector<GridAdapter::Element*>* >(grid.getElements()); + size_t nElems(elems->size()); + + // create file + std::string filename(argv[1]); + std::string name(BaseLib::getFileNameFromPath(filename)); + + std::string new_matname(name + "_prop"); + std::ofstream out_prop( new_matname.c_str(), std::ios::out ); + if (out_prop.is_open()) + { + for (size_t i=0; i<nElems; i++) + out_prop << i << "\t" << (*elems)[i]->material << std::endl; + out_prop.close(); + } + else + { + std::cout << "Error: Could not create property file..." << std::endl; + return -1; + } + + // set mat ids to 0 and write new msh file + for (size_t i=0; i<nElems; i++) + (*elems)[i]->material = 0; + const MeshLib::CFEMesh* mesh(grid.getCFEMesh()); + std::string new_mshname(name + "_new.msh"); + std::cout << "writing mesh to file " << new_mshname << " ... " << std::flush; + FileIO::OGSMeshIO mesh_io; + mesh_io.setMesh(mesh); + mesh_io.writeToFile (new_mshname); + std::cout << "ok" << std::endl; + + std::cout << "New files \"" << new_mshname << "\" and \"" << new_matname << "\" written." << std::endl; + std::cout << "Conversion finished." << std::endl; + + return 1; +} + + diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake index 5fc97e8a004..090cd9ebcbb 100644 --- a/scripts/cmake/Find.cmake +++ b/scripts/cmake/Find.cmake @@ -59,3 +59,46 @@ FIND_PACKAGE ( BLAS ) # lapack FIND_PACKAGE ( LAPACK ) + +## VTK ## +IF (OGS_LIBS_DIR_FOUND) + SET (VTK_DIR ${PROJECT_SOURCE_DIR}/../Libs/VTK/build) +ENDIF () # OGS_LIBS_DIR_FOUND +IF(NOT OGS_DONT_USE_VTK) + FIND_PACKAGE( VTK ) +ENDIF() +IF(VTK_FOUND) + ADD_DEFINITIONS(-DVTK_FOUND) + FIND_PACKAGE(QVTK) + IF(NOT QVTK_FOUND AND OGS_USE_QT) + MESSAGE(FATAL_ERROR "QVTK was not found but is required for OGS_USE_QT! On Ubuntu it can be installed via 'sudo apt-get install libvtk5-qt4-dev'") + ENDIF() +ENDIF() + +## NetCDF ## +IF(VTK_FOUND) + FIND_PATH(VTK_NETCDF_FOUND netcdf.h + PATHS ${VTK_INCLUDE_DIRS}/vtknetcdf ${VTK_SOURCE_DIR}/Utilities/vtknetcdf + PATH_SUFFIXES include + NO_DEFAULT_PATH) +ENDIF() + +IF(VTK_NETCDF_FOUND) + ADD_DEFINITIONS(-DVTK_NETCDF_FOUND) + INCLUDE_DIRECTORIES(${VTK_NETCDF_FOUND}) +ELSE() + SET(NETCDF_CXX TRUE) + FIND_PACKAGE(NetCDF) + IF(NOT NETCDF_FOUND AND OGS_USE_QT) + MESSAGE(FATAL_ERROR "NetCDF was not found but is required for OGS_USE_QT!") + ENDIF() +ENDIF() + +## geotiff ## +IF(NOT MSVC) + FIND_PACKAGE( LibTiff ) +ENDIF() # NOT MSVC +FIND_PACKAGE( LibGeoTiff ) +IF(libgeotiff_FOUND) + ADD_DEFINITIONS(-Dlibgeotiff_FOUND) +ENDIF() # libgeotiff_FOUND diff --git a/scripts/cmake/FindLibGeoTiff.cmake b/scripts/cmake/FindLibGeoTiff.cmake new file mode 100644 index 00000000000..8b46fc9cff5 --- /dev/null +++ b/scripts/cmake/FindLibGeoTiff.cmake @@ -0,0 +1,43 @@ +# - Try to find libgeotiff +# Once done, this will define +# +# libgeotiff_FOUND +# libgeotiff_INCLUDE_DIRS +# libgeotiff_LIBRARIES + +if (NOT libgeotiff_FOUND) + + include(LibFindMacros) + + find_path( libgeotiff_INCLUDE_DIR + NAMES geotiff.h + PATHS /usr/include + /usr/include/libgeotiff + /usr/include/geotiff + ${CMAKE_SOURCE_DIR}/../Libs/libgeotiff + C:/OGS_Libs/libgeotiff + $ENV{OGS_LIBS}/libgeotiff) + + find_library(libgeotiff_LIBRARIES + NAMES geotiff + PATHS /usr/lib64 + /usr/lib + ${CMAKE_SOURCE_DIR}/../Libs/libgeotiff + C:/OGS_Libs/libgeotiff + $ENV{OGS_LIBS}/libgeotiff) + + + # Set the include dir variables and the libraries and let libfind_process do the rest. + # NOTE: Singular variables for this library, plural for libraries this this lib depends on. + if (NOT libgeotiff_LIBRARIES STREQUAL "libgeotiff_LIBRARIES-NOTFOUND" AND NOT libgeotiff_INCLUDE_DIR STREQUAL "libgeotiff_INCLUDE_DIR-NOTFOUND") + set(libgeotiff_PROCESS_INCLUDES libgeotiff_INCLUDE_DIR) + set(libgeotiff_PROCESS_LIBS libgeotiff_LIBRARIES) + libfind_process(libgeotiff) + else (NOT libgeotiff_LIBRARIES STREQUAL "libgeotiff_LIBRARIES-NOTFOUND" AND NOT libgeotiff_INCLUDE_DIR STREQUAL "libgeotiff_INCLUDE_DIR-NOTFOUND") + message (STATUS "Could NOT find libgeotiff.") + endif (NOT libgeotiff_LIBRARIES STREQUAL "libgeotiff_LIBRARIES-NOTFOUND" AND NOT libgeotiff_INCLUDE_DIR STREQUAL "libgeotiff_INCLUDE_DIR-NOTFOUND") + + SET ( libgeotiff_INCLUDE_DIR ${libgeotiff_INCLUDE_DIR} ${libtiff_INCLUDE_DIR} CACHE STRING "libgeotiff include directories." FORCE ) + SET ( libgeotiff_LIBRARIES ${libgeotiff_LIBRARIES} ${libtiff_LIBRARIES} CACHE STRING "libgeotiff link libraries." FORCE ) + +endif (NOT libgeotiff_FOUND) diff --git a/scripts/cmake/FindLibTiff.cmake b/scripts/cmake/FindLibTiff.cmake new file mode 100644 index 00000000000..96b4cac12d2 --- /dev/null +++ b/scripts/cmake/FindLibTiff.cmake @@ -0,0 +1,42 @@ +# - Try to find libtiff +# Once done, this will define +# +# libtiff_FOUND +# libtiff_INCLUDE_DIRS +# libtiff_LIBRARIES + +if (NOT libtiff_FOUND) + + include(LibFindMacros) + + find_path( libtiff_INCLUDE_DIR + NAMES tiff.h + PATHS /usr/include + ${CMAKE_SOURCE_DIR}/../Libs/libtiff/libtiff + C:/OGS_Libs/libtiff + $ENV{OGS_LIBS}/libtiff) + + if ( UNIX ) + find_library(libtiff_LIBRARIES + NAMES tiff + PATHS /usr/lib64 /usr/lib ${CMAKE_SOURCE_DIR}/../Libs/libtiff/libtiff) + else ( UNIX ) + find_library(libtiff_LIBRARIES + NAMES libtiff + PATHS ${CMAKE_SOURCE_DIR}/../Libs/libtiff/libtiff + C:/OGS_Libs/libtiff + $ENV{OGS_LIBS}/libtiff) + endif ( UNIX ) + + + # Set the include dir variables and the libraries and let libfind_process do the rest. + # NOTE: Singular variables for this library, plural for libraries this this lib depends on. + if (NOT libtiff_LIBRARIES STREQUAL "libtiff_LIBRARIES-NOTFOUND" AND NOT libtiff_INCLUDE_DIR STREQUAL "libtiff_INCLUDE_DIR-NOTFOUND") + set(libtiff_PROCESS_INCLUDES libtiff_INCLUDE_DIR) + set(libtiff_PROCESS_LIBS libtiff_LIBRARIES) + libfind_process(libtiff) + else (NOT libtiff_LIBRARIES STREQUAL "libtiff_LIBRARIES-NOTFOUND" AND NOT libtiff_INCLUDE_DIR STREQUAL "libtiff_INCLUDE_DIR-NOTFOUND") + message (STATUS "Could NOT find libtiff.") + endif (NOT libtiff_LIBRARIES STREQUAL "libtiff_LIBRARIES-NOTFOUND" AND NOT libtiff_INCLUDE_DIR STREQUAL "libtiff_INCLUDE_DIR-NOTFOUND") + +endif (NOT libtiff_FOUND) -- GitLab