如何在NS3内部将包装颜色设置为netanim

发布于 2025-01-30 05:55:25 字数 760 浏览 2 评论 0原文

AnimationInterface anim("DDoSim.xml");

ns3::AnimationInterface::SetConstantPosition(nodes.Get(0), 0, 0);
ns3::AnimationInterface::SetConstantPosition(nodes.Get(1), 10, 10);
ns3::AnimationInterface::SetConstantPosition(nodes.Get(2), 23, 10);
anim.UpdateNodeColor(nodes.Get(0), 0, 0, 255);

uint32_t x_pos = 0;
for (int l = 0; l < NUMBER_OF_BOTS; ++l)
{
    ns3::AnimationInterface::SetConstantPosition(botNodes.Get(l), x_pos++, 30);
}

默认情况下,模拟中的所有数据包均以蓝色显示。 我希望该数据包源自模拟中的节点0,以与植物瘤不同的颜色显示不同的颜色,表明它可以很容易地看到哪些数据包来自Node0,哪些数据包来自botnodes。

有什么办法可以实现这一目标?

AnimationInterface anim("DDoSim.xml");

ns3::AnimationInterface::SetConstantPosition(nodes.Get(0), 0, 0);
ns3::AnimationInterface::SetConstantPosition(nodes.Get(1), 10, 10);
ns3::AnimationInterface::SetConstantPosition(nodes.Get(2), 23, 10);
anim.UpdateNodeColor(nodes.Get(0), 0, 0, 255);

uint32_t x_pos = 0;
for (int l = 0; l < NUMBER_OF_BOTS; ++l)
{
    ns3::AnimationInterface::SetConstantPosition(botNodes.Get(l), x_pos++, 30);
}

Simulation image

By default all the packets in the simulation are shown in blue color.
I want the packet originating from node 0 in the simulation to be shown with different color than originating from botnodes, show that it can be easily seen which packets are from node0 and which are from botNodes.

Is there any way I can achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾听心声的旋律 2025-02-06 05:55:25

您无法做到。您只能更改节点的颜色,而不能更改数据包。

There is no way you can do so. You can only change the color of nodes, but not packets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文