Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/12/16 14:35:31 (9 years ago)
Author:
jkarder
Message:

#1265: worked on visualization

  • brought back support for SnapToGrid methods
  • updated license headers
Location:
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Chart.cs

    r13717 r13753  
    8181    public double MinimumZoomDistance { get; set; }
    8282    public IGroup Group { get; protected set; }
     83    public IGrid Grid { get; protected set; }
    8384
    8485    public Chart(PointD lowerLeft, PointD upperRight) {
     
    8990      Scale = 1.0;
    9091      Group = new Group(this);
     92      Grid = new Grid(this);
    9193      renderStages = new List<RenderStage> {
    9294        new BackgroundColorRenderStage(this),
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/HeuristicLab.Visualization-3.3.csproj

    r13716 r13753  
    133133    <Compile Include="ChartModes\PanChartMode.cs" />
    134134    <Compile Include="ChartModes\RulerChartMode.cs" />
     135    <Compile Include="Interfaces\IDrawable.cs" />
    135136    <Compile Include="PrimitiveAttribute.cs" />
    136137    <Compile Include="Primitives\Grid.cs" />
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Interfaces/IChart.cs

    r13717 r13753  
    3737    SizeD WorldToPixelRatio { get; }
    3838    IGroup Group { get; }
     39    IGrid Grid { get; }
    3940
    4041    PointD TransformPixelToWorld(Point point);
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Interfaces/IGrid.cs

    r13045 r13753  
    1 
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
    222namespace HeuristicLab.Visualization {
    3   public interface IGrid {
     23  public interface IGrid : IDrawable {
    424    PointD Origin { get; set; }
    525    double XPrecision { get; }
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Interfaces/IPrimitive.cs

    r13717 r13753  
    2525
    2626namespace HeuristicLab.Visualization {
    27   public interface IPrimitive {
     27  public interface IPrimitive : IDrawable {
    2828    Pen Pen { get; set; }
    2929    Brush Brush { get; set; }
     
    4141    Cursor GetCursor(PointD point);
    4242    string GetToolTipText(PointD point);
    43 
    44     void PreDraw(Graphics graphics);
    45     void Draw(Graphics graphics);
    46     void PostDraw(Graphics graphics);
    47 
    48     event EventHandler RedrawRequired;
    4943  }
    5044}
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Plugin.cs.frame

    r13045 r13753  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Grid.cs

    r13045 r13753  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Drawing;
    324
     
    728
    829    public virtual PointD Origin { get; set; }
    9     public virtual PointD Offset { get; set; }
    10     public virtual SizeD Size { get; set; }
    11 
    1230    public virtual double XPrecision { get; set; }
    1331    public virtual double YPrecision { get; set; }
     
    3351    }
    3452
    35     public Grid(IChart chart, PointD offset, SizeD size)
    36       : this(chart, offset, size, 1) { }
    37     public Grid(IChart chart, PointD offset, SizeD size, double precision)
    38       : base(chart) {
     53    public Grid(IChart chart) : this(chart, 1.0) { }
     54    public Grid(IChart chart, double precision) : base(chart) {
    3955      Origin = new PointD(0, 0);
    40       Offset = offset;
    41       Size = size;
    4256      XPrecision = precision;
    4357      YPrecision = precision;
     
    4862    }
    4963
    50     public override void Move(Offset delta) {
    51       Offset += delta;
    52     }
     64    public override void Move(Offset delta) { }
    5365
    54     public override void Move(PointD point, Offset delta) {
    55       Move(delta);
    56     }
     66    public override void Move(PointD point, Offset delta) { }
    5767
    5868    public override void SnapToGrid(IGrid grid) { }
     
    6171
    6272    public override void Draw(Graphics graphics) {
    63       if (!(Size.Width > 0) || !(Size.Height > 0)) return;
     73      if (!(Chart.Size.Width > 0) || !(Chart.Size.Height > 0)) return;
    6474      graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
    6575      var pen = new Pen(Color.LightGray, 1.0f);
    66       var pixelSize = Chart.TransformWorldToPixel(Size); // size of the drawing area in pixel coordinates
     76      var pixelSize = Chart.TransformWorldToPixel(Chart.Size); // size of the drawing area in pixel coordinates
    6777
    6878      var numberOfXParallelLines = (int)Math.Floor(pixelSize.Height / (double)CellSpacing); // how many x parallel lines can be drawn
    6979      var numberOfYParallelLines = (int)Math.Floor(pixelSize.Width / (double)CellSpacing); // how many y parallel lines can be drawn
    7080      if (numberOfXParallelLines <= 0 || numberOfYParallelLines <= 0) return;
    71       var cellWorldSize = new SizeD(Size.Width / numberOfYParallelLines, Size.Height / numberOfXParallelLines); // the cellSize in world coordinates
     81      var cellWorldSize = new SizeD(Chart.Size.Width / numberOfYParallelLines, Chart.Size.Height / numberOfXParallelLines); // the cellSize in world coordinates
    7282      cellWorldSize.Width = Math.Pow(10, Math.Floor(Math.Log10(cellWorldSize.Width)));
    7383      cellWorldSize.Height = Math.Pow(10, Math.Floor(Math.Log10(cellWorldSize.Width)));
     
    8191        cellPixelSize = Chart.TransformWorldToPixel(cellWorldSize);
    8292      }
    83       var firstX = Math.Floor(Offset.X / cellWorldSize.Width) * cellWorldSize.Width;
    84       var firstY = Math.Floor(Offset.Y / cellWorldSize.Height) * cellWorldSize.Height;
     93      var firstX = Math.Floor(Chart.LowerLeft.X / cellWorldSize.Width) * cellWorldSize.Width;
     94      var firstY = Math.Floor(Chart.LowerLeft.Y / cellWorldSize.Height) * cellWorldSize.Height;
    8595      double x = firstX, y = firstY;
    8696      var axisyLabel = new Font(FontFamily.GenericMonospace, 7.0f, FontStyle.Regular, GraphicsUnit.Point, 0);
     
    8898      var axisDrawing = new SolidBrush(Color.DarkGray);
    8999      try {
    90         var bottom = Chart.TransformWorldToPixel(Size).Height;
    91         while (x <= Offset.X + Size.Width) {
     100        var bottom = Chart.TransformWorldToPixel(Chart.Size).Height;
     101        while (x <= Chart.LowerLeft.X + Chart.Size.Width) {
    92102          var start = Chart.TransformWorldToPixel(new PointD(x, firstY));
    93           var end = Chart.TransformWorldToPixel(new PointD(x, Offset.Y + Size.Height));
     103          var end = Chart.TransformWorldToPixel(new PointD(x, Chart.LowerLeft.Y + Chart.Size.Height));
    94104          graphics.DrawLine(pen, start, end);
    95105          var axis = x.ToString("0.##");
     
    98108          x += cellWorldSize.Width;
    99109        }
    100         while (y <= Offset.Y + Size.Height) {
     110        while (y <= Chart.LowerLeft.Y + Chart.Size.Height) {
    101111          var start = Chart.TransformWorldToPixel(new PointD(firstX, y));
    102           var end = Chart.TransformWorldToPixel(new PointD(Offset.X + Size.Width, y));
     112          var end = Chart.TransformWorldToPixel(new PointD(Chart.LowerLeft.X + Chart.Size.Width, y));
    103113          graphics.DrawLine(pen, start, end);
    104114          graphics.DrawString(y.ToString("0.##"), axisxLabel, axisDrawing, 0, start.Y);
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Properties/AssemblyInfo.frame

    r13045 r13753  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3232[assembly: AssemblyCompany("")]
    3333[assembly: AssemblyProduct("HeuristicLab")]
    34 [assembly: AssemblyCopyright("(c) 2002-2015 HEAL")]
     34[assembly: AssemblyCopyright("(c) 2002-2016 HEAL")]
    3535[assembly: AssemblyTrademark("")]
    3636[assembly: AssemblyCulture("")]
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/RenderStages/GridRenderStage.cs

    r13717 r13753  
    2727
    2828    public override void Render(Graphics graphics) {
    29       var grid = new Grid(chart, chart.LowerLeft, chart.Size);
    30       grid.PreDraw(graphics);
    31       grid.Draw(graphics);
    32       grid.PostDraw(graphics);
     29      if (chart.Grid == null) return;
     30
     31      chart.Grid.PreDraw(graphics);
     32      chart.Grid.Draw(graphics);
     33      chart.Grid.PostDraw(graphics);
    3334    }
    3435  }
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/RenderStages/GroupRenderStage.cs

    r13717 r13753  
    2727
    2828    public override void Render(Graphics graphics) {
     29      if (chart.Group == null) return;
     30
    2931      chart.Group.PreDraw(graphics);
    3032      chart.Group.Draw(graphics);
Note: See TracChangeset for help on using the changeset viewer.