void ModelObjectVectorController::attachOtherModelObject(const model::ModelObject& modelObject)
{
  // check not already connected
  for (const model::ModelObject& currentModelObject : m_otherModelObjects){
    if (modelObject.handle() == currentModelObject.handle()){
      return;
    }
  }

  m_otherModelObjects.push_back(modelObject);

  connect(modelObject.getImpl<model::detail::ModelObject_Impl>().get(), &model::detail::ModelObject_Impl::onRelationshipChange,
          this, &ModelObjectVectorController::changeRelationship);
}
void ModelObjectVectorController::detachOtherModelObject(const model::ModelObject& modelObject)
{
  std::vector<model::ModelObject>::const_iterator it = m_otherModelObjects.begin();
  std::vector<model::ModelObject>::const_iterator itend = m_otherModelObjects.end();
  std::vector<model::ModelObject> newVector;
  for (; it != itend; ++it){
    if (it->handle() == modelObject.handle()){
      disconnect(modelObject.getImpl<model::detail::ModelObject_Impl>().get());
    }else{
      newVector.push_back(*it);
    }
  }
  m_otherModelObjects.swap(newVector);
}
void ModelObjectVectorController::attachOtherModelObject(const model::ModelObject& modelObject)
{
  // check not already connected
  BOOST_FOREACH(const model::ModelObject& currentModelObject, m_otherModelObjects){
    if (modelObject.handle() == currentModelObject.handle()){
      return;
    }
  }

  m_otherModelObjects.push_back(modelObject);

  bool isConnected = false;
  isConnected = connect(modelObject.getImpl<model::detail::ModelObject_Impl>().get(),
                        SIGNAL(onRelationshipChange(int, Handle, Handle)),
                        this,
                        SLOT(changeRelationship(int, Handle, Handle)));
  OS_ASSERT(isConnected);
}
void SubSurfaceConstructionVectorController::onDataChange(const model::ModelObject& modelObject)
{
  if (m_modelObject && (modelObject.handle() == m_modelObject->handle())){
    emit itemIds(makeVector());
  }
}