LCOV - code coverage report
Current view: top level - ogr - ogrsurface.cpp (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 6 6 100.0 %
Date: 2024-05-04 12:52:34 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  OpenGIS Simple Features Reference Implementation
       4             :  * Purpose:  The OGRSurface class.
       5             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 1999, Frank Warmerdam
       9             :  *
      10             :  * Permission is hereby granted, free of charge, to any person obtaining a
      11             :  * copy of this software and associated documentation files (the "Software"),
      12             :  * to deal in the Software without restriction, including without limitation
      13             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      14             :  * and/or sell copies of the Software, and to permit persons to whom the
      15             :  * Software is furnished to do so, subject to the following conditions:
      16             :  *
      17             :  * The above copyright notice and this permission notice shall be included
      18             :  * in all copies or substantial portions of the Software.
      19             :  *
      20             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      21             :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      22             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      23             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      24             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      25             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      26             :  * DEALINGS IN THE SOFTWARE.
      27             :  ****************************************************************************/
      28             : 
      29             : #include "cpl_port.h"
      30             : #include "ogr_geometry.h"
      31             : #include "ogr_p.h"
      32             : 
      33             : /**
      34             :  * \fn double OGRSurface::get_Area() const;
      35             :  *
      36             :  * \brief Get the area of the surface object.
      37             :  *
      38             :  * The returned area is a 2D Cartesian (planar) area in square units of the
      39             :  * spatial reference system in use, so potentially "square degrees" for a
      40             :  * geometry expressed in a geographic SRS.
      41             :  *
      42             :  * For polygons the area is computed as the area of the outer ring less
      43             :  * the area of all internal rings.
      44             :  *
      45             :  * This method relates to the SFCOM ISurface::get_Area() method.
      46             :  *
      47             :  * @return the area of the geometry in square units of the spatial reference
      48             :  * system in use.
      49             :  *
      50             :  * @see get_GeodesicArea() for an alternative method returning areas
      51             :  * computed on the ellipsoid, an in square meters.
      52             :  */
      53             : 
      54             : /**
      55             :  * \fn double OGRSurface::get_GeodesicArea(const OGRSpatialReference* poSRSOverride = nullptr) const;
      56             :  *
      57             :  * \brief Get the area of the surface object, considered as a surface on the
      58             :  * underlying ellipsoid of the SRS attached to the geometry.
      59             :  *
      60             :  * The returned area will always be in square meters, and assumes that
      61             :  * polygon edges describe geodesic lines on the ellipsoid.
      62             :  *
      63             :  * If the geometry' SRS is not a geographic one, geometries are reprojected to
      64             :  * the underlying geographic SRS of the geometry' SRS.
      65             :  * OGRSpatialReference::GetDataAxisToSRSAxisMapping() is honored.
      66             :  *
      67             :  * For polygons the area is computed as the area of the outer ring less
      68             :  * the area of all internal rings.
      69             :  *
      70             :  * Note that geometries with circular arcs will be linearized in their original
      71             :  * coordinate space first, so the resulting geodesic area will be an
      72             :  * approximation.
      73             :  *
      74             :  * @param poSRSOverride If not null, overrides OGRGeometry::getSpatialReference()
      75             :  * @return the area of the geometry in square meters, or a negative value in case
      76             :  * of error.
      77             :  *
      78             :  * @see get_Area() for an alternative method returning areas computed in
      79             :  * 2D Cartesian space.
      80             :  *
      81             :  * @since GDAL 3.9
      82             :  */
      83             : 
      84             : /**
      85             :  * \fn OGRErr OGRSurface::PointOnSurface( OGRPoint * poPoint ) const;
      86             :  *
      87             :  * \brief This method relates to the SFCOM
      88             :  * ISurface::get_PointOnSurface() method.
      89             :  *
      90             :  * NOTE: Only implemented when GEOS included in build.
      91             :  *
      92             :  * @param poPoint point to be set with an internal point.
      93             :  *
      94             :  * @return OGRERR_NONE if it succeeds or OGRERR_FAILURE otherwise.
      95             :  */
      96             : 
      97             : /************************************************************************/
      98             : /*                          CastToPolygon()                             */
      99             : /************************************************************************/
     100             : 
     101             : /*! @cond Doxygen_Suppress */
     102             : /**
     103             :  * \brief Cast to polygon
     104             :  *
     105             :  * The passed in geometry is consumed and a new one returned (or NULL in case
     106             :  * of failure)
     107             :  *
     108             :  * @param poSurface the input geometry - ownership is passed to the method.
     109             :  * @return new geometry.
     110             :  */
     111             : 
     112         567 : OGRPolygon *OGRSurface::CastToPolygon(OGRSurface *poSurface)
     113             : {
     114         567 :     OGRSurfaceCasterToPolygon pfn = poSurface->GetCasterToPolygon();
     115         567 :     return pfn(poSurface);
     116             : }
     117             : 
     118             : /************************************************************************/
     119             : /*                          CastToCurvePolygon()                        */
     120             : /************************************************************************/
     121             : 
     122             : /**
     123             :  * \brief Cast to curve polygon
     124             :  *
     125             :  * The passed in geometry is consumed and a new one returned (or NULL in case
     126             :  * of failure)
     127             :  *
     128             :  * @param poSurface the input geometry - ownership is passed to the method.
     129             :  * @return new geometry.
     130             :  */
     131             : 
     132          20 : OGRCurvePolygon *OGRSurface::CastToCurvePolygon(OGRSurface *poSurface)
     133             : {
     134          20 :     OGRSurfaceCasterToCurvePolygon pfn = poSurface->GetCasterToCurvePolygon();
     135          20 :     return pfn(poSurface);
     136             : }
     137             : 
     138             : /*! @endcond */

Generated by: LCOV version 1.14