Image Component Library (ICL)
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
icl::qt::LowLevelPlotWidget Class Reference

Default AbstractPlotWidget implementation for plotting different kinds of data. More...

#include <LowLevelPlotWidget.h>

Inheritance diagram for icl::qt::LowLevelPlotWidget:
icl::qt::AbstractPlotWidget icl::qt::ThreadedUpdatableWidget icl::utils::Configurable icl::qt::PlotWidget icl::qt::HistogrammWidget

Public Member Functions

 LowLevelPlotWidget (QWidget *parent=0)
 constructor More...
 
 ~LowLevelPlotWidget ()
 destructor More...
 
virtual utils::Rect32f getDataViewPort () const
 returns the data viewport More...
 
void addSeriesData (const float *data, int len, const AbstractPlotWidget::PenPtr &style=new AbstractPlotWidget::Pen(QColor(255, 0, 0)), const std::string &name="", int stride=1, bool deepCopy=true, bool passOwnerShip=false)
 adds series data More...
 
void addBarPlotData (const float *data, int len, const AbstractPlotWidget::PenPtr &style=new AbstractPlotWidget::Pen(QColor(255, 0, 0)), const std::string &name="", int stride=1, bool deepCopy=true, bool passOwnerShip=false)
 adds data for a bar plots More...
 
void addScatterData (char symbol, const float *xs, const float *ys, int num, const std::string &name="", int r=255, int g=0, int b=0, int size=5, bool connectingLine=false, int xStride=1, int yStride=1, bool filled=false, bool deepCopyData=true, bool passDataOwnerShip=false)
 adds a list of symbols More...
 
void clearScatterData ()
 clears the scatter data draw list More...
 
void clearSeriesData ()
 clears series data draw list More...
 
void clearBarPlotData ()
 clears the bar plot draw list More...
 
void clear ()
 clears all contained data More...
 
- Public Member Functions inherited from icl::qt::AbstractPlotWidget
void install (MouseHandler *h)
 adds a new mouse handler More...
 
void uninstall (MouseHandler *h)
 removes a mouse handler More...
 
 AbstractPlotWidget (QWidget *parent=0)
 Base constructor. More...
 
 ~AbstractPlotWidget ()
 destructor More...
 
virtual void paintEvent (QPaintEvent *evt)
 custom drawing More...
 
virtual void keyPressEvent (QKeyEvent *event)
 listens for F11 which enables the fullscreen mode More...
 
void renderTo (QPainter &p)
 renders the whole content using the given qpainter More...
 
void setBackground (const QBrush &bgBrush)
 sets the background brush More...
 
void setPen (PenType p, const QPen &pen)
 sets the pen for one of the widget compoments More...
 
void render ()
 updates the screen More...
 
void setDataViewPort (const utils::Rect32f &viewPort)
 sets the default dataviewport More...
 
void setDataViewPort (const utils::Range32f &xrange, const utils::Range32f &yrange)
 sets the default viewport More...
 
void lock () const
 locks drawing / data updates in subclasses More...
 
void unlock () const
 unlocks drawing / data updates in subclasses More...
 
void addAnnotations (const char type, const float *data, int num=1, const QPen &linePen=QColor(255, 0, 0), const QBrush &brush=Qt::NoBrush, const std::string &text="", const std::string &textDelim=",")
 adds an annotation to the data viewport More...
 
void clearAnnotations ()
 removes all existing annotations More...
 
void setBackgroundFunction (bgFunction f)
 sets the background function More...
 
void updateBackgroundFunction ()
 forces a repaint on the background function in the next rendering cycle More...
 
void removeBackgroundFunction ()
 removes the background function More...
 
- Public Member Functions inherited from icl::qt::ThreadedUpdatableWidget
 ThreadedUpdatableWidget (QWidget *parent=0)
 Base constructor. More...
 
void updateFromOtherThread ()
 call this function to update a widget's UI from an external thread More...
 
virtual bool event (QEvent *event)
 automatically called by Qt's event processing mechanism More...
 
- Public Member Functions inherited from icl::utils::Configurable
virtual ~Configurable ()
 virtual destructor More...
 
 Configurable (const Configurable &other)
 Copy constructor. More...
 
Configurableoperator= (const Configurable &other)
 Assignment operator. More...
 
void setConfigurableID (const std::string &ID)
 sets the ID of this configurable More...
 
const std::string & getConfigurableID () const
 returns the configurables static ID More...
 
bool isOrderedFlagSet () const
 returns whether the ordered flag is set More...
 
