void ModelObjectVectorController::attach(const model::ModelObject& modelObject)
{
  detach();

  m_modelObject = modelObject;

  attachModel(modelObject.model());

  connect(m_model->getImpl<model::detail::Model_Impl>().get(),
    static_cast<void (model::detail::Model_Impl::*)(std::shared_ptr<detail::WorkspaceObject_Impl>, const IddObjectType &, const UUID &) const>(&model::detail::Model_Impl::addWorkspaceObject),
    this,
    &ModelObjectVectorController::objectAdded,
    Qt::QueuedConnection);
  
  connect(m_model->getImpl<model::detail::Model_Impl>().get(),
    static_cast<void (model::detail::Model_Impl::*)(std::shared_ptr<detail::WorkspaceObject_Impl>, const IddObjectType &, const UUID &) const>(&model::detail::Model_Impl::removeWorkspaceObject),
    this,
    &ModelObjectVectorController::objectRemoved,
    Qt::QueuedConnection);
  
  connect(m_modelObject->getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onRelationshipChange,
          this, &ModelObjectVectorController::changeRelationship);

  connect(m_modelObject->getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onDataChange,
          this, &ModelObjectVectorController::dataChange);

  connect(m_modelObject->getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onChange,
          this, &ModelObjectVectorController::change);
}
void BuildingStorySpacesVectorController::attach(const model::ModelObject& modelObject)
{
  ModelObjectVectorController::attach(modelObject);
  BOOST_FOREACH(const model::Space& space, modelObject.model().getModelObjects<model::Space>()){
    attachOtherModelObject(space);
  }
}
void SpaceSpaceTypeVectorController::attach(const model::ModelObject& modelObject)
{
    ModelObjectVectorController::attach(modelObject);

    model::Building building = modelObject.model().getUniqueModelObject<model::Building>();
    attachOtherModelObject(building);
}
void SpaceSpaceInfiltrationDesignFlowRateVectorController::attach(const model::ModelObject& modelObject)
{
    ModelObjectVectorController::attach(modelObject);
    BOOST_FOREACH(const model::SpaceInfiltrationDesignFlowRate& spaceInfiltrationDesignFlowRate, modelObject.model().getConcreteModelObjects<model::SpaceInfiltrationDesignFlowRate>()) {
        attachOtherModelObject(spaceInfiltrationDesignFlowRate);
    }
}