本文整理汇总了C++中KstVCurvePtr类的典型用法代码示例。如果您正苦于以下问题:C++ KstVCurvePtr类的具体用法?C++ KstVCurvePtr怎么用?C++ KstVCurvePtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KstVCurvePtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeCurve
KJS::Value KstBindCurve::yMinusErrorPoint(KJS::ExecState *exec, const KJS::List& args) {
KstVCurvePtr d = makeCurve(_d);
if (!d) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Undefined();
}
if (args.size() != 1) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError, "Requires exactly one argument.");
exec->setException(eobj);
return KJS::Undefined();
}
unsigned i = 0;
if (args[0].type() != KJS::NumberType || !args[0].toUInt32(i)) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Undefined();
}
KstReadLocker rl(d);
double x, y, e;
d->getEYMinusPoint(i, x, y, e);
return KJS::Number(e);
}
示例2: Q_UNUSED
KJS::Value KstBindCurve::hasBars(KJS::ExecState *exec) const {
Q_UNUSED(exec)
KstVCurvePtr d = makeCurve(_d);
if (d) {
KstReadLocker rl(d);
return KJS::Boolean(d->hasBars());
}
return KJS::Boolean(false);
}
示例3: edit_I
void KstCurveDialogI::edit_I() {
int index;
KstVCurvePtr curve;
KstVCurveList curves = kstObjectSubList<KstDataObject, KstVCurve>(KST::dataObjectList);
index = Select->currentItem();
if (index < 0 || unsigned(index) >= curves.count()) {
new_I();
return;
}
QString tag_name = Select->currentText();
/* verify that the curve name is unique */
if (tag_name != curves[index]->tagName()) {
if (KST::dataTagNameNotUnique(tag_name))
return;
}
curve = curves[index];
curve->setTagName(tag_name);
{ // leave this scope here to destroy the iterator
KstReadLocker ml(&KST::vectorList.lock());
KstVectorList::Iterator i = KST::vectorList.findTag(_xVector->selectedVector());
if (i != KST::vectorList.end())
curve->setXVector(*i);
i = KST::vectorList.findTag(_yVector->selectedVector());
if (i != KST::vectorList.end())
curve->setYVector(*i);
i = KST::vectorList.findTag(_xError->selectedVector());
curve->setXError(*i);
i = KST::vectorList.findTag(_yError->selectedVector());
curve->setYError(*i);
}
curve->setColor(_curveAppearance->color());
curve->setHasPoints(_curveAppearance->showPoints());
curve->setHasLines(_curveAppearance->showLines());
curve->Point.setType(_curveAppearance->pointType());
curve->update(-1);
curve = 0L;
curves.clear();
emit modified();
}
示例4: createPowerSpectrum
QString KstIfaceImpl::createPowerSpectrum(const QString & name,
const QString& vector,
bool appodize,
bool removeMean,
int fftLength,
const QString& rateUnits,
double sampleRate,
const QString& vectorUnits,
const QColor& color) {
QStringList objList = createPowerSpectrum(name, vector, appodize, removeMean,
fftLength, rateUnits, sampleRate,
vectorUnits);
if (objList.isEmpty())
{
return QString::null;
}
KST::vectorList.lock().readLock();
KstVectorPtr vx = *KST::vectorList.findTag(objList[1]);
KstVectorPtr vy = *KST::vectorList.findTag(objList[2]);
KST::vectorList.lock().unlock();
QString n = objList[0] + "-C";
KST::dataObjectList.lock().readLock();
while (KST::dataObjectList.findTag(n) != KST::dataObjectList.end()) {
n += "'";
}
KST::dataObjectList.lock().unlock();
// create curve as well (but don't plot the curve)
KstVCurvePtr vc = new KstVCurve(n, vx, vy,
0L, 0L, 0L, 0L,
color.isValid() ? color : QColor("darkBlue"));
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(KstDataObjectPtr(vc));
KST::dataObjectList.lock().unlock();
_doc->forceUpdate();
_doc->setModified();
return vc->tagName(); //return the curve name so user can plot it
}
示例5: KstVCurve
bool KstFilterDialogI::createCurve(KstCPluginPtr plugin) {
KstVectorPtr xVector;
KstVectorPtr yVector;
KST::vectorList.lock().readLock();
KstVectorList::Iterator it = KST::vectorList.findTag(_xvector);
if (it != KST::vectorList.end()) {
xVector = *it;
}
KST::vectorList.lock().unlock();
if (plugin->outputVectors().contains(plugin->plugin()->data()._filterOutputVector)) {
yVector = plugin->outputVectors()[plugin->plugin()->data()._filterOutputVector];
}
if (!xVector || !yVector) {
return false;
}
plugin->setDirty();
QString c_name = KST::suggestCurveName(plugin->tag(), true);
KstVCurvePtr fit = new KstVCurve(c_name, KstVectorPtr(xVector), KstVectorPtr(yVector), KstVectorPtr(0L), KstVectorPtr(0L), KstVectorPtr(0L), KstVectorPtr(0L), _w->_curveAppearance->color());
fit->setHasPoints(_w->_curveAppearance->showPoints());
fit->setHasLines(_w->_curveAppearance->showLines());
fit->setHasBars(_w->_curveAppearance->showBars());
fit->setLineWidth(_w->_curveAppearance->lineWidth());
fit->setLineStyle(_w->_curveAppearance->lineStyle());
fit->pointType = _w->_curveAppearance->pointType();
fit->setBarStyle(_w->_curveAppearance->barStyle());
fit->setPointDensity(_w->_curveAppearance->pointDensity());
KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_window));
if (w && w->view()->findChild(_plotName)) {
Kst2DPlotPtr plot = kst_cast<Kst2DPlot>(w->view()->findChild(_plotName));
if (plot) {
plot->addCurve(fit.data());
}
}
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(fit.data());
KST::dataObjectList.lock().unlock();
return true;
}
示例6: show_setCurve
void KstFilterDialogI::show_setCurve(const QString& curveName,
const QString& plotName,
const QString& window) {
KstBaseCurveList curves = kstObjectSubList<KstDataObject, KstBaseCurve>(KST::dataObjectList);
KstVCurveList vcurves = kstObjectSubList<KstBaseCurve, KstVCurve>(curves);
_window = window;
_plotName = plotName;
_curve = curveName;
// it should be impossible for the curve not to exist so this should
// always be true. If it is false, we do not properly take care of it,
// here and bad things will happen....
KstVCurvePtr curve = *vcurves.findTag(curveName);
if (curve) {
curve->readLock();
_xvector = curve->xVTag().displayString();
_yvector = curve->yVTag().displayString();
curve->unlock();
}
show();
}
示例7: while
const QString& KstIfaceImpl::createCurve(const QString& name, const QString& xVector, const QString& yVector, const QString& xErrorVector, const QString& yErrorVector, const QColor& color) {
QString n = name;
KST::vectorList.lock().readLock();
KstVectorPtr vx = *KST::vectorList.findTag(xVector);
KstVectorPtr vy = *KST::vectorList.findTag(yVector);
KstVectorPtr ex = *KST::vectorList.findTag(xErrorVector);
KstVectorPtr ey = *KST::vectorList.findTag(yErrorVector);
KST::vectorList.lock().unlock();
KST::dataObjectList.lock().writeLock();
while (KST::dataObjectList.findTag(n) != KST::dataObjectList.end()) {
n += "'";
}
KstVCurvePtr c = new KstVCurve(n, vx, vy, ex, ey, ex, ey, color);
KST::dataObjectList.append(KstDataObjectPtr(c));
KST::dataObjectList.lock().unlock();
_doc->forceUpdate();
_doc->setModified();
return c->tagName();
}
示例8: createHistogram
QString KstIfaceImpl::createHistogram(const QString& name,
const QString& vector,
double min,
double max,
int numBins,
int normalizationType,
const QColor& color) {
QStringList objList = createHistogram(name, vector, min, max, numBins, normalizationType);
if (objList.isEmpty())
{
return QString::null;
}
// also create the curve for the histogram
QString n = objList[0] + "-C";
KST::vectorList.lock().readLock();
KstVectorPtr vx = *KST::vectorList.findTag(objList[1]);
KstVectorPtr vy = *KST::vectorList.findTag(objList[2]);
KST::vectorList.lock().unlock();
KST::dataObjectList.lock().readLock();
while (KST::dataObjectList.findTag(n) != KST::dataObjectList.end()) {
n += "'";
}
KST::dataObjectList.lock().unlock();
KstVCurvePtr c = new KstVCurve(n, vx, vy, 0L, 0L, 0L, 0L, color);
c->setHasPoints(false);
c->setHasLines(false);
c->setHasBars(true);
c->setBarStyle(1);
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(KstDataObjectPtr(c));
KST::dataObjectList.lock().unlock();
_doc->forceUpdate();
_doc->setModified();
return c->tagName(); //return the curve name so user can plot it
}
示例9: newObject
bool KstPsdDialog::newObject() {
QString tag_name = _tagName->text();
bool retVal = false;
if (tag_name == defaultTag) {
tag_name = KST::suggestPSDName(KstObjectTag::fromString(_w->_vector->selectedVector()));
}
if (KstData::self()->dataTagNameNotUnique(tag_name)) {
_tagName->setFocus();
return false;
}
if (_w->_vector->selectedVector().isEmpty()) {
QMessageBox::warning(this, QObject::tr("Kst"), QObject::tr("New spectrum not made: define vectors first."));
return false;
}
KST::vectorList.lock().readLock();
KstVectorPtr p = *KST::vectorList.findTag(_w->_vector->selectedVector());
KST::vectorList.lock().unlock();
if (_w->_kstFFTOptions->checkValues()) {
if (p) {
KstVCurvePtr vc;
KstPSDPtr psd;
QColor color;
p->readLock();
psd = new KstPSD(tag_name, p,
_w->_kstFFTOptions->SampRate->text().toDouble(),
_w->_kstFFTOptions->Interleaved->isChecked(),
_w->_kstFFTOptions->FFTLen->text().toInt(),
_w->_kstFFTOptions->Apodize->isChecked(),
_w->_kstFFTOptions->RemoveMean->isChecked(),
_w->_kstFFTOptions->VectorUnits->text(),
_w->_kstFFTOptions->RateUnits->text(),
ApodizeFunction(_w->_kstFFTOptions->ApodizeFxn->currentIndex()),
_w->_kstFFTOptions->Sigma->value(),
PSDType(_w->_kstFFTOptions->Output->currentIndex()));
psd->setInterpolateHoles(_w->_kstFFTOptions->InterpolateHoles->isChecked());
p->unlock();
// xxx color = KstApp::inst()->chooseColorDlg()->getColorForCurve(psd->vX(), psd->vY());
if (!color.isValid()) {
color = _w->_curveAppearance->color();
}
vc = new KstVCurve(KST::suggestCurveName(psd->tag(),true), psd->vX(), psd->vY(), KstVectorPtr(), KstVectorPtr(), KstVectorPtr(), KstVectorPtr(), color);
vc->setHasPoints(_w->_curveAppearance->showPoints());
vc->setHasLines(_w->_curveAppearance->showLines());
vc->setHasBars(_w->_curveAppearance->showBars());
vc->setPointStyle(_w->_curveAppearance->pointType());
vc->setLineWidth(_w->_curveAppearance->lineWidth());
vc->setLineStyle(_w->_curveAppearance->lineStyle());
vc->setBarStyle(_w->_curveAppearance->barStyle());
vc->setPointDensity(_w->_curveAppearance->pointDensity());
QString legend_text = _legendText->text();
if (legend_text == defaultTag) {
vc->setLegendText(QString::null);
} else {
vc->setLegendText(legend_text);
}
Kst2DPlotPtr plot;
KstViewWindow *w;
/* xxx
w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_w->_curvePlacement->_plotWindow->currentText()));
if (!w) {
QString n = KstApp::inst()->newWindow(KST::suggestWinName());
w = static_cast<KstViewWindow*>(KstApp::inst()->findWindow(n));
}
*/
if (w) {
if (_w->_curvePlacement->existingPlot()) {
plot = kst_cast<Kst2DPlot>(w->view()->findChild(_w->_curvePlacement->plotName()));
if (plot) {
plot->addCurve(vc);
}
}
if (_w->_curvePlacement->newPlot()) {
QString name = w->createPlot(KST::suggestPlotName());
if (_w->_curvePlacement->reGrid()) {
w->view()->cleanup(_w->_curvePlacement->columns());
}
plot = kst_cast<Kst2DPlot>(w->view()->findChild(name));
if (plot) {
plot->setXAxisInterpretation(false, KstAxisInterpretation(), KstAxisDisplay());
plot->setYAxisInterpretation(false, KstAxisInterpretation(), KstAxisDisplay());
_w->_curvePlacement->update();
_w->_curvePlacement->setCurrentPlot(plot->tagName());
plot->addCurve(vc);
plot->generateDefaultLabels();
}
}
}
//.........这里部分代码省略.........
示例10: ml
void KstCurveDialogI::new_I() {
KstWriteLocker ml(&KST::vectorList.lock());
KstVectorList::Iterator VX, VY;
KstVectorList::Iterator EX, EY;
KstVCurvePtr curve;
KstPlot *plot;
if (_xVector->selectedVector().isEmpty()) {
KMessageBox::sorry(0L, i18n("New curve not made: define vectors first."));
return;
}
/* find VX and VY */
VX = KST::vectorList.findTag(_xVector->selectedVector());
VY = KST::vectorList.findTag(_yVector->selectedVector());
EX = KST::vectorList.findTag(_xError->selectedVector());
EY = KST::vectorList.findTag(_yError->selectedVector());
if (VX == KST::vectorList.end() || VY == KST::vectorList.end()) {
kdFatal() << "Bug in kst: the XVector field in plotDialog refers to "
<< "a non existant vector...." << endl;
}
KstReadLocker rl1(*VX), rl2(*VY);
QString tag_name = Select->currentText();
tag_name.replace(i18n("<New_Curve>"), (*VY)->tagName());
/* verify that the curve name is unique */
if (KST::dataTagNameNotUnique(tag_name)) {
return;
}
/* create the curve */
curve = new KstVCurve(tag_name, *VX, *VY,
EX != KST::vectorList.end() ? *EX : KstVectorPtr(0L),
EY != KST::vectorList.end() ? *EY : KstVectorPtr(0L),
_curveAppearance->color());
curve->setHasPoints(_curveAppearance->showPoints());
curve->setHasLines(_curveAppearance->showLines());
curve->Point.setType(_curveAppearance->pointType());
if (_curvePlacement->existingPlot()) {
/* assign curve to plot */
plot = KST::plotList.FindKstPlot(_curvePlacement->plotName());
plot->addCurve(curve);
}
if (_curvePlacement->newPlot()) {
/* assign curve to plot */
plot = KST::plotList.addPlot(QString::null, _curvePlacement->columns());
_curvePlacement->appendPlot(plot->tagName(), true);
plot->addCurve(curve);
plot->GenerateDefaultLabels();
}
KST::dataObjectList.lock().readLock();
KST::dataObjectList.append(curve.data());
KST::dataObjectList.lock().writeUnlock();
curve = 0L;
emit modified();
}
示例11: extractVector
KJS::Object KstBindCurve::construct(KJS::ExecState *exec, const KJS::List& args) {
KstVectorPtr x, y, ex, ey, exm, eym;
if (args.size() > 0) {
x = extractVector(exec, args[0]);
if (!x) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
}
if (args.size() > 1) {
y = extractVector(exec, args[1]);
if (!y) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
}
if (args.size() > 2) {
ex = extractVector(exec, args[2]);
if (!ex) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
}
if (args.size() > 3) {
ey = extractVector(exec, args[3]);
if (!ey) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
}
if (args.size() > 4) {
exm = extractVector(exec, args[4]);
if (!exm) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
}
if (args.size() > 5) {
eym = extractVector(exec, args[5]);
if (!eym) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
}
if (args.size() > 6) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError);
exec->setException(eobj);
return KJS::Object();
}
if (!x || !y) { // force at least X and Y vectors
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError);
exec->setException(eobj);
return KJS::Object();
}
QColor color = KstColorSequence::next();
KstVCurvePtr d = new KstVCurve(QString::null, x, y, ex, ey, exm, eym, color);
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(d.data());
KST::dataObjectList.lock().writeUnlock();
return KJS::Object(new KstBindCurve(exec, d));
}
示例12: update
void KstCurveDialogI::update(int new_index) {
int i_curve;
KstVCurvePtr curve;
int index;
bool isNew = false;
int n_v, n_c;
KstVCurveList curves = kstObjectSubList<KstDataObject, KstVCurve>(KST::dataObjectList);
if (new_index == -1) {
if (curves.findTag(Select->currentText()) != curves.end()) {
QString save = Select->currentText();
Select->blockSignals(true);
Select->clear();
for (KstVCurveList::iterator i = curves.begin(); i != curves.end(); ++i) {
Select->insertItem((*i)->tagName());
}
Select->setCurrentText(save);
Select->blockSignals(false);
return;
}
}
/**********************/
/* initialize indexes */
KST::vectorList.lock().readLock();
n_v = KST::vectorList.count();
KST::vectorList.lock().readUnlock();
n_c = curves.count();
if (new_index == -2) { // initialize for new curve
isNew = true;
index = n_c;
} else if (n_c < 1) {
isNew = true;
index = 0;
} else if (new_index >= 0 && new_index < n_c) { // initialize specific curve
index = new_index;
} else if (Select->count() > 0) { // initialize for old default
index = Select->currentItem();
} else { // initialize for last in list
index = n_c - 1;
}
/*****************************************/
/* fill the Select combo with curve tags */
Select->clear();
for (KstVCurveList::iterator i = curves.begin(); i != curves.end(); ++i) {
Select->insertItem((*i)->tagName());
}
if (isNew) {
QString new_label;
new_label.sprintf("C%d-", curves.count()+1);
new_label += i18n("<New_Curve>");
Select->insertItem(new_label);
}
if ((index>=0) && (index<Select->count())) {
Select->setCurrentItem(index);
}
/*******************************************/
/* fill the Vector lists with vector names */
_xVector->update();
_yVector->update();
_xError->update();
_yError->update();
/***********************************/
/* set the curve placement window */
_curvePlacement->setPlotList(KST::plotList.tagNames(), true);
_curvePlacement->setColumns(KST::plotList.getPlotCols());
if (isNew) {
// guess what placement option is wanted
if (!KST::plotList.isEmpty() && curves.count() > KST::plotList.count()) {
_curvePlacement->setNewPlot(false);
_curvePlacement->setExistingPlot(true);
} else {
_curvePlacement->setNewPlot(true);
_curvePlacement->setExistingPlot(false);
}
}
/****************************************************/
/* set the vector pull downs to the correct vectors */
if (n_c > 0 && !isNew) {
i_curve = Select->currentItem();
curve = curves[i_curve];
_xVector->setSelection(curve->getXVTag());
_yVector->setSelection(curve->getYVTag());
_xError->setSelection(curve->getXETag());
_yError->setSelection(curve->getYETag());
_curveAppearance->setValue(curve->hasLines(), curve->hasPoints(), curve->getColor(), curve->Point.getType());
Delete->setEnabled(curve->getUsage() == 2);
} else { /* no curves defined - initialize what we can to vector 0 */
_curveAppearance->reset();
Delete->setEnabled(false);
//.........这里部分代码省略.........
示例13: i18n
/* returns true if succesful */
bool KstPsdDialogI::newObject() {
QString tag_name = _tagName->text();
if (tag_name == defaultTag) {
tag_name = KST::suggestPSDName(KstObjectTag::fromString(_w->_vector->selectedVector()));
}
// verify that the curve name is unique
if (KstData::self()->dataTagNameNotUnique(tag_name)) {
_tagName->setFocus();
return false;
}
if (_w->_vector->selectedVector().isEmpty()) {
KMessageBox::sorry(this, i18n("New PSD not made: define vectors first."));
return false;
}
KST::vectorList.lock().readLock();
KstVectorPtr p = *KST::vectorList.findTag(_w->_vector->selectedVector());
KST::vectorList.lock().unlock();
if (!p) {
kstdFatal() << "Bug in kst: the vector field (PSD) refers to "
<< "a non existant vector...." << endl;
}
// create the psd curve
if (!_w->_kstFFTOptions->checkValues()) {
return false;
} else {
p->readLock();
KstPSDPtr psd = new KstPSD(tag_name, p,
_w->_kstFFTOptions->SampRate->text().toDouble(),
_w->_kstFFTOptions->Interleaved->isChecked(),
_w->_kstFFTOptions->FFTLen->text().toInt(),
_w->_kstFFTOptions->Apodize->isChecked(),
_w->_kstFFTOptions->RemoveMean->isChecked(),
_w->_kstFFTOptions->VectorUnits->text(),
_w->_kstFFTOptions->RateUnits->text(),
ApodizeFunction(_w->_kstFFTOptions->ApodizeFxn->currentItem()),
_w->_kstFFTOptions->Sigma->value(),
PSDType(_w->_kstFFTOptions->Output->currentItem()));
psd->setInterpolateHoles(_w->_kstFFTOptions->InterpolateHoles->isChecked());
p->unlock();
KstVCurvePtr vc = new KstVCurve(KST::suggestCurveName(psd->tag(),true), psd->vX(), psd->vY(), 0L, 0L, 0L, 0L, _w->_curveAppearance->color());
vc->setHasPoints(_w->_curveAppearance->showPoints());
vc->setHasLines(_w->_curveAppearance->showLines());
vc->setHasBars(_w->_curveAppearance->showBars());
vc->pointType = _w->_curveAppearance->pointType();
vc->setLineWidth(_w->_curveAppearance->lineWidth());
vc->setLineStyle(_w->_curveAppearance->lineStyle());
vc->setBarStyle(_w->_curveAppearance->barStyle());
vc->setPointDensity(_w->_curveAppearance->pointDensity());
QString legend_text = _legendText->text();
if (legend_text == defaultTag) {
vc->setLegendText(QString::null);
} else {
vc->setLegendText(legend_text);
}
Kst2DPlotPtr plot;
KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_w->_curvePlacement->_plotWindow->currentText()));
if (!w) {
QString n = KstApp::inst()->newWindow(KST::suggestWinName());
w = static_cast<KstViewWindow*>(KstApp::inst()->findWindow(n));
}
if (w) {
if (_w->_curvePlacement->existingPlot()) {
// assign curve to plot
plot = kst_cast<Kst2DPlot>(w->view()->findChild(_w->_curvePlacement->plotName()));
if (plot) {
plot->addCurve(vc.data());
}
}
if (_w->_curvePlacement->newPlot()) {
// assign curve to plot
QString name = w->createObject<Kst2DPlot>(KST::suggestPlotName());
if (_w->_curvePlacement->reGrid()) {
w->view()->cleanup(_w->_curvePlacement->columns());
}
plot = kst_cast<Kst2DPlot>(w->view()->findChild(name));
if (plot) {
plot->setXAxisInterpretation(false, KstAxisInterpretation(), KstAxisDisplay());
plot->setYAxisInterpretation(false, KstAxisInterpretation(), KstAxisDisplay());
_w->_curvePlacement->update();
_w->_curvePlacement->setCurrentPlot(plot->tagName());
plot->addCurve(vc.data());
plot->generateDefaultLabels();
}
}
}
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(psd.data());
KST::dataObjectList.append(vc.data());
KST::dataObjectList.lock().unlock();
psd = 0L;
vc = 0L;
//.........这里部分代码省略.........
示例14: if
bool KstHsDialog::newObject() {
QString tag_name = _tagName->text();
if (tag_name == defaultTag) {
tag_name = KST::suggestHistogramName(KstObjectTag::fromString(_w->_vector->selectedVector()));
}
//
// verify that the curve name is unique...
//
if (KstData::self()->dataTagNameNotUnique(tag_name)) {
_tagName->setFocus();
return false;
}
if (_w->_vector->selectedVector().isEmpty()) {
QMessageBox::warning(this, QObject::tr("Kst"), QObject::tr("New Histogram not made: define vectors first."));
return false;
}
//
// find max and min...
//
double new_min = _w->Min->text().toDouble();
double new_max = _w->Max->text().toDouble();
if (new_max < new_min) {
double m = new_max;
new_max = new_min;
new_min = m;
}
if (new_max == new_min) {
QMessageBox::warning(this, QObject::tr("kst"), QObject::tr("Max and Min can not be equal."));
return false;
}
int new_n_bins = _w->N->text().toInt();
if (new_n_bins < 1) {
QMessageBox::warning(this, QObject::tr("kst"), QObject::tr("You must have one or more bins in a histogram."));
return false;
}
KstHsNormType new_norm_mode;
if (_w->NormIsPercent->isChecked()) {
new_norm_mode = KST_HS_PERCENT;
} else if (_w->NormIsFraction->isChecked()) {
new_norm_mode = KST_HS_FRACTION;
} else if (_w->PeakIs1->isChecked()) {
new_norm_mode = KST_HS_MAX_ONE;
} else {
new_norm_mode = KST_HS_NUMBER;
}
KstHistogramPtr hs;
KST::vectorList.lock().readLock();
KstVectorPtr vp = *KST::vectorList.findTag(_w->_vector->selectedVector());
KST::vectorList.lock().unlock();
if (vp) {
KstVCurvePtr vc;
KstViewWindow *w;
QColor color;
vp->readLock();
hs = new KstHistogram(tag_name, vp, new_min, new_max,
new_n_bins, new_norm_mode);
vp->unlock();
hs->setRealTimeAutoBin(_w->_realTimeAutoBin->isChecked());
// xxx color = KstApp::inst()->chooseColorDlg()->getColorForCurve(hs->vX(), hs->vY());
if (!color.isValid()) {
color = _w->_curveAppearance->color();
}
vc = new KstVCurve(KST::suggestCurveName(hs->tag(), true), hs->vX(), hs->vY(), KstVectorPtr(), KstVectorPtr(), KstVectorPtr(), KstVectorPtr(), color);
vc->setHasPoints(_w->_curveAppearance->showPoints());
vc->setHasLines(_w->_curveAppearance->showLines());
vc->setHasBars(_w->_curveAppearance->showBars());
vc->setPointStyle(_w->_curveAppearance->pointType());
vc->setLineWidth(_w->_curveAppearance->lineWidth());
vc->setLineStyle(_w->_curveAppearance->lineStyle());
vc->setBarStyle(_w->_curveAppearance->barStyle());
vc->setPointDensity(_w->_curveAppearance->pointDensity());
QString legendText = _legendText->text();
if (legendText == defaultTag) {
vc->setLegendText(QString(""));
} else {
vc->setLegendText(legendText);
}
/* xxx
w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_w->_curvePlacement->_plotWindow->currentText()));
*/
if (!w) {
//.........这里部分代码省略.........
示例15: o
KstBindCurve::KstBindCurve(KJS::ExecState *exec, KstVCurvePtr d)
: KstBindDataObject(exec, d.data(), "Curve") {
KJS::Object o(this);
addBindings(exec, o);
}