bool ShadingSurfaceGroup_Impl::setSpace(const Space& space) { bool result = setPointer(OS_ShadingSurfaceGroupFields::SpaceName, space.handle()); if (result){ bool test = setString(OS_ShadingSurfaceGroupFields::ShadingSurfaceType, "Space"); OS_ASSERT(test); boost::optional<SubSurface> shadedSubSurface = this->shadedSubSurface(); if (shadedSubSurface){ boost::optional<Space> otherSpace = shadedSubSurface->space(); if (otherSpace){ if (space.handle() == otherSpace->handle()){ // ok }else{ resetShadedObject(); } }else{ resetShadedObject(); } } } return result; }
bool InteriorPartitionSurfaceGroup_Impl::setSpace(const Space& space) { return setPointer(OS_InteriorPartitionSurfaceGroupFields::SpaceName, space.handle()); }
OptionalModelObject ReverseTranslator::translateFenestrationSurfaceDetailed( const WorkspaceObject & workspaceObject ) { if( workspaceObject.iddObject().type() != IddObjectType::FenestrationSurface_Detailed ){ LOG(Error, "WorkspaceObject is not IddObjectType: Site:FenestrationSurface_Detailed"); return boost::none; } openstudio::Point3dVector vertices = getVertices(FenestrationSurface_DetailedFields::NumberofVertices + 1, workspaceObject); boost::optional<SubSurface> subSurface; try{ subSurface = SubSurface(vertices, m_model); }catch(const std::exception&){ LOG(Error, "Cannot create SubSurface for object: " << workspaceObject); return boost::none; } OptionalString s = workspaceObject.name(); if(s) { subSurface->setName(*s); } OptionalWorkspaceObject target = workspaceObject.getTarget(openstudio::FenestrationSurface_DetailedFields::ConstructionName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<ConstructionBase>()){ subSurface->setConstruction(modelObject->cast<ConstructionBase>()); } } } target = workspaceObject.getTarget(openstudio::FenestrationSurface_DetailedFields::BuildingSurfaceName); if (target){ OptionalModelObject modelObject = translateAndMapWorkspaceObject(*target); if (modelObject){ if (modelObject->optionalCast<Surface>()){ subSurface->setSurface(modelObject->cast<Surface>()); } } } // needs to be after .setSurface. s = workspaceObject.getString(FenestrationSurface_DetailedFields::SurfaceType); if (s) { if (istringEqual("Window", *s)){ s = "FixedWindow"; boost::optional<Surface> surface = subSurface->surface(); if (surface){ if ((surface->surfaceType() == "RoofCeiling") && (surface->outsideBoundaryCondition() == "Outdoors")){ s = "Skylight"; } } } subSurface->setSubSurfaceType(*s); } target = workspaceObject.getTarget(openstudio::FenestrationSurface_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>(); OptionalSurface surface = subSurface->surface(); if (surface && surface->space()){ Space space = surface->space().get(); if (surface->adjacentSurface()){ Surface adjacentSurface = surface->adjacentSurface().get(); if (adjacentSurface.space() && adjacentSpace.handle() == adjacentSurface.space()->handle()){ Transformation transformation = adjacentSpace.transformation().inverse()*surface->space()->transformation(); // duplicate subsurface in other space SubSurface adjacentSubSurface = subSurface->clone(m_model).cast<SubSurface>(); adjacentSubSurface.setName(subSurface->name().get() + " Reversed"); std::reverse(vertices.begin(), vertices.end()); adjacentSubSurface.setVertices(transformation*vertices); adjacentSubSurface.setSurface(adjacentSurface); subSurface->setAdjacentSubSurface(adjacentSubSurface); return subSurface.get(); } } } } }else if (target->iddObject().type() == IddObjectType::FenestrationSurface_Detailed){ // SubSurface boundary condition // see if we have already mapped other sub surface, don't do it here because that is circular auto it = m_workspaceToModelMap.find(target->handle()); if( it != m_workspaceToModelMap.end()){ if (it->second.optionalCast<SubSurface>()){ // this will set other side boundary object on both surfaces SubSurface adjacentSubSurface = it->second.cast<SubSurface>(); subSurface->setAdjacentSubSurface(adjacentSubSurface); return subSurface.get(); } } }else{ LOG(Error, "OutsideBoundaryConditionObject not yet mapped for object of type " << target->iddObject().name()); } } // DLM: should these be before control paths that return above? OptionalDouble d = workspaceObject.getDouble(FenestrationSurface_DetailedFields::ViewFactortoGround); if (d) { subSurface->setViewFactortoGround(*d); } target = workspaceObject.getTarget(openstudio::FenestrationSurface_DetailedFields::ShadingControlName); if (target){ LOG(Warn, "Shading Control Name not yet mapped for FenestrationSurface:Detailed"); } target = workspaceObject.getTarget(openstudio::FenestrationSurface_DetailedFields::FrameandDividerName); if (target){ LOG(Warn, "Frame and Divider Name not yet mapped for FenestrationSurface:Detailed"); } OptionalInt i = workspaceObject.getInt(FenestrationSurface_DetailedFields::Multiplier); if (i) { subSurface->setMultiplier(*i); } return subSurface.get(); }
bool SpaceItem_Impl::setSpace(const Space& space) { return setPointer(this->spaceIndex(), space.handle()); }