Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7780


Ignore:
Timestamp:
05/04/12 13:35:59 (13 years ago)
Author:
bburlacu
Message:

#1265: Fixed zoom and small issue with selection. Added tool tips.

Location:
branches/HeuristicLab.Visualization
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Visualization

    • Property svn:ignore
      •  

        old new  
        11*.suo
        22CustomPostBuild.cmd
         3_ReSharper.HeuristicLab.Visualization
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Chart.cs

    r4776 r7780  
    2222using System;
    2323using System.Collections.Generic;
    24 using System.Text;
    2524using System.Drawing;
     25using System.Linq;
    2626using System.Windows.Forms;
    2727
     
    242242      } else if (Mode == ChartMode.Select) {
    243243        if (button == MouseButtons.Left) {
    244           IList<IPrimitive> selected = Group.SelectedPrimitives;
     244          IList<IPrimitive> selected = Group.SelectedPrimitives.Where(p => p.ContainsPoint(p1)).ToList();
    245245          UpdateEnabled = false;
    246246          foreach (IPrimitive primitive in selected)
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartControl.cs

    r7617 r7780  
    8181      mouseClickCount = e.Clicks;
    8282    }
    83     private void pictureBox_MouseUp(object sender, MouseEventArgs e) {
     83    protected virtual void pictureBox_MouseUp(object sender, MouseEventArgs e) {
    8484      if (e.Button == MouseButtons.Left) {
    8585        if (Chart.Mode == ChartMode.Zoom) {
    8686          pictureBox.Refresh();
    87           Point lowerLeft = new Point(Math.Min(e.X, buttonDownPoint.X),
    88                                       Math.Max(e.Y, buttonDownPoint.Y));
    89           Point upperRight = new Point(Math.Max(e.X, buttonDownPoint.X),
    90                                        Math.Min(e.Y, buttonDownPoint.Y));
     87          // some code to preserve the aspect ratio when zooming
     88          //       +---------------------+ (Width,Height)
     89          //       |  (x1,y1)            |
     90          //       |      +-------+      |
     91          //       |      |       |      |
     92          //       |      |       |      |
     93          //       |      +-------+      |
     94          //       |             (x2,y2) |
     95          // (0,0) +---------------------+
     96          //
     97          double aspectRatio = (double)Width / Height;
     98          double x1 = Math.Min(e.X, buttonDownPoint.X);
     99          double y1 = Math.Max(e.Y, buttonDownPoint.Y);
     100          double x2 = Math.Max(e.X, buttonDownPoint.X);
     101          double y2 = Math.Min(e.Y, buttonDownPoint.Y);
     102          // consider the relative ratios between the X and Y dimensions of the selection
     103          // area and the Width and Height, respectively. The "dominant" dimension is the
     104          // one with a ratio closer to 1, and it stays fixed while the other is adjusted
     105          // in order to preserve the aspect ratio
     106          if ((x2 - x1) / Width > (y1 - y2) / Height) {
     107            y1 = y2 + (x2 - x1) / aspectRatio;
     108          } else {
     109            x2 = aspectRatio * (y1 - y2) + x1;
     110          }
     111          var lowerLeft = new Point((int)x1, (int)y1);
     112          var upperRight = new Point((int)x2, (int)y2);
    91113          if ((lowerLeft.X != upperRight.X) && (lowerLeft.Y != upperRight.Y)) {
    92114            Chart.ZoomIn(lowerLeft, upperRight);
     
    112134      }
    113135    }
     136
    114137    private void pictureBox_MouseMove(object sender, MouseEventArgs e) {
    115       toolTip.SetToolTip(pictureBox, Chart.GetToolTipText(e.Location));
     138      var text = Chart.GetToolTipText(e.Location);
     139      if (toolTip.GetToolTip(pictureBox) != text)
     140        toolTip.SetToolTip(pictureBox, text);
    116141      Cursor cursor = Chart.GetCursor(e.Location);
    117142      if (cursor != null) pictureBox.Cursor = cursor;
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/HeuristicLab.Visualization-3.3.csproj

    r5170 r7780  
    4040    <DebugType>full</DebugType>
    4141    <Optimize>false</Optimize>
    42     <OutputPath>bin\Debug\</OutputPath>
     42    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    4343    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4444    <ErrorReport>prompt</ErrorReport>
     
    5050    <DebugType>pdbonly</DebugType>
    5151    <Optimize>true</Optimize>
    52     <OutputPath>bin\Release\</OutputPath>
     52    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    5353    <DefineConstants>TRACE</DefineConstants>
    5454    <ErrorReport>prompt</ErrorReport>
    5555    <WarningLevel>4</WarningLevel>
    5656    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    57     <DocumentationFile>bin\Release\HeuristicLab.Visualization-3.3.xml</DocumentationFile>
     57    <DocumentationFile>
     58    </DocumentationFile>
    5859    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    5960  </PropertyGroup>
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/HeuristicLab.Visualization-3.3.csproj.user

    r4776 r7780  
    1212    <ProjectView>ProjectFiles</ProjectView>
    1313  </PropertyGroup>
     14  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
     15    <StartAction>Program</StartAction>
     16    <StartProgram>C:\Users\bburlacu\Desktop\HL-Core\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
     17  </PropertyGroup>
     18  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
     19    <StartAction>Program</StartAction>
     20    <StartProgram>C:\Users\bburlacu\Desktop\HL-Core\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>
     21  </PropertyGroup>
    1422</Project>
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Ellipse.cs

    r4776 r7780  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    2523using System.Drawing;
    2624
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/FixedSizeCircle.cs

    r4776 r7780  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    2522using System.Drawing;
    2623
     
    6158      double yDistance = x.Y - center.Y;
    6259
    63       return Size.Height*Size.Height/4.0 >= (xDistance * xDistance + yDistance * yDistance);
     60      return Size.Height * Size.Height / 4.0 >= (xDistance * xDistance + yDistance * yDistance);
    6461    }
    6562  }
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/PrimitiveBase.cs

    r4776 r7780  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    2523using System.Drawing;
    2624using System.Windows.Forms;
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/RectangularPrimitiveBase.cs

    r4776 r7780  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Text;
    2523using System.Drawing;
    2624using System.Drawing.Drawing2D;
Note: See TracChangeset for help on using the changeset viewer.