Example #1
0
bool HistoWidget::SaveToCurveSpec(CPlotItem * curve, const CPlotItem *original /*= NULL*/) const
{

  C_INT32 Activity = 0;

  if (mpCheckBefore->isChecked()) Activity += COutputInterface::BEFORE;

  if (mpCheckDuring->isChecked()) Activity += COutputInterface::DURING;

  if (mpCheckAfter->isChecked()) Activity += COutputInterface::AFTER;

  std::string title = TO_UTF8(mpEditTitle->text());
  CCopasiObjectName name = mpObjectX ? mpObjectX->getCN() : CCopasiObjectName("");
  C_FLOAT64 increment = mpEditIncrement->text().toDouble();

  bool thingsChanged = false;

  if (original != NULL)
    {
      if (original->getType() != CPlotItem::histoItem1d)
        thingsChanged = true;

      if (thingsChanged || original->getTitle() != title)
        thingsChanged = true;

      if (thingsChanged || original->getValue< C_FLOAT64 >("increment") != increment)
        thingsChanged = true;

      if (thingsChanged || original->getActivity() != Activity)
        thingsChanged = true;

      if (thingsChanged || original->getChannels().size() != 1)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[0] != name)
        thingsChanged = true;
    }
  else thingsChanged = true;

  if (!thingsChanged)
    return false;

  //title
  curve->setTitle(title);

  //channels
  curve->getChannels().clear();
  curve->getChannels().push_back(CPlotDataChannelSpec(name));

  //other parameters: TODO
  curve->setValue("increment", increment);

  curve->setActivity((COutputInterface::Activity) Activity);

  return true;
}
Example #2
0
void CQPlotSubwidget::createHistograms(std::vector<const CDataObject * >objects, const C_FLOAT64 &incr)
{
  C_INT32 storeTab = getCurrentIndex();
  size_t i;

  for (i = 1; i < objects.size(); ++i)
    {
      if (objects[i])
        addHisto1DTab("Histogram: " + objects[i]->getObjectDisplayName(),
                      CPlotDataChannelSpec(objects[i]->getCN()), incr);

      //         lineEditTitle->setText("Histogram: " + FROM_UTF8(mpObjectX->getObjectDisplayName()));
    }

  setCurrentIndex(storeTab);
}
Example #3
0
void CQPlotSubwidget::addHisto1D()
{
  addHisto1DTab("Histogram", CPlotDataChannelSpec(CCommonName("")), 1.0);
}
Example #4
0
bool Curve2DWidget::SaveToCurveSpec(CPlotItem * curve, const CPlotItem *original /*= NULL*/) const
{
  //if (!(mpObjectX && mpObjectY)) return false;

  //curve->setType(CPlotItem::curve2d);

  std::string title = TO_UTF8(mpEditTitle->text());
  unsigned C_INT32 lineType = (unsigned C_INT32)mpBoxType->currentIndex();
  unsigned C_INT32 lineSubType = (unsigned C_INT32)mpBoxLineSubType->currentIndex();
  unsigned C_INT32 symbolSubType = (unsigned C_INT32)mpBoxSymbolSubType->currentIndex();
  C_FLOAT64 lineWidth = (C_FLOAT64)mpSpinBoxWidth->value();
  std::string color = TO_UTF8(mpBoxColor->currentText());

  C_INT32 Activity = 0;

  if (mpCheckBefore->isChecked()) Activity += COutputInterface::BEFORE;

  if (mpCheckDuring->isChecked()) Activity += COutputInterface::DURING;

  if (mpCheckAfter->isChecked()) Activity += COutputInterface::AFTER;

  CCopasiObjectName xName = mpObjectX ? mpObjectX->getCN() : CCopasiObjectName("");
  CCopasiObjectName yName = mpObjectY ? mpObjectY->getCN() : CCopasiObjectName("");

  bool thingsChanged = false;

  if (original != NULL)
    {
      // compare whether things changed
      if (original->getTitle() != title)
        thingsChanged = true;

      if (thingsChanged || original->getType() != CPlotItem::curve2d)
        thingsChanged = true;

      if (thingsChanged || *original->getValue("Line type").pUINT != lineType)
        thingsChanged = true;

      if (thingsChanged || *original->getValue("Line subtype").pUINT != lineSubType)
        thingsChanged = true;

      if (thingsChanged || *original->getValue("Symbol subtype").pUINT != symbolSubType)
        thingsChanged = true;

      if (thingsChanged || *original->getValue("Line width").pDOUBLE != lineWidth)
        thingsChanged = true;

      if (thingsChanged || *original->getValue("Color").pSTRING != color)
        thingsChanged = true;

      if (thingsChanged || original->getActivity() != Activity)
        thingsChanged = true;

      if (thingsChanged || original->getChannels().size() != 2)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[0] != xName)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[1] != yName)
        thingsChanged = true;
    }
  else thingsChanged = true;

  if (!thingsChanged)
    return false;

  //title
  curve->setTitle(title);

  //channels
  curve->getChannels().clear();
  curve->getChannels().push_back(CPlotDataChannelSpec(xName));
  curve->getChannels().push_back(CPlotDataChannelSpec(yName));

  curve->setValue("Line type", lineType);
  curve->setValue("Line subtype", lineSubType);
  curve->setValue("Symbol subtype", symbolSubType);
  curve->setValue("Line width", lineWidth);

  //color
  curve->setValue("Color", color);

  curve->setActivity((COutputInterface::Activity) Activity);

  return true;
}
Example #5
0
bool
CQSpectogramWidget::SaveToCurveSpec(CPlotItem * curve, const CPlotItem *original /*= NULL*/) const
{
  curve->setType(CPlotItem::spectogram);

  std::string title = TO_UTF8(mpEditTitle->text());

  CCopasiObjectName xName = mpObjectX ? mpObjectX->getCN() : CCopasiObjectName("");
  CCopasiObjectName yName = mpObjectY ? mpObjectY->getCN() : CCopasiObjectName("");
  CCopasiObjectName zName = mpObjectZ ? mpObjectZ->getCN() : CCopasiObjectName("");

  C_INT32 Activity = 0;

  if (mpCheckBefore->isChecked()) Activity += COutputInterface::BEFORE;

  if (mpCheckDuring->isChecked()) Activity += COutputInterface::DURING;

  if (mpCheckAfter->isChecked()) Activity += COutputInterface::AFTER;

  bool thingsChanged = false;

  if (original != NULL)
    {
      // compare whether things changed
      if (original->getTitle() != title)
        thingsChanged = true;

      if (thingsChanged || original->getType() != CPlotItem::spectogram)
        thingsChanged = true;

      if (thingsChanged || original->getActivity() != Activity)
        thingsChanged = true;

      if (thingsChanged || original->getChannels().size() != 3)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[0] != xName)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[1] != yName)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[2] != zName)
        thingsChanged = true;

      if (thingsChanged || *curve->assertParameter("contours", CCopasiParameter::STRING, std::string("")) != TO_UTF8(mpContours->text()))
        thingsChanged = true;

      if (thingsChanged || *curve->assertParameter("maxZ", CCopasiParameter::STRING, std::string("")) != TO_UTF8(mpMaxZ->text()))
        thingsChanged = true;

      if (thingsChanged || *curve->assertParameter("colorMap", CCopasiParameter::STRING, std::string("")) != TO_UTF8(mpColorMap->currentText()))
        thingsChanged = true;

      if (thingsChanged || *curve->assertParameter("logZ", CCopasiParameter::BOOL, false) != mpLogZ->isChecked())
        thingsChanged = true;

      if (thingsChanged || *curve->assertParameter("bilinear", CCopasiParameter::BOOL, true) != mpBilinear->isChecked())
        thingsChanged = true;
    }
  else thingsChanged = true;

  if (!thingsChanged)
    return false;

  //title
  curve->setTitle(title);

  //channels
  curve->getChannels().clear();
  curve->getChannels().push_back(CPlotDataChannelSpec(xName));
  curve->getChannels().push_back(CPlotDataChannelSpec(yName));
  curve->getChannels().push_back(CPlotDataChannelSpec(zName));

  curve->setActivity((COutputInterface::Activity) Activity);

  bool* pLogZ = curve->assertParameter("logZ", CCopasiParameter::BOOL, false);
  bool* pBilinear = curve->assertParameter("bilinear", CCopasiParameter::BOOL, true);
  std::string* pContours = curve->assertParameter("contours", CCopasiParameter::STRING, std::string(""));
  std::string* pMaxZ = curve->assertParameter("maxZ", CCopasiParameter::STRING, std::string(""));
  std::string* pColorMap = curve->assertParameter("colorMap", CCopasiParameter::STRING, std::string("Default"));

  *pLogZ = mpLogZ->isChecked();
  *pBilinear = mpBilinear->isChecked();

  *pContours = TO_UTF8(mpContours->text());
  *pMaxZ = TO_UTF8(mpMaxZ->text());
  *pColorMap = TO_UTF8(mpColorMap->currentText());

  return true;
}
Example #6
0
bool
BandedGraphWidget::SaveToCurveSpec(CPlotItem * curve, const CPlotItem *original /*= NULL*/) const
{
  //curve->setType(CPlotItem::bandedGraph);

  std::string title = TO_UTF8(mpEditTitle->text());

  CCopasiObjectName xName = mpObjectX ? mpObjectX->getCN() : CCopasiObjectName("");
  CCopasiObjectName yName1 = mpObjectYone ? mpObjectYone->getCN() : CCopasiObjectName("");
  CCopasiObjectName yName2 = mpObjectYtwo ? mpObjectYtwo->getCN() : (mpObjectYone ? mpObjectYone->getCN() : CCopasiObjectName(""));

  C_INT32 Activity = 0;

  if (mpCheckBefore->isChecked()) Activity += COutputInterface::BEFORE;

  if (mpCheckDuring->isChecked()) Activity += COutputInterface::DURING;

  if (mpCheckAfter->isChecked()) Activity += COutputInterface::AFTER;

  bool thingsChanged = false;

  if (original != NULL)
    {
      // compare whether things changed
      if (original->getTitle() != title)
        thingsChanged = true;

      if (thingsChanged || original->getType() != CPlotItem::bandedGraph)
        thingsChanged = true;

      if (thingsChanged || original->getActivity() != Activity)
        thingsChanged = true;

      if (thingsChanged || original->getChannels().size() != 3)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[0] != xName)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[1] != yName1)
        thingsChanged = true;

      if (thingsChanged || original->getChannels()[2] != yName2)
        thingsChanged = true;
    }
  else thingsChanged = true;

  if (!thingsChanged)
    return false;

  //title
  curve->setTitle(title);

  //channels
  curve->getChannels().clear();
  curve->getChannels().push_back(CPlotDataChannelSpec(xName));
  curve->getChannels().push_back(CPlotDataChannelSpec(yName1));
  curve->getChannels().push_back(CPlotDataChannelSpec(yName2));

  curve->setActivity((COutputInterface::Activity) Activity);

  return true;
}