Class Primitive2D is an interface for all geometric primitives.
More...
#include <primitives.h>
Public Types |
enum | Type {
POINT_2D,
LINE_2D,
RAY_2D,
RECT_2D,
CIRCLE_2D,
TRIANGLE_2D,
TRIPLET_2D,
TEXT_2D,
POLYGON_2D,
ELLIPSE_2D,
CONTAINER_2D
} |
| Enumerates the primitive types.
More...
|
Public Member Functions |
| Primitive2D (double x=0.0, double y=0.0) |
| Creates a new primitive.
|
virtual | ~Primitive2D () |
| Destructor.
|
| Primitive2D (const Primitive2D &primitive) |
| Copy constructor.
|
Primitive2D & | assign (const Primitive2D &primitive) |
| Assignment operator.
|
virtual Type | get_type () const =0 |
| Type of the primitive.
|
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.
|
void | set_opacity (double opacity) |
| Sets the opacity of the primitive.
|
double | get_x () const |
| Returns the x-Coordinate.
|
double | get_y () const |
| Returns the y-Coordinate.
|
double | get_r () const |
| Returns the red color.
|
double | get_g () const |
| Returns the green color.
|
double | get_b () const |
| Returns the blue color.
|
double | get_opacity () const |
| Returns the opacity.
|
const std::string & | get_label () const |
| Returns the label.
|
void | set_label (const std::string &label) |
| Sets the label.
|
virtual void | set_position (double x, double y) |
| Sets the position of the primitive.
|
virtual void | move (double dx, double dy) |
| Moves the primitive by the given offset.
|
void | set_valid (bool valid) |
| Sets the primitives valid status.
|
bool | is_valid () const |
| Returns the primitives validity status.
|
int | get_index () const |
| Returns the index of the primitive.
|
virtual void | set_index (int index) |
| Sets the index of the primitive.
|
double | get_width () const |
| Returns the width of the primitive.
|
virtual void | set_width (double width) |
| Sets the width of the primitive.
|
virtual Primitive2D * | get_copy ()=0 |
| Copies the current primitive.
|
Protected Attributes |
double | x |
| Coordinates.
|
double | y |
double | r |
| Color.
|
double | g |
double | b |
double | opacity |
double | width |
| Width of the lines.
|
std::string | label |
| Label.
|
bool | valid |
| Validity flag.
|
int | index |
| Index of the primitive.
|
Detailed Description
Class Primitive2D is an interface for all geometric primitives.
Member Enumeration Documentation
Enumerates the primitive types.
- Enumerator:
POINT_2D |
|
LINE_2D |
|
RAY_2D |
|
RECT_2D |
|
CIRCLE_2D |
|
TRIANGLE_2D |
|
TRIPLET_2D |
|
TEXT_2D |
|
POLYGON_2D |
|
ELLIPSE_2D |
|
CONTAINER_2D |
|
Constructor & Destructor Documentation
crp::Primitive2D::Primitive2D |
( |
double |
x = 0.0 , |
|
|
double |
y = 0.0 |
|
) |
| [inline] |
Creates a new primitive.
- Parameters:
-
x | X-Coordinate |
y | Y-Coordinate |
virtual crp::Primitive2D::~Primitive2D |
( |
| ) |
[inline, virtual] |
crp::Primitive2D::Primitive2D |
( |
const Primitive2D & |
primitive | ) |
[inline] |
Copy constructor.
- Parameters:
-
primitive | Primitive to copy |
Member Function Documentation
Assignment operator.
- Parameters:
-
double crp::Primitive2D::get_b |
( |
| ) |
const [inline] |
Returns the blue color.
- Returns:
- Blue color
virtual Primitive2D* crp::Primitive2D::get_copy |
( |
| ) |
[pure virtual] |
double crp::Primitive2D::get_g |
( |
| ) |
const [inline] |
Returns the green color.
- Returns:
- Red color
int crp::Primitive2D::get_index |
( |
| ) |
const [inline] |
Returns the index of the primitive.
- Returns:
- Primitive index
const std::string& crp::Primitive2D::get_label |
( |
| ) |
const [inline] |
Returns the label.
- Returns:
- Label of the entity
double crp::Primitive2D::get_opacity |
( |
| ) |
const [inline] |
Returns the opacity.
The opacity value is normally between 0.0 and 1.0.
- Returns:
- Opacity value
double crp::Primitive2D::get_r |
( |
| ) |
const [inline] |
Returns the red color.
- Returns:
- Red color
virtual Type crp::Primitive2D::get_type |
( |
| ) |
const [pure virtual] |
double crp::Primitive2D::get_width |
( |
| ) |
const [inline] |
Returns the width of the primitive.
- Returns:
- Primitive width
Reimplemented in crp::Rect2D.
double crp::Primitive2D::get_x |
( |
| ) |
const [inline] |
Returns the x-Coordinate.
- Returns:
- x-Coordinate
double crp::Primitive2D::get_y |
( |
| ) |
const [inline] |
Returns the y-Coordinate.
- Returns:
- y-Coordinate
bool crp::Primitive2D::is_valid |
( |
| ) |
const [inline] |
Returns the primitives validity status.
- Returns:
- True if the primitive is valid
virtual void crp::Primitive2D::move |
( |
double |
dx, |
|
|
double |
dy |
|
) |
| [inline, virtual] |
Moves the primitive by the given offset.
- Parameters:
-
dx | New X-Coordinate offset |
dy | New Y-Coordinate offset |
void crp::Primitive2D::set_color |
( |
const Color & |
color | ) |
[inline] |
Sets the color of the primitive.
- Parameters:
-
color | Color of the primitive |
Reimplemented in crp::Container2D.
void crp::Primitive2D::set_color |
( |
double |
r, |
|
|
double |
g, |
|
|
double |
b, |
|
|
double |
opacity = 1.0 |
|
) |
| [inline] |
Sets the color of the primitive.
- Parameters:
-
r | Red amount between 0.0 and 1.0 |
g | Green amount between 0.0 and 1.0 |
b | Blue amount between 0.0 and 1.0 |
opacity | Opacity value between 0.0 and 1.0 |
Reimplemented in crp::Container2D.
virtual void crp::Primitive2D::set_index |
( |
int |
index | ) |
[inline, virtual] |
void crp::Primitive2D::set_label |
( |
const std::string & |
label | ) |
[inline] |
Sets the label.
- Parameters:
-
void crp::Primitive2D::set_opacity |
( |
double |
opacity | ) |
[inline] |
Sets the opacity of the primitive.
- Parameters:
-
opacity | Opacity value between 0.0 and 1.0 |
virtual void crp::Primitive2D::set_position |
( |
double |
x, |
|
|
double |
y |
|
) |
| [inline, virtual] |
Sets the position of the primitive.
- Parameters:
-
x | New X-Coordinate |
y | New Y-Coordinate |
void crp::Primitive2D::set_valid |
( |
bool |
valid | ) |
[inline] |
Sets the primitives valid status.
- Parameters:
-
virtual void crp::Primitive2D::set_width |
( |
double |
width | ) |
[inline, virtual] |
Sets the width of the primitive.
- Parameters:
-
Reimplemented in crp::Rect2D.
Field Documentation
The documentation for this class was generated from the following file: