コード例 #1
0
bool CQGlobalQuantityDM::insertGlobalQuantityRows(QList <UndoGlobalQuantityData *>& pData)
{
  //reinsert all the GlobalQuantities
  QList <UndoGlobalQuantityData *>::const_iterator i;

  for (i = pData.begin(); i != pData.end(); ++i)
    {
      UndoGlobalQuantityData * data = *i;

      if (mpGlobalQuantities->getIndex(data->getName()) != C_INVALID_INDEX)
        continue;

      beginInsertRows(QModelIndex(), 1, 1);
      CModelValue *pGlobalQuantity = data->restoreObjectIn(mpDataModel->getModel());

      if (pGlobalQuantity != NULL)
        emit notifyGUI(ListViews::MODELVALUE, ListViews::ADD, pGlobalQuantity->getKey());

      endInsertRows();
    }

  switchToWidget(CCopasiUndoCommand::GLOBALQUANTITYIES);

  return true;
}
コード例 #2
0
void CQGlobalQuantityDM::deleteGlobalQuantityRows(QList <UndoGlobalQuantityData *>& pData)
{
  switchToWidget(CCopasiUndoCommand::GLOBALQUANTITYIES);

  QList <UndoGlobalQuantityData *>::const_iterator j;

  for (j = pData.begin(); j != pData.end(); ++j)
    {
      UndoGlobalQuantityData * data = *j;
      size_t index = mpGlobalQuantities->getIndex(data->getName());
      removeRow((int) index);
    }
}
コード例 #3
0
ファイル: UndoDependentData.cpp プロジェクト: jonasfoe/COPASI
void UndoDependentData::fillDependentObjects(CModel *pModel,
    QList<UndoGlobalQuantityData *> *pGlobalQuantityData)
{
  //reinsert the dependency global quantity
  if (pModel == NULL || pGlobalQuantityData == NULL || pGlobalQuantityData->empty())
    return;

  QList <UndoGlobalQuantityData *>::const_iterator g;

  for (g = pGlobalQuantityData->begin(); g != pGlobalQuantityData->end(); ++g)
    {
      UndoGlobalQuantityData* data = *g;
      data->fillObject(pModel);
    }
}
コード例 #4
0
RemoveAllGlobalQuantityRowsCommand::RemoveAllGlobalQuantityRowsCommand(CQGlobalQuantityDM * pGlobalQuantityDM, const QModelIndex&)
{
  mpGlobalQuantityDM = pGlobalQuantityDM;

  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);
  CModel * pModel = pDataModel->getModel();

  assert(pModel != NULL);

  for (int i = 0; i != pGlobalQuantityDM->rowCount() - 1; ++i)
    {

      UndoGlobalQuantityData *data = new UndoGlobalQuantityData();

      if (pModel->getModelValues()[i])
        {
          data->setName(pModel->getModelValues()[i]->getObjectName());
          data->setStatus(pModel->getModelValues()[i]->getStatus());

          if (pModel->getModelValues()[i]->getStatus() != CModelEntity::ASSIGNMENT)
            {
              data->setInitialValue(pModel->getModelValues()[i]->getInitialValue());
            }

          // set expression
          if (pModel->getModelValues()[i]->getStatus() != CModelEntity::FIXED)
            {
              data->setExpression(pModel->getModelValues()[i]->getExpression());
            }

          // set initial expression
          if (pModel->getModelValues()[i]->getStatus() != CModelEntity::ASSIGNMENT)
            {
              data->setInitialExpression(pModel->getModelValues()[i]->getInitialExpression());
            }

          setDependentObjects(pModel->getModelValues()[i]->getDeletedObjects());
          data->setReactionDependencyObjects(getReactionData());
          data->setSpecieDependencyObjects(getSpecieData());
          data->setEventDependencyObjects(getEventData());
          mpGlobalQuantityData.append(data);
        }
    }

  mType = GLOBALQUANTITYREMOVEALL;
  setEntityType("Global Quantity");
  this->setText(removeAllGlobalQuantityRowsText());
}
コード例 #5
0
ファイル: UndoDependentData.cpp プロジェクト: jonasfoe/COPASI
void UndoDependentData::createDependentObjects(CModel *pModel,
    QList<UndoGlobalQuantityData *> *pGlobalQuantityData)
{
  //reinsert the dependency global quantity
  if (pModel == NULL || pGlobalQuantityData == NULL || pGlobalQuantityData->empty())
    return;

  QList <UndoGlobalQuantityData *>::const_iterator g;

  for (g = pGlobalQuantityData->begin(); g != pGlobalQuantityData->end(); ++g)
    {
      UndoGlobalQuantityData* data = *g;
      CModelValue *pGlobalQuantity = data->createObjectIn(pModel);

      if (pGlobalQuantity == NULL) continue;

      updateGUI(ListViews::MODELVALUE, ListViews::ADD, pGlobalQuantity->getKey());
    }
}