Skip to content
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.

Wrong result of the python method View.pickNodeEdge #139

Open
rgiot opened this issue Jul 3, 2019 · 1 comment
Open

Wrong result of the python method View.pickNodeEdge #139

rgiot opened this issue Jul 3, 2019 · 1 comment

Comments

@rgiot
Copy link
Contributor

rgiot commented Jul 3, 2019

If I use the code of the issue #133 and apply to it this patch:

@@ -49,4 +49,9 @@ mouse = g.addNode()
 viewLayout[mouse] = mouse_world
 viewSize[mouse] = (0.75, 0.75, 1.0)
 
+g.delNode(n)
+
+found = gui.pickNodeEdge(mouse_view[0], mouse_view[1],True, False)
+print found
+

I obtain the following answer
(False, <node 4294967295>, <edge 4294967295>) wheras I expect to obtain
(False, <node 6>, <edge 4294967295>)

@rgiot rgiot changed the title Wrong result of the python method gui.pickNodeEdge Wrong result of the python method View.pickNodeEdge Jul 3, 2019
@anlambert
Copy link
Contributor

This seems related to issue #137.

When the graph set to the view is empty and calling method setOverviewVisible before the resize one, a nasty side effect appears.

This code works as expected for instance:

from tulip import tlp
from tulipgui import tlpgui

WIDTH = 500
HEIGHT = 500

g = tlp.newGraph()
viewLayout = g.getLayoutProperty("viewLayout")
viewSize = g.getSizeProperty("viewSize")
viewColor = g.getColorProperty("viewColor")

gui = tlpgui.createNodeLinkDiagramView(g)

gui.resize(WIDTH, HEIGHT)
gui.setOverviewVisible(False)

# Ensure the camera is as I want
nodes = g.addNodes(4)
viewLayout[nodes[0]] = (-10,10,0)
viewLayout[nodes[1]] = (-10,-10,0)
viewLayout[nodes[2]] = (10,10,0)
viewLayout[nodes[3]] = (10,-10,0)
for i in range(4):
    viewColor[nodes[i]] = tlp.Color.Black


gui.centerView()

# Add node in the middle of screen using world coordinates
n = g.addNode()
viewLayout[n] = (0, 0, 0)
viewSize[n] = (1.0, 1.0, 1.0)
viewColor[n] = tlp.Color.Green

# Add node in the middle of screen using pixels coordinates (should hide the previous one)
mouse_view = (WIDTH/2, HEIGHT/2, 0)
mouse_world = gui.viewToWorld(mouse_view)

print("View", mouse_view, "Computed World", mouse_world, "Groundtruth world", (0,0,0))

mouse = g.addNode()

viewLayout[mouse] = mouse_world
viewSize[mouse] = (0.75, 0.75, 1.0)

g.delNode(n)

found = gui.pickNodeEdge(mouse_view[0], mouse_view[1],True, False)
print(found)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants