Commit 8ffae2b5 authored by Will Schroeder's avatar Will Schroeder

ENH: Propagating icon display size through views

parent 2fc3e6a0
......@@ -86,6 +86,8 @@ vtkRenderView::vtkRenderView()
this->InHoverTextRender = false;
this->IconSize[0] = 16;
this->IconSize[1] = 16;
this->DisplaySize[0] = 0;
this->DisplaySize[1] = 0;
this->PickRenderNeedsUpdate = true;
this->InPickRender = false;
......@@ -743,6 +745,34 @@ void vtkRenderView::SetLabelRenderMode(int render_mode)
}
}
int* vtkRenderView::GetDisplaySize()
{
if ( this->DisplaySize[0] == 0 ||
this->DisplaySize[1] == 0 )
{
return this->IconSize;
}
else
{
return this->DisplaySize;
}
}
void vtkRenderView::GetDisplaySize(int &dsx, int &dsy)
{
if ( this->DisplaySize[0] == 0 ||
this->DisplaySize[1] == 0 )
{
dsx = this->IconSize[0];
dsy = this->IconSize[1];
}
else
{
dsx = this->DisplaySize[0];
dsy = this->DisplaySize[1];
}
}
void vtkRenderView::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
......@@ -791,4 +821,5 @@ void vtkRenderView::PrintSelf(ostream& os, vtkIndent indent)
os << "(none)\n";
}
os << indent << "IconSize: " << this->IconSize[0] << "," << this->IconSize[1] << endl;
os << indent << "DisplaySize: " << this->DisplaySize[0] << "," << this->DisplaySize[1] << endl;
}
......@@ -169,6 +169,13 @@ public:
vtkSetVector2Macro(IconSize, int);
vtkGetVector2Macro(IconSize, int);
// Description:
// Set the display size of the icon (which may be different from the icon
// size). By default, if this value is not set, the the IconSize is used.
vtkSetVector2Macro(DisplaySize, int);
int* GetDisplaySize();
void GetDisplaySize(int &dsx, int &dsy);
//BTX
enum
{
......@@ -264,6 +271,7 @@ protected:
vtkAbstractTransform* Transform;
vtkTexture* IconTexture;
int IconSize[2];
int DisplaySize[2];
//BTX
vtkSmartPointer<vtkBalloonRepresentation> Balloon;
......
......@@ -1017,7 +1017,8 @@ void vtkRenderedGraphRepresentation::PrepareForRendering(vtkRenderView* view)
this->VertexIconActor->GetTexture()->GetInput())
{
this->VertexIconGlyph->SetIconSize(view->GetIconSize());
this->VertexIconGlyph->SetUseIconSize(true);
this->VertexIconGlyph->SetDisplaySize(view->GetDisplaySize());
this->VertexIconGlyph->SetUseIconSize(false);
this->VertexIconActor->GetTexture()->MapColorScalarsThroughLookupTableOff();
this->VertexIconActor->GetTexture()->GetInput()->Update();
int* dim = this->VertexIconActor->GetTexture()->GetInput()->GetDimensions();
......
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