Thanks for the patch. I finally got around to merging this into VTK master.<div><br></div><div>Jeff</div><div><br><div class="gmail_quote">On Wed, Mar 16, 2011 at 1:51 PM, Nicolas Rannou <span dir="ltr"><<a href="mailto:nicolas_rannou@hms.harvard.edu">nicolas_rannou@hms.harvard.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div text="#000000" bgcolor="#ffffff">
Thanks both!<br>
<br>
Jeff,<br>
Please find enclosed a patch which allows the user to select only
the vertex in the graph.<br>
<br>
We should just call:<br>
vtkGraphLayoutView::SetEdgeSelection(bool);<br><font color="#888888">
<br>
Nicolas</font><div><div></div><div class="h5"><br>
<br>
On 03/15/2011 09:05 PM, Jeff Baumes wrote:
<blockquote type="cite">
<div>Sure enough, vtkQtTreeView::Update() was calling
SetShowRootNode(false). If you put Update() before
SetShowRootNode(true) in your code it should work. I also just
pushed a fix to master that resolves this so the order should no
longer matter.</div>
<div><br>
</div>
<div>Jeff</div>
<br>
<div class="gmail_quote">On Tue, Mar 15, 2011 at 7:29 PM, Nicolas
Rannou <span dir="ltr"><<a href="mailto:Nicolas_Rannou@hms.harvard.edu" target="_blank">Nicolas_Rannou@hms.harvard.edu</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">
<div style="word-wrap:break-word">
<div>Hi Julien,</div>
<div><br>
</div>
<div> I tried:
<div><br>
</div>
<div>
<div>this->m_treeTableView->AddRepresentationFromInput(tree);</div>
<div>this->m_treeTableView->SetShowRootNode(true);</div>
<div>this->m_treeTableView->Update();</div>
<div><br>
</div>
<div>but the root node is not visible in
the vtkQtTreeView...</div>
<div><br>
</div>
<font color="#888888">
<div>
Nicolas</div>
</font>
<div>
<div>
<div><br>
</div>
<div>
<div>On Mar 15, 2011, at 6:31 PM, Julien Finet
wrote:</div>
<br>
<blockquote type="cite">Did you try
vtkQtTreeView::SetShowRootNode(true) ?
<div>Julien.<br>
<br>
<div class="gmail_quote">On Tue, Mar 15, 2011
at 6:28 PM, Nicolas Rannou <span dir="ltr"><<a href="mailto:nicolas_rannou@hms.harvard.edu" target="_blank">nicolas_rannou@hms.harvard.edu</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div text="#000000" bgcolor="#ffffff"> Hi
Jeff,<br>
<br>
another thing we noticed is that the
root vertex is not shown in the
vtkQtTreeView. Is there any reason for
that or is it a bug?<br>
<br>
If "A" is the tree root vertex:<br>
<br>
vtkGraphLayoutView:<br>
<br>
A--->B--->C--->D<br>
| |<br>
| ->E<br>
->F<br>
<br>
vtkQtTreeView:<br>
<br>
B--->C--->D<br>
|<br>
->E<br>
F<br>
<br>
Thanks,<br>
<font color="#888888"> <br>
<br>
Nicolas</font>
<div>
<div><br>
<br>
On 03/14/2011 02:36 PM, Nicolas
Rannou wrote:
<blockquote type="cite"> 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" target="_blank">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 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 href="mailto:jeff.baumes@kitware.com" target="_blank">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>On Fri, Mar 11,
2011 at 4:41 PM,
Nicolas Rannou <span dir="ltr"><<a 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>
<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 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>
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>
</blockquote>
<br>
</div>
</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>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Jeff Baumes, Ph.D.<br>
Technical Lead, Kitware Inc.<br>
(518) 881-4932<br>
</blockquote>
<br>
</div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Jeff Baumes, Ph.D.<br>Technical Lead, Kitware Inc.<br>(518) 881-4932<br>
</div>