25 #ifndef WMHISTOGRAMVIEW_H
26 #define WMHISTOGRAMVIEW_H
32 #include <boost/thread.hpp>
35 #include "core/common/WCounter.h"
36 #include "core/common/WHistogramBasic.h"
37 #include "core/common/math/linearAlgebra/WMatrixFixed.h"
38 #include "core/dataHandler/WDataSetHistogram1D.h"
39 #include "core/graphicsEngine/WGEGroupNode.h"
40 #include "core/kernel/WModule.h"
41 #include "core/kernel/WModuleInputData.h"
42 #include "core/kernel/WModuleOutputData.h"
43 #include "core/ui/WUIViewWidget.h"
70 virtual const std::string
getName()
const;
84 virtual std::shared_ptr< WModule >
factory()
const;
132 void handleResize(
int x,
int y,
int width,
int height );
212 double findOptimalSpacing(
double intervalLength,
double availableSpace,
double textSize );
304 std::shared_ptr< WModuleInputData< WDataSetHistogram1D > >
m_input;
307 std::shared_ptr< WDataSetHistogram1D >
m_data;
This is a simple but thread-safe counter.
A module that draws a histogram.
void updateHistogramMax()
This updates the maximum value of the histograms.
osg::ref_ptr< osg::Geode > m_infoNode
Draws histogram bin info to the top right corner of the window.
std::shared_ptr< WHistogramBasic const > m_histogram
A vector of histograms, one histogram per input.
WVector2d histogramSpaceToWindowSpace(WVector2d const &v)
This transforms histogram space coordinates to window coordinates.
boost::mutex m_createInfoMutex
Whenever a new info node is made this mutex should be used.
virtual void connectors()
Initialize the connectors this module is using.
static WCounter m_instanceCounter
The instance counter used to get the instance ID.
WMHistogramView()
Constuctor.
WVector2d m_framePosition
The space to the left and under the frame in window coordinates.
int m_windowWidth
The width of the window.
WVector2d m_frameSpacing
The spacing between labels at the histogram axis in histogram coordinates.
WVector2d m_histogramLowerLeft
The lower left corner of the histogram in histogram coordinates.
osg::ref_ptr< osg::Geode > m_markerNode
Draws a marker showing the currently selected histogram bin.
osg::ref_ptr< WGEGroupNode > m_mainNode
The scene node of the custom window. All geometry nodes are added as children of this node.
void handleResize(int x, int y, int width, int height)
Called on every resize event from the custom widget.
virtual void requirements()
Initialize requirements for this module.
virtual const std::string getName() const
Gives back the name of this module.
WUIViewWidget::SPtr m_widget
Holds the reference to the custom widget used for displaying the histogram.
std::shared_ptr< WCondition > m_propCondition
A condition for property updates.
void createFrame()
Creates the geometry for the frame and the ticks/labels.
double const m_frameSize
The distance between the histogram frame and the top resp. right side of the window in relative windo...
void handleMouseMove(WVector2f pos)
Called on every mouse move event from the custom widget.
void calculateFramePosition()
Finds a good position of the frame relative to the lower left corner of the window.
void calculateHistograms()
This simply calculates a histogram per dataset, where the bin sizes and positions are the same for ea...
virtual void properties()
Initialize the properties for this module.
void calculateFrameSize()
Finds a good size for the frame, depending on the chosen spacing for axis labels.
void createGeometryStairs()
Creates the geometry for stairs (i.e.
osg::ref_ptr< osg::Geode > m_frameNode
Draws the frame and ticks/labels.
WVector2d windowSpaceToHistogramSpace(WVector2d const &v)
This is the inverse of histogramSpaceToWindowSpace.
void createNothing()
This simply prints a NYI message to the errorLog.
WVector2d m_histogramUpperRight
The upper right corner of the histogram in histogram coordinates.
std::vector< boost::function< void(void) > > m_geometryFunctions
A vector containing functions to use for histogram geometry generation.
virtual void moduleMain()
Entry point after loading the module.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
void createGeometryBars()
Creates the geometry for histogram bars.
boost::mutex m_redrawMutex
Whenever a redraw is made this mutex should be used.
WVector2d m_mousePos
The position of the mouse cursor in window coordinates.
WVector2d m_frameUpperRight
The upper right vertex of the frame box in histogram coordinates.
int m_instanceID
The number of this WMHistogram instance. Used to generate a unique window title for every instance of...
int m_windowHeight
The height of the window.
WPropSelection m_styleSelection
Allows to select which one of the geometry generation functions should be used.
std::shared_ptr< WModuleInputData< WDataSetHistogram1D > > m_input
The input connector.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
WVector2d m_frameLowerLeft
The lower left vertex of the frame box in histogram coordinates.
void createGeometryCurves()
Creates the geometry for curves.
virtual ~WMHistogramView()
Destructor.
WPropColor m_color
The color properties for the dataset.
virtual const std::string getDescription() const
Gives back a description of this module.
void redraw()
Redraws the histogram and add it to the main geode.
void createInfo(WVector2f mousePos)
Writes the values of the currently selected histogram bin to the top right corner of the window.
double findOptimalSpacing(double intervalLength, double availableSpace, double textSize)
This finds a suitable spacing of ticks to use for an axis with a certain length and value interval.
std::shared_ptr< WDataSetHistogram1D > m_data
The histogram to show.
A fixed size matrix class.
Class representing a single module of OpenWalnut.