SunnyXu / SBMLDiagrams

MIT License
5 stars 1 forks source link

Problem with p = sd.getNodeTextPosition(‘ATP’)[0] #74

Closed hsauro closed 2 years ago

hsauro commented 2 years ago

I noticed that getNodeTextPosition() returns a point in a list. This is not the right way to do it, it should just return the point for a given alias.

It should be used like this:

p = sd.getNodeTextPosition(‘ATP’)

print (p.x, p.y)

Since alias nodes are relatively rare I would add an optional argument to the method which specifies the alias node. If the argument is missing it will use alias node zero.

p = sd.getNodeTextPosition(‘ATP’)

If the node has an alias then a user can do:

p = sd.getNodeTextPosition(‘ATP’, alias=1)

Note it should check for errors:

p = sd.getNodeTextPosition(‘ATP’, alias=999)

Error: Alias 999 does not exist.

The way you did doesn't look great.

SunnyXu commented 2 years ago

fixed. changed all the get node functions regarding to alias. rm the list output from all the get functions.