Ignore:
Timestamp:
05/21/12 15:28:50 (7 years ago)
Author:
svonolfe
Message:

Added color palette (#1177)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MDCVRPPDTWView.cs

    r6947 r7858  
    4646      int cities = Content.Cities.Value;
    4747
    48       Pen[] pens = {new Pen(Color.FromArgb(92,20,237)), new Pen(Color.FromArgb(237,183,20)), new Pen(Color.FromArgb(237,20,219)), new Pen(Color.FromArgb(20,237,76)),
    49                     new Pen(Color.FromArgb(237,61,20)), new Pen(Color.FromArgb(115,78,26)), new Pen(Color.FromArgb(20,237,229)), new Pen(Color.FromArgb(39,101,19)),
    50                     new Pen(Color.FromArgb(230,170,229)), new Pen(Color.FromArgb(142,136,89)), new Pen(Color.FromArgb(157,217,166)), new Pen(Color.FromArgb(31,19,101)),
    51                     new Pen(Color.FromArgb(173,237,20)), new Pen(Color.FromArgb(230,231,161)), new Pen(Color.FromArgb(142,89,89)), new Pen(Color.FromArgb(93,89,142)),
    52                     new Pen(Color.FromArgb(146,203,217)), new Pen(Color.FromArgb(101,19,75)), new Pen(Color.FromArgb(198,20,237)), new Pen(Color.FromArgb(185,185,185)),
    53                     new Pen(Color.FromArgb(179,32,32)), new Pen(Color.FromArgb(18,119,115)), new Pen(Color.FromArgb(104,158,239)), new Pen(Color.Black)};
    54 
    5548      Pen flowPen = new Pen(Brushes.Red, 3);
    5649      flowPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor;
     
    7972
    8073            int currentTour = 0;
    81             foreach (Tour tour in Solution.GetTours()) {
     74
     75            List<Tour> tours = Solution.GetTours();
     76            List<Pen> pens = GetColors(tours.Count);
     77
     78            foreach (Tour tour in tours) {
    8279              int tourIndex = Solution.GetTourIndex(tour);
    8380              int vehicle = Solution.GetVehicleAssignment(tourIndex);
     
    148145
    149146              if (!drawFlow)
    150                 graphics.DrawPolygon(pens[((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints);
     147                graphics.DrawPolygon(pens[currentTour], tourPoints);
    151148
    152149              for (int i = 0; i < tour.Stops.Count; i++) {
     
    168165              currentTour++;
    169166            }
     167
     168            for (int i = 0; i < pens.Count; i++)
     169              pens[i].Dispose();
    170170          } else {
    171171            {
     
    197197      }
    198198
    199       for (int i = 0; i < pens.Length; i++)
    200         pens[i].Dispose();
    201 
    202199      flowPen.Dispose();
    203200    }
Note: See TracChangeset for help on using the changeset viewer.