| 233 | } |
| 234 | |
| 235 | void ModelMerger::mergeBuilding(Building& currentBuilding, const Building& newBuilding) { |
| 236 | if (m_newMergedHandles.find(newBuilding.handle()) != m_newMergedHandles.end()) { |
| 237 | // already merged |
| 238 | return; |
| 239 | } |
| 240 | m_newMergedHandles.insert(newBuilding.handle()); |
| 241 | |
| 242 | currentBuilding.setName(newBuilding.nameString()); |
| 243 | |
| 244 | if (!newBuilding.isNorthAxisDefaulted()) { |
| 245 | currentBuilding.setNorthAxis(newBuilding.northAxis()); |
| 246 | } |
| 247 | |
| 248 | if (newBuilding.nominalFloortoFloorHeight()) { |
| 249 | currentBuilding.setNominalFloortoFloorHeight(newBuilding.nominalFloortoFloorHeight().get()); |
| 250 | } |
| 251 | |
| 252 | if (newBuilding.nominalFloortoCeilingHeight()) { |
| 253 | currentBuilding.setNominalFloortoCeilingHeight(newBuilding.nominalFloortoCeilingHeight().get()); |
| 254 | } |
| 255 | |
| 256 | if (newBuilding.standardsNumberOfStories()) { |
| 257 | currentBuilding.setStandardsNumberOfStories(newBuilding.standardsNumberOfStories().get()); |
| 258 | } |
| 259 | |
| 260 | if (newBuilding.standardsNumberOfAboveGroundStories()) { |
| 261 | currentBuilding.setStandardsNumberOfAboveGroundStories(newBuilding.standardsNumberOfAboveGroundStories().get()); |
| 262 | } |
| 263 | |
| 264 | if (newBuilding.standardsNumberOfLivingUnits()) { |
| 265 | currentBuilding.setStandardsNumberOfLivingUnits(newBuilding.standardsNumberOfLivingUnits().get()); |
| 266 | } |
| 267 | |
| 268 | if (newBuilding.standardsTemplate()) { |
| 269 | currentBuilding.setStandardsTemplate(newBuilding.standardsTemplate().get()); |
| 270 | } |
| 271 | |
| 272 | if (newBuilding.standardsBuildingType()) { |
| 273 | currentBuilding.setStandardsBuildingType(newBuilding.standardsBuildingType().get()); |
| 274 | } |
| 275 | |
| 276 | if (!newBuilding.isRelocatableDefaulted()) { |
| 277 | currentBuilding.setRelocatable(newBuilding.relocatable()); |
| 278 | } |
| 279 | |
| 280 | // default construction set |
| 281 | if (boost::optional<DefaultConstructionSet> newDefaultConstructionSet = newBuilding.defaultConstructionSet()) { |
| 282 | boost::optional<WorkspaceObject> currentObject = getCurrentModelObject(*newDefaultConstructionSet); |
| 283 | if (currentObject) { |
| 284 | auto currentDefaultConstructionSet = currentObject->cast<DefaultConstructionSet>(); |
| 285 | currentBuilding.setDefaultConstructionSet(currentDefaultConstructionSet); |
| 286 | } else { |
| 287 | currentBuilding.resetDefaultConstructionSet(); |
| 288 | } |
| 289 | } else { |
| 290 | currentBuilding.resetDefaultConstructionSet(); |
| 291 | } |
| 292 |
nothing calls this directly
no test coverage detected