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


C++ KstMatrixPtr::sampleCount方法代码示例

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


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

示例1: commonConstructor

void KstCSD::commonConstructor(const QString& in_tag, KstVectorPtr in_V,
                               double in_freq, bool in_average, bool in_removeMean,
                               bool in_apodize, int in_apodizeFxn, int in_windowSize, int in_length,
                               double in_gaussianSigma, const QString& in_vectorUnits, const QString& in_rateUnits,
                               const QString& vecName) {

  _typeString = i18n("Cumulative Spectral Decay");
  _inputVectors[INVECTOR] = in_V;
  setTagName(in_tag);
  _frequency = in_freq;
  _average = in_average;
  _apodize = in_apodize;
  _windowSize = in_windowSize;
  _apodizeFxn = in_apodizeFxn;
  _gaussianSigma = in_gaussianSigma;
  _removeMean = in_removeMean;
  _length = in_length;
  _vectorUnits = in_vectorUnits;
  _rateUnits = in_rateUnits;
  
  if (!_average) {
    _length = int(ceil(log(_windowSize)/log(2.0)));
  }

  if (_length < 2) {
    _length = 2;
  }

  if (_length > KSTCSDMAXLEN) {
    _length = KSTCSDMAXLEN;
  }

  if (_frequency <= 0.0) {
    _frequency = 1.0;
  }
  
  int psdLength = int(pow(2.0, (double)(_length-1)));
  
  KstMatrixPtr outMatrix = new KstMatrix(in_tag+"-csd", psdLength, 1);
  outMatrix->setLabel(i18n("Power [%1/%2^{1/2}]").arg(_vectorUnits).arg(_rateUnits));
  outMatrix->setXLabel(i18n("%1 [%2]").arg(vecName).arg(_vectorUnits));
  outMatrix->setYLabel(i18n("Frequency [%1]").arg(_rateUnits));
  if (outMatrix->sampleCount() != psdLength) {
    _length = 1;
    KstDebug::self()->log(i18n("Attempted to create a CSD that used all memory."), KstDebug::Error);
  }
  
  outMatrix->setProvider(this);
  _outMatrix = _outputMatrices.insert(OUTMATRIX, outMatrix);
  KST::addMatrixToList(outMatrix);
  (*_outMatrix)->setDirty();
}
开发者ID:,项目名称:,代码行数:52,代码来源:

示例2: update


//.........这里部分代码省略.........
          setPixmap(2, inUse ? _dm->yesPixmap() : QPixmap());
        }
        QString field = QString::number(x->length());
        if (text(3) != field) {
          setText(3, field);
        }
        field = i18n("[%1..%2]").arg(x->min()).arg(x->max());
        if (text(4) != field) {
          setText(4, field);
        }
        x->unlock();
        _removable = false;
      }
      break;
    }
    case RTTI_OBJ_OBJECT:
    {
      KST::dataObjectList.lock().readLock();
      KstDataObjectPtr x = *KST::dataObjectList.findTag(_tag.tag());
      KST::dataObjectList.lock().unlock();
      if (x) {
        x->readLock();
        QString field = x->typeString();
        if (text(1) != field) {
          setText(1, field);
        }
        // getUsage:
        //  subtract 1 for KstDataObjectPtr x
        bool inUse = (x->getUsage() - 1 - localUseCount) > 0;
        if (inUse != _inUse) {
          _inUse = inUse;
          setPixmap(2, inUse ? _dm->yesPixmap() : QPixmap());
        }
        if (x->sampleCount() > 0) {
          field = QString::number(x->sampleCount());
          if (text(3) != field) {
            setText(3, field);
          }
        } else {
          if (text(3) != "-") {
            setText(3, "-");
          }          
        }
        field = x->propertyString();
        if (text(4) != field) {
          setText(4, field);
        }
        if (recursive) {
          QPtrStack<QListViewItem> trash;
          KstVectorMap vl = x->outputVectors();
          KstVectorMap::Iterator vlEnd = vl.end();

          for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) {
            KstObjectItem *oi = static_cast<KstObjectItem*>(i);
            if (vl.findTag(oi->tag().tag()) == vlEnd) {
              trash.push(i);
            }
          }
          trash.setAutoDelete(true);
          trash.clear();

          // get the output vectors
          for (KstVectorMap::Iterator p = vl.begin(); p != vlEnd; ++p) {
            bool found = false;
            QString tn = p.data()->tag().tag();
            for (QListViewItem *i = firstChild(); i; i = i->nextSibling()) {
开发者ID:,项目名称:,代码行数:67,代码来源:


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