Setting a custom node image in netanim

1,090 views
Skip to first unread message

Jordi Baranda

unread,
Jan 26, 2016, 3:21:25 AM1/26/16
to ns-3-users
Dear all,

I am using NetAnim as a tool to show some of the network concepts I am working in.
I would like to customize the network visualization by adding some custom icons to some of the nodes.
I have added the resources (images) and assigned to a node when generating the xml file, but after that I have seen that the visualization in NetAnim is not as I expected.
In the attached files you can see the problems I am facing on when adding the custom icon for the node:
1) The icon center does not coincide with the expected center position as when you display the round (netanim-image.png vs netanim-noimage.png).
2) The ID when using the default round shape is next to the round, but when using a custom icon is very far away (netanim-image.png vs netanim-noimage.png). (I am putting the same size to both the custom icon and the default round shape).

I have been trying to solve this problem but I could not. Can anyone suggest something? I would like to achieve a result like the one displayed in the
website (attached image NetAnim.3.105.png). Is it an issue with Linux? I am working with linux, but the NetAnim.3.105.png is using MAC OS.
I thought there was an issue with the node distance and the image resolution. Currently, they are separated 60 pixels and the image is 100x63 pixels.
Anyway, I have tried to separated more the nodes (600 pixels) so the image resolution is on the order, but I still observed the same issues 1) 2) reported previously. 

Any help will be welcome,

Thank you very much for your time and attention,

With kind regards,

Jordi Baranda
netanim-image.png
netanim-noimage.png
NetAnim.3.105.png

John Abraham

unread,
Jan 26, 2016, 9:41:22 AM1/26/16
to ns-3-...@googlegroups.com
can you grep for this?

[root@localhost netanim]# grep drawPixmap resizeableitem.cpp 

          //painter->drawPixmap (0, 0, m_width, m_height, *m_pixmap);

          painter->drawPixmap (-m_width/2, -m_height/2, m_width/2, m_height/2, *m_pixmap);





--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Jordi Baranda

unread,
Jan 27, 2016, 3:25:11 AM1/27/16
to ns-3-...@googlegroups.com
Dear John,

Thank you for your hint.
I have been able to center the image by inserting the following line in resizeableitem.cpp
painter->drawPixmap (-m_width/2, -m_height/2, m_width, m_height, *m_pixmap);

However, I still have the issue with the position of the node description as mention in my original post.
I have realized this happens when putting custom icons. I have tried to modify the description position in animatormode.cpp file
when parsing the event AnimEvent::UPDATE_NODE_IMAGE_EVENT.
Anyone can provide some help with respect to this?

Again thank you very much for your time and attention,

With kind regards,

Jordi

You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/J2LUo2yYsSU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

John Abraham

unread,
Jan 27, 2016, 9:25:39 AM1/27/16
to ns-3-...@googlegroups.com
Yes, that was a bug. Your solution was correct.
I tried to fix this. Can you retry by pulling it again?

Jordi Baranda

unread,
Jan 28, 2016, 3:03:36 AM1/28/16
to ns-3-...@googlegroups.com
Dear John,

Thank you very much. The issues with the custom images are solved, both the position and the text position.
I have seen that you included new cases in the resizeableitem.cpp file.

Again, thank you very much for your hints and help,

Kind regards,

Jordi

Babu Mandal

unread,
Mar 4, 2018, 12:46:00 AM3/4/18
to ns-3-users
 Hi all,

can any one tell me how can I add my image into a particular node...????pls it's emergency
Reply all
Reply to author
Forward
0 new messages