Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/3.2/Translate.cs @ 1835

Last change on this file since 1835 was 1530, checked in by gkronber, 16 years ago

Moved source files of plugins Hive ... Visualization.Test into version-specific sub-folders. #576

File size: 884 bytes
Line 
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.