Changeset 4349


Ignore:
Timestamp:
08/31/10 14:51:43 (10 years ago)
Author:
svonolfe
Message:

Added a tour view for a VRP solution (#1039)

Location:
branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.3/VRPSolutionView.Designer.cs

    r4185 r4349  
    5050      this.valueTabPage = new System.Windows.Forms.TabPage();
    5151      this.tourGroupBox = new System.Windows.Forms.GroupBox();
    52       this.tourViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
     52      this.tourGridView = new System.Windows.Forms.DataGridView();
    5353      this.tabControl.SuspendLayout();
    5454      this.visualizationTabPage.SuspendLayout();
     
    5656      this.valueTabPage.SuspendLayout();
    5757      this.tourGroupBox.SuspendLayout();
     58      ((System.ComponentModel.ISupportInitialize)(this.tourGridView)).BeginInit();
    5859      this.SuspendLayout();
    5960      //
     
    100101      this.valueTabPage.Name = "valueTabPage";
    101102      this.valueTabPage.Padding = new System.Windows.Forms.Padding(3);
    102       this.valueTabPage.Size = new System.Drawing.Size(415, 398);
     103      this.valueTabPage.Size = new System.Drawing.Size(415, 532);
    103104      this.valueTabPage.TabIndex = 1;
    104105      this.valueTabPage.Text = "Value";
     
    107108      // tourGroupBox
    108109      //
    109       this.tourGroupBox.Controls.Add(this.tourViewHost);
     110      this.tourGroupBox.Controls.Add(this.tourGridView);
    110111      this.tourGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
    111112      this.tourGroupBox.Location = new System.Drawing.Point(3, 3);
    112113      this.tourGroupBox.Name = "tourGroupBox";
    113       this.tourGroupBox.Size = new System.Drawing.Size(409, 392);
     114      this.tourGroupBox.Size = new System.Drawing.Size(409, 526);
    114115      this.tourGroupBox.TabIndex = 0;
    115116      this.tourGroupBox.TabStop = false;
    116117      this.tourGroupBox.Text = "Tour";
    117118      //
    118       // tourViewHost
     119      // tourGridView
    119120      //
    120       this.tourViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    121                   | System.Windows.Forms.AnchorStyles.Left)
    122                   | System.Windows.Forms.AnchorStyles.Right)));
    123       this.tourViewHost.Caption = "View";
    124       this.tourViewHost.Content = null;
    125       this.tourViewHost.Location = new System.Drawing.Point(6, 19);
    126       this.tourViewHost.Name = "tourViewHost";
    127       this.tourViewHost.ReadOnly = false;
    128       this.tourViewHost.Size = new System.Drawing.Size(397, 367);
    129       this.tourViewHost.TabIndex = 0;
    130       this.tourViewHost.ViewType = null;
     121      this.tourGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     122      this.tourGridView.Dock = System.Windows.Forms.DockStyle.Fill;
     123      this.tourGridView.Location = new System.Drawing.Point(3, 16);
     124      this.tourGridView.Name = "tourGridView";
     125      this.tourGridView.Size = new System.Drawing.Size(403, 507);
     126      this.tourGridView.TabIndex = 0;
    131127      //
    132128      // VRPSolutionView
     
    142138      this.valueTabPage.ResumeLayout(false);
    143139      this.tourGroupBox.ResumeLayout(false);
     140      ((System.ComponentModel.ISupportInitialize)(this.tourGridView)).EndInit();
    144141      this.ResumeLayout(false);
    145142
     
    153150    private System.Windows.Forms.TabPage valueTabPage;
    154151    private System.Windows.Forms.GroupBox tourGroupBox;
    155     private MainForm.WindowsForms.ViewHost tourViewHost;
     152    private System.Windows.Forms.DataGridView tourGridView;
    156153
    157154
  • branches/VRP/HeuristicLab.Problems.VehicleRouting.Views/3.3/VRPSolutionView.cs

    r4268 r4349  
    2828using HeuristicLab.Problems.VehicleRouting.Encodings;
    2929using HeuristicLab.Parameters;
     30using System.Linq;
    3031
    3132namespace HeuristicLab.Problems.VehicleRouting.Views {
     
    6869      } else {
    6970        GenerateImage();
    70         tourViewHost.Content = Content.Solution;
     71        UpdateTourView();
    7172      }
    7273    }
     
    8182      pictureBox.Enabled = Content != null;
    8283      tourGroupBox.Enabled = Content != null;
     84    }
     85
     86    private void UpdateTourView() {
     87      tourGridView.Rows.Clear();
     88      tourGridView.ColumnCount = Content.Coordinates.Rows - 1;
     89
     90      if (Content != null && Content.Solution != null) {
     91        foreach (Tour tour in Content.Solution.GetTours(new ValueLookupParameter<DoubleMatrix>("DistanceMatrix", Content.DistanceMatrix))) {
     92          int row = tourGridView.Rows.Add();
     93          int cell = 0;
     94          foreach (int city in tour.Cities) {
     95            tourGridView.Rows[row].Cells[cell].Value = city;
     96            cell++;
     97          }
     98        }
     99      }
    83100    }
    84101
     
    203220      else {
    204221        GenerateImage();
    205         tourViewHost.Content = Content.Solution;
     222        UpdateTourView();
    206223      }
    207224    }
Note: See TracChangeset for help on using the changeset viewer.