Chemical Data Processing Library C++ API - Version 1.1.1
Public Types | Public Member Functions | List of all members
CDPL::Vis::PathPrimitive2D Class Reference

A graphics primitive representing an arbitrary path in 2D space. More...

#include <PathPrimitive2D.hpp>

+ Inheritance diagram for CDPL::Vis::PathPrimitive2D:

Public Types

typedef std::shared_ptr< PathPrimitive2DSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated PathPrimitive2D instances. More...
 
- Public Types inherited from CDPL::Vis::Path2D
enum  FillRule {
  EVEN_ODD,
  WINDING
}
 Specifies which method to use for filling closed shapes described by the Path2D object. More...
 
- Public Types inherited from CDPL::Vis::GraphicsPrimitive2D
typedef std::shared_ptr< GraphicsPrimitive2DSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated GraphicsPrimitive2D instances. More...
 

Public Member Functions

 PathPrimitive2D ()
 Constructs an undefined path primitive. More...
 
void render (Renderer2D &renderer) const
 Visualizes the graphics primitive by means of the Renderer2D instance renderer. More...
 
void setPen (const Pen &pen)
 Sets the pen defining the color, width, line style, cap style and join style of the path outline. More...
 
const PengetPen () const
 Returns the pen defining the color, width, line style, cap style and join style of the path outline. More...
 
void setBrush (const Brush &brush)
 Sets the brush defining the fill color and fill pattern. More...
 
const BrushgetBrush () const
 Returns the brush defining the fill color and fill pattern. More...
 
GraphicsPrimitive2D::SharedPointer clone () const
 Creates a dynamically allocated copy of the graphics primitive. More...
 
void getBounds (Rectangle2D &bounds, FontMetrics *font_metrics=0) const
 Calculates the bounds of the graphics primitive. More...
 
- Public Member Functions inherited from CDPL::Vis::Path2D
 Path2D ()
 Constructs an empty Path2D instance. More...
 
 Path2D (const Path2D &path)
 Constructs a copy of the Path2D instance path. More...
 
virtual ~Path2D ()
 Virtual destructor. More...
 
bool isEmpty () const
 Tells whether the Path2D instance does not contain any elements. More...
 
bool hasDrawingElements () const
 Tells whether the Path2D instance contains any elements representing drawing operations (lines and arcs). More...
 
void clear ()
 Deletes all path elements added so far and sets the fill rule to its default. More...
 
void setFillRule (FillRule rule)
 Sets the fill rule of the path to the specified value. More...
 
FillRule getFillRule () const
 Returns the currently set fill rule. More...
 
void moveTo (double x, double y)
 Sets the current position to (x, y) and starts a new subpath, implicitly closing the previous path. More...
 
void moveTo (const Math::Vector2D &pos)
 Sets the current position to pos and starts a new subpath, implicitly closing the previous path. More...
 
void arc (double cx, double cy, double rx, double ry, double start_ang, double sweep)
 Creates an elliptical arc centered at (cx, cy) with ellipse radii rx and ry beginning at the angle start_ang and extending sweep degrees clockwise. More...
 
void arc (const Math::Vector2D &ctr, double rx, double ry, double start_ang, double sweep)
 Creates an elliptical arc centered at ctr with ellipse radii rx and ry beginning at the angle start_ang and extending sweep degrees clockwise. More...
 
void arcTo (double cx, double cy, double rx, double ry, double start_ang, double sweep)
 Creates an elliptical arc centered at (cx, cy) with ellipse radii rx and ry beginning at the angle start_ang and extending sweep degrees clockwise. More...
 
void arcTo (const Math::Vector2D &ctr, double rx, double ry, double start_ang, double sweep)
 Creates an elliptical arc centered at ctr with ellipse radii rx and ry beginning at the angle start_ang and extending sweep degrees clockwise. More...
 
void lineTo (double x, double y)
 Adds a straight line from the current position to the point (x, y). More...
 
