Skip to content

Commit

Permalink
Fix inaccessible GCP properties, change to public (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
pericles-tpt authored Oct 30, 2023
1 parent 7effafe commit 67bb5f9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 49 deletions.
42 changes: 21 additions & 21 deletions godal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3994,13 +3994,13 @@ func (ds *Dataset) NearblackInto(sourceDs *Dataset, switches []string, opts ...N

// GCP mirrors the structure of the GDAL_GCP type
type GCP struct {
pszId string
pszInfo string
dfGCPPixel float64
dfGCPLine float64
dfGCPX float64
dfGCPY float64
dfGCPZ float64
PszId string
PszInfo string
DfGCPPixel float64
DfGCPLine float64
DfGCPX float64
DfGCPY float64
DfGCPZ float64
}

// gdalGCPToGoGCPArray is a utility function for conversion from `C.GCPsAndCount` (GDAL) to `[]GCP` (Go)
Expand All @@ -4015,13 +4015,13 @@ func gdalGCPToGoGCPArray(gcp C.GCPsAndCount) []GCP {
ret = make([]GCP, gcp.numGCPs)
for i := 0; i < len(ret); i++ {
ret[i] = GCP{
pszId: C.GoString(gcps[i].pszId),
pszInfo: C.GoString(gcps[i].pszInfo),
dfGCPPixel: float64(gcps[i].dfGCPPixel),
dfGCPLine: float64(gcps[i].dfGCPLine),
dfGCPX: float64(gcps[i].dfGCPX),
dfGCPY: float64(gcps[i].dfGCPY),
dfGCPZ: float64(gcps[i].dfGCPZ),
PszId: C.GoString(gcps[i].pszId),
PszInfo: C.GoString(gcps[i].pszInfo),
DfGCPPixel: float64(gcps[i].dfGCPPixel),
DfGCPLine: float64(gcps[i].dfGCPLine),
DfGCPX: float64(gcps[i].dfGCPX),
DfGCPY: float64(gcps[i].dfGCPY),
DfGCPZ: float64(gcps[i].dfGCPZ),
}
}

Expand Down Expand Up @@ -4063,13 +4063,13 @@ func (ds *Dataset) SetGCPs(GCPList []GCP, opts ...SetGCPsOption) error {
gcpZs = make([]float64, len(GCPList))
)
for i, g := range GCPList {
ids[i] = g.pszId
infos[i] = g.pszInfo
gcpPixels[i] = (g.dfGCPPixel)
gcpLines[i] = (g.dfGCPLine)
gcpXs[i] = (g.dfGCPX)
gcpYs[i] = (g.dfGCPY)
gcpZs[i] = (g.dfGCPZ)
ids[i] = g.PszId
infos[i] = g.PszInfo
gcpPixels[i] = (g.DfGCPPixel)
gcpLines[i] = (g.DfGCPLine)
gcpXs[i] = (g.DfGCPX)
gcpYs[i] = (g.DfGCPY)
gcpZs[i] = (g.DfGCPZ)
}
cIds := sliceToCStringArray(ids)
defer cIds.free()
Expand Down
56 changes: 28 additions & 28 deletions godal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4594,22 +4594,22 @@ func TestSetGCPsAddTwoGCPs(t *testing.T) {

var gcpList []GCP = []GCP{
{
pszId: "",
pszInfo: "",
dfGCPPixel: 0,
dfGCPLine: 1,
dfGCPX: 0,
dfGCPY: 0,
dfGCPZ: 0,
PszId: "",
PszInfo: "",
DfGCPPixel: 0,
DfGCPLine: 1,
DfGCPX: 0,
DfGCPY: 0,
DfGCPZ: 0,
},
{
pszId: "hello",
pszInfo: "world",
dfGCPPixel: 1,
dfGCPLine: 0,
dfGCPX: 1,
dfGCPY: 1,
dfGCPZ: 1,
PszId: "hello",
PszInfo: "world",
DfGCPPixel: 1,
DfGCPLine: 0,
DfGCPX: 1,
DfGCPY: 1,
DfGCPZ: 1,
},
}
sr, err := NewSpatialRefFromEPSG(3857)
Expand Down Expand Up @@ -4709,22 +4709,22 @@ func TestSetGCPs2AddTwoGCPs(t *testing.T) {

var gcpList []GCP = []GCP{
{
pszId: "",
pszInfo: "",
dfGCPPixel: 0,
dfGCPLine: 1,
dfGCPX: 0,
dfGCPY: 0,
dfGCPZ: 0,
PszId: "",
PszInfo: "",
DfGCPPixel: 0,
DfGCPLine: 1,
DfGCPX: 0,
DfGCPY: 0,
DfGCPZ: 0,
},
{
pszId: "hello",
pszInfo: "world",
dfGCPPixel: 1,
dfGCPLine: 0,
dfGCPX: 1,
dfGCPY: 1,
dfGCPZ: 1,
PszId: "hello",
PszInfo: "world",
DfGCPPixel: 1,
DfGCPLine: 0,
DfGCPX: 1,
DfGCPY: 1,
DfGCPZ: 1,
},
}
sr, err := NewSpatialRefFromEPSG(3857)
Expand Down

0 comments on commit 67bb5f9

Please sign in to comment.