Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/Translate.cs @ 1284

Last change on this file since 1284 was 1249, checked in by bspisic, 16 years ago

reimplemented panning and zooming (#424)

File size: 884 bytes
RevLine 
[1249]1using System.Drawing;
2
3namespace HeuristicLab.Visualization {
4  public static class Translate {
5    public static RectangleD ClippingArea(Point startPoint, Point endPoint, RectangleD clippingArea, Rectangle viewPort) {
6      PointD worldStartPoint = Transform.ToWorld(startPoint, viewPort, clippingArea);
7      PointD worldEndPoint = Transform.ToWorld(endPoint, viewPort, clippingArea);
8
9      double xDiff = worldEndPoint.X - worldStartPoint.X;
10      double yDiff = worldEndPoint.Y - worldStartPoint.Y;
11
12      return RectangleD(xDiff, yDiff, clippingArea);
13    }
14
15    public static RectangleD RectangleD(double x, double y, RectangleD rectangle) {
16      RectangleD rect = new RectangleD();
17
18      rect.X1 = rectangle.X1 - x;
19      rect.X2 = rectangle.X2 - x;
20      rect.Y1 = rectangle.Y1 - y;
21      rect.Y2 = rectangle.Y2 - y;
22
23      return rect;
24    }
25  }
26}
Note: See TracBrowser for help on using the repository browser.