Coverage Report

Created: 2025-11-16 06:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/gcore/gdal_gcp.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Name:     gdal_gcp.h
4
 * Project:  GDAL Core
5
 * Purpose:  Declaration of gdal::GCP class
6
 * Author:   Even Rouault, <even.rouault@spatialys.com>
7
 *
8
 ******************************************************************************
9
 * Copyright (c) 2024, Even Rouault, <even.rouault@spatialys.com>
10
 *
11
 * SPDX-License-Identifier: MIT
12
 ****************************************************************************/
13
14
#ifndef GDALGCP_H_INCLUDED
15
#define GDALGCP_H_INCLUDED
16
17
#include "cpl_port.h"
18
#include "gdal.h"
19
20
#include <vector>
21
22
/* ******************************************************************** */
23
/*                             gdal::GCP                                */
24
/* ******************************************************************** */
25
26
namespace gdal
27
{
28
/** C++ wrapper over the C GDAL_GCP structure.
29
 *
30
 * It has the same binary layout, and thus a gdal::GCP pointer can be cast as a
31
 * GDAL_GCP pointer.
32
 *
33
 * @since 3.9
34
 */
35
class CPL_DLL GCP
36
{
37
  public:
38
    explicit GCP(const char *pszId = "", const char *pszInfo = "",
39
                 double dfPixel = 0, double dfLine = 0, double dfX = 0,
40
                 double dfY = 0, double dfZ = 0);
41
    ~GCP();
42
    GCP(const GCP &);
43
    explicit GCP(const GDAL_GCP &other);
44
    GCP &operator=(const GCP &);
45
    GCP(GCP &&);
46
    GCP &operator=(GCP &&);
47
48
    /** Returns the "id" member. */
49
    inline const char *Id() const
50
0
    {
51
0
        return gcp.pszId;
52
0
    }
53
54
    void SetId(const char *pszId);
55
56
    /** Returns the "info" member. */
57
    inline const char *Info() const
58
0
    {
59
0
        return gcp.pszInfo;
60
0
    }
61
62
    void SetInfo(const char *pszInfo);
63
64
    /** Returns the "pixel" member. */
65
    inline double Pixel() const
66
0
    {
67
0
        return gcp.dfGCPPixel;
68
0
    }
69
70
    /** Returns a reference to the "pixel" member. */
71
    inline double &Pixel()
72
0
    {
73
0
        return gcp.dfGCPPixel;
74
0
    }
75
76
    /** Returns the "line" member. */
77
    inline double Line() const
78
0
    {
79
0
        return gcp.dfGCPLine;
80
0
    }
81
82
    /** Returns a reference to the "line" member. */
83
    inline double &Line()
84
0
    {
85
0
        return gcp.dfGCPLine;
86
0
    }
87
88
    /** Returns the "X" member. */
89
    inline double X() const
90
0
    {
91
0
        return gcp.dfGCPX;
92
0
    }
93
94
    /** Returns a reference to the "X" member. */
95
    inline double &X()
96
0
    {
97
0
        return gcp.dfGCPX;
98
0
    }
99
100
    /** Returns the "Y" member. */
101
    inline double Y() const
102
0
    {
103
0
        return gcp.dfGCPY;
104
0
    }
105
106
    /** Returns a reference to the "Y" member. */
107
    inline double &Y()
108
0
    {
109
0
        return gcp.dfGCPY;
110
0
    }
111
112
    /** Returns the "Z" member. */
113
    inline double Z() const
114
0
    {
115
0
        return gcp.dfGCPZ;
116
0
    }
117
118
    /** Returns a reference to the "Z" member. */
119
    inline double &Z()
120
0
    {
121
0
        return gcp.dfGCPZ;
122
0
    }
123
124
    /** Casts as a C GDAL_GCP pointer */
125
    inline const GDAL_GCP *c_ptr() const
126
0
    {
127
0
        return &gcp;
128
0
    }
129
130
    static const GDAL_GCP *c_ptr(const std::vector<GCP> &asGCPs);
131
132
    static std::vector<GCP> fromC(const GDAL_GCP *pasGCPList, int nGCPCount);
133
134
  private:
135
    GDAL_GCP gcp;
136
};
137
138
} /* namespace gdal */
139
140
#endif