Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/ViewportConstraints/MinimalSizeConstraint.cs @ 12747

Last change on this file since 12747 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.3 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6
7namespace Microsoft.Research.DynamicDataDisplay.ViewportConstraints
8{
9  /// <summary>
10  /// Represents a ViewportConstraint, which the minimal size of <see cref="Viewport"/>'s Visible.
11  /// </summary>
12  public class MinimalSizeConstraint : ViewportConstraint
13  {
14    private double minSize = 1E-11;
15
16    /// <summary>
17    /// Gets or sets the minimal size of Viewport's Visible.
18    /// </summary>
19    /// <value>The minimal size of Viewport's Visible.</value>
20    public double MinSize
21    {
22      get { return minSize; }
23      set
24      {
25        if (minSize != value)
26        {
27          minSize = value;
28          RaiseChanged();
29        }
30      }
31    }
32
33    /// <summary>
34    /// Applies the restriction.
35    /// </summary>
36    /// <param name="previousDataRect">Previous data rectangle.</param>
37    /// <param name="proposedDataRect">Proposed data rectangle.</param>
38    /// <param name="viewport">The viewport, to which current restriction is being applied.</param>
39    /// <returns>New changed visible rectangle.</returns>
40    public override DataRect Apply(DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport)
41    {
42      if (proposedDataRect.Width < minSize || proposedDataRect.Height < minSize)
43        return previousDataRect;
44
45      return proposedDataRect;
46    }
47  }
48}
Note: See TracBrowser for help on using the repository browser.