Gtkmm-PLplot 3.0
A scientific plotting library for Gtkmm
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Gtk::PLplot::PlotObject2DText Class Reference

Text object for 2D plots. More...

#include <gtkmm-plplot/plotobject2dtext.h>

Inheritance diagram for Gtk::PLplot::PlotObject2DText:
Inheritance graph
[legend]

Public Member Functions

 PlotObject2DText (Glib::ustring text, double coord_x, double coord_y, Gdk::RGBA color=Gdk::RGBA("black"))
 
virtual ~PlotObject2DText ()
 
double get_justification ()
 
void set_justification (double justification)
 
Glib::ustring get_text ()
 
void set_text (Glib::ustring text)
 
void get_coordinates (double &coord_x, double &coord_y)
 
void set_coordinates (double coord_x, double coord_y)
 
double get_scale_factor ()
 
void set_scale_factor (double scale_factor)
 
virtual bool is_logarithmic_x_compatible () override
 
virtual bool is_logarithmic_y_compatible () override
 
virtual void draw_plot_object (const Cairo::RefPtr< Cairo::Context > &cr, plstream *pls, PlotObjectAuxData &data) override
 
- Public Member Functions inherited from Gtk::PLplot::PlotObject2D
virtual ~PlotObject2D ()
 
void set_color (Gdk::RGBA color)
 
Gdk::RGBA get_color ()
 
- Public Member Functions inherited from Gtk::PLplot::PlotObject
virtual ~PlotObject ()
 
void show ()
 
void hide ()
 
bool is_showing () const
 
sigc::signal< void(void)> signal_changed ()
 
- Public Member Functions inherited from Gtk::PLplot::Object
virtual void set_manage ()
 

Protected Attributes

double justification
 text justification. Must be [0,1]
 
Glib::ustring text
 text that should be plotted
 
double coords [2]
 text coordinates
 
double scale_factor
 text scale factor
 
- Protected Attributes inherited from Gtk::PLplot::PlotObject2D
Gdk::RGBA color
 The color the dataset will be drawn in.
 
- Protected Attributes inherited from Gtk::PLplot::PlotObject
sigc::signal< void(void)> _signal_changed
 signal that gets emitted whenever any of the plot object properties is changed.
 

Private Member Functions

 PlotObject2DText ()=delete
 no default constructor
 
PlotObject2DTextoperator= (const PlotObject2DText &)=delete
 no assignment operator
 
 PlotObject2DText (const PlotObject2DText &source)=delete
 no default copy constructor;
 

Additional Inherited Members

- Protected Member Functions inherited from Gtk::PLplot::PlotObject2D
 PlotObject2D (Gdk::RGBA color)
 
- Protected Member Functions inherited from Gtk::PLplot::PlotObject
virtual void on_changed ()
 
 PlotObject ()
 
- Protected Member Functions inherited from Gtk::PLplot::Object
 Object ()
 

Detailed Description

Text object for 2D plots.

This object is used in Example 2: Logarithmic axes and box styles

Constructor & Destructor Documentation

◆ PlotObject2DText() [1/3]

Gtk::PLplot::PlotObject2DText::PlotObject2DText ( )
privatedelete

no default constructor

◆ PlotObject2DText() [2/3]

Gtk::PLplot::PlotObject2DText::PlotObject2DText ( const PlotObject2DText source)
privatedelete

no default copy constructor;

◆ PlotObject2DText() [3/3]

Gtk::PLplot::PlotObject2DText::PlotObject2DText ( Glib::ustring  text,
double  coord_x,
double  coord_y,
Gdk::RGBA  color = Gdk::RGBA("black") 
)

Constructor

This constructor initializes a new PlotObject2DText instance, defined by its contents (text) as well as its position and color. More properties can be set using the other methods that are offered by this class.

Parameters
textWhat will be printed on the plot
coord_xX-coordinate of the text
coord_yY-coordinate of the text
colorThe color text color

◆ ~PlotObject2DText()

virtual Gtk::PLplot::PlotObject2DText::~PlotObject2DText ( )
virtual

Destructor

Member Function Documentation

◆ draw_plot_object()

virtual void Gtk::PLplot::PlotObject2DText::draw_plot_object ( const Cairo::RefPtr< Cairo::Context > &  cr,
plstream *  pls,
PlotObjectAuxData data 
)
overridevirtual

Method to draw the object

This method is virtual allowing inheriting classes to implement their own method with the same signature.

Parameters
crthe cairo context to draw to.
plsthe PLplot plstream object that will do the actual plotting on the Cairo context
dataadditional data sent from the Plot to influence drawing

Implements Gtk::PLplot::PlotObject.

◆ get_coordinates()

void Gtk::PLplot::PlotObject2DText::get_coordinates ( double &  coord_x,
double &  coord_y 
)

Get current text coordinates

Parameters
coord_xX-coordinate
coord_yY-coordinate

◆ get_justification()

double Gtk::PLplot::PlotObject2DText::get_justification ( )

Get current text justification

0.0 corresponds to left justified, 1.0 to right justified. Only values in [0.0, 1.0] are valid

Returns
Current text justification

◆ get_scale_factor()

double Gtk::PLplot::PlotObject2DText::get_scale_factor ( )

Get current text scale factor

Use this parameter to get the current text font size

Returns
Text scale factor

◆ get_text()

Glib::ustring Gtk::PLplot::PlotObject2DText::get_text ( )

Get current text

Returns
Current text

◆ is_logarithmic_x_compatible()

virtual bool Gtk::PLplot::PlotObject2DText::is_logarithmic_x_compatible ( )
overridevirtual

Check if the object can be used in a plot with a logarithmic X-axis

Returns
true if compatible, false if not

Implements Gtk::PLplot::PlotObject2D.

◆ is_logarithmic_y_compatible()

virtual bool Gtk::PLplot::PlotObject2DText::is_logarithmic_y_compatible ( )
overridevirtual

Check if the object can be used in a plot with a logarithmic Y-axis

Returns
true if compatible, false if not

Implements Gtk::PLplot::PlotObject2D.

◆ operator=()

PlotObject2DText & Gtk::PLplot::PlotObject2DText::operator= ( const PlotObject2DText )
privatedelete

no assignment operator

◆ set_coordinates()

void Gtk::PLplot::PlotObject2DText::set_coordinates ( double  coord_x,
double  coord_y 
)

Set new text coordinates

Parameters
coord_xX-coordinate
coord_yY-coordinate

◆ set_justification()

void Gtk::PLplot::PlotObject2DText::set_justification ( double  justification)

Set text justification

0.0 corresponds to left justified, 1.0 to right justified. Only values in [0.0, 1.0] are valid

Parameters
justificationNew text justification
Exceptions
Gtk::PLplot::Exception

◆ set_scale_factor()

void Gtk::PLplot::PlotObject2DText::set_scale_factor ( double  scale_factor)

Set text scale factor

Use this parameter to increase or decrease the text font size

Parameters
scale_factorNew text scale factor

◆ set_text()

void Gtk::PLplot::PlotObject2DText::set_text ( Glib::ustring  text)

Set new text

Parameters
textNew text

Member Data Documentation

◆ coords

double Gtk::PLplot::PlotObject2DText::coords[2]
protected

text coordinates

◆ justification

double Gtk::PLplot::PlotObject2DText::justification
protected

text justification. Must be [0,1]

◆ scale_factor

double Gtk::PLplot::PlotObject2DText::scale_factor
protected

text scale factor

◆ text

Glib::ustring Gtk::PLplot::PlotObject2DText::text
protected

text that should be plotted