diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
index 34c9353fe9..3ef1d0c672 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/CMakeLists.txt
@@ -1,11 +1,4 @@
-# create a plugin that adds a reader to the ParaView GUI
-# it is added in the file dialog when doing opens/saves.
-
-# The qrc file is processed by Qt's resource compiler (rcc)
-# the qrc file must have a resource prefix of "/ParaViewResources"
-# and ParaView will read anything contained under that prefix
-# the pqReader.xml file contains xml defining readers with their
-# file extensions and descriptions.
+# Create a plugin to add a reader to the ParaView GUI
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
@@ -25,7 +18,7 @@ INCLUDE_DIRECTORIES(
)
ADD_DEFINITIONS(
- -std=c++0x
+ -std=c++11
-DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
)
@@ -37,44 +30,44 @@ SET(
"Single output directory for building all libraries."
)
-#
-# Define combined plugin
-#
-# Extend the auto-generated panel
-QT4_WRAP_CPP(MOC_SRCS pqPVblockMeshReaderPanel.h)
-
-ADD_PARAVIEW_OBJECT_PANEL(IFACES IFACE_SRCS
- CLASS_NAME pqPVblockMeshReaderPanel
- XML_NAME PVblockMeshReader # name of SourceProxy in *SM.xml
- XML_GROUP sources
-)
-
-# Separate GUI_RESOURCE_FILES deprecated with paraview 4.3
-# so check if version < 4.4
-
-IF(("${PARAVIEW_VERSION_MAJOR}" LESS 5) AND ("${PARAVIEW_VERSION_MINOR}" LESS 4))
- ADD_PARAVIEW_PLUGIN(
- PVblockMeshReader_SM "1.0"
- SERVER_MANAGER_XML PVblockMeshReader_SM.xml
- SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
- GUI_INTERFACES ${IFACES}
- GUI_SOURCES pqPVblockMeshReaderPanel.cxx
- ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
- GUI_RESOURCE_FILES PVblockMeshReader.xml
- )
+IF (PARAVIEW_QT_VERSION VERSION_GREATER "4")
+ QT5_WRAP_CPP(MOC_SRCS
+ pqRefreshProperty.h
+ pqShowPointNumbersProperty.h
+ )
ELSE()
- ADD_PARAVIEW_PLUGIN(
- PVblockMeshReader_SM "1.0"
- SERVER_MANAGER_XML PVblockMeshReader_SM.xml
- SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
- GUI_INTERFACES ${IFACES}
- GUI_SOURCES pqPVblockMeshReaderPanel.cxx
- ${MOC_SRCS} ${UI_SRCS} ${IFACE_SRCS}
- )
+ QT4_WRAP_CPP(MOC_SRCS
+ pqRefreshProperty.h
+ pqShowPointNumbersProperty.h
+ )
ENDIF()
-# Build the client-side plugin
+ADD_PARAVIEW_PROPERTY_WIDGET(IFACES0 IFACES0_SRCS
+ TYPE "openfoam_refresh_button"
+ CLASS_NAME pqRefreshProperty
+)
+
+ADD_PARAVIEW_PROPERTY_WIDGET(IFACES1 IFACES1_SRCS
+ TYPE "openfoam_show_point_numbers"
+ CLASS_NAME pqShowPointNumbersProperty
+)
+
+ADD_PARAVIEW_PLUGIN(
+ PVblockMeshReader_SM "1.0"
+ SERVER_MANAGER_XML PVblockMeshReader_SM.xml
+ SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
+ GUI_INTERFACES
+ ${IFACES0}
+ ${IFACES1}
+ SOURCES
+ ${IFACES0_SRCS}
+ ${IFACES1_SRCS}
+ ${MOC_SRCS}
+ pqRefreshProperty.cxx
+ pqShowPointNumbersProperty.cxx
+)
+
TARGET_LINK_LIBRARIES(
PVblockMeshReader_SM
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.qrc b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.qrc
deleted file mode 100644
index 228226bd56..0000000000
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- PVblockMeshReader.xml
-
-
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml
deleted file mode 100644
index 9354a13525..0000000000
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader_SM.xml b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader_SM.xml
index 28df8ae78b..61b251bbd1 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader_SM.xml
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/PVblockMeshReader_SM.xml
@@ -5,45 +5,38 @@
class="vtkPVblockMeshReader">
-
+ panel_visibility="never">
-
- Specifies the filename for the OpenFOAM blockMesh Reader.
-
+ The filename for the OpenFOAM blockMesh reader.
-
-
-
-
- Show point numbers in render window.
-
-
-
-
-
+
+ panel_widget="openfoam_refresh_button"
+ number_of_elements="1"
+ panel_visibility="default">
-
- Rescan for updated blockMeshDict.
-
+ Rescan for updated blockMeshDict.
+
+
+
+ Show point numbers in render window.
+
@@ -81,7 +71,7 @@
information_only="1">
-
+ information_property="CurvedEdgesArrayStatus">
-
- This property contains a list of the curved edges
-
+ The list of curved edges
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqPVblockMeshReaderPanel.cxx b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqPVblockMeshReaderPanel.cxx
deleted file mode 100644
index 06f0db328d..0000000000
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqPVblockMeshReaderPanel.cxx
+++ /dev/null
@@ -1,143 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-\*---------------------------------------------------------------------------*/
-
-#include "pqPVblockMeshReaderPanel.h"
-
-// QT
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-// Paraview <-> QT UI
-#include "pqAnimationScene.h"
-#include "pqApplicationCore.h"
-#include "pqPipelineRepresentation.h"
-#include "pqServerManagerModel.h"
-#include "pqView.h"
-
-// Paraview Server Manager
-#include "vtkSMDoubleVectorProperty.h"
-#include "vtkSMIntVectorProperty.h"
-#include "vtkSMProperty.h"
-#include "vtkSMSourceProxy.h"
-
-
-// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-
-pqPVblockMeshReaderPanel::pqPVblockMeshReaderPanel
-(
- pqProxy *proxy,
- QWidget *p
-)
-:
- pqAutoGeneratedObjectPanel(proxy, p)
-{
- // Create first sublayout (at top of the panel)
- QGridLayout *form = new QGridLayout();
- this->PanelLayout->addLayout(form, 0, 0, 1, -1);
-
- vtkSMProperty* prop = 0;
-
- // Refresh button for updating blocks
- if ((prop = this->proxy()->GetProperty("UiRefresh")) != 0)
- {
- prop->SetImmediateUpdate(1);
- QPushButton* refresh = new QPushButton("Refresh");
- refresh->setToolTip("Rescan for updated blockMeshDict.");
-
- form->addWidget(refresh, 0, 0, Qt::AlignLeft);
- QObject::connect
- (
- refresh,
- SIGNAL(clicked()),
- this,
- SLOT(RefreshPressed())
- );
- }
-
- // Checkbox for showing point numbers
- if ((prop = this->proxy()->GetProperty("UiShowPointNumbers")) != 0)
- {
- prop->SetImmediateUpdate(true);
-
- ShowPointNumbers_ = new QCheckBox("Show Point Numbers");
- ShowPointNumbers_->setToolTip("Show point numbers in render window.");
- ShowPointNumbers_->setChecked
- (
- vtkSMIntVectorProperty::SafeDownCast(prop)->GetElement(0)
- );
-
- form->addWidget(ShowPointNumbers_);
-
- connect
- (
- ShowPointNumbers_,
- SIGNAL(stateChanged(int)),
- this,
- SLOT(ShowPointNumbersToggled())
- );
- }
-
-}
-
-// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
-
-void pqPVblockMeshReaderPanel::ShowPointNumbersToggled()
-{
- vtkSMIntVectorProperty::SafeDownCast
- (
- this->proxy()->GetProperty("UiShowPointNumbers")
- )->SetElement(0, ShowPointNumbers_->isChecked());
-
- // Update the active view
- if (this->view())
- {
- this->view()->render();
- }
- // OR: update all views
- // pqApplicationCore::instance()->render();
-}
-
-
-void pqPVblockMeshReaderPanel::RefreshPressed()
-{
- // Update everything
- vtkSMIntVectorProperty::SafeDownCast
- (
- this->proxy()->GetProperty("UiRefresh")
- )->Modified();
-
- vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
-
- // Render all views
- pqApplicationCore::instance()->render();
-}
-
-
-// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqRefreshProperty.cxx b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqRefreshProperty.cxx
new file mode 100644
index 0000000000..c925dfe8cc
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqRefreshProperty.cxx
@@ -0,0 +1,120 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "pqRefreshProperty.h"
+
+#include
+#include
+
+#include "pqApplicationCore.h"
+#include "pqView.h"
+#include "vtkSMDocumentation.h"
+#include "vtkSMIntVectorProperty.h"
+#include "vtkSMSourceProxy.h"
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+// file-scope
+static void setButtonProperties
+(
+ QAbstractButton* b,
+ vtkSMIntVectorProperty* prop,
+ bool initChecked = true
+)
+{
+ QString tip;
+
+ vtkSMDocumentation* doc = prop->GetDocumentation();
+ if (doc)
+ {
+ const char* txt = doc->GetDescription();
+ if (txt)
+ {
+ tip = QString(txt).simplified();
+ }
+ }
+
+ b->setText(prop->GetXMLLabel());
+ if (tip.size())
+ {
+ b->setToolTip(tip);
+ }
+ b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
+
+ // initial checked state
+ if (initChecked)
+ {
+ b->setChecked(prop->GetElement(0));
+ }
+}
+
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+void pqRefreshProperty::refreshPressed()
+{
+ // Update everything
+ refresh_->Modified();
+
+ vtkSMSourceProxy::SafeDownCast(this->proxy())->UpdatePipeline();
+
+ // Render all views
+ pqApplicationCore::instance()->render();
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+pqRefreshProperty::pqRefreshProperty
+(
+ vtkSMProxy* proxy,
+ vtkSMProperty* prop,
+ QWidget* parent
+)
+:
+ Superclass(proxy, parent),
+ refresh_(vtkSMIntVectorProperty::SafeDownCast(prop))
+{
+ // Replace with our UI content
+ this->setShowLabel(false);
+
+ QGridLayout* form = new QGridLayout(this);
+
+ QPushButton* b = new QPushButton(this);
+ setButtonProperties(b, refresh_, false);
+ form->addWidget(b, 0, 0, Qt::AlignLeft);
+
+ connect(b, SIGNAL(clicked()), this, SLOT(refreshPressed()));
+ refresh_->SetImmediateUpdate(true);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+pqRefreshProperty::~pqRefreshProperty()
+{}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqPVblockMeshReaderPanel.h b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqRefreshProperty.h
similarity index 61%
rename from applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqPVblockMeshReaderPanel.h
rename to applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqRefreshProperty.h
index 4c15bc374e..cf2879ebfb 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqPVblockMeshReaderPanel.h
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqRefreshProperty.h
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -22,60 +22,63 @@ License
along with OpenFOAM. If not, see .
Class
- pqPVblockMeshReaderPanel
+ pqRefreshProperty
Description
- GUI modifications for the ParaView reader panel
-
- A custom panel for the PVblockMeshReader.
+ Custom refresh button (ParaView blockMesh reader)
SourceFiles
- pqPVblockMeshReaderPanel.cxx
+ pqRefreshProperty.cxx
\*---------------------------------------------------------------------------*/
-#ifndef pqPVblockMeshReaderPanel_h
-#define pqPVblockMeshReaderPanel_h
+#ifndef pqRefreshProperty_h
+#define pqRefreshProperty_h
-#include "pqAutoGeneratedObjectPanel.h"
+#include "pqPropertyWidget.h"
-// Forward declaration of QT classes
-
-class QCheckBox;
-class QLineEdit;
-class QTimer;
-class QToolButton;
-
-// Forward declaration of ParaView classes
-class vtkSMSourceProxy;
+// Forward declarations (ParaView)
+class vtkSMIntVectorProperty;
/*---------------------------------------------------------------------------*\
- Class pqPVblockMeshReaderPanel Declaration
+ Class pqRefreshProperty Declaration
\*---------------------------------------------------------------------------*/
-class pqPVblockMeshReaderPanel
+class pqRefreshProperty
:
- public pqAutoGeneratedObjectPanel
+ public pqPropertyWidget
{
- // Private data
Q_OBJECT;
- typedef pqAutoGeneratedObjectPanel Superclass;
+ typedef pqPropertyWidget Superclass;
+
+ // Private data
+
+ //- Refresh (bool property - as push button)
+ vtkSMIntVectorProperty* refresh_;
- //- Show Point Numbers checkbox
- QCheckBox* ShowPointNumbers_;
protected slots:
- void ShowPointNumbersToggled();
- void RefreshPressed();
+ // Protected Member Functions
+
+ //- Trigger refresh
+ void refreshPressed();
public:
- // Constructors
+ //- Construct from components
+ pqRefreshProperty
+ (
+ vtkSMProxy* proxy,
+ vtkSMProperty* prop,
+ QWidget* parent = nullptr
+ );
+
+
+ //- Destructor
+ virtual ~pqRefreshProperty();
- //- Construct from components
- pqPVblockMeshReaderPanel(pqProxy*, QWidget*);
};
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqShowPointNumbersProperty.cxx b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqShowPointNumbersProperty.cxx
new file mode 100644
index 0000000000..8e3c40e1aa
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqShowPointNumbersProperty.cxx
@@ -0,0 +1,122 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "pqShowPointNumbersProperty.h"
+
+#include
+#include
+
+#include "pqApplicationCore.h"
+#include "pqView.h"
+#include "vtkSMDocumentation.h"
+#include "vtkSMIntVectorProperty.h"
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+// file-scope
+static void setButtonProperties
+(
+ QAbstractButton* b,
+ vtkSMIntVectorProperty* prop,
+ bool initChecked = true
+)
+{
+ QString tip;
+
+ vtkSMDocumentation* doc = prop->GetDocumentation();
+ if (doc)
+ {
+ const char* txt = doc->GetDescription();
+ if (txt)
+ {
+ tip = QString(txt).simplified();
+ }
+ }
+
+ b->setText(prop->GetXMLLabel());
+ if (tip.size())
+ {
+ b->setToolTip(tip);
+ }
+ b->setFocusPolicy(Qt::NoFocus); // avoid dotted border
+
+ // initial checked state
+ if (initChecked)
+ {
+ b->setChecked(prop->GetElement(0));
+ }
+}
+
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+void pqShowPointNumbersProperty::showPointNumbers(bool checked)
+{
+ showPointNumbers_->SetElement(0, checked);
+
+ // Update the active view
+ if (this->view())
+ {
+ this->view()->render();
+ }
+
+ // OR: update all views
+ // pqApplicationCore::instance()->render();
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+pqShowPointNumbersProperty::pqShowPointNumbersProperty
+(
+ vtkSMProxy* proxy,
+ vtkSMProperty* prop,
+ QWidget* parent
+)
+:
+ Superclass(proxy, parent),
+ showPointNumbers_(vtkSMIntVectorProperty::SafeDownCast(prop))
+{
+ // Replace with our UI content
+ this->setShowLabel(false);
+
+ QGridLayout* form = new QGridLayout(this);
+
+ QCheckBox* b = new QCheckBox(this);
+ setButtonProperties(b, showPointNumbers_);
+ form->addWidget(b, 0, 0, Qt::AlignLeft);
+
+ connect(b, SIGNAL(toggled(bool)), this, SLOT(showPointNumbers(bool)));
+ showPointNumbers_->SetImmediateUpdate(true);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+pqShowPointNumbersProperty::~pqShowPointNumbersProperty()
+{}
+
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqShowPointNumbersProperty.h b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqShowPointNumbersProperty.h
new file mode 100644
index 0000000000..30021a309d
--- /dev/null
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/pqShowPointNumbersProperty.h
@@ -0,0 +1,89 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ pqShowPointNumbersProperty
+
+Description
+ Custom UI handling of show-points (ParaView blockMesh reader)
+
+SourceFiles
+ pqShowPointNumbersProperty.cxx
+
+\*---------------------------------------------------------------------------*/
+#ifndef pqShowPointNumbersProperty_h
+#define pqShowPointNumbersProperty_h
+
+#include "pqPropertyWidget.h"
+
+// Forward declarations (ParaView)
+class vtkSMIntVectorProperty;
+
+
+/*---------------------------------------------------------------------------*\
+ Class pqShowPointNumbersProperty Declaration
+\*---------------------------------------------------------------------------*/
+
+class pqShowPointNumbersProperty
+:
+ public pqPropertyWidget
+{
+ Q_OBJECT;
+ typedef pqPropertyWidget Superclass;
+
+ // Private data
+
+ //- Show Point Numbers (bool property)
+ vtkSMIntVectorProperty* showPointNumbers_;
+
+
+protected slots:
+
+ // Protected Member Functions
+
+ //- Sync property with changed checkbox state, update rendered view(s)
+ void showPointNumbers(bool checked);
+
+
+public:
+
+ //- Construct from components
+ pqShowPointNumbersProperty
+ (
+ vtkSMProxy* proxy,
+ vtkSMProperty* prop,
+ QWidget* parent = nullptr
+ );
+
+
+ //- Destructor
+ virtual ~pqShowPointNumbersProperty();
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/vtkPVblockMeshReader.cxx b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/vtkPVblockMeshReader.cxx
index 6d559e7a33..2ff68b27b7 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/vtkPVblockMeshReader.cxx
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/vtkPVblockMeshReader.cxx
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -59,7 +59,7 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
FileName = nullptr;
foamData_ = nullptr;
- ShowPointNumbers = 1;
+ ShowPointNumbers = true;
BlockSelection = vtkDataArraySelection::New();
CurvedEdgesSelection = vtkDataArraySelection::New();
@@ -92,7 +92,7 @@ vtkPVblockMeshReader::vtkPVblockMeshReader()
vtkPVblockMeshReader::~vtkPVblockMeshReader()
{
- vtkDebugMacro(<<"Deconstructor");
+ vtkDebugMacro(<<"Destructor");
if (foamData_)
{
@@ -106,8 +106,8 @@ vtkPVblockMeshReader::~vtkPVblockMeshReader()
delete [] FileName;
}
- BlockSelection->RemoveObserver(this->SelectionObserver);
- CurvedEdgesSelection->RemoveObserver(this->SelectionObserver);
+ BlockSelection->RemoveAllObservers();
+ CurvedEdgesSelection->RemoveAllObservers();
SelectionObserver->Delete();
BlockSelection->Delete();
@@ -218,7 +218,7 @@ int vtkPVblockMeshReader::RequestData
}
-void vtkPVblockMeshReader::SetRefresh(int val)
+void vtkPVblockMeshReader::SetRefresh(bool val)
{
// Delete the current blockMesh to force re-read and update
if (foamData_)
@@ -232,7 +232,7 @@ void vtkPVblockMeshReader::SetRefresh(int val)
}
-void vtkPVblockMeshReader::SetShowPointNumbers(const int val)
+void vtkPVblockMeshReader::SetShowPointNumbers(bool val)
{
if (ShowPointNumbers != val)
{
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/vtkPVblockMeshReader.h b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/vtkPVblockMeshReader.h
index b160b7c035..92a02e7ebd 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/vtkPVblockMeshReader.h
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/PVblockMeshReader/vtkPVblockMeshReader.h
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -73,12 +73,12 @@ public:
// Description:
// Display corner point labels
- virtual void SetShowPointNumbers(int);
- vtkGetMacro(ShowPointNumbers, int);
+ virtual void SetShowPointNumbers(bool);
+ vtkGetMacro(ShowPointNumbers, bool);
// Description:
// Refresh blockMesh from changes to blockMeshDict
- virtual void SetRefresh(int);
+ virtual void SetRefresh(bool);
// Description:
// Blocks selection list control
@@ -144,25 +144,23 @@ protected:
private:
//- Disallow default bitwise copy construct
- vtkPVblockMeshReader(const vtkPVblockMeshReader&);
+ vtkPVblockMeshReader(const vtkPVblockMeshReader&) = delete;
//- Disallow default bitwise assignment
- void operator=(const vtkPVblockMeshReader&);
+ void operator=(const vtkPVblockMeshReader&) = delete;
//- Add/remove point numbers to/from the view
void updatePointNumbersView(const bool show);
//- Show Point Numbers
- int ShowPointNumbers;
+ bool ShowPointNumbers;
vtkDataArraySelection* BlockSelection;
vtkDataArraySelection* CurvedEdgesSelection;
- //BTX
Foam::vtkPVblockMesh* foamData_;
- //ETX
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C
index dd40c8e359..c4b5e9c6e5 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -63,13 +63,15 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
vtkDataArraySelection* arraySelection
)
{
+ arrayRange& range = arrayRangeBlocks_;
+
if (debug)
{
Info<< " Foam::vtkPVblockMesh::updateInfoBlocks"
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
- arrayRangeBlocks_.reset( arraySelection->GetNumberOfArrays() );
+ range.reset(arraySelection->GetNumberOfArrays());
const blockMesh& blkMesh = *meshPtr_;
@@ -80,21 +82,20 @@ void Foam::vtkPVblockMesh::updateInfoBlocks
// Display either blockI as a number or with its name
// (looked up from blockMeshDict)
- OStringStream os;
- blockDescriptor::write(os, blockI, blkMesh.meshDict());
- word partName(os.str());
+ OStringStream ostr;
+ blockDescriptor::write(ostr, blockI, blkMesh.meshDict());
// append the (optional) zone name
if (!blockDef.zoneName().empty())
{
- partName += " - " + blockDef.zoneName();
+ ostr << " - " << blockDef.zoneName();
}
- // Add blockId and zoneName to GUI list
- arraySelection->AddArray(partName.c_str());
+ // Add "blockId" or "blockId - zoneName" to GUI list
+ arraySelection->AddArray(ostr.str().c_str());
}
- arrayRangeBlocks_ += nBlocks;
+ range += nBlocks;
if (debug)
{
@@ -111,18 +112,19 @@ void Foam::vtkPVblockMesh::updateInfoEdges
vtkDataArraySelection* arraySelection
)
{
+ arrayRange& range = arrayRangeEdges_;
+
if (debug)
{
Info<< " Foam::vtkPVblockMesh::updateInfoEdges"
<< " [meshPtr=" << (meshPtr_ ? "set" : "nullptr") << "]" << endl;
}
- arrayRangeEdges_.reset( arraySelection->GetNumberOfArrays() );
+ range.reset(arraySelection->GetNumberOfArrays());
const blockMesh& blkMesh = *meshPtr_;
const blockEdgeList& edges = blkMesh.edges();
- const int nEdges = edges.size();
forAll(edges, edgeI)
{
OStringStream ostr;
@@ -135,7 +137,7 @@ void Foam::vtkPVblockMesh::updateInfoEdges
arraySelection->AddArray(ostr.str().c_str());
}
- arrayRangeEdges_ += nEdges;
+ range += edges.size();
if (debug)
{
@@ -281,18 +283,14 @@ void Foam::vtkPVblockMesh::updateInfo()
resetCounters();
vtkDataArraySelection* blockSelection = reader_->GetBlockSelection();
- vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection();
+ vtkDataArraySelection* edgeSelection = reader_->GetCurvedEdgesSelection();
// enable 'internalMesh' on the first call
// or preserve the enabled selections
stringList enabledParts;
stringList enabledEdges;
- bool firstTime = false;
- if (!blockSelection->GetNumberOfArrays() && !meshPtr_)
- {
- firstTime = true;
- }
- else
+ const bool firstTime = (!blockSelection->GetNumberOfArrays() && !meshPtr_);
+ if (!firstTime)
{
enabledParts = getSelectedArrayEntries(blockSelection);
enabledEdges = getSelectedArrayEntries(edgeSelection);
@@ -306,10 +304,10 @@ void Foam::vtkPVblockMesh::updateInfo()
updateFoamMesh();
// Update mesh parts list
- updateInfoBlocks( blockSelection );
+ updateInfoBlocks(blockSelection);
// Update curved edges list
- updateInfoEdges( edgeSelection );
+ updateInfoEdges(edgeSelection);
// restore the enabled selections
if (!firstTime)
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.H b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.H
index dc502926f4..abaa705f13 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.H
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMesh.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -41,18 +41,11 @@ SourceFiles
#ifndef vtkPVblockMesh_H
#define vtkPVblockMesh_H
-// do not include legacy strstream headers
-#ifndef VTK_EXCLUDE_STRSTREAM_HEADERS
-# define VTK_EXCLUDE_STRSTREAM_HEADERS
-#endif
-
#include "className.H"
#include "fileName.H"
#include "stringList.H"
#include "wordList.H"
-#include "primitivePatch.H"
-
// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * //
class vtkDataArraySelection;
@@ -198,6 +191,7 @@ class vtkPVblockMesh
//- List of point numbers for rendering to window
List pointNumberTextActorsPtrs_;
+
// Private Member Functions
// Convenience method use to convert the readers from VTK 5
@@ -211,23 +205,6 @@ class vtkPVblockMesh
const std::string& datasetName
);
- // Convenience method use to convert the readers from VTK 5
- // multiblock API to the current composite data infrastructure
- static vtkDataSet* GetDataSetFromBlock
- (
- vtkMultiBlockDataSet* output,
- const arrayRange&,
- const label datasetNo
- );
-
- // Convenience method use to convert the readers from VTK 5
- // multiblock API to the current composite data infrastructure
- static label GetNumberOfDataSets
- (
- vtkMultiBlockDataSet* output,
- const arrayRange&
- );
-
//- Update boolList from GUI selection
static void updateBoolListStatus
(
@@ -294,10 +271,10 @@ class vtkPVblockMesh
//- Disallow default bitwise copy construct
- vtkPVblockMesh(const vtkPVblockMesh&);
+ vtkPVblockMesh(const vtkPVblockMesh&) = delete;
//- Disallow default bitwise assignment
- void operator=(const vtkPVblockMesh&);
+ void operator=(const vtkPVblockMesh&) = delete;
public:
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C
index 9c7f8a06ba..09df113f0e 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshConvert.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -52,7 +52,7 @@ void Foam::vtkPVblockMesh::convertMeshBlocks
vtkDataArraySelection* selection = reader_->GetBlockSelection();
arrayRange& range = arrayRangeBlocks_;
range.block(blockNo); // set output block
- label datasetNo = 0; // restart at dataset 0
+ label datasetNo = 0; // restart at dataset 0
const blockMesh& blkMesh = *meshPtr_;
const Foam::pointField& blockPoints = blkMesh.vertices();
@@ -234,7 +234,6 @@ void Foam::vtkPVblockMesh::convertMeshEdges
}
}
-
// anything added?
if (datasetNo)
{
@@ -286,7 +285,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
scaleFactor
);
- vtkcells->InsertNextCell(1, &pointId);
+ vtkcells->InsertNextCell(1, &pointId); // VTK_VERTEX
pointId++;
}
@@ -296,11 +295,7 @@ void Foam::vtkPVblockMesh::convertMeshCorners
vtkmesh->SetVerts(vtkcells);
vtkcells->Delete();
- AddToBlock
- (
- output, vtkmesh, range, datasetNo,
- arrayRangeCorners_.name()
- );
+ AddToBlock(output, vtkmesh, range, datasetNo, range.name());
vtkmesh->Delete();
datasetNo++;
diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshUtils.C b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshUtils.C
index a838c5b602..92602737b9 100644
--- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshUtils.C
+++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/vtkPVblockMesh/vtkPVblockMeshUtils.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -126,47 +126,6 @@ void Foam::vtkPVblockMesh::AddToBlock
}
-vtkDataSet* Foam::vtkPVblockMesh::GetDataSetFromBlock
-(
- vtkMultiBlockDataSet* output,
- const arrayRange& range,
- const label datasetNo
-)
-{
- const int blockNo = range.block();
-
- vtkDataObject* blockDO = output->GetBlock(blockNo);
- vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
-
- if (block)
- {
- return vtkDataSet::SafeDownCast(block->GetBlock(datasetNo));
- }
-
- return 0;
-}
-
-
-// ununsed at the moment
-Foam::label Foam::vtkPVblockMesh::GetNumberOfDataSets
-(
- vtkMultiBlockDataSet* output,
- const arrayRange& range
-)
-{
- const int blockNo = range.block();
-
- vtkDataObject* blockDO = output->GetBlock(blockNo);
- vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(blockDO);
- if (block)
- {
- return block->GetNumberOfBlocks();
- }
-
- return 0;
-}
-
-
Foam::wordHashSet Foam::vtkPVblockMesh::getSelected
(
vtkDataArraySelection* select