Changeset 6715
- Timestamp:
- 09/07/11 09:57:12 (13 years ago)
- Location:
- branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/CVRPPDTWView.cs
r6710 r6715 23 23 } 24 24 25 private bool drawFlow = false; 26 27 protected override void pictureBox_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { 28 if (e.Button == System.Windows.Forms.MouseButtons.Right) { 29 drawFlow = !drawFlow; 30 GenerateImage(); 31 } 32 } 33 25 34 protected override void DrawVisualization(Bitmap bitmap) { 26 35 DoubleMatrix coordinates = Content.Coordinates; … … 39 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)), 40 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 Pen flowPen = new Pen(Brushes.Red, 3); 52 flowPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; 53 flowPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; 41 54 42 55 if ((coordinates != null) && (coordinates.Rows > 0) && (coordinates.Columns == 2)) { … … 88 101 customerBrush = Brushes.Orange; 89 102 customerPen = Pens.Orange; 90 103 91 104 } else if (t > dueTime[location]) { 92 105 customerBrush = Brushes.Red; … … 108 121 } 109 122 110 graphics.DrawPolygon(pens[((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints); 123 if (!drawFlow) 124 graphics.DrawPolygon(pens[((currentTour >= pens.Length) ? (pens.Length - 1) : (currentTour))], tourPoints); 111 125 112 126 for (int i = 0; i < tour.Stops.Count; i++) { 113 if (validPickupDelivery[i])127 if (validPickupDelivery[i]) { 114 128 graphics.FillRectangle(customerBrushes[i], tourPoints[i + 1].X - 3, tourPoints[i + 1].Y - 3, 6, 6); 115 else 129 130 if (demand[tour.Stops[i]] < 0 && drawFlow) { 131 int location = pickupDeliveryLocation[tour.Stops[i]]; 132 int source = tour.Stops.IndexOf(location); 133 134 graphics.DrawLine(flowPen, tourPoints[source + 1], tourPoints[i + 1]); 135 } 136 } else 116 137 graphics.DrawRectangle(customerPens[i], tourPoints[i + 1].X - 3, tourPoints[i + 1].Y - 3, 6, 6); 117 138 } … … 122 143 } 123 144 } else { 124 Point locationPoint; 125 //just draw customers 126 for (int i = 1; i < coordinates.Rows; i++) { 127 locationPoint = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)), 128 bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep)))); 145 { 146 Point locationPoint; 147 //just draw customers 148 for (int i = 1; i < coordinates.Rows; i++) { 149 locationPoint = new Point(border + ((int)((coordinates[i, 0] - xMin) * xStep)), 150 bitmap.Height - (border + ((int)((coordinates[i, 1] - yMin) * yStep)))); 129 151 130 graphics.FillRectangle(Brushes.Black, locationPoint.X - 3, locationPoint.Y - 3, 6, 6); 152 graphics.FillRectangle(Brushes.Black, locationPoint.X - 3, locationPoint.Y - 3, 6, 6); 153 } 154 155 locationPoint = new Point(border + ((int)((coordinates[0, 0] - xMin) * xStep)), 156 bitmap.Height - (border + ((int)((coordinates[0, 1] - yMin) * yStep)))); 157 graphics.FillEllipse(Brushes.Blue, locationPoint.X - 5, locationPoint.Y - 5, 10, 10); 131 158 } 132 133 locationPoint = new Point(border + ((int)((coordinates[0, 0] - xMin) * xStep)),134 bitmap.Height - (border + ((int)((coordinates[0, 1] - yMin) * yStep))));135 graphics.FillEllipse(Brushes.Blue, locationPoint.X - 5, locationPoint.Y - 5, 10, 10);136 159 } 137 160 } … … 140 163 for (int i = 0; i < pens.Length; i++) 141 164 pens[i].Dispose(); 165 166 flowPen.Dispose(); 142 167 } 143 168 } -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPProblemInstanceView.Designer.cs
r4374 r6715 39 39 this.pictureBox.TabStop = false; 40 40 this.pictureBox.SizeChanged += new System.EventHandler(this.pictureBox_SizeChanged); 41 this.pictureBox.MouseClick += new System.Windows.Forms.MouseEventHandler(pictureBox_MouseClick); 41 42 // 42 43 // VRPProblemInstanceView … … 50 51 51 52 } 52 53 53 #endregion 54 54 -
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.4/VRPProblemInstanceView.cs
r4374 r6715 69 69 } 70 70 71 protected virtual void pictureBox_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { 72 } 73 71 74 protected abstract void DrawVisualization(Bitmap bitmap); 72 75 73 pr ivatevoid GenerateImage() {76 protected void GenerateImage() { 74 77 if ((pictureBox.Width > 0) && (pictureBox.Height > 0)) { 75 78 if (Content == null) {
Note: See TracChangeset
for help on using the changeset viewer.