#include <Area.h>
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. | |
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::AxisBox< 2 > & | bbox () const |
Accessor for the bounding box of the geometric shape. | |
const WFMath::Polygon< 2 > & | shape () const |
Accessor for the geometric shape. | |
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. | |
WFMath::AxisBox< 2 > | m_box |
The bounding box of the geometric shape. |
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. |
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. |
bool Mercator::Area::checkIntersects | ( | const Segment & | s | ) | const |
Test if a segment intersects this area
References Mercator::Segment::getRect(), and m_shape.
Referenced by Mercator::Terrain::addArea(), clipToSegment(), Mercator::Terrain::removeArea(), and Mercator::Terrain::updateArea().
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().