本文整理汇总了C++中openstudio::model::ModelObject::parent方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelObject::parent方法的具体用法?C++ ModelObject::parent怎么用?C++ ModelObject::parent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openstudio::model::ModelObject
的用法示例。
在下文中一共展示了ModelObject::parent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onAddObject
void SpaceTypesController::onAddObject(const openstudio::model::ModelObject& modelObject)
{
if (IddObjectType::OS_SpaceType == modelObject.iddObjectType().value()) {
openstudio::model::SpaceType(this->model());
return;
}
boost::optional<model::ParentObject> parent = modelObject.parent();
OS_ASSERT(parent);
// Expect a load from the gridview loads tab
switch (modelObject.iddObjectType().value()){
case IddObjectType::OS_People:
openstudio::model::People(openstudio::model::PeopleDefinition(this->model())).setParent(*parent);
break;
case IddObjectType::OS_InternalMass:
openstudio::model::InternalMass(openstudio::model::InternalMassDefinition(this->model())).setParent(*parent);
break;
case IddObjectType::OS_Lights:
openstudio::model::Lights(openstudio::model::LightsDefinition(this->model())).setParent(*parent);
break;
case IddObjectType::OS_Luminaire:
openstudio::model::Luminaire(openstudio::model::LuminaireDefinition(this->model())).setParent(*parent);
break;
case IddObjectType::OS_ElectricEquipment:
openstudio::model::ElectricEquipment(openstudio::model::ElectricEquipmentDefinition(this->model())).setParent(*parent);
break;
case IddObjectType::OS_GasEquipment:
openstudio::model::GasEquipment(openstudio::model::GasEquipmentDefinition(this->model())).setParent(*parent);
break;
case IddObjectType::OS_SteamEquipment:
openstudio::model::SteamEquipment(openstudio::model::SteamEquipmentDefinition(this->model())).setParent(*parent);
break;
case IddObjectType::OS_OtherEquipment:
openstudio::model::OtherEquipment(openstudio::model::OtherEquipmentDefinition(this->model())).setParent(*parent);
break;
case IddObjectType::OS_WaterUse_Equipment:
openstudio::model::WaterUseEquipment(openstudio::model::WaterUseEquipmentDefinition(this->model())).setParent(*parent);
break;
default:
// Should not get here
OS_ASSERT(false);
LOG_FREE(Error, "LoadsController", "Unknown IddObjectType '" << modelObject.iddObjectType().valueName() << "'");
}
}