ContRap-Libraries
Public Member Functions | Protected Attributes

crp::Container2D Class Reference

Class Container2D represents a primitive container. More...

#include <primitives.h>

Inheritance diagram for crp::Container2D:
crp::Primitive2D

Public Member Functions

 Container2D (double x=0.0, double y=0.0)
 Creates a new empty container.
virtual ~Container2D ()
 Destructor.
Container2Doperator= (const Container2D &primitive)
 Assignment operator.
virtual Type get_type () const
 Type of the primitive.
virtual Primitive2Dget_copy ()
 Copies the current primitive.
std::vector< SPtr< Primitive2D > > & get_primitives ()
 Returns the primitives.
void add_primitive (const SPtr< Primitive2D > &primitive)
 Adds a primitive to the end of the primitives list.
void set_color (double r, double g, double b, double opacity=1.0)
 Sets the color of the primitive.
void set_color (const Color &color)
 Sets the color of the primitive.
virtual void set_index (int index)
 Sets the index of the primitive.
void clear ()
 Clears the contents.

Protected Attributes

std::vector< SPtr< Primitive2D > > primitives

Detailed Description

Class Container2D represents a primitive container.

Containers allow to group primitives into semantical objects.


Constructor & Destructor Documentation

crp::Container2D::Container2D ( double  x = 0.0,
double  y = 0.0 
) [inline]

Creates a new empty container.

Parameters:
xX-Coordinate
yY-Coordinate
virtual crp::Container2D::~Container2D ( ) [inline, virtual]

Destructor.


Member Function Documentation

void crp::Container2D::add_primitive ( const SPtr< Primitive2D > &  primitive) [inline]

Adds a primitive to the end of the primitives list.

Parameters:
primitiveNew primitive to add
void crp::Container2D::clear ( ) [inline]

Clears the contents.

virtual Primitive2D* crp::Container2D::get_copy ( ) [inline, virtual]

Copies the current primitive.

Returns:
New copy of the current primitive

Implements crp::Primitive2D.

std::vector<SPtr<Primitive2D> >& crp::Container2D::get_primitives ( ) [inline]

Returns the primitives.

Returns:
Vector of primitives
virtual Type crp::Container2D::get_type ( ) const [inline, virtual]

Type of the primitive.

Returns:
Type of the primitive

Implements crp::Primitive2D.

Container2D& crp::Container2D::operator= ( const Container2D primitive) [inline]

Assignment operator.

Parameters:
primitiveObject to assign
void crp::Container2D::set_color ( const Color color) [inline]

Sets the color of the primitive.

Parameters:
colorColor of the primitive

Reimplemented from crp::Primitive2D.

void crp::Container2D::set_color ( double  r,
double  g,
double  b,
double  opacity = 1.0 
) [inline]

Sets the color of the primitive.

Parameters:
rRed amount between 0.0 and 1.0
gGreen amount between 0.0 and 1.0
bBlue amount between 0.0 and 1.0
opacityOpacity value between 0.0 and 1.0

Reimplemented from crp::Primitive2D.

virtual void crp::Container2D::set_index ( int  index) [inline, virtual]

Sets the index of the primitive.

Parameters:
indexNew index

Reimplemented from crp::Primitive2D.


Field Documentation

std::vector<SPtr<Primitive2D> > crp::Container2D::primitives [protected]

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