public void Execute() { if (m_points2Update != null) { foreach (var point in m_points2Update) { if (point.justColored) { m_pointsContainer.ChangeColor(point); // не требуется менять положение } else { m_pointsContainer.Update(point); // требуется сменить цвет/положение } } } if (m_observations2Update != null) { foreach (var observation in m_observations2Update) { m_observationsContainer.Update(observation); } } }
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 UpdateConnectionVerticesFor(SlamObservation observation) { var allConnectionsOfArg = m_connections.Where(con => (con.first == observation || con.second == observation) && con.lineId != -1); foreach (var connection in allConnectionsOfArg) { SlamLine line = m_lines[connection.lineId]; if (connection.first == observation) { line.vert1 = connection.first.Point.position; line.vert2 = connection.second.Point.position; } else { line.vert2 = connection.second.Point.position; line.vert1 = connection.first.Point.position; } m_lines.Update(line); } }