本文整理汇总了C++中Kst2DPlotList类的典型用法代码示例。如果您正苦于以下问题:C++ Kst2DPlotList类的具体用法?C++ Kst2DPlotList怎么用?C++ Kst2DPlotList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kst2DPlotList类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
bool KstIfaceImpl::setPlotAxes(const QString& plotName,
int XLower,
int XUpper,
int YLower,
int YUpper) {
//find the plot
KstApp *app = KstApp::inst();
KMdiIterator<KMdiChildView*> *iter = app->createIterator();
while (iter->currentItem()) {
KMdiChildView *childview = iter->currentItem();
KstViewWindow *viewwindow = dynamic_cast<KstViewWindow*>(childview);
if (viewwindow) {
Kst2DPlotList plotlist = viewwindow->view()->findChildrenType<Kst2DPlot>(false);
Kst2DPlotList::Iterator plot_iter=plotlist.findTag(plotName);
if (plot_iter != plotlist.end()) {
app->deleteIterator(iter);
(*plot_iter)->setXScaleMode(FIXED);
(*plot_iter)->setYScaleMode(FIXED);
(*plot_iter)->setScale(XLower, YLower,
XUpper, YUpper); //set the scale
// repaint the plot
(*plot_iter)->setDirty();
viewwindow->view()->paint(KstPainter::P_PLOT);
return true;
}
}
iter->next();
}
app->deleteIterator(iter);
return false;
}
示例2: cycleWindow
void KstCurveDifferentiateI::cycleWindow(KstViewWindow *window) {
KstTopLevelViewPtr tlv = kst_cast<KstTopLevelView>(window->view());
if (tlv) {
Kst2DPlotList plotList = tlv->findChildrenType<Kst2DPlot>(false);
for (Kst2DPlotList::Iterator it = plotList.begin(); it != plotList.end(); ++it ) {
if (_repeatAcross == 0) {
_seqVect[0]->reset();
}
KstVCurveList vcurves = kstObjectSubList<KstBaseCurve,KstVCurve>((*it)->Curves);
for (KstVCurveList::Iterator i = vcurves.begin(); i != vcurves.end(); ++i) {
if (_lineColorOrder > -1) {
(*i)->setColor(KstColorSequence::entry(_lineColorSeq.current()));
}
if (_pointStyleOrder > -1) {
(*i)->Point.setType(_pointStyleSeq.current());
(*i)->setHasPoints(true);
(*i)->setPointDensity(_pointDensity);
}
if (_lineStyleOrder > -1) {
(*i)->setLineStyle(_lineStyleSeq.current());
}
if (_lineWidthOrder > -1) {
(*i)->setLineWidth(_lineWidthSeq.current());
}
(_seqVect[0])->next();
}
}
}
}
示例3: tiedZoomMode
bool KstTopLevelView::tiedZoomMode(int zoom, bool flag, double center, int mode, int modeExtra, const QString& plotName) {
Kst2DPlotList pl = findChildrenType<Kst2DPlot>(true);
bool repaint = false;
for (Kst2DPlotList::Iterator i = pl.begin(); i != pl.end(); ++i) {
Kst2DPlotPtr p = *i;
if (p->isTied() && p->tagName() != plotName) {
p->tiedZoomMode((ZoomType)zoom, flag, center, (KstScaleModeType)mode, (KstScaleModeType)modeExtra);
repaint = true;
}
}
return repaint;
}
示例4: tiedZoom
bool KstTopLevelView::tiedZoom(bool x, double xmin, double xmax, bool y, double ymin, double ymax, const QString& plotName) {
Kst2DPlotList pl = findChildrenType<Kst2DPlot>(true);
bool repaint = false;
for (Kst2DPlotList::Iterator i = pl.begin(); i != pl.end(); ++i) {
Kst2DPlotPtr p = *i;
if (p->isTied() && p->tagName() != plotName) {
p->tiedZoom(x, xmin, xmax, y, ymin, ymax);
repaint = true;
}
}
return repaint;
}
示例5: tiedZoomPrev
bool KstTopLevelView::tiedZoomPrev(const QString& plotName) {
Kst2DPlotList pl = findChildrenType<Kst2DPlot>(true);
bool repaint = false;
for (Kst2DPlotList::Iterator i = pl.begin(); i != pl.end(); ++i) {
Kst2DPlotPtr p = *i;
if (p->isTied() && p->tagName() != plotName) {
if (p->tiedZoomPrev(widget())) {
repaint = true;
}
}
}
return repaint;
}
示例6: plotList
QStringList KstIfaceImpl::plotList(const QString& window) {
QStringList rc;
KstApp *app = KstApp::inst();
KMdiChildView *c = app->findWindow(window);
KstViewWindow *v = dynamic_cast<KstViewWindow*>(c);
if (v) {
Kst2DPlotList l = v->view()->findChildrenType<Kst2DPlot>(false);
for (Kst2DPlotList::Iterator i = l.begin(); i != l.end(); ++i) {
rc += (*i)->tagName();
}
}
return rc;
}
示例7: removeCurveFromPlot
bool KstIfaceImpl::removeCurveFromPlot(KMdiChildView *win, const QString& plot, const QString& curve) {
KstViewWindow *w = dynamic_cast<KstViewWindow*>(win);
if (w) {
KstTopLevelViewPtr view = kst_cast<KstTopLevelView>(w->view());
if (view) {
Kst2DPlotList plots = view->findChildrenType<Kst2DPlot>(true);
if (plots.findTag(plot) != plots.end()) {
Kst2DPlotPtr p = *(plots.findTag(plot));
KstBaseCurveList bcl = kstObjectSubList<KstDataObject,KstBaseCurve>(KST::dataObjectList);
KstBaseCurveList::Iterator ci = bcl.findTag(curve);
if (p && ci != bcl.end()) {
p->removeCurve(*ci);
_doc->forceUpdate();
return true;
}
}
}
}
return false;
}
示例8: tr
//.........这里部分代码省略.........
oldSources << newVector->dataSource();
}
newVector->changeFile(file);
KST::vectorList.lock().unlock();
// duplicate dependents
if (_duplicateDependents->isChecked()) {
duplicatedVectors.insert(KstVectorPtr(vector), KstVectorPtr(newVector));
KST::duplicateDependents(KstVectorPtr(vector), duplicatedMap, duplicatedVectors);
}
} else {
if (!oldSources.contains(vector->dataSource())) {
oldSources << vector->dataSource();
}
vector->changeFile(file);
}
}
vector->unlock();
app->slotUpdateProgress(selected, ++handled, tr("Updating vectors..."));
}
}
// go through the matrices
for (int i = (int)rvl.count(); i < (int)ChangeFileCurveList->count(); i++) {
if (ChangeFileCurveList->isSelected(i)) {
KstRMatrixPtr matrix = rml[i-rvl.count()];
matrix->writeLock();
file->readLock();
bool valid = file->isValidMatrix(matrix->field());
file->unlock();
if (!valid) {
if (invalid > 0) {
invalidSources = tr("%1, %2").arg(invalidSources).arg(matrix->field());
} else {
invalidSources = matrix->field();
}
++invalid;
} else {
if (_duplicateSelected->isChecked()) {
// block matrix updates until matrix is setup properly
KST::matrixList.lock().writeLock();
// create a new matrix
KstRMatrixPtr newMatrix = matrix->makeDuplicate();
if (!oldSources.contains(newMatrix->dataSource())) {
oldSources << newMatrix->dataSource();
}
newMatrix->changeFile(file);
KST::matrixList.lock().unlock();
// duplicate dependents
if (_duplicateDependents->isChecked()) {
duplicatedMatrices.insert(KstMatrixPtr(matrix), KstMatrixPtr(newMatrix));
KST::duplicateDependents(KstMatrixPtr(matrix), duplicatedMap, duplicatedMatrices);
}
} else {
if (!oldSources.contains(matrix->dataSource())) {
oldSources << matrix->dataSource();
}
matrix->changeFile(file);
}
}
matrix->unlock();
app->slotUpdateProgress(selected, ++handled, tr("Updating matrices..."));
}
}
app->slotUpdateProgress(0, 0, QString::null);
file = 0L;
// now add any curves and images to plots if they were duplicated
if (_duplicateSelected->isChecked() && _duplicateDependents->isChecked()) {
KstApp *app = KstApp::inst();
QList<QMdiSubWindow*> windows;
QList<QMdiSubWindow*>::const_iterator i;
windows = app->subWindowList( CreationOrder );
for (i = windows.constBegin(); i != windows.constEnd(); ++i)
KstViewWindow *viewWindow = dynamic_cast<KstViewWindow*>(*i);
if (viewWindow) {
KstTopLevelViewPtr view = kst_cast<KstTopLevelView>(viewWindow->view());
if (view) {
Kst2DPlotList plots = view->findChildrenType<Kst2DPlot>(true);
for (Kst2DPlotList::Iterator plotIter = plots.begin(); plotIter != plots.end(); ++plotIter) {
for (KstDataObjectDataObjectMap::ConstIterator iter = duplicatedMap.begin(); iter != duplicatedMap.end(); ++iter) {
if (KstBaseCurvePtr curve = kst_cast<KstBaseCurve>(iter.data())) {
if ((*plotIter)->Curves.contains(kst_cast<KstBaseCurve>(iter.key())) && !(*plotIter)->Curves.contains(kst_cast<KstBaseCurve>(curve))) {
(*plotIter)->addCurve(curve);
}
}
}
}
}
}
}
}
示例9: i18n
//.........这里部分代码省略.........
KstRMatrixPtr matrix = rml[i-rvl.count()];
matrix->writeLock();
file->readLock();
bool valid = file->isValidMatrix(matrix->field());
file->unlock();
if (!valid) {
if (invalid > 0) {
// FIXME: invalid list construction for i18n
invalidSources = i18n("%1, %2").arg(invalidSources).arg(matrix->field());
} else {
invalidSources = matrix->field();
}
++invalid;
} else {
if (_duplicateSelected->isChecked()) {
// block matrix updates until matrix is setup properly
KST::matrixList.lock().writeLock();
// create a new matrix
KstRMatrixPtr newMatrix = matrix->makeDuplicate();
if (!oldSources.contains(newMatrix->dataSource())) {
oldSources << newMatrix->dataSource();
}
newMatrix->changeFile(file);
KST::matrixList.lock().unlock();
// duplicate dependents
if (_duplicateDependents->isChecked()) {
duplicatedMatrices.insert(KstMatrixPtr(matrix), KstMatrixPtr(newMatrix));
KST::duplicateDependents(KstMatrixPtr(matrix), duplicatedMap, duplicatedMatrices);
}
} else {
if (!oldSources.contains(matrix->dataSource())) {
oldSources << matrix->dataSource();
}
matrix->changeFile(file);
}
}
matrix->unlock();
app->slotUpdateProgress(selected, ++handled, i18n("Updating matrices..."));
}
}
app->slotUpdateProgress(0, 0, QString::null);
file = 0L;
// now add any curves and images to plots if they were duplicated
if (_duplicateSelected->isChecked() && _duplicateDependents->isChecked()) {
KstApp *app = KstApp::inst();
KMdiIterator<KMdiChildView*> *it = app->createIterator();
while (it->currentItem()) {
KstViewWindow *w = dynamic_cast<KstViewWindow*>(it->currentItem());
if (w) {
KstTopLevelViewPtr view = kst_cast<KstTopLevelView>(w->view());
if (view) {
Kst2DPlotList plots = view->findChildrenType<Kst2DPlot>(true);
for (Kst2DPlotList::Iterator plotIter = plots.begin(); plotIter != plots.end(); ++plotIter) {
for (KstDataObjectDataObjectMap::ConstIterator iter = duplicatedMap.begin(); iter != duplicatedMap.end(); ++iter) {
if (KstBaseCurvePtr curve = kst_cast<KstBaseCurve>(iter.data())) {
if ((*plotIter)->Curves.contains(kst_cast<KstBaseCurve>(iter.key())) && !(*plotIter)->Curves.contains(kst_cast<KstBaseCurve>(curve))) {
(*plotIter)->addCurve(curve);
}
}
}
}
}
}
it->next();
}
app->deleteIterator(it);
}
// clean up unused data sources
// kstdDebug() << "cleaning up data sources" << endl;
KST::dataSourceList.lock().writeLock();
for (KstDataSourceList::Iterator it = oldSources.begin(); it != oldSources.end(); ++it) {
// kstdDebug() << "DATA SOURCE: " << (*it)->tag().displayString() << " (" << (void*)(*it) << ") USAGE: " << (*it)->getUsage() << endl;
if ((*it)->getUsage() == 1) {
// kstdDebug() << " -> REMOVED" << endl;
KST::dataSourceList.remove((*it).data());
}
}
KST::dataSourceList.lock().unlock();
if (!invalidSources.isEmpty()) {
if (invalid == 1) {
KMessageBox::sorry(this, i18n("The following field is not defined for the requested file:\n%1").arg(invalidSources));
} else {
KMessageBox::sorry(this, i18n("The following fields are not defined for the requested file:\n%1").arg(invalidSources));
}
}
emit docChanged();
// force an update in case we're in paused mode
KstApp::inst()->forceUpdate();
return true;
}
示例10: KstBindCollection
KstBindPlotCollection::KstBindPlotCollection(KJS::ExecState *exec, Kst2DPlotList plots)
: KstBindCollection(exec, "PlotCollection") {
_isWindow = false;
_plots = plots.tagNames();
}
示例11: removeCurveFromPlots
void KST::removeCurveFromPlots(KstBaseCurve *c) {
Kst2DPlotList pl = Kst2DPlot::globalPlotList();
for (Kst2DPlotList::Iterator i = pl.begin(); i != pl.end(); ++i) {
(*i)->removeCurve(c);
}
}
示例12: main
//.........这里部分代码省略.........
matrixList = args->getOptionList("z");
yEqList = args->getOptionList("ye");
psdList = args->getOptionList("p");
hsList = args->getOptionList("h");
errorList = args->getOptionList("e");
// y axis or PSD specified, so the files are data files, not kst files.
n_y = ycolList.count() + psdList.count() + hsList.count() + yEqList.count() + matrixList.count();
if (n_y > 0) {
QString creatingEquations = i18n("Creating equations");
QString creatingCurves = i18n("Creating curves");
QString creatingPlots = i18n("Creating plots");
int count;
int handled;
kst->slotUpdateProgress( 0, 0, QString::null );
SetCMDOptions(args, in, n_y);
KstTopLevelViewPtr tlv = kst->activeView();
if (!tlv) {
// if there was no active view then we create one...
kst->newWindow(false);
tlv = kst->activeView();
}
if (!tlv) {
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());