Beispiel #1
0
KstScalar::KstScalar(const QDomElement& e)
: KstObject(), _orphan(false), _displayable(true), _editable(false) {
  QDomNode n = e.firstChild();
  bool ok;

  while(!n.isNull()) {
    QDomElement e = n.toElement();
    if(!e.isNull()) {
      if (e.tagName() == "tag") {
        setTagName(e.text());
      } else if (e.tagName() == "orphan") {
        _orphan = true;
      } else if (e.tagName() == "value") {
        setValue(e.text().toDouble());
      } else if (e.tagName() == "editable") {
        _editable = true;
      }
    }
    n = n.nextSibling();
  }

  if (tagName().toDouble(&ok) == value() && ok) {
    _displayable = false;
  }

  KST::scalarList.append(this);
}
Beispiel #2
0
/** Create the base scalar */
KstScalar::KstScalar(const QString& in_tag, double val, bool orphan, bool displayable, bool doLock, bool editable)
: KstObject(), _value(val), _orphan(orphan), _displayable(displayable), _editable(editable) {
  QString _tag = in_tag;
  if (_tag.isEmpty()) {
    QString nt = i18n("Anonymous Scalar %1");

    do {
      _tag = nt.arg(iAnonymousScalarCounter++);
    } while (KST::vectorTagNameNotUniqueInternal(_tag));
  } else {
    while (KST::vectorTagNameNotUniqueInternal(_tag)) {
      _tag += '\'';
    }
  }
  setTagName(_tag);

  // FIXME: passing in a lock variable indicates a design problem
  if (doLock) {
    KST::scalarList.lock().writeLock();
  }
  KST::scalarList.append(this);
  if (doLock) {
    KST::scalarList.lock().writeUnlock();
  }
}
KstAMatrix::KstAMatrix(const QDomElement &e) : KstMatrix() {
  _editable = true;

  double in_xMin = 0, in_yMin = 0, in_xStep = 1, in_yStep = 1;
  int in_nX = 2, in_nY = 2;
  QString in_tag = QString::null; 

  // must get the grid dimensions before the data
  QDomNode n = e.firstChild();
  while (!n.isNull()) {
    QDomElement e = n.toElement();
    if (!e.isNull()) {
      if (e.tagName() == "tag") {
        setTagName(KstObjectTag::fromString(e.text()));
      } else if (e.tagName() == "nx") {
        in_nX = e.text().toInt();
      } else if (e.tagName() == "ny") {
        in_nY = e.text().toInt();
      } else if (e.tagName() == "xmin") {
        in_xMin = e.text().toDouble();
      } else if (e.tagName() == "ymin") {
        in_yMin = e.text().toDouble();
      } else if (e.tagName() == "xstep") {
        in_xStep = e.text().toDouble();
      } else if (e.tagName() == "ystep") {
        in_yStep = e.text().toDouble();
      }
    }
    n = n.nextSibling();
  }
  _saveable = true;
  resizeZ(in_nX*in_nY, true);

  // now get the z data
  if (in_nX*in_nY > 0) {
    QDomNode n = e.firstChild();
    while (!n.isNull()) {
      QDomElement e = n.toElement();
      if (!e.isNull()) {
        if (e.tagName() == "data") {
          QCString qcs(e.text().latin1());
          QByteArray qbca;
          KCodecs::base64Decode(qcs, qbca);
          QByteArray qba = qUncompress(qbca);
          QDataStream qds(qba, IO_ReadOnly);
          int i;
          // fill in the raw array with the data
          for (i = 0; i < in_nX*in_nY && !qds.atEnd(); i++) {
            qds >> _z[i];  // stored in the same order as it was saved
          }
          if (i < in_nX*in_nY) {
            KstDebug::self()->log(i18n("Saved matrix contains less data than it claims."), KstDebug::Warning);
            resizeZ(i, false);
          }
        }
      }
      n = n.nextSibling();
    }
Beispiel #4
0
void KstRMatrix::change(KstDataSourcePtr file, const QString &field, const QString &tag,
                        int xStart, int yStart,
                        int xNumSteps, int yNumSteps,
                        bool doAve, bool doSkip, int skip) {
  setTagName(tag);
  commonConstructor(file, field, xStart, yStart, xNumSteps, yNumSteps, doAve, doSkip, skip);

  setDirty(true);
}
Beispiel #5
0
KstPlugin::KstPlugin(QDomElement &e) : KstDataObject(e) {
  QString pluginName;

  commonConstructor();

  QDomNode n = e.firstChild();

  while(!n.isNull()) {
    QDomElement e = n.toElement();
    if(!e.isNull()) {
      if (e.tagName() == "tag") {
        setTagName(e.text());
      } else if (e.tagName() == "name") {
        pluginName = e.text();
      } else if (e.tagName() == "ivector") {
        _inputVectorLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "iscalar") {
        _inputScalarLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "ovector") {
        _outputVectors.insert(e.attribute("name"), new KstVector(e.text()));
      } else if (e.tagName() == "oscalar") {
        _outputScalars.insert(e.attribute("name"), new KstScalar(e.text()));
      }
    }
    n = n.nextSibling();
  }

  _plugin = PluginCollection::self()->plugin(pluginName);

  if (!_plugin.data()) {
    kdWarning() << i18n("Unable to load plugin %1 for \"%2\".").arg(pluginName).arg(tagName()) << endl;
    // can cause nasty crashes
    //KMessageBox::sorry(0L, i18n("Unable to load plugin %1 for \"%2\".").arg(pluginName).arg(tagName()));
  } else {
    countScalarsAndVectors(_plugin->data()._inputs, _inScalarCnt, _inArrayCnt);

    const QValueList<Plugin::Data::IOValue>& otable = _plugin->data()._outputs;
    for (QValueList<Plugin::Data::IOValue>::ConstIterator it = otable.begin();
                                                           it != otable.end();
                                                                         ++it) {
      if ((*it)._type == Plugin::Data::IOValue::TableType) {
        _outArrayCnt++;
        if (!_outputVectors.contains((*it)._name)) {
          _outputVectors.insert((*it)._name, new KstVector(tagName() + " vector - " + (*it)._name));
        }
      } else if ((*it)._type == Plugin::Data::IOValue::FloatType) {
        _outScalarCnt++;
        if (!_outputScalars.contains((*it)._name)) {
          KstScalar *s = new KstScalar(tagName() + " scalar - " + (*it)._name);
          _outputScalars.insert((*it)._name, s);
        }
      }
    }
  }
}
// ######################################################################
// ColorBandChannel member definitions:
// ######################################################################
ColorBandChannel::ColorBandChannel(OptionManager& mgr, const uint bandidx) :
  SingleChannel(mgr, "", "", COLBAND,
                rutz::make_shared(new GaussianPyrBuilder<float>(5))),
  itsBandIndex("ColorBandChannelIndex", this, bandidx)
{
  itsTakeAbs.setVal(true);
  itsNormalizeOutput.setVal(true);

  setDescriptiveName(sformat("ColorBand(%d)", bandidx));
  setTagName(sformat("cband_%d", bandidx));
}
KstPlotGroup::KstPlotGroup()
: KstMetaPlot("PlotGroup") {
  _standardActions |= Delete | Raise | Zoom | Lower | RaiseToTop | LowerToBottom;
  _layoutActions |= Delete | Copy | Raise | Lower | RaiseToTop | LowerToBottom | Rename | MoveTo;
  setTagName(KstObjectTag(i18n("Plot Group %1").arg(++pgcount), KstObjectTag::globalTagContext));  // FIXME: tag context?
  _type = "PlotGroup";
  setBorderColor(Qt::blue);
  _container = false; // plot group is a container that doesn't behave like one
  setTransparent(true);
  setBorderWidth(0);
}
Beispiel #8
0
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();
}
void ossimNitfTagInformation::setTagData(ossimRefPtr<ossimNitfRegisteredTag> tagData)
{
   theTagData = tagData;

   memset(theTagName, ' ', 6);
   memset(theTagLength, ' ', 5);
   
   if(theTagData.valid())
   {
      setTagName(theTagData->getRegisterTagName());
      setTagLength(theTagData->getSizeInBytes());
   }
}
Beispiel #10
0
KstRMatrix::KstRMatrix(const QDomElement &e) : KstMatrix(QString::null, 0L, 1,1,0,0,1,1) {
  KstDataSourcePtr in_file = 0L;
  QString in_field;
  QString in_tag;
  int in_xStart = 0;
  int in_yStart = 0;
  int in_xNumSteps = 0;
  int in_yNumSteps = 1;
  bool in_doAve = false;
  bool in_doSkip = false;
  int in_skip = 1;

  /* parse the DOM tree */
  QDomNode n = e.firstChild();
  while (!n.isNull()) {
    QDomElement e = n.toElement();
    if (!e.isNull()) {
      if (e.tagName() == "tag") {
        in_tag = e.text();
      } else if (e.tagName() == "file") {
        KST::dataSourceList.lock().readLock();
        in_file = *KST::dataSourceList.findFileName(e.text());
        KST::dataSourceList.lock().unlock();
      } else if (e.tagName() == "field") {
        in_field = e.text();
      } else if (e.tagName() == "reqxstart") {
        in_xStart = e.text().toInt();
      } else if (e.tagName() == "reqystart") {
        in_yStart = e.text().toInt();
      } else if (e.tagName() == "reqnx") {
        in_xNumSteps = e.text().toInt();
      } else if (e.tagName() == "reqny") {
        in_yNumSteps = e.text().toInt();
      } else if (e.tagName() == "doave") {
        in_doAve = (e.text() != "0");
      } else if (e.tagName() == "doskip") {
        in_doSkip = (e.text() != "0");
      } else if (e.tagName() == "skip") {
        in_skip = e.text().toInt();
      }
    }
    n = n.nextSibling();
  }

  setTagName(in_tag);

  // call common constructor
  commonConstructor(in_file, in_field, in_xStart, in_yStart, in_xNumSteps, in_yNumSteps, in_doAve, in_doSkip, in_skip);
}
// ######################################################################
DirectFeedChannel::DirectFeedChannel(OptionManager& mgr, int id)
  : ChannelBase(mgr, "DirectFeed", "DirectFeed", DIRECTFEED),
    itsMapLevel(&OPT_MapLevel, this),
    itsNormType(&OPT_MaxNormType, this),
    itsUseOlderVersion(&OPT_UseOlderVersion, this), // see Channels/ChannelOpts.{H,C}
    itsOutputRangeMin(&OPT_ChannelOutputRangeMin, this),
    itsOutputRangeMax(&OPT_ChannelOutputRangeMax, this)
{
  if (id >= 0)
    {
      std::string name("DirectFeed_No_");
      name += toStr(id);
      setTagName(name);
      setDescriptiveName(name);
    }
}
Beispiel #12
0
GeneratedMatrix::GeneratedMatrix(ObjectStore *store, const QDomElement &e) : Matrix(store) {
  double in_xMin = 0, in_yMin = 0, in_xStep = 1, in_yStep = 1;
  double in_gradZMin = 0, in_gradZMax = 1;
  bool in_xDirection = true;
  int in_nX = 2, in_nY = 2;
  QString in_tag = QString::null;

  /* parse the DOM tree */
  QDomNode n = e.firstChild();
  while (!n.isNull()) {
    QDomElement e = n.toElement();
    if (!e.isNull()) {
      if (e.tagName() == "tag") {
        in_tag = e.text();
      } else if (e.tagName() == "nx") {
        in_nX = e.text().toInt();
      } else if (e.tagName() == "ny") {
        in_nY = e.text().toInt();
      } else if (e.tagName() == "xmin") {
        in_xMin = e.text().toDouble();
      } else if (e.tagName() == "ymin") {
        in_yMin = e.text().toDouble();
      } else if (e.tagName() == "xstep") {
        in_xStep = e.text().toDouble();
      } else if (e.tagName() == "ystep") {
        in_yStep = e.text().toDouble();
      } else if (e.tagName() == "gradzmin") {
        in_gradZMin = e.text().toDouble();
      } else if (e.tagName() == "gradzmax") {
        in_gradZMax = e.text().toDouble();
      } else if (e.tagName() == "xdirection") {
        in_xDirection = (e.text() != "0");
      }
    }
    n = n.nextSibling();
  }

  setTagName(ObjectTag::fromString(in_tag));

  _saveable = true;
  _editable = true;
  _zSize = 0;
  change(in_nX, in_nY, in_xMin, in_yMin, in_xStep, in_yStep, in_gradZMin, in_gradZMax, in_xDirection);
}
Beispiel #13
0
KstString::KstString(QDomElement& e)
: KstPrimitive(), _orphan(false) {
  QDomNode n = e.firstChild();

  while (!n.isNull()) {
    QDomElement e = n.toElement();
    if (!e.isNull()) {
      if (e.tagName() == "tag") {
        setTagName(KstObjectTag::fromString(e.text()));
      } else if (e.tagName() == "orphan") {
        _orphan = true;
      } else if (e.tagName() == "value") {
        setValue(e.text());
      }
    }
    n = n.nextSibling();
  }
  KST::stringList.append(this);
}
Beispiel #14
0
void KstHistogram::commonConstructor(const QString &in_tag, KstVectorPtr in_V,
                                     double xmin_in,
                                     double xmax_in,
                                     int in_n_bins,
                                     KstHsNormType in_norm_mode) {
  _typeString = i18n("Histogram");
  _type = "Histogram";
  _NormMode = in_norm_mode;
  _Bins = 0L;
  _NBins = 0;
  
  setTagName(in_tag);
  _inputVectors[RAWVECTOR] = in_V;

  if (xmax_in>xmin_in) {
    _MaxX = xmax_in;
    _MinX = xmin_in;
  } else {
    _MinX = xmax_in;
    _MaxX = xmin_in;
  }
  if (_MaxX == _MinX) {
    _MaxX += 1.0;
    _MinX -= 1.0;
  }

  _NBins = in_n_bins;
  if (_NBins < 2) {
    _NBins = 2;
  }
  _Bins = new unsigned long[_NBins];
  _NS = 3 * _NBins + 1;

  KstVectorPtr v = new KstVector(in_tag+"-bins", _NBins, this);
  KST::addVectorToList(v);
  _bVector = _outputVectors.insert(BINS, v);

  v = new KstVector(in_tag+"-sv", _NBins, this);
  KST::addVectorToList(v);
  _hVector = _outputVectors.insert(HIST, v);

  setDirty();
}
KstPlotGroup::KstPlotGroup(const QDomElement& e)
: KstMetaPlot(e) {
  setBorderWidth(0);
  QDomNode n = e.firstChild();
  while (!n.isNull()) {
    QDomElement el = n.toElement();
    if (!el.isNull()) {
      if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
        setProperty(el.tagName().latin1(), QVariant(el.text()));
      }
    }
    n = n.nextSibling();
  }

  // always have these values
  _standardActions |= Delete | Raise | Zoom | Lower | RaiseToTop | LowerToBottom;
  _layoutActions |= Delete | Copy | Raise | Lower | RaiseToTop | LowerToBottom | Rename | MoveTo;
  setTagName(KstObjectTag(i18n("Plot Group %1").arg(++pgcount), KstObjectTag::globalTagContext));  // FIXME: tag context?
  _type = "PlotGroup";
  _container = false; // plot group is a container that doesn't behave like one
  setBorderColor(Qt::blue);
}
void KstCSD::commonConstructor(const QString& in_tag, KstVectorPtr in_V, double in_freq, bool in_average, 
                                bool in_removeMean, bool in_apodize, ApodizeFunction in_apodizeFxn, int in_windowSize, 
                                int in_averageLength, double in_gaussianSigma, const QString& in_vectorUnits,
                                const QString& in_rateUnits, PSDType in_outputType, bool in_interpolateHoles,
                                const QString& vecName) {
  _typeString = i18n("Spectrogram");
  _type = "Spectrogram";
  _inputVectors[INVECTOR] = in_V;
  setTagName(KstObjectTag::fromString(in_tag));
  _frequency = in_freq;
  _average = in_average;
  _apodize = in_apodize;
  _windowSize = in_windowSize;
  _apodizeFxn = in_apodizeFxn;
  _gaussianSigma = in_gaussianSigma;
  _removeMean = in_removeMean;
  _averageLength = in_averageLength;
  _vectorUnits = in_vectorUnits;
  _rateUnits = in_rateUnits;
  _outputType = in_outputType;
  _interpolateHoles = in_interpolateHoles;

  if (_frequency <= 0.0) {
    _frequency = 1.0;
  }

  {
    KstWriteLocker blockMatrixUpdates(&KST::matrixList.lock());

    KstMatrixPtr outMatrix = new KstMatrix(KstObjectTag("csd", tag()), this, 1, 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));
    _outMatrix = _outputMatrices.insert(OUTMATRIX, outMatrix);
  }

  updateMatrixLabels();
  (*_outMatrix)->setDirty();
}
Beispiel #17
0
void KstPSDCurve::commonConstructor(const QString &in_tag, KstVectorPtr in_V,
                                    double in_freq, int in_len,
                                    const QString &in_VUnits,
                                    const QString &in_RUnits,
                                    const QColor &in_color) {

  _typeString = i18n("Power Spectrum");
  NumUsed = 0;
  _inputVectors[INVECTOR] = in_V;
  Color = in_color;
  setTagName(in_tag);
  Freq = in_freq;
  Len = in_len;
  VUnits = in_VUnits;
  RUnits = in_RUnits;

  PSDLen = int(pow(2, Len-1));

  ALen = PSDLen*2;
  a = new double[ALen];
  w = new double[ALen];
  GenW();

  last_f0 = 0;
  last_n_subsets = 0;
  last_n_new = 0;
  setRemoveMean(true);
  setAppodize(true);

  KstVectorPtr iv = new KstVector(in_tag+"-freq", 2);
  _fVector = _outputVectors.insert(FVECTOR, iv);

  iv = new KstVector(in_tag+"-sv", PSDLen);
  _sVector = _outputVectors.insert(SVECTOR, iv);

  update();
}
void CrossPowerSpectrum::load(const QDomElement &e) {
  QDomNode n = e.firstChild();

  while (!n.isNull()) {
    QDomElement e = n.toElement();
    if (!e.isNull()) {
      if (e.tagName() == "tag") {
        setTagName(KstObjectTag::fromString(e.text()));
      } else if (e.tagName() == "ivector") {
        _inputVectorLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "iscalar") {
        _inputScalarLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "istring") {
        _inputStringLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "ovector") {
        KstWriteLocker blockVectorUpdates(&KST::vectorList.lock());
        KstVectorPtr v;
        if (e.attribute("scalarList", "0").toInt()) {
          v = new KstVector(KstObjectTag(e.text(), tag()), 0, this, true);
        } else {
          v = new KstVector(KstObjectTag(e.text(), tag()), 0, this, false);
        }
        _outputVectors.insert(e.attribute("name"), v);
      } else if (e.tagName() == "oscalar") {
        KstWriteLocker blockScalarUpdates(&KST::scalarList.lock());
        KstScalarPtr sp = new KstScalar(KstObjectTag(e.text(), tag()), this);
        _outputScalars.insert(e.attribute("name"), sp);
      } else if (e.tagName() == "ostring") {
        KstWriteLocker blockStringUpdates(&KST::stringList.lock());
        KstStringPtr sp = new KstString(KstObjectTag(e.text(), tag()), this);
        _outputStrings.insert(e.attribute("name"), sp);
      }
    }
    n = n.nextSibling();
  }
}
// ######################################################################
DirectionChannel::DirectionChannel(OptionManager& mgr,
                                   const uint dirIndex,
                                   const double direction,
                                   const PyramidType type) :
  SingleChannel(mgr, "", "", MOTION,
                rutz::make_shared(new ReichardtPyrBuilder<float>
                           (cos(direction * M_PI / 180.0),
                            -sin(direction * M_PI / 180.0),
                            type, direction + 90.0))),
  itsIndex("DirectionChannelIndex", this, dirIndex),
  itsDirection("DirectionChannelDirection", this, direction),
  itsTakeSqrt(&OPT_DirectionChannelTakeSqrt, this),
  itsThresh(&OPT_DirectionChannelLowThresh, this)
{
GVX_TRACE(__PRETTY_FUNCTION__);
  itsTakeAbs.setVal(true);
  itsNormalizeOutput.setVal(true);
  itsScaleNoiseToMax.setVal(true);
  itsLowThresh.setVal(itsThresh.getVal());  // kill small values in pyramid
  itsRectifyPyramid.setVal(true); // kill negative values in pyramid

  setDescriptiveName(sformat("Direction(%d)", int(direction)));
  setTagName(sformat("dir_%d", dirIndex));
}
Beispiel #20
0
KstString::KstString(const QString& in_tag, const QString& val, bool orphan, bool doLock)
: KstObject(), _value(val), _orphan(orphan) {
  QString _tag = in_tag;
  if (_tag.isEmpty()) {
    QString nt = i18n("Anonymous String %1");

    do {
      _tag = nt.arg(anonymousStringCounter++);
    } while (KST::vectorTagNameNotUniqueInternal(_tag));
  } else {
    while (KST::vectorTagNameNotUniqueInternal(_tag)) {
      _tag += '\'';
    }
  }
  setTagName(_tag);

  if (doLock) {
    KST::stringList.lock().writeLock();
  }
  KST::stringList.append(this);
  if (doLock) {
    KST::stringList.lock().writeUnlock();
  }
}
void BinnedMap::load(const QDomElement &e) {
  QDomNode n = e.firstChild();

  setAutoBin(false);

  while (!n.isNull()) {
    QDomElement e = n.toElement();
    if (!e.isNull()) {
      if (e.tagName() == "tag") {
        setTagName(KstObjectTag::fromString(e.text()));
      } else if (e.tagName() == "ivector") {
        _inputVectorLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "omatrix") {
	KstWriteLocker blockMatrixUpdates(&KST::matrixList.lock());
	KstMatrixPtr m;
	m = new KstMatrix(KstObjectTag(e.text(), tag()), this);
	_outputMatrices.insert(e.attribute("name"), m);
      } else if (e.tagName() == "minX") {
	setXMin(e.text().toDouble());
      } else if (e.tagName() == "maxX") {
	setXMax(e.text().toDouble());
      } else if (e.tagName() == "minY") {
	setYMin(e.text().toDouble());
      } else if (e.tagName() == "maxY") {
	setYMax(e.text().toDouble());
      } else if (e.tagName() == "nX") {
	setNX(e.text().toInt());
      } else if (e.tagName() == "nY") {
	setNY(e.text().toInt());
      } else if (e.tagName() == "autoBin") {
	setAutoBin(true);
      }
    }
    n = n.nextSibling();
  }
}
KstCPlugin::KstCPlugin(const QDomElement& pluginElement)
: KstDataObject(pluginElement) {
  QString pluginName;

  _inStringCnt = 0;
  _outStringCnt = 0;
  commonConstructor();

  QDomNode n = pluginElement.firstChild();

  while (!n.isNull()) {
    QDomElement e = n.toElement();
    if (!e.isNull()) {
      if (e.tagName() == "tag") {
        setTagName(KstObjectTag::fromString(e.text()));
      } else if (e.tagName() == "name") {
        pluginName = e.text();
      } else if (e.tagName() == "ivector") {
        _inputVectorLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "iscalar") {
        _inputScalarLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "istring") {
        _inputStringLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
      } else if (e.tagName() == "ovector") {
        KstWriteLocker blockVectorUpdates(&KST::vectorList.lock());
        KstVectorPtr v;
        if (e.attribute("scalarList", "0").toInt()) {
          v = new KstVector(KstObjectTag(e.text(), tag()), 0, this, true);
        } else {
          v = new KstVector(KstObjectTag(e.text(), tag()), 0, this, false);
        }
        _outputVectors.insert(e.attribute("name"), v);
      } else if (e.tagName() == "oscalar") {
        KstWriteLocker blockScalarUpdates(&KST::scalarList.lock());
        KstScalarPtr sp = new KstScalar(KstObjectTag(e.text(), tag()), this);
        _outputScalars.insert(e.attribute("name"), sp);
      } else if (e.tagName() == "ostring") {
        KstWriteLocker blockStringUpdates(&KST::stringList.lock());
        KstStringPtr sp = new KstString(KstObjectTag(e.text(), tag()), this);
        _outputStrings.insert(e.attribute("name"), sp);
      }
    }
    n = n.nextSibling();
  }

  _plugin = PluginCollection::self()->plugin(pluginName);

  if (!_plugin.data()) {
    KstDebug::self()->log(i18n("Unable to load plugin %1 for \"%2\".").arg(pluginName).arg(tagName()), KstDebug::Warning);
  } else {
    Plugin::countScalarsVectorsAndStrings(_plugin->data()._inputs, _inScalarCnt, _inArrayCnt, _inStringCnt, _inPid);

    const QValueList<Plugin::Data::IOValue>& otable = _plugin->data()._outputs;
    for (QValueList<Plugin::Data::IOValue>::ConstIterator it = otable.begin();
                                                           it != otable.end();
                                                                         ++it) {
      // FIXME: i18n?
      if ((*it)._type == Plugin::Data::IOValue::TableType) {
        _outArrayCnt++;
        if (!_outputVectors.contains((*it)._name)) {
          KstWriteLocker blockVectorUpdates(&KST::vectorList.lock());
          KstVectorPtr v;

          if ((*it)._subType == Plugin::Data::IOValue::FloatNonVectorSubType) {
            v = new KstVector(KstObjectTag(tagName() + " vector - " + (*it)._name, tag()), 0, this, true);  // FIXME: tag name?
          } else {
            v = new KstVector(KstObjectTag(tagName() + " vector - " + (*it)._name, tag()), 0, this, false);  // FIXME: tag name?
          }
          _outputVectors.insert((*it)._name, v);
        }
      } else if ((*it)._type == Plugin::Data::IOValue::MatrixType) {
          abort(); // FIXME:
#if 0
        _outArrayCnt += 2;
        if (!_outputMatrices.contains((*it)._name)) {
          KstWriteLocker blockMatrixUpdates(&KST::matrixList.lock());
          KstMatrixPtr m;

          if ((*it)._subType == Plugin::Data::IOValue::FloatNonVectorSubType) {
            m = new KstMatrix(KstObjectTag(tagName() + " matrix - " + (*it)._name, tag()), 0, this, true);  // FIXME: tag name?
          } else {
            m = new KstMatrix(KstObjectTag(tagName() + " matrix - " + (*it)._name, tag()), 0, this, false);  // FIXME: tag name?
          }
          m->setProvider(this);
          _outputMatrices.insert((*it)._name, m);
        }
#endif
      } else if ((*it)._type == Plugin::Data::IOValue::FloatType) {
        _outScalarCnt++;
        if (!_outputScalars.contains((*it)._name)) {
          KstScalarPtr s = new KstScalar(KstObjectTag(tagName() + " scalar - " + (*it)._name, tag()), this);  // FIXME: tag name?
          _outputScalars.insert((*it)._name, s);
        }
      } else if ((*it)._type == Plugin::Data::IOValue::StringType) {
        _outStringCnt++;
        if (!_outputStrings.contains((*it)._name)) {
          KstStringPtr s = new KstString(KstObjectTag(tagName() + " string - " + (*it)._name, tag()), this);  // FIXME: tag name?
          _outputStrings.insert((*it)._name, s);
        }
      }
    }
    allocateParameters();
  }
}
Beispiel #23
0
vkhtmlDFN::vkhtmlDFN() {
  setTagName("DFN");
}
Beispiel #24
0
vkhtmlTEXTAREA::vkhtmlTEXTAREA() {
  setTagName("TEXTAREA");
}
Beispiel #25
0
vkhtmlINPUT::vkhtmlINPUT() {
  setRequireEndTag(false);
  setTagName("INPUT");
}
Beispiel #26
0
ossimNitfRpcBTag::ossimNitfRpcBTag()
   : ossimNitfRpcBase()
{
   // Set the tag name in base.
   setTagName(std::string("RPC00B"));
}
Beispiel #27
0
vkhtmlLABEL::vkhtmlLABEL() {
  setTagName("LABEL");
}
Beispiel #28
0
vkhtmlBODY::vkhtmlBODY() {
  setTagName("BODY");
}
Beispiel #29
0
vkhtmlDT::vkhtmlDT() {
  setTagName("DT");
}
Beispiel #30
0
KstTopLevelView::KstTopLevelView(QWidget *parent, const char *name, WFlags w)
: KstViewObject("TopLevelView"), _w(new KstViewWidget(this, parent, name, w)) {
  _onGrid = true;
  setTagName(name);
  commonConstructor(); 
}