| 1309 | } |
| 1310 | |
| 1311 | void Map::determineColorsInUse(const std::vector< bool >& by_which_symbols, std::vector< bool >& out) const |
| 1312 | { |
| 1313 | if (getNumSymbols() == 0) |
| 1314 | { |
| 1315 | out.clear(); |
| 1316 | return; |
| 1317 | } |
| 1318 | |
| 1319 | Q_ASSERT(int(by_which_symbols.size()) == getNumSymbols()); |
| 1320 | out.assign(std::size_t(getNumColors()), false); |
| 1321 | for (std::size_t c = 0, last = std::size_t(getNumColors()); c != last; ++c) |
| 1322 | { |
| 1323 | for (std::size_t s = 0, last_s = std::size_t(getNumSymbols()); s != last_s; ++s) |
| 1324 | { |
| 1325 | if (by_which_symbols[s] && getSymbol(int(s))->containsColor(getColor(int(c)))) |
| 1326 | { |
| 1327 | out[c] = true; |
| 1328 | break; |
| 1329 | } |
| 1330 | } |
| 1331 | } |
| 1332 | |
| 1333 | // Include required spot colors, too |
| 1334 | for (std::size_t c = 0, last_c = std::size_t(getNumColors()); c != last_c; ++c) |
| 1335 | { |
| 1336 | if (out[c]) |
| 1337 | continue; |
| 1338 | |
| 1339 | const auto* color = getColor(int(c)); |
| 1340 | if (color->getSpotColorMethod() != MapColor::SpotColor) |
| 1341 | continue; |
| 1342 | |
| 1343 | for (std::size_t o = 0, last_o = std::size_t(getNumColors()); o != last_o; ++o) |
| 1344 | { |
| 1345 | if (!out[o]) |
| 1346 | continue; |
| 1347 | |
| 1348 | const auto* other = getColor(int(o)); |
| 1349 | if (other->getSpotColorMethod() != MapColor::CustomColor) |
| 1350 | continue; |
| 1351 | |
| 1352 | const auto& components = other->getComponents(); |
| 1353 | if (std::any_of(begin(components), end(components), [color](auto& component) { |
| 1354 | return component.spot_color == color; |
| 1355 | })) |
| 1356 | { |
| 1357 | out[c] = true; |
| 1358 | break; |
| 1359 | } |
| 1360 | } |
| 1361 | } |
| 1362 | } |
| 1363 | |
| 1364 | void Map::checkSpotColorPresence() |
| 1365 | { |
no test coverage detected