Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Hive_Management_Console_Refactoring_Ticket508/HeuristicLab.Visualization/Legend/LegendShape.cs @ 1368

Last change on this file since 1368 was 1240, checked in by mstoeger, 15 years ago

Transformations on shapes are possible outside of the Draw method. (#424)

File size: 912 bytes
Line 
1using System.Collections.Generic;
2using HeuristicLab.Visualization.Legend;
3
4namespace HeuristicLab.Visualization.Legend {
5  public class LegendShape : WorldShape {
6    private readonly IList<LegendItem> legendItems = new List<LegendItem>();
7   
8    public LegendShape() {
9      CreateLegend();
10    }
11
12    public void CreateLegend() {
13      ClearShapes();
14      double y = ClippingArea.Y2;
15      foreach (LegendItem item in legendItems) {
16        AddShape(new LineShape(10, y - 10, 30, y - 10, item.Color, item.Thickness, DrawingStyle.Solid));
17        AddShape(new TextShape(35, y, item.Label));
18        y -= 15;
19      }
20    }
21
22    public void AddLegendItem(LegendItem item) {
23      legendItems.Add(item);
24    }
25
26    public void RemoveLegendItem(LegendItem item) {
27      legendItems.Remove(item);
28    }
29
30    public void ClearLegendItems() {
31      legendItems.Clear();
32    }
33  }
34}
Note: See TracBrowser for help on using the repository browser.