void deactivateProperty (const std::string &pattern)
 adds an additional deativation pattern More...
 
void deleteDeactivationPattern (const std::string &pattern)
 removed a formerly added deactivation pattern More...
 
std::vector< std::string > getPropertyListWithoutDeactivated () const
 this returns a filtered list of properties (using all filters added by deactivateProperty) More...
 
virtual void adaptProperty (const std::string &name, const std::string &newType, const std::string &newInfo, const std::string &newToolTip)
 this function can be used to adapt a specific property afterwards More...
 
void registerCallback (const Callback &cb)
 add a callback for changed properties More...
 
void removedCallback (const Callback &cb)
 removes a callback that was registered before More...
 
void syncChangesTo (Configurable *others, int num=1)
 this can be used to let this instance also apply property changes to others More...
 
virtual void setPropertyValue (const std::string &propertyName, const Any &value)
 sets a property value More...
 
virtual std::vector< std::string > getPropertyList () const
 returns a list of All properties, that can be set using setProperty More...
 
virtual bool supportsProperty (const std::string &propertyName) const
 base implementation for property check (seaches in the property list) More...
 
virtual void saveProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC) const
 writes all available properties into a file More...
 
virtual void loadProperties (const std::string &filename, const std::vector< std::string > &propertiesToSkip=EMPTY_VEC)
 reads a camera config file from disc More...
 
virtual std::string getPropertyType (const std::string &propertyName) const
 get type of property More...
 
virtual std::string getPropertyInfo (const std::string &propertyName) const
 get information of a properties valid values More...
 
virtual Any getPropertyValue (const std::string &propertyName) const
 returns the current value of a property or a parameter More...
 
virtual std::string getPropertyToolTip (const std::string &propertyName) const
 returns the tooltip description for a given property More...
 
virtual int getPropertyVolatileness (const std::string &propertyName) const
 Returns whether this property may be changed internally. More...
 

Protected Member Functions

virtual void drawLegend (QPainter &p, const utils::Rect &where, bool horizontal)
 internally used More...
 
virtual bool drawSeriesData (QPainter &p, const DrawState &state)
 draws the series data More...
 
virtual bool drawScatterData (QPainter &p, const DrawState &state)
 draws the sctter data More...
 
virtual bool drawBarPlotData (QPainter &p, const DrawState &state)
 draws the bar plot data More...
 
virtual bool drawData (QPainter &p)
 draws all the data More...
 
virtual utils::Range32f estimateDataXRange () const
 estimates the data xrange (for automatic viewport adaption) More...
 
virtual utils::Range32f estimateDataYRange () const
 estimates the data yrange (for automatic viewport adaption) More...
 
- Protected Member Functions inherited from icl::qt::AbstractPlotWidget
bool isZoomed () const
 returns whether the zoom is active More...
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 internally used More...
 
virtual void mouseMoveEvent (QMouseEvent *event)
 internally used More...
 
virtual void mousePressEvent (QMouseEvent *event)
 internally used More...
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 internally used More...
 
virtual void enterEvent (QEvent *event)
 internally used More...
 
virtual void leaveEvent (QEvent *event)
 internally used More...
 
void drawDefaultLedgend (QPainter &p, const utils::Rect &where, bool horizontal, const std::vector< std::string > &rowNames, const std::vector< PenPtr > &pens)
 draws a default ledgen into the given quad More...
 
float winToDrawX (int winX) const
 converts a window x coordinate to logical drawing coordinate More...
 
float winToDrawY (int winY) const
 converts a window y coordinate to logical drawing coordinate More...
 
utils::Point32f winToDraw (const utils::Point &p) const
 converts a window coordinates to logical drawing coordinates More...
 
int drawToWinX (float drawX) const
 convert logical drawing x coordinate to window coordinate More...
 
int drawToWinY (float drawY) const
 convert logical drawing y coordinate to window coordinate More...
 
utils::Point drawToWin (const utils::Point32f &p) const
 convert logical drawing coordinates to window coordinates More...
 
utils::Rect32f getDynamicDataViewPort () const
 returns the current data viewport w.r.t. the current zoom More...
 
- Protected Member Functions inherited from icl::utils::Configurable
void addProperty (const std::string &name, const std::string &type, const std::string &info, const Any &value=Any(), const int volatileness=0, const std::string &tooltip=std::string())
 This can be used by derived classes to store supported properties in the internal list. More...
 
void addChildConfigurable (Configurable *configurable, const std::string &childPrefix="")
 This adds another configurable as child. More...
 
void removeChildConfigurable (Configurable *configurable)
 removes the given child configurable More...
 
