<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Thanks for the feedback Jeff,<br>
<br>
I added it in the bug tracker. (<a
href="http://public.kitware.com/Bug/view.php?id=11969">http://public.kitware.com/Bug/view.php?id=11969</a>)<br>
<br>
I'll submit a patch for the vtkGraphLayoutView in the next days.<br>
<br>
Thanks,<br>
<br>
Nicolas<br>
<br>
On 03/14/2011 01:12 PM, Jeff Baumes wrote:
<blockquote
cite="mid:AANLkTimO=NeZaMni4eyR28zuEGB7o8WKn5yuh06emwSY@mail.gmail.com"
type="cite">Glancing at your message again, it appears you are
also finding a bug in vtkQtTreeView where it interprets edge ids
as vertex ids. If you could add that to the VTK bug tracker, I
could hopefully take a look at it sometime soon. Getting rid of
edge selections in the graph layout view as I suggested would work
around this problem.
<div>
<br>
<div class="gmail_quote">On Mon, Mar 14, 2011 at 1:07 PM, Jeff
Baumes <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
I do not know of a simple way to make this difference in
selections go away. The vtkGraphLayoutView generates vertex
+ edge selections, and vtkQtTreeView generates vertex-only
selections. I believe the best solution is to have
vtkGraphLayoutView have an option to not select edges, as
you suggested. If you are interested in adding that option,
you can patch vtkGraphLayoutView.cxx to add some checks in
ConvertSelection() based on a new boolean member variable
and submit it to us for inclusion in VTK, or you could
subclass vtkGraphLayoutView and reimplement
ConvertSelection() if you want to just get it working for
your own application.
<div>
<br>
</div>
<div>Jeff<br>
<br>
<div class="gmail_quote">
<div>
<div class="h5">On Fri, Mar 11, 2011 at 4:41 PM,
Nicolas Rannou <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:nicolas_rannou@hms.harvard.edu"
target="_blank">nicolas_rannou@hms.harvard.edu</a>></span>
wrote:<br>
</div>
</div>
<blockquote class="gmail_quote" style="margin: 0pt 0pt
0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div>
<div class="h5">
<div text="#000000" bgcolor="#ffffff"> Hi all,<br>
<br>
I'm trying to connect a <small>vtkQtTree</small>
and a <small>vtkGraphLayout</small> but the
selection is not working as expected.<br>
<br>
When I select something in the <small>vtkGraphLayout</small>,
the selection can contain vertices and edges.<br>
When I select something in the <small>vtkQtTree</small>,
the selection only contains vertices.<br>
<br>
If I select edges + vertices in the <small>vtkGraphLayout</small>,
i.e. vertices: 1 and 4, edge:3, it highlights <u>vertices</u>
1,3,4 in the <small>vtkQtTree</small>...<br>
<br>
Then I have 3 questions/issues:<br>
(see pseudo-code at the end of the email)<br>
<br>
#1: should I modify the structure of my <small>vtkTree</small>
(<small>Add specific arrays for vertices/edges?</small>)
so the <small>vtkQtTree</small> handles
properly selection of edges+vertices?<br>
<br>
#2: can I get my <small>vtkQtTree</small> to
return the edges? Or should I find the edges
after it returns the vertices (is there an
efficient way to do it?)?<br>
<br>
#3: is there a straight forward way to disable
edges selection in the <small>vtkGraphLayoutView</small>?
<small>(Something like: EdgesNotSelectable()?)</small><br>
<br>
<br>
Thanks,<br>
<br>
<br>
Nicolas<br>
<br>
<br>
// What I do<br>
<br>
I first create a graph and add some arrays
associated to the <u>vertices</u>. <br>
<small>
vtkSmartPointer<vtkMutableDirectedGraph>
graph =<br>
vtkSmartPointer<vtkMutableDirectedGraph>::New();<br>
vtkIdType a = graph->AddVertex();<br>
vtkIdType b = graph->AddChild(a);<br>
vtkIdType c = graph->AddChild(a);<br>
<br>
vtkSmartPointer<vtkStringArray>
cellType =<br>
vtkSmartPointer<vtkStringArray>::New();<br>
cellType->SetName("name");<br>
cellType->InsertValue(a, "TypeA");<br>
cellType->InsertValue(b, "TypeB");<br>
cellType->InsertValue(c, "TypeC");<br>
<br>
graph->GetVertexData()->AddArray(cellType);<br>
...<br>
</small><br>
I convert the graph to a <small>vtkTree</small>
and add this representation to the <small>vtkQtTree</small>
and to the <small>vtkGraphLayout</small>.<br>
<br>
I connect the views through <small>vtkAnnotations</small>
and <small>vtkEventQtSlotConnect</small>.<br>
<small> this->m_annotationLink =
vtkSmartPointer<vtkAnnotationLink>::New();<br>
this->m_treeGraphView->GetRepresentation()->SetAnnotationLink(this->m_annotationLink);<br>
this->m_treeTableView->GetRepresentation()->SetAnnotationLink(this->m_annotationLink);</small><br>
<br>
<small> this->m_connect =
vtkSmartPointer<vtkEventQtSlotConnect>::New();<br>
this->m_connect->Connect(this->m_treeTableView->GetRepresentation(),<br>
vtkCommand::SelectionChangedEvent,<br>
this, SLOT(selectionChanged(vtkObject*,
unsigned long, void*, void*)));<br>
this->m_connect->Connect(this->m_treeGraphView->GetRepresentation(),<br>
vtkCommand::SelectionChangedEvent,<br>
this, SLOT(selectionChanged(vtkObject*,
unsigned long, void*, void*)));</small><br>
<br>
<small>selectionChanged() only call update on
the 2 views</small><br>
</div>
<br>
</div>
</div>
_______________________________________________<br>
Powered by <a moz-do-not-send="true"
href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a
moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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>
Technical Lead, Kitware Inc.<br>
(518) 881-4932<br>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Jeff Baumes, Ph.D.<br>
Technical Lead, Kitware Inc.<br>
(518) 881-4932<br>
</div>
</blockquote>
<br>
</body>
</html>