Changeset 13753 for branches/HeuristicLab.Visualization
- Timestamp:
- 04/12/16 14:35:31 (9 years ago)
- 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 81 81 public double MinimumZoomDistance { get; set; } 82 82 public IGroup Group { get; protected set; } 83 public IGrid Grid { get; protected set; } 83 84 84 85 public Chart(PointD lowerLeft, PointD upperRight) { … … 89 90 Scale = 1.0; 90 91 Group = new Group(this); 92 Grid = new Grid(this); 91 93 renderStages = new List<RenderStage> { 92 94 new BackgroundColorRenderStage(this), -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/HeuristicLab.Visualization-3.3.csproj
r13716 r13753 133 133 <Compile Include="ChartModes\PanChartMode.cs" /> 134 134 <Compile Include="ChartModes\RulerChartMode.cs" /> 135 <Compile Include="Interfaces\IDrawable.cs" /> 135 136 <Compile Include="PrimitiveAttribute.cs" /> 136 137 <Compile Include="Primitives\Grid.cs" /> -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Interfaces/IChart.cs
r13717 r13753 37 37 SizeD WorldToPixelRatio { get; } 38 38 IGroup Group { get; } 39 IGrid Grid { get; } 39 40 40 41 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 2 22 namespace HeuristicLab.Visualization { 3 public interface IGrid {23 public interface IGrid : IDrawable { 4 24 PointD Origin { get; set; } 5 25 double XPrecision { get; } -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Interfaces/IPrimitive.cs
r13717 r13753 25 25 26 26 namespace HeuristicLab.Visualization { 27 public interface IPrimitive {27 public interface IPrimitive : IDrawable { 28 28 Pen Pen { get; set; } 29 29 Brush Brush { get; set; } … … 41 41 Cursor GetCursor(PointD point); 42 42 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;49 43 } 50 44 } -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Plugin.cs.frame
r13045 r13753 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * 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 22 using System; 2 23 using System.Drawing; 3 24 … … 7 28 8 29 public virtual PointD Origin { get; set; } 9 public virtual PointD Offset { get; set; }10 public virtual SizeD Size { get; set; }11 12 30 public virtual double XPrecision { get; set; } 13 31 public virtual double YPrecision { get; set; } … … 33 51 } 34 52 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) { 39 55 Origin = new PointD(0, 0); 40 Offset = offset;41 Size = size;42 56 XPrecision = precision; 43 57 YPrecision = precision; … … 48 62 } 49 63 50 public override void Move(Offset delta) { 51 Offset += delta; 52 } 64 public override void Move(Offset delta) { } 53 65 54 public override void Move(PointD point, Offset delta) { 55 Move(delta); 56 } 66 public override void Move(PointD point, Offset delta) { } 57 67 58 68 public override void SnapToGrid(IGrid grid) { } … … 61 71 62 72 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; 64 74 graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; 65 75 var pen = new Pen(Color.LightGray, 1.0f); 66 var pixelSize = Chart.TransformWorldToPixel( Size); // size of the drawing area in pixel coordinates76 var pixelSize = Chart.TransformWorldToPixel(Chart.Size); // size of the drawing area in pixel coordinates 67 77 68 78 var numberOfXParallelLines = (int)Math.Floor(pixelSize.Height / (double)CellSpacing); // how many x parallel lines can be drawn 69 79 var numberOfYParallelLines = (int)Math.Floor(pixelSize.Width / (double)CellSpacing); // how many y parallel lines can be drawn 70 80 if (numberOfXParallelLines <= 0 || numberOfYParallelLines <= 0) return; 71 var cellWorldSize = new SizeD( Size.Width / numberOfYParallelLines,Size.Height / numberOfXParallelLines); // the cellSize in world coordinates81 var cellWorldSize = new SizeD(Chart.Size.Width / numberOfYParallelLines, Chart.Size.Height / numberOfXParallelLines); // the cellSize in world coordinates 72 82 cellWorldSize.Width = Math.Pow(10, Math.Floor(Math.Log10(cellWorldSize.Width))); 73 83 cellWorldSize.Height = Math.Pow(10, Math.Floor(Math.Log10(cellWorldSize.Width))); … … 81 91 cellPixelSize = Chart.TransformWorldToPixel(cellWorldSize); 82 92 } 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; 85 95 double x = firstX, y = firstY; 86 96 var axisyLabel = new Font(FontFamily.GenericMonospace, 7.0f, FontStyle.Regular, GraphicsUnit.Point, 0); … … 88 98 var axisDrawing = new SolidBrush(Color.DarkGray); 89 99 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) { 92 102 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)); 94 104 graphics.DrawLine(pen, start, end); 95 105 var axis = x.ToString("0.##"); … … 98 108 x += cellWorldSize.Width; 99 109 } 100 while (y <= Offset.Y +Size.Height) {110 while (y <= Chart.LowerLeft.Y + Chart.Size.Height) { 101 111 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)); 103 113 graphics.DrawLine(pen, start, end); 104 114 graphics.DrawString(y.ToString("0.##"), axisxLabel, axisDrawing, 0, start.Y); -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Properties/AssemblyInfo.frame
r13045 r13753 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 32 32 [assembly: AssemblyCompany("")] 33 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-201 5HEAL")]34 [assembly: AssemblyCopyright("(c) 2002-2016 HEAL")] 35 35 [assembly: AssemblyTrademark("")] 36 36 [assembly: AssemblyCulture("")] -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/RenderStages/GridRenderStage.cs
r13717 r13753 27 27 28 28 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); 33 34 } 34 35 } -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/RenderStages/GroupRenderStage.cs
r13717 r13753 27 27 28 28 public override void Render(Graphics graphics) { 29 if (chart.Group == null) return; 30 29 31 chart.Group.PreDraw(graphics); 30 32 chart.Group.Draw(graphics);
Note: See TracChangeset
for help on using the changeset viewer.