Commit 8be79855 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit
Browse files

Deprecate pqDisplayPolicy.

Use vtkSMParaViewPipelineController instead.
Fixes #17455.
parent 96687e1a
......@@ -36,7 +36,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqActiveObjects.h"
#include "pqAlwaysConnectedBehavior.h"
#include "pqApplicationCore.h"
#include "pqDisplayPolicy.h"
#include "pqLoadDataReaction.h"
#include "pqObjectBuilder.h"
#include "pqOutputPort.h"
......
......@@ -18,25 +18,25 @@
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
#include "pqSLACDataLoadManager.h"
#include "pqSLACManager.h"
#include "ui_pqSLACDataLoadManager.h"
#include "pqApplicationCore.h"
#include "pqDataRepresentation.h"
#include "pqDisplayPolicy.h"
#include "pqObjectBuilder.h"
#include "pqPipelineSource.h"
#include "pqSLACManager.h"
#include "pqSMAdaptor.h"
#include "pqUndoStack.h"
#include "pqView.h"
#include "vtkNew.h"
#include "vtkSMParaViewPipelineControllerWithRendering.h"
#include "vtkSMProperty.h"
#include "vtkSMSourceProxy.h"
#include <QPushButton>
#include <QtDebug>
#include "ui_pqSLACDataLoadManager.h"
class pqSLACDataLoadManager::pqUI : public Ui::pqSLACDataLoadManager
{
};
......@@ -109,7 +109,7 @@ void pqSLACDataLoadManager::setupPipeline()
{
pqApplicationCore* core = pqApplicationCore::instance();
pqObjectBuilder* builder = core->getObjectBuilder();
pqDisplayPolicy* displayPolicy = core->getDisplayPolicy();
vtkNew<vtkSMParaViewPipelineControllerWithRendering> controller;
pqSLACManager* manager = pqSLACManager::instance();
......@@ -150,11 +150,10 @@ void pqSLACDataLoadManager::setupPipeline()
->Copy(meshReaderProxy->GetProperty("PhaseShiftInfo"));
// Make representations.
pqDataRepresentation* repr;
repr = displayPolicy->setRepresentationVisibility(meshReader->getOutputPort(0), meshView, true);
repr->setVisible(true);
repr = displayPolicy->setRepresentationVisibility(meshReader->getOutputPort(1), meshView, true);
repr->setVisible(false);
controller->Show(meshReaderProxy, 0, meshView->getViewProxy());
controller->Show(meshReaderProxy, 1, meshView->getViewProxy());
controller->Hide(
meshReaderProxy, 1, meshView->getViewProxy()); // keeping what old code was doing.
// We have already made the representations and pushed everything to the
// server manager. Thus, there is no state left to be modified.
......@@ -168,9 +167,9 @@ void pqSLACDataLoadManager::setupPipeline()
builder->createReader("sources", "SLACParticleReader", particlesFiles, this->Server);
// Make representations.
pqDataRepresentation* repr =
displayPolicy->setRepresentationVisibility(particlesReader->getOutputPort(0), meshView, true);
repr->setVisible(manager->actionShowParticles()->isChecked());
controller->Show(particlesReader->getSourceProxy(), 0, meshView->getViewProxy());
controller->SetVisibility(particlesReader->getSourceProxy(), 0, meshView->getViewProxy(),
manager->actionShowParticles()->isChecked()); // keeping what old code was doing.
// We have already made the representations and pushed everything to the
// server manager. Thus, there is no state left to be modified.
......
......@@ -21,37 +21,35 @@
#include "pqSLACManager.h"
#include "pqSLACDataLoadManager.h"
#include "vtkTemporalRanges.h"
#include "vtkAlgorithm.h"
#include "vtkTable.h"
#include "vtkPVArrayInformation.h"
#include "vtkPVDataInformation.h"
#include "vtkPVDataSetAttributesInformation.h"
#include "vtkSMChartSeriesSelectionDomain.h"
#include "vtkSMPVRepresentationProxy.h"
#include "vtkSMProperty.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMProxyManager.h"
#include "vtkSMSourceProxy.h"
#include "pqActiveObjects.h"
#include "pqApplicationCore.h"
#include "pqDisplayPolicy.h"
#include "pqObjectBuilder.h"
#include "pqOutputPort.h"
#include "pqPipelineFilter.h"
#include "pqPipelineRepresentation.h"
#include "pqPipelineSource.h"
#include "pqRenderView.h"
#include "pqSLACDataLoadManager.h"
#include "pqSMAdaptor.h"
#include "pqScalarsToColors.h"
#include "pqServer.h"
#include "pqServerManagerModel.h"
#include "pqUndoStack.h"
#include "pqXYChartView.h"
#include "vtkAlgorithm.h"
#include "vtkNew.h"
#include "vtkPVArrayInformation.h"
#include "vtkPVDataInformation.h"
#include "vtkPVDataSetAttributesInformation.h"
#include "vtkSMChartSeriesSelectionDomain.h"
#include "vtkSMPVRepresentationProxy.h"
#include "vtkSMParaViewPipelineControllerWithRendering.h"
#include "vtkSMProperty.h"
#include "vtkSMPropertyHelper.h"
#include "vtkSMProxyManager.h"
#include "vtkSMSourceProxy.h"
#include "vtkTable.h"
#include "vtkTemporalRanges.h"
#include <QMainWindow>
#include <QPointer>
......@@ -724,7 +722,7 @@ void pqSLACManager::createPlotOverZ()
{
pqApplicationCore* core = pqApplicationCore::instance();
pqObjectBuilder* builder = core->getObjectBuilder();
pqDisplayPolicy* displayPolicy = core->getDisplayPolicy();
vtkNew<vtkSMParaViewPipelineControllerWithRendering> controller;
pqPipelineSource* meshReader = this->getMeshReader();
if (!meshReader)
......@@ -781,7 +779,7 @@ void pqSLACManager::createPlotOverZ()
plotFilter->updatePipeline();
// Make representation
displayPolicy->setRepresentationVisibility(plotFilter->getOutputPort(0), plotView, true);
controller->Show(plotFilter->getSourceProxy(), 0, plotView ? plotView->getViewProxy() : nullptr);
this->updatePlotField();
......
......@@ -97,6 +97,7 @@ IF (PARAVIEW_BUILD_QT_GUI)
GUI_RESOURCES SierraPlotTools.qrc
SOURCES ${HEADERS} ${MOC_SRCS} ${UI_SRCS} ${SIERRA_PLOT_TOOLS_TOOLBAR_IFACE_SRCS} ${CLIENT_SRCS}
)
target_link_libraries(${PLUGIN_NAME} LINK_PRIVATE vtkPVVTKExtensionsDefault ${qt_targets})
target_link_libraries(${PLUGIN_NAME}
LINK_PRIVATE vtkPVVTKExtensionsDefault vtkPVServerManagerRendering ${qt_targets})
ELSE ()
ENDIF ()
......@@ -31,7 +31,6 @@
#include "pqApplicationCore.h"
#include "pqDataRepresentation.h"
#include "pqDisplayPolicy.h"
#include "pqObjectBuilder.h"
#include "pqPipelineSource.h"
#include "pqSMAdaptor.h"
......
......@@ -22,23 +22,23 @@
#include "warningState.h"
#include "pqSierraPlotToolsDataLoadManager.h"
#include "pqSierraPlotToolsManager.h"
#include "vtkSMProxy.h"
#include "ui_pqSierraPlotToolsDataLoadManager.h"
#include "pqApplicationCore.h"
#include "pqDataRepresentation.h"
#include "pqDisplayPolicy.h"
#include "pqObjectBuilder.h"
#include "pqPipelineSource.h"
#include "pqSMAdaptor.h"
#include "pqSierraPlotToolsManager.h"
#include "pqUndoStack.h"
#include "pqView.h"
#include "vtkNew.h"
#include "vtkSMParaViewPipelineControllerWithRendering.h"
#include "vtkSMProxy.h"
#include <QPushButton>
#include <QtDebug>
#include "ui_pqSierraPlotToolsDataLoadManager.h"
// used to show line number in #pragma message
#define STRING2(x) #x
#define STRING(x) STRING2(x)
......@@ -103,7 +103,7 @@ void pqSierraPlotToolsDataLoadManager::setupPipeline()
pqApplicationCore* core = pqApplicationCore::instance();
pqObjectBuilder* builder = core->getObjectBuilder();
pqUndoStack* stack = core->getUndoStack();
pqDisplayPolicy* displayPolicy = core->getDisplayPolicy();
vtkNew<vtkSMParaViewPipelineControllerWithRendering> controller;
pqSierraPlotToolsManager* manager = pqSierraPlotToolsManager::instance();
......@@ -130,7 +130,7 @@ void pqSierraPlotToolsDataLoadManager::setupPipeline()
meshReaderProxy->UpdateVTKObjects();
// Make representations.
displayPolicy->setRepresentationVisibility(meshReader->getOutputPort(0), meshView, true);
controller->Show(meshReader->getSourceProxy(), 0, meshView->getViewProxy());
// We have already made the representations and pushed everything to the
// server manager. Thus, there is no state left to be modified.
......
......@@ -32,6 +32,22 @@
#include "ui_pqVariablePlot.h"
#include "pqActiveObjects.h"
#include "pqApplicationCore.h"
#include "pqObjectBuilder.h"
#include "pqOutputPort.h"
#include "pqPipelineFilter.h"
#include "pqPipelineRepresentation.h"
#include "pqPipelineSource.h"
#include "pqRenderView.h"
#include "pqSMAdaptor.h"
#include "pqScalarsToColors.h"
#include "pqServer.h"
#include "pqServerManagerModel.h"
#include "pqSetName.h"
#include "pqUndoStack.h"
#include "pqView.h"
#include "pqXYChartView.h"
#include "vtkCompositeDataIterator.h"
#include "vtkCompositeDataSet.h"
#include "vtkDataSet.h"
......@@ -39,6 +55,7 @@
#include "vtkExodusIIReader.h"
#include "vtkIdTypeArray.h"
#include "vtkMultiBlockDataSet.h"
#include "vtkNew.h"
#include "vtkPVArrayInformation.h"
#include "vtkPVCompositeDataInformation.h"
#include "vtkPVDataInformation.h"
......@@ -46,30 +63,13 @@
#include "vtkSMIdTypeVectorProperty.h"
#include "vtkSMIntVectorProperty.h"
#include "vtkSMOutputPort.h"
#include "vtkSMParaViewPipelineControllerWithRendering.h"
#include "vtkSMProperty.h"
#include "vtkSMProxy.h"
#include "vtkSMSourceProxy.h"
#include "vtkSMStringVectorProperty.h"
#include "vtkSelectionNode.h"
#include "pqActiveObjects.h"
#include "pqApplicationCore.h"
#include "pqDisplayPolicy.h"
#include "pqObjectBuilder.h"
#include "pqOutputPort.h"
#include "pqPipelineFilter.h"
#include "pqPipelineRepresentation.h"
#include "pqPipelineSource.h"
#include "pqRenderView.h"
#include "pqSMAdaptor.h"
#include "pqScalarsToColors.h"
#include "pqServer.h"
#include "pqServerManagerModel.h"
#include "pqUndoStack.h"
#include "pqView.h"
#include "pqXYChartView.h"
#include <pqSetName.h>
#include <QDockWidget>
#include <QGridLayout>
#include <QListWidget>
......@@ -1350,11 +1350,14 @@ bool pqSierraPlotToolsManager::createPlotOverTime()
pqApplicationCore* core = pqApplicationCore::instance();
pqObjectBuilder* builder = core->getObjectBuilder();
pqUndoStack* stack = core->getUndoStack();
pqDisplayPolicy* displayPolicy = core->getDisplayPolicy();
vtkNew<vtkSMParaViewPipelineControllerWithRendering> controller;
pqPipelineSource* meshReader = this->getMeshReader();
if (!meshReader)
{
return false;
}
if (stack)
stack->beginUndoSet("Plot Over time");
......@@ -1435,9 +1438,7 @@ bool pqSierraPlotToolsManager::createPlotOverTime()
//
// Make representation
//
pqDataRepresentation* repr;
repr = displayPolicy->setRepresentationVisibility(plotFilter->getOutputPort(0), plotView, true);
(void)repr;
controller->Show(plotFilter->getSourceProxy(), 0, plotView->getViewProxy());
// UpdateSelfAndAllInputs--
// Calls UpdateVTKObjects() on self and all proxies that depend on this proxy
......
......@@ -65,8 +65,6 @@ set(Module_SRCS
pqDataRepresentation.h
pqDebug.cxx
pqDebug.h
pqDisplayPolicy.cxx
pqDisplayPolicy.h
pqFileDialog.cxx
pqFileDialogEventPlayer.cxx
pqFileDialogEventPlayer.h
......@@ -240,7 +238,6 @@ set (Module_MOC_HDRS
pqCoreTestUtility.h
pqCoreUtilities.h
pqDataRepresentation.h
pqDisplayPolicy.h
pqFileDialogEventPlayer.h
pqFileDialogEventTranslator.h
pqFileDialogFavoriteModel.h
......@@ -307,6 +304,14 @@ set (Module_MOC_HDRS
pqXYChartView.h
)
if(NOT VTK_LEGACY_REMOVE)
list(APPEND Module_SRCS
pqDisplayPolicy.cxx
pqDisplayPolicy.h)
list(APPEND Module_MOC_HDRS
pqDisplayPolicy.h)
endif()
set (Module_UI_FILES
Resources/UI/pqOutputWidget.ui
Resources/UI/pqOutputWindow.ui
......
......@@ -52,7 +52,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "pqCoreInit.h"
#include "pqCoreTestUtility.h"
#include "pqCoreUtilities.h"
#include "pqDisplayPolicy.h"
#include "pqEventDispatcher.h"
#include "pqInterfaceTracker.h"
#include "pqLinksModel.h"
......@@ -91,6 +90,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkSmartPointer.h"
#if !defined(VTK_LEGACY_REMOVE)
#include "pqDisplayPolicy.h"
#include "pqOutputWindow.h"
#include "pqOutputWindowAdapter.h"
#endif
......@@ -192,8 +192,10 @@ void pqApplicationCore::constructor()
this->PluginManager = new pqPluginManager(this);
// * Create various factories.
// * Create various factories.
#if !defined(VTK_LEGACY_REMOVE)
this->DisplayPolicy = new pqDisplayPolicy(this);
#endif
this->ProgressManager = new pqProgressManager(this);
......@@ -266,10 +268,12 @@ pqApplicationCore::~pqApplicationCore()
this->HelpEngine = NULL;
#endif
// We don't call delete on these since we have already setup parent on these
// correctly so they will be deleted. It's possible that the user calls delete
// on these explicitly in which case we end up with segfaults.
// We don't call delete on these since we have already setup parent on these
// correctly so they will be deleted. It's possible that the user calls delete
// on these explicitly in which case we end up with segfaults.
#if !defined(VTK_LEGACY_REMOVE)
this->DisplayPolicy = 0;
#endif
this->UndoStack = 0;
// Delete all children, which clears up all managers etc. before the server
......@@ -335,9 +339,11 @@ void pqApplicationCore::setUndoStack(pqUndoStack* stack)
}
}
#if !defined(VTK_LEGACY_REMOVE)
//-----------------------------------------------------------------------------
void pqApplicationCore::setDisplayPolicy(pqDisplayPolicy* policy)
{
VTK_LEGACY_BODY(pqApplicationCore::setDisplayPolicy, "ParaView 5.5");
delete this->DisplayPolicy;
this->DisplayPolicy = policy;
if (policy)
......@@ -346,6 +352,14 @@ void pqApplicationCore::setDisplayPolicy(pqDisplayPolicy* policy)
}
}
//-----------------------------------------------------------------------------
pqDisplayPolicy* pqApplicationCore::getDisplayPolicy() const
{
VTK_LEGACY_BODY(pqApplicationCore::getDisplayPolicy, "ParaView 5.5");
return this->DisplayPolicy;
}
#endif // VTK_LEGACY_REMOVE
//-----------------------------------------------------------------------------
void pqApplicationCore::registerManager(const QString& function, QObject* _manager)
{
......
......@@ -37,7 +37,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QObject>
#include <QPointer>
class pqDisplayPolicy;
class pqInterfaceTracker;
class pqLinksModel;
class pqObjectBuilder;
......@@ -66,6 +65,7 @@ class vtkSMStateLoader;
#if !defined(VTK_LEGACY_REMOVE)
class pqOutputWindow;
class pqOutputWindowAdapter;
class pqDisplayPolicy;
#endif
/**
......@@ -200,7 +200,7 @@ public:
* pqDisplayPolicy defines the policy for creating representations
* for sources.
*/
pqDisplayPolicy* getDisplayPolicy() const { return this->DisplayPolicy; }
VTK_LEGACY(pqDisplayPolicy* getDisplayPolicy() const);
/**
* Returns the output window.
......@@ -210,11 +210,9 @@ public:
VTK_LEGACY(inline pqOutputWindow* outputWindow());
/**
* It is possible to change the display policy used by
* the application. Used to change the active display
* policy. The pqApplicationCore takes over the ownership of the display policy.
* @deprecated ParaView 5.5. See vtkSMParaViewPipelineControllerWithRendering.
*/
void setDisplayPolicy(pqDisplayPolicy* dp);
VTK_LEGACY(void setDisplayPolicy(pqDisplayPolicy* dp));
/**
* Provides access to the test utility.
......@@ -392,7 +390,9 @@ protected:
#endif
pqOptions* Options;
#if !defined(VTK_LEGACY_REMOVE)
pqDisplayPolicy* DisplayPolicy;
#endif
pqLinksModel* LinksModel;
pqObjectBuilder* ObjectBuilder;
pqInterfaceTracker* InterfaceTracker;
......
......@@ -58,9 +58,11 @@ pqDisplayPolicy::~pqDisplayPolicy()
}
//-----------------------------------------------------------------------------
#if !defined(VTK_LEGACY_REMOVE)
pqDataRepresentation* pqDisplayPolicy::setRepresentationVisibility(
pqOutputPort* opPort, pqView* view, bool visible) const
{
VTK_LEGACY_BODY(pqDisplayPolicy, "ParaView 5.5");
if (!opPort)
{
// Cannot really repr a NULL source.
......@@ -80,10 +82,13 @@ pqDataRepresentation* pqDisplayPolicy::setRepresentationVisibility(
return pqApplicationCore::instance()->getServerManagerModel()->findItem<pqDataRepresentation*>(
reprProxy);
}
#endif
//-----------------------------------------------------------------------------
#if !defined(VTK_LEGACY_REMOVE)
QString pqDisplayPolicy::getPreferredViewType(pqOutputPort* port, bool update_pipeline) const
{
VTK_LEGACY_BODY(pqDisplayPolicy, "ParaView 5.5");
(void)update_pipeline;
if (port)
{
......@@ -93,11 +98,14 @@ QString pqDisplayPolicy::getPreferredViewType(pqOutputPort* port, bool update_pi
}
return QString();
}
#endif
//-----------------------------------------------------------------------------
#if !defined(VTK_LEGACY_REMOVE)
pqDisplayPolicy::VisibilityState pqDisplayPolicy::getVisibility(
pqView* view, pqOutputPort* port) const
{
VTK_LEGACY_BODY(pqDisplayPolicy, "ParaView 5.5");
if (view && port)
{
vtkSMSourceProxy* source = vtkSMSourceProxy::SafeDownCast(port->getSource()->getProxy());
......@@ -137,3 +145,4 @@ pqDisplayPolicy::VisibilityState pqDisplayPolicy::getVisibility(
// Default behavior if no view is present
return Hidden;
}
#endif
......@@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define pqDisplayPolicy_h
#include "pqCoreModule.h" // Needed for PQCORE_EXPORT macro
#include "vtkSetGet.h" // needed for VTK_LEGACY
#include <QObject>
class pqDataRepresentation;
......@@ -68,8 +69,8 @@ public:
* create new views, we provide this as part of display policy which can
* be easily overridden by creating a new subclass.
*/
virtual pqDataRepresentation* setRepresentationVisibility(
pqOutputPort* opPort, pqView* view, bool visible) const;
VTK_LEGACY(virtual pqDataRepresentation* setRepresentationVisibility(
pqOutputPort* opPort, pqView* view, bool visible) const);
/**
* Returns the type for the view that is indicated as the preferred view
......@@ -78,14 +79,15 @@ public:
* If update_pipeline is set, then the pipeline will be update prior to
* fetching the data information from the port.
*/
virtual QString getPreferredViewType(pqOutputPort* opPort, bool update_pipeline) const;
VTK_LEGACY(
virtual QString getPreferredViewType(pqOutputPort* opPort, bool update_pipeline) const);
/**
* Apps can choose whether new filter outputs are hidden upon creation by
* overriding this method. The default behavior is to create a representation
* such that it obeys to the Visibility from rendering.xml.
*/
virtual bool getHideByDefault() const { return false; }
VTK_LEGACY(virtual bool getHideByDefault() const { return false; });
enum VisibilityState
{
......@@ -98,7 +100,7 @@ public:
* Returns the visibility state for port in the given view (view may be null
* for an empty view).
*/
virtual VisibilityState getVisibility(pqView* view, pqOutputPort* port) const;
VTK_LEGACY(virtual VisibilityState getVisibility(pqView* view, pqOutputPort* port) const);
private:
Q_DISABLE_COPY(pqDisplayPolicy)
......
......@@ -43,6 +43,14 @@ As part of this change, the enum values
have been moved from `vtkPVGeneralSettings.h` to `vtkSMTransferFunctionManager.h`.
###Deprecated pqDisplayPolicy###
`pqDisplayPolicy`, a class that has been unofficially deprecated since
`vtkSMParaViewPipelineControllerWithRendering` was introduced is now officially
deprecated and will be removed in future. Use
`vtkSMParaViewPipelineControllerWithRendering` to show/hide data in views
instead of `pqDisplayPolicy`.
Changes in 5.4
--------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment