Board  0.6.devel
 All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Macros
LibBoard::Polyline Struct Reference

#include <Shapes.h>

Inheritance diagram for LibBoard::Polyline:
Collaboration diagram for LibBoard::Polyline:

Public Member Functions

 Polyline (const std::vector< Point > &points, bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
 Polyline (const Path &path, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
 Polyline (bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1)
const std::string & name () const
Point center () const
Polylineoperator<< (const Point &p)
Pointoperator[] (const unsigned int n)
Polylinerotate (double angle, const Point &center)
Polyline rotated (double angle, const Point &center) const
Polylinerotate (double angle)
Polyline rotated (double angle) const
Polylinetranslate (double dx, double dy)
Polyline translated (double dx, double dy) const
Shapescale (double sx, double sy)
Shapescale (double s)
Polyline scaled (double sx, double sy) const
Polyline scaled (double s) const
void scaleAll (double s)
void flushPostscript (std::ostream &stream, const TransformEPS &transform) const
void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const
void flushSVG (std::ostream &stream, const TransformSVG &transform) const
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const
Rect boundingBox () const
Polylineclone () const
- Public Member Functions inherited from LibBoard::Shape
 Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
virtual ~Shape ()
bool filled () const
ShaperotateDeg (double angle, const Point &center)
ShaperotateDeg (double angle)
Rect bbox ()
Shapeoperator-- ()
Shapeoperator++ ()
int depth () const
virtual void depth (int)
virtual void shiftDepth (int shift)
const DGtal::Color & penColor () const
const DGtal::Color & fillColor () const

Protected Attributes

Path _path
- Protected Attributes inherited from LibBoard::Shape
int _depth
DGtal::Color _penColor
DGtal::Color _fillColor
double _lineWidth
LineStyle _lineStyle
LineCap _lineCap
LineJoin _lineJoin

Static Private Attributes

static const std::string _name

Additional Inherited Members

- Public Types inherited from LibBoard::Shape
enum  LineCap { ButtCap = 0, RoundCap, SquareCap }
enum  LineJoin { MiterJoin = 0, RoundJoin, BevelJoin }
enum  LineStyle {
  SolidStyle = 0, DashStyle, DotStyle, DashDotStyle,
  DashDotDotStyle, DashDotDotDotStyle
}
- Protected Member Functions inherited from LibBoard::Shape
std::string svgProperties (const TransformSVG &transform) const
std::string postscriptProperties () const
std::string tikzProperties (const TransformTikZ &transform) const

Detailed Description

A polygonal line described by a series of 2D points.

The polyline structure.


Constructor & Destructor Documentation

LibBoard::Polyline::Polyline ( const std::vector< Point > &  points,
bool  closed,
DGtal::Color  penColor,
DGtal::Color  fillColor,
double  lineWidth,
const LineStyle  lineStyle = SolidStyle,
const LineCap  cap = ButtCap,
const LineJoin  join = MiterJoin,
int  depth = -1 
)
inline
LibBoard::Polyline::Polyline ( const Path path,
DGtal::Color  penColor,
DGtal::Color  fillColor,
double  lineWidth,
const LineStyle  lineStyle = SolidStyle,
const LineCap  cap = ButtCap,
const LineJoin  join = MiterJoin,
int  depth = -1 
)
inline
LibBoard::Polyline::Polyline ( bool  closed,
DGtal::Color  penColor,
DGtal::Color  fillColor,
double  lineWidth,
const LineStyle  lineStyle = SolidStyle,
const LineCap  cap = ButtCap,
const LineJoin  join = MiterJoin,
int  depth = -1 
)
inline

Member Function Documentation

Rect LibBoard::Polyline::boundingBox ( ) const
virtual

Returns the bounding box of the figure.

Returns:
The rectangle of the bounding box.

Implements LibBoard::Shape.

References _path, and LibBoard::Path::boundingBox().

Point LibBoard::Polyline::center ( ) const
virtual

Returns the gravity center of the shape.

Returns:
The center of the shape.

Implements LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle.

References _path, and LibBoard::Path::center().

Referenced by rotate(), rotated(), and LibBoard::Rectangle::rotated().

Polyline * LibBoard::Polyline::clone ( ) const
virtual

Return a copy of the shape.

Returns:

Implements LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle, LibBoard::Triangle, LibBoard::Image, and LibBoard::Rectangle.

References Polyline().

void LibBoard::Polyline::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< DGtal::Color, int > &  colormap 
) const
virtual
void LibBoard::Polyline::flushPostscript ( std::ostream &  stream,
const TransformEPS transform 
) const
virtual

Writes the EPS code of the shape in a stream according to a transform.

Parameters:
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle.

References LibBoard::Shape::_fillColor, _path, LibBoard::Shape::_penColor, LibBoard::Path::empty(), LibBoard::Shape::filled(), LibBoard::Path::flushPostscript(), and LibBoard::Shape::postscriptProperties().

Referenced by LibBoard::Board::saveEPS().

void LibBoard::Polyline::flushSVG ( std::ostream &  stream,
const TransformSVG transform 
) const
virtual

Writes the SVG code of the shape in a stream according to a transform.

Parameters:
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle, LibBoard::Image, and LibBoard::Rectangle.

References _path, LibBoard::Path::closed(), LibBoard::Path::empty(), LibBoard::Path::flushSVGPoints(), and LibBoard::Shape::svgProperties().

void LibBoard::Polyline::flushTikZ ( std::ostream &  stream,
const TransformTikZ transform 
) const
virtual

Writes the TikZ code of the shape in a stream according to a transform.

Parameters:
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle, LibBoard::Image, and LibBoard::Rectangle.

References _path, LibBoard::Path::closed(), LibBoard::Path::empty(), LibBoard::Path::flushTikZPoints(), and LibBoard::Shape::tikzProperties().

const std::string & LibBoard::Polyline::name ( ) const
virtual

Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)

Returns:

Reimplemented from LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle, LibBoard::Triangle, LibBoard::Image, and LibBoard::Rectangle.

References _name.

Polyline & LibBoard::Polyline::operator<< ( const Point p)

Add a point to the polyline.

Parameters:
p
Returns:

References _path.

Point& LibBoard::Polyline::operator[] ( const unsigned int  n)
inline

Returns the n-th point of the polyline.

Parameters:
i
Returns:

References _path.

Polyline & LibBoard::Polyline::rotate ( double  angle,
const Point center 
)
virtual

Rotate the shape around a given center of rotation.

Parameters:
angleThe rotation angle in radian.
centerThe center of rotation.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle.

References _path, and LibBoard::Path::rotate().

Polyline & LibBoard::Polyline::rotate ( double  angle)
virtual

Rotate the shape around its center.

Parameters:
angleThe rotation angle in radian.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle.

References _path, center(), and LibBoard::Path::rotate().

Polyline LibBoard::Polyline::rotated ( double  angle,
const Point center 
) const
Parameters:
angle
center
Returns:

Reimplemented in LibBoard::GouraudTriangle, and LibBoard::Rectangle.

References Polyline().

Polyline LibBoard::Polyline::rotated ( double  angle) const
Parameters:
angle
Returns:

Reimplemented in LibBoard::GouraudTriangle, LibBoard::Triangle, and LibBoard::Rectangle.

References center(), and Polyline().

Shape & LibBoard::Polyline::scale ( double  sx,
double  sy 
)
virtual

Scale the shape along the x an y axis.

Parameters:
sxThe scale factor along the x axis.
syThe scale factor along the y axis.
Returns:
The shape itself.

Implements LibBoard::Shape.

References _path, and LibBoard::Path::scale().

Referenced by scale().

Shape & LibBoard::Polyline::scale ( double  s)
virtual

Scale the shape along both axis.

Parameters:
sThe scale factor along both axis.
Returns:
The shape itself.

Implements LibBoard::Shape.

References scale().

void LibBoard::Polyline::scaleAll ( double  s)
virtual

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters:
sThe scaling factor.

Implements LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle, and LibBoard::Rectangle.

References _path, and LibBoard::Path::scaleAll().

Polyline LibBoard::Polyline::scaled ( double  sx,
double  sy 
) const
Parameters:
sx
sy
Returns:

Reimplemented in LibBoard::GouraudTriangle, LibBoard::Triangle, and LibBoard::Rectangle.

References Polyline().

Polyline LibBoard::Polyline::scaled ( double  s) const
Polyline & LibBoard::Polyline::translate ( double  dx,
double  dy 
)
virtual

Translate the shape by a given offset.

Parameters:
dxThe x offset.
dyThe y offset.
Returns:
A reference to the shape itself.

Implements LibBoard::Shape.

References _path, and LibBoard::Path::translate().

Polyline LibBoard::Polyline::translated ( double  dx,
double  dy 
) const
Parameters:
dx
dy
Returns:

Reimplemented in LibBoard::GouraudTriangle, LibBoard::Triangle, and LibBoard::Rectangle.

References Polyline().


Field Documentation

const std::string LibBoard::Polyline::_name
staticprivate

The generic name of the shape.

Reimplemented from LibBoard::Shape.

Reimplemented in LibBoard::GouraudTriangle, LibBoard::Triangle, LibBoard::Image, and LibBoard::Rectangle.

Referenced by name().


The documentation for this struct was generated from the following files: