Commit b4dabc0b authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

ComparativeRenderView now works.

To avoid update-self properties, we came up with a vtk-object for the
comparative view that simply uses the proxies directly.
parent 4bf7a8bd
......@@ -48,7 +48,7 @@ QT4_WRAP_CPP(MOC_BUILT_SOURCES
pqColorButtonEventTranslator.h
pqCommandServerStartup.h
# pqComparativeContextView.h
# pqComparativeRenderView.h
pqComparativeRenderView.h
# pqComparativeXYBarChartView.h
# pqComparativeXYChartView.h
pqCoreTestUtility.h
......@@ -191,6 +191,8 @@ ADD_LIBRARY(pqCore
pqColorButtonEventTranslator.h
pqCommandServerStartup.cxx
pqCommandServerStartup.h
pqComparativeRenderView.cxx
pqComparativeRenderView.h
pqContextView.cxx
pqContextView.h
pqCoreExport.h
......@@ -376,8 +378,6 @@ ADD_LIBRARY(pqCore
#ADD_LIBRARY(pqCore_old
# pqComparativeContextView.cxx
# pqComparativeContextView.h
# pqComparativeRenderView.cxx
# pqComparativeRenderView.h
# pqComparativeXYBarChartView.cxx
# pqComparativeXYBarChartView.h
# pqComparativeXYChartView.cxx
......
......@@ -187,8 +187,8 @@ void pqComparativeRenderView::onComparativeVisLayoutChanged()
// Now layout the views.
int dimensions[2];
compView->GetDimensions(dimensions);
if (compView->GetOverlayAllComparisons())
vtkSMPropertyHelper(compView, "Dimensions").Get(dimensions, 2);
if (vtkSMPropertyHelper(compView, "OverlayAllComparisons").GetAsInt() !=0)
{
dimensions[0] = dimensions[1] = 1;
}
......@@ -249,11 +249,12 @@ vtkImageData* pqComparativeRenderView::captureImage(int magnification)
// Get the collection of view proxies
int dimensions[2];
vtkCollection* currentViews = vtkCollection::New();
this->getComparativeRenderViewProxy()->GetViews(currentViews);
this->getComparativeRenderViewProxy()->GetDimensions(dimensions);
vtkSMComparativeViewProxy* compView = this->getComparativeRenderViewProxy();
if (this->getComparativeRenderViewProxy()->GetOverlayAllComparisons())
vtkCollection* currentViews = vtkCollection::New();
compView->GetViews(currentViews);
vtkSMPropertyHelper( compView, "Dimensions").Get(dimensions, 2);
if (vtkSMPropertyHelper(compView, "OverlayAllComparisons").GetAsInt() !=0)
{
dimensions[0] = dimensions[1] = 1;
}
......
......@@ -72,8 +72,8 @@ QStringList pqStandardViewModules::viewTypes() const
// pqScatterPlotView::scatterPlotViewType() <<
pqXYChartView::XYChartViewType() <<
pqXYBarChartView::XYBarChartViewType() <<
#ifdef FIXME_COLLABORATION
pqComparativeRenderView::comparativeRenderViewType() <<
#ifdef FIXME_COLLABORATION
pqComparativeXYChartView::chartViewType() <<
pqComparativeXYBarChartView::chartViewType() <<
#endif
......@@ -98,11 +98,11 @@ QString pqStandardViewModules::viewTypeName(const QString& type) const
{
return pqTableView::tableTypeName();
}
#ifdef FIXME_COLLABORATION
else if (type == pqComparativeRenderView::comparativeRenderViewType())
{
return pqComparativeRenderView::comparativeRenderViewTypeName();
}
#ifdef FIXME_COLLABORATION
else if (type == pqComparativeXYBarChartView::chartViewType())
{
return pqComparativeXYBarChartView::chartViewTypeName();
......@@ -154,11 +154,11 @@ vtkSMProxy* pqStandardViewModules::createViewProxy(const QString& viewtype,
{
root_xmlname = "RenderView";
}
#ifdef FIXME_COLLABORATION
else if(viewtype == pqComparativeRenderView::comparativeRenderViewType())
{
root_xmlname = "ComparativeRenderView";
}
#ifdef FIXME_COLLABORATION
else if(viewtype == pqComparativeXYBarChartView::chartViewType())
{
root_xmlname = "ComparativeXYBarChartView";
......@@ -246,13 +246,13 @@ pqView* pqStandardViewModules::createView(const QString& viewtype,
group, viewname, vtkSMComparativeViewProxy::SafeDownCast(viewmodule),
server, p);
}
#endif
else if (viewmodule->IsA("vtkSMComparativeViewProxy"))
{
// Handle the other comparative render views.
return new pqComparativeRenderView(
group, viewname, viewmodule, server, p);
}
#endif
// else if (viewmodule->IsA("vtkSMScatterPlotViewProxy"))
// {
// return new pqScatterPlotView(
......
......@@ -47,6 +47,7 @@ SET (Kit_SRCS
vtkPMVectorProperty.cxx
vtkPMWriterProxy.cxx
vtkPVKeyFrameAnimationCueForProxies.cxx
vtkPVComparativeView.cxx
# --- SM Objects ---
vtkSMAnimationScene.cxx
vtkSMAnimationSceneImageWriter.cxx
......@@ -57,6 +58,7 @@ SET (Kit_SRCS
vtkSMCameraLink.cxx
vtkSMCameraProxy.cxx
vtkSMChartRepresentationProxy.cxx
vtkSMComparativeViewProxy.cxx
vtkSMCompoundProxyDefinitionLoader.cxx
vtkSMCompoundSourceProxy.cxx
vtkSMCompoundSourceProxyDefinitionBuilder.cxx
......@@ -195,7 +197,6 @@ SET(Kit_SRCS
## Comparative view +++++++++
vtkSMComparativeAnimationCueProxy.cxx
vtkSMComparativeViewProxy.cxx
## Charts stuff +++++++++++++
vtkSMContextArraysInformationHelper.cxx #---- SM Side only, not managed yet...
......
......@@ -4068,12 +4068,11 @@
<ProxyGroup name="views">
<!-- ================================================================== -->
<Proxy name="ComparativeViewBase" processes="client|renderserver|dataserver">
<Proxy name="ComparativeViewBase">
<DoubleVectorProperty name="ViewTime"
command="SetViewTime"
number_of_elements="1"
update_self="1"
default_values="none">
<DoubleRangeDomain name="range"/>
<Documentation>
......@@ -4104,7 +4103,6 @@
</IntVectorProperty>
<IntVectorProperty name="ViewPosition"
update_self="1"
command="SetViewPosition"
number_of_elements="2"
default_values="0 0">
......@@ -4115,7 +4113,6 @@
<IntVectorProperty name="ViewSize"
command="SetViewSize"
update_self="1"
number_of_elements="2"
default_values="400 400" >
<Documentation>
......@@ -4125,8 +4122,6 @@
<IntVectorProperty name="Dimensions"
command="Build"
update_self="1"
immediate_update="1"
number_of_elements="2"
default_values="2 2">
<IntRangeDomain name="range" min="1 1" max="10 10" />
......@@ -4134,7 +4129,6 @@
<IntVectorProperty name="OverlayAllComparisons"
command="SetOverlayAllComparisons"
update_self="1"
number_of_elements="1"
default_values="0">
<BooleanDomain name="bool" />
......@@ -4142,7 +4136,6 @@
<IntVectorProperty name="Spacing"
command="SetSpacing"
update_self="1"
number_of_elements="2"
default_values="1 1">
<IntRangeDomain name="range" min="0 0" max="10 10" />
......@@ -4151,7 +4144,7 @@
<ProxyProperty name="Representations"
command="AddRepresentation"
remove_command="RemoveRepresentation"
update_self="1"
argument_type="SMProxy"
repeatable="1">
<Documentation>
Representations in this view.
......@@ -4161,7 +4154,7 @@
<ProxyProperty name="Cues"
command="AddCue"
remove_command="RemoveCue"
update_self="1">
argument_type="SMProxy">
<Documentation>
Animation cues for changing parameters.
</Documentation>
......@@ -4170,7 +4163,8 @@
<!-- ================================================================== -->
<ComparativeViewProxy name="ComparativeRenderView"
base_proxygroup="views" base_proxyname="ComparativeViewBase">
base_proxygroup="views" base_proxyname="ComparativeViewBase"
class="vtkPVComparativeView" >
<Documentation>
The is comparative view comprising of individual "RenderView" proxies
for each panel in the comparative view grid.
......@@ -4247,7 +4241,8 @@
<!-- ================================================================== -->
<ComparativeViewProxy name="ComparativeXYChartView"
base_proxygroup="views" base_proxyname="ComparativeViewBase">
base_proxygroup="views" base_proxyname="ComparativeViewBase"
class="vtkPVComparativeView" >
<Documentation>
The is comparative view comprising of individual "XYChartView" proxies
for each panel in the comparative view grid.
......@@ -4286,7 +4281,8 @@
<!-- ================================================================== -->
<ComparativeViewProxy name="ComparativeXYBarChartView"
base_proxygroup="views" base_proxyname="ComparativeViewBase">
base_proxygroup="views" base_proxyname="ComparativeViewBase"
class="vtkPVComparativeView" >
<Documentation>
The is comparative view comprising of individual "XYBarChartView" proxies
for each panel in the comparative view grid.
......
This diff is collapsed.
/*=========================================================================
Program: ParaView
Module: vtkPVComparativeView.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPVComparativeView - view for comparative visualization/
// film-strips.
// .SECTION Description
// vtkPVComparativeView is the view used to generate/view comparative
// visualizations/film-strips. This is not a proxy
#ifndef __vtkPVComparativeView_h
#define __vtkPVComparativeView_h
#include "vtkObject.h"
class vtkCollection;
class vtkSMComparativeAnimationCueProxy;
class vtkSMRepresentationProxy;
class vtkSMViewProxy;
class VTK_EXPORT vtkPVComparativeView : public vtkObject
{
public:
static vtkPVComparativeView* New();
vtkTypeMacro(vtkPVComparativeView, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Provides empty handlers to simulate the vtkPVView API.
void Initialize(unsigned int) {};
// Description:
// Call StillRender() on the root view.
void StillRender();
// Description:
// Call InteractiveRender() on the root view.
void InteractiveRender();
// Description:
// Initialize the vtkPVComparativeView giving the root view proxy to be used
// to create the comparative views.
void Initialize(vtkSMViewProxy* rootView);
// Description:
// Builds the MxN views. This method simply creates the MxN internal view modules.
// It does not generate the visualization i.e. play the animation scene(s).
// This method does nothing unless the dimensions have changed, in which case
// it creates new internal view modules (or destroys extra ones). Note that
// the it's the responsibility of the application to lay the views out so that
// they form a MxN grid.
void Build(int dx, int dy);
// Description:
// When set to true, all comparisons are shown in the same view. Otherwise,
// they are tiled in separate views.
void SetOverlayAllComparisons(bool);
vtkGetMacro(OverlayAllComparisons, bool);
// Description:
// Returns the dimensions used by the most recent Build() request.
vtkGetVector2Macro(Dimensions, int);
// Description:
// Adds a representation proxy to this view.
void AddRepresentation(vtkSMRepresentationProxy*);
// Description:
// Removes a representation proxy from this view.
void RemoveRepresentation(vtkSMRepresentationProxy*);
// Description:
// Removes all added representations from this view.
// Simply calls RemoveRepresentation() on all added representations
// one by one.
void RemoveAllRepresentations();
// Description:
// Updates the data pipelines for all visible representations.
void Update();
// Description:
// Get all the internal views. The views should only be used to be layed out
// by the GUI. It's not recommended to directly change the properties of the
// views.
void GetViews(vtkCollection* collection);
// Description:
// Get all internal vtkSMRepresentations for a given view. If the given
// view is not managed by this comparative view it will be ignored. The
// representations should only be used by the GUI for creating representation
// clones. It is not recommended to directly change the properties of the returned
// representations.
void GetRepresentationsForView(vtkSMViewProxy*, vtkCollection*);
void GetRepresentations(int x, int y, vtkCollection*);
// Description:
// Returns the root view proxy.
vtkGetObjectMacro(RootView, vtkSMViewProxy);
// Description:
// ViewSize, ViewPosition need to split up among all the component
// views correctly.
void SetViewSize(int x, int y)
{
this->ViewSize[0] = x;
this->ViewSize[1] = y;
this->UpdateViewLayout();
}
// Description:
// ViewSize, ViewPosition need to split up among all the component
// views correctly.
void SetViewPosition(int x, int y)
{
this->ViewPosition[0] = x;
this->ViewPosition[1] = y;
this->UpdateViewLayout();
}
// Description:
// Set spacing between views.
vtkSetVector2Macro(Spacing, int);
vtkGetVector2Macro(Spacing, int);
//BTX
// Description:
// Add/Remove parameter cues.
void AddCue(vtkSMComparativeAnimationCueProxy*);
void RemoveCue(vtkSMComparativeAnimationCueProxy*);
//ETX
// Description:
// Get/Set the view time.
vtkSetMacro(ViewTime, double);
vtkGetMacro(ViewTime, double);
// Description:
// Marks the view dirty i.e. on next Update() it needs to regenerate the
// comparative vis by replaying the animation(s).
void MarkOutdated()
{ this->Outdated=true; }
//BTX
protected:
vtkPVComparativeView();
~vtkPVComparativeView();
// Description:
// Creates and appends a new internal view.
// This not only creates a new view but also new copies of representations
// for all the representations in the view and adds them to the new view.
void AddNewView();
// Description:
// Removes an internal view and all the representations in that view.
void RemoveView(vtkSMViewProxy* remove);
// Description:
// Update layout for internal views.
void UpdateViewLayout();
// Description:
// Update all representations belonging for the indicated position.
void UpdateAllRepresentations(int x, int y);
void ClearDataCaches();
int Dimensions[2];
int ViewSize[2];
int ViewPosition[2];
int Spacing[2];
double ViewTime;
bool OverlayAllComparisons;
bool Outdated;
void SetRootView(vtkSMViewProxy*);
vtkSMViewProxy* RootView;
private:
vtkPVComparativeView(const vtkPVComparativeView&); // Not implemented
void operator=(const vtkPVComparativeView&); // Not implemented
class vtkInternal;
vtkInternal* Internal;
vtkCommand* MarkOutdatedObserver;
//ETX
};
#endif
......@@ -16,14 +16,16 @@
// film-strips.
// .SECTION Description
// vtkSMComparativeViewProxy is the view used to generate/view comparative
// visualizations/film-strips.
// visualizations/film-strips. vtkSMComparativeViewProxy works together with
// vtkPVComparativeView -- the vtk-object for which this represents the proxy.
// vtkPVComparativeView is a client-side VTK object which literally uses the
// view and representation proxies to simulate the comparative view. Refer to
// vtkPVComparativeView for details.
#ifndef __vtkSMComparativeViewProxy_h
#define __vtkSMComparativeViewProxy_h
#include "vtkSMViewProxy.h"
class vtkSMComparativeAnimationCueProxy;
class vtkCollection;
class VTK_EXPORT vtkSMComparativeViewProxy : public vtkSMViewProxy
......@@ -33,37 +35,6 @@ public:
vtkTypeMacro(vtkSMComparativeViewProxy, vtkSMViewProxy);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Builds the MxN views. This method simply creates the MxN internal view modules.
// It does not generate the visualization i.e. play the animation scene(s).
// This method does nothing unless the dimensions have changed, in which case
// it creates new internal view modules (or destroys extra ones). Note that
// the it's the responsibility of the application to lay the views out so that
// they form a MxN grid.
void Build(int dx, int dy);
// Description:
void SetOverlayAllComparisons(bool);
vtkGetMacro(OverlayAllComparisons, bool);
// Description:
// Returns the dimensions used by the most recent Build() request.
vtkGetVector2Macro(Dimensions, int);
// Description:
// Adds a representation proxy to this view.
virtual void AddRepresentation(vtkSMRepresentationProxy*);
// Description:
// Removes a representation proxy from this view.
virtual void RemoveRepresentation(vtkSMRepresentationProxy*);
// Description:
// Removes all added representations from this view.
// Simply calls RemoveRepresentation() on all added representations
// one by one.
virtual void RemoveAllRepresentations();
// Description:
// Updates the data pipelines for all visible representations.
virtual void Update();
......@@ -93,47 +64,11 @@ public:
// Returns the root view proxy.
vtkSMViewProxy* GetRootView();
// Description:
// ViewSize, ViewPosition need to split up among all the component
// views correctly.
virtual void SetViewSize(int x, int y)
{
this->ViewSize[0] = x;
this->ViewSize[1] = y;
this->UpdateViewLayout();
}
// Description:
// ViewSize, ViewPosition need to split up among all the component
// views correctly.
virtual void SetViewPosition(int x, int y)
{
this->ViewPosition[0] = x;
this->ViewPosition[1] = y;
this->UpdateViewLayout();
}
// Description:
// Set spacing between views.
vtkSetVector2Macro(Spacing, int);
vtkGetVector2Macro(Spacing, int);
// Description:
// Add/Remove parameter cues.
void AddCue(vtkSMComparativeAnimationCueProxy*);
void RemoveCue(vtkSMComparativeAnimationCueProxy*);
// Description:
// Dirty means this algorithm will execute during next update.
// This all marks all consumers as dirty.
virtual void MarkDirty(vtkSMProxy* modifiedProxy);
// Description:
// Get/Set the view time.
vtkSetMacro(ViewTime, double);
vtkGetMacro(ViewTime, double);
//BTX
protected:
vtkSMComparativeViewProxy();
~vtkSMComparativeViewProxy();
......@@ -141,56 +76,9 @@ protected:
// Description:
virtual void CreateVTKObjects();
// Description:
// Creates and appends a new internal view.
// This not only creates a new view but also new copies of representations
// for all the representations in the view and adds them to the new view.
void AddNewView();
// Description:
// Removes an internal view and all the representations in that view.
void RemoveView(vtkSMViewProxy* remove);
// Description:
// Passes on the render request to the root view.
virtual void PostRender(bool interactive);
// Description:
// Update layout for internal views.
void UpdateViewLayout();
// Description:
// Update all representations belonging for the indicated position.
void UpdateAllRepresentations(int x, int y);
// Description:
// Marks the view dirty i.e. on next StillRender it needs to regenerate the
// comparative vis by replaying the animation(s).
void MarkOutdated()
{ this->Outdated=true; }
void ClearDataCaches();
int Dimensions[2];
int ViewSize[2];
int ViewPosition[2];
int Spacing[2];
double ViewTime;
bool OverlayAllComparisons;
bool Outdated;
private:
vtkSMComparativeViewProxy(const vtkSMComparativeViewProxy&); // Not implemented
void operator=(const vtkSMComparativeViewProxy&); // Not implemented
class vtkInternal;
vtkInternal* Internal;
vtkCommand* MarkOutdatedObserver;
//ETX
};
#endif
......@@ -79,7 +79,7 @@ private:
void ViewTimeChanged();
friend class vtkSMViewProxy;
friend class vtkSMComparativeViewProxy;
friend class vtkPVComparativeView;
void ClearMarkedModified() { this->MarkedModified = false; }
bool MarkedModified;
//ETX
......
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