本文整理汇总了C++中ModelObject::handle方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelObject::handle方法的具体用法?C++ ModelObject::handle怎么用?C++ ModelObject::handle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelObject
的用法示例。
在下文中一共展示了ModelObject::handle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isConnected
bool Node_Impl::isConnected(const ModelObject & modelObject)
{
if( auto mo = outletModelObject() ) {
if( modelObject.handle() == mo->handle() ) {
return true;
}
}
if( auto mo = inletModelObject() ) {
if( modelObject.handle() == mo->handle() ) {
return true;
}
}
return false;
}
示例2: coolingPriority
unsigned ZoneHVACEquipmentList_Impl::coolingPriority(const ModelObject & equipment)
{
boost::optional<unsigned> result;
std::vector<IdfExtensibleGroup> groups = extensibleGroups();
for( std::vector<IdfExtensibleGroup>::iterator it = groups.begin();
it != groups.end();
++it )
{
boost::optional<WorkspaceObject> wo = it->cast<WorkspaceExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment);
OS_ASSERT(wo);
if( wo->handle() == equipment.handle() )
{
result = it->getUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence);
break;
}
}
OS_ASSERT(result);
return result.get();
}
示例3: getGroupForModelObject
WorkspaceExtensibleGroup ZoneHVACEquipmentList_Impl::getGroupForModelObject(const ModelObject & modelObject)
{
boost::optional<WorkspaceExtensibleGroup> result;
std::vector<IdfExtensibleGroup> groups = extensibleGroups();
for( std::vector<IdfExtensibleGroup>::iterator it = groups.begin();
it != groups.end();
++it )
{
boost::optional<WorkspaceObject> wo = it->cast<WorkspaceExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment);
OS_ASSERT(wo);
if( wo->handle() == modelObject.handle() )
{
result = it->cast<WorkspaceExtensibleGroup>();
break;
}
}
OS_ASSERT(result);
return result.get();
}
示例4: addModelObject
bool ModelObjectList_Impl::addModelObject(const ModelObject& modelObject ) {
WorkspaceExtensibleGroup eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
bool ok = eg.setPointer(OS_ModelObjectListExtensibleFields::ModelObject,modelObject.handle());
if( !ok ) {
getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex());
}
return ok;
}
示例5: registerObject
bool ComponentData_Impl::registerObject(const ModelObject& object) {
IdfExtensibleGroup eg = pushExtensibleGroup(StringVector());
bool result = !eg.empty();
if (result) {
ModelExtensibleGroup meg = eg.cast<ModelExtensibleGroup>();
result = result && meg.setPointer(OS_ComponentDataExtensibleFields::NameofObject,
object.handle());
}
return result;
}
示例6: exterior
TEST_F(ModelFixture, Construction_Clone)
{
Model library;
// Create some materials
StandardOpaqueMaterial exterior(library);
AirGap air(library);
StandardOpaqueMaterial interior(library);
OpaqueMaterialVector layers;
layers.push_back(exterior);
layers.push_back(air);
layers.push_back(interior);
EXPECT_EQ(static_cast<unsigned>(3), library.getModelObjects<Material>().size());
Construction construction(layers);
ASSERT_EQ(static_cast<unsigned>(3), construction.layers().size());
// Clone into same model
ModelObject clone = construction.clone(library);
// Material ResourceObject instances are shared resources so they have not been cloned
EXPECT_EQ(static_cast<unsigned>(3), library.getModelObjects<Material>().size());
// New handle for cloned construction
EXPECT_FALSE(clone.handle() == construction.handle());
ASSERT_TRUE(clone.optionalCast<Construction>());
ASSERT_EQ(static_cast<unsigned>(3), clone.cast<Construction>().layers().size());
// Clone into a differnt model
Model model;
auto clone2 = construction.clone(model).cast<Construction>();
EXPECT_EQ(static_cast<unsigned>(3), model.getModelObjects<Material>().size());
EXPECT_EQ(static_cast<unsigned>(1), model.getModelObjects<Construction>().size());
// Make sure materials are still hooked up
ASSERT_EQ(static_cast<unsigned>(3), clone2.cast<Construction>().layers().size());
// Clone again
auto clone3 = construction.clone(model).cast<Construction>();
EXPECT_EQ(static_cast<unsigned>(3), model.getModelObjects<Material>().size());
EXPECT_EQ(static_cast<unsigned>(2), model.getModelObjects<Construction>().size());
// Make sure materials are still hooked up
ASSERT_EQ(static_cast<unsigned>(3), clone3.cast<Construction>().layers().size());
EXPECT_FALSE(clone2.handle() == clone3.handle());
}
示例7: removeEquipment
void ZoneHVACEquipmentList_Impl::removeEquipment(const ModelObject & equipment)
{
std::vector<ModelObject> coolingVector = equipmentInCoolingOrder();
std::vector<ModelObject> heatingVector = equipmentInHeatingOrder();
std::vector<IdfExtensibleGroup> groups = extensibleGroups();
for( std::vector<IdfExtensibleGroup>::iterator it = groups.begin();
it != groups.end();
++it )
{
boost::optional<WorkspaceObject> wo = it->cast<WorkspaceExtensibleGroup>().getTarget(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment);
OS_ASSERT(wo);
if( wo->handle() == equipment.handle() )
{
getObject<ModelObject>().eraseExtensibleGroup(it->groupIndex());
break;
}
}
coolingVector.erase(std::find(coolingVector.begin(),coolingVector.end(),equipment));
heatingVector.erase(std::find(heatingVector.begin(),heatingVector.end(),equipment));
unsigned priority = 1;
for( std::vector<ModelObject>::iterator it = coolingVector.begin();
it != coolingVector.end();
++it )
{
WorkspaceExtensibleGroup eg = getGroupForModelObject(*it);
eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence,priority);
priority++;
}
priority = 1;
for( std::vector<ModelObject>::iterator it = heatingVector.begin();
it != heatingVector.end();
++it )
{
WorkspaceExtensibleGroup eg = getGroupForModelObject(*it);
eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence,priority);
priority++;
}
}
示例8: addEquipment
void ZoneHVACEquipmentList_Impl::addEquipment(const ModelObject & equipment)
{
unsigned count = this->equipment().size();
WorkspaceExtensibleGroup eg = getObject<ModelObject>().pushExtensibleGroup().cast<WorkspaceExtensibleGroup>();
bool ok = eg.setPointer(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipment,equipment.handle());
if( ok )
{
eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentCoolingSequence,count + 1);
eg.setUnsigned(OS_ZoneHVAC_EquipmentListExtensibleFields::ZoneEquipmentHeatingorNoLoadSequence,count + 1);
}
else
{
getObject<ModelObject>().eraseExtensibleGroup(eg.groupIndex());
}
}
示例9: ParentObject
ScheduleRule::ScheduleRule(ScheduleRuleset& scheduleRuleset, const ScheduleDay& daySchedule)
: ParentObject(ScheduleRule::iddObjectType(), scheduleRuleset.model())
{
OS_ASSERT(getImpl<detail::ScheduleRule_Impl>());
bool result = setPointer(OS_Schedule_RuleFields::ScheduleRulesetName, scheduleRuleset.handle());
OS_ASSERT(result);
ModelObject clone = daySchedule.clone(scheduleRuleset.model());
result = setPointer(OS_Schedule_RuleFields::DayScheduleName, clone.handle());
OS_ASSERT(result);
if (OptionalScheduleTypeLimits limits = scheduleRuleset.scheduleTypeLimits()) {
clone.cast<ScheduleDay>().setScheduleTypeLimits(*limits);
}
this->setRuleIndex(std::numeric_limits<int>::max());
result = scheduleRuleset.setScheduleRuleIndex(*this, 0);
OS_ASSERT(result);
}
示例10: currentObject
std::vector<ModelObject> getRecursiveChildrenAndResources(const ModelObject& object) {
std::set<Handle> resultSet;
std::pair<HandleSet::const_iterator,bool> insertResult;
std::vector<ModelObject> result;
resultSet.insert(object.handle());
result.push_back(object);
std::deque<ModelObject> objectQueue;
objectQueue.push_back(object);
while (objectQueue.size() > 0) {
ModelObject currentObject(objectQueue[0]);
objectQueue.pop_front();
// resources
for (const ResourceObject& resource : currentObject.resources()) {
insertResult = resultSet.insert(resource.handle());
if (insertResult.second) {
// new object
ModelObject mo = resource.cast<ModelObject>();
result.push_back(mo);
objectQueue.push_back(mo);
}
}
// children
OptionalParentObject opo = currentObject.optionalCast<ParentObject>();
if (opo) {
ParentObject currentParent(*opo);
for (const ModelObject& child : currentParent.children()) {
insertResult = resultSet.insert(child.handle());
if (insertResult.second) {
// new object
result.push_back(child);
objectQueue.push_back(child);
}
}
}
}
return result;
}
示例11: getGroupForModelObject
WorkspaceExtensibleGroup ModelObjectList_Impl::getGroupForModelObject(const ModelObject& modelObject)
{
boost::optional<WorkspaceExtensibleGroup> result;
std::vector<IdfExtensibleGroup> groups = extensibleGroups();
for( const auto & group : groups )
{
boost::optional<WorkspaceObject> wo = group.cast<WorkspaceExtensibleGroup>().getTarget(OS_ModelObjectListExtensibleFields::ModelObject);
OS_ASSERT(wo);
if( wo->handle() == modelObject.handle() )
{
result = group.cast<WorkspaceExtensibleGroup>();
break;
}
}
OS_ASSERT(result);
return result.get();
}
示例12: setTargetObject
bool Connection_Impl::setTargetObject(ModelObject object)
{
return setPointer(openstudio::OS_ConnectionFields::TargetObject,object.handle());;
}
示例13: setSourceObject
void Connection_Impl::setSourceObject(ModelObject object)
{
setPointer(openstudio::OS_ConnectionFields::SourceObject,object.handle());
}
示例14: setActuatedComponentUnique
bool ExternalInterfaceFunctionalMockupUnitImportToActuator_Impl::setActuatedComponentUnique(const ModelObject& modelObject) {
bool result = setPointer(OS_ExternalInterface_FunctionalMockupUnitImport_To_ActuatorFields::ActuatedComponentUniqueName, modelObject.handle());
return result;
}
示例15: setRefrigerationCondenser
bool RefrigerationSystem_Impl::setRefrigerationCondenser(const ModelObject& refrigerationCondenser) {
bool result = setPointer(OS_Refrigeration_SystemFields::RefrigerationCondenserName, refrigerationCondenser.handle());
return result;
}