Mercator
Public Member Functions | Private Attributes | List of all members
Mercator::Area Class Reference

Region of terrain surface which is modified. More...

#include <Area.h>

Inheritance diagram for Mercator::Area:
Mercator::Effector

Public Member Functions

 Area (int layer, bool hole)
 Constructor. More...
 
void setLayer (int layer, bool hole)
 Set the layer number and flag indicating whether this is a hole. More...
 
void setShape (const WFMath::Polygon< 2 > &p)
 Set the geometric shape of this area.
 
void setShader (const Shader *shader) const
 
bool contains (WFMath::CoordType x, WFMath::CoordType y) const
 Determine if a point is contained by the shape of this area.
 
int getLayer () const
 Accessor for the layer number.
 
bool isHole () const
 Accessor for the flag indicating whether this is a hole.
 
const WFMath::Polygon< 2 > & shape () const
 Accessor for the geometric shape.
 
const ShadergetShader () const
 
int addToSegment (Segment &) const
 
void updateToSegment (Segment &) const
 
void removeFromSegment (Segment &) const
 
bool checkIntersects (const Segment &s) const
 
WFMath::Polygon< 2 > clipToSegment (const Segment &s) const
 Clip the shape of this area to a given segment. More...
 
- Public Member Functions inherited from Mercator::Effector
Contextcontext () const
 
void setContext (Context *)
 
const WFMath::AxisBox< 2 > & bbox () const
 Accessor for the bounding box of the geometric shape.
 

Private Attributes

int m_layer
 The layer number.
 
bool m_hole
 A flag indicating whether this is a hole.
 
WFMath::Polygon< 2 > m_shape
 The geometric shape.
 
const Shaderm_shader
 Shader that shades this area.
 

Additional Inherited Members

- Protected Member Functions inherited from Mercator::Effector
 Effector ()
 Constructor.
 
 Effector (const Effector &)
 Copy constructor.
 
Effectoroperator= (const Effector &)
 Assignment.
 
- Protected Attributes inherited from Mercator::Effector
WFMath::AxisBox< 2 > m_box
 The bounding box of the geometric shape.
 
Contextm_context
 The application context of this effector.
 

Detailed Description

Region of terrain surface which is modified.

Objects of this class describe regions of the surface which have been changed. Which layers of the shaded terrain is affected by their layer number. For example, if they are below the snow layer then the snow shader will cover them where the area affected by snow intersects with the area, but the lower grass area will be overriden. In order to get the best effect it is important to select the layer carefully.

Constructor & Destructor Documentation

Mercator::Area::Area ( int  layer,
bool  hole 
)

Constructor.

Parameters
layerlayer number.
holeflag indicating whether this is a hole.

Member Function Documentation

bool Mercator::Area::checkIntersects ( const Segment s) const
virtual

Test if a segment intersects this area

Implements Mercator::Effector.

References Mercator::Segment::getRect(), and m_shape.

Referenced by clipToSegment(), contains(), and shape().

WFMath::Polygon< 2 > Mercator::Area::clipToSegment ( const Segment s) const

Clip the shape of this area to a given segment.

Determines the intersection of the geometric shape of this area with a square terrain segment, and returns the intersection as a geometric shape.

Parameters
sthe segment that the shape should be clipped to.
Returns
the shape of the intersection of this area with the segment.

References checkIntersects(), Mercator::Segment::getRect(), and m_shape.

Referenced by Mercator::AreaShader::shadeArea(), and shape().

void Mercator::Area::setLayer ( int  layer,
bool  hole 
)

Set the layer number and flag indicating whether this is a hole.

Parameters
layerlayer number.
holeflag indicating whether this is a hole.

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