Find all regions with a specific attribute value.
212 {
213 std::vector<Region> result;
214 for (
const auto& region :
regions) {
215 auto it = region.attributes.find(key);
216 if (it != region.attributes.end()) {
217 try {
218 if (it->second.type() == value.type()) {
219 if (value.type() == typeid(std::string)) {
220 if (std::any_cast<std::string>(it->second) == std::any_cast<std::string>(value)) {
221 result.push_back(region);
222 }
223 } else if (value.type() == typeid(double)) {
224 if (std::any_cast<double>(it->second) == std::any_cast<double>(value)) {
225 result.push_back(region);
226 }
227 } else if (value.type() == typeid(int)) {
228 if (std::any_cast<int>(it->second) == std::any_cast<int>(value)) {
229 result.push_back(region);
230 }
231 } else if (value.type() == typeid(bool)) {
232 if (std::any_cast<bool>(it->second) == std::any_cast<bool>(value)) {
233 result.push_back(region);
234 }
235 }
236 }
237 } catch (const std::bad_any_cast&) {
238 }
239 }
240 }
241 return result;
242 }
std::vector< Region > regions
Collection of regions belonging to this group.