diff --git a/Applications/DataExplorer/DataView/ElementTreeModel.cpp b/Applications/DataExplorer/DataView/ElementTreeModel.cpp index ac7734bc37437ee3029a9e6fd58a8bfce2eca9eb..b8b8ade257a47d5f0ea2b18da69179d7def342f6 100644 --- a/Applications/DataExplorer/DataView/ElementTreeModel.cpp +++ b/Applications/DataExplorer/DataView/ElementTreeModel.cpp @@ -13,15 +13,17 @@ */ #include "ElementTreeModel.h" -#include "OGSError.h" -#include "TreeItem.h" -#include "Mesh.h" + +#include "MeshLib/Mesh.h" #include "MeshLib/Node.h" -#include "MeshInformation.h" -#include "Elements/Element.h" -#include "AABB.h" +#include "MeshLib/MeshInformation.h" +#include "MeshLib/Elements/Element.h" + +#include "GeoLib/AABB.h" -#include "VtkMeshSource.h" +#include "InSituLib/VtkMappedMeshSource.h" + +#include "TreeItem.h" /** * Constructor. @@ -44,7 +46,8 @@ void ElementTreeModel::setElement(vtkUnstructuredGridAlgorithm const*const grid, _mesh_source = grid; this->clearView(); - VtkMeshSource const*const source = dynamic_cast<VtkMeshSource const*const>(grid); + InSituLib::VtkMappedMeshSource const*const source = + dynamic_cast<InSituLib::VtkMappedMeshSource const*const>(grid); if (!source) return; diff --git a/Applications/DataExplorer/DataView/MshItem.cpp b/Applications/DataExplorer/DataView/MshItem.cpp index e57d565f7e21ba0101d1b4ef6df94f07a44b6d07..544a87985cbffb038cd2fc0dc14d30f7b4aea3a3 100644 --- a/Applications/DataExplorer/DataView/MshItem.cpp +++ b/Applications/DataExplorer/DataView/MshItem.cpp @@ -13,7 +13,7 @@ */ #include "MshItem.h" -#include "VtkMeshSource.h" +#include "InSituLib/VtkMappedMeshSource.h" /** * Constructor. @@ -24,11 +24,11 @@ MshItem::MshItem(const QList<QVariant> &data, TreeItem* parent, const MeshLib::Mesh* mesh) : TreeItem(data, parent) { - _meshSource = VtkMeshSource::New(); - _meshSource->SetMesh(mesh); + _mesh_source = InSituLib::VtkMappedMeshSource::New(); + static_cast<InSituLib::VtkMappedMeshSource*>(_mesh_source)->SetMesh(mesh); } MshItem::~MshItem() { - _meshSource->Delete(); + _mesh_source->Delete(); } diff --git a/Applications/DataExplorer/DataView/MshItem.h b/Applications/DataExplorer/DataView/MshItem.h index 662a89acb8b6c7725ede901e50b3dd65d8643671..bbe09bf2abc443c53b3b2ea4a526437fc50a3e0b 100644 --- a/Applications/DataExplorer/DataView/MshItem.h +++ b/Applications/DataExplorer/DataView/MshItem.h @@ -16,9 +16,8 @@ #define MSHITEM_H #include "TreeItem.h" -#include "VtkMeshSource.h" -class VtkMeshSource; +#include "InSituLib/VtkMappedMeshSource.h" namespace MeshLib { class Mesh; @@ -36,12 +35,12 @@ public: ~MshItem(); /// Returns the mesh. - const MeshLib::Mesh* getMesh() const { return this->_meshSource->GetMesh(); } + MeshLib::Mesh const* getMesh() const { return _mesh_source->GetMesh(); } /// Returns the VTK object. - VtkMeshSource* vtkSource() const { return _meshSource; } + InSituLib::VtkMappedMeshSource* vtkSource() const { return _mesh_source; } private: - VtkMeshSource* _meshSource; + InSituLib::VtkMappedMeshSource * _mesh_source; }; #endif //MSHITEM_H diff --git a/Applications/DataExplorer/DataView/MshModel.cpp b/Applications/DataExplorer/DataView/MshModel.cpp index 2a9a67515e2e3a696a0d4ccec93972ec7e09ea25..67155a286f36a2a337faf7497ec30076b7d9d6ca 100644 --- a/Applications/DataExplorer/DataView/MshModel.cpp +++ b/Applications/DataExplorer/DataView/MshModel.cpp @@ -14,25 +14,24 @@ #include "MshModel.h" +// Qt +#include <QFileInfo> +#include <QString> + +#include <vtkUnstructuredGridAlgorithm.h> + // ThirdParty/logog #include "logog/include/logog.hpp" -// ** INCLUDES ** #include "MshItem.h" #include "StringTools.h" #include "TreeItem.h" -#include "VtkMeshSource.h" // MeshLib #include "MeshLib/Node.h" #include "Elements/Element.h" #include "MeshEnums.h" -// Qt -#include <QFileInfo> -#include <QString> - -#include "StringTools.h" MshModel::MshModel(ProjectData &project, QObject* parent /*= 0*/ ) : TreeModel(parent), _project(project) @@ -63,8 +62,8 @@ void MshModel::addMeshObject(const MeshLib::Mesh* mesh) QList<QVariant> meshData; meshData << display_name << ""; MshItem* newMesh = new MshItem(meshData, _rootItem, mesh); - if (newMesh->vtkSource()) - newMesh->vtkSource()->SetName(display_name); + //if (newMesh->vtkSource()) + // newMesh->vtkSource()->SetName(display_name); _rootItem->appendChild(newMesh); // display elements @@ -171,7 +170,7 @@ void MshModel::updateModel() addMeshObject(*it); } -VtkMeshSource* MshModel::vtkSource(const QModelIndex &idx) const +vtkUnstructuredGridAlgorithm* MshModel::vtkSource(const QModelIndex &idx) const { if (idx.isValid()) { @@ -183,7 +182,7 @@ VtkMeshSource* MshModel::vtkSource(const QModelIndex &idx) const return nullptr; } -VtkMeshSource* MshModel::vtkSource(const std::string &name) const +vtkUnstructuredGridAlgorithm* MshModel::vtkSource(const std::string &name) const { for (int i = 0; i < _rootItem->childCount(); i++) { diff --git a/Applications/DataExplorer/DataView/MshModel.h b/Applications/DataExplorer/DataView/MshModel.h index e7cb48b5bde62a324e49fcdd53e305ed6c8c0a9e..61f5807bb2912ae1a64742b65d11176368a49de7 100644 --- a/Applications/DataExplorer/DataView/MshModel.h +++ b/Applications/DataExplorer/DataView/MshModel.h @@ -26,7 +26,7 @@ namespace MeshLib { class Mesh; } -class VtkMeshSource; +class vtkUnstructuredGridAlgorithm; /** * The MshModel is a Qt model which represents Mesh objects. @@ -57,9 +57,9 @@ public slots: /// Updates the model based on the ProjectData-object void updateModel(); /// Returns the VTK source item for the mesh with the given index. - VtkMeshSource* vtkSource(const QModelIndex &idx) const; + vtkUnstructuredGridAlgorithm* vtkSource(const QModelIndex &idx) const; /// Returns the VTK source item for the mesh with the given name. - VtkMeshSource* vtkSource(const std::string &name) const; + vtkUnstructuredGridAlgorithm* vtkSource(const std::string &name) const; private: /// Adds the mesh to the GUI-Mesh-Model und -View diff --git a/Applications/DataExplorer/DataView/MshView.cpp b/Applications/DataExplorer/DataView/MshView.cpp index f80e516dab8be783bab3f362c0807b621736b2ef..316018c5527f07331094fdfe9151ce0053e2bb27 100644 --- a/Applications/DataExplorer/DataView/MshView.cpp +++ b/Applications/DataExplorer/DataView/MshView.cpp @@ -34,7 +34,6 @@ #include "ImportFileTypes.h" #include "LastSavedFileDirectory.h" #include "SaveMeshDialog.h" -#include "VtkMeshSource.h" #include "SHPInterface.h" #include "TetGenInterface.h" diff --git a/Applications/DataExplorer/DataView/MshView.h b/Applications/DataExplorer/DataView/MshView.h index ea7e2a6bbb1bff5438a7db3375744d102612905c..53f1b2027b66b584945e869526f73f6408e554cc 100644 --- a/Applications/DataExplorer/DataView/MshView.h +++ b/Applications/DataExplorer/DataView/MshView.h @@ -19,17 +19,16 @@ #include <QTreeView> class MshModel; -class VtkMeshSource; class vtkUnstructuredGridAlgorithm; namespace MeshLib { class Mesh; } -/* - namespace GeoLib { - class Point; - } - */ + +namespace InSituLib { + class VtkMappedMeshSource; +} + /** * The DataView is table view which acts as a base class for displaying * several OSG data formats. @@ -89,7 +88,7 @@ signals: void enableRemoveButton(bool); void meshSelected(MeshLib::Mesh const*const); void openMeshFile(int); - void qualityCheckRequested(VtkMeshSource*); + void qualityCheckRequested(InSituLib::VtkMappedMeshSource*); void removeSelectedMeshComponent(); void requestCondSetupDialog(const std::string&, const GeoLib::GEOTYPE, const std::size_t, bool on_points); void requestMeshRemoval(const QModelIndex&); diff --git a/Applications/DataExplorer/VtkVis/CMakeLists.txt b/Applications/DataExplorer/VtkVis/CMakeLists.txt index fd011f61395d695b18e305733c94b01338580e4f..f7f0ce4937e645362bd16ce32cd44eaefe4b9ca4 100644 --- a/Applications/DataExplorer/VtkVis/CMakeLists.txt +++ b/Applications/DataExplorer/VtkVis/CMakeLists.txt @@ -27,7 +27,6 @@ set(SOURCES VtkFilterFactory.cpp VtkGeoImageSource.cpp VtkImageDataToLinePolyDataFilter.cpp - VtkMeshSource.cpp VtkPolylinesSource.cpp VtkPointsSource.cpp VtkRaster.cpp @@ -65,7 +64,6 @@ set(HEADERS VtkFilterFactory.h VtkGeoImageSource.h VtkImageDataToLinePolyDataFilter.h - VtkMeshSource.h VtkPolylinesSource.h VtkPointsSource.h VtkRaster.h diff --git a/Applications/DataExplorer/VtkVis/VtkMeshSource.cpp b/Applications/DataExplorer/VtkVis/VtkMeshSource.cpp deleted file mode 100644 index 2cd256e25bd0cbd1c9dc5c2a08215a66c803f318..0000000000000000000000000000000000000000 --- a/Applications/DataExplorer/VtkVis/VtkMeshSource.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** - * \file - * \author Karsten Rink - * \date 2010-03-19 - * \brief Implementation of the VtkMeshSource class. - * - * \copyright - * Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#include "VtkMeshSource.h" - -#include "logog/include/logog.hpp" - -#include "Color.h" - -#include <vtkProperty.h> - - -vtkStandardNewMacro(VtkMeshSource); - -VtkMeshSource::VtkMeshSource() : - _grid(nullptr), _matName("MaterialIDs") -{ - _removable = false; // From VtkAlgorithmProperties - this->SetNumberOfInputPorts(0); - - const GeoLib::Color* c = GeoLib::getRandomColor(); - vtkProperty* vtkProps = GetProperties(); - vtkProps->SetColor((*c)[0] / 255.0,(*c)[1] / 255.0,(*c)[2] / 255.0); - delete c; - vtkProps->SetEdgeVisibility(1); -} - -VtkMeshSource::~VtkMeshSource() -{ -} - -void VtkMeshSource::PrintSelf( ostream& os, vtkIndent indent ) -{ - this->Superclass::PrintSelf(os,indent); -} - -int VtkMeshSource::RequestData( vtkInformation* request, - vtkInformationVector** inputVector, - vtkInformationVector* outputVector ) -{ - return this->Superclass::RequestData(request, inputVector, outputVector); -} - -void VtkMeshSource::SetUserProperty( QString name, QVariant value ) -{ - VtkAlgorithmProperties::SetUserProperty(name, value); - - (*_algorithmUserProperties)[name] = value; -} diff --git a/Applications/DataExplorer/VtkVis/VtkMeshSource.h b/Applications/DataExplorer/VtkVis/VtkMeshSource.h deleted file mode 100644 index fbe0187fd41e42e8085e28325bc07c18b6607443..0000000000000000000000000000000000000000 --- a/Applications/DataExplorer/VtkVis/VtkMeshSource.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * \file - * \author Karsten Rink - * \date 2010-03-19 - * \brief Definition of the VtkMeshSource class. - * - * \copyright - * Copyright (c) 2012-2015, OpenGeoSys Community (http://www.opengeosys.org) - * Distributed under a Modified BSD License. - * See accompanying file LICENSE.txt or - * http://www.opengeosys.org/project/license - * - */ - -#ifndef VTKMESHSOURCE_H -#define VTKMESHSOURCE_H - -// ** INCLUDES ** -#include <map> - -#include "VtkAlgorithmProperties.h" -#include "InSituLib/VtkMappedMeshSource.h" - -class VtkColorLookupTable; - -namespace MeshLib { - class Mesh; -} - -/** - * \brief VTK source object for the visualisation of unstructured grids - */ -class VtkMeshSource : public InSituLib::VtkMappedMeshSource, public VtkAlgorithmProperties -{ -public: - /// Create new objects with New() because of VTKs object reference counting. - static VtkMeshSource* New(); - - vtkTypeMacro(VtkMeshSource, InSituLib::VtkMappedMeshSource); - - const char* GetMaterialArrayName() const { return _matName; } - - /// Prints the mesh data to an output stream. - void PrintSelf(ostream& os, vtkIndent indent); - - /** - * \brief Generates random colors based on the material scalar value. - * Each element of the mesh is assigned an RGB-value based on its material group. - * This method should only be called after setMesh()! - */ - //ogsUserPropertyMacro(ColorByMaterial,bool); - - virtual void SetUserProperty(QString name, QVariant value); - -protected: - VtkMeshSource(); - ~VtkMeshSource(); - - /// Computes the unstructured grid data object. - int RequestData(vtkInformation* request, - vtkInformationVector** inputVector, - vtkInformationVector* outputVector); - - const MeshLib::Mesh* _grid; - -private: - const char* _matName; -}; - -#endif // VTKMESHSOURCE_H diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp b/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp index a3afae2346b3793e69a2de09c3ef7d61278d99fd..89ddc0298eaa7edb24d60c3edc0371bce0d9f0d7 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp @@ -32,11 +32,12 @@ #include "VtkCompositeElementSelectionFilter.h" #include "VtkCompositeGeoObjectFilter.h" #include "VtkFilterFactory.h" -#include "VtkMeshSource.h" #include "VtkVisImageItem.h" #include "VtkVisPipelineItem.h" #include "VtkVisPointSetItem.h" +#include "InSituLib/VtkMappedMeshSource.h" + #include <vtkAlgorithm.h> #include <vtkCamera.h> #include <vtkGenericDataObjectReader.h> @@ -431,7 +432,9 @@ void VtkVisPipeline::listArrays(vtkDataSet* dataSet) ERR("VtkVisPipeline::listArrays(): not a valid vtkDataSet."); } -void VtkVisPipeline::showMeshElementQuality(VtkMeshSource* source, MeshLib::MeshQualityType t, std::vector<double> const& quality) +void VtkVisPipeline::showMeshElementQuality( + InSituLib::VtkMappedMeshSource* source, + MeshLib::MeshQualityType t, std::vector<double> const& quality) { if (!source || quality.empty()) return; diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipeline.h b/Applications/DataExplorer/VtkVis/VtkVisPipeline.h index c86fd1288ad625dc7bf0b6fb54c9d67c5aef9663..cc1f285a5b46e18511d9381f9fc0f9652f3c1d6e 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipeline.h +++ b/Applications/DataExplorer/VtkVis/VtkVisPipeline.h @@ -45,7 +45,11 @@ class MshModel; class StationTreeModel; class TreeModel; class VtkVisPipelineItem; -class VtkMeshSource; + +namespace InSituLib +{ + class VtkMappedMeshSource; +} /** * \brief VtkVisPipeline manages the VTK visualization. @@ -97,7 +101,7 @@ public: void setGlobalBackfaceCulling(bool enable) const; /// Checks the quality of mesh elements and adds a filter to highlight deformed elements. - void showMeshElementQuality(VtkMeshSource* mesh, MeshLib::MeshQualityType t, std::vector<double> const& quality); + void showMeshElementQuality(InSituLib::VtkMappedMeshSource* mesh, MeshLib::MeshQualityType t, std::vector<double> const& quality); public slots: /// \brief Adds the given Model to the pipeline. diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index 144c7591d773c3abfa937b36ed3bf7738199749a..384c4fad4c6fc1104db2c448e786c06d5ea69981 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -56,11 +56,12 @@ #include "TreeModelIterator.h" #include "VtkBGImageSource.h" #include "VtkGeoImageSource.h" -#include "VtkMeshSource.h" #include "VtkRaster.h" #include "VtkVisPipeline.h" #include "VtkVisPipelineItem.h" +#include "InSituLib/VtkMappedMeshSource.h" + // FileIO includes #include "FileIO/FEFLOWInterface.h" #include "FileIO/GMSInterface.h" @@ -177,8 +178,10 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) _meshModels, SLOT(removeMesh(const QModelIndex &))); connect(mshTabWidget->treeView, SIGNAL(requestMeshRemoval(const QModelIndex &)), _elementModel, SLOT(clearView())); - connect(mshTabWidget->treeView, SIGNAL(qualityCheckRequested(VtkMeshSource*)), - this, SLOT(showMshQualitySelectionDialog(VtkMeshSource*))); + connect(mshTabWidget->treeView, + SIGNAL(qualityCheckRequested(InSituLib::VtkMappedMeshSource*)), + this, + SLOT(showMshQualitySelectionDialog(InSituLib::VtkMappedMeshSource*))); connect(mshTabWidget->treeView, SIGNAL(requestMeshToGeometryConversion(const MeshLib::Mesh*)), this, SLOT(convertMeshToGeometry(const MeshLib::Mesh*))); connect(mshTabWidget->treeView, SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const*const, unsigned, bool)), @@ -1040,7 +1043,7 @@ void MainWindow::showMergeGeometriesDialog() OGSError::box("Points are missing for\n at least one geometry."); } -void MainWindow::showMshQualitySelectionDialog(VtkMeshSource* mshSource) +void MainWindow::showMshQualitySelectionDialog(InSituLib::VtkMappedMeshSource* mshSource) { if (mshSource == nullptr) return; diff --git a/Applications/DataExplorer/mainwindow.h b/Applications/DataExplorer/mainwindow.h index 4f600e8a275239d3cbac91ea76ebbd26e22c107e..7ebe02a2a39c838184b83d71e349eafbca63e6c7 100644 --- a/Applications/DataExplorer/mainwindow.h +++ b/Applications/DataExplorer/mainwindow.h @@ -30,6 +30,11 @@ class ProcessModel; class VtkVisPipeline; class VisPrefsDialog; +namespace InSituLib +{ + class VtkMappedMeshSource; +} + class QSignalMapper; /** @@ -95,7 +100,7 @@ protected slots: void showGMSHPrefsDialog(); void showMergeGeometriesDialog(); void showMeshAnalysisDialog(); - void showMshQualitySelectionDialog(VtkMeshSource* mshSource); + void showMshQualitySelectionDialog(InSituLib::VtkMappedMeshSource* mshSource); void showVisalizationPrefsDialog(); void updateDataViews(); void writeGeometryToFile(QString listName, QString fileName);