当前位置: 首页>>代码示例>>C++>>正文


C++ CCopasiDataModel::getObjectFromCN方法代码示例

本文整理汇总了C++中CCopasiDataModel::getObjectFromCN方法的典型用法代码示例。如果您正苦于以下问题:C++ CCopasiDataModel::getObjectFromCN方法的具体用法?C++ CCopasiDataModel::getObjectFromCN怎么用?C++ CCopasiDataModel::getObjectFromCN使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCopasiDataModel的用法示例。


在下文中一共展示了CCopasiDataModel::getObjectFromCN方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadFromCurveSpec

bool HistoWidget::LoadFromCurveSpec(const CPlotItem * curve)
{
  if (!curve)
    {
      // We need to reset the widget to defaults
      mpEditTitle->setText("");

      mpObjectX = NULL;
      mpEditVariable->setText("");

      mpEditIncrement->setText("");

      mpCheckBefore->setChecked(false);
      mpCheckDuring->setChecked(true);
      mpCheckAfter->setChecked(false);

      return true;
    }

  if (curve->getType() != CPlotItem::histoItem1d) return false;

  if (curve->getChannels().size() != 1) return false;

  //title
  mpEditTitle->setText(FROM_UTF8(curve->getTitle()));

  //variable
  mpObjectX = NULL;
  CCopasiDataModel* pDataModel = mpModel->getObjectDataModel();
  assert(pDataModel != NULL);

  if (curve->getChannels().size() >= 1)
    mpObjectX = CObjectInterface::DataObject(pDataModel->getObjectFromCN(curve->getChannels()[0]));

  if (mpObjectX == pDataModel)
    {
      mpObjectX = NULL;
    }

  if (mpObjectX != NULL)
    mpEditVariable->setText(FROM_UTF8(mpObjectX->getObjectDisplayName()));
  else
    mpEditVariable->setText("");

  //other parameters:
  mpEditIncrement->setText(QString::number(curve->getValue< C_FLOAT64 >("increment")));

  mpCheckBefore->setChecked(curve->getActivity() & COutputInterface::BEFORE);
  mpCheckDuring->setChecked(curve->getActivity() & COutputInterface::DURING);
  mpCheckAfter->setChecked(curve->getActivity() & COutputInterface::AFTER);

  return true; //TODO
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例2: load

// virtual
void CScanWidgetScan::load(const CCopasiParameterGroup * pItem)
{
  if (pItem == NULL) return;

  *mpData = *pItem;

  CScanProblem::Type type = mpData->getValue< CScanProblem::Type >("Type");

  if (type != CScanProblem::SCAN_LINEAR)
    return;

  lineEditNumber->setText(QString::number(mpData->getValue< C_INT32 >("Number of steps")));
  std::string tmpString = mpData->getValue< std::string >("Object");

  if (tmpString == "")
    mpObject = NULL;
  else
    {
      assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
      CCopasiDataModel* pDataModel = &CCopasiRootContainer::getDatamodelList()->operator[](0);
      assert(pDataModel != NULL);
      mpObject = CObjectInterface::DataObject(pDataModel->getObjectFromCN(tmpString));
    }

  if (mpObject)
    lineEditObject->setText(FROM_UTF8(mpObject->getObjectDisplayName()));
  else
    lineEditObject->setText("");

  lineEditMin->setText(QString::number(mpData->getValue< C_FLOAT64 >("Minimum")));
  lineEditMax->setText(QString::number(mpData->getValue< C_FLOAT64 >("Maximum")));

  checkBoxLog->setChecked(mpData->getValue< bool >("log"));

  return;
}
开发者ID:jonasfoe,项目名称:COPASI,代码行数:37,代码来源:CScanWidgetScan.cpp

示例3: pix

bool Curve2DWidget::LoadFromCurveSpec(const CPlotItem * curve)
{
  if (!curve)
    {
      // We need to reset the widget to defaults
      mpEditTitle->setText("");

      mpObjectX = NULL;
      mpEditX->setText("");

      mpObjectY = NULL;
      mpEditY->setText("");

      mpBoxType->setCurrentIndex(0);
      mpBoxLineSubType->setCurrentIndex(0);
      mpBoxColor->clear();

      mpCheckBefore->setChecked(false);
      mpCheckDuring->setChecked(true);
      mpCheckAfter->setChecked(false);

      return true;
    }

  if (curve->getType() != CPlotItem::curve2d) return false;

  //if (curve->getChannels().getSize != 2) return false;

  mpEditTitle->setText(FROM_UTF8(curve->getTitle()));

  //TODO: check if objects exist....
  CCopasiDataModel* pDataModel = mpModel->getObjectDataModel();
  assert(pDataModel != NULL);
  mpObjectX = mpObjectY = NULL;

  if (curve->getChannels().size() >= 1)
    mpObjectX = CObjectInterface::DataObject(pDataModel->getObjectFromCN(curve->getChannels()[0]));

  if (curve->getChannels().size() >= 2)
    mpObjectY = CObjectInterface::DataObject(pDataModel->getObjectFromCN(curve->getChannels()[1]));

  if (mpObjectX)
    mpEditX->setText(FROM_UTF8(mpObjectX->getObjectDisplayName()));
  else
    mpEditX->clear();

  if (mpObjectY)
    mpEditY->setText(FROM_UTF8(mpObjectY->getObjectDisplayName()));
  else
    mpEditY->clear();

  //Type
  unsigned C_INT32 linetype = curve->getValue< unsigned C_INT32 >("Line type");
  mpBoxType->setCurrentIndex(linetype);

  typeChanged(linetype);

  //line subtype & width
  if (linetype == 0 || linetype == 3)
    {
      mpBoxLineSubType->setCurrentIndex(curve->getValue< unsigned C_INT32 >("Line subtype"));

      //mpBoxWidth
      mpSpinBoxWidth->setValue(curve->getValue< C_FLOAT64 >("Line width"));
    }

  // points
  if (linetype == 1)
    {
      mpSpinBoxWidth->setValue(curve->getValue< C_FLOAT64 >("Line width"));
    }

  //symbol type
  if (linetype == 2 || linetype == 3)
    {
      mpBoxSymbolSubType->setCurrentIndex(curve->getValue< unsigned C_INT32 >("Symbol subtype"));
    }

  //color TODO
  mpBoxColor->clear();
  mpBoxColor->addItem("auto");
  size_t i;

  for (i = 0; i < CQPlotColors::getNumCopasiColors(); ++i)
    {
      QColor color = CQPlotColors::getColor("auto", i);
      QPixmap pix(12, 12);
      QPainter painter(&pix);

      if (color.isValid())
        {
          painter.setPen(Qt::gray);
          painter.setBrush(QBrush(color));
          painter.drawRect(0, 0, 12, 12);
        }

      QIcon icon;
      icon.addPixmap(pix);

      mpBoxColor->addItem(icon, CQPlotColors::getCopasiColorStr(i).c_str());
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的CCopasiDataModel::getObjectFromCN方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。