Changeset 7858
- Timestamp:
- 05/21/12 15:28:50 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPPDTWView.cs
r6851 r7858 42 42 IntArray pickupDeliveryLocation = Content.PickupDeliveryLocation; 43 43 44 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)),45 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)),46 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)),47 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)),48 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)),49 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)};50 51 44 Pen flowPen = new Pen(Brushes.Red, 3); 52 45 flowPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; … … 69 62 if (Solution != null) { 70 63 int currentTour = 0; 71 foreach (Tour tour in Solution.GetTours()) { 64 65 List<Tour> tours = Solution.GetTours(); 66 List<Pen> pens = GetColors(tours.Count); 67 68 foreach (Tour tour in tours) { 72 69 double t = 0.0; 73 70 Point[] tourPoints = new Point[tour.Stops.Count + 2]; … … 122 119 123 120 if (!drawFlow) 124 graphics.DrawPolygon(pens[ ((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints);121 graphics.DrawPolygon(pens[currentTour], tourPoints); 125 122 126 123 for (int i = 0; i < tour.Stops.Count; i++) { … … 142 139 currentTour++; 143 140 } 141 142 for (int i = 0; i < pens.Count; i++) 143 pens[i].Dispose(); 144 144 } else { 145 145 { … … 170 170 } 171 171 172 for (int i = 0; i < pens.Length; i++)173 pens[i].Dispose();174 175 172 flowPen.Dispose(); 176 173 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPTWView.cs
r6851 r7858 31 31 DoubleArray readyTime = Content.ReadyTime; 32 32 33 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)),34 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)),35 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)),36 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)),37 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)),38 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)};39 40 33 if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2)) { 41 34 double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue; … … 54 47 if (Solution != null) { 55 48 int currentTour = 0; 56 foreach (Tour tour in Solution.GetTours()) { 49 50 List<Tour> tours = Solution.GetTours(); 51 List<Pen> pens = GetColors(tours.Count); 52 53 foreach (Tour tour in tours) { 57 54 double t = 0.0; 58 55 Point[] tourPoints = new Point[tour.Stops.Count + 2]; … … 91 88 } 92 89 93 graphics.DrawPolygon(pens[ ((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints);90 graphics.DrawPolygon(pens[currentTour], tourPoints); 94 91 95 92 for (int i = 0; i < tour.Stops.Count; i++) { … … 101 98 currentTour++; 102 99 } 100 101 for (int i = 0; i < pens.Count; i++) 102 pens[i].Dispose(); 103 103 } else { 104 104 Point locationPoint; … … 117 117 } 118 118 } 119 120 for (int i = 0; i < pens.Length; i++)121 pens[i].Dispose();122 119 } 123 120 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MDCVRPPDTWView.cs
r6947 r7858 46 46 int cities = Content.Cities.Value; 47 47 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 55 48 Pen flowPen = new Pen(Brushes.Red, 3); 56 49 flowPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; … … 79 72 80 73 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) { 82 79 int tourIndex = Solution.GetTourIndex(tour); 83 80 int vehicle = Solution.GetVehicleAssignment(tourIndex); … … 148 145 149 146 if (!drawFlow) 150 graphics.DrawPolygon(pens[ ((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints);147 graphics.DrawPolygon(pens[currentTour], tourPoints); 151 148 152 149 for (int i = 0; i < tour.Stops.Count; i++) { … … 168 165 currentTour++; 169 166 } 167 168 for (int i = 0; i < pens.Count; i++) 169 pens[i].Dispose(); 170 170 } else { 171 171 { … … 197 197 } 198 198 199 for (int i = 0; i < pens.Length; i++)200 pens[i].Dispose();201 202 199 flowPen.Dispose(); 203 200 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MDCVRPTWView.cs
r6854 r7858 34 34 int depots = Content.Depots.Value; 35 35 36 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)),37 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)),38 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)),39 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)),40 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)),41 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)};42 43 36 if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2)) { 44 37 double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue; … … 63 56 64 57 int currentTour = 0; 65 foreach (Tour tour in Solution.GetTours()) { 58 59 List<Tour> tours = Solution.GetTours(); 60 List<Pen> pens = GetColors(tours.Count); 61 62 foreach (Tour tour in tours) { 66 63 int tourIndex = Solution.GetTourIndex(tour); 67 64 int vehicle = Solution.GetVehicleAssignment(tourIndex); … … 116 113 } 117 114 118 graphics.DrawPolygon(pens[ ((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints);115 graphics.DrawPolygon(pens[currentTour], tourPoints); 119 116 120 117 for (int i = 0; i < tour.Stops.Count; i++) { … … 126 123 currentTour++; 127 124 } 125 126 for (int i = 0; i < pens.Count; i++) 127 pens[i].Dispose(); 128 128 } else { 129 129 Point locationPoint; … … 144 144 } 145 145 } 146 147 for (int i = 0; i < pens.Length; i++)148 pens[i].Dispose();149 146 } 150 147 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/MultiDepotVRPView.cs
r6851 r7858 28 28 BoolValue useDistanceMatrix = Content.UseDistanceMatrix; 29 29 30 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)),31 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)),32 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)),33 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)),34 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)),35 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)};36 37 38 30 if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2)) { 39 31 double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue; … … 58 50 59 51 int currentTour = 0; 60 foreach (Tour tour in Solution.GetTours()) { 52 53 List<Tour> tours = Solution.GetTours(); 54 List<Pen> pens = GetColors(tours.Count); 55 56 foreach (Tour tour in tours) { 61 57 Point[] tourPoints = new Point[tour.Stops.Count + 2]; 62 58 Brush[] customerBrushes = new Brush[tour.Stops.Count]; … … 93 89 } 94 90 95 graphics.DrawPolygon(pens[ ((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints);91 graphics.DrawPolygon(pens[currentTour], tourPoints); 96 92 97 93 for (int i = 0; i < tour.Stops.Count; i++) { … … 103 99 currentTour++; 104 100 } 101 102 for (int i = 0; i < pens.Count; i++) 103 pens[i].Dispose(); 105 104 } else { 106 105 Point locationPoint; … … 121 120 } 122 121 } 123 124 for (int i = 0; i < pens.Length; i++)125 pens[i].Dispose();126 122 } 127 123 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/SingleDepotVRPView.cs
r4374 r7858 28 28 BoolValue useDistanceMatrix = Content.UseDistanceMatrix; 29 29 30 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)),31 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)),32 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)),33 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)),34 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)),35 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)};36 37 38 30 if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2)) { 39 31 double xMin = double.MaxValue, yMin = double.MaxValue, xMax = double.MinValue, yMax = double.MinValue; … … 51 43 using (Graphics graphics = Graphics.FromImage(bitmap)) { 52 44 if (Solution != null) { 45 List<Tour> tours = Solution.GetTours(); 46 List<Pen> pens = GetColors(tours.Count); 47 53 48 int currentTour = 0; 54 foreach (Tour tour in Solution.GetTours()) {49 foreach (Tour tour in tours) { 55 50 Point[] tourPoints = new Point[tour.Stops.Count + 2]; 56 51 Brush[] customerBrushes = new Brush[tour.Stops.Count]; … … 76 71 } 77 72 78 graphics.DrawPolygon(pens[ ((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints);73 graphics.DrawPolygon(pens[currentTour], tourPoints); 79 74 80 75 for (int i = 0; i < tour.Stops.Count; i++) { … … 86 81 currentTour++; 87 82 } 83 84 for (int i = 0; i < pens.Count; i++) 85 pens[i].Dispose(); 88 86 } else { 89 87 Point locationPoint; … … 102 100 } 103 101 } 104 105 for (int i = 0; i < pens.Length; i++)106 pens[i].Dispose();107 102 } 108 103 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPProblemInstanceView.cs
r6715 r7858 74 74 protected abstract void DrawVisualization(Bitmap bitmap); 75 75 76 protected List<Pen> GetColors(int count) { 77 List<Pen> result = new List<Pen>(); 78 79 int i = 0; 80 81 int r = 255; 82 int g = 255; 83 int b = 255; 84 85 int step = Math.Max(1, 200 * 6 / count); 86 87 while (result.Count != count) { 88 switch (i) { 89 case 0: result.Add(new Pen(Color.FromArgb(0, 0, b))); 90 break; 91 case 1: result.Add(new Pen(Color.FromArgb(0, g, 0))); 92 break; 93 case 2: result.Add(new Pen(Color.FromArgb(r, 0, 0))); 94 break; 95 case 3: result.Add(new Pen(Color.FromArgb(0, g, b))); 96 break; 97 case 4: result.Add(new Pen(Color.FromArgb(r, 0, b))); 98 break; 99 case 5: result.Add(new Pen(Color.FromArgb(r, g, 0))); 100 break; 101 } 102 103 i++; 104 if (i == 6) { 105 i = 0; 106 107 if(r >= step) 108 r -= step; 109 110 if(g >= step) 111 g -= step; 112 113 if(b >= step) 114 b -= step; 115 } 116 } 117 118 return result; 119 } 120 76 121 protected void GenerateImage() { 77 122 if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) {
Note: See TracChangeset
for help on using the changeset viewer.