src/mobility/position-allocator.cc
changeset 2621 b0e140bbeeee
parent 2602 d9262bff6df2
child 2965 4b28e9740e3b
equal deleted inserted replaced
2620:0131b5889305 2621:b0e140bbeeee
   112 }
   112 }
   113 GridPositionAllocator::GridPositionAllocator ()
   113 GridPositionAllocator::GridPositionAllocator ()
   114   : m_current (0)
   114   : m_current (0)
   115 {}
   115 {}
   116 
   116 
       
   117 void 
       
   118 GridPositionAllocator::SetMinX (double xMin)
       
   119 {
       
   120   m_xMin = xMin;
       
   121 }
       
   122 void 
       
   123 GridPositionAllocator::SetMinY (double yMin)
       
   124 {
       
   125   m_yMin = yMin;
       
   126 }
       
   127 void 
       
   128 GridPositionAllocator::SetDeltaX (double deltaX)
       
   129 {
       
   130   m_deltaX = deltaX;
       
   131 }
       
   132 void 
       
   133 GridPositionAllocator::SetDeltaY (double deltaY)
       
   134 {
       
   135   m_deltaY = deltaY;
       
   136 }
       
   137 void 
       
   138 GridPositionAllocator::SetN (uint32_t n)
       
   139 {
       
   140   m_n = n;
       
   141 }
       
   142 void 
       
   143 GridPositionAllocator::SetLayoutType (enum LayoutType layoutType)
       
   144 {
       
   145   m_layoutType = layoutType;
       
   146 }
       
   147 
       
   148 double 
       
   149 GridPositionAllocator::GetMinX (void) const
       
   150 {
       
   151   return m_xMin;
       
   152 }
       
   153 double 
       
   154 GridPositionAllocator::GetMinY (void) const
       
   155 {
       
   156   return m_yMin;
       
   157 }
       
   158 double 
       
   159 GridPositionAllocator::GetDeltaX (void) const
       
   160 {
       
   161   return m_deltaX;
       
   162 }
       
   163 double 
       
   164 GridPositionAllocator::GetDeltaY (void) const
       
   165 {
       
   166   return m_deltaY;
       
   167 }
       
   168 uint32_t 
       
   169 GridPositionAllocator::GetN (void) const
       
   170 {
       
   171   return m_n;
       
   172 }
       
   173 enum GridPositionAllocator::LayoutType 
       
   174 GridPositionAllocator::GetLayoutType (void) const
       
   175 {
       
   176   return m_layoutType;
       
   177 }
       
   178 
   117 Vector 
   179 Vector 
   118 GridPositionAllocator::GetNext (void) const
   180 GridPositionAllocator::GetNext (void) const
   119 {
   181 {
   120   double x = 0.0, y = 0.0;
   182   double x = 0.0, y = 0.0;
   121   switch (m_layoutType) {
   183   switch (m_layoutType) {
   157 
   219 
   158 RandomRectanglePositionAllocator::RandomRectanglePositionAllocator ()
   220 RandomRectanglePositionAllocator::RandomRectanglePositionAllocator ()
   159 {}
   221 {}
   160 RandomRectanglePositionAllocator::~RandomRectanglePositionAllocator ()
   222 RandomRectanglePositionAllocator::~RandomRectanglePositionAllocator ()
   161 {}
   223 {}
       
   224 
       
   225 void 
       
   226 RandomRectanglePositionAllocator::SetX (RandomVariable x)
       
   227 {
       
   228   m_x = x;
       
   229 }
       
   230 void 
       
   231 RandomRectanglePositionAllocator::SetY (RandomVariable y)
       
   232 {
       
   233   m_y = y;
       
   234 }
       
   235 
   162 Vector
   236 Vector
   163 RandomRectanglePositionAllocator::GetNext (void) const
   237 RandomRectanglePositionAllocator::GetNext (void) const
   164 {
   238 {
   165   double x = m_x.GetValue ();
   239   double x = m_x.GetValue ();
   166   double y = m_y.GetValue ();
   240   double y = m_y.GetValue ();
   202 
   276 
   203 RandomDiscPositionAllocator::RandomDiscPositionAllocator ()
   277 RandomDiscPositionAllocator::RandomDiscPositionAllocator ()
   204 {}
   278 {}
   205 RandomDiscPositionAllocator::~RandomDiscPositionAllocator ()
   279 RandomDiscPositionAllocator::~RandomDiscPositionAllocator ()
   206 {}
   280 {}
       
   281 
       
   282 void 
       
   283 RandomDiscPositionAllocator::SetTheta (RandomVariable theta)
       
   284 {
       
   285   m_theta = theta;
       
   286 }
       
   287 void 
       
   288 RandomDiscPositionAllocator::SetRho (RandomVariable rho)
       
   289 {
       
   290   m_rho = rho;
       
   291 }
       
   292 void 
       
   293 RandomDiscPositionAllocator::SetX (double x)
       
   294 {
       
   295   m_x = x;
       
   296 }
       
   297 void 
       
   298 RandomDiscPositionAllocator::SetY (double y)
       
   299 {
       
   300   m_y = y;
       
   301 }
   207 Vector
   302 Vector
   208 RandomDiscPositionAllocator::GetNext (void) const
   303 RandomDiscPositionAllocator::GetNext (void) const
   209 {
   304 {
   210   double theta = m_theta.GetValue ();
   305   double theta = m_theta.GetValue ();
   211   double rho = m_rho.GetValue ();
   306   double rho = m_rho.GetValue ();