Propertyprop (const std::string &propertyName)
 this CAN be used e.g. to store a property value in internal property-list More...
 
const Propertyprop (const std::string &propertyName) const
 this CAN be used e.g. to store a property value in internal property-list More...
 
 Configurable (const std::string &ID="", bool ordered=true)
 create this configurable with given ID More...
 
void call_callbacks (const std::string &propertyName, const Configurable *caller) const
 calls all registered callbacks More...
 

Private Attributes

Data * data
 pimpl More...
 

Additional Inherited Members

- Public Types inherited from icl::qt::AbstractPlotWidget
enum  PenType {
  X_AXIS_PEN, Y_AXIS_PEN, X_TIC_PEN, Y_TIC_PEN,
  X_LABEL_PEN, Y_LABEL_PEN, X_GRID_PEN, Y_GRID_PEN,
  AXIS_NAME_PEN, NUM_PEN_TYPES
}
 different pen types More...
 
typedef utils::SmartPtr< PenPenPtr
 typedef for managed row-style pointers More...
 
typedef utils::Function< float, float, float > bgFunction
 function that is used to render a non-homo More...
 
- Public Types inherited from icl::utils::Configurable
typedef Function< void, const Property & > Callback
 Function type for changed properties. More...
 
- Static Public Member Functions inherited from icl::utils::Configurable
static std::string create_default_ID (const std::string &prefix)
 this function can be used in subclasses to create a default ID More...
 
static Configurableget (const std::string &id)
 returns configurable by given ID More...
 
static void register_configurable_type (const std::string &classname, Function< Configurable * > creator)
 registers a configurable type More...
 
static std::vector< std::string > get_registered_configurables ()
 returns a list of all registered configurable classnames More...
 
static Configurablecreate_configurable (const std::string &classname)
 creates a configurable by given name More...
 
- Static Public Attributes inherited from icl::utils::Configurable
static const std::vector< std::string > EMPTY_VEC
 used as shortcut – just an empty vector of std::strings More...
 
- Static Protected Member Functions inherited from icl::qt::AbstractPlotWidget
template<char s>
static void draw_symbol (QPainter &p, int size, float x, float y)
 draws one of the Symbols (filled symbols are drawn by setting the QPainters brush manually) More...
 
- Protected Attributes inherited from icl::utils::Configurable
std::vector< Callbackcallbacks
 internally managed list of callbacks More...
 

Detailed Description

Default AbstractPlotWidget implementation for plotting different kinds of data.

Why Low-Level ?

ICL's plotting framework does also provide a derived class called icl::PlotWidget. We strongly recommend to use the PlotWidget instead of the LowLevelPlotWidget be cause the PlotWidget provides a simpler interface and it's usage is more similar to the usage of ICL's image annotation framework (see ICLDrawWidget and ICLDrawWidget3D). However, in some special situations, the LowLevelPlotWidget provides a better performance, since it can e.g. visualize data that is just linked into it using a shallow copy. In contrast to the LowLevelPlotWidget, the PlotWidget does also provide template methods, that can be used to draw data of all POD types directly. In short: The LowLevelPlotWidget provides a low level interface for data visualization. It's functions are tuned for speed. Usually, the derived class icl::PlotWidget is simpler to use.

Constructor & Destructor Documentation

◆ LowLevelPlotWidget()

icl::qt::LowLevelPlotWidget::LowLevelPlotWidget ( QWidget *  parent = 0)

constructor

◆ ~LowLevelPlotWidget()

icl::qt::LowLevelPlotWidget::~LowLevelPlotWidget ( )

destructor

Member Function Documentation

◆ addBarPlotData()

void icl::qt::LowLevelPlotWidget::addBarPlotData ( const float *  data,
int  len,
const AbstractPlotWidget::PenPtr style = new AbstractPlotWidget::Pen(QColor(255, 0, 0)),
const std::string &  name = "",
int  stride = 1,
bool  deepCopy = true,
bool  passOwnerShip = false 
)

adds data for a bar plots

Bar plots basically work like function/series data except for the fact, that bars are drawn instead of a (filled) function graph line

See also
addSeriesData

◆ addScatterData()

void icl::qt::LowLevelPlotWidget::addScatterData ( char  symbol,
const float *  xs,
const float *  ys,
int  num,
const std::string &  name = "",
int  r = 255,
int  g = 0,
int  b = 0,
int  size = 5,
bool  connectingLine = false,
int  xStride = 1,
int  yStride = 1,
bool  filled = false,
bool  deepCopyData = true,
bool  passDataOwnerShip = false 
)

