public LineElement AddLine(Vector2 start, Vector2 end, BrushSize size, BrushColor color) { if (start != null && end != null && size != null && color != null) { var line = new LineElement(this, start, end, color, size); #warning change concat addition to lists eventually LineElements = LineElements.Concat(new LineElement[] { line }).ToArray(); OnChanged.SafeInvoke(this); return(line); } else { throw new ArgumentException("AddLine input arguments not valid"); } }
public NoteData ToData() { return(new NoteData() { BackgroundColor = BackgroundColor, DateCreated = Name.DateCreated, Name = Name.Name, DateLastModified = Name.DateLastModified, DateLastOpened = Name.DateLastOpened, Description = Name.Description, Id = Id, LineELementIds = LineElements.Select(l => l.Id).ToArray(), StrokeIds = Strokes.Select(s => s.Id).ToArray(), TextELementIds = TextElements.Select(t => t.Id).ToArray(), }); }
/// <summary> /// Creates a box around where the user has their mouse targeted. /// The appears might vary depending on the validity of that location /// </summary> /// <param name="tilemap">The map</param> /// <returns>The line segments to render</returns> IEnumerable <SegmentProperties> GenerateSelectionBoxLines(IMap tilemap) { if (lastMouseLocationOffGrid) { return(new List <SegmentProperties>()); } List <SegmentProperties> segments = new List <SegmentProperties>(); var selectedCellWorldSpace = GridSpaceConversion.GetWorldSpaceFromLogical(lastMouseLocation, tilemap); Color boxColor = Color.white; if (!pendingTargetActive) { boxColor = Color.red; segments.AddRange(LineElements.XSegments(selectedCellWorldSpace, boxColor)); } segments.AddRange(LineElements.SquareSelectionSegments(selectedCellWorldSpace, boxColor)); return(segments); }