#include <TerrainMod.h>
Public Member Functions | |
virtual | ~InnerTerrainMod () |
Dtor. | |
const std::string & | getTypename () const |
Gets the type of terrain mod handled by this. | |
virtual bool | parseAtlasData (const Atlas::Message::MapType &modElement)=0 |
Tries to parse the Atlas data. | |
virtual Mercator::TerrainMod * | getModifier ()=0 |
Accessor for the Mercator::TerrainMod created and held by this instance. | |
Protected Member Functions | |
InnerTerrainMod (TerrainMod &terrainMod, const std::string &typemod) | |
Ctor. | |
const std::string & | parseShape (const Atlas::Message::MapType &modElement, const Atlas::Message::Element **shapeMap) |
Parses the atlas data of the modifiers, finding the base atlas element for the shape definition, and returning the kind of shape specified. | |
WFMath::Point< 3 > | parsePosition (const Atlas::Message::MapType &modElement) |
Parses the position of the mod. | |
Protected Attributes | |
std::string | mTypeName |
The type of mod this instance handles. | |
TerrainMod & | mTerrainMod |
The TerrainMod instance to which this instance belongs. |
Eris::InnerTerrainMod::InnerTerrainMod | ( | TerrainMod & | terrainMod, | |
const std::string & | typemod | |||
) | [protected] |
Ctor.
This is protected to prevent any other class than subclasses of this to call it.
terrainMod | The TerrainMod instance to which this instance belongs to. | |
typemod | The type of terrainmod this handles, such as "cratermod" or "slopemod. This will be stored in mTypeName. |
virtual Mercator::TerrainMod* Eris::InnerTerrainMod::getModifier | ( | ) | [pure virtual] |
Accessor for the Mercator::TerrainMod created and held by this instance.
If no terrain mod could be created, such as with faulty Atlas data, or if parseAtlasData() hasn't been called yet, this will return a null pointer.
Implemented in Eris::InnerTerrainModSlope, Eris::InnerTerrainModCrater, Eris::InnerTerrainModLevel, and Eris::InnerTerrainModAdjust.
Referenced by Eris::TerrainMod::getMod().
const std::string & Eris::InnerTerrainMod::getTypename | ( | ) | const |
Gets the type of terrain mod handled by this.
This corresponds to the "type" attribute of the "terrainmod" atlas attribute, for example "cratermod" or "slopemod". Internally, it's stored in the mTypeName field, as set through the constructor.
References mTypeName.
virtual bool Eris::InnerTerrainMod::parseAtlasData | ( | const Atlas::Message::MapType & | modElement | ) | [pure virtual] |
Tries to parse the Atlas data.
It's up to the specific subclasses to provide proper parsing of the data depending on their needs. If the data is successfully parsed, a new Mercator::TerrainMod instance will be created.
modElement | The Atlas element describing the terrainmod. This should in most instances correspond directly to the "terrainmod" element found in the root atlas attribute map. |
Implemented in Eris::InnerTerrainModSlope, Eris::InnerTerrainModCrater, Eris::InnerTerrainModLevel, and Eris::InnerTerrainModAdjust.
Referenced by Eris::TerrainMod::parseMod().
WFMath::Point< 3 > Eris::InnerTerrainMod::parsePosition | ( | const Atlas::Message::MapType & | modElement | ) | [protected] |
Parses the position of the mod.
If no height data is given the height of the entity the mod belongs to will be used. If however a "height" value is set, that will be used instead. If no "height" value is set, but a "heightoffset" is present, that value will be added to the height set by the position of the entity the mod belongs to.
modElement | The top mod element. |
If the height is specified use that, else check for a height offset. If none is found, use the default height of the entity position
References Eris::TerrainMod::getEntity(), Eris::Entity::getPosition(), and mTerrainMod.
Referenced by Eris::InnerTerrainModLevel::parseAtlasData(), Eris::InnerTerrainModSlope::parseAtlasData(), and Eris::InnerTerrainModCrater::parseAtlasData().
const std::string & Eris::InnerTerrainMod::parseShape | ( | const Atlas::Message::MapType & | modElement, | |
const Atlas::Message::Element ** | shapeMap | |||
) | [protected] |
Parses the atlas data of the modifiers, finding the base atlas element for the shape definition, and returning the kind of shape specified.
This is an utility method to help with those many cases where we need to parse the shape data in order to determine the kind of shape. The actual parsing and creation of the shape happens in InnerTerrainMod_impl however, since that depends on templated calls. However, in order to know what kind of template to use we must first look at the type of shape, thus the need for this method.
modElement | The atlas element containing the modifier. | |
shapeMap | A shape data is found, and it's in the map form, it will be put here. |
Referenced by Eris::InnerTerrainModAdjust::parseAtlasData(), Eris::InnerTerrainModLevel::parseAtlasData(), Eris::InnerTerrainModSlope::parseAtlasData(), and Eris::InnerTerrainModCrater::parseAtlasData().
std::string Eris::InnerTerrainMod::mTypeName [protected] |