LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::fillPattern Class Reference

Fill pattern class. More...

#include <ltiGraphicsPattern.h>

Inheritance diagram for lti::fillPattern:
Inheritance graph
[legend]
Collaboration diagram for lti::fillPattern:
Collaboration graph
[legend]

List of all members.

Public Types

enum  contourType
typedef std::list< const
basicObject * > 
objectList

Public Member Functions

 fillPattern ()
 fillPattern (const fillPattern &other)
 fillPattern (const basicObject &base, contourType type, float scale=1.0)
virtual ~fillPattern ()
void add (const basicObject &o)
template<class T >
void setMask (const matrix< T > &m)
bool isSet (int x, int y)
bool isSet (const point &p)
const objectListgetObjects () const
virtual rectangle getBoundingBox () const
fillPatterncopy (const fillPattern &other)
fillPatternoperator= (const fillPattern &other)
virtual objectclone () const
virtual void clear ()
virtual bool write (ioHandler &handler, const bool complete=true) const
virtual bool read (ioHandler &handler, const bool complete=true)

Static Public Member Functions

static fillPatterncreateHatching (int dx, int dy, int w)

Protected Member Functions

void updateMask ()
template<class T >
void drawObject (matrix< T > &pane, const internalObject &p)

Detailed Description

Fill pattern class.

A fill pattern is defined by a set of graphical primitives. At present, the only supported primitives are borderPoints, areaPoints, and polygonPoints.


Member Typedef Documentation

typedef std::list<const basicObject*> lti::fillPattern::objectList

The representation of a mask in vector form.

The list contains pointers to point list objects (maybe different subtypes of pointlist). Once added to the mask, the objects must not be modified.


Member Enumeration Documentation

The type of mask objects that should be used.

At present, only polygon is supported.


Constructor & Destructor Documentation

lti::fillPattern::fillPattern (  ) 

Default constructor.

This will create a homogeneous area.

lti::fillPattern::fillPattern ( const fillPattern other  ) 

Copy constructor.

lti::fillPattern::fillPattern ( const basicObject base,
contourType  type,
float  scale = 1.0 
)

Constructor.

The given pointList is cast to the type given as argument.

Parameters:
base the base object of the pattern.
type the type of created contour. If you choose, e.g. Polygon, then all objects that are added get converted to polygons.
scale 
virtual lti::fillPattern::~fillPattern (  )  [virtual]

Destructor.


Member Function Documentation

void lti::fillPattern::add ( const basicObject o  ) 

Adds a contour to the pattern.

The given contour gets converted to the type defined in the constructor.

virtual void lti::fillPattern::clear (  )  [virtual]

Resets this pattern to its default state.

Implements lti::graphicsPattern.

virtual object* lti::fillPattern::clone (  )  const [virtual]

create a clone of this basicObject

Returns:
a pointer to a copy of this basicObject

Implements lti::graphicsPattern.

fillPattern& lti::fillPattern::copy ( const fillPattern other  ) 

assigment operator.

copy the contents of other in this object.

Parameters:
other the source basicObject to be copied.

Reimplemented from lti::graphicsPattern.

Referenced by operator=().

static fillPattern* lti::fillPattern::createHatching ( int  dx,
int  dy,
int  w 
) [static]

Static method to create a hatch pattern.

dx and dy determine two things: The width and height of the returned pattern, and also the slope of the lines. There is only one line per pattern. Examples:

 createHatching(2,2,1);

will create a hatching that looks about:

  *
 *

whereas

 createHatching(2,-2,1);

will create a hatching that looks like:

 *
  *

A more complex example:

 createHatching(16,4,2);
         ********
     ********
 ********
 ****        ****
template<class T >
void lti::fillPattern::drawObject ( matrix< T > &  pane,
const internalObject p 
) [inline, protected]

Draws a filled polygon into the given mask.

virtual rectangle lti::fillPattern::getBoundingBox (  )  const [virtual]

Returns the bounding box of this pattern.

Implements lti::graphicsPattern.

const objectList& lti::fillPattern::getObjects (  )  const [inline]

Returns the list of objects that constitute the pattern.

bool lti::fillPattern::isSet ( const point p  )  [inline]

Returns true if the given point is allowed by this pattern mask.

References isSet(), lti::tpoint< T >::x, and lti::tpoint< T >::y.

bool lti::fillPattern::isSet ( int  x,
int  y 
) [inline]

Returns true if the given point is allowed by this pattern mask.

References lti::genericMatrix< T >::at(), lti::tpoint< T >::x, and lti::tpoint< T >::y.

Referenced by isSet().

fillPattern& lti::fillPattern::operator= ( const fillPattern other  )  [inline]

assigment operator (alias for copy(other)).

Parameters:
other the basicObject to be copied
Returns:
a reference to the actual basicObject

Reimplemented from lti::graphicsPattern.

References copy().

virtual bool lti::fillPattern::read ( ioHandler handler,
const bool  complete = true 
) [virtual]

read the pattern from the given ioHandler

Reimplemented from lti::graphicsPattern.

template<class T >
void lti::fillPattern::setMask ( const matrix< T > &  m  )  [inline]

Sets the pattern mask explicitly.

The mask is only used for pixel-based drawing where the vector format usually yields crap.

References lti::matrix< T >::castFrom(), and lti::genericMatrix< T >::size().

void lti::fillPattern::updateMask (  )  [protected]

Updates the pixel mask from the list of mask objects.

Also recomputes the bounding box.

virtual bool lti::fillPattern::write ( ioHandler handler,
const bool  complete = true 
) const [virtual]

write the pattern to the given ioHandler

Reimplemented from lti::graphicsPattern.


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

Generated on Sat Apr 10 15:27:23 2010 for LTI-Lib by Doxygen 1.6.1