MCPcopy Create free account
hub / github.com/PDAL/PDAL / getLimits

Function getLimits

plugins/e57/io/Utils.cpp:140–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140bool getLimits(const e57::StructureNode& prototype,
141 const std::string& fieldName, std::pair<double, double>& minmax)
142{
143 // Reset minmax
144 minmax.first = minmax.second = 0;
145
146 std::string minKey = fieldName + "Minimum";
147 std::string maxKey = fieldName + "Maximum";
148 std::string boundingBoxName = fieldName + "Limits";
149
150 if (fieldName.substr(0, 5) == "color")
151 boundingBoxName = "colorLimits";
152 else if (fieldName[0] == 'x' || fieldName[0] == 'y' || fieldName[0] == 'z')
153 boundingBoxName = "cartesianBounds";
154
155 if (prototype.isDefined(boundingBoxName))
156 {
157 e57::StructureNode intbox(prototype.get(boundingBoxName));
158 if (intbox.get(maxKey).type() == e57::E57_SCALED_INTEGER)
159 {
160 minmax.second =
161 static_cast<e57::ScaledIntegerNode>(intbox.get(maxKey))
162 .scaledValue();
163 minmax.first =
164 static_cast<e57::ScaledIntegerNode>(intbox.get(minKey))
165 .scaledValue();
166 }
167 else if (intbox.get(maxKey).type() == e57::E57_FLOAT)
168 {
169 minmax.second =
170 static_cast<e57::FloatNode>(intbox.get(maxKey)).value();
171 minmax.first =
172 static_cast<e57::FloatNode>(intbox.get(minKey)).value();
173 }
174 else if (intbox.get(maxKey).type() == e57::E57_INTEGER)
175 {
176 minmax.second = static_cast<double>(
177 static_cast<e57::IntegerNode>(intbox.get(maxKey)).value());
178 minmax.first = static_cast<double>(
179 static_cast<e57::IntegerNode>(intbox.get(minKey)).value());
180 }
181 }
182 else if (prototype.isDefined(fieldName))
183 {
184 if (prototype.get(fieldName).type() == e57::E57_INTEGER)
185 {
186 minmax.first = static_cast<double>(
187 static_cast<e57::IntegerNode>(prototype.get(fieldName))
188 .minimum());
189 minmax.second = static_cast<double>(
190 static_cast<e57::IntegerNode>(prototype.get(fieldName))
191 .maximum());
192 }
193 else if (prototype.get(fieldName).type() == e57::E57_SCALED_INTEGER)
194 {
195 double scale =
196 static_cast<e57::ScaledIntegerNode>(prototype.get(fieldName))
197 .scale();

Callers 1

decodeHeaderMethod · 0.85

Calls 9

isDefinedMethod · 0.45
getMethod · 0.45
typeMethod · 0.45
scaledValueMethod · 0.45
valueMethod · 0.45
minimumMethod · 0.45
maximumMethod · 0.45
scaleMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected