| 138 | } |
| 139 | |
| 140 | bool 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(); |
no test coverage detected