79 lines
2.4 KiB
C#
79 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace UseCases
|
|
{
|
|
public class Diagram
|
|
{
|
|
/// <summary>
|
|
/// Initialize a new diagram with the default values.
|
|
/// </summary>
|
|
public Diagram()
|
|
{
|
|
Version = new Version(1,0,0,0);
|
|
Actors = new List<Actor>();
|
|
UseCases = new List<UseCase>();
|
|
Size = new Size(430, 372);
|
|
Maximized = false;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
/// <summary>
|
|
/// Initialize a new diagram with the default values and a specific size.
|
|
/// </summary>
|
|
/// <param name="size">The size the diagram should be.</param>
|
|
public Diagram(Size size) : this()
|
|
{
|
|
Size = size;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initialize a new diagram with these values.
|
|
/// </summary>
|
|
/// <param name="version">The version of the diagram</param>
|
|
/// <param name="actors">The actors in the diagram</param>
|
|
/// <param name="useCases">The usecases in the diagram</param>
|
|
/// <param name="size">The size of the diagram</param>
|
|
/// <param name="maximized">Whether or not the window is maximized</param>
|
|
public Diagram(Version version, List<Actor> actors, List<UseCase> useCases, Size size, bool maximized)
|
|
{
|
|
Version = version;
|
|
Actors = actors;
|
|
UseCases = useCases;
|
|
Size = size;
|
|
Maximized = maximized;
|
|
}
|
|
|
|
/// <summary>
|
|
/// All the drawable objects (Actors and UseCases) concatenated.
|
|
/// </summary>
|
|
[JsonIgnore]
|
|
public IEnumerable<IDrawable> Drawable => Actors.Cast<IDrawable>().Concat(UseCases);
|
|
|
|
|
|
/// <summary>
|
|
/// The version of the diagram
|
|
/// </summary>
|
|
public Version Version { get; set; }
|
|
/// <summary>
|
|
/// The actors in the diagram
|
|
/// </summary>
|
|
public List<Actor> Actors { get; set; }
|
|
/// <summary>
|
|
/// The usecases in the diagram
|
|
/// </summary>
|
|
public List<UseCase> UseCases { get; set; }
|
|
/// <summary>
|
|
/// The size of the diagram
|
|
/// </summary>
|
|
public Size Size { get; set; }
|
|
/// <summary>
|
|
/// Wheter or not the diagram is maximized.
|
|
/// </summary>
|
|
public bool Maximized { get; set; }
|
|
}
|
|
}
|