A high level widget to handle curves. More...
#include <CurveBrowser.h>
Public Slots | |
void | average () |
void | clear () |
void | cut () |
void | legend () |
virtual void | load () |
void | remove () |
void | resample () |
void | save () |
void | setCurveName (QString n) |
virtual void | setLimits () |
void | showLog () |
void | smooth () |
Signals | |
void | curveModified () |
Public Member Functions | |
QAction * | addCurveAction (QString title, QString toolTip, bool editCurve) |
CurveProperties * | addLine (AbstractLine *line) |
int | count () const |
LineLayer * | currentLayer () const |
int | currentLine () const |
CurveBrowser (QWidget *parent=0) | |
QList< CurveProperties * > | curves () const |
void | dock (QWidget *w) |
void | initLayer (LineLayer *curveLayer) |
void | loadMultiColumns (QString fileName, bool lastFile, ColumnTextParser *&parser) |
CurveBrowserProxy * | proxy () |
void | setCurrentLayer (LineLayer *curveLayer) |
virtual void | setEditable (bool e) |
void | setProxy (CurveBrowserProxy *proxy) |
~CurveBrowser () | |
Protected Member Functions | |
void | closeEvent (QCloseEvent *e) |
virtual void | loadMultiColumns (const ColumnTextParser *parser, QString fileName) |
void | removeLine (int index) |
QList< CurveProperties * > | selectCurves () |
Static Protected Member Functions | |
static void | curveRange (const QList< CurveProperties * > &list, double &min, double &max) |
A high level widget to handle curves.
SciFigs::CurveBrowser::CurveBrowser | ( | QWidget * | parent = 0 | ) |
Description of constructor still missing
References addCurveAction(), average(), cut(), resample(), save(), showLog(), smooth(), QGpCoreTools::tr(), and TRACE.
: QWidget(parent) { TRACE; setupUi(this); _proxy=0; _currentLayer=0; _editable=true; _legendEditor=0; // Init the action menu QMenu * m=new QMenu(this); m->setTitle(tr("Edit")); m->setTearOffEnabled(true); editBut->setMenu(m); QAction * a; a=addCurveAction(tr("&Save"), tr("Save curve(s) in a text file"), false); connect(a, SIGNAL(triggered()), this, SLOT(save())); a=addCurveAction(tr("&Log"), tr("Show log of curve(s)"), false); connect(a, SIGNAL(triggered()), this, SLOT(showLog()) ); a=addCurveAction(tr("&Remove"), tr("Remove curve(s)"), true); connect(a, SIGNAL(triggered()), this, SLOT(remove())); a=addCurveAction(tr("Resa&mple" ), tr("Resample curve(s)"), true); connect(a, SIGNAL(triggered()), this, SLOT(resample())); a=addCurveAction(tr("&Cut"), tr("Cut curve(s)"), true); connect(a, SIGNAL(triggered()), this, SLOT(cut())); a=addCurveAction(tr("Sm&ooth"), tr("Smooth curve(s)"), true); connect(a, SIGNAL(triggered()), this, SLOT(smooth())); a=addCurveAction(tr("&Average"), tr("Average curve(s)"), false); connect(a, SIGNAL(triggered()), this, SLOT(average())); }
QAction * SciFigs::CurveBrowser::addCurveAction | ( | QString | title, |
QString | toolTip, | ||
bool | editCurve | ||
) |
Add a new action to curve menu 'Actions' with title and toolTip. editCurve must be true if the action can modify the curve. If false, this action is not affected by setEditable().
References TRACE.
Referenced by CurveBrowser().
{ TRACE; QAction * a; a=new QAction(title, this); a->setToolTip(toolTip); a->setData(editCurve); editBut->menu()->addAction(a); return a; }
References SciFigs::CurveBrowserProxy::clone(), curveModified(), SciFigs::CurveBrowserProxy::name(), SciFigs::CurveProperties::setCurrentLayer(), setCurveName(), SciFigs::CurveBrowserProxy::setLine(), SciFigs::CurveBrowserProxy::setName(), SciFigs::CurveProperties::setProxy(), and w.
Referenced by average(), loadMultiColumns(), and setCurrentLayer().
{ CurveProperties * w=new CurveProperties; w->setCurrentLayer(_currentLayer); connect(w, SIGNAL(curveModified()), this, SIGNAL(curveModified())); connect(w, SIGNAL(nameChanged(QString)), this, SLOT(setCurveName(QString))); CurveBrowserProxy * p=_proxy->clone(); p->setLine(line); w->setProxy(p); QString n=p->name(); if(n.isEmpty()) { n="# "+QString::number(curveTabs->count()+1); p->setName(n); } curveTabs->addTab(w, n); return w; }
void SciFigs::CurveBrowser::average | ( | ) | [slot] |
References addLine(), SciFigs::LineLayer::addLine(), SciFigs::CurveBrowserProxy::addLog(), SciFigs::CurveProperties::curveChanged(), SciFigs::CurveBrowserProxy::log(), MSG_ID, SciFigs::CurveBrowserProxy::name(), SciFigs::CurveProperties::proxy(), selectCurves(), QGpCoreTools::tr(), and TRACE.
Referenced by CurveBrowser().
{ TRACE; QList<CurveProperties *> list=selectCurves(); switch(list.count()) { case 0: return; case 1: Message::warning(MSG_ID, tr("Average"), tr("At least two curves are required to calculate an average curve.")); return; default: break; } // Create new averaged curve CurveProperties * pa=addLine(_currentLayer->addLine()); CurveBrowserProxy * pxa=pa->proxy(); pxa->addLog(tr("Average of curves:\n")); for(QList<CurveProperties *>::iterator it=list.begin(); it!=list.end(); it++) { CurveBrowserProxy * px=(*it)->proxy(); pxa->addLog(" "+px->name()+"\n"); pxa->addLog(px->log()); pxa->average(px); pxa->setName(tr("average")); } pa->curveChanged(); }
void SciFigs::CurveBrowser::clear | ( | ) | [slot] |
Reimplemented in QGpGuiWave::ModalCurveBrowser, and AutocorrTargetWidget.
References SciFigs::LineLayer::count(), curveModified(), removeLine(), and TRACE.
Referenced by TargetListWidget::setFrom().
{ TRACE; // Sanity operation, first remove link of model to current line //CurveBrowserItem * item=qobject_cast<CurveBrowserItem *>(curveTable->model()); //item->setCurrentLine( -1); if(_currentLayer) { for(int i=_currentLayer->count()-1; i>=0; i--) { removeLine(i); } } for(int i=curveTabs->count()-1; i>=0; i--) { CurveProperties * p=static_cast<CurveProperties *>(curveTabs->widget(i)); curveTabs->removeTab(i); delete p; } emit curveModified(); }
void SciFigs::CurveBrowser::closeEvent | ( | QCloseEvent * | e | ) | [protected] |
int SciFigs::CurveBrowser::count | ( | ) | const |
References SciFigs::LineLayer::count(), and TRACE.
Referenced by RefractionTargetWidget::addCurves(), MagnetoTelluricTargetWidget::addCurves(), QGpGuiWave::ModalCurveBrowser::addCurves(), currentLine(), RefractionTargetWidget::curves(), MagnetoTelluricTargetWidget::curves(), QGpGuiWave::ModalCurveBrowser::curves(), MagnetoTelluricTargetWidget::load(), EllipticityCurveTargetWidget::load(), DispersionTargetWidget::load(), load(), RefractionTargetWidget::on_curveScroll_valueChanged(), selectCurves(), SpacSelector::selectSamples(), setEditable(), and TargetListWidget::updateInfo().
LineLayer* SciFigs::CurveBrowser::currentLayer | ( | ) | const [inline] |
Referenced by RefractionTargetWidget::addCurve(), MagnetoTelluricTargetWidget::addCurve(), QGpGuiWave::ModalCurveBrowser::addCurve(), HistogramWidget::initGrid(), MagnetoTelluricTargetWidget::load(), AutocorrTargetWidget::load(), SpacSelector::selectSamples(), RefractionTargetWidget::setLimits(), and HistogramWidget::toStream().
{return _currentLayer;}
int SciFigs::CurveBrowser::currentLine | ( | ) | const |
Returns -1 if there is no line available.
References count(), and TRACE.
Referenced by RefractionTargetWidget::sourceChanged().
void SciFigs::CurveBrowser::curveModified | ( | ) | [signal] |
Referenced by QGpGuiWave::ModalCurveBrowser::addCurves(), addLine(), clear(), remove(), and setCurrentLayer().
void SciFigs::CurveBrowser::curveRange | ( | const QList< CurveProperties * > & | list, |
double & | min, | ||
double & | max | ||
) | [static, protected] |
References SciFigs::CurveBrowserProxy::maximumX(), SciFigs::CurveBrowserProxy::minimumX(), SciFigs::CurveBrowserProxy::setFunction(), and TRACE.
Referenced by cut(), resample(), and smooth().
{ TRACE; double v; for(QList<CurveProperties *>::const_iterator it=list.begin(); it!=list.end(); it++) { CurveBrowserProxy * p=(*it)->proxy(); p->setFunction(); v=p->minimumX(); if(v<min) { min=v; } v=p->maximumX(); if(v>max) { max=v; } } }
QList< CurveProperties * > SciFigs::CurveBrowser::curves | ( | ) | const |
Reimplemented in QGpGuiWave::ModalCurveBrowser, MagnetoTelluricTargetWidget, and RefractionTargetWidget.
References TRACE.
{ TRACE; QList<CurveProperties *> list; for(int i=curveTabs->count()-1; i>=0; i--) { list.append(static_cast<CurveProperties *>(curveTabs->widget(i))); } return list; }
void SciFigs::CurveBrowser::cut | ( | ) | [slot] |
References curveRange(), QGpCoreTools::Function, QGpCoreTools::InversedScale, selectCurves(), SciFigs::CurveBrowserCut::setAxisNames(), SciFigs::CurveBrowserCut::setCurveLimits(), TRACE, SciFigs::CurveBrowserProxy::xInversedName(), and SciFigs::CurveBrowserProxy::xName().
Referenced by CurveBrowser().
{ TRACE; QList<CurveProperties *> list=selectCurves(); if(list.isEmpty()) { return; } double min=INFINITY, max=-INFINITY; curveRange(list, min, max); CurveBrowserCut * d=new CurveBrowserCut(this); d->setCurveLimits(min, max); d->setAxisNames(_proxy->xName(), _proxy->xInversedName()); Settings::getWidget(d, "CurveBrowserCut" ); if(d->exec()==QDialog::Accepted) { Settings::setWidget(d, "CurveBrowserCut" ); double minimum=d->minimumEdit->text().toDouble(); double maximum=d->maximumEdit->text().toDouble(); SamplingOptions options=Function; if(d->inversedBut->isChecked()) { options|=InversedScale; } for(QList<CurveProperties *>::const_iterator it=list.begin(); it!=list.end(); it++) { (*it)->cut(minimum, maximum, options); } } delete d; }
void SciFigs::CurveBrowser::dock | ( | QWidget * | w | ) |
Docks widget w to the right side of the browser. Can be called only once.
References TRACE.
Referenced by AutocorrTargetWidget::AutocorrTargetWidget(), DispersionTargetWidget::DispersionTargetWidget(), EllipticityCurveTargetWidget::EllipticityCurveTargetWidget(), and MagnetoTelluricTargetWidget::MagnetoTelluricTargetWidget().
{ TRACE; w->setMinimumSize(QSize(100,100)); layout()->removeWidget(frame); frame->setParent(0); QSplitter * hSplitter=new QSplitter(this); hSplitter->setOrientation(Qt::Horizontal); hSplitter->addWidget(frame); QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred); sp.setHorizontalStretch(1); w->setSizePolicy(sp); hSplitter->addWidget(w); layout()->addWidget(hSplitter); }
void SciFigs::CurveBrowser::initLayer | ( | LineLayer * | curveLayer | ) |
Setup browser layer and axis.Don't forget to call setReferenceLine().
Reimplemented in QGpGuiWave::ModalCurveBrowser, and MagnetoTelluricTargetWidget.
References SciFigs::GraphContentLayer::addTrackingAction(), SciFigs::LineLayer::Edit, SciFigs::GraphContentLayer::graph(), SciFigs::LineLayer::Pick, SciFigs::LineLayer::PickOrdered, SciFigs::GraphContentLayer::setEditable(), SciFigs::Axis::setTitle(), SciFigs::Axis::setTitleInversedScale(), SciFigs::CurveBrowserProxy::setXAxisProperties(), SciFigs::CurveBrowserProxy::setYAxisProperties(), QGpCoreTools::tr(), TRACE, SciFigs::AxisWindow::updateExternalGeometry(), SciFigs::AxisWindow::xAxis(), SciFigs::CurveBrowserProxy::xInversedTitle(), SciFigs::CurveBrowserProxy::xTitle(), SciFigs::AxisWindow::yAxis(), SciFigs::CurveBrowserProxy::yInversedTitle(), and SciFigs::CurveBrowserProxy::yTitle().
Referenced by HistogramWidget::HistogramWidget(), and SpacSelector::SpacSelector().
{ TRACE; AxisWindow * graph=curveLayer->graph(); graph->xAxis()->setTitle(_proxy->xTitle()); graph->xAxis()->setTitleInversedScale(_proxy->xInversedTitle()); _proxy->setXAxisProperties(graph->xAxis()); graph->yAxis()->setTitle(_proxy->yTitle()); graph->yAxis()->setTitleInversedScale(_proxy->yInversedTitle()); _proxy->setYAxisProperties(graph->yAxis()); graph->updateExternalGeometry(); curveLayer->addTrackingAction( tr("&Pick"), LineLayer::Pick, tr("Add points to the current curve.")); curveLayer->addTrackingAction( tr("&Pick ordered"), LineLayer::PickOrdered, tr("Add points to the current curve, keeping x sample ordering.")); curveLayer->addTrackingAction( tr("&Edit"), LineLayer::Edit, tr("Edit points of the current curve.")); curveLayer->setEditable(false); connect(curveLayer, SIGNAL(pickLine(AbstractLine *)), this, SLOT(newPickedLine(AbstractLine *))); connect(curveLayer, SIGNAL(pointAdded(AbstractLine *,int)), this, SLOT(newPickedPoint(AbstractLine *,int))); }
void SciFigs::CurveBrowser::legend | ( | ) | [slot] |
References SciFigs::LegendTable::All, SciFigs::GraphContentLayer::deepUpdate(), SciFigs::LineLayer::legend(), SciFigs::LegendProperties::setLegend(), SciFigs::LineLayer::setLegend(), QGpGuiTools::Dialog::setMainWidget(), SciFigs::LegendProperties::setPropertySections(), SciFigs::LegendProperties::setReadOnlyText(), and TRACE.
{ TRACE; Legend legend=_currentLayer->legend(); Dialog * d=new Dialog(this); ASSERT(!_legendEditor); _legendEditor=new LegendProperties(this); _legendEditor->setPropertySections(LegendTable::All); d->setMainWidget(_legendEditor, Dialog::Close); _legendEditor->setLegend(legend); _legendEditor->setReadOnlyText(true); connect(_legendEditor, SIGNAL(touched()), this, SLOT(commitLegend())); Settings::getRect(d, "CurveBrowser::legend"); if(d->exec()==QDialog::Accepted) { Settings::setRect(d, "CurveBrowser::legend"); } else { _currentLayer->setLegend(legend); _currentLayer->deepUpdate(); } delete d; _legendEditor=0; }
void SciFigs::CurveBrowser::load | ( | ) | [virtual, slot] |
Can be overloaded to add support for custom file format import. Mandatory to call curvesChanged() at the end. And even better to adjust graph limits if the number of curves was initialty zero.
Reimplemented in DispersionTargetWidget, AutocorrTargetWidget, EllipticityCurveTargetWidget, and MagnetoTelluricTargetWidget.
References count(), loadMultiColumns(), setLimits(), QGpCoreTools::tr(), and TRACE.
{ TRACE; QStringList fileNames=Message::getOpenFileNames(tr("Load curve(s)"),tr("Mutli-column file(*)")); if( !fileNames.isEmpty()) { int curvesCount=count(); ColumnTextParser * parser=0; int n=fileNames.count(); for(int i=0;i<n;i++) { loadMultiColumns(fileNames.at(i), i==n-1, parser); } delete parser; if(_currentLayer) { if(curvesCount==0) setLimits(); } } }
void SciFigs::CurveBrowser::loadMultiColumns | ( | QString | fileName, |
bool | lastFile, | ||
ColumnTextParser *& | parser | ||
) |
References SciFigs::CurveBrowserProxy::columnFileTypes(), SciFigs::CurveBrowserProxy::defaultColumnFileTypes(), QGpCoreTools::endl(), fileName, QGpGuiTools::ColumnTextWidget::parse(), QGpGuiTools::ColumnTextWidget::parser(), QGpGuiTools::ColumnTextWidget::restoreParserSettings(), QGpGuiTools::ColumnTextWidget::saveParserSettings(), QGpGuiTools::ColumnTextWidget::setFile(), QGpGuiTools::Dialog::setMainWidget(), QGpGuiTools::ColumnTextWidget::setStandardTypes(), QGpCoreTools::ColumnTextParser::setText(), QGpGuiTools::ColumnTextWidget::setTypes(), QGpCoreTools::Thread::start(), QGpCoreTools::tr(), TRACE, and w.
Referenced by MagnetoTelluricTargetWidget::load(), EllipticityCurveTargetWidget::load(), DispersionTargetWidget::load(), and load().
{ TRACE; if(fileName.isEmpty()) return; if(parser) { QFile f(fileName); if(f.open(QIODevice::ReadOnly)) { parser->setText(new QTextStream(&f)); parser->start(); parser->wait(); loadMultiColumns(parser, fileName); } else { App::stream() << tr("Cannot read file %1").arg(fileName) << endl; } } else { Dialog * d=new Dialog; ColumnTextWidget * dg=new ColumnTextWidget; dg->setStandardTypes(_proxy->columnFileTypes()); dg->setTypes(_proxy->defaultColumnFileTypes()); dg->setFile(fileName); dg->restoreParserSettings("CurveBrowserLoad"); QWidget * w; QCheckBox * sameParserForAll; if(lastFile) { w=dg; sameParserForAll=0; } else { w=new QWidget; QVBoxLayout * layout=new QVBoxLayout(w); layout->setMargin(0); layout->addWidget(dg); sameParserForAll=new QCheckBox(w); sameParserForAll->setText(tr("Use the same parser for next files")); layout->addWidget(sameParserForAll); } d->setMainWidget(w); d->setWindowTitle(tr("Load curves")); Settings::getRect(d, "CurveBrowserLoad"); dg->parse(false); if(d->exec()==QDialog::Accepted) { Settings::setRect(d, "CurveBrowserLoad"); dg->saveParserSettings("CurveBrowserLoad"); loadMultiColumns(dg->parser(), fileName); if(sameParserForAll && sameParserForAll->isChecked()) { parser=new ColumnTextParser(*dg->parser()); } } delete dg; delete d; } }
void SciFigs::CurveBrowser::loadMultiColumns | ( | const ColumnTextParser * | parser, |
QString | fileName | ||
) | [protected, virtual] |
References addLine(), SciFigs::LineLayer::addLine(), QGpCoreTools::ColumnTextIterator::atEnd(), SciFigs::LineLayer::count(), SciFigs::CurveProperties::curveChanged(), SciFigs::CurveBrowserProxy::parse(), SciFigs::CurveProperties::proxy(), removeLine(), QGpCoreTools::tr(), and TRACE.
{ TRACE; ColumnTextIterator it(parser); int nCurves=0; while(!it.atEnd()) { CurveProperties * p=addLine(_currentLayer->addLine()); CurveBrowserProxy * px=p->proxy(); px->parse(it); if(px->sampleCount()==0) { removeLine(_currentLayer->count()-1); } else { px->addLog(tr("%1 samples loaded from file %2\n").arg(px->sampleCount()).arg(fileName)); QFileInfo fi(fileName); nCurves++; if(nCurves>1) { px->setName((fi.fileName()+" #%1").arg(nCurves)); } else { px->setName(fi.fileName()); } } p->curveChanged(); curveTabs->setCurrentWidget(p); } }
CurveBrowserProxy* SciFigs::CurveBrowser::proxy | ( | ) | [inline] |
Referenced by setProxy(), and QGpGuiWave::ModalCurveBrowser::~ModalCurveBrowser().
{return _proxy;}
void SciFigs::CurveBrowser::remove | ( | ) | [slot] |
References curveModified(), SciFigs::LineLayer::removeLine(), selectCurves(), and TRACE.
{ TRACE; QList<CurveProperties *> list=selectCurves(); if(list.isEmpty()) { return; } for(QList<CurveProperties *>::const_iterator it=list.begin(); it!=list.end(); it++) { CurveProperties * p=*it; int index=curveTabs->indexOf(p); curveTabs->removeTab(index); _currentLayer->removeLine(index); delete p; } emit curveModified(); }
void SciFigs::CurveBrowser::removeLine | ( | int | index | ) | [protected] |
References SciFigs::LineLayer::removeLine(), and w.
Referenced by clear(), loadMultiColumns(), and setCurrentLayer().
{ CurveProperties * w=static_cast<CurveProperties *>(curveTabs->widget(index)); curveTabs->removeTab(index); _currentLayer->removeLine(index); delete w; }
void SciFigs::CurveBrowser::resample | ( | ) | [slot] |
References curveRange(), QGpCoreTools::Function, QGpCoreTools::InversedScale, QGpCoreTools::LogScale, selectCurves(), SciFigs::CurveBrowserResample::setAxisNames(), SciFigs::CurveBrowserResample::setCurveLimits(), TRACE, SciFigs::CurveBrowserProxy::xInversedName(), and SciFigs::CurveBrowserProxy::xName().
Referenced by CurveBrowser().
{ TRACE; QList<CurveProperties *> list=selectCurves(); if(list.isEmpty()) { return; } double min=INFINITY, max=-INFINITY; curveRange(list, min, max); CurveBrowserResample * d=new CurveBrowserResample(this); d->setCurveLimits(min, max); d->setAxisNames(_proxy->xName(), _proxy->xInversedName()); Settings::getWidget(d, "CurveBrowserResample"); if(d->exec()==QDialog::Accepted) { Settings::setWidget(d, "CurveBrowserResample"); int n=d->sampleCount->value(); double minimum=d->minimumEdit->text().toDouble(); double maximum=d->maximumEdit->text().toDouble(); SamplingOptions options=Function; if(d->logBut->isChecked()) { options|=LogScale; } else if(d->inversedBut->isChecked()) { options|=InversedScale; } for(QList<CurveProperties *>::const_iterator it=list.begin(); it!=list.end(); it++) { (*it)->resample(n, minimum, maximum, options, d->dsBut->isChecked()); } } delete d; }
void SciFigs::CurveBrowser::save | ( | ) | [slot] |
References TRACE.
Referenced by CurveBrowser().
QList< CurveProperties * > SciFigs::CurveBrowser::selectCurves | ( | ) | [protected] |
References SciFigs::CurveSelector::addCurve(), count(), SciFigs::CurveProperties::proxy(), SciFigs::CurveBrowserProxy::sampleCount(), SciFigs::CurveSelector::selectAll(), SciFigs::CurveSelector::selectedCurves(), and TRACE.
Referenced by average(), cut(), remove(), resample(), and smooth().
{ TRACE; QList<CurveProperties *> list; CurveProperties * p; int n=count(); switch(n) { case 0: return list; case 1: p=static_cast<CurveProperties *>(curveTabs->widget(0)); if(p->proxy()->sampleCount()>0) { list.append(p); } return list; default: break; } CurveSelector * d=new CurveSelector(this); for(int i=0; i<n; i++) { d->addCurve(static_cast<CurveProperties *>(curveTabs->widget(i))); } d->selectAll(); Settings::getWidget(d); if(d->exec()==QDialog::Accepted) { Settings::setWidget(d); list=d->selectedCurves(); } delete d; return list; }
void SciFigs::CurveBrowser::setCurrentLayer | ( | LineLayer * | layer | ) |
Set current graph.
References addLine(), SciFigs::LineLayer::count(), curveModified(), SciFigs::LineLayer::line(), removeLine(), and TRACE.
Referenced by AutocorrTargetWidget::clear(), DispersionTargetWidget::DispersionTargetWidget(), EllipticityCurveTargetWidget::EllipticityCurveTargetWidget(), HistogramWidget::HistogramWidget(), MagnetoTelluricTargetWidget::initLayer(), and SpacSelector::SpacSelector().
{ TRACE; if(layer==_currentLayer) { return; } if(_currentLayer) { disconnect(this, SIGNAL(curveModified()), _currentLayer, SLOT(deepUpdate())); for(int i=_currentLayer->count()-1; i>=0; i--) { removeLine(i); } } _currentLayer=layer; if(_currentLayer) { connect(this, SIGNAL(curveModified()), _currentLayer, SLOT(deepUpdate())); for(int i=0; i<_currentLayer->count(); i++) { addLine(_currentLayer->line(i)); } for(int i=curveTabs->count()-1; i>=0; i--) { static_cast<CurveProperties *>(curveTabs->widget(i))->setCurrentLayer(_currentLayer); } } emit curveModified(); }
void SciFigs::CurveBrowser::setCurveName | ( | QString | n | ) | [slot] |
void SciFigs::CurveBrowser::setEditable | ( | bool | e | ) | [virtual] |
Set the browser as editable or not.
Reimplemented in QGpGuiWave::ModalCurveBrowser, and AutocorrTargetWidget.
References count(), and SciFigs::CurveProperties::setEditable().
Referenced by TargetListWidget::setEditable().
{ _editable=e; loadBut->setEnabled(e); clearBut->setEnabled(e && count()>0); editBut->setEnabled(count()>0); QList<QAction *> aList=editBut->menu()->actions(); for(QList<QAction *>::iterator it=aList.begin();it!=aList.end();it++) { QAction& a=**it; if(a.data().toBool()) a.setEnabled(e); } for(int i=curveTabs->count()-1; i>=0; i--) { CurveProperties * p=static_cast<CurveProperties *>(curveTabs->widget(i)); p->setEditable(e); } }
void SciFigs::CurveBrowser::setLimits | ( | ) | [virtual, slot] |
Reimplemented in AutocorrTargetWidget, and RefractionTargetWidget.
References SciFigs::GraphContent::boundingRect(), SciFigs::GraphContentLayer::graph(), SciFigs::AxisWindow::graphContent(), SciFigs::Axis::setRange(), TRACE, w, QGpCoreTools::Rect::x1(), QGpCoreTools::Rect::x2(), SciFigs::AxisWindow::xAxis(), QGpCoreTools::Rect::y1(), QGpCoreTools::Rect::y2(), and SciFigs::AxisWindow::yAxis().
Referenced by MagnetoTelluricTargetWidget::addCurves(), QGpGuiWave::ModalCurveBrowser::addCurves(), MagnetoTelluricTargetWidget::load(), EllipticityCurveTargetWidget::load(), DispersionTargetWidget::load(), and load().
void SciFigs::CurveBrowser::setProxy | ( | CurveBrowserProxy * | proxy | ) |
References proxy(), and TRACE.
Referenced by HistogramWidget::HistogramWidget(), MagnetoTelluricTargetWidget::MagnetoTelluricTargetWidget(), and SpacSelector::SpacSelector().
void SciFigs::CurveBrowser::showLog | ( | ) | [slot] |
References TRACE.
Referenced by CurveBrowser().
void SciFigs::CurveBrowser::smooth | ( | ) | [slot] |
References curveRange(), QGpCoreTools::Function, QGpCoreTools::InversedScale, QGpCoreTools::LogScale, selectCurves(), SciFigs::CurveBrowserSmooth::setAxisNames(), SciFigs::CurveBrowserSmooth::setCurveLimits(), TRACE, SciFigs::CurveBrowserProxy::xInversedName(), and SciFigs::CurveBrowserProxy::xName().
Referenced by CurveBrowser().
{ TRACE; QList<CurveProperties *> list=selectCurves(); if(list.isEmpty()) { return; } double min=INFINITY, max=-INFINITY; curveRange(list, min, max); CurveBrowserSmooth * d=new CurveBrowserSmooth(this); d->setCurveLimits(min, max); d->setAxisNames(_proxy->xName(), _proxy->xInversedName()); Settings::getWidget(d, "CurveBrowserSmooth"); if(d->exec()==QDialog::Accepted) { Settings::setWidget(d, "CurveBrowserSmooth"); double minimum=d->minimumEdit->text().toDouble(); double maximum=d->maximumEdit->text().toDouble(); SamplingOptions options=Function; if(d->logBut->isChecked()) { options |= LogScale; } else if(d->inversedBut->isChecked()) { options |= InversedScale; } for(QList<CurveProperties *>::const_iterator it=list.begin(); it!=list.end(); it++) { (*it)->smooth(minimum, maximum, options); } } delete d; }