20 #ifndef ofxOuiGraph_hpp 21 #define ofxOuiGraph_hpp 108 template <
typename T,
typename args,
class ListenerClass>
110 void (ListenerClass::*listenerMethod)(args)) {
111 using namespace std::placeholders;
114 std::bind(listenerMethod, owner, _1);
138 ofVec2f
coord2pix(ofVec2f
const& pointAsCoord)
const;
145 ofVec2f
pix2coord(ofVec2f
const& pointAsPixels)
const;
152 ofVec2f
scale2view(ofVec2f
const& scaleAsCoord)
const;
159 ofVec2f
scale2graph(ofVec2f
const& scaleAsPixels)
const;
177 std::function<void(Graph::BoundsChangedEvent&)>
ofVec2f scale2graph(ofVec2f const &scaleAsPixels) const
Scale pixel units to graph units.
Definition: ofxOuiGraph.cpp:196
vector< TextBox > ticks_labels
Definition: ofxOuiGraph.hpp:55
Definition: ofxOuiGraph.hpp:34
std::function< void(Graph::BoundsChangedEvent &)> bounds_changed_event_callback_
Definition: ofxOuiGraph.hpp:178
ofVec2f pix2coord(ofVec2f const &pointAsPixels) const
Convert pixel coordinates to graph coordinates.
Definition: ofxOuiGraph.cpp:179
float y
Definition: ofxOuiGraph.hpp:43
float max
Definition: ofxOuiGraph.hpp:48
Ruler(Layout layout_=Layout::Horizontal)
Definition: ofxOuiGraph.hpp:38
ofVec2f scale2view(ofVec2f const &scaleAsCoord) const
Scale graph units to pixel units.
Definition: ofxOuiGraph.cpp:190
float width
Definition: ofxOuiGraph.hpp:44
ofRectangle view
View area rectangle (in pixels)
Definition: ofxOuiGraph.hpp:164
void draw()
Definition: ofxOuiGraph.cpp:72
void drawRuler()
Definition: ofxOuiGraph.cpp:105
Layout
Definition: ofxOuiGraph.hpp:36
Graph * sender
pointer to the sender component
Definition: ofxOuiGraph.hpp:83
void setupViewport()
Definition: ofxOuiGraph.cpp:128
void mouseScrolled(ofMouseEventArgs &e)
Definition: ofxOuiGraph.cpp:202
std::pair< bool, Ruler > vertical_ruler
Definition: ofxOuiGraph.hpp:173
vector< float > ticks_major
Definition: ofxOuiGraph.hpp:54
vector< float > ticks_minor
Definition: ofxOuiGraph.hpp:53
Definition: ofxOuiColormap.hpp:25
float min
Definition: ofxOuiGraph.hpp:47
bool insideViewArea(ofVec2f const &pointAsPixels) const
Checks if a point is in the view area.
Definition: ofxOuiGraph.cpp:154
float x
Definition: ofxOuiGraph.hpp:42
bool viewport_valid
Definition: ofxOuiGraph.hpp:180
Event arguments for pan/zoom events resulting in bounds changes of the graph area.
Definition: ofxOuiGraph.hpp:72
Graph()
Default Constructor.
Definition: ofxOuiGraph.cpp:95
bool insideGraphArea(ofVec2f const &pointAsCoord) const
Checks if a point is in the graph area.
Definition: ofxOuiGraph.cpp:161
void update()
Definition: ofxOuiGraph.cpp:22
void restoreViewport()
Definition: ofxOuiGraph.cpp:148
Bounds graph_area
Bounds of the graph space.
Definition: ofxOuiGraph.hpp:169
ofVec2f coord2pix(ofVec2f const &pointAsCoord) const
Convert graph coordinates to pixel coordinates.
Definition: ofxOuiGraph.cpp:168
~Graph()
Destructor.
Definition: ofxOuiGraph.cpp:100
Bounds of the graph space.
Definition: ofxOuiGraph.hpp:61
void onBoundsChanged(T *owner, void(ListenerClass::*listenerMethod)(args))
Set callback function for bounds changed events.
Definition: ofxOuiGraph.hpp:109
std::pair< bool, Ruler > horizontal_ruler
Definition: ofxOuiGraph.hpp:172
Layout layout
Definition: ofxOuiGraph.hpp:50
float height
Definition: ofxOuiGraph.hpp:45
2D Graph Area (with virtual coordinate system)
Definition: ofxOuiGraph.hpp:32
bool iso_zoom
Definition: ofxOuiGraph.hpp:171