001    /*
002     *    GeoAPI - Java interfaces for OGC/ISO standards
003     *    http://www.geoapi.org
004     *
005     *    Copyright (C) 2004-2012 Open Geospatial Consortium, Inc.
006     *    All Rights Reserved. http://www.opengeospatial.org/ogc/legal
007     *
008     *    Permission to use, copy, and modify this software and its documentation, with
009     *    or without modification, for any purpose and without fee or royalty is hereby
010     *    granted, provided that you include the following on ALL copies of the software
011     *    and documentation or portions thereof, including modifications, that you make:
012     *
013     *    1. The full text of this NOTICE in a location viewable to users of the
014     *       redistributed or derivative work.
015     *    2. Notice of any changes or modifications to the OGC files, including the
016     *       date changes were made.
017     *
018     *    THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE
019     *    NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
020     *    TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
021     *    THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
022     *    PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
023     *
024     *    COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
025     *    CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
026     *
027     *    The name and trademarks of copyright holders may NOT be used in advertising or
028     *    publicity pertaining to the software without specific, written prior permission.
029     *    Title to copyright in this software and any associated documentation will at all
030     *    times remain with copyright holders.
031     */
032    package org.opengis.geometry.coordinate;
033    
034    import org.opengis.geometry.DirectPosition;
035    import org.opengis.geometry.primitive.Bearing;
036    import org.opengis.annotation.UML;
037    
038    import static org.opengis.annotation.Obligation.*;
039    import static org.opengis.annotation.Specification.*;
040    
041    
042    /**
043     * Arc of the circle determined by 3 points, starting at the first, passing through the second
044     * and terminating at the third. If the 3 points are co-linear, then the arc shall be a 3-point
045     * line string, and will not be able to return values for center, radius, start angle and end
046     * angle.
047     *
048     * <blockquote><font size=2>
049     * <strong>NOTE:</strong> In the model, an  {@code Arc} is a subclass of {@link ArcString},
050     * being a trivial arc string consisting of only one arc. This may be counter-intuitive in the
051     * sense that subclasses are often thought of as more complex than their superclass (with
052     * additional methods and attributes). An {@code Arc} is simpler than a {@linkplain ArcString
053     * arc string} in that it has less data, but it is more complex in that it can return geometric
054     * information such as "center", "start angle", and "end angle". This additional computational
055     * complexity forces the subclassing to be the way it is. In addition the "is type of" semantics
056     * works this way and not the other.
057     * </font></blockquote>
058     *
059     * In its simplest representation, the three points in the {@linkplain #getControlPoints control point}
060     * sequence for an {@code Arc} shall consist of, in order, the initial point on the arc, some
061     * point on the arc neither at the start or end, and the end point of the {@code Arc}. If
062     * additional points are given, then all points must lie on the circle defined by any 3 non-colinear
063     * points in the control point array. All points shall lie on the same circle, and shall be given
064     * in the {@linkplain #getControlPoints control point} array in the order in which they occur on
065     * the arc.
066     *
067     * <blockquote><font size=2>
068     * <strong>NOTE:</strong> The use of the term "midPoint" for the center {@linkplain Position position}
069     * of the {@linkplain #getControlPoints control point} sequence is not meant to require that
070     * the {@linkplain Position position} be the geometric midpoint of the arc. This is the best
071     * choice for this {@linkplain Position position} from a computational stability perspective,
072     * but it is not absolutely necessary for the mathematics to work.
073     * </font></blockquote>
074     *
075     * @version <A HREF="http://www.opengeospatial.org/standards/as">ISO 19107</A>
076     * @author Martin Desruisseaux (IRD)
077     * @since GeoAPI 1.0
078     *
079     * @see GeometryFactory#createArc(Position,Position,Position)
080     * @see GeometryFactory#createArc(Position,Position,double,double[])
081     */
082    @UML(identifier="GM_Arc", specification=ISO_19107)
083    public interface Arc extends ArcString {
084        /**
085         * Calculates the center of the circle of which this arc is a portion as a direct position.
086         * The {@linkplain org.opengis.referencing.crs.CoordinateReferenceSystem coordinate reference system}
087         * of the returned {@linkplain DirectPosition direct position} will be the same as that
088         * for this {@code Arc}. In some extreme cases, the {@linkplain DirectPosition direct
089         * position} as calculated may lie outside the domain of validity of the coordinate reference
090         * system used by this {@code Arc} (especially if the underlying arc has a very large
091         * radius). Implementations may choose an appropriate course of action in such cases.
092         *
093         * @return The center of the circle of which this arc is a portion.
094         */
095        @UML(identifier="center", obligation=MANDATORY, specification=ISO_19107)
096        DirectPosition getCenter();
097    
098        /**
099         * Calculates the radius of the circle of which this arc is a portion.
100         *
101         * @return The radius of the circle of which this arc is a portion.
102         * @unitof Distance
103         */
104        @UML(identifier="radius", obligation=MANDATORY, specification=ISO_19107)
105        double getRadius();
106    
107        /**
108         * Calculates the bearing of the line from the center of the circle of which this arc is a
109         * portion to the start point of the arc. In the 2D case this will be a start angle. In the
110         * 3D case, the normal bearing angle implies that the arc is parallel to the reference circle.
111         * If this is not the case, then the bearing must include altitude information.
112         *
113         * @return The bearing from the {@linkplain #getCenter center} of the circle to the
114         *         {@link #getStartPoint start point} of this arc.
115         *
116         * @todo Inconsistent UML: "startAngle" and "startOfArc" are both used.
117         *       Which one is the right one?
118         */
119        @UML(identifier="startAngle", obligation=MANDATORY, specification=ISO_19107)
120        Bearing getStartAngle();
121    
122        /**
123         * Calculates the bearing of the line from the center of the circle of which this arc is a
124         * portion to the end point of the arc. In the 2D case this will be an end angle. In the 3D
125         * case, the normal bearing angle implies that the arc is parallel to the reference circle.
126         * If this is not the case, then the bearing must include altitude information.
127         *
128         * @return The bearing from the {@linkplain #getCenter center} of the circle to the
129         *         {@link #getEndPoint end point} of this arc.
130         *
131         * @todo Inconsistent UML: "endAngle" and "endOfArc" are both used.
132         *       Which one is the right one?
133         */
134        @UML(identifier="endAngle", obligation=MANDATORY, specification=ISO_19107)
135        Bearing getEndAngle();
136    }