1 : /******************************************************************************
2 : * $Id: ogrcurve.cpp 16574 2009-03-14 13:09:10Z rouault $
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: The OGRCurve geometry class.
6 : * Author: Frank Warmerdam, warmerda@home.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 1999, Frank Warmerdam
10 : *
11 : * Permission is hereby granted, free of charge, to any person obtaining a
12 : * copy of this software and associated documentation files (the "Software"),
13 : * to deal in the Software without restriction, including without limitation
14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 : * and/or sell copies of the Software, and to permit persons to whom the
16 : * Software is furnished to do so, subject to the following conditions:
17 : *
18 : * The above copyright notice and this permission notice shall be included
19 : * in all copies or substantial portions of the Software.
20 : *
21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 : * DEALINGS IN THE SOFTWARE.
28 : ****************************************************************************/
29 :
30 : #include "ogr_geometry.h"
31 : #include "ogr_p.h"
32 :
33 : CPL_CVSID("$Id: ogrcurve.cpp 16574 2009-03-14 13:09:10Z rouault $");
34 :
35 14474 : OGRCurve::OGRCurve()
36 : {
37 14474 : }
38 :
39 14474 : OGRCurve::~OGRCurve()
40 : {
41 14474 : }
42 :
43 : /************************************************************************/
44 : /* get_IsClosed() */
45 : /************************************************************************/
46 :
47 : /**
48 : * \brief Return TRUE if curve is closed.
49 : *
50 : * Tests if a curve is closed. A curve is closed if its start point is
51 : * equal to its end point.
52 : *
53 : * This method relates to the SFCOM ICurve::get_IsClosed() method.
54 : *
55 : * @return TRUE if closed, else FALSE.
56 : */
57 :
58 0 : int OGRCurve::get_IsClosed() const
59 :
60 : {
61 0 : OGRPoint oStartPoint, oEndPoint;
62 :
63 0 : StartPoint( &oStartPoint );
64 0 : EndPoint( &oEndPoint );
65 :
66 0 : if( oStartPoint.getX() == oEndPoint.getX()
67 : && oStartPoint.getY() == oEndPoint.getY() )
68 : {
69 0 : return TRUE;
70 : }
71 : else
72 : {
73 0 : return FALSE;
74 0 : }
75 : }
76 :
77 : /**
78 : * \fn double OGRCurve::get_Length() const;
79 : *
80 : * \brief Returns the length of the curve.
81 : *
82 : * This method relates to the SFCOM ICurve::get_Length() method.
83 : *
84 : * @return the length of the curve, zero if the curve hasn't been
85 : * initialized.
86 : */
87 :
88 : /**
89 : * \fn void OGRCurve::StartPoint( OGRPoint * poPoint ) const;
90 : *
91 : * \brief Return the curve start point.
92 : *
93 : * This method relates to the SF COM ICurve::get_StartPoint() method.
94 : *
95 : * @param poPoint the point to be assigned the start location.
96 : */
97 :
98 : /**
99 : * \fn void OGRCurve::EndPoint( OGRPoint * poPoint ) const;
100 : *
101 : * \brief Return the curve end point.
102 : *
103 : * This method relates to the SF COM ICurve::get_EndPoint() method.
104 : *
105 : * @param poPoint the point to be assigned the end location.
106 : */
107 :
108 : /**
109 : * \fn void OGRCurve::Value( double dfDistance, OGRPoint * poPoint ) const;
110 : *
111 : * \brief Fetch point at given distance along curve.
112 : *
113 : * This method relates to the SF COM ICurve::get_Value() method.
114 : *
115 : * @param dfDistance distance along the curve at which to sample position.
116 : * This distance should be between zero and get_Length()
117 : * for this curve.
118 : * @param poPoint the point to be assigned the curve position.
119 : */
120 :
|