Mercator
Public Member Functions | Private Attributes
Mercator::Area Class Reference

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

#include <Area.h>

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

List of all members.

Public Member Functions

 Area (int layer, bool hole)
 Constructor.
void setLayer (int layer, bool hole)
 Set the layer number and flag indicating whether this is a hole.
void setShape (const WFMath::Polygon< 2 > &p)
 Set the geometric shape of this area.
void setShader (const Shader *shader) const
bool contains (double x, double 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.

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.

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().

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().

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: