MCPcopy Create free account
hub / github.com/Kitware/VTK / getZOffset

Method getZOffset

ThirdParty/libproj/vtklibproj/src/transformations/defmodel.cpp:127–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 }
126
127 bool getZOffset(int ix, int iy, double &zOffset) const {
128 if (!checkedVertical) {
129 const auto samplesPerPixel = realGrid->samplesPerPixel();
130 if (samplesPerPixel == 1) {
131 sampleZ = 0;
132 } else if (samplesPerPixel < 3) {
133 pj_log(ctx, PJ_LOG_ERROR, "grid %s has not enough samples",
134 realGrid->name().c_str());
135 return false;
136 }
137 bool foundDesc = false;
138 bool foundDescZ = false;
139 for (int i = 0; i < samplesPerPixel; i++) {
140 const auto desc = realGrid->description(i);
141 if (desc == "vertical_offset") {
142 sampleZ = i;
143 foundDescZ = true;
144 }
145 if (!desc.empty()) {
146 foundDesc = true;
147 }
148 }
149 if (foundDesc && !foundDescZ) {
150 pj_log(ctx, PJ_LOG_ERROR,
151 "grid %s : Found band description, "
152 "but not the ones expected",
153 realGrid->name().c_str());
154 return false;
155 }
156 const auto unit = realGrid->unit(sampleZ);
157 if (!unit.empty() && unit != STR_METRE) {
158 pj_log(ctx, PJ_LOG_ERROR,
159 "grid %s : Only unit=metre currently "
160 "handled for this mode",
161 realGrid->name().c_str());
162 return false;
163 }
164 checkedVertical = true;
165 }
166 float zOffsetFloat = 0.0f;
167 const bool ret = realGrid->valueAt(ix, iy, sampleZ, zOffsetFloat);
168 zOffset = zOffsetFloat;
169 return ret;
170 }
171
172 bool getEastingNorthingOffset(int ix, int iy, double &eastingOffset,
173 double &northingOffset) const {

Callers 1

forwardMethod · 0.45

Calls 8

pj_logFunction · 0.85
samplesPerPixelMethod · 0.45
c_strMethod · 0.45
nameMethod · 0.45
descriptionMethod · 0.45
emptyMethod · 0.45
unitMethod · 0.45
valueAtMethod · 0.45

Tested by

no test coverage detected