[vtkusers] Scaling vertices in a vtkGraphItem based on a data array

Noeska Smit noeska.smit at gmail.com
Fri May 2 05:46:18 EDT 2014


Dear VTK-users,

I would like to scale vertices in a vtkGraphItem based on a data array. The
functionality I want is similar to this example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Graphs/ScaleVertices. In that
example, a GraphLayoutView scales the vertex glyphs according to a scaling
float array. My problem, however, is that I am currently using a
vtkGraphItem and according to the documentation for the VertexSize method:
'Returns the vertex size in pixels, which is remains the same at any zoom
level. Override in a subclass to change the graph vertex size. Note: The
item currently supports one size per graph, queried on the first vertex.'

I have subclassed the vtkGraphItem class and indeed, if I do something like
this:
float vtkVariationGraphItem::VertexSize(vtkIdType vertex)
{
	vtkAbstractArray *weights =
this->GetGraph()->GetVertexData()->GetAbstractArray("VertexSizes");
	return weights->GetVariantValue(vertex).ToFloat();
}

all vertices in my graph are the same size. 

I typically use VTK at the Python level and am definitely not a C++ hero,
but what is the reasoning behind not allowing different vertex sizes within
a graph? Can it be adjusted easily? I did manage to vary the edge thickness
based on a data array already.

Thanks in advance!
Noeska Smit



--
View this message in context: http://vtk.1045678.n5.nabble.com/Scaling-vertices-in-a-vtkGraphItem-based-on-a-data-array-tp5726954.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list