void lineTo (const Math::Vector2D &pos)
 Adds a straight line from the current position to the point (x, y). More...
 
void closePath ()
 Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting a new path. More...
 
void addEllipse (double x, double y, double width, double height)
 Creates an ellipse positioned at (x, y) with the specified width and height, and adds it to this path as a closed subpath. More...
 
void addEllipse (const Math::Vector2D &pos, double width, double height)
 Creates an ellipse positioned at pos with the specified width and height, and adds it to this path as a closed subpath. More...
 
void addRectangle (double x, double y, double width, double height)
 Creates a rectangle positioned at (x, y) with the specified width and height, and adds it to this path as a closed subpath. More...
 
void addRectangle (const Math::Vector2D &pos, double width, double height)
 Creates a rectangle positioned at pos with the specified width and height, and adds it to this path as a closed subpath. More...
 
void getBounds (Rectangle2D &bounds) const
 Calculates the axis-aligned bounding box of the path. More...
 
void convert (Path2DConverter &conv) const
 Iterates over the stored path elements and calls the corresponding method of conv for each visited element. More...
 
bool operator== (const Path2D &path) const
 Equality comparison operator. More...
 
bool operator!= (const Path2D &path) const
 Non-equality comparison operator. More...
 
Path2Doperator+= (const Path2D &path)
 Appends the elements stored in the Path2D instance path to this path. More...
 
Path2Doperator= (const Path2D &path)
 Assignment operator. More...
 
- Public Member Functions inherited from CDPL::Vis::GraphicsPrimitive2D
virtual ~GraphicsPrimitive2D ()
 Virtual destructor. More...
 

Detailed Description

A graphics primitive representing an arbitrary path in 2D space.

Since
1.1

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated PathPrimitive2D instances.

Constructor & Destructor Documentation

◆ PathPrimitive2D()

CDPL::Vis::PathPrimitive2D::PathPrimitive2D ( )
inline

Constructs an undefined path primitive.

Member Function Documentation

◆ render()

void CDPL::Vis::PathPrimitive2D::render ( Renderer2D renderer) const
virtual

Visualizes the graphics primitive by means of the Renderer2D instance renderer.

Parameters
rendererThe renderer that performs the drawing operations.

Implements CDPL::Vis::GraphicsPrimitive2D.

◆ setPen()

void CDPL::Vis::PathPrimitive2D::setPen ( const Pen pen)

Sets the pen defining the color, width, line style, cap style and join style of the path outline.

Parameters
penThe pen defining the color, width, line style, cap style and join style of the path outline.

◆ getPen()

const Pen& CDPL::Vis::PathPrimitive2D::getPen ( ) const

Returns the pen defining the color, width, line style, cap style and join style of the path outline.

Returns
The pen defining the color, width, line style, cap style and join style of the path outline.

◆ setBrush()

void CDPL::Vis::PathPrimitive2D::setBrush ( const Brush brush)

Sets the brush defining the fill color and fill pattern.

Parameters
brushThe brush defining the fill color and fill pattern.

◆ getBrush()

const Brush& CDPL::Vis::PathPrimitive2D::getBrush ( ) const

Returns the brush defining the fill color and fill pattern.

Returns
The brush defining the fill color and fill pattern.

◆ clone()

GraphicsPrimitive2D::SharedPointer CDPL::Vis::PathPrimitive2D::clone ( ) const
virtual

Creates a dynamically allocated copy of the graphics primitive.

Returns
The copy of the graphics primitive.

Implements CDPL::Vis::GraphicsPrimitive2D.

◆ getBounds()

void CDPL::Vis::PathPrimitive2D::getBounds ( Rectangle2D bounds,
FontMetrics font_metrics = 0 
) const
virtual

Calculates the bounds of the graphics primitive.

Parameters
boundsThe object storing the calculated bounding box.
font_metricsThe font metrics object to use for bounds calculation (if required).

Implements CDPL::Vis::GraphicsPrimitive2D.


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