LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_shift_longitude.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2026-09-11 05:09:32 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  "shift-longitude" step of "raster pipeline"
       5             :  * Author:   Daniel Baston
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2026, ISciences LLC
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_RASTER_SHIFT_LONGITUDE_INCLUDED
      14             : #define GDALALG_RASTER_SHIFT_LONGITUDE_INCLUDED
      15             : 
      16             : #include "gdalrasterpipelinestepalgorithm.h"
      17             : 
      18             : #include <limits>
      19             : 
      20             : //! @cond Doxygen_Suppress
      21             : 
      22             : /************************************************************************/
      23             : /*                  GDALRasterShiftLongitudeAlgorithm                   */
      24             : /************************************************************************/
      25             : 
      26             : class GDALRasterShiftLongitudeAlgorithm /* non final */
      27             :     : public GDALRasterPipelineStepAlgorithm
      28             : {
      29             :   public:
      30             :     static constexpr const char *NAME = "shift-longitude";
      31             :     static constexpr const char *DESCRIPTION =
      32             :         "Shift a raster dataset (e.g. 0-360 to -180-180)";
      33             :     static constexpr const char *HELP_URL =
      34             :         "/programs/gdal_raster_shift_longitude.html";
      35             : 
      36             :     explicit GDALRasterShiftLongitudeAlgorithm(bool standaloneStep = false);
      37             : 
      38             :   protected:
      39             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      40             : 
      41             :   private:
      42             :     double m_minX{0};
      43             :     double m_maxX{0};
      44             :     std::string m_nodata{};
      45             : };
      46             : 
      47             : /************************************************************************/
      48             : /*             GDALRasterShiftLongitudeAlgorithmStandalone              */
      49             : /************************************************************************/
      50             : 
      51         128 : class GDALRasterShiftLongitudeAlgorithmStandalone final
      52             :     : public GDALRasterShiftLongitudeAlgorithm
      53             : {
      54             :   public:
      55          64 :     GDALRasterShiftLongitudeAlgorithmStandalone()
      56          64 :         : GDALRasterShiftLongitudeAlgorithm(/* standaloneStep = */ true)
      57             :     {
      58          64 :     }
      59             : 
      60             :     ~GDALRasterShiftLongitudeAlgorithmStandalone() override;
      61             : };
      62             : 
      63             : //! @endcond
      64             : 
      65             : #endif /* GDALALG_RASTER_SHIFT_LONGITUDE_INCLUDED */

Generated by: LCOV version 1.14