void ModelObjectVectorController::detach()
{
  if (m_modelObject){
    disconnect(m_modelObject->getImpl<model::detail::ModelObject_Impl>().get());
    m_modelObject.reset();
  }

  if (m_model){
    disconnect(m_model->getImpl<model::detail::Model_Impl>().get());
    m_model.reset();
  }

  detachOtherModelObjects();
}
Exemplo n.º 2
0
void SpaceDesignSpecificationOutdoorAirVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
    if (modelObject.optionalCast<model::Space>()) {
        if (index == OS_SpaceFields::DesignSpecificationOutdoorAirObjectName) {
            emit itemIds(makeVector());
        } else if (index == OS_SpaceFields::SpaceTypeName) {
            detachOtherModelObjects();
            model::Space space = m_modelObject->cast<model::Space>();
            attachOtherModelObjects(space);
            emit itemIds(makeVector());
        }
    } else if (modelObject.optionalCast<model::Building>()) {
        if (index == OS_BuildingFields::SpaceTypeName) {
            detachOtherModelObjects();
            model::Space space = m_modelObject->cast<model::Space>();
            attachOtherModelObjects(space);
            emit itemIds(makeVector());
        }
    } else if (modelObject.optionalCast<model::SpaceType>()) {
        if (index == OS_SpaceTypeFields::DesignSpecificationOutdoorAirObjectName) {
            emit itemIds(makeVector());
        }
    }
}
void SubSurfaceConstructionVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  model::SubSurface subSurface = m_modelObject->cast<model::SubSurface>();

  if (modelObject.optionalCast<model::SubSurface>()){
    if (index == OS_SubSurfaceFields::ConstructionName){
      emit itemIds(makeVector());
    }else if (index == OS_SubSurfaceFields::SurfaceName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::Surface>()){
    if (index == OS_SurfaceFields::SpaceName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::Space>()){
    if (index == OS_SpaceFields::SpaceTypeName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }else if (index == OS_SpaceFields::BuildingStoryName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }else if (index == OS_SpaceFields::DefaultConstructionSetName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::SpaceType>()){
    if (index == OS_SpaceTypeFields::DefaultConstructionSetName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::Building>()){
    if (index == OS_BuildingFields::DefaultConstructionSetName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }else if (index == OS_BuildingFields::SpaceTypeName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::BuildingStory>()){
    if (index == OS_BuildingStoryFields::DefaultConstructionSetName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::DefaultConstructionSet>()){
    if (index == OS_DefaultConstructionSetFields::DefaultExteriorSubSurfaceConstructionsName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }else if (index == OS_DefaultConstructionSetFields::DefaultInteriorSubSurfaceConstructionsName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::DefaultSubSurfaceConstructions>()){
    emit itemIds(makeVector());
  }
}