#region License Information
/* HeuristicLab
* Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace Visualization {
public partial class VisualizationForm : Form {
public double[][] Inputs { get; set; }
public List ConvexHull1 { get; set; }
public List ConvexHull2 { get; set; }
public VisualizationForm() {
InitializeComponent();
}
private void Visualization_Load(object sender, System.EventArgs e) {
Draw();
}
private void DrawPixel(int x, int y, Color color, Bitmap image) {
using (Graphics g = Graphics.FromImage(image)) {
using (Brush b = new SolidBrush(color)) {
g.FillEllipse(b, x, y, 5, 5);
}
}
}
private void Draw() {
Bitmap image = new Bitmap(pictureBox.Width, pictureBox.Height);
foreach (var input in Inputs) {
DrawPixel((int)input.First(), (int)input.Last(), Color.Black, image);
}
foreach (var input in ConvexHull1) {
DrawPixel((int)input.First() + 1, (int)input.Last() + 1, Color.Red, image);
}
foreach (var input in ConvexHull2) {
DrawPixel((int)input.First(), (int)input.Last(), Color.Blue, image);
}
pictureBox.Image = image;
}
}
}