Exemple #1
0
 /// <summary>
 /// Shows the provided objects and "hangs" (halts code until user closes presenter window).
 /// </summary>
 /// <param name="vertices">The vertices.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="marker">The marker.</param>
 public static void ShowAndHang(IEnumerable <IEnumerable <Vertex> > vertices, Vector3 direction, string title = "",
                                Plot2DType plot2DType = Plot2DType.Line,
                                bool closeShape       = true, MarkerType marker = MarkerType.Circle)
 {
     ShowAndHang(vertices.Select(listsOfVerts => listsOfVerts.ProjectTo2DCoordinates(direction, out _)),
                 title, plot2DType, closeShape, marker);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window2DPlot" /> class.
 ///     This version allows different markers to be set for each set of polygons.
 /// </summary>
 /// <param name="listOfListOfPoints2"></param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="listOfListOfPoints1"></param>
 /// <param name="marker1"></param>
 /// <param name="marker2"></param>
 public Window2DPlot(IEnumerable <List <Vertex> > listOfListOfPoints1, IEnumerable <List <Vertex> > listOfListOfPoints2,
                     string title, Plot2DType plot2DType, bool closeShape,
                     MarkerType marker1, MarkerType marker2) : this(title)
 {
     foreach (var points in listOfListOfPoints1)
     {
         if (plot2DType == Plot2DType.Line)
         {
             AddLineSeriesToModel(points, closeShape, marker1);
         }
         else
         {
             AddScatterSeriesToModel(points, marker1);
         }
     }
     foreach (var points in listOfListOfPoints2)
     {
         if (plot2DType == Plot2DType.Line)
         {
             AddLineSeriesToModel(points, closeShape, marker2);
         }
         else
         {
             AddScatterSeriesToModel(points, marker2);
         }
     }
     InitializeComponent();
 }
Exemple #3
0
 /// <summary>
 /// Shows the and hang.
 /// </summary>
 /// <param name="vertices">The vertices.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="marker">The marker.</param>
 public static void ShowAndHang(IList <Vertex> vertices, double[] direction, string title = "",
                                Plot2DType plot2DType = Plot2DType.Line,
                                bool closeShape       = true, MarkerType marker = MarkerType.Circle)
 {
     ShowAndHang(MiscFunctions.Get2DProjectionPoints(vertices, direction, false), title, plot2DType, closeShape,
                 marker);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window2DPlot" /> class.
 ///     This version allows different markers to be set for each set of polygons.
 /// </summary>
 /// <param name="listOfListOfPoints2"></param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="listOfListOfPoints1"></param>
 /// <param name="marker1"></param>
 /// <param name="marker2"></param>
 public Window2DPlot(IEnumerable <IEnumerable <Vector2> > listOfListOfPoints1,
                     IEnumerable <IEnumerable <Vector2> > listOfListOfPoints2,
                     string title, Plot2DType plot2DType, bool closeShape,
                     MarkerType marker1, MarkerType marker2) : this(title)
 {
     foreach (var points in listOfListOfPoints1)
     {
         if (plot2DType == Plot2DType.Line)
         {
             AddLineSeriesToModel(points, closeShape, marker1);
         }
         else
         {
             AddScatterSeriesToModel(points, marker1);
         }
     }
     foreach (var points in listOfListOfPoints2)
     {
         if (plot2DType == Plot2DType.Line)
         {
             AddLineSeriesToModel(points, closeShape, marker2);
         }
         else
         {
             AddScatterSeriesToModel(points, marker2);
         }
     }
     var allpoints = listOfListOfPoints1.SelectMany(v => v).ToList();
     allpoints.AddRange(listOfListOfPoints2.SelectMany(v => v));
     SetAxes(allpoints);
     InitializeComponent();
     Title = title;
 }
Exemple #5
0
        /// <summary>
        /// Shows the and hang.
        /// </summary>
        /// <param name="points">The points.</param>
        /// <param name="title">The title.</param>
        /// <param name="plot2DType">Type of the plot2 d.</param>
        /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
        /// <param name="marker">The marker.</param>
        public static void ShowAndHang(IList <PointLight> points, string title = "", Plot2DType plot2DType = Plot2DType.Line,
                                       bool closeShape = true, MarkerType marker = MarkerType.Circle)
        {
            var window = new Window2DPlot(points, title, plot2DType, closeShape, marker);

            window.ShowDialog();
        }
Exemple #6
0
 /// <summary>
 /// Shows the specified vertices.
 /// </summary>
 /// <param name="vertices">The vertices.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="marker">The marker.</param>
 public static void Show(IList <Vertex[]> vertices, double[] direction, string title = "",
                         Plot2DType plot2DType = Plot2DType.Line,
                         bool closeShape       = true, MarkerType marker = MarkerType.Circle)
 {
     Show(
         vertices.Select(listsOfVerts => MiscFunctions.Get2DProjectionPoints(listsOfVerts, direction, false)
                         )
         .ToList(), title, plot2DType, closeShape, marker);
 }
Exemple #7
0
        /// <summary>
        /// Shows two different lists of polygons using a unique marker for each.
        /// </summary>
        /// <param name="points1">The points1.</param>
        /// <param name="points2">The points2.</param>
        /// <param name="title">The title.</param>
        /// <param name="plot2DType">Type of the plot2 d.</param>
        /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
        /// <param name="marker1">The marker1.</param>
        /// <param name="marker2">The marker2.</param>
        public static void ShowAndHang(IEnumerable <IEnumerable <Vector2> > points1,
                                       IEnumerable <IEnumerable <Vector2> > points2, string title = "",
                                       Plot2DType plot2DType = Plot2DType.Line,
                                       bool closeShape       = true, MarkerType marker1 = MarkerType.Circle,
                                       MarkerType marker2    = MarkerType.Cross)
        {
            var window = new Window2DPlot(points1, points2, title, plot2DType, closeShape, marker1, marker2);

            window.ShowDialog();
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window2DPlot" /> class.
 /// </summary>
 /// <param name="points">The points.</param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="marker">The marker.</param>
 public Window2DPlot(IList <double[]> points, string title, Plot2DType plot2DType, bool closeShape, MarkerType marker)
     : this(title)
 {
     if (plot2DType == Plot2DType.Line)
     {
         AddLineSeriesToModel(points, closeShape, marker);
     }
     else
     {
         AddScatterSeriesToModel(points, marker);
     }
     InitializeComponent();
 }
Exemple #9
0
 public Window2DPlot(IEnumerable <PointLight> points, string title, Plot2DType plot2DType, bool closeShape,
                     MarkerType marker) : this(title)
 {
     if (plot2DType == Plot2DType.Line)
     {
         AddLineSeriesToModel(points.ToList(), closeShape, marker);
     }
     else
     {
         AddScatterSeriesToModel(points.ToList(), marker);
     }
     InitializeComponent();
 }
        public Window2DPlot(IEnumerable <IEnumerable <IEnumerable <Vector2> > > listofListOfListOfPoints,
                            string title, Plot2DType plot2DType, bool closeShape, MarkerType marker) : this(title)
        {
            var i = 0;

            var colorPalet = Presenter.ColorPalette();
            var maxLength  = colorPalet.Length;
            foreach (var listOfListOfPoints in listofListOfListOfPoints)
            {
                if (plot2DType == Plot2DType.Line)
                {
                    //Set each list of points as its own color.
                    //Close each list of points
                    foreach (var points in listOfListOfPoints)
                    {
                        var color = new Color(colorPalet[i]);
                        i++;
                        if (i == maxLength)
                        {
                            i = 0;
                        }
                        var series = new LineSeries
                        {
                            MarkerType = marker,
                            Color      = OxyColor.FromRgb(color.R, color.G, color.B)
                        };
                        foreach (var point in points)
                        {
                            series.Points.Add(new DataPoint(point.X, point.Y));
                        }
                        if (closeShape)
                        {
                            series.Points.Add(new DataPoint(points.First().X, points.First().Y));
                        }
                        Model.Series.Add(series);
                    }
                }
                else
                {
                    foreach (var points in listOfListOfPoints)
                    {
                        AddScatterSeriesToModel(points, marker);
                    }
                }
            }
            SetAxes(listofListOfListOfPoints.SelectMany(poly => poly.SelectMany(v => v)));
            InitializeComponent();
            Title = title;
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window2DPlot" /> class.
 /// </summary>
 /// <param name="points">The points.</param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="marker">The marker.</param>
 public Window2DPlot(IList <double[]> points, string title, Plot2DType plot2DType, bool closeShape, MarkerType marker)
     : this(title)
 {
     if (plot2DType == Plot2DType.Line)
     {
         AddLineSeriesToModel(points, closeShape, marker);
     }
     else
     {
         AddScatterSeriesToModel(points, marker);
     }
     SetAxes(points.Select(v => new Vector2(v[0], v[1])));
     InitializeComponent();
     Title = title;
 }
Exemple #12
0
 public static void ShowAndHang(Polygon polygon, string title = "", Plot2DType plot2DType = Plot2DType.Line,
                                bool closeShape = true, MarkerType marker = MarkerType.Circle)
 {
     ShowAndHang(new[] { polygon }, title, plot2DType, closeShape, marker);
 }
Exemple #13
0
        /// <summary>
        /// Shows the specified points.
        /// </summary>
        /// <param name="points">The points.</param>
        /// <param name="colors">The colors.</param>
        /// <param name="title">The title.</param>
        /// <param name="plot2DType">Type of the plot2 d.</param>
        /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
        /// <param name="marker">The marker.</param>
        public static void ShowAndHang(IList <List <double[]> > points, IList <Color> colors, string title = "", Plot2DType plot2DType = Plot2DType.Line,
                                       bool closeShape = true, MarkerType marker = MarkerType.Circle)
        {
            var window = new Window2DPlot(points, title, plot2DType, closeShape, marker, colors);

            window.ShowDialog();
        }
Exemple #14
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window2DPlot" /> class.
 /// </summary>
 /// <param name="listOfArrayOfPoints">The list of array of points.</param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="marker">The marker.</param>
 public Window2DPlot(IEnumerable <PointLight[]> listOfArrayOfPoints, string title, Plot2DType plot2DType, bool closeShape,
                     MarkerType marker) : this(title)
 {
     foreach (var points in listOfArrayOfPoints)
     {
         if (plot2DType == Plot2DType.Line)
         {
             AddLineSeriesToModel(points, closeShape, marker);
         }
         else
         {
             AddScatterSeriesToModel(points, marker);
         }
     }
     InitializeComponent();
 }
Exemple #15
0
        public static void ShowAndHang(IList <PolygonLight> polygons, string title = "", Plot2DType plot2DType = Plot2DType.Line,
                                       bool closeShape = true, MarkerType marker = MarkerType.Circle)
        {
            var points = polygons.Select(polygon => polygon.Path).ToList();
            var window = new Window2DPlot(points, title, plot2DType, closeShape, marker);

            window.ShowDialog();
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="Window2DPlot" /> class.
        /// </summary>
        /// <param name="listOfSeriesOfPoints">The list of array of points.</param>
        /// <param name="title">The title.</param>
        /// <param name="plot2DType">Type of the plot2 d.</param>
        /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
        /// <param name="marker">The marker.</param>
        public Window2DPlot(IList <List <double[]> > listOfSeriesOfPoints, string title, Plot2DType plot2DType, bool closeShape,
                            MarkerType marker, IList <TVGL.Color> colors = null) : this(title)
        {
            for (var i = 0; i < listOfSeriesOfPoints.Count(); i++)
            {
                //Note: both methods below will accept null colors, so set to null by default
                TVGL.Color color = null;
                if (colors != null)
                {
                    color = colors[i];
                }

                if (plot2DType == Plot2DType.Line)
                {
                    AddLineSeriesToModel(listOfSeriesOfPoints[i], closeShape, marker, color);
                }
                else
                {
                    AddScatterSeriesToModel(listOfSeriesOfPoints[i], marker, color);
                }
            }
            InitializeComponent();
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window2DPlot" /> class.
 /// </summary>
 /// <param name="listOfArrayOfPoints">The list of array of points.</param>
 /// <param name="title">The title.</param>
 /// <param name="plot2DType">Type of the plot2 d.</param>
 /// <param name="closeShape">if set to <c>true</c> [close shape].</param>
 /// <param name="marker">The marker.</param>
 public Window2DPlot(IEnumerable <IEnumerable <Vector2> > listOfArrayOfPoints, string title, Plot2DType plot2DType, bool closeShape,
                     MarkerType marker) : this(title)
 {
     foreach (var points in listOfArrayOfPoints)
     {
         if (!points.Any())
         {
             continue;
         }
         if (plot2DType == Plot2DType.Line)
         {
             AddLineSeriesToModel(points, closeShape, marker);
         }
         else
         {
             AddScatterSeriesToModel(points, marker);
         }
     }
     SetAxes(listOfArrayOfPoints.SelectMany(v => v));
     InitializeComponent();
     Title = title;
 }