adds a list of symbols

Parameters
symbolsymbol type
xsx-coordinate pointer (using xStride as stride)
ysy-coordinate pointer (using yStride as stride)
numnumber of symbols (i.e. xs and ys have xStride * num elements
name
rsymbol red component
gsymbol green component
bsymbol blue component
sizesymbol size (in screen pixels)
connectingLinedraw a line that connects successive symbols
xStridestride for xs-data (in units of sizeof(float), i.e. if the underlying data is interleaved (x,y)-data, the strides are 2 )
yStridestride for ys-data (in units of sizeof(float))
filleddefines whether the symbol must be filled (for triangle, circle, rect and diamond only)
deepCopyDataif set to true, xs, and ys are copied deeply otherwise, they are just linked (via pointer)
passDataOwnerShipif set to true, the plot widget will take the ownership of the given data
See also
AbstractPlotWidget::Pen::Pen for allowed symbols

◆ addSeriesData()

void icl::qt::LowLevelPlotWidget::addSeriesData ( const float *  data,
int  len,
const AbstractPlotWidget::PenPtr style = new AbstractPlotWidget::Pen(QColor(255, 0, 0)),
const std::string &  name = "",
int  stride = 1,
bool  deepCopy = true,
bool  passOwnerShip = false 
)

adds series data

Parameters
datadata pointer
lennumber of elements in the data pointer
styledraw style
name
stridedata stride (in units of sizeof(float))
deepCopyif true, the data is copied into the drawer, otherwise, it is just linked. If the data is linked, it must remain valid until the seriesData is removed using LowLevelPlotWidget::clearSeriesData or LowLevelPlotWidget::clear.
passOwnerShipThis flag is only used if deepCopy is false. If passOwnerShip is true, the LowLevelPlotWidget will delete the data at deletion or when LowLevelPlotWidget::clearSeriesData or LowLevelPlotWidget::clear is called.

◆ clear()

void icl::qt::LowLevelPlotWidget::clear ( )
virtual

clears all contained data

Reimplemented from icl::qt::AbstractPlotWidget.

Reimplemented in icl::qt::PlotWidget.

◆ clearBarPlotData()

void icl::qt::LowLevelPlotWidget::clearBarPlotData ( )

clears the bar plot draw list

◆ clearScatterData()

void icl::qt::LowLevelPlotWidget::clearScatterData ( )

clears the scatter data draw list

◆ clearSeriesData()

void icl::qt::LowLevelPlotWidget::clearSeriesData ( )

clears series data draw list

◆ drawBarPlotData()

virtual bool icl::qt::LowLevelPlotWidget::drawBarPlotData ( QPainter &  p,
const DrawState &  state 
)
protectedvirtual

draws the bar plot data

◆ drawData()

virtual bool icl::qt::LowLevelPlotWidget::drawData ( QPainter &  p)
protectedvirtual

draws all the data

Implements icl::qt::AbstractPlotWidget.

◆ drawLegend()

virtual void icl::qt::LowLevelPlotWidget::drawLegend ( QPainter &  p,
const utils::Rect where,
bool  horizontal 
)
protectedvirtual

internally used

draws the ledgend

Reimplemented from icl::qt::AbstractPlotWidget.

◆ drawScatterData()

virtual bool icl::qt::LowLevelPlotWidget::drawScatterData ( QPainter &  p,
const DrawState &  state 
)
protectedvirtual

draws the sctter data

◆ drawSeriesData()

virtual bool icl::qt::LowLevelPlotWidget::drawSeriesData ( QPainter &  p,
const DrawState &  state 
)
protectedvirtual

draws the series data

◆ estimateDataXRange()

virtual utils::Range32f icl::qt::LowLevelPlotWidget::estimateDataXRange ( ) const
protectedvirtual

estimates the data xrange (for automatic viewport adaption)

◆ estimateDataYRange()

virtual utils::Range32f icl::qt::LowLevelPlotWidget::estimateDataYRange ( ) const
protectedvirtual

estimates the data yrange (for automatic viewport adaption)

◆ getDataViewPort()

virtual utils::Rect32f icl::qt::LowLevelPlotWidget::getDataViewPort ( ) const
virtual

returns the data viewport

If the data viewport is not given using AbstractPlotWidget::setDataViewPort

Reimplemented from icl::qt::AbstractPlotWidget.

Member Data Documentation

◆ data

Data* icl::qt::LowLevelPlotWidget::data
private

pimpl

pimpl pointer


The documentation for this class was generated from the following file: