Commit 4f8b04c2 authored by Jeff Baumes's avatar Jeff Baumes

ENH: vtkViewTheme now contains lookup table internally.

This allows general lookup tables to be used in views, where
previously you could only use a fixed set of options for hue,
saturation, value, and alpha ranges.
parent 8be20c64
This diff is collapsed.
......@@ -60,15 +60,37 @@ public:
vtkGetMacro(PointOpacity, double);
// Description:
// The ranges to use in a lookup table.
vtkSetVector2Macro(PointHueRange, double);
vtkGetVector2Macro(PointHueRange, double);
vtkSetVector2Macro(PointSaturationRange, double);
vtkGetVector2Macro(PointSaturationRange, double);
vtkSetVector2Macro(PointValueRange, double);
vtkGetVector2Macro(PointValueRange, double);
vtkSetVector2Macro(PointAlphaRange, double);
vtkGetVector2Macro(PointAlphaRange, double);
// The ranges to use in the point lookup table.
// You may also do this by accessing the point lookup table directly
// with GetPointLookupTable() and calling these methods.
virtual void SetPointHueRange(double mn, double mx);
virtual void SetPointHueRange(double rng[2]);
virtual double* GetPointHueRange();
virtual void GetPointHueRange(double& mn, double& mx);
virtual void GetPointHueRange(double rng[2]);
virtual void SetPointSaturationRange(double mn, double mx);
virtual void SetPointSaturationRange(double rng[2]);
virtual double* GetPointSaturationRange();
virtual void GetPointSaturationRange(double& mn, double& mx);
virtual void GetPointSaturationRange(double rng[2]);
virtual void SetPointValueRange(double mn, double mx);
virtual void SetPointValueRange(double rng[2]);
virtual double* GetPointValueRange();
virtual void GetPointValueRange(double& mn, double& mx);
virtual void GetPointValueRange(double rng[2]);
virtual void SetPointAlphaRange(double mn, double mx);
virtual void SetPointAlphaRange(double rng[2]);
virtual double* GetPointAlphaRange();
virtual void GetPointAlphaRange(double& mn, double& mx);
virtual void GetPointAlphaRange(double rng[2]);
// Description:
// Set/Get the cell lookup table.
vtkGetObjectMacro(CellLookupTable, vtkScalarsToColors);
virtual void SetCellLookupTable(vtkScalarsToColors* lut);
// Description:
// The color and opacity of cells or edges when not mapped through
......@@ -79,15 +101,37 @@ public:
vtkGetMacro(CellOpacity, double);
// Description:
// The ranges to use in a lookup table.
vtkSetVector2Macro(CellHueRange, double);
vtkGetVector2Macro(CellHueRange, double);
vtkSetVector2Macro(CellSaturationRange, double);
vtkGetVector2Macro(CellSaturationRange, double);
vtkSetVector2Macro(CellValueRange, double);
vtkGetVector2Macro(CellValueRange, double);
vtkSetVector2Macro(CellAlphaRange, double);
vtkGetVector2Macro(CellAlphaRange, double);
// The ranges to use in the cell lookup table.
// You may also do this by accessing the cell lookup table directly
// with GetCellLookupTable() and calling these methods.
virtual void SetCellHueRange(double mn, double mx);
virtual void SetCellHueRange(double rng[2]);
virtual double* GetCellHueRange();
virtual void GetCellHueRange(double& mn, double& mx);
virtual void GetCellHueRange(double rng[2]);
virtual void SetCellSaturationRange(double mn, double mx);
virtual void SetCellSaturationRange(double rng[2]);
virtual double* GetCellSaturationRange();
virtual void GetCellSaturationRange(double& mn, double& mx);
virtual void GetCellSaturationRange(double rng[2]);
virtual void SetCellValueRange(double mn, double mx);
virtual void SetCellValueRange(double rng[2]);
virtual double* GetCellValueRange();
virtual void GetCellValueRange(double& mn, double& mx);
virtual void GetCellValueRange(double rng[2]);
virtual void SetCellAlphaRange(double mn, double mx);
virtual void SetCellAlphaRange(double rng[2]);
virtual double* GetCellAlphaRange();
virtual void GetCellAlphaRange(double& mn, double& mx);
virtual void GetCellAlphaRange(double rng[2]);
// Description:
// Set/Get the point lookup table.
vtkGetObjectMacro(PointLookupTable, vtkScalarsToColors);
virtual void SetPointLookupTable(vtkScalarsToColors* lut);
// Description:
// The color of any outlines in the view.
......@@ -151,17 +195,9 @@ protected:
double PointColor[3];
double PointOpacity;
double PointHueRange[2];
double PointSaturationRange[2];
double PointValueRange[2];
double PointAlphaRange[2];
double CellColor[3];
double CellOpacity;
double CellHueRange[2];
double CellSaturationRange[2];
double CellValueRange[2];
double CellAlphaRange[2];
double OutlineColor[3];
......@@ -175,6 +211,9 @@ protected:
double VertexLabelColor[3];
double EdgeLabelColor[3];
vtkScalarsToColors* PointLookupTable;
vtkScalarsToColors* CellLookupTable;
private:
vtkViewTheme(const vtkViewTheme&); // Not implemented.
void operator=(const vtkViewTheme&); // Not implemented.
......
......@@ -42,7 +42,7 @@
#include "vtkTextProperty.h"
#include "vtkViewTheme.h"
vtkCxxRevisionMacro(vtkHierarchicalGraphPipeline, "1.10");
vtkCxxRevisionMacro(vtkHierarchicalGraphPipeline, "1.11");
vtkStandardNewMacro(vtkHierarchicalGraphPipeline);
vtkHierarchicalGraphPipeline::vtkHierarchicalGraphPipeline()
......@@ -240,18 +240,9 @@ void vtkHierarchicalGraphPipeline::ApplyViewTheme(vtkViewTheme* theme)
this->ApplyColors->SetDefaultCellOpacity(theme->GetCellOpacity());
this->ApplyColors->SetSelectedCellColor(theme->GetSelectedCellColor());
this->ApplyColors->SetSelectedCellOpacity(theme->GetSelectedCellOpacity());
vtkScalarsToColors* oldLut = this->ApplyColors->GetCellLookupTable();
if (!theme->LookupMatchesCellTheme(oldLut))
{
vtkSmartPointer<vtkLookupTable> lut =
vtkSmartPointer<vtkLookupTable>::New();
lut->SetHueRange(theme->GetCellHueRange());
lut->SetSaturationRange(theme->GetCellSaturationRange());
lut->SetValueRange(theme->GetCellValueRange());
lut->SetAlphaRange(theme->GetCellAlphaRange());
lut->Build();
this->ApplyColors->SetCellLookupTable(lut);
}
this->ApplyColors->SetCellLookupTable(theme->GetCellLookupTable());
this->TextProperty->SetColor(theme->GetEdgeLabelColor());
this->Actor->GetProperty()->SetLineWidth(theme->GetLineWidth());
}
......
......@@ -94,7 +94,7 @@
vtkCxxRevisionMacro(vtkRenderedGraphRepresentation, "1.24");
vtkCxxRevisionMacro(vtkRenderedGraphRepresentation, "1.25");
vtkStandardNewMacro(vtkRenderedGraphRepresentation);
vtkRenderedGraphRepresentation::vtkRenderedGraphRepresentation()
......@@ -1299,33 +1299,8 @@ void vtkRenderedGraphRepresentation::ApplyViewTheme(vtkViewTheme* theme)
{
this->Superclass::ApplyViewTheme(theme);
vtkLookupTable* plutOld = vtkLookupTable::SafeDownCast(
this->ApplyColors->GetPointLookupTable());
if (!theme->LookupMatchesPointTheme(plutOld))
{
vtkSmartPointer<vtkLookupTable> plut =
vtkSmartPointer<vtkLookupTable>::New();
plut->SetHueRange(theme->GetPointHueRange());
plut->SetSaturationRange(theme->GetPointSaturationRange());
plut->SetValueRange(theme->GetPointValueRange());
plut->SetAlphaRange(theme->GetPointAlphaRange());
plut->Build();
this->ApplyColors->SetPointLookupTable(plut);
}
vtkLookupTable* clutOld = vtkLookupTable::SafeDownCast(
this->ApplyColors->GetCellLookupTable());
if (!theme->LookupMatchesCellTheme(clutOld))
{
vtkSmartPointer<vtkLookupTable> clut =
vtkSmartPointer<vtkLookupTable>::New();
clut->SetHueRange(theme->GetCellHueRange());
clut->SetSaturationRange(theme->GetCellSaturationRange());
clut->SetValueRange(theme->GetCellValueRange());
clut->SetAlphaRange(theme->GetCellAlphaRange());
clut->Build();
this->ApplyColors->SetCellLookupTable(clut);
}
this->ApplyColors->SetPointLookupTable(theme->GetPointLookupTable());
this->ApplyColors->SetCellLookupTable(theme->GetCellLookupTable());
this->ApplyColors->SetDefaultPointColor(theme->GetPointColor());
this->ApplyColors->SetDefaultPointOpacity(theme->GetPointOpacity());
......
......@@ -43,7 +43,7 @@
#include "vtkTransformFilter.h"
#include "vtkViewTheme.h"
vtkCxxRevisionMacro(vtkRenderedSurfaceRepresentation, "1.5");
vtkCxxRevisionMacro(vtkRenderedSurfaceRepresentation, "1.6");
vtkStandardNewMacro(vtkRenderedSurfaceRepresentation);
//----------------------------------------------------------------------------
vtkRenderedSurfaceRepresentation::vtkRenderedSurfaceRepresentation()
......@@ -200,33 +200,8 @@ void vtkRenderedSurfaceRepresentation::ApplyViewTheme(vtkViewTheme* theme)
{
this->Superclass::ApplyViewTheme(theme);
vtkLookupTable* plutOld = vtkLookupTable::SafeDownCast(
this->ApplyColors->GetPointLookupTable());
if (!theme->LookupMatchesPointTheme(plutOld))
{
vtkSmartPointer<vtkLookupTable> plut =
vtkSmartPointer<vtkLookupTable>::New();
plut->SetHueRange(theme->GetPointHueRange());
plut->SetSaturationRange(theme->GetPointSaturationRange());
plut->SetValueRange(theme->GetPointValueRange());
plut->SetAlphaRange(theme->GetPointAlphaRange());
plut->Build();
this->ApplyColors->SetPointLookupTable(plut);
}
vtkLookupTable* clutOld = vtkLookupTable::SafeDownCast(
this->ApplyColors->GetCellLookupTable());
if (!theme->LookupMatchesCellTheme(clutOld))
{
vtkSmartPointer<vtkLookupTable> clut =
vtkSmartPointer<vtkLookupTable>::New();
clut->SetHueRange(theme->GetCellHueRange());
clut->SetSaturationRange(theme->GetCellSaturationRange());
clut->SetValueRange(theme->GetCellValueRange());
clut->SetAlphaRange(theme->GetCellAlphaRange());
clut->Build();
this->ApplyColors->SetCellLookupTable(clut);
}
this->ApplyColors->SetPointLookupTable(theme->GetPointLookupTable());
this->ApplyColors->SetCellLookupTable(theme->GetCellLookupTable());
this->ApplyColors->SetDefaultPointColor(theme->GetPointColor());
this->ApplyColors->SetDefaultPointOpacity(theme->GetPointOpacity());
......
......@@ -76,7 +76,7 @@ public:
vtkstd::vector<vtkSmartPointer<vtkHierarchicalGraphPipeline> > Graphs;
};
vtkCxxRevisionMacro(vtkRenderedTreeAreaRepresentation, "1.9");
vtkCxxRevisionMacro(vtkRenderedTreeAreaRepresentation, "1.10");
vtkStandardNewMacro(vtkRenderedTreeAreaRepresentation);
vtkRenderedTreeAreaRepresentation::vtkRenderedTreeAreaRepresentation()
......@@ -850,19 +850,7 @@ void vtkRenderedTreeAreaRepresentation::ApplyViewTheme(vtkViewTheme* theme)
{
this->Superclass::ApplyViewTheme(theme);
vtkLookupTable* plutOld = vtkLookupTable::SafeDownCast(
this->ApplyColors->GetPointLookupTable());
if (!theme->LookupMatchesPointTheme(plutOld))
{
vtkSmartPointer<vtkLookupTable> plut =
vtkSmartPointer<vtkLookupTable>::New();
plut->SetHueRange(theme->GetPointHueRange());
plut->SetSaturationRange(theme->GetPointSaturationRange());
plut->SetValueRange(theme->GetPointValueRange());
plut->SetAlphaRange(theme->GetPointAlphaRange());
plut->Build();
this->ApplyColors->SetPointLookupTable(plut);
}
this->ApplyColors->SetPointLookupTable(theme->GetPointLookupTable());
this->ApplyColors->SetDefaultPointColor(theme->GetPointColor());
this->ApplyColors->SetDefaultPointOpacity(theme->GetPointOpacity());
......
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