The Gnome Chemistry Utils  0.14.0
Public Member Functions | Protected Member Functions | List of all members
gccv::Leaf Class Reference

A drop or leaf item. More...

#include <leaf.h>

Inheritance diagram for gccv::Leaf:
gccv::FillItem gccv::LineItem gccv::Item

Public Member Functions

 Leaf (Canvas *canvas, double x, double y, double radius)
 Leaf (Group *parent, double x, double y, double radius, ItemClient *client=NULL)
virtual ~Leaf ()
void SetPosition (double x, double y)
void GetPosition (double &x, double &y)
void SetWidthFactor (double factor)
double Distance (double x, double y, Item **item) const
void Draw (cairo_t *cr, bool is_vector) const
void Move (double x, double y)
void SetRadius (double val)
double GetRadius (void) const
void SetRotation (double val)
double GetRotation (void) const
double GetWidthFactor (void) const
- Public Member Functions inherited from gccv::FillItem
 FillItem (Canvas *canvas)
 FillItem (Group *parent, ItemClient *client=NULL)
virtual ~FillItem ()
void SetFillColor (GOColor val)
GOColor GetFillColor (void) const
- Public Member Functions inherited from gccv::LineItem
 LineItem (Canvas *canvas)
 LineItem (Group *parent, ItemClient *client=NULL)
virtual ~LineItem ()
GOColor GetEffectiveLineColor () const
void ApplyLine (cairo_t *cr) const
void SetDashes (double const *dashes, int num_dashes, double offset)
void SetLineWidth (double val)
double GetLineWidth (void) const
void SetLineColor (GOColor val)
GOColor GetLineColor (void) const
void SetAutoColor (bool val)
bool GetAutoColor (void) const
- Public Member Functions inherited from gccv::Item
 Item (Canvas *canvas)
 Item (Group *parent, ItemClient *client=NULL)
virtual ~Item ()
void GetBounds (double &x0, double &y0, double &x1, double &y1) const
void Invalidate () const
void SetVisible (bool visible)
virtual void BuildPath (cairo_t *cr) const
virtual bool Draw (cairo_t *cr, double x0, double y0, double x1, double y1, bool is_vector) const
bool IsTopLevel () const
void SetClient (ItemClient *val)
ItemClientGetClient (void)
Group const * GetParent (void) const
bool GetVisible (void) const
void SetOperator (cairo_operator_t val)
cairo_operator_t GetOperator (void) const

Protected Member Functions

void UpdateBounds ()

Additional Inherited Members

- Protected Attributes inherited from gccv::Item
double m_x0
double m_y0
double m_x1
double m_y1

Detailed Description

A drop or leaf item.

The Leaf item looks like a drop or some type of tree leaf:

gccvleaf.png

Definition at line 41 of file leaf.h.

Constructor & Destructor Documentation

gccv::Leaf::Leaf ( Canvas canvas,
double  x,
double  y,
double  radius 
)
Parameters
canvasa Canvas.
xthe leaf origin horizontal position.
ythe leaf origin vertical position.
radiusthe leaf radius.

Creates a new Leaf and sets it as a child of the root Group of canvas. The origin is the angular point, and the radius the distance between the origin and the opposite point.

gccv::Leaf::Leaf ( Group parent,
double  x,
double  y,
double  radius,
ItemClient client = NULL 
)
Parameters
parentthe Group to which the new Leaf will be added.
xthe leaf origin horizontal position.
ythe leaf origin vertical position.
radiusthe leaf radius.
clientthe ItemClient for the new Leaf if any.

Creates a new Leaf inside parent and sets client as its associated ItemClient. The origin is the angular point, and the radius the distance between the origin and the opposite point.

virtual gccv::Leaf::~Leaf ( )
virtual

The destructor.

Member Function Documentation

double gccv::Leaf::Distance ( double  x,
double  y,
Item **  item 
) const
virtual
Parameters
xhorizontal position
yvertical position
itemwhere to store the Item.

Implementation of Item::Distance() for the Leaf class. Sets item to this.

Reimplemented from gccv::Item.

void gccv::Leaf::Draw ( cairo_t *  cr,
bool  is_vector 
) const
virtual
Parameters
cra cairo_t.
is_vectorwhether the cairo_t is a vectorial context.

Draws the Leaf to cr.

Reimplemented from gccv::Item.

void gccv::Leaf::GetPosition ( double &  x,
double &  y 
)
Parameters
xwhere to store the leaf originhorizontal position.
ywhere to store the leaf origin vertical position.

Retrieves the position of the leaf origin.

gccv::Leaf::GetRadius ( void  ) const
inline
Returns
the current Leaf radius.

Definition at line 137 of file leaf.h.

gccv::Leaf::GetRotation ( void  ) const
inline
Returns
the current Leaf orientation.

Definition at line 147 of file leaf.h.

gccv::Leaf::GetWidthFactor ( void  ) const
inline
Returns
the width factor for the Leaf. Actually, the width is 0.8 * factor * radius.

Definition at line 152 of file leaf.h.

void gccv::Leaf::Move ( double  x,
double  y 
)
virtual
Parameters
xthe horizontal deplacement
ythe vertical deplacement

Moves the Leaf.

Reimplemented from gccv::Item.

void gccv::Leaf::SetPosition ( double  x,
double  y 
)
Parameters
xthe new leaf origin horizontal position.
ythe new leaf origin vertical position.

Sets the position of the leaf origin.

gccv::Leaf::SetRadius ( double  radius)
inline
Parameters
radiusthe new leaf radius.

Sets the radius for the leaf. The radius is defined as the distance between the origin and the opposite point.

Definition at line 137 of file leaf.h.

gccv::Leaf::SetRotation ( double  rotation)
inline
Parameters
rotationthe new orientation in radians.

Sets the orientation relative to the up vertical direction, using the trigonometric convention.

Definition at line 147 of file leaf.h.

void gccv::Leaf::SetWidthFactor ( double  factor)
Parameters
factorthe new width factor.

Sets the width of the leaf relative to its radius. Actually, the width is 0.8 * factor * radius.

void gccv::Leaf::UpdateBounds ( )
protectedvirtual

Evaluates the Leaf bounds.

Reimplemented from gccv::Item.


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