Example #1
0
 public int AddWaypoint(AGT_Waypoint waypoint)
 {
     lock (this)
     {
         _waypoints.AddLast(waypoint);
         return(_waypoints.Count);
     }
 }
Example #2
0
 public int AddWaypoint(AGT_Waypoint waypoint)
 {
     lock (this)
     {
         _waypoints.AddLast(waypoint);
         return _waypoints.Count;
     }
 }
Example #3
0
 public bool DeleteWaypoint(AGT_Waypoint waypoint)
 {
     lock (this)
     {
         LinkedListNode <AGT_Waypoint> node = _waypoints.Find(waypoint);
         if (node != null)
         {
             _waypoints.Remove(node);
             return(true);
         }
         return(false);
     }
 }
Example #4
0
 public bool InsertWaypoint(AGT_Waypoint after, AGT_Waypoint insert)
 {
     lock (this)
     {
         LinkedListNode <AGT_Waypoint> node = _waypoints.Find(after);
         if (node != null)
         {
             _waypoints.AddAfter(_waypoints.Find(after), insert);
             return(true);
         }
         return(false);
     }
 }
Example #5
0
 public bool DeleteWaypoint(AGT_Waypoint waypoint)
 {
     lock (this)
     {
         LinkedListNode<AGT_Waypoint> node = _waypoints.Find(waypoint);
         if (node != null)
         {
             _waypoints.Remove(node);
             return true;
         }
         return false;
     }
 }
Example #6
0
 public AGT_Waypoint InsertWaypointAt(int x, int y)
 {
     lock (this)
     {
         LinkedListNode <AGT_Waypoint> node = _waypoints.First;
         while (node.Next != null)
         {
             if (LineHitTest(node.Value.X, node.Value.Y, node.Next.Value.X, node.Next.Value.Y, x, y))
             {
                 if (((node.Value.X <= x) && (node.Next.Value.X >= x)) &&
                     ((node.Value.Y <= y) && (node.Next.Value.Y >= y)))
                 {
                     float        new_x = (node.Next.Value.X + node.Value.X) * .5f;
                     float        new_y = (node.Next.Value.Y + node.Value.Y) * .5f;
                     AGT_Waypoint point = new AGT_Waypoint("Point " + _waypoints.Count, (float)new_x, (float)new_y, 0);
                     _waypoints.AddAfter(node, point);
                     return(point);
                 }
             }
             node = node.Next;
         }
         return(null);
     }
 }
Example #7
0
 public AGT_Waypoint InsertWaypointAt(int x, int y)
 {
     lock (this)
     {
         LinkedListNode<AGT_Waypoint> node = _waypoints.First;
         while (node.Next != null)
         {
             if (LineHitTest(node.Value.X, node.Value.Y, node.Next.Value.X, node.Next.Value.Y, x, y))
             {
                 if ( ((node.Value.X <= x) && (node.Next.Value.X >= x)) &&
                       ((node.Value.Y <= y) && (node.Next.Value.Y >= y)) )
                 {
                     float new_x = (node.Next.Value.X + node.Value.X) * .5f;
                     float new_y = (node.Next.Value.Y + node.Value.Y) * .5f;
                     AGT_Waypoint point = new AGT_Waypoint("Point " + _waypoints.Count, (float)new_x, (float)new_y, 0);
                     _waypoints.AddAfter(node, point);
                     return point;
                 }
             }
             node = node.Next;
         }
         return null;
     }
 }
Example #8
0
 public bool InsertWaypoint(AGT_Waypoint after, AGT_Waypoint insert)
 {
     lock (this)
     {
         LinkedListNode<AGT_Waypoint> node = _waypoints.Find(after);
         if (node != null)
         {
             _waypoints.AddAfter(_waypoints.Find(after), insert);
             return true;
         }
         return false;
     }
 }