gccv::Leaf Class Reference

A drop or leaf item. More...

#include <leaf.h>

Inheritance diagram for gccv::Leaf:

gccv::FillItem gccv::LineItem gccv::Item

List of all members.

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

Protected Member Functions

void UpdateBounds ()


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:
canvas a Canvas.
x the leaf origin horizontal position.
y the leaf origin vertical position.
radius the 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:
parent the Group to which the new Leaf will be added.
x the leaf origin horizontal position.
y the leaf origin vertical position.
radius the leaf radius.
client the 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:
x horizontal position
y vertical position
item where 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:
cr a cairo_t.
is_vector whether 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:
x where to store the leaf originhorizontal position.
y where 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:
x the horizontal deplacement
y the vertical deplacement
Moves the Leaf.

Reimplemented from gccv::Item.

void gccv::Leaf::SetPosition ( double  x,
double  y 
)

Parameters:
x the new leaf origin horizontal position.
y the new leaf origin vertical position.
Sets the position of the leaf origin.

gccv::Leaf::SetRadius ( double  radius  )  [inline]

Parameters:
radius the 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:
rotation the 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:
factor the 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 (  )  [protected, virtual]

Evaluates the Leaf bounds.

Reimplemented from gccv::Item.


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

Generated on Fri Sep 24 15:58:43 2010 for The Gnome Chemistry Utils by  doxygen 1.5.9