Commit 0b20a7ba authored by David Thompson's avatar David Thompson Committed by Code Review

Merge topic 'broken-view-scalar-bar' into master

8ee7cfbf Initialize representation's scalar bar actors.
parents 7578ffe4 8ee7cfbf
......@@ -32,6 +32,8 @@
#include "vtkStringToNumeric.h"
#include "vtkTestUtilities.h"
#include "vtkXMLTreeReader.h"
#include "vtkScalarBarWidget.h"
#include "vtkScalarBarActor.h"
using std::string;
......@@ -1124,6 +1126,7 @@ int TestGraphLayoutView(int argc, char* argv[])
view->SetVertexColorArrayName("size");
view->ColorVerticesOn();
view->SetRepresentationFromInputConnection(numeric->GetOutputPort());
view->SetVertexScalarBarVisibility(true);
view->SetEdgeColorArrayName("distance");
view->ColorEdgesOn();
view->SetEdgeLabelArrayName("edge label");
......@@ -1131,6 +1134,9 @@ int TestGraphLayoutView(int argc, char* argv[])
vtkRenderedGraphRepresentation* rep = vtkRenderedGraphRepresentation::SafeDownCast(view->GetRepresentation());
rep->SetVertexHoverArrayName("name");
rep->SetEdgeHoverArrayName("edge label");
rep->GetVertexScalarBar()->GetScalarBarActor()->SetOrientation(VTK_ORIENT_HORIZONTAL);
rep->GetVertexScalarBar()->GetScalarBarActor()->SetPosition(0.05,0.05);
rep->GetVertexScalarBar()->GetScalarBarActor()->SetPosition2(0.55,0.15);
view->ResetCamera();
......
......@@ -537,6 +537,7 @@ void vtkRenderedGraphRepresentation::SetVertexColorArrayName(const char* name)
this->SetVertexColorArrayNameInternal(name);
this->ApplyColors->SetInputArrayToProcess(0, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_VERTICES, name);
this->VertexScalarBar->GetScalarBarActor()->SetTitle(name);
}
const char* vtkRenderedGraphRepresentation::GetVertexColorArrayName()
......@@ -559,6 +560,7 @@ void vtkRenderedGraphRepresentation::SetEdgeColorArrayName(const char* name)
this->SetEdgeColorArrayNameInternal(name);
this->ApplyColors->SetInputArrayToProcess(1, 0, 0,
vtkDataObject::FIELD_ASSOCIATION_EDGES, name);
this->EdgeScalarBar->GetScalarBarActor()->SetTitle(name);
}
const char* vtkRenderedGraphRepresentation::GetEdgeColorArrayName()
......@@ -674,6 +676,16 @@ bool vtkRenderedGraphRepresentation::GetEdgeScalarBarVisibility()
return this->EdgeScalarBar->GetScalarBarActor()->GetVisibility() ? true : false;
}
vtkScalarBarWidget* vtkRenderedGraphRepresentation::GetVertexScalarBar()
{
return this->VertexScalarBar.GetPointer();
}
vtkScalarBarWidget* vtkRenderedGraphRepresentation::GetEdgeScalarBar()
{
return this->EdgeScalarBar.GetPointer();
}
bool vtkRenderedGraphRepresentation::IsLayoutComplete()
{
return this->Layout->IsLayoutComplete() ? true : false;
......@@ -1250,6 +1262,8 @@ void vtkRenderedGraphRepresentation::ApplyViewTheme(vtkViewTheme* theme)
this->ApplyColors->SetPointLookupTable(theme->GetPointLookupTable());
this->ApplyColors->SetCellLookupTable(theme->GetCellLookupTable());
this->VertexScalarBar->GetScalarBarActor()->SetLookupTable(theme->GetPointLookupTable());
this->EdgeScalarBar->GetScalarBarActor()->SetLookupTable(theme->GetCellLookupTable());
this->ApplyColors->SetDefaultPointColor(theme->GetPointColor());
this->ApplyColors->SetDefaultPointOpacity(theme->GetPointOpacity());
......
......@@ -337,6 +337,11 @@ public:
virtual void SetEdgeScalarBarVisibility(bool b);
virtual bool GetEdgeScalarBarVisibility();
// Description:
// Obtain the scalar bar widget used to draw a legend for the vertices/edges.
virtual vtkScalarBarWidget* GetVertexScalarBar();
virtual vtkScalarBarWidget* GetEdgeScalarBar();
// Description:
// Whether the current graph layout is complete.
virtual bool IsLayoutComplete();
......
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