void RefrigerationSystemListController::removeSystem(model::RefrigerationSystem & refrigerationSystem) { int i = systemIndex(refrigerationSystem); refrigerationSystem.remove(); emit itemRemoved(i); }
void RefrigerationSystemListController::createNewSystem() { if( boost::optional<model::Model> model = OSAppBase::instance()->currentModel() ) { model::RefrigerationSystem system(model.get()); emit itemInserted(systemIndex(system)); } }
void VRFSystemListController::createNewSystem() { if( boost::optional<model::Model> model = OSAppBase::instance()->currentModel() ) { model::AirConditionerVariableRefrigerantFlow system(model.get()); emit itemInserted(systemIndex(system)); } }
void VRFSystemListController::removeSystem(model::AirConditionerVariableRefrigerantFlow & vrfSystem) { std::vector<model::ZoneHVACTerminalUnitVariableRefrigerantFlow> terminals = vrfSystem.terminals(); if( ! terminals.empty() ) { QMessageBox message(m_vrfController->vrfView()); QString text; int size = terminals.size(); if( size == 1 ) { text.append("There is "); text.append(QString::number(size)); text.append( " terminal "); } else { text.append("There are "); text.append(QString::number(size)); text.append( " terminals "); } text.append("attached to this system which will be removed if you continue."); message.setText(text); message.addButton(QMessageBox::Cancel); message.addButton(QMessageBox::Ok); int response = message.exec(); if( response != QMessageBox::Ok ) { return; } } int i = systemIndex(vrfSystem); for(std::vector<model::ZoneHVACTerminalUnitVariableRefrigerantFlow>::iterator it = terminals.begin(); it != terminals.end(); ++it) { it->remove(); } vrfSystem.remove(); emit itemRemoved(i); }
void RefrigerationSystemListController::addSystem(const OSItemId & itemid) { boost::shared_ptr<OSDocument> doc = OSAppBase::instance()->currentDocument(); if( doc->fromComponentLibrary(itemid) ) { boost::optional<model::ModelObject> mo = doc->getModelObject(itemid); boost::optional<model::Model> model = OSAppBase::instance()->currentModel(); if( mo && model ) { if( boost::optional<model::RefrigerationSystem> system = mo->optionalCast<model::RefrigerationSystem>() ) { model::RefrigerationSystem systemClone = system->clone(model.get()).cast<model::RefrigerationSystem>(); emit itemInserted(systemIndex(systemClone)); } } } }