Rev | Line | |
---|
[1249] | 1 | using System.Drawing;
|
---|
| 2 |
|
---|
| 3 | namespace 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.