Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 2455 was 1964, checked in by mstoeger, 15 years ago

moved the canvas and the basic types of shapes to their own namespace. #498

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