Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/01/10 11:13:46 (15 years ago)
Author:
svonolfe
Message:

Merged r4351 of the VRP feature branch into trunk (#1039)

Location:
trunk/sources/HeuristicLab.Problems.VehicleRouting.Views
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting.Views

  • trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VRPSolutionView.Designer.cs

    r4185 r4352  
    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
  • trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VRPSolutionView.cs

    r4185 r4352  
    2727using HeuristicLab.MainForm;
    2828using HeuristicLab.Problems.VehicleRouting.Encodings;
     29using HeuristicLab.Parameters;
     30using System.Linq;
    2931
    3032namespace HeuristicLab.Problems.VehicleRouting.Views {
     
    6769      } else {
    6870        GenerateImage();
    69         tourViewHost.Content = Content.Solution;
     71        UpdateTourView();
    7072      }
    7173    }
     
    8082      pictureBox.Enabled = Content != null;
    8183      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      }
    82100    }
    83101
     
    119137              if (Content.Solution != null) {
    120138                int currentTour = 0;
    121                 foreach (Tour tour in Content.Solution.Tours) {
     139                foreach (Tour tour in Content.Solution.GetTours(new ValueLookupParameter<DoubleMatrix>("DistanceMatrix", distanceMatrix))) {
    122140                  double t = 0.0;
    123141                  Point[] tourPoints = new Point[tour.Cities.Count + 2];
     
    202220      else {
    203221        GenerateImage();
    204         tourViewHost.Content = Content.Solution;
     222        UpdateTourView();
    205223      }
    206224    }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.Designer.cs

    r4185 r4352  
    2929      this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();
    3030      this.tabPage2 = new System.Windows.Forms.TabPage();
     31      this.importButton2 = new System.Windows.Forms.Button();
     32      this.importButton3 = new System.Windows.Forms.Button();
    3133      this.vrpSolutionView = new HeuristicLab.Problems.VehicleRouting.Views.VRPSolutionView();
    3234      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
     
    4345      // importButton
    4446      //
    45       this.importButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    46                   | System.Windows.Forms.AnchorStyles.Right)));
    4747      this.importButton.Location = new System.Drawing.Point(0, 55);
    4848      this.importButton.Name = "importButton";
    49       this.importButton.Size = new System.Drawing.Size(490, 23);
     49      this.importButton.Size = new System.Drawing.Size(139, 23);
    5050      this.importButton.TabIndex = 5;
    5151      this.importButton.Text = "Import from Solomon";
     
    6363      this.tabControl1.Name = "tabControl1";
    6464      this.tabControl1.SelectedIndex = 0;
    65       this.tabControl1.Size = new System.Drawing.Size(490, 338);
     65      this.tabControl1.Size = new System.Drawing.Size(490, 265);
    6666      this.tabControl1.TabIndex = 6;
    6767      //
     
    7272      this.tabPage1.Name = "tabPage1";
    7373      this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
    74       this.tabPage1.Size = new System.Drawing.Size(482, 312);
     74      this.tabPage1.Size = new System.Drawing.Size(482, 239);
    7575      this.tabPage1.TabIndex = 0;
    7676      this.tabPage1.Text = "Parameters";
     
    8585      this.parameterCollectionView.Name = "parameterCollectionView";
    8686      this.parameterCollectionView.ReadOnly = false;
    87       this.parameterCollectionView.Size = new System.Drawing.Size(476, 306);
     87      this.parameterCollectionView.Size = new System.Drawing.Size(476, 233);
    8888      this.parameterCollectionView.TabIndex = 1;
    8989      //
     
    9494      this.tabPage2.Name = "tabPage2";
    9595      this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
    96       this.tabPage2.Size = new System.Drawing.Size(482, 312);
     96      this.tabPage2.Size = new System.Drawing.Size(482, 239);
    9797      this.tabPage2.TabIndex = 1;
    9898      this.tabPage2.Text = "Visualization";
    9999      this.tabPage2.UseVisualStyleBackColor = true;
     100      //
     101      // importButton2
     102      //
     103      this.importButton2.Location = new System.Drawing.Point(145, 55);
     104      this.importButton2.Name = "importButton2";
     105      this.importButton2.Size = new System.Drawing.Size(126, 23);
     106      this.importButton2.TabIndex = 7;
     107      this.importButton2.Text = "Import from TSPLib";
     108      this.importButton2.UseVisualStyleBackColor = true;
     109      this.importButton2.Click += new System.EventHandler(this.importButton2_Click);
     110      //
     111      // importButton3
     112      //
     113      this.importButton3.Location = new System.Drawing.Point(277, 55);
     114      this.importButton3.Name = "importButton3";
     115      this.importButton3.Size = new System.Drawing.Size(131, 23);
     116      this.importButton3.TabIndex = 8;
     117      this.importButton3.Text = "Import from ORLib";
     118      this.importButton3.UseVisualStyleBackColor = true;
     119      this.importButton3.Click += new System.EventHandler(this.importButton3_Click);
    100120      //
    101121      // vrpSolutionView
     
    107127      this.vrpSolutionView.Name = "vrpSolutionView";
    108128      this.vrpSolutionView.ReadOnly = false;
    109       this.vrpSolutionView.Size = new System.Drawing.Size(476, 306);
     129      this.vrpSolutionView.Size = new System.Drawing.Size(476, 233);
    110130      this.vrpSolutionView.TabIndex = 0;
    111131      //
     
    113133      //
    114134      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     135      this.Controls.Add(this.importButton3);
     136      this.Controls.Add(this.importButton2);
    115137      this.Controls.Add(this.importButton);
    116138      this.Controls.Add(this.tabControl1);
    117139      this.Name = "VehicleRoutingProblemView";
    118       this.Size = new System.Drawing.Size(490, 422);
     140      this.Size = new System.Drawing.Size(490, 352);
    119141      this.Controls.SetChildIndex(this.tabControl1, 0);
    120142      this.Controls.SetChildIndex(this.importButton, 0);
     
    123145      this.Controls.SetChildIndex(this.descriptionLabel, 0);
    124146      this.Controls.SetChildIndex(this.descriptionTextBox, 0);
     147      this.Controls.SetChildIndex(this.importButton2, 0);
     148      this.Controls.SetChildIndex(this.importButton3, 0);
    125149      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    126150      this.tabControl1.ResumeLayout(false);
     
    140164    private Core.Views.ParameterCollectionView parameterCollectionView;
    141165    private VRPSolutionView vrpSolutionView;
     166    private System.Windows.Forms.Button importButton2;
     167    private System.Windows.Forms.Button importButton3;
    142168  }
    143169}
  • trunk/sources/HeuristicLab.Problems.VehicleRouting.Views/3.3/VehicleRoutingProblemView.cs

    r4185 r4352  
    6464      parameterCollectionView.Enabled = Content != null;
    6565      vrpSolutionView.Enabled = Content != null;
    66       importButton.Enabled = Content != null && !ReadOnly;
     66      importButton.Enabled = importButton2.Enabled = importButton3.Enabled = Content != null && !ReadOnly;
    6767    }
    6868
    6969    private void importButton_Click(object sender, EventArgs e) {
    7070      OpenFileDialog dialog = new OpenFileDialog();
    71       dialog.DefaultExt = "txt";
     71      dialog.Filter = "Solomon files (*.txt)|*.txt";
    7272
    7373      if (dialog.ShowDialog() == DialogResult.OK) {
     
    7676    }
    7777
     78    private void importButton2_Click(object sender, EventArgs e) {
     79      OpenFileDialog dialog = new OpenFileDialog();
     80      dialog.Filter = "TSPLib files (*.vrp)|*.vrp";
     81
     82      if (dialog.ShowDialog() == DialogResult.OK) {
     83        Content.ImportFromTSPLib(dialog.FileName);
     84      }
     85    }
     86
     87    private void importButton3_Click(object sender, EventArgs e) {
     88      OpenFileDialog dialog = new OpenFileDialog();
     89      dialog.Filter = "ORLib files (*.txt)|*.txt";
     90
     91      if (dialog.ShowDialog() == DialogResult.OK) {
     92        Content.ImportFromORLib(dialog.FileName);
     93      }
     94    } 
     95
    7896    private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) {
    7997      vrpSolutionView.Content.Coordinates = Content.Coordinates;
    80     }
     98    } 
    8199  }
    82100}
Note: See TracChangeset for help on using the changeset viewer.