本文整理汇总了C++中KstVCurvePtr::setHasPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ KstVCurvePtr::setHasPoints方法的具体用法?C++ KstVCurvePtr::setHasPoints怎么用?C++ KstVCurvePtr::setHasPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstVCurvePtr
的用法示例。
在下文中一共展示了KstVCurvePtr::setHasPoints方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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)) {
Select->setFocus();
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->setLineWidth(_curveAppearance->lineWidth());
curve->setLineStyle(_curveAppearance->lineStyle());
curve->Point.setType(_curveAppearance->pointType());
curve->update(-1);
curve = 0L;
curves.clear();
emit modified();
}
示例2: setHasPoints
void KstBindCurve::setHasPoints(KJS::ExecState *exec, const KJS::Value& value) {
if (value.type() != KJS::BooleanType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return;
}
KstVCurvePtr d = makeCurve(_d);
if (d) {
KstWriteLocker wl(d);
d->setHasPoints(value.toBoolean(exec));
}
}
示例3: 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;
}
示例4: 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
}
示例5: 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());
//.........这里部分代码省略.........
示例6: 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();
}
示例7: main
//.........这里部分代码省略.........
KstDataSourcePtr file = KstDataSource::loadSource(fullPath);
if (file) {
if (!file->isValid() || file->isEmpty()) {
kstdError() << i18n("No data in file %1. Trying to continue...").arg(args->arg(i_file)) << endl;
// The file might get data later!
}
KST::dataObjectList.lock().writeLock();
KST::dataSourceList.append(file);
KST::dataObjectList.lock().unlock();
KstRVectorPtr yvector;
KstRVectorPtr evector;
KstVCurvePtr curve;
KstPSDPtr psd;
KstHistogramPtr hs;
KstRVectorPtr xvector;
if (!ycolList.isEmpty()) { // if there are some xy plots
// make the x axis vector
xvector = GetOrCreateVector(args->getOption("x"), file, in);
if (xvector) {
// make the y axis vectors
for (i_ycol = 0; i_ycol < ycolList.count(); ++i_ycol ) {
yvector = GetOrCreateVector(*(ycolList.at(i_ycol)), file, in);
if (yvector) {
// make the curves
color = KstColorSequence::next(vcurves,plot->backgroundColor());
curve = new KstVCurve(KST::suggestCurveName(yvector->tag(), false),
KstVectorPtr(xvector), KstVectorPtr(yvector),
0L, 0L, 0L, 0L, color);
if (in.has_points) {
curve->setHasPoints(true);
curve->setHasLines(false);
}
if (i_ycol<errorList.count()) {
evector = GetOrCreateVector(*(errorList.at(i_ycol)), file, in);
if (evector) {
curve->setYError(KstVectorPtr(evector));
curve->setYMinusError(KstVectorPtr(evector));
}
}
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(curve.data());
KST::dataObjectList.lock().unlock();
plot->addCurve(curve.data());
if (in.sep_plots) {
plot->setTagName(curve->tag());
i_plot++;
if (i_plot < in.n_plots) {
plot = *plist.at(i_plot);
}
} // end (if they are separate plots)
}
} // next y col
}
} // end (if there are some xy plots)
if (!yEqList.isEmpty()) {
QString eqS;
double max, min;
int n;