/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
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows;
- using Microsoft.Research.DynamicDataDisplay.Common;
-
- namespace Microsoft.Research.DynamicDataDisplay.ViewportConstraints
- {
- /// <summary>
- /// Represents a base class for all constraints that are being applied to viewport's visible rect.
- /// </summary>
- public abstract class ViewportConstraint
- {
- /// <summary>
- /// Applies the constraint.
- /// </summary>
- /// <param name="previousDataRect">Previous data rectangle.</param>
- /// <param name="proposedDataRect">Proposed data rectangle.</param>
- /// <param name="viewport">The viewport, to which current restriction is being applied.</param>
- /// <returns>New changed visible rectangle.</returns>
- public abstract DataRect Apply(DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport);
-
- /// <summary>
- /// Raises the changed event.
- /// </summary>
- protected void RaiseChanged()
- {
- Changed.Raise(this);
- }
- /// <summary>
- /// Occurs when constraint changes.
- /// Causes update of <see cref="Viewport"/>'s Visible property.
- /// </summary>
- public event EventHandler Changed;
- }
- }