Classes | Public Member Functions | List of all members
Ruler Class Reference

Class for coordinate axis ruler. More...

#include <ruler.hpp>

Public Member Functions

 Ruler ()
 Default contructor. More...
 
 Ruler (int cind)
 Contructor for defined coordinate index. More...
 
 Ruler (const Ruler &ruler)
 Copy contructor. More...
 
Ruleroperator= (const Ruler &ruler)
 Assignment operator. More...
 
 ~Ruler ()
 Destructor. More...
 
void copy_tics (const Ruler &ruler)
 Copy tics and from other ruler. More...
 
void set_font_size (double size)
 Set font size. More...
 
void set_color (const Color &color)
 Set ruler color. More...
 
void set_ticlen (double inlen, double outlen)
 Set tic lengths. More...
 
void set_autorange (bool autorange_min, bool autorange_max)
 Set ruler autoranging status. More...
 
void get_autorange (bool &autorange_min, bool &autorange_max) const
 Get ruler autoranging status. More...
 
void set_ranges (double min, double max)
 Set ruler ranges. More...
 
void get_ranges (double &min, double &max) const
 Get current ruler ranges. More...
 
void set_endpoints (double x1, double y1, double x2, double y2)
 End points in pixels for ruler. More...
 
void set_axis_label (const std::string &label)
 Set axis label. More...
 
void enable_labels (bool enable)
 Enable axis title and tic labels. More...
 
void set_coord_index (int cind)
 Set coordinate index. More...
 
void set_indir (bool ccw)
 Set in direction for frame ruler. More...
 
void calculate (cairo_t *cairo, Coordmapper1D &cm, bool ruler_tic_bbox_test)
 Calculate ruler ranges, set tics and coordmapper. More...
 
void draw (cairo_t *cairo, Coordmapper1D &cm, bool recalculate=true)
 Draw ruler with cairo. More...
 
void get_bbox (cairo_t *cairo, double bbox[4], Coordmapper1D &cm, bool recalculate=true)
 Get bounding box of ruler. More...
 
void debug_print (std::ostream &os) const
 Debug print to stream. More...
 

Detailed Description

Class for coordinate axis ruler.

Ruler is a class for drawing coordinate axis for frame or palette colormap legend for example.

Constructor & Destructor Documentation

Ruler::Ruler ( )

Default contructor.

Ruler::Ruler ( int  cind)

Contructor for defined coordinate index.

Ruler::Ruler ( const Ruler ruler)

Copy contructor.

Ruler::~Ruler ( )
inline

Destructor.

Member Function Documentation

void Ruler::calculate ( cairo_t *  cairo,
Coordmapper1D cm,
bool  ruler_tic_bbox_test 
)

Calculate ruler ranges, set tics and coordmapper.

If ruler_tic_bbox_test is set to true, the bounding boxes of the tic labels are tested against overlapping and tics are rebuilt with larger tic spacing to prevent this.

void Ruler::copy_tics ( const Ruler ruler)

Copy tics and from other ruler.

void Ruler::debug_print ( std::ostream &  os) const

Debug print to stream.

void Ruler::draw ( cairo_t *  cairo,
Coordmapper1D cm,
bool  recalculate = true 
)

Draw ruler with cairo.

If recalculate is false, the ruler will be drawn with it's current settings. This is for frame to prevent excess recalculation of rulers.

void Ruler::enable_labels ( bool  enable)

Enable axis title and tic labels.

void Ruler::get_autorange ( bool &  autorange_min,
bool &  autorange_max 
) const

Get ruler autoranging status.

void Ruler::get_bbox ( cairo_t *  cairo,
double  bbox[4],
Coordmapper1D cm,
bool  recalculate = true 
)

Get bounding box of ruler.

If recalculate is false, the ruler bounding box will correspond to it's current settings. This is for frame to prevent excess recalculation of rulers.

void Ruler::get_ranges ( double &  min,
double &  max 
) const

Get current ruler ranges.

Returns finite values used for ruler ranges.

Ruler& Ruler::operator= ( const Ruler ruler)

Assignment operator.

void Ruler::set_autorange ( bool  autorange_min,
bool  autorange_max 
)

Set ruler autoranging status.

void Ruler::set_axis_label ( const std::string &  label)

Set axis label.

void Ruler::set_color ( const Color color)

Set ruler color.

void Ruler::set_coord_index ( int  cind)

Set coordinate index.

Set cind to 0 for x and 1 for y.

void Ruler::set_endpoints ( double  x1,
double  y1,
double  x2,
double  y2 
)

End points in pixels for ruler.

void Ruler::set_font_size ( double  size)

Set font size.

void Ruler::set_indir ( bool  ccw)

Set in direction for frame ruler.

void Ruler::set_ranges ( double  min,
double  max 
)

Set ruler ranges.

Set ruler ranges to finite values. If only one range is either infinite or NaN, it is replaced by a number to get a total range span of 1. If both numbers are infinite or NaN, the minimum will be set to 0.0 and maximum to 1.0.

void Ruler::set_ticlen ( double  inlen,
double  outlen 
)

Set tic lengths.


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