mercator 0.4.0
A terrain generation library for the Worldforge system.
Mercator::Area Class Reference

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

#include <Area.h>

Inheritance diagram for Mercator::Area:
Collaboration diagram for Mercator::Area:

Public Member Functions

 Area (int layer, bool hole)
 Constructor. More...
 
void setShape (const WFMath::Polygon< 2 > &p)
 Set the geometric shape of this area. More...
 
bool contains (WFMath::CoordType x, WFMath::CoordType z) const
 Determine if a point is contained by the shape of this area. More...
 
int getLayer () const
 Accessor for the layer number. More...
 
bool isHole () const
 Accessor for the flag indicating whether this is a hole. More...
 
const WFMath::Polygon< 2 > & shape () const
 Accessor for the geometric shape. More...
 
bool checkIntersects (const Segment &s) const override
 
WFMath::Polygon< 2 > clipToSegment (const Segment &s) const
 Clip the shape of this area to a given segment. More...
 
Contextcontext () const
 
void setContext (std::unique_ptr< Context > context)
 
const WFMath::AxisBox< 2 > & bbox () const
 Accessor for the bounding box of the geometric shape. More...
 

Protected Attributes

WFMath::AxisBox< 2 > m_box
 The bounding box of the geometric shape. More...
 
std::unique_ptr< Contextm_context
 The application context of this effector. More...
 

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.

Definition at line 28 of file Area.h.

Constructor & Destructor Documentation

◆ Area()

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

Constructor.

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

Definition at line 224 of file Area.cpp.

Member Function Documentation

◆ bbox()

const WFMath::AxisBox< 2 > & Mercator::Effector::bbox ( ) const
inlineinherited

Accessor for the bounding box of the geometric shape.

Definition at line 37 of file Effector.h.

References Mercator::Effector::m_box.

Referenced by Mercator::Forest::populate().

◆ checkIntersects()

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

Test if a segment intersects this area

Implements Mercator::Effector.

Definition at line 259 of file Area.cpp.

References Mercator::Segment::getRect().

Referenced by clipToSegment().

◆ 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.

Definition at line 244 of file Area.cpp.

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

◆ contains()

bool Mercator::Area::contains ( WFMath::CoordType  x,
WFMath::CoordType  z 
) const

Determine if a point is contained by the shape of this area.

Definition at line 237 of file Area.cpp.

References Mercator::Effector::m_box.

Referenced by Mercator::Forest::populate().

◆ context()

Context * Mercator::Effector::context ( ) const
inlineinherited

Definition at line 32 of file Effector.h.

◆ getLayer()

int Mercator::Area::getLayer ( ) const
inline

Accessor for the layer number.

Definition at line 44 of file Area.h.

◆ isHole()

bool Mercator::Area::isHole ( ) const
inline

Accessor for the flag indicating whether this is a hole.

Definition at line 50 of file Area.h.

◆ setContext()

void Mercator::Effector::setContext ( std::unique_ptr< Context context)
inherited

Definition at line 12 of file Effector.cpp.

◆ setShape()

void Mercator::Area::setShape ( const WFMath::Polygon< 2 > &  p)

Set the geometric shape of this area.

Definition at line 230 of file Area.cpp.

References Mercator::Effector::m_box.

◆ shape()

const WFMath::Polygon< 2 > & Mercator::Area::shape ( ) const
inline

Accessor for the geometric shape.

Definition at line 56 of file Area.h.

Member Data Documentation

◆ m_box

WFMath::AxisBox<2> Mercator::Effector::m_box
protectedinherited

The bounding box of the geometric shape.

Definition at line 57 of file Effector.h.

Referenced by Mercator::Effector::bbox(), contains(), Mercator::Effector::operator=(), setShape(), and Mercator::ShapeTerrainMod< Shape >::ShapeTerrainMod().

◆ m_context

std::unique_ptr<Context> Mercator::Effector::m_context
protectedinherited

The application context of this effector.

Definition at line 60 of file Effector.h.

Referenced by Mercator::Effector::operator=().


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