private void UpdateMap <T>(
     ICollection <T> source,
     Func <T, bool> isNewSelector,
     Func <T, bool> isRemovedSelector,
     Func <T, bool> justColoredSelector,
     Func <T, bool> isValidSelector,
     ICloudObjectsContainer <T> map)
 {
     if (source != null)
     {
         foreach (var element in source)
         {
             if (isValidSelector(element))
             {
                 if (isNewSelector(element))
                 {
                     map.Add(element);
                 }
                 else if (isRemovedSelector(element))
                 {
                     map.Remove(element);
                 }
                 else if (justColoredSelector(element))
                 {
                     map.ChangeColor(element);
                 }
                 else
                 {
                     map.Update(element);
                 }
             }
         }
     }
 }
 private void DisconnectFromAll(SlamObservation observation)
 {
     foreach (var connection in m_connections)
     {
         if ((connection.first == observation || connection.second == observation) && connection.lineId != -1)
         {
             m_lines.Remove(connection.lineId);
         }
     }
     m_connections.RemoveAll(c => c.first == observation || c.second == observation);
 }
示例#3
0
 public void TurnBack()
 {
     if (m_poseHistory.Count > 0)
     {
         Pose lastPose = m_poseHistory.Pop();
         transform.position = lastPose.position;
         transform.rotation = lastPose.rotation;
     }
     if (m_lineIdsHistory.Count > 0)
     {
         int lastLineId = m_lineIdsHistory.Pop();
         if (lastLineId != -1)
         {
             m_linesContainer.Remove(lastLineId);
         }
         m_linesContainer.Repaint();
     }
 }
示例#4
0
 public void UnExecute()
 {
     if (m_addedPoints != null)
     {
         foreach (var point in m_addedPoints)
         {
             m_pointsContainer.Remove(point);
         }
     }
     if (m_addedLines != null)
     {
         foreach (var line in m_addedLines)
         {
             m_linesContainer.Remove(line);
         }
     }
     if (m_addedObservations != null)
     {
         foreach (var observation in m_addedObservations)
         {
             m_observationsContainer.Remove(observation);
         }
     }
 }
示例#5
0
 public void Execute()
 {
     if (m_points2Remove != null)
     {
         foreach (var point in m_points2Remove)
         {
             m_pointsContainer.Remove(point);
         }
     }
     if (m_lines2Remove != null)
     {
         foreach (var line in m_lines2Remove)
         {
             m_linesContainer.Remove(line);
         }
     }
     if (m_observations2Remove != null)
     {
         foreach (var observation in m_observations2Remove)
         {
             m_observationsContainer.Remove(observation);
         }
     }
 }