本文整理汇总了C++中WorkspaceObject::handle方法的典型用法代码示例。如果您正苦于以下问题:C++ WorkspaceObject::handle方法的具体用法?C++ WorkspaceObject::handle怎么用?C++ WorkspaceObject::handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkspaceObject
的用法示例。
在下文中一共展示了WorkspaceObject::handle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: thermalZone
TEST_F(EnergyPlusFixture,ForwardTranslator_Surface_Zone)
{
Model model;
ThermalZone thermalZone(model);
Space space(model);
space.setThermalZone(thermalZone);
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
Surface surface(points, model);
surface.setSpace(space);
ForwardTranslator forwardTranslator;
Workspace workspace = forwardTranslator.translateModel(model);
EXPECT_EQ(0u, forwardTranslator.errors().size());
EXPECT_EQ(0u, forwardTranslator.warnings().size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed).size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Zone).size());
WorkspaceObject surfaceObject = workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed)[0];
WorkspaceObject zoneObject = workspace.getObjectsByType(IddObjectType::Zone)[0];
ASSERT_TRUE(surfaceObject.getTarget(BuildingSurface_DetailedFields::ZoneName));
EXPECT_EQ(zoneObject.handle(), surfaceObject.getTarget(BuildingSurface_DetailedFields::ZoneName)->handle());
}
示例2: objectAdd
void WorkspaceWatcher::objectAdd(const WorkspaceObject& addedObject, const openstudio::IddObjectType& type, const openstudio::UUID& uuid)
{
// Note: Args 2 & 3 are simply to comply with Nano::Signal template parameters
// let change() handle m_dirty and onChangeWorkspace();
m_objectAdded = true;
if (enabled()){
if (!addedObject.handle().isNull()){
this->onObjectAdd(addedObject);
}
}
}
示例3:
BOOST_FOREACH(const WorkspaceObject& object,objectsInNewOrder) {
if (!oMaterial && (object.iddObject().type() == IddObjectType::Material)) {
oMaterial = object;
EXPECT_FALSE(oConstruction);
OptionalUnsigned oIndex = wsOrder.indexInOrder(object.handle());
EXPECT_FALSE(oIndex);
}
if (!oConstruction && (object.iddObject().type() == IddObjectType::Construction)) {
oConstruction = object;
}
if (oMaterial && oConstruction) { break; }
}
示例4: construction
TEST_F(EnergyPlusFixture,ForwardTranslator_Surface_DefaultConstruction)
{
Model model;
Construction construction(model);
DefaultSurfaceConstructions defaultSurfaceConstructions(model);
defaultSurfaceConstructions.setRoofCeilingConstruction(construction);
DefaultConstructionSet defaultConstructionSet(model);
defaultConstructionSet.setDefaultExteriorSurfaceConstructions(defaultSurfaceConstructions);
Building building = model.getUniqueModelObject<Building>();
building.setDefaultConstructionSet(defaultConstructionSet);
Space space(model);
ThermalZone zone(model);
EXPECT_TRUE(space.setThermalZone(zone));
Point3dVector points;
points.push_back(Point3d(0, 1, 0));
points.push_back(Point3d(0, 0, 0));
points.push_back(Point3d(1, 0, 0));
points.push_back(Point3d(1, 1, 0));
Surface surface(points, model);
surface.setSpace(space);
EXPECT_EQ("RoofCeiling", surface.surfaceType());
EXPECT_EQ("Outdoors", surface.outsideBoundaryCondition());
EXPECT_FALSE(surface.adjacentSurface());
ASSERT_TRUE(surface.construction());
EXPECT_TRUE(surface.isConstructionDefaulted());
EXPECT_EQ(construction.handle(), surface.construction()->handle());
ForwardTranslator forwardTranslator;
Workspace workspace = forwardTranslator.translateModel(model);
EXPECT_EQ(0u, forwardTranslator.errors().size());
EXPECT_EQ(0u, forwardTranslator.warnings().size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed).size());
ASSERT_EQ(1u, workspace.getObjectsByType(IddObjectType::Construction).size());
WorkspaceObject surfaceObject = workspace.getObjectsByType(IddObjectType::BuildingSurface_Detailed)[0];
WorkspaceObject constructionObject = workspace.getObjectsByType(IddObjectType::Construction)[0];
ASSERT_TRUE(surfaceObject.getTarget(BuildingSurface_DetailedFields::ConstructionName));
EXPECT_EQ(constructionObject.handle(), surfaceObject.getTarget(BuildingSurface_DetailedFields::ConstructionName)->handle());
}
示例5: translateBuildingSurfaceDetailed
OptionalModelObject ReverseTranslator::translateBuildingSurfaceDetailed( const WorkspaceObject & workspaceObject )
{
if( workspaceObject.iddObject().type() != IddObjectType::BuildingSurface_Detailed ){
LOG(Error, "WorkspaceObject is not IddObjectType: BuildingSurface:Detailed");
return boost::none;
}
openstudio::Point3dVector vertices = getVertices(BuildingSurface_DetailedFields::NumberofVertices + 1, workspaceObject);
boost::optional<Surface> surface;
try{
surface = Surface(vertices, m_model);
}catch(const std::exception&){
LOG(Error, "Cannot create Surface for object: " << workspaceObject);
return boost::none;
}
OptionalString s = workspaceObject.name();
if(s) {
surface->setName(*s);
}
OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::BuildingSurface_DetailedFields::ConstructionName);
if (target){
OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
if (modelObject){
if (modelObject->optionalCast<ConstructionBase>()){
surface->setConstruction(modelObject->cast<ConstructionBase>());
}
}
}
target = workspaceObject.getTarget(openstudio::BuildingSurface_DetailedFields::ZoneName);
if (target){
OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
if (modelObject){
if (modelObject->optionalCast<Space>()){
surface->setSpace(modelObject->cast<Space>());
}
}
}
s = workspaceObject.getString(BuildingSurface_DetailedFields::SurfaceType);
if (s) {
if (istringEqual("Roof", *s) || istringEqual("Ceiling", *s)){
s = "RoofCeiling";
}
surface->setSurfaceType(*s);
}
//std::string surfaceType = surface->surfaceType();
s = workspaceObject.getString(BuildingSurface_DetailedFields::SunExposure);
if (s) {
surface->setSunExposure(*s);
}
s = workspaceObject.getString(BuildingSurface_DetailedFields::WindExposure);
if (s) {
surface->setWindExposure(*s);
}
OptionalDouble d = workspaceObject.getDouble(BuildingSurface_DetailedFields::ViewFactortoGround);
if (d) {
surface->setViewFactortoGround(*d);
}
target = workspaceObject.getTarget(openstudio::BuildingSurface_DetailedFields::OutsideBoundaryConditionObject);
if (target){
if (target->iddObject().type() == IddObjectType::Zone){
// Zone boundary condition
OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target);
if(modelObject->optionalCast<Space>()){
Space adjacentSpace = modelObject->cast<Space>();
if (surface->space()){
// insert this surface in the map so subsurface translation can find it
m_workspaceToModelMap.insert(std::make_pair(workspaceObject.handle(), surface.get()));
// need to translate all sub surfaces here so they will be in adjacent space
for (const WorkspaceObject& workspaceSubSurface : workspaceObject.getSources(IddObjectType::FenestrationSurface_Detailed)){
translateAndMapWorkspaceObject(workspaceSubSurface);
}
// create adjacent surface in other space
surface->createAdjacentSurface(adjacentSpace);
return surface.get();
}
}
}else if (target->iddObject().type() == IddObjectType::BuildingSurface_Detailed){
// Surface boundary condition
// see if we have already mapped other surface, don't do it here because that is circular
if (target->handle() == workspaceObject.handle() ){
// these objects are the same, set boundary condition to adiabatic
surface->setOutsideBoundaryCondition("Adiabatic");
return surface.get();
}else{
//.........这里部分代码省略.........
示例6: LOG
boost::optional<ModelObject> ReverseTranslator::translateAndMapWorkspaceObject(const WorkspaceObject & workspaceObject)
{
auto i = m_workspaceToModelMap.find(workspaceObject.handle());
boost::optional<ModelObject> modelObject;
if( i != m_workspaceToModelMap.end())
{
return boost::optional<ModelObject>(i->second);
}
LOG(Trace,"Translating " << workspaceObject.briefDescription() << ".");
// DLM: the scope of this translator is being changed, we now only import objects from idf
// in the geometry, loads, resources, and general simulation control portions of the model.
// Users can add idf objects to their model using idf measures. Only objects viewable in the
// current GUIs should be imported, I am making an exception for curves.
bool addToUntranslated = true;
switch(workspaceObject.iddObject().type().value())
{
case openstudio::IddObjectType::AirLoopHVAC :
{
//modelObject = translateAirLoopHVAC(workspaceObject);
break;
}
case openstudio::IddObjectType::AirLoopHVAC_ControllerList :
{
break; // no-op
}
case openstudio::IddObjectType::AirLoopHVAC_OutdoorAirSystem :
{
//modelObject = translateAirLoopHVACOutdoorAirSystem(workspaceObject );
break;
}
case openstudio::IddObjectType::AirLoopHVAC_OutdoorAirSystem_EquipmentList :
{
break; // no-op
}
case openstudio::IddObjectType::AirLoopHVAC_ReturnPath :
{
break; // no-op
}
case openstudio::IddObjectType::CoilSystem_Cooling_DX :
{
//modelObject = translateCoilSystemCoolingDX(workspaceObject);
break;
}
case openstudio::IddObjectType::AirLoopHVAC_ZoneSplitter :
{
break; // no-op
}
case openstudio::IddObjectType::AirTerminal_SingleDuct_ConstantVolume_Reheat :
{
modelObject = translateAirTerminalSingleDuctConstantVolumeReheat(workspaceObject );
break;
}
case openstudio::IddObjectType::AirTerminal_SingleDuct_Uncontrolled :
{
//modelObject = translateAirTerminalSingleDuctUncontrolled(workspaceObject );
break;
}
case openstudio::IddObjectType::AirTerminal_SingleDuct_VAV_NoReheat :
{
modelObject = translateAirTerminalSingleDuctVAVNoReheat(workspaceObject );
break;
}
case openstudio::IddObjectType::AirTerminal_SingleDuct_VAV_Reheat :
{
//modelObject = translateAirTerminalSingleDuctVAVReheat(workspaceObject );
break;
}
case openstudio::IddObjectType::AvailabilityManagerAssignmentList :
{
break; // no-op
}
case openstudio::IddObjectType::Branch :
{
break; // no-op
}
case openstudio::IddObjectType::BranchList :
{
break; // no-op
}
case openstudio::IddObjectType::BuildingSurface_Detailed :
{
modelObject = translateBuildingSurfaceDetailed(workspaceObject );
break;
}
case openstudio::IddObjectType::Building :
{
modelObject = translateBuilding(workspaceObject );
break;
}
case openstudio::IddObjectType::Coil_Heating_Fuel :
{
//modelObject = translateCoilHeatingGas(workspaceObject );
break;
}
//.........这里部分代码省略.........
示例7: find
std::vector<Handle>::const_iterator WorkspaceObjectOrder_Impl::getIterator(
const WorkspaceObject& object) const
{
OS_ASSERT(m_directOrder);
return std::find(m_directOrder->begin(),m_directOrder->end(),object.handle());
}
示例8: onObjectRemove
void WorkspaceWatcher::onObjectRemove(const WorkspaceObject& removedObject)
{
OS_ASSERT(removedObject.initialized());
OS_ASSERT(removedObject.workspace().isMember(removedObject.handle()));
}
示例9: onObjectAdd
void WorkspaceWatcher::onObjectAdd(const WorkspaceObject& addedObject)
{
OS_ASSERT(addedObject.initialized());
OS_ASSERT(addedObject.workspace().isMember(addedObject.handle()));
}