BoardLib::Shape Struct Reference

Abstract structure for a 2D shape. More...

#include <Shapes.h>

Inheritance diagram for BoardLib::Shape:

BoardLib::Ellipse BoardLib::Line BoardLib::Polyline BoardLib::ShapeList BoardLib::Text BoardLib::Circle BoardLib::Arrow BoardLib::GouraudTriangle BoardLib::Rectangle BoardLib::Board BoardLib::Board BoardLib::Group

List of all members.

Public Types

enum  LineCap { ButtCap = 0, RoundCap, SquareCap }
enum  LineJoin { MiterJoin = 0, RoundJoin, BevelJoin }

Public Member Functions

 Shape (Color penColor, Color fillColor, float lineWidth, const LineCap cap, const LineJoin join, int depth)
virtual ~Shape ()
virtual Shapeclone () const =0
bool filled () const
virtual Point center () const =0
virtual Shaperotate (double angle, const Point &center)=0
virtual Shaperotate (double angle)=0
ShaperotateDeg (double angle, const Point &center)
ShaperotateDeg (double angle)
virtual Shapetranslate (double dx, double dy)=0
virtual Shapescale (double sx, double sy)=0
virtual void flushPostscript (std::ostream &stream, const TransformEPS &transform) const =0
virtual void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const =0
virtual void flushSVG (std::ostream &stream, const TransformSVG &transform) const =0
virtual Rect boundingBox () const =0
int depth () const
virtual void depth (int)
const ColorpenColor () const
const ColorfillColor () const

Protected Member Functions

std::string svgProperties (const TransformSVG &transform) const
std::string postscriptProperties () const

Protected Attributes

int _depth
Color _penColor
Color _fillColor
float _lineWidth
LineCap _lineCap
LineJoin _lineJoin


Detailed Description

Abstract structure for a 2D shape.

Shape structure.


Constructor & Destructor Documentation

BoardLib::Shape::Shape ( Color  penColor,
Color  fillColor,
float  lineWidth,
const LineCap  cap,
const LineJoin  join,
int  depth 
) [inline]

Shape constructor.

Parameters:
penColor The pen color of the shape.
fillColor The fill color of the shape.
lineWidth The line thickness.
depth The depth of the shape.

virtual BoardLib::Shape::~Shape (  )  [inline, virtual]

Shape destructor.


Member Function Documentation

virtual Shape* BoardLib::Shape::clone (  )  const [pure virtual]

Return a copy of the shape.

Returns:

Implemented in BoardLib::ShapeList, BoardLib::Group, BoardLib::Line, BoardLib::Arrow, BoardLib::Polyline, BoardLib::Rectangle, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.

bool BoardLib::Shape::filled (  )  const [inline]

Checks whether a shape is filled with a color or not.

Returns:
true if the shape is filled.

virtual Point BoardLib::Shape::center (  )  const [pure virtual]

Returns the gravity center of the shape.

Returns:
The center of the shape.

Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.

virtual Shape& BoardLib::Shape::rotate ( double  angle,
const Point center 
) [pure virtual]

Rotate the shape around a given center of rotation.

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

Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.

virtual Shape& BoardLib::Shape::rotate ( double  angle  )  [pure virtual]

Rotate the shape around its center.

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

Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.

Shape & BoardLib::Shape::rotateDeg ( double  angle,
const Point center 
) [inline]

Rotate the shape around a given center of rotation.

Parameters:
angle The rotation angle in degree.
center The center of rotation.
Returns:
A reference to the shape itself.

Shape & BoardLib::Shape::rotateDeg ( double  angle  )  [inline]

Rotate the shape around its center.

Parameters:
angle The rotation angle in degree.
center The center of rotation.
Returns:
A reference to the shape itself.

virtual Shape& BoardLib::Shape::translate ( double  dx,
double  dy 
) [pure virtual]

Translate the shape by a given offset.

Parameters:
dx The x offset.
dy The y offset.
Returns:
A reference to the shape itself.

Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.

virtual Shape& BoardLib::Shape::scale ( double  sx,
double  sy 
) [pure virtual]

Scale the shape along the x an y axis.

Parameters:
sx The scale factor along the x axis.
sy The scale factor along the y axis.
Returns:
The shape itself.

Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.

virtual void BoardLib::Shape::flushPostscript ( std::ostream &  stream,
const TransformEPS transform 
) const [pure virtual]

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

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implemented in BoardLib::ShapeList, BoardLib::Group, BoardLib::Line, BoardLib::Arrow, BoardLib::Polyline, BoardLib::GouraudTriangle, BoardLib::Ellipse, and BoardLib::Text.

virtual void BoardLib::Shape::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< Color, int > &  colormap 
) const [pure virtual]

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

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implemented in BoardLib::ShapeList, BoardLib::Group, BoardLib::Line, BoardLib::Arrow, BoardLib::Polyline, BoardLib::Rectangle, BoardLib::GouraudTriangle, BoardLib::Ellipse, and BoardLib::Text.

virtual void BoardLib::Shape::flushSVG ( std::ostream &  stream,
const TransformSVG transform 
) const [pure virtual]

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

Parameters:
stream The output stream.
transform A 2D transform to be applied.

Implemented in BoardLib::ShapeList, BoardLib::Group, BoardLib::Line, BoardLib::Arrow, BoardLib::Polyline, BoardLib::Rectangle, BoardLib::GouraudTriangle, BoardLib::Ellipse, BoardLib::Circle, and BoardLib::Text.

virtual Rect BoardLib::Shape::boundingBox (  )  const [pure virtual]

Returns the bounding box of the figure.

Returns:
The rectangle of the bounding box.

Implemented in BoardLib::ShapeList, BoardLib::Line, BoardLib::Polyline, BoardLib::Ellipse, and BoardLib::Text.

std::string BoardLib::Shape::svgProperties ( const TransformSVG transform  )  const [protected]

Return a string of the svg properties lineWidth, opacity, penColor, fillColor, lineCap, and lineJoin.

Returns:
A string of the properties suitable for inclusion in an svg tag.

std::string BoardLib::Shape::postscriptProperties (  )  const [protected]

Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as Postscript commands.

Returns:
A string of the Postscript commands.


Member Data Documentation

int BoardLib::Shape::_depth [protected]

The depth of the shape.

Color BoardLib::Shape::_penColor [protected]

The color of the shape.

Color BoardLib::Shape::_fillColor [protected]

The color of the shape.

float BoardLib::Shape::_lineWidth [protected]

The line thickness.

LineCap BoardLib::Shape::_lineCap [protected]

The linecap attribute. (The way line terminates.)

LineJoin BoardLib::Shape::_lineJoin [protected]

The linejoin attribute. (The shape of line junctions.)


The documentation for this struct was generated from the following files:
Generated on Mon Dec 17 11:15:52 2007 for Board by  doxygen 1.5.3-20071008