01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19: package org.openharmonise.workfloweditor.flowchart.shapes;
20:
21: import java.awt.*;
22: import java.awt.geom.*;
23:
24: /**
25: * Represents the move handler for workflow stage shapes.
26: *
27: * @author Matthew Large
28: * @version $Revision: 1.1 $
29: *
30: */
31: public class ControlPoint extends AbstractWorkflowShape {
32:
33: /**
34: * Rectangle shape for the handler.
35: */
36: private Rectangle2D.Float m_rect;
37:
38: /**
39: * Constructs a new control point.
40: *
41: * @param control 2D location of control point
42: * @param nWidth Width
43: * @param nHeight Height
44: */
45: public ControlPoint(Point2D.Double control, int nWidth, int nHeight) {
46: super (new Double(control.x).floatValue(), new Double(control.y)
47: .floatValue());
48:
49: this .m_rect = new Rectangle2D.Float(new Double(control.x)
50: .intValue(), new Double(control.y).intValue(), nWidth,
51: nHeight);
52:
53: }
54:
55: /* (non-Javadoc)
56: * @see com.simulacramedia.workfloweditor.flowchart.shapes.AbstractWorkflowShape#drawSelf(java.awt.Graphics2D)
57: */
58: public void drawSelf(Graphics2D g) {
59:
60: }
61:
62: /**
63: * Returns the location of the control point.
64: *
65: * @return Location
66: */
67: public Point2D.Double getControl() {
68: return new Point2D.Double(this .getX(), this .getY());
69: }
70:
71: /**
72: * Checks if the control point contains a given co-ordinate.
73: *
74: * @param x X co-ordinate to check
75: * @param y Y co-ordinate to check
76: * @return true if the control point contains the co-ordinate
77: */
78: public boolean contains(double x, double y) {
79: return this .m_rect.contains(x, y);
80: }
81:
82: /* (non-Javadoc)
83: * @see com.simulacramedia.workfloweditor.flowchart.shapes.AbstractWorkflowShape#setX(float)
84: */
85: public void setX(float x) {
86: super .setX(x);
87: this .m_rect.x = x;
88: }
89:
90: /* (non-Javadoc)
91: * @see com.simulacramedia.workfloweditor.flowchart.shapes.AbstractWorkflowShape#setY(float)
92: */
93: public void setY(float y) {
94: super.setY(y);
95: this.m_rect.y = y;
96: }
97:
98: }
|