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.primitive;
033    
034    import org.opengis.geometry.coordinate.GenericCurve;
035    import org.opengis.geometry.coordinate.PointArray;
036    import org.opengis.annotation.Association;
037    import org.opengis.annotation.UML;
038    
039    import static org.opengis.annotation.Obligation.*;
040    import static org.opengis.annotation.Specification.*;
041    
042    
043    /**
044     * Defines a homogeneous segment of a {@linkplain Curve curve}.
045     * Each {@code CurveSegment} shall be in, at most, one {@linkplain Curve curve}.
046     *
047     * @version <A HREF="http://www.opengeospatial.org/standards/as">ISO 19107</A>
048     * @author Martin Desruisseaux (IRD)
049     * @since GeoAPI 1.0
050     */
051    @UML(identifier="GM_CurveSegment", specification=ISO_19107)
052    public interface CurveSegment extends GenericCurve {
053        /**
054         * Returns the curve which own this curve segment. This method is <em>optional</em> since
055         * the association in ISO 19107 is navigable only from {@code Curve} to {@code CurveSegment},
056         * not the other way.
057         *
058         * <blockquote><font size=-1><b>NOTE:</b>
059         * In the specification, curve segments do not appear except in the context of a curve,
060         * and therefore this method should never returns {@code null} which would preclude the
061         * use of curve segments except in this manner. While this would not affect the specification,
062         * allowing {@code null} owner allows other standards based on ISO 19107 one to use curve
063         * segments in a more open-ended manner.
064         * </font></blockquote>
065         *
066         * @return The owner of this curve segment, or {@code null} if the association is
067         *         not available or not implemented that way.
068         *
069         * @see Curve#getSegments
070         * @see SurfacePatch#getSurface
071         * @issue http://jira.codehaus.org/browse/GEO-63
072         */
073        @Association("Segmentation")
074        @UML(identifier="curve", obligation=OPTIONAL, specification=ISO_19107)
075        Curve getCurve();
076    
077        /**
078         * Specifies the curve interpolation mechanism used for this segment. This mechanism
079         * uses the control points and control parameters to determine the position of this
080         * {@code CurveSegment}.
081         *
082         * @return The interpolation mechanism used for this segment.
083         */
084        @UML(identifier="interpolation", obligation=MANDATORY, specification=ISO_19107)
085        CurveInterpolation getInterpolation();
086    
087        /**
088         * Specifies the type of continuity between this curve segment and its immediate neighbors.
089         * If this is the first curve segment in the curve, this value is ignored.
090         *
091         * <blockquote><font size=-1><b>NOTE:</b>
092         * Use of these values is only appropriate when the basic curve definition is an underdetermined
093         * system. For example, line strings and segments cannot support continuity above C<sup>0</sup>,
094         * since there is no spare control parameter to adjust the incoming angle at the end points of
095         * the segment. Spline functions on the other hand often have extra degrees of freedom on end
096         * segments that allow them to adjust the values of the derivatives to support C<sup>1</sup>
097         * or higher continuity.
098         * </font></blockquote>
099         *
100         * @return The type of continuity between this curve segment and its immediate neighbors.
101         *
102         * @see #getNumDerivativesInterior
103         * @see #getNumDerivativesAtEnd
104         */
105        @UML(identifier="numDerivativesAtStart", obligation=MANDATORY, specification=ISO_19107)
106        int getNumDerivativesAtStart();
107    
108        /**
109         * Specifies the type of continuity that is guaranteed interior to the curve. The default
110         * value of "0" means simple continuity, which is a mandatory minimum level of continuity.
111         * This level is referred to as "C<sup>0</sup>" in mathematical texts. A value of 1 means
112         * that the function and its first derivative are continuous at the appropriate end point:
113         * "C<sup>1</sup>" continuity. A value of "n" for any integer means the function and its
114         * first <var>n</var> derivatives are continuous: "C<sup>n</sup>" continuity.
115         *
116         * @return The type of continuity that is guaranteed interior to the curve.
117         *
118         * @see #getNumDerivativesAtStart
119         * @see #getNumDerivativesAtEnd
120         */
121        @UML(identifier="numDerivativesInterior", obligation=MANDATORY, specification=ISO_19107)
122        int getNumDerivativesInterior();
123    
124        /**
125         * Specifies the type of continuity between this curve segment and its immediate neighbors.
126         * If this is the last curve segment in the curve, this value is ignored.
127         *
128         * <blockquote><font size=-1><b>NOTE:</b>
129         * Use of these values is only appropriate when the basic curve definition is an underdetermined
130         * system. For example, line strings and segments cannot support continuity above C<sup>0</sup>,
131         * since there is no spare control parameter to adjust the incoming angle at the end points of
132         * the segment. Spline functions on the other hand often have extra degrees of freedom on end
133         * segments that allow them to adjust the values of the derivatives to support C<sup>1</sup>
134         * or higher continuity.
135         * </font></blockquote>
136         *
137         * @return The type of continuity between this curve segment and its immediate neighbors.
138         *
139         * @see #getNumDerivativesAtStart
140         * @see #getNumDerivativesInterior
141         */
142        @UML(identifier="numDerivativesAtEnd", obligation=MANDATORY, specification=ISO_19107)
143        int getNumDerivativesAtEnd();
144    
145        /**
146         * Returns an ordered array of point values that lie on the {@linkplain CurveSegment curve segment}.
147         * In most cases, these will be related to control points used in the construction of the segment.
148         * The control points of a curve segment are use to control its shape, and are not always on the
149         * curve segment itself. For example in a spline curve, the curve segment is given as a weighted
150         * vector sum of the control points. Each weight function will have a maximum within the
151         * constructive parameter interval, which will roughly correspond to the point on the curve
152         * where it passes closest that the corresponding control point. These points, the values of
153         * the curve at the maxima of the weight functions, will be the sample points for the curve
154         * segment.
155         *
156         * @return The control points.
157         *
158         * @todo This interface has been removed from ISO 19107:2008 draft, since it is now
159         *       inherited from {@link GenericCurve}.
160         */
161        @UML(identifier="samplePoint", obligation=MANDATORY, specification=ISO_19107)
162        PointArray getSamplePoints();
163    
164        /**
165         * Returns an ordered pair of points, which are the start point and end point of the curve.
166         * This method operates with the same semantics as that on {@linkplain Curve#getBoundary curve}
167         * except that the end points of a {@code CurveSegment} are not necessarily existing
168         * {@linkplain Point points} and thus the boundary may contain transient {@linkplain Point points}.
169         *
170         * <blockquote><font size=-1><b>NOTE:</b>
171         * The above {@linkplain CurveBoundary curve boundary} will almost always be two distinct
172         * positions, but, like {@linkplain Curve curves}, {@code CurveSegment}s can be cycles in
173         * themselves. The most likely scenario is that all of the points used will be transients
174         * (constructed to support the return value), except for the start point and end point of
175         * the aggregated {@linkplain Curve curve}. These two positions, in the case where the
176         * {@linkplain Curve curve} is involved in a {@linkplain org.opengis.geometry.complex.Complex complex},
177         * will be represented as {@linkplain Point points} in the same complex.
178         * </font></blockquote>
179         *
180         * @return The sets of positions on the boundary.
181         *
182         * @todo This interface has been removed from ISO 19107:2008 draft, since it is now
183         *       inherited from {@link GenericCurve}.
184         */
185        @UML(identifier="boundary", obligation=MANDATORY, specification=ISO_19107)
186        CurveBoundary getBoundary();
187    
188        /**
189         * Reverses the orientation of the parameterizations of the segment.
190         *
191         * @return The reverse of this curve segment.
192         */
193        @UML(identifier="reverse", obligation=MANDATORY, specification=ISO_19107)
194        CurveSegment reverse();
195    }