Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11240


Ignore:
Timestamp:
07/30/14 14:59:20 (10 years ago)
Author:
pfleck
Message:

#2208 improved visualization of orienteering solution

Location:
branches/HeuristicLab.Problems.Orienteering
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.Designer.cs

    r11235 r11240  
    5959      this.valueTabPage.SuspendLayout();
    6060      this.tourGroupBox.SuspendLayout();
     61      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    6162      this.splitContainer.Panel1.SuspendLayout();
    6263      this.splitContainer.Panel2.SuspendLayout();
     
    6768      // pictureBox
    6869      //
    69       this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    70                   | System.Windows.Forms.AnchorStyles.Left)
    71                   | System.Windows.Forms.AnchorStyles.Right)));
     70      this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     71            | System.Windows.Forms.AnchorStyles.Left)
     72            | System.Windows.Forms.AnchorStyles.Right)));
    7273      this.pictureBox.BackColor = System.Drawing.Color.White;
    7374      this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    7475      this.pictureBox.Location = new System.Drawing.Point(6, 6);
    7576      this.pictureBox.Name = "pictureBox";
    76       this.pictureBox.Size = new System.Drawing.Size(403, 288);
     77      this.pictureBox.Size = new System.Drawing.Size(403, 322);
    7778      this.pictureBox.TabIndex = 0;
    7879      this.pictureBox.TabStop = false;
     
    8182      // tabControl
    8283      //
    83       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    84                   | System.Windows.Forms.AnchorStyles.Left)
    85                   | System.Windows.Forms.AnchorStyles.Right)));
     84      this.tabControl.AllowDrop = true;
     85      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     86            | System.Windows.Forms.AnchorStyles.Left)
     87            | System.Windows.Forms.AnchorStyles.Right)));
    8688      this.tabControl.Controls.Add(this.visualizationTabPage);
    8789      this.tabControl.Controls.Add(this.valueTabPage);
     
    8991      this.tabControl.Name = "tabControl";
    9092      this.tabControl.SelectedIndex = 0;
    91       this.tabControl.Size = new System.Drawing.Size(423, 326);
     93      this.tabControl.Size = new System.Drawing.Size(423, 360);
    9294      this.tabControl.TabIndex = 0;
    9395      //
     
    98100      this.visualizationTabPage.Name = "visualizationTabPage";
    99101      this.visualizationTabPage.Padding = new System.Windows.Forms.Padding(3);
    100       this.visualizationTabPage.Size = new System.Drawing.Size(415, 300);
     102      this.visualizationTabPage.Size = new System.Drawing.Size(415, 334);
    101103      this.visualizationTabPage.TabIndex = 0;
    102104      this.visualizationTabPage.Text = "Visualization";
     
    116118      // tourGroupBox
    117119      //
    118       this.tourGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    119                   | System.Windows.Forms.AnchorStyles.Left)
    120                   | System.Windows.Forms.AnchorStyles.Right)));
     120      this.tourGroupBox.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)));
    121123      this.tourGroupBox.Controls.Add(this.tourViewHost);
    122124      this.tourGroupBox.Location = new System.Drawing.Point(6, 6);
     
    129131      // tourViewHost
    130132      //
    131       this.tourViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    132                   | System.Windows.Forms.AnchorStyles.Left)
    133                   | System.Windows.Forms.AnchorStyles.Right)));
     133      this.tourViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     134            | System.Windows.Forms.AnchorStyles.Left)
     135            | System.Windows.Forms.AnchorStyles.Right)));
     136      this.tourViewHost.Caption = "View";
    134137      this.tourViewHost.Content = null;
     138      this.tourViewHost.Enabled = false;
    135139      this.tourViewHost.Location = new System.Drawing.Point(6, 19);
    136140      this.tourViewHost.Name = "tourViewHost";
     
    138142      this.tourViewHost.Size = new System.Drawing.Size(391, 263);
    139143      this.tourViewHost.TabIndex = 0;
     144      this.tourViewHost.ViewsLabelVisible = true;
    140145      this.tourViewHost.ViewType = null;
    141146      //
     
    155160      this.splitContainer.Panel2.Controls.Add(this.tabControl);
    156161      this.splitContainer.Size = new System.Drawing.Size(423, 402);
    157       this.splitContainer.SplitterDistance = 69;
     162      this.splitContainer.SplitterDistance = 35;
    158163      this.splitContainer.TabIndex = 0;
    159164      //
    160165      // qualityGroupBox
    161166      //
    162       this.qualityGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    163                   | System.Windows.Forms.AnchorStyles.Left)
    164                   | System.Windows.Forms.AnchorStyles.Right)));
     167      this.qualityGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     168            | System.Windows.Forms.AnchorStyles.Left)
     169            | System.Windows.Forms.AnchorStyles.Right)));
    165170      this.qualityGroupBox.Controls.Add(this.qualityViewHost);
    166171      this.qualityGroupBox.Location = new System.Drawing.Point(0, 0);
    167172      this.qualityGroupBox.Name = "qualityGroupBox";
    168       this.qualityGroupBox.Size = new System.Drawing.Size(423, 66);
     173      this.qualityGroupBox.Size = new System.Drawing.Size(423, 32);
    169174      this.qualityGroupBox.TabIndex = 0;
    170175      this.qualityGroupBox.TabStop = false;
     
    173178      // qualityViewHost
    174179      //
    175       this.qualityViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    176                   | System.Windows.Forms.AnchorStyles.Left)
    177                   | System.Windows.Forms.AnchorStyles.Right)));
     180      this.qualityViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     181            | System.Windows.Forms.AnchorStyles.Left)
     182            | System.Windows.Forms.AnchorStyles.Right)));
     183      this.qualityViewHost.Caption = "View";
    178184      this.qualityViewHost.Content = null;
     185      this.qualityViewHost.Enabled = false;
    179186      this.qualityViewHost.Location = new System.Drawing.Point(6, 19);
    180187      this.qualityViewHost.Name = "qualityViewHost";
    181188      this.qualityViewHost.ReadOnly = false;
    182       this.qualityViewHost.Size = new System.Drawing.Size(411, 41);
     189      this.qualityViewHost.Size = new System.Drawing.Size(411, 7);
    183190      this.qualityViewHost.TabIndex = 0;
     191      this.qualityViewHost.ViewsLabelVisible = true;
    184192      this.qualityViewHost.ViewType = null;
    185193      //
    186194      // OrienteeringSolutionView
    187195      //
    188       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    189196      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    190197      this.Controls.Add(this.splitContainer);
     
    198205      this.splitContainer.Panel1.ResumeLayout(false);
    199206      this.splitContainer.Panel2.ResumeLayout(false);
     207      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
    200208      this.splitContainer.ResumeLayout(false);
    201209      this.qualityGroupBox.ResumeLayout(false);
    202210      this.ResumeLayout(false);
     211
    203212    }
    204213
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering.Views/3.3/OrienteeringSolutionView.cs

    r11235 r11240  
    2222using System;
    2323using System.Drawing;
     24using System.Linq;
    2425using HeuristicLab.Core.Views;
    2526using HeuristicLab.MainForm;
     
    4142      Content.QualityChanged -= new EventHandler(Content_QualityChanged);
    4243      Content.CoordinatesChanged -= new EventHandler(Content_CoordinatesChanged);
     44      Content.ScoresChanged -= new EventHandler(Content_ScoresChanged);
    4345      Content.IntegerVectorChanged -= new EventHandler(Content_IntegerVectorChanged);
    4446      base.DeregisterContentEvents();
     
    4850      Content.QualityChanged += new EventHandler(Content_QualityChanged);
    4951      Content.CoordinatesChanged += new EventHandler(Content_CoordinatesChanged);
     52      Content.ScoresChanged += new EventHandler(Content_ScoresChanged);
    5053      Content.IntegerVectorChanged += new EventHandler(Content_IntegerVectorChanged);
    5154    }
     
    7780        } else {
    7881          var coordinates = Content.Coordinates;
     82          var scores = Content.Scores;
    7983          var integerVector = Content.IntegerVector;
    8084          var bitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
     
    106110                graphics.DrawPolygon(Pens.Black, tour);
    107111              }
    108               for (int i = 0; i < points.Length; i++)
    109                 graphics.FillRectangle(Brushes.Red, points[i].X - 2, points[i].Y - 2, 6, 6);
     112
     113              double scoreMin = scores.Min();
     114              double scoreMax = scores.Max();
     115              double scoreRange = scoreMax - scoreMin;
     116              for (int i = 0; i < points.Length; i++) {
     117                double score = scores[i];
     118                int size = (int)Math.Round(((score - scoreMin) / scoreRange) * 9 + 1);
     119                graphics.FillRectangle(Brushes.Red, points[i].X - size / 2, points[i].Y - size / 2, size, size);
     120              }
    110121            }
    111122          } else {
     
    135146        GenerateImage();
    136147    }
     148    private void Content_ScoresChanged(object sender, EventArgs e) {
     149      if (InvokeRequired)
     150        Invoke(new EventHandler(Content_ScoresChanged), sender, e);
     151      else
     152        GenerateImage();
     153    }
    137154    private void Content_IntegerVectorChanged(object sender, EventArgs e) {
    138155      if (InvokeRequired)
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/Analyzers/BestOrienteeringSolutionAnalyser.cs

    r11190 r11240  
    9595      var solution = BestSolutionParameter.ActualValue;
    9696      var coordinates = CoordinatesParameter.ActualValue;
     97      var scores = ScoresParameter.ActualValue;
    9798      if (solution == null) {
    9899        solution = new OrienteeringSolution(
    99100          (IntegerVector)solutions[bestIndex].Clone(),
    100101          coordinates,
     102          scores,
    101103          new DoubleValue(qualities[bestIndex].Value));
    102104        BestSolutionParameter.ActualValue = solution;
     
    105107        if (solution.Quality.Value < qualities[bestIndex].Value) {
    106108          solution.Coordinates = coordinates;
     109          solution.Scores = scores;
    107110          solution.IntegerVector = (IntegerVector)solutions[bestIndex].Clone();
    108111          solution.Quality.Value = qualities[bestIndex].Value;
  • branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.Orienteering/3.3/OrienteeringSolution.cs

    r11190 r11240  
    4242    }
    4343    [Storable]
     44    private DoubleArray scores;
     45    public DoubleArray Scores {
     46      get { return scores; }
     47      set {
     48        if (scores != value) {
     49          if (scores != null) DeregisterScoresEvents();
     50          scores = value;
     51          if (scores != null) RegisterScoresEvents();
     52          OnScoresChanged();
     53        }
     54      }
     55    }
     56    [Storable]
    4457    private DoubleValue quality;
    4558    public DoubleValue Quality {
     
    6477      Initialize();
    6578    }
    66     public OrienteeringSolution(IntegerVector integerVector, DoubleMatrix coordinates, DoubleValue quality)
     79    public OrienteeringSolution(IntegerVector integerVector, DoubleMatrix coordinates, DoubleArray scores, DoubleValue quality)
    6780      : base() {
    6881      this.integerVector = integerVector;
    6982      this.coordinates = coordinates;
     83      this.scores = scores;
    7084      this.quality = quality;
    7185      Initialize();
     
    8498      if (integerVector != null) RegisterIntegerVectorEvents();
    8599      if (coordinates != null) RegisterCoordinatesEvents();
     100      if (scores != null) RegisterScoresEvents();
    86101      if (quality != null) RegisterQualityEvents();
    87102    }
     
    102117    }
    103118
     119    public event EventHandler ScoresChanged;
     120    private void OnScoresChanged() {
     121      var changed = ScoresChanged;
     122      if (changed != null)
     123        changed(this, EventArgs.Empty);
     124    }
    104125
    105126    public event EventHandler QualityChanged;
     
    126147      Coordinates.Reset -= new EventHandler(Coordinates_Reset);
    127148    }
     149    private void RegisterScoresEvents() {
     150      Scores.ItemChanged += new EventHandler<EventArgs<int>>(Scores_ItemChanged);
     151      Scores.Reset += new EventHandler(Scores_Reset);
     152    }
     153    private void DeregisterScoresEvents() {
     154      Scores.ItemChanged -= new EventHandler<EventArgs<int>>(Scores_ItemChanged);
     155      Scores.Reset -= new EventHandler(Scores_Reset);
     156    }
    128157    private void RegisterQualityEvents() {
    129158      Quality.ValueChanged += new EventHandler(Quality_ValueChanged);
     
    145174      OnCoordinatesChanged();
    146175    }
     176    private void Scores_ItemChanged(object sender, EventArgs<int> e) {
     177      OnCoordinatesChanged();
     178    }
     179    private void Scores_Reset(object sender, EventArgs e) {
     180      OnCoordinatesChanged();
     181    }
    147182    private void Quality_ValueChanged(object sender, EventArgs e) {
    148183      OnQualityChanged();
Note: See TracChangeset for help on using the changeset viewer.