Mercator
|
Region of terrain surface which is modified. More...
#include <Area.h>
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 Shader * | getShader () 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... | |
![]() | |
Context * | context () 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 Shader * | m_shader |
Shader that shades this area. | |
Additional Inherited Members | |
![]() | |
Effector () | |
Constructor. | |
Effector (const Effector &) | |
Copy constructor. | |
Effector & | operator= (const Effector &) |
Assignment. | |
![]() | |
WFMath::AxisBox< 2 > | m_box |
The bounding box of the geometric shape. | |
Context * | m_context |
The application context of this effector. | |
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.
Mercator::Area::Area | ( | int | layer, |
bool | hole | ||
) |
Constructor.
layer | layer number. |
hole | flag indicating whether this is a hole. |
|
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.
s | the segment that the shape should be clipped to. |
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.
layer | layer number. |
hole | flag indicating whether this is a hole. |