Coverage Report

Created: 2026-02-14 09:00

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
84.1k
    {
51
84.1k
        return gcp.pszId;
52
84.1k
    }
53
54
    void SetId(const char *pszId);
55
56
    /** Returns the "info" member. */
57
    inline const char *Info() const
58
168k
    {
59
168k
        return gcp.pszInfo;
60
168k
    }
61
62
    void SetInfo(const char *pszInfo);
63
64
    /** Returns the "pixel" member. */
65
    inline double Pixel() const
66
84.1k
    {
67
84.1k
        return gcp.dfGCPPixel;
68
84.1k
    }
69
70
    /** Returns a reference to the "pixel" member. */
71
    inline double &Pixel()
72
27.3k
    {
73
27.3k
        return gcp.dfGCPPixel;
74
27.3k
    }
75
76
    /** Returns the "line" member. */
77
    inline double Line() const
78
84.1k
    {
79
84.1k
        return gcp.dfGCPLine;
80
84.1k
    }
81
82
    /** Returns a reference to the "line" member. */
83
    inline double &Line()
84
27.3k
    {
85
27.3k
        return gcp.dfGCPLine;
86
27.3k
    }
87
88
    /** Returns the "X" member. */
89
    inline double X() const
90
84.1k
    {
91
84.1k
        return gcp.dfGCPX;
92
84.1k
    }
93
94
    /** Returns a reference to the "X" member. */
95
    inline double &X()
96
27.8k
    {
97
27.8k
        return gcp.dfGCPX;
98
27.8k
    }
99
100
    /** Returns the "Y" member. */
101
    inline double Y() const
102
84.1k
    {
103
84.1k
        return gcp.dfGCPY;
104
84.1k
    }
105
106
    /** Returns a reference to the "Y" member. */
107
    inline double &Y()
108
27.8k
    {
109
27.8k
        return gcp.dfGCPY;
110
27.8k
    }
111
112
    /** Returns the "Z" member. */
113
    inline double Z() const
114
155k
    {
115
155k
        return gcp.dfGCPZ;
116
155k
    }
117
118
    /** Returns a reference to the "Z" member. */
119
    inline double &Z()
120
25.3k
    {
121
25.3k
        return gcp.dfGCPZ;
122
25.3k
    }
123
124
    /** Casts as a C GDAL_GCP pointer */
125
    inline const GDAL_GCP *c_ptr() const
126
8.74k
    {
127
8.74k
        return &gcp;
128
8.74k
    }
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