#include <LiveGridLayer.h>
Signals | |
void | paletteAdjusted (const ColorPalette &pal) const |
Public Member Functions | |
virtual void | addProperties (PropertyProxy *pp) |
bool | autoAdjustPalette () const |
virtual Rect | boundingRect () const |
bool | forceMaximumValue () const |
bool | forceMinimumValue () const |
const AbstractFunction2 * | function () const |
virtual bool | hasProperties () |
LiveGridLayer (AxisWindow *parent) | |
double | maximumValue () const |
double | minimumValue () const |
virtual void | properties (PropertyWidget *w) const |
virtual void | removeProperties (PropertyProxy *pp) |
int | sampling () const |
SamplingParameters::Type | scale () const |
void | setAutoAdjustPalette (bool a) |
void | setForceMaximumValue (bool f) |
void | setForceMinimumValue (bool f) |
void | setFunction (AbstractFunction2 *f) |
void | setMaximumValue (double m) |
void | setMinimumValue (double m) |
virtual void | setProperty (uint wid, int pid, QVariant val) |
void | setSampling (int s) |
void | setScale (SamplingParameters::Type s) |
void | setSmallestDetail (double d) |
int | smallestDetail () const |
AbstractFunction2 * | takeFunction () |
virtual const QString & | xml_tagName () const |
~LiveGridLayer () | |
Protected Member Functions | |
virtual void | paintData (const LayerPainterRequest &lp, QPainter &p, double dotpercm) const |
virtual void | xml_writeChildren (XML_WRITECHILDREN_ARGS) const |
Protected Attributes | |
AbstractFunction2 * | _function |
int | _sampling |
double | _smallestDetail |
SciFigs::LiveGridLayer::LiveGridLayer | ( | AxisWindow * | parent | ) |
References _function, _sampling, _smallestDetail, paletteAdjusted(), and TRACE.
: GridPlot(parent) { TRACE; _function=0; _sampling=1; _autoAdjustPalette=true; _forceMinimumValue=true; _forceMaximumValue=false; _scale=SamplingParameters::Linear; _minimumValue=0.0; _maximumValue=0.0; _smallestDetail=1e99; _tab=0; connect(this, SIGNAL(paletteAdjusted(const ColorPalette&)), this, SLOT(showAdjustedPalette(const ColorPalette&)), Qt::QueuedConnection); }
void SciFigs::LiveGridLayer::addProperties | ( | PropertyProxy * | pp | ) | [virtual] |
Setup property editor
Reimplemented from SciFigs::GridPlot.
References QGpGuiTools::PropertyProxy::addReference(), QGpGuiTools::PropertyProxy::addTab(), QGpGuiTools::PropertyProxy::setCurrentTab(), QGpCoreTools::tr(), TRACE, and w.
{ TRACE; GridPlot::addProperties(pp); if(pp->setCurrentTab(_tab)) { pp->addReference(this); } else { LiveGridLayerProperties * w=new LiveGridLayerProperties; pp->addTab(_tab, tr("Palette update"), w, this); } }
bool SciFigs::LiveGridLayer::autoAdjustPalette | ( | ) | const [inline] |
Referenced by properties().
{return _autoAdjustPalette;}
Rect SciFigs::LiveGridLayer::boundingRect | ( | ) | const [virtual] |
bool SciFigs::LiveGridLayer::forceMaximumValue | ( | ) | const [inline] |
Referenced by properties().
{return _forceMaximumValue;}
bool SciFigs::LiveGridLayer::forceMinimumValue | ( | ) | const [inline] |
Referenced by properties().
{return _forceMinimumValue;}
const AbstractFunction2* SciFigs::LiveGridLayer::function | ( | ) | const [inline] |
{return _function;}
virtual bool SciFigs::LiveGridLayer::hasProperties | ( | ) | [inline, virtual] |
Reimplemented from SciFigs::GridPlot.
{return true;}
double SciFigs::LiveGridLayer::maximumValue | ( | ) | const [inline] |
Referenced by properties().
{return _maximumValue;}
double SciFigs::LiveGridLayer::minimumValue | ( | ) | const [inline] |
Referenced by properties().
{return _minimumValue;}
void SciFigs::LiveGridLayer::paintData | ( | const LayerPainterRequest & | lp, |
QPainter & | p, | ||
double | dotpercm | ||
) | const [protected, virtual] |
Implements SciFigs::GraphContentLayer.
References _function, SciFigs::GridPlot::drawGrid2DBlock(), SciFigs::GridPlot::drawGrid2DSmooth(), SciFigs::LayerPainterRequest::options(), SciFigs::GridPlot::palette(), paletteAdjusted(), SciFigs::IrregularGrid2DDraw::setCellLimits(), SciFigs::IrregularGrid2DDraw::setCellNodes(), SciFigs::IrregularGrid2DDraw::setVisibleArea(), SciFigs::LayerPainterRequest::size(), SciFigs::GridPlot::smooth(), and TRACE.
{ TRACE; if(!_function) return; IrregularGrid2D grid=calculateGrid(lp.size(), lp.options(), &lp); // Make a copy of current palette (mandatory for multi-thread, palette are implicitly shared // objects so deep copy probably is not occuring right now, only upon user request for modification) ColorPalette pal=palette(); if(_autoAdjustPalette) { adjustPalette(grid, pal); emit paletteAdjusted(pal); } const GraphContentOptions& gc=lp.options(); IrregularGrid2DDraw d; // Get the limit of visible area in terms of grid indexes d.setVisibleArea(grid, gc); // Create two int vectors containing the x and y of nodes (centers of blocks) d.setCellNodes(grid, gc); if(smooth()) { drawGrid2DSmooth(grid, pal, lp, p, d); } else { d.setCellLimits(); drawGrid2DBlock(grid, pal, lp, p, d); } /*GraphContent * gc=graphContent(); QImage im(w, h, QImage::Format_ARGB32); uint * imPtr=(uint * ) im.bits() + w + 1; double y; int h1=h-1; int w1=w-1; int iy; for(iy=1;iy<h1; iy+=3) { y=gc->ys2r(iy); fillRow(gc, imPtr, y, w, w1); imPtr+=2*w; } // Add last pixel rows switch(iy-h1) { case 0: // two rows are missing y=gc->xs2r(iy); fillRowSup2(gc, imPtr, y, w, w1); break; case 1: // one row is missing y=gc->xs2r(iy); fillRowSup1(gc, imPtr, y, w, w1); break; default: // h is a multiple of 3 break; } p.drawImage(0, 0, im);*/ }
void SciFigs::LiveGridLayer::paletteAdjusted | ( | const ColorPalette & | pal | ) | const [signal] |
Referenced by LiveGridLayer(), and paintData().
void SciFigs::LiveGridLayer::properties | ( | PropertyWidget * | w | ) | const [virtual] |
Reimplemented from SciFigs::GridPlot.
References SciFigs::LiveGridLayerProperties::AutoAdjustPalette, autoAdjustPalette(), forceMaximumValue(), SciFigs::LiveGridLayerProperties::ForceMaxValue, forceMinimumValue(), SciFigs::LiveGridLayerProperties::ForceMinValue, QGpGuiTools::PropertyWidget::id(), SciFigs::LiveGridLayerProperties::LinearScale, SciFigs::LiveGridLayerProperties::LogScale, maximumValue(), SciFigs::LiveGridLayerProperties::MaxValue, minimumValue(), SciFigs::LiveGridLayerProperties::MinValue, scale(), QGpGuiTools::PropertyWidget::setValue(), and TRACE.
{ TRACE; if(w->id()==_tab) { w->setValue(LiveGridLayerProperties::AutoAdjustPalette, autoAdjustPalette()); w->setValue(LiveGridLayerProperties::LinearScale, scale()==SamplingParameters::Linear); w->setValue(LiveGridLayerProperties::LogScale, scale()==SamplingParameters::Log); w->setValue(LiveGridLayerProperties::ForceMinValue, forceMinimumValue()); w->setValue(LiveGridLayerProperties::ForceMaxValue, forceMaximumValue()); w->setValue(LiveGridLayerProperties::MinValue, minimumValue()); w->setValue(LiveGridLayerProperties::MaxValue, maximumValue()); } else { GridPlot::properties(w); } }
void SciFigs::LiveGridLayer::removeProperties | ( | PropertyProxy * | pp | ) | [virtual] |
Clean property editor
Reimplemented from SciFigs::GridPlot.
References QGpGuiTools::PropertyProxy::removeTab(), and TRACE.
int SciFigs::LiveGridLayer::sampling | ( | ) | const [inline] |
{return _sampling;}
SamplingParameters::Type SciFigs::LiveGridLayer::scale | ( | ) | const [inline] |
Referenced by properties().
{return _scale;}
void SciFigs::LiveGridLayer::setAutoAdjustPalette | ( | bool | a | ) | [inline] |
Referenced by ArrayGui::ArrayResponse::createObjects(), and setProperty().
{_autoAdjustPalette=a;}
void SciFigs::LiveGridLayer::setForceMaximumValue | ( | bool | f | ) | [inline] |
Referenced by DispersionGridThread::initResultsGraphs(), and setProperty().
{_forceMaximumValue=f;}
void SciFigs::LiveGridLayer::setForceMinimumValue | ( | bool | f | ) | [inline] |
Referenced by DispersionGridThread::initResultsGraphs(), and setProperty().
{_forceMinimumValue=f;}
void SciFigs::LiveGridLayer::setFunction | ( | AbstractFunction2 * | f | ) |
References _function, and TRACE.
Referenced by Simulator::init(), ArrayGui::ArrayResponse::setArray(), HRFKTimeWindows::setComponent(), FKTimeWindows::setComponent(), FKTimeWindows::setCurrentWindow(), and FKTimeWindows::setParameters().
void SciFigs::LiveGridLayer::setMaximumValue | ( | double | m | ) | [inline] |
Referenced by DispersionGridThread::initResultsGraphs(), and setProperty().
{_maximumValue=m;}
void SciFigs::LiveGridLayer::setMinimumValue | ( | double | m | ) | [inline] |
Referenced by DispersionGridThread::initResultsGraphs(), and setProperty().
{_minimumValue=m;}
void SciFigs::LiveGridLayer::setProperty | ( | uint | wid, |
int | pid, | ||
QVariant | val | ||
) | [virtual] |
Reimplemented from SciFigs::GridPlot.
References SciFigs::LiveGridLayerProperties::AutoAdjustPalette, SciFigs::LiveGridLayerProperties::ForceMaxValue, SciFigs::LiveGridLayerProperties::ForceMinValue, SciFigs::LiveGridLayerProperties::LinearScale, SciFigs::LiveGridLayerProperties::LogScale, SciFigs::LiveGridLayerProperties::MaxValue, SciFigs::LiveGridLayerProperties::MinValue, setAutoAdjustPalette(), setForceMaximumValue(), setForceMinimumValue(), setMaximumValue(), setMinimumValue(), setScale(), and TRACE.
{ TRACE; if(wid==_tab) { switch(pid) { case LiveGridLayerProperties::AutoAdjustPalette: setAutoAdjustPalette(val.toBool()); break; case LiveGridLayerProperties::LinearScale: setScale(val.toBool() ? SamplingParameters::Linear : SamplingParameters::Log); break; case LiveGridLayerProperties::LogScale: setScale(val.toBool() ? SamplingParameters::Log : SamplingParameters::Linear); break; case LiveGridLayerProperties::ForceMinValue: setForceMinimumValue(val.toBool()); break; case LiveGridLayerProperties::ForceMaxValue: setForceMaximumValue(val.toBool()); break; case LiveGridLayerProperties::MinValue: setMinimumValue(val.toDouble()); break; case LiveGridLayerProperties::MaxValue: setMaximumValue(val.toDouble()); break; } } else { GridPlot::setProperty(wid, pid, val); } }
void SciFigs::LiveGridLayer::setSampling | ( | int | s | ) | [inline] |
Referenced by ArrayGui::ArrayResponse::createObjects(), FKTimeWindows::FKTimeWindows(), and Simulator::init().
{_sampling=s;}
void SciFigs::LiveGridLayer::setScale | ( | SamplingParameters::Type | s | ) | [inline] |
Referenced by setProperty().
{_scale=s;}
void SciFigs::LiveGridLayer::setSmallestDetail | ( | double | d | ) | [inline] |
{_smallestDetail=d;}
int SciFigs::LiveGridLayer::smallestDetail | ( | ) | const [inline] |
{return _smallestDetail;}
References _function, and TRACE.
Referenced by FKTimeWindows::setCurrentWindow().
{ TRACE; LayerLocker ll(this); AbstractFunction2 * f=_function; _function=0; return f; }
virtual const QString& SciFigs::LiveGridLayer::xml_tagName | ( | ) | const [inline, virtual] |
Reimplemented from SciFigs::GridPlot.
References SciFigs::IrregularGrid2DPlot::xmlIrregularGrid2DPlotTag.
void SciFigs::LiveGridLayer::xml_writeChildren | ( | XML_WRITECHILDREN_ARGS | ) | const [protected, virtual] |
Reimplemented from SciFigs::GridPlot.
References SciFigs::XMLSciFigs::data(), SciFigs::GraphContentLayer::graphContent(), TRACE, and QGpCoreTools::XMLClass::xml_save().
{ TRACE; // Calculate grid with current plot limits IrregularGrid2D grid=calculateGrid(graphContent()->size(), graphContent()->options()); XMLSciFigs * scifigsContext=static_cast<XMLSciFigs *>(context); if(scifigsContext->data()) { grid.xml_save(s, context); } GridPlot::xml_writeChildren(s, context); }
AbstractFunction2* SciFigs::LiveGridLayer::_function [protected] |
Referenced by LiveGridLayer(), paintData(), setFunction(), takeFunction(), and ~LiveGridLayer().
int SciFigs::LiveGridLayer::_sampling [protected] |
Referenced by LiveGridLayer().
double SciFigs::LiveGridLayer::_smallestDetail [protected] |
Referenced by LiveGridLayer().