std::vector< const CCopasiObject * > CCopasiSelectionDialog::getObjectVector(QWidget * parent, const CQSimpleSelectionTree::ObjectClasses & classes, const std::vector< const CCopasiObject * > * pCurrentSelection) { std::vector< const CCopasiObject * > Selection; if (pCurrentSelection) Selection = *pCurrentSelection; CCopasiSelectionDialog * pDialog = new CCopasiSelectionDialog(parent); pDialog->setWindowTitle("Select Items"); pDialog->setToolTip("Select multiple items by holding down the Ctrl or Shift (or equivalent) key."); pDialog->setFilter(classes); pDialog->setSingleSelection(false); pDialog->setOutputVector(&Selection); if (pDialog->exec() == QDialog::Rejected && pCurrentSelection) return *pCurrentSelection; else // return Selection; { std::vector<const CCopasiObject *> newSelection; std::vector< const CCopasiObject * >::iterator itSelection = Selection.begin(); for (; itSelection != Selection.end(); ++itSelection) { // if the current object is an array then select firstly one cell of it const CArrayAnnotation * pArray; if ((pArray = dynamic_cast< const CArrayAnnotation * >(*itSelection))) { // second parameter is false in order 'ALL' options on the matrix dialog to appear std::vector<const CCopasiObject *> tmp = chooseCellMatrix(pArray, false, true); //TODO value flag std::vector<const CCopasiObject *>::const_iterator tmpit, tmpitEnd = tmp.end(); for (tmpit = tmp.begin(); tmpit != tmpitEnd; ++tmpit) newSelection.push_back(*tmpit); } // otherwise, just put it into newSelection else { newSelection.push_back(*itSelection); } } return newSelection; } // return Selection; }
std::vector< const CCopasiObject * > CCopasiSelectionDialog::getObjectVector(QWidget * parent, const std::vector< const CCopasiObject * > & objectList, const std::vector< const CCopasiObject * > * pCurrentSelection) { std::vector< const CCopasiObject * > Selection; if (pCurrentSelection) Selection = *pCurrentSelection; CCopasiSelectionDialog * pDialog = new CCopasiSelectionDialog(parent); pDialog->setWindowTitle("Select Items"); pDialog->setToolTip("Select multiple items by holding down the Ctrl or Shift (or equivalent) key."); assert(CCopasiRootContainer::getDatamodelList()->size() > 0); pDialog->enableExpertMode(false); pDialog->setValidObjects(objectList); pDialog->setSingleSelection(false); pDialog->setOutputVector(&Selection); if (pDialog->exec() == QDialog::Rejected) { return Selection; } std::vector<const CCopasiObject *> newSelection; std::vector< const CCopasiObject * >::iterator itSelection = Selection.begin(); std::vector< const CCopasiObject * >::iterator endSelection = Selection.end(); for (; itSelection != endSelection; ++itSelection) { // if the current object is an array then select firstly one cell of it const CArrayAnnotation * pArray; if ((pArray = dynamic_cast< const CArrayAnnotation * >(*itSelection))) { // second parameter is false in order 'ALL' options on the matrix dialog to appear std::vector<const CCopasiObject *> tmp = chooseCellMatrix(pArray, false, true); //TODO value flag std::vector<const CCopasiObject *>::const_iterator tmpit, tmpitEnd = tmp.end(); for (tmpit = tmp.begin(); tmpit != tmpitEnd; ++tmpit) newSelection.push_back(*tmpit); } // otherwise, just put it into newSelection else { newSelection.push_back(*itSelection); } } return newSelection; }