LCOV - code coverage report
Current view: top level - apps - gdalalg_vector_buffer.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2025-06-19 12:30:01 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  "gdal vector buffer"
       5             :  * Author:   Even Rouault <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_VECTOR_BUFFER_INCLUDED
      14             : #define GDALALG_VECTOR_BUFFER_INCLUDED
      15             : 
      16             : #include "gdalalg_vector_geom.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                    GDALVectorBufferAlgorithm                         */
      22             : /************************************************************************/
      23             : 
      24             : class GDALVectorBufferAlgorithm /* non final */
      25             :     : public GDALVectorGeomAbstractAlgorithm
      26             : {
      27             :   public:
      28             :     static constexpr const char *NAME = "buffer";
      29             :     static constexpr const char *DESCRIPTION =
      30             :         "Compute a buffer around geometries of a vector dataset.";
      31             :     static constexpr const char *HELP_URL = "/programs/gdal_vector_buffer.html";
      32             : 
      33             :     struct Options : public GDALVectorGeomAbstractAlgorithm::OptionsBase
      34             :     {
      35             :         double m_distance = 0;
      36             :         std::string m_endCapStyle = "round";
      37             :         std::string m_joinStyle = "round";
      38             :         double m_mitreLimit = 5;
      39             :         int m_quadrantSegments = 8;
      40             :         std::string m_side = "both";
      41             :     };
      42             : 
      43             :     std::unique_ptr<OGRLayerWithTranslateFeature>
      44             :     CreateAlgLayer(OGRLayer &srcLayer) override;
      45             : 
      46             :     explicit GDALVectorBufferAlgorithm(bool standaloneStep = false);
      47             : 
      48             :   private:
      49             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      50             : 
      51             :     Options m_opts{};
      52             : };
      53             : 
      54             : /************************************************************************/
      55             : /*                    GDALVectorBufferAlgorithmStandalone               */
      56             : /************************************************************************/
      57             : 
      58          16 : class GDALVectorBufferAlgorithmStandalone final
      59             :     : public GDALVectorBufferAlgorithm
      60             : {
      61             :   public:
      62           8 :     GDALVectorBufferAlgorithmStandalone()
      63           8 :         : GDALVectorBufferAlgorithm(/* standaloneStep = */ true)
      64             :     {
      65           8 :     }
      66             : 
      67             :     ~GDALVectorBufferAlgorithmStandalone() override;
      68             : };
      69             : 
      70             : //! @endcond
      71             : 
      72             : #endif /* GDALALG_VECTOR_BUFFER_INCLUDED */

Generated by: LCOV version 1.14