Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.api / src / main / java / org / gvsig / fmap / geom / primitive / Arc.java @ 42356

History | View | Annotate | Download (5.95 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

    
25
package org.gvsig.fmap.geom.primitive;
26

    
27
import org.gvsig.fmap.geom.operation.GeometryOperationException;
28
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
29

    
30
/**
31
 * <p>
32
 * This interface is equivalent to the GM_Arc specified in <a href=
33
 * "http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012"
34
 * >ISO 19107</a>. A Arc is defined by 3 points, and consists of the arc of the
35
 * circle determined by the 3 points, starting at the first, passing through the
36
 * second and terminating at the third. If the 3 points are co-linear, then the
37
 * arc shall be a 3-point line string, and will not be able to return values for
38
 * center, radius, start angle and end angle.
39
 * </p>
40
 *
41
 * @see <a
42
 *      href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=26012">ISO
43
 *      19107</a>
44
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
45
 */
46
public interface Arc extends Curve {
47

    
48
    /**
49
     * Sets the three points to define an arc.
50
     * These are three ordered points that belong to the arc
51
     * (none of them is the center of the ellipse/circle). Therefore
52
     * they must not be aligned.
53
     *
54
     * @param startPoint
55
     *            The start point of an arc.
56
     * @param midPoint
57
     *            The middle point of an arc.
58
     * @param endPoint
59
     *            The end point of an arc.
60
     * @exception IllegalArgumentException
61
     *                if the three points are aligned or
62
     *                there is a repeated point.
63
     *
64
     */
65
    void setPoints(Point startPoint, Point midPoint, Point endPoint);
66

    
67
    /**
68
     * Sets the values to define an arc.
69
     *
70
     * @param center
71
     *            The center of the arc.
72
     * @param radius
73
     *            The radius.
74
     * @param startAngle
75
     *            The start angle of the arc (in radians)
76
     * @param angleExt
77
     *            The angular extent of the arc (in radians).
78
     *
79
     *            The sign convention is:
80
     *
81
     *            startAngle = 0 is "3 o'clock";
82
     *            startAngle = (PI / 3) is "1 o'clock";
83
     *            angleExt > 0 means "advancing clockwise";
84
     *            angleExt < 0 means "advancing counterclockwise".
85
     */
86
    void setPoints(Point center, double radius, double startAngle, double angleExt);
87

    
88
    /**
89
     * Sets the values to define an arc.
90
     *
91
     * @param center
92
     *            The center of the arc.
93
     * @param radius
94
     *            The radius.
95
     * @param startAngle
96
     *            The start angle of the arc (in radians)
97
     * @param angleExt
98
     *            The angular extent of the arc (in radians).
99
     *
100
     *            The sign convention is:
101
     *
102
     *            startAngle = 0 is "3 o'clock";
103
     *            startAngle = (PI / 3) is "1 o'clock";
104
     *            angleExt > 0 means "advancing clockwise";
105
     *            angleExt < 0 means "advancing counterclockwise".
106
     */
107
    void setPointsStartExt(Point center, double radius, double startAngle, double angleExt);
108

    
109
    /**
110
     * Sets the values to define an arc. The arc will go from
111
     * startAngle to endAngle clockwise. Angles will be
112
     * normalized to ]-PI, PI] (-PI excluded) before creating
113
     * the arc.
114
     *
115
     * @param center
116
     *            The center of the arc.
117
     * @param radius
118
     *            The radius.
119
     * @param startAngle
120
     *            The start angle of the arc (in radians)
121
     * @param endAngle
122
     *            The end angle of the arc (in radians).
123
     *
124
     */
125
    void setPointsStartEnd(Point center, double radius, double startAngle, double endAngle);
126

    
127
    /**
128
     * Return the first point that has been used to create the arc.
129
     *
130
     * @return
131
     *         The first point of the arc.
132
     */
133
    Point getInitPoint();
134

    
135
    /**
136
     * Return the end point that has been used to create the arc.
137
     *
138
     * @return
139
     *         The end point of the arc.
140
     */
141
    Point getEndPoint();
142

    
143
    /**
144
     * Return the center of the arc, that is, the center of the ellipse/circle
145
     * in which the arc is based.
146
     *
147
     * @return The center of the arc.
148
     */
149
    Point getCenterPoint();
150

    
151
    /**
152
     * Return the middle point of the arc.
153
     *
154
     * @return The middle point of the arc.
155
     */
156
    Point getMiddlePoint();
157

    
158
    /**
159
     * Returns the counterclockwise angle formed by the horizontal line passing
160
     * through the center, the center itself and the starting point.
161
     *
162
     * @return
163
     * @throws GeometryOperationNotSupportedException
164
     * @throws GeometryOperationException
165
     */
166
    double getStartAngle() throws GeometryOperationNotSupportedException, GeometryOperationException;
167

    
168
    /**
169
     * Returns the counterclockwise angle formed by the horizontal line passing
170
     * through the center, the center itself and the ending point.
171
     *
172
     * @return
173
     * @throws GeometryOperationNotSupportedException
174
     * @throws GeometryOperationException
175
     */
176
    double getEndAngle() throws GeometryOperationNotSupportedException, GeometryOperationException;
177

    
178
}