Arrowheads are possible. Currently the functionality is not exposed in vtkGraphLayoutView, but it is possible to create your own actor. Here is the python code for doing it:<br><br>from vtk import *<br><br># Make a small random graph and graph view.<br>
source = vtkRandomGraphSource()<br>view = vtkGraphLayoutView()<br><br># Do layout manually before handing graph to the view.<br># This allows us to know the positions of edge arrows.<br>layout = vtkGraphLayout()<br>strategy = vtkSimple2DLayoutStrategy()<br>
layout.SetInputConnection(source.GetOutputPort())<br>layout.SetLayoutStrategy(strategy);<br>view.SetLayoutStrategyToPassThrough()<br><br># Add the graph to the view. This will render vertices and edges,<br># but not edge arrows.<br>
view.AddRepresentationFromInputConnection(layout.GetOutputPort())<br><br># Manually create an actor containing the glyphed arrows.<br>graphToPoly = vtkGraphToPolyData()<br>graphToPoly.SetInputConnection(layout.GetOutputPort())<br>
graphToPoly.EdgeGlyphOutputOn()<br><br># Set the position (0: edge start, 1: edge end) where<br># the edge arrows should go.<br>graphToPoly.SetEdgeGlyphPosition(0.8)<br><br># Make a simple edge arrow for glyphing.<br>arrowSource = vtkGlyphSource2D()<br>
arrowSource.SetGlyphTypeToEdgeArrow()<br>arrowSource.SetScale(0.3)<br><br># Use Glyph3D to repeat the glyph on all edges.<br>arrowGlyph = vtkGlyph3D()<br>arrowGlyph.SetInputConnection(0, graphToPoly.GetOutputPort(1))<br>arrowGlyph.SetInputConnection(1, arrowSource.GetOutputPort())<br>
<br># Add the edge arrow actor to the view.<br>arrowMapper = vtkPolyDataMapper()<br>arrowMapper.SetInputConnection(arrowGlyph.GetOutputPort())<br>arrowActor = vtkActor()<br>arrowActor.SetMapper(arrowMapper)<br>view.GetRenderer().AddActor(arrowActor)<br>
<br># Start interaction.<br>view.ResetCamera()<br>view.GetInteractor().Start()<br><br>Jeff<br>
<br><div class="gmail_quote">On Mon, Feb 22, 2010 at 2:54 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria%2Bvtk@gmail.com" target="_blank">daviddoria+vtk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="gmail_quote"><div><div></div><div>On Fri, Feb 19, 2010 at 8:39 AM, JO BLOGGS <span dir="ltr"><<a href="mailto:glogboj@yahoo.co.uk" target="_blank">glogboj@yahoo.co.uk</a>></span> wrote:<br>
<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td valign="top">I am using vtkGraphLayoutView to visualize a vtkDirectedGraph. How do I get the view to show me the directions of edges (i.e. arrowheads or colour change)?<br><br>Many thanks for your advice,<br>Colin<br>
</td></tr></tbody></table><br><br></blockquote>
<div class="gmail_quote"><br></div>
</div></div><div class="gmail_quote">It seems reasonable to indicate the direction of the edges with arrows. I also don't see any option for this. Anyone know if this is possible?</div><br clear="all">Thanks,<br><br>
<div>David <br></div></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Jeff Baumes, Ph.D.<br>R&D Engineer, Kitware Inc.<br>(518) 881-4932<br><a href="mailto:jeff.baumes@kitware.com" target="_blank">jeff.baumes@kitware.com</a><br>