コード例 #1
0
ファイル: CModelMIRIAMInfo.cpp プロジェクト: jonasfoe/COPASI
bool CMIRIAMInfo::save()
{
  CCopasiObject * pCopasiObject = dynamic_cast< CCopasiObject * >(CCopasiRootContainer::getKeyFactory()->get(mKey));

  if (pCopasiObject && mpRDFGraph)
    {
      mpRDFGraph->clean();
      mpRDFGraph->updateNamespaces();

      std::string XML = CRDFWriter::xmlFromGraph(mpRDFGraph);

      CAnnotation * pAnnotation = CAnnotation::castObject(pCopasiObject);

      if (pAnnotation == NULL)
        {
          return false;
        }

      pAnnotation->setMiriamAnnotation(XML, pAnnotation->getKey(), pAnnotation->getKey());

      return true;
    }

  return false;
}
コード例 #2
0
ファイル: CQMiriamWidget.cpp プロジェクト: PriKalra/COPASI
bool CQMiriamWidget::enterProtected()
{
  if (mKey == "")
    return false;

  CCopasiMessage::clearDeque();

  if (mKeyToCopy != "")
    {
      CAnnotation * pAnnotation = CAnnotation::castObject(dynamic_cast< CCopasiObject * >(CCopasiRootContainer::getKeyFactory()->get(mKeyToCopy)));

      std::string pMiriamAnnotation = pAnnotation->getMiriamAnnotation();

      pAnnotation = CAnnotation::castObject(mpObject);

      pAnnotation->setMiriamAnnotation(pMiriamAnnotation, mKey, mKeyToCopy);

      mKeyToCopy = "";
    }

  mpMIRIAMInfo->load(mKey);

  //Set Models for the 4 TableViews
  std::vector<CQTableView*>::const_iterator it = mWidgets.begin();
  std::vector<CQTableView*>::const_iterator end = mWidgets.end();

  std::vector<CQBaseDataModel*>::const_iterator itDM = mDMs.begin();
  std::vector<CQBaseDataModel*>::const_iterator endDM = mDMs.end();

  std::vector<CQSortFilterProxyModel*>::const_iterator itPDM = mProxyDMs.begin();
  std::vector<CQSortFilterProxyModel*>::const_iterator endPDM = mProxyDMs.end();

  for (; it != end && itDM != endDM && itPDM != endPDM; it++, itDM++, itPDM++)
    {
      (*itPDM)->setSourceModel(*itDM);
      (*it)->setModel(NULL);
      (*it)->setModel(*itPDM);
      (*it)->resizeColumnsToContents();
    }

  QDateTime DTCreated;

  if (mpMIRIAMInfo->getCreatedDT() != "")
    DTCreated = QDateTime::fromString(FROM_UTF8(mpMIRIAMInfo->getCreatedDT()), Qt::ISODate);

  if (DTCreated.isValid())
    mpDTCreated->setDateTime(DTCreated);
  else
    {
      mpDTCreated->setDateTime(QDateTime::currentDateTime());
    }

  if (CCopasiMessage::size() > 0)
    {
      mMessageType = CCopasiMessage::getHighestSeverity();
      mMessage = CCopasiMessage::getAllMessageText();
      CCopasiMessage::clearDeque();

      showEvent(NULL);
    }
  else
    {
      mMessageType = -1;
      mMessage = "";
    }

  return true;
}