You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.
Currently, we got an issue when we were trying to select the nodes of Tulip's view. Below are our investigation.
The below example is showing issue
#!/bin/python"""Test interaction with view"""fromtulipimporttlpfromtulipguiimporttlpguiWIDTH=256HEIGHT=256g=tlp.newGraph()
viewLayout=g.getLayoutProperty("viewLayout")
viewSelection=g.getBooleanProperty("viewSelection")
viewColor=g.getColorProperty("viewColor")
viewLabel=g.getStringProperty("viewLabel")
nodes=g.addNodes(4)
n1=nodes[0]
n2=nodes[1]
n3=nodes[2]
n4=nodes[3]
# (*) When the coordinators are not symmetric, the result was not as expected.viewLayout[n1] = (-17,-5,0)
viewLayout[n2] = (-14,-4,0)
viewLayout[n3] = (-11,-5,0)
viewLayout[n4] = (-15,-7,0)
gui=tlpgui.createNodeLinkDiagramView(g)
gui.resize(WIDTH, HEIGHT)
gui.setQuickAccessBarVisible(False)
gui.setOverviewVisible(False)
gui.centerView()
gui.draw()
fornodeiing.getNodes():
worldToView=gui.worldToView(viewLayout[nodei])
(found, node, edge) =gui.pickNodeEdge(worldToView[0], worldToView[1], True, False)
print("Pick Node {}".format((found, node, edge)))
# colorize selected nodeiffound:
viewColor[nodei] = (0, 0, 255) # BlueviewSelection[nodei] =Truegui.draw() # reflect on UIinput("wait")
Expected: All nodes should be selected. Actual result: None of the nodes were selected
But when I replaced the coordinators of the nodes with the symmetric ones, all nodes were perfectly selected as expected, below is the code that worked perfectly.
Replace
# (*) When the coordinators are not symmetric, the result was not as expected.viewLayout[n1] = (-17,-5,0)
viewLayout[n2] = (-14,-4,0)
viewLayout[n3] = (-11,-5,0)
viewLayout[n4] = (-15,-7,0)
by
# Attention: to replace the previous nodes coordinators {e.g. previous code at (*)} # by the symmetric ones as followings ==> The result is perfect.viewLayout[n1] = (-3, 3, 0)
viewLayout[n2] = (-3, -3, 0)
viewLayout[n3] = (3, 3, 0)
viewLayout[n4] = (3, -3, 0)
Actual result: All of the nodes were selected (as expected)
Could you please help me to check this case? Thank you very much.
Best regards,
Truong.
The text was updated successfully, but these errors were encountered:
I do not know if it is a bug of your code, or Tulip or a lack of explanations in the documentation.
However, I have found the reason and a workaround.
Y axis needs to be reverted: instead of using the Y coordinate computed by worldToView, use the height of view substracted by this Y coordinate. @p-mary or @anlambert : is it the normal behavior ? I let you close (or not) the comment depending on the answer. Because it has other impacts: the suer may change the height of the window; so it should be obtained programmaticlly and not hardcoded.
So your second test is faulty and does not work despite the apperances : the picked nodes are not the good ones, but the mirrored ones.
Look at this updated example that works:
#!/bin/python"""Test interaction with view"""fromtulipimporttlpfromtulipguiimporttlpguiWIDTH=512HEIGHT=512g=tlp.newGraph()
viewLayout=g.getLayoutProperty("viewLayout")
viewSelection=g.getBooleanProperty("viewSelection")
viewColor=g.getColorProperty("viewColor")
viewLabel=g.getStringProperty("viewLabel")
nodes=g.addNodes(6)
n1=nodes[0]
n2=nodes[1]
n3=nodes[2]
n4=nodes[3]
n5=nodes[4]
n6=nodes[5]
# (*) When the coordinators are not symmetric, the result was not as expected.viewLayout[n1] = (-9, 9, 0)
viewLayout[n2] = (-9, -9, 0)
viewLayout[n3] = (9, 9, 0)
viewLayout[n4] = (9, -9, 0)
viewLayout[n5] = (3, 3, 0)
viewLayout[n6] = (3, -9, 0)
gui=tlpgui.createNodeLinkDiagramView(g)
gui.resize(WIDTH, HEIGHT)
gui.setQuickAccessBarVisible(False)
gui.setOverviewVisible(False)
gui.setViewOrtho(True)
gui.centerView()
gui.draw()
fornodeiing.getNodes():
worldToView=gui.worldToView(viewLayout[nodei])
print("screen {}".format(worldToView))
(found, node, edge) =gui.pickNodeEdge(int(worldToView[0]), HEIGHT-int(worldToView[1]), True, False)
print("Pick Node {}".format((found, node, edge)))
# colorize selected nodeiffound:
viewColor[nodei] = (0, 0, 255) # BlueviewSelection[nodei] =Truegui.draw() # reflect on UIinput("wait")
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Dear Tulip Dev,
Currently, we got an issue when we were trying to select the nodes of Tulip's view. Below are our investigation.
The below example is showing issue
Expected: All nodes should be selected.
Actual result: None of the nodes were selected
But when I replaced the coordinators of the nodes with the symmetric ones, all nodes were perfectly selected as expected, below is the code that worked perfectly.
Replace
by
Actual result: All of the nodes were selected (as expected)
Could you please help me to check this case? Thank you very much.
Best regards,
Truong.
The text was updated successfully, but these errors were encountered: