Commit 4f5cc67d authored by Kyle Lutz's avatar Kyle Lutz Committed by Marcus D. Hanwell
Browse files

Add scatter plot matrix support

This adds a new representation for scatter plot
matrices in ParaView.

Change-Id: I5df9ff020161aa98714e1f98ecfae9657aa657d9
parent 5e4ce168
......@@ -77,6 +77,8 @@ SET (Kit_SRCS
vtkPVOptionsXMLParser.cxx
vtkPVParallelCoordinatesChartView.cxx
vtkPVParallelCoordinatesRepresentation.cxx
vtkPVPlotMatrixView.cxx
vtkPVPlotMatrixRepresentation.cxx
vtkPVPlugin.cxx
vtkPVPluginLoader.cxx
vtkPVPluginTracker.cxx
......
......@@ -101,7 +101,7 @@ bool vtkChartRepresentation::AddToView(vtkView* view)
this->ContextView = chartView;
if (this->Options)
{
this->Options->SetChart(chartView->GetChart());
this->Options->SetChart(vtkChart::SafeDownCast(chartView->GetContextItem()));
this->Options->SetTableVisibility(this->GetVisibility());
}
return true;
......@@ -204,12 +204,15 @@ int vtkChartRepresentation::RequestData(vtkInformation* request,
this->Options->SetTable(this->GetLocalOutput());
}
if (this->ContextView && this->ContextView->GetChart())
if (this->ContextView)
{
vtkSelection* sel = vtkSelection::SafeDownCast(
this->SelectionDeliveryFilter->GetOutputDataObject(0));
this->AnnLink->SetCurrentSelection(sel);
this->ContextView->GetChart()->SetAnnotationLink(this->AnnLink);
if(vtkChart *chart = vtkChart::SafeDownCast(this->ContextView->GetContextItem()))
{
vtkSelection* sel = vtkSelection::SafeDownCast(
this->SelectionDeliveryFilter->GetOutputDataObject(0));
this->AnnLink->SetCurrentSelection(sel);
chart->SetAnnotationLink(this->AnnLink);
}
}
return this->Superclass::RequestData(request, inputVector, outputVector);
......
......@@ -23,6 +23,7 @@
#include "vtkPVView.h"
class vtkContextView;
class vtkAbstractContextItem;
class vtkRenderWindow;
class vtkChart;
......@@ -48,8 +49,8 @@ public:
vtkGetObjectMacro(ContextView, vtkContextView);
// Description:
// Get the chart.
virtual vtkChart* GetChart()=0;
// Get the context item.
virtual vtkAbstractContextItem* GetContextItem() = 0;
// Description:
vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
......
......@@ -47,6 +47,10 @@ bool vtkPVParallelCoordinatesRepresentation::AddToView(vtkView* view)
return false;
}
std::cout << "pc table: ";
this->GetLocalOutput()->Print(std::cout);
std::cout << "num cols: " << this->GetLocalOutput()->GetNumberOfColumns() << std::endl;
if (this->GetChart())
{
// Set the table, in case it has changed.
......@@ -74,7 +78,7 @@ vtkChartParallelCoordinates* vtkPVParallelCoordinatesRepresentation::GetChart()
if (this->ContextView)
{
return vtkChartParallelCoordinates::SafeDownCast(
this->ContextView->GetChart());
this->ContextView->GetContextItem());
}
return 0;
......
/*=========================================================================
Program: ParaView
Module: pqPlotMatrixDisplayPanel.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "vtkPVPlotMatrixRepresentation.h"
#include "vtkObjectFactory.h"
#include "vtkScatterPlotMatrix.h"
#include "vtkPVContextView.h"
#include "vtkTable.h"
#include "vtkStdString.h"
vtkStandardNewMacro(vtkPVPlotMatrixRepresentation);
//----------------------------------------------------------------------------
vtkPVPlotMatrixRepresentation::vtkPVPlotMatrixRepresentation()
{
}
//----------------------------------------------------------------------------
vtkPVPlotMatrixRepresentation::~vtkPVPlotMatrixRepresentation()
{
}
//----------------------------------------------------------------------------
bool vtkPVPlotMatrixRepresentation::AddToView(vtkView *view)
{
if(!this->Superclass::AddToView(view))
{
return false;
}
if(vtkScatterPlotMatrix *plotMatrix = this->GetPlotMatrix())
{
plotMatrix->SetInput(this->GetLocalOutput());
plotMatrix->SetVisible(true);
}
return true;
}
//----------------------------------------------------------------------------
bool vtkPVPlotMatrixRepresentation::RemoveFromView(vtkView* view)
{
if(vtkScatterPlotMatrix *plotMatrix = this->GetPlotMatrix())
{
plotMatrix->SetInput(0);
plotMatrix->SetVisible(false);
}
return this->Superclass::RemoveFromView(view);
}
//----------------------------------------------------------------------------
int vtkPVPlotMatrixRepresentation::RequestData(vtkInformation *request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
if(!this->Superclass::RequestData(request, inputVector, outputVector))
{
return 0;
}
if(vtkScatterPlotMatrix *plotMatrix = this->GetPlotMatrix())
{
plotMatrix->SetInput(this->GetLocalOutput());
}
return 1;
}
//----------------------------------------------------------------------------
void vtkPVPlotMatrixRepresentation::SetVisibility(bool visible)
{
if(vtkScatterPlotMatrix *plotMatrix = this->GetPlotMatrix())
{
plotMatrix->SetVisible(visible);
}
}
//----------------------------------------------------------------------------
void vtkPVPlotMatrixRepresentation::SetSeriesVisibility(const char *name, bool visible)
{
if(vtkScatterPlotMatrix *plotMatrix = this->GetPlotMatrix())
{
plotMatrix->SetColumnVisibility(name, visible);
}
}
//----------------------------------------------------------------------------
void vtkPVPlotMatrixRepresentation::SetSeriesLabel(const char *name, const char *label)
{
}
//----------------------------------------------------------------------------
void vtkPVPlotMatrixRepresentation::PrintSelf(ostream &os, vtkIndent indent)
{
}
//----------------------------------------------------------------------------
vtkScatterPlotMatrix* vtkPVPlotMatrixRepresentation::GetPlotMatrix() const
{
if(this->ContextView)
{
return vtkScatterPlotMatrix::SafeDownCast(this->ContextView->GetContextItem());
}
return 0;
}
/*=========================================================================
Program: ParaView
Module: pqPlotMatrixDisplayPanel.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#ifndef _vtkPVPlotMatrixRepresentation_h
#define _vtkPVPlotMatrixRepresentation_h
#include "vtkChartRepresentation.h"
class vtkScatterPlotMatrix;
class VTK_EXPORT vtkPVPlotMatrixRepresentation : public vtkChartRepresentation
{
public:
static vtkPVPlotMatrixRepresentation* New();
vtkTypeMacro(vtkPVPlotMatrixRepresentation, vtkChartRepresentation);
void PrintSelf(ostream &os, vtkIndent indent);
// Description:
// Sets the visibility for the plot matrix representation.
virtual void SetVisibility(bool visible);
// Description:
// Sets the visibility for the series in the plot matrix.
void SetSeriesVisibility(const char *name, bool visible);
// Description:
// Sets the label for the series in the plot matrix.
void SetSeriesLabel(const char *name, const char *label);
// Description:
// Returns the scatter plot matrix.
vtkScatterPlotMatrix* GetPlotMatrix() const;
protected:
vtkPVPlotMatrixRepresentation();
~vtkPVPlotMatrixRepresentation();
virtual int RequestData(vtkInformation *,
vtkInformationVector **,
vtkInformationVector *);
// Description:
// Add the plot matrix representation to the view.
virtual bool AddToView(vtkView *view);
// Description:
// Remove the plot matrix representation from the view.
virtual bool RemoveFromView(vtkView *view);
};
#endif
/*=========================================================================
Program: ParaView
Module: vtkPVPlotMatrixView.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.
=========================================================================*/
#include "vtkPVPlotMatrixView.h"
#include "vtkObjectFactory.h"
#include "vtkScatterPlotMatrix.h"
#include "vtkContextView.h"
#include "vtkContextScene.h"
vtkStandardNewMacro(vtkPVPlotMatrixView);
//----------------------------------------------------------------------------
vtkPVPlotMatrixView::vtkPVPlotMatrixView()
{
this->PlotMatrix = vtkScatterPlotMatrix::New();
this->ContextView->GetScene()->AddItem(this->PlotMatrix);
}
//----------------------------------------------------------------------------
vtkPVPlotMatrixView::~vtkPVPlotMatrixView()
{
this->PlotMatrix->Delete();
}
//----------------------------------------------------------------------------
void vtkPVPlotMatrixView::PrintSelf(ostream &os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
/*=========================================================================
Program: ParaView
Module: vtkPVPlotMatrixView.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.
=========================================================================*/
#ifndef __vtkPVPlotMatrixView_h
#define __vtkPVPlotMatrixView_h
#include "vtkPVContextView.h"
#include "vtkScatterPlotMatrix.h"
class VTK_EXPORT vtkPVPlotMatrixView : public vtkPVContextView
{
public:
static vtkPVPlotMatrixView* New();
vtkTypeMacro(vtkPVPlotMatrixView, vtkPVContextView);
void PrintSelf(ostream &os, vtkIndent indent);
vtkAbstractContextItem* GetContextItem() { return this->PlotMatrix; }
protected:
vtkPVPlotMatrixView();
~vtkPVPlotMatrixView();
private:
vtkPVPlotMatrixView(const vtkPVPlotMatrixView&); // Not implemented.
void operator=(const vtkPVPlotMatrixView&); // Not implemented.
vtkScatterPlotMatrix *PlotMatrix;
};
#endif
......@@ -22,7 +22,8 @@
#include "vtkPVContextView.h"
class vtkChart;
#include "vtkChart.h"
class vtkChartView;
class vtkPVPlotTime;
......@@ -233,6 +234,10 @@ public:
// Provides access to the chart view.
virtual vtkChart* GetChart();
// Description:
// Get the context item.
virtual vtkAbstractContextItem* GetContextItem() { return this->GetChart(); }
//BTX
protected:
vtkPVXYChartView();
......
......@@ -45,7 +45,7 @@ vtkChartXY* vtkXYChartRepresentation::GetChart()
{
if (this->ContextView)
{
return vtkChartXY::SafeDownCast(this->ContextView->GetChart());
return vtkChartXY::SafeDownCast(this->ContextView->GetContextItem());
}
else
{
......
......@@ -944,6 +944,18 @@
</ContextViewProxy>
<!-- ================================================================== -->
<ContextViewProxy name="PlotMatrixView"
base_proxygroup="views"
base_proxyname="ViewBase"
class="vtkPVPlotMatrixView"
processes="client|renderserver|dataserver"
representation_name="PlotMatrixRepresentation">
<Documentation>
This is the proxy for the plot matrix view.
</Documentation>
</ContextViewProxy>
<!-- ================================================================== -->
<ViewProxy name="SpreadSheetView"
base_proxygroup="views"
......@@ -3822,6 +3834,214 @@
</ParallelCoordinatesRepresentationProxy>
<!-- =================================================================== -->
<PlotMatrixRepresentationProxy name="PlotMatrixRepresentation"
class="vtkPVPlotMatrixRepresentation"
processes="client|dataserver|renderserver" >
<Documentation>
Representation used by PlotMatrixView.
</Documentation>
<InputProperty name="Input" command="SetInputConnection" >
<Documentation>
Data input for the representation.
</Documentation>
<DataTypeDomain name="input_type">
<DataType value="vtkDataObject"/>
</DataTypeDomain>
</InputProperty>
<IntVectorProperty name="Visibility"
command="SetVisibility"
number_of_elements="1"
default_values="1" >
<BooleanDomain name="bool" />
<Documentation>
Visibility of the representation.
</Documentation>
</IntVectorProperty>
<IntVectorProperty name="ForceUseCache"
command="SetForceUseCache"
is_internal="1"
number_of_elements="1"
default_values="0">
<BooleanDomain name="bool" />
<Documentation>
Typically UseCache and CacheKey are updated by the View and
representations cache based on what the view tells it. However in some
cases we may want to force a representation to cache irrespective of
the view (e.g. comparative views). In which case these ivars can up
set. If ForcedCacheKey is true, it overrides UseCache and CacheKey.
Instead, ForcedCacheKey is used.
</Documentation>
</IntVectorProperty>
<DoubleVectorProperty name="ForcedCacheKey"
command="SetForcedCacheKey"
is_internal="1"
number_of_elements="1"
default_values="none">
<DoubleRangeDomain name="range" />
<Documentation>
Typically UseCache and CacheKey are updated by the View and
representations cache based on what the view tells it. However in some
cases we may want to force a representation to cache irrespective of
the view (e.g. comparative views). In which case these ivars can up
set. If ForcedCacheKey is true, it overrides UseCache and CacheKey.
Instead, ForcedCacheKey is used.
</Documentation>
</DoubleVectorProperty>
<IntVectorProperty name="FieldAssociation"
command="SetFieldAssociation"
number_of_elements="1"
default_values="0">
<Documentation>
Select the attribute data to pass.
</Documentation>
<FieldDataDomain name="enum"
enable_field_data="1"
disable_update_domain_entries="1" >
<RequiredProperties>
<Property name="Input" function="Input"/>
</RequiredProperties>
</FieldDataDomain>
</IntVectorProperty>
<IntVectorProperty name="CompositeDataSetIndex"
command="SetCompositeDataSetIndex"
number_of_elements="1"
default_values="0">
<Documentation>
In case of Composite datasets, set the flat index of the dataset to
pass. The flat index must point to a non-empty, non-composite dataset
for anything to be passed through. If the input is not a composite
dataset, then this index is ignored.
</Documentation>
<CompositeTreeDomain name="tree" mode="leaves">
<RequiredProperties>
<Property name="Input" function="Input"/>
</RequiredProperties>
</CompositeTreeDomain>
</IntVectorProperty>
<StringVectorProperty name="SeriesVisibilityInfo"
number_of_elements_per_command="2"
repeat_command="1"
information_only="1">
<Documentation>
Property which has the current state of visibility for the series
available currently.
</Documentation>
</StringVectorProperty>
<StringVectorProperty name="SeriesVisibility"
command="SetSeriesVisibility"
number_of_elements_per_command="2"
element_types="2 0"
repeat_command="1"
information_property="SeriesVisibilityInfo" >
<Documentation>
Set the series visibility.
</Documentation>
</StringVectorProperty>
<StringVectorProperty name="LineStyleInfo"
number_of_elements_per_command="1"
information_only="1">
<Documentation>
Property which has the current state of line style for the series
available currently.
</Documentation>
</StringVectorProperty>
<StringVectorProperty name="LineStyle"
command="SetLineStyle"
number_of_elements_per_command="1"
element_types="0"
repeat_command="1"
information_property="LineStyleInfo">
<Documentation>
Set the series line style.
</Documentation>
</StringVectorProperty>
<StringVectorProperty name="SeriesLabelInfo"
number_of_elements_per_command="2"
repeat_command="1"
information_only="1">
<Documentation>
Property which has the current state of labels for the series
available currently.
</Documentation>
</StringVectorProperty>
<StringVectorProperty name="SeriesLabel"
command="SetLabel"
number_of_elements_per_command="2"
element_types="2 2"
repeat_command="1"
information_property="LabelInfo">
<Documentation>
Set the series labels.
</Documentation>