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


C++ BasicBox::hasCurve方法代码示例

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


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

示例1: addCurve

bool
BoxWidget::updateCurve(const string &address, bool forceUpdate)
{
  Q_UNUSED(forceUpdate);
  BasicBox *box = Maquette::getInstance()->getBox(_boxID);

  if (box != NULL) { // Box Found
      if (box->hasCurve(address)) {
          AbstractCurve *abCurve = box->getCurve(address);
          QMap<string, CurveWidget *>::iterator curveIt2 = _curveMap->find(address);
          QString curveAddressStr = QString::fromStdString(address);

          bool curveFound = (curveIt2 != _curveMap->end());
          CurveWidget *curveTab = NULL;

          unsigned int sampleRate;
          bool redundancy, interpolate;
          vector<float> values, xPercents, yValues, coeff;
          vector<string> argTypes;
          vector<short> sectionType;

          bool getCurveSuccess = Maquette::getInstance()->getCurveAttributes(_boxID, address, 0, sampleRate, redundancy, interpolate, values, argTypes, xPercents, yValues, sectionType, coeff);

          //--- PRINT ---
//            std::cout<<"values : "<<std::endl;
//            for (unsigned int i = 0; i < yValues.size() ; i++) {
//                std::cout<<"  "<<yValues[i]<<std::endl;
//            }
//            std::cout<<std::endl;
          //-------------

          if (getCurveSuccess) {
              /********** Abstract Curve found ***********/
              if (abCurve != NULL) {
                  if (curveFound) {
                      curveTab = curveIt2.value();

                      curveTab->setAttributes(_boxID, address, 0, values, sampleRate, redundancy, abCurve->_show, interpolate, argTypes, xPercents, yValues, sectionType, coeff);
                      bool muteState = Maquette::getInstance()->getCurveMuteState(_boxID, address);

                      if (forceUpdate) {
                          if (!muteState) {
                              addCurve(curveAddressStr, curveTab);
                            }
                          else {
                              removeCurve(address);
                            }
                        }
                    }
                  else {
                      //Create
                      curveTab = new CurveWidget(NULL);

                      curveTab->setAttributes(_boxID, address, 0, values, sampleRate, redundancy, abCurve->_show, interpolate, argTypes, xPercents, yValues, sectionType, coeff);
                      bool muteState = Maquette::getInstance()->getCurveMuteState(_boxID, address);
                      if (!muteState) {
                          addCurve(curveAddressStr, curveTab);
                        }
                      else {
                          removeCurve(address);
                        }
                    }

                  //Set attributes
                  box->setCurve(address, curveTab->abstractCurve());
                }


              /******* Abstract Curve not found ********/
              else {
                  bool show = true;

//                    interpolate = !Maquette::getInstance()->getCurveMuteState(_boxID,address);
//                    if (xPercents.empty() && yValues.empty() && values.size() >= 2) {
//                        if (values.front() == values.back()) {
//                            show = false;
//                            interpolate = false;
//                        }
//                    }
                  //Set attributes
                  curveTab = new CurveWidget(NULL);
                  QString curveAddressStr = QString::fromStdString(address);
                  curveTab->setAttributes(_boxID, address, 0, values, sampleRate, redundancy, show, interpolate, argTypes, xPercents, yValues, sectionType, coeff);
                  if (interpolate) {
                      addCurve(curveAddressStr, curveTab);
                      box->setCurve(address, curveTab->abstractCurve());
                    }
                }
            }
        }
      else {
          return false;
        }
    }
  else {  // Box Not Found
      return false;
    }
  return false;
}
开发者ID:ChristianFrisson,项目名称:i-score,代码行数:99,代码来源:BoxWidget.cpp


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