/Main/src/DynamicDataDisplay/ViewportConstraints/ViewportConstraint.cs
C# | 37 lines | 18 code | 2 blank | 17 comment | 0 complexity | 3c1b77fe58c6a01d5a3ed0e1249dece4 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
1using System; 2using System.Collections.Generic; 3using System.Linq; 4using System.Text; 5using System.Windows; 6using Microsoft.Research.DynamicDataDisplay.Common; 7 8namespace Microsoft.Research.DynamicDataDisplay.ViewportConstraints 9{ 10 /// <summary> 11 /// Represents a base class for all constraints that are being applied to viewport's visible rect. 12 /// </summary> 13 public abstract class ViewportConstraint 14 { 15 /// <summary> 16 /// Applies the constraint. 17 /// </summary> 18 /// <param name="previousDataRect">Previous data rectangle.</param> 19 /// <param name="proposedDataRect">Proposed data rectangle.</param> 20 /// <param name="viewport">The viewport, to which current restriction is being applied.</param> 21 /// <returns>New changed visible rectangle.</returns> 22 public abstract DataRect Apply(DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport); 23 24 /// <summary> 25 /// Raises the changed event. 26 /// </summary> 27 protected void RaiseChanged() 28 { 29 Changed.Raise(this); 30 } 31 /// <summary> 32 /// Occurs when constraint changes. 33 /// Causes update of <see cref="Viewport"/>'s Visible property. 34 /// </summary> 35 public event EventHandler Changed; 36 } 37}