Rev | Line | |
---|
[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Windows.Media;
|
---|
| 6 | using System.Windows;
|
---|
| 7 | using System.ComponentModel;
|
---|
| 8 |
|
---|
| 9 | namespace Microsoft.Research.DynamicDataDisplay.Charts
|
---|
| 10 | {
|
---|
| 11 | /// <summary>
|
---|
| 12 | /// Represents a rectangle with corners bound to viewport coordinates.
|
---|
| 13 | /// </summary>
|
---|
| 14 | public sealed class RectangleHighlight : ViewportShape
|
---|
| 15 | {
|
---|
| 16 | /// <summary>
|
---|
| 17 | /// Initializes a new instance of the <see cref="RectangleHighlight"/> class.
|
---|
| 18 | /// </summary>
|
---|
| 19 | public RectangleHighlight() { }
|
---|
| 20 |
|
---|
| 21 | /// <summary>
|
---|
| 22 | /// Initializes a new instance of the <see cref="RectangleHighlight"/> class.
|
---|
| 23 | /// </summary>
|
---|
| 24 | /// <param name="bounds">The bounds.</param>
|
---|
| 25 | public RectangleHighlight(Rect bounds)
|
---|
| 26 | {
|
---|
| 27 | Bounds = bounds;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | private DataRect rect = DataRect.Empty;
|
---|
| 31 | public DataRect Bounds
|
---|
| 32 | {
|
---|
| 33 | get { return rect; }
|
---|
| 34 | set
|
---|
| 35 | {
|
---|
| 36 | if (rect != value)
|
---|
| 37 | {
|
---|
| 38 | rect = value;
|
---|
| 39 | UpdateUIRepresentation();
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | protected override void UpdateUIRepresentationCore()
|
---|
| 45 | {
|
---|
| 46 | var transform = Plotter.Viewport.Transform;
|
---|
| 47 |
|
---|
| 48 | Point p1 = rect.XMaxYMax.DataToScreen(transform);
|
---|
| 49 | Point p2 = rect.XMinYMin.DataToScreen(transform);
|
---|
| 50 | rectGeometry.Rect = new Rect(p1, p2);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | private RectangleGeometry rectGeometry = new RectangleGeometry();
|
---|
| 54 | protected override Geometry DefiningGeometry
|
---|
| 55 | {
|
---|
| 56 | get { return rectGeometry; }
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.