KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > gvt > Marker


1 /*
2
3    Copyright 2001 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.gvt;
19
20 import java.awt.geom.Point2D JavaDoc;
21
22 /**
23  * A Marker describes a GraphicsNode with a reference point that can be used to
24  * position the Marker at a particular location and a particular policy for
25  * rotating the marker when drawing it.
26  *
27  * @author <a HREF="mailto:vincent.hardy@eng.sun.com">Vincent Hardy</a>
28  * @version $Id: Marker.java,v 1.5 2004/08/18 07:14:26 vhardy Exp $
29  */

30 public class Marker {
31
32     /**
33      * Rotation angle, about (0, 0) is user space. If orient is NaN then the
34      * marker's x-axis should be aligned with the slope of the curve on the
35      * point where the object is drawn
36      */

37     protected double orient;
38
39     /**
40      * GraphicsNode this marker is associated to
41      */

42     protected GraphicsNode markerNode;
43
44     /**
45      * Reference point about which the marker should be drawn
46      */

47     protected Point2D JavaDoc ref;
48
49     /**
50      * Constructs a new marker.
51      *
52      * @param markerNode the graphics node that represents the marker
53      * @param ref the reference point
54      * @param orient the orientation of the marker
55      */

56     public Marker(GraphicsNode markerNode, Point2D JavaDoc ref, double orient){
57
58         if (markerNode == null) {
59             throw new IllegalArgumentException JavaDoc();
60         }
61
62         if (ref == null) {
63             throw new IllegalArgumentException JavaDoc();
64         }
65
66         this.markerNode = markerNode;
67         this.ref = ref;
68         this.orient = orient;
69     }
70
71     /**
72      * Returns the reference point of this marker.
73      */

74     public Point2D JavaDoc getRef(){
75         return (Point2D JavaDoc)ref.clone();
76     }
77
78     /**
79      * Returns the orientation of this marker.
80      */

81     public double getOrient(){
82         return orient;
83     }
84
85     /**
86      * Returns the <code>GraphicsNode</code> that draws this marker.
87      */

88     public GraphicsNode getMarkerNode(){
89         return markerNode;
90     }
91 }
92
Popular Tags