NetAnim: Redundant margin calculations
authorJohn Abraham <john.abraham.in@gmail.com>
Wed, 10 Oct 2012 22:11:07 -0700
changeset 9108 0e70eb6f9855
parent 9107 97282f9f685b
child 9109 a09a1899429d
NetAnim: Redundant margin calculations
src/netanim/model/animation-interface.cc
src/netanim/model/animation-interface.h
--- a/src/netanim/model/animation-interface.cc	Tue Oct 09 12:47:50 2012 -0700
+++ b/src/netanim/model/animation-interface.cc	Wed Oct 10 22:11:07 2012 -0700
@@ -397,7 +397,6 @@
       }
     }
 
-  AddMargin ();
   if (m_xml)
     { // output the xml headers
       std::ostringstream oss;
@@ -621,20 +620,6 @@
   return WriteN (st.c_str (), st.length ());
 }
 
-// Private methods
-void AnimationInterface::AddMargin ()
-{
-  // Compute width/height, and add a small margin
-  double w = m_topoMaxX - m_topoMinX;
-  double h = m_topoMaxY - m_topoMinY;
-  m_topoMinX -= w * 0.05;
-  m_topoMinY -= h * 0.05;
-  m_topoMaxX = m_topoMinX + w * 1.5;
-  m_topoMaxY = m_topoMinY + h * 1.5;
-  NS_LOG_INFO ("Added Canvas Margin:" << m_topoMinX << "," <<
-               m_topoMinY << "," << m_topoMaxX << "," << m_topoMaxY);                 
-}
-
 std::vector <Ptr <Node> >  AnimationInterface::RecalcTopoBounds ()
 {
   std::vector < Ptr <Node> > MovedNodes;
@@ -668,20 +653,11 @@
 
 void AnimationInterface::RecalcTopoBounds (Vector v)
 {
-  double oldminX = m_topoMinX;
-  double oldminY = m_topoMinY;
-  double oldmaxX = m_topoMaxX;
-  double oldmaxY = m_topoMaxY;
   m_topoMinX = std::min (m_topoMinX, v.x);
   m_topoMinY = std::min (m_topoMinY, v.y);
   m_topoMaxX = std::max (m_topoMaxX, v.x);
   m_topoMaxY = std::max (m_topoMaxY, v.y);
   
-  if ((m_topoMinX != oldminX) || (m_topoMinY != oldminY) ||
-      (m_topoMaxX != oldmaxX) || (m_topoMaxY != oldmaxY))
-    {
-      AddMargin ();
-    } 
 }
 
 int AnimationInterface::WriteN (const char* data, uint32_t count)
--- a/src/netanim/model/animation-interface.h	Tue Oct 09 12:47:50 2012 -0700
+++ b/src/netanim/model/animation-interface.h	Wed Oct 10 22:11:07 2012 -0700
@@ -521,7 +521,6 @@
   Vector UpdatePosition (Ptr <Node> n, Vector v);
   void WriteDummyPacket ();
   bool NodeHasMoved (Ptr <Node> n, Vector newLocation);
-  void AddMargin ();
 
   void PurgePendingWifi ();
   void PurgePendingWimax ();