01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.core.print;
17:
18: import java.awt.Point;
19: import java.awt.geom.Point2D;
20:
21: public class cPoint {
22: private cUnit x;
23: private cUnit y;
24:
25: public cPoint(cUnit x, cUnit y) {
26: this .x = x;
27: this .y = y;
28: }
29:
30: public void setLocation(cUnit x, cUnit y) {
31: this .x = x;
32: this .y = y;
33: }
34:
35: public void setX(cUnit x) {
36: this .x = x;
37: }
38:
39: public void setY(cUnit y) {
40: this .y = y;
41: }
42:
43: public cUnit getX() {
44: return x;
45: }
46:
47: public cUnit getY() {
48: return y;
49: }
50:
51: public Point2D.Double getPoint2D() {
52: Point2D.Double temp = new Point2D.Double(x.getPoints(), y
53: .getPoints());
54:
55: return temp;
56: }
57:
58: public Point getPoint() {
59: Point temp = new Point((int) x.getPoints(), (int) y.getPoints());
60:
61: return temp;
62: }
63:
64: public cPoint add(cPoint p) {
65: cPoint temp = new cPoint(p.getX().add(getX()), p.getY().add(
66: getY()));
67:
68: return temp;
69: }
70:
71: public cPoint subHeight(cUnit h) {
72: cPoint temp = new cPoint(getX(), getY().sub(h));
73:
74: return temp;
75: }
76:
77: public cPoint addHeight(cUnit h) {
78: cPoint temp = new cPoint(getX(), getY().add(h));
79:
80: return temp;
81: }
82:
83: public Object clone() {
84: cPoint clone = new cPoint(getX(), getY());
85:
86: return clone;
87: }
88: }
|