| 96 | } |
| 97 | |
| 98 | std::vector<LayerStreamType> DS1::getLayerStreamTypes() const { |
| 99 | if (version < 4) { |
| 100 | return {LayerStreamType::Wall1, LayerStreamType::Floor1, LayerStreamType::Orientation1, LayerStreamType::Substitution, |
| 101 | LayerStreamType::Shadow}; |
| 102 | } |
| 103 | |
| 104 | const auto numWalls = layers.wall.size(); |
| 105 | const auto numOrientations = numWalls; |
| 106 | const auto numFloors = layers.floor.size(); |
| 107 | const auto numShadows = layers.shadow.size(); |
| 108 | const auto numSubstitutions = layers.substitution.size(); |
| 109 | const auto numLayers = numWalls + numOrientations + numFloors + numShadows + numSubstitutions; |
| 110 | |
| 111 | std::vector<LayerStreamType> layerStreamTypes = {}; |
| 112 | layerStreamTypes.reserve(numLayers); |
| 113 | |
| 114 | for (int i = 0; i < numWalls; ++i) { |
| 115 | layerStreamTypes.push_back(static_cast<LayerStreamType>(static_cast<int>(LayerStreamType::Wall1) + i)); |
| 116 | layerStreamTypes.push_back(static_cast<LayerStreamType>(static_cast<int>(LayerStreamType::Orientation1) + i)); |
| 117 | } |
| 118 | |
| 119 | for (int i = 0; i < numFloors; ++i) |
| 120 | layerStreamTypes.push_back(static_cast<LayerStreamType>(static_cast<int>(LayerStreamType::Floor1) + i)); |
| 121 | |
| 122 | for (int i = 0; i < numShadows; ++i) |
| 123 | layerStreamTypes.push_back(static_cast<LayerStreamType>(static_cast<int>(LayerStreamType::Shadow) + i)); |
| 124 | |
| 125 | if (numSubstitutions > 0) |
| 126 | layerStreamTypes.push_back(LayerStreamType::Substitution); |
| 127 | |
| 128 | return layerStreamTypes; |
| 129 | } |
| 130 | |
| 131 | DS1::DS1(const std::string_view path) { |
| 132 | if (const auto lastSeparator = std::max(path.find_last_of('/'), path.find_last_of('\\')); lastSeparator != std::string_view::npos) { |