本文整理汇总了C++中KstVCurvePtr::data方法的典型用法代码示例。如果您正苦于以下问题:C++ KstVCurvePtr::data方法的具体用法?C++ KstVCurvePtr::data怎么用?C++ KstVCurvePtr::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstVCurvePtr
的用法示例。
在下文中一共展示了KstVCurvePtr::data方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createCurve
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);
QColor color = KstApp::inst()->chooseColorDlg()->getColorForCurve(KstVectorPtr(xVector), KstVectorPtr(yVector));
if (!color.isValid()) {
color = _w->_curveAppearance->color();
}
KstVCurvePtr fit = new KstVCurve(c_name, KstVectorPtr(xVector), KstVectorPtr(yVector), KstVectorPtr(0L), KstVectorPtr(0L), KstVectorPtr(0L), KstVectorPtr(0L), 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->setPointStyle(_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;
}
示例2: construct
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));
}
示例3: o
KstBindCurve::KstBindCurve(KJS::ExecState *exec, KstVCurvePtr d)
: KstBindDataObject(exec, d.data(), "Curve") {
KJS::Object o(this);
addBindings(exec, o);
}
示例4: newObject
bool KstEqDialogI::newObject() {
QString tag_name = _tagName->text();
QString etext = _w->_equation->text();
etext.remove(QRegExp("[^a-zA-Z0-9\\(\\)\\+\\-\\*/\\%\\^\\|\\&\\!<>=_.]"));
if (etext.length() > 12) {
etext.truncate(12);
etext += "...";
}
if (tag_name == defaultTag) {
tag_name = KST::suggestEQName(etext);
}
/* verify that the curve name is unique */
if (KstData::self()->dataTagNameNotUnique(tag_name)) {
_tagName->setFocus();
return false;
}
if (!checkEntries()) {
return false;
}
KST::vectorList.lock().readLock();
/* find *V */
KstVectorPtr vp = *KST::vectorList.findTag(_w->_xVectors->selectedVector());
if (!vp) {
kstdFatal() << "Bug in kst: the Vector field (Eq) "
<< "refers to a non-existent vector..." << endl;
}
KST::vectorList.lock().unlock();
/** Create the equation here */
vp->readLock();
KstEquationPtr eq = new KstEquation(tag_name, _w->_equation->text(), vp, _w->_doInterpolation->isChecked());
vp->unlock();
if (!eq->isValid()) {
eq = 0L;
QString parseErrors;
for (QStringList::ConstIterator i = Equation::errorStack.begin(); i != Equation::errorStack.end(); ++i) {
parseErrors += *i;
parseErrors += "\n";
}
KMessageBox::detailedSorry(this, i18n("There is an error in the equation you entered."), parseErrors);
return false;
}
KstVCurvePtr vc = new KstVCurve(KST::suggestCurveName(tag_name, true), eq->vX(), eq->vY(), 0L, 0L, 0L, 0L, _w->_curveAppearance->color());
vc->setHasPoints(_w->_curveAppearance->showPoints());
vc->setHasLines(_w->_curveAppearance->showLines());
vc->setHasBars(_w->_curveAppearance->showBars());
vc->setLineWidth(_w->_curveAppearance->lineWidth());
vc->setLineStyle(_w->_curveAppearance->lineStyle());
vc->pointType = _w->_curveAppearance->pointType();
vc->setPointDensity(_w->_curveAppearance->pointDensity());
vc->setBarStyle(_w->_curveAppearance->barStyle());
QString legend_text = _legendText->text();
if (legend_text == defaultTag) {
vc->setLegendText(QString(""));
} else {
vc->setLegendText(legend_text);
}
KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_w->_curvePlacement->_plotWindow->currentText()));
if (!w) {
QString n = KstApp::inst()->newWindow(KST::suggestWinName());
w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(n));
}
if (w) {
Kst2DPlotPtr plot;
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) {
_w->_curvePlacement->update();
_w->_curvePlacement->setCurrentPlot(plot->tagName());
plot->addCurve(vc.data());
plot->generateDefaultLabels();
}
}
}
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(eq.data());
//.........这里部分代码省略.........
示例5: new_I
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();
}
示例6: main
//.........这里部分代码省略.........
kstdError() << i18n("Can't create a view.") << endl;
return 0;
}
CreatePlots(in, tlv);
Kst2DPlotList plist = kstObjectSubList<KstViewObject, Kst2DPlot>(tlv->children());
i_plot = 0;
Kst2DPlotPtr plot = *plist.at(i_plot);
KstVCurveList vcurves = kstObjectSubList<KstBaseCurve,KstVCurve>(plot->Curves);
// make stand alone equations if there are no files
if (args->count() < 1) {
if (!yEqList.isEmpty()) {
QString eqS;
double max, min;
int n;
bool xeq;
SetEqXRanges(args->getOption("xe"), &min, &max, &n, &xeq);
if (xeq) {
count = yEqList.size();
handled = 0;
kst->slotUpdateProgress( count, handled, creatingEquations );
for (eq_i = yEqList.begin(); eq_i != yEqList.end(); ++eq_i) {
eqS = *eq_i;
if (NoVectorEq(eqS)) {
KstEquationPtr eq = new KstEquation(KST::suggestEQName(eqS), eqS, min, max, n);
KstVCurvePtr vc = new KstVCurve(KST::suggestCurveName(eq->tag(), true),
eq->vX(), eq->vY(), 0L, 0L, 0L, 0L,
KstColorSequence::next(vcurves,plot->backgroundColor()));
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(eq.data());
KST::dataObjectList.append(vc.data());
KST::dataObjectList.lock().unlock();
plot->addCurve(vc.data());
if (in.sep_plots) {
i_plot++;
if (i_plot < in.n_plots) {
plot = *plist.at(i_plot);
}
}
}
handled++;
kst->slotUpdateProgress( count, handled, creatingEquations );
}
}
}
}
// make the requested curves for each data file
count = args->count();
handled = 0;
kst->slotUpdateProgress( count, handled, creatingCurves );
for (i_curve = i_v = 0, i_file = 0; i_file < args->count(); i_file++) {
// make the file
if (QFile::exists(args->arg(i_file))) {
fullPath = QFileInfo(args->arg(i_file)).absFilePath();
} else {
fullPath = args->arg(i_file);
}