public void Delete([NotNull] IShape shape) { Assert.ArgumentNotNull(shape, nameof(shape)); Canvas.Children.Remove(shape as FrameworkElement); RemoveSelectedItem(shape); if (!Shapes.Any()) { Empty.Visibility = Visibility.Visible; Canvas.Visibility = Visibility.Collapsed; } }
public override IntersectionCollection LocalIntersect(Ray localRay) { if (!Shapes.Any() || !HitsBoundingBox(localRay)) { return(new IntersectionCollection()); } var xs = Shapes .SelectMany(shape => shape.Intersect(localRay).Intersections) .OrderBy(intersection => intersection.T); return(new IntersectionCollection(xs)); }
private void SyncBrushesWithShapes() { if (_context?.Factory == null || Shapes == null) { return; } //add any missing brushes foreach (var instance in Shapes) { foreach (var color in instance.GetColorsToCache()) { if (!_brushResources.ContainsKey(color)) { //color missing, add it var solidBrush = new SolidColorBrush(_context, color.ToDirect2dColor()); _brushResources.Add(color, solidBrush); } } } var colorsToDelete = new List <Wpf.Color>(); //delete any brushes not in use anymore foreach (var color in _brushResources.Keys) { bool colorFound = Shapes.Any(instance => instance.GetColorsToCache().Contains(color)); if (!colorFound) { colorsToDelete.Add(color); } } //remove brushes to be deleted foreach (var color in colorsToDelete) { var brush = _brushResources[color]; _brushResources.Remove(color); brush.Dispose(); } }
public override bool Contains(Shape other) { return(Shapes.Any(x => x.Contains(other))); }
private bool DoesShapesContainInitialNode() { return(Shapes.Any(shape => shape.Type == EShape.Initial)); }
public override bool Contains(IShape shape) { return(ReferenceEquals(shape, this) || Shapes.Any(s => s.Contains(shape))); }
private void UpdateUndoRedo() { CanUndo = Shapes.Any(); CanRedo = _undoneShapes.Any(); }
private bool CanGetPermiter(object param) { return(Shapes.Any()); }
bool IResourceProvider.ContainsResource(string resourceName) { return(Shapes.Any(s => s.Name == resourceName) || Animations.Any(a => a.Name == resourceName)); }