VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
makVrv::DtBuoyBeaconModelStringParser Class Reference

The DtBuoyBeaconModelStringParser parses the buoy attributes found in the strings used by streamed buoy marker names. More...

Classes

struct  buoySymbols
 2D Icon methods More...
 

Public Types

typedef boost::unordered_map
< std::string, std::string > 
ParsedAttributeValueMap
 This type defines a map from attribute name to the value we parsed for it. More...
 
typedef boost::unordered_map
< std::string, std::string > 
ModelDefsByNameMap
 This type defines a map from a specific buoy name to the model definition requested for it. More...
 

Public Member Functions

virtual ~DtBuoyBeaconModelStringParser ()
 virtual DTOR More...
 
virtual bool readEnumMappingFile (const std::string &path, const std::string &enumMappingsFileName)
 Read the file that specifies the strings to use for each enumerated value for each attribute. More...
 
virtual bool readModelDefsByNameFile (const std::string &path, const std::string &modelDefsFileName)
 Read a file that lists model definitions that are to be used for specific buoys (indicated by the OBJNAM attribute) More...
 
virtual bool readDefaultsFile (const std::string &path, const std::string &defaultsFileName)
 Read a file that provides default names and model definitions for each feature class. More...
 
virtual void parse (const std::string &stringToParse)
 Break the string supplied with a streamed buoy into its component tokens and build the ParsedAttributeValueMap, replacing enumerated values with strings from the enumeration mapping file. More...
 
const std::string & attributeValue (const std::string &attrName) const
 Get the attribute value for the specified attribute name for the most recently parsed string. More...
 
const std::string & buildPattern () const
 Get the build pattern from the most recently parsed string. More...
 
const std::string & designator () const
 Get the designator string. More...
 
const std::string & defaultModelDefinition (const std::string &featureClass) const
 Get the default model definition for the specified feature class. More...
 
const std::string & defaultName (const std::string &featureClass) const
 Get the default name. More...
 
const ParsedAttributeValueMapresults () const
 Get the map of all attributes and associated values for the most recently parsed string. More...
 
const ModelDefsByNameMapmodelDefsByName () const
 Get the map of buoy name (OBJNAM attribute) / model definition pairs that indicate an explicit model definition to use for that buoy. More...
 

Protected Types

typedef boost::unordered_map
< std::string, std::vector
< std::string > > 
AttributeEnumerationMap
 This is what is read from the importConfig file - attribute names with a vector of strings for each enumerated value. More...
 
typedef boost::unordered_map
< std::string, std::string > 
DefaultMap
 
typedef boost::unordered_set
< std::string > 
DesignatorAcceptSet
 
typedef boost::unordered_map
< std::string, BuoySymbols
BuoyIconsByColorMap
 
typedef boost::unordered_map
< std::string, std::string > 
BeaconIconByColorMap
 

Protected Member Functions

 DtBuoyBeaconModelStringParser ()
 CTOR. More...
 
void getAttributeValue (const std::string &attr, const std::string &valueString)
 Given ATTRIBUTE=VALUE, find the value and place into the results map. More...
 
void createDesignatorString ()
 Generate the designator string. More...
 
void clearParseResultStrings ()
 Clear the results map in preparation for a new parse. More...
 

Protected Attributes

AttributeEnumerationMap myAttributeEnumerationMap
 
ParsedAttributeValueMap myAttributeValueResultsMap
 
ModelDefsByNameMap myModelDefsByNameMap
 
std::string myBuildPatternString
 
std::string myDesignatorString
 
DefaultMap myDefaultModelDefinitions
 
DefaultMap myDefaultNames
 
DesignatorAcceptSet myDesignatorAcceptSet
 
bool myIsMulticolored
 
BuoyIconsByColorMap myBuoyIconsByColorMap
 
BuoySymbols myBuoyMulticoloredIcons
 
BuoySymbols myBuoyDefaultIcons
 
BeaconIconByColorMap myBeaconIconByColorMap
 
std::string myBeaconLitIcon
 
std::string myBeaconUnnamedIcon
 
std::string myBeaconNamedIcon
 

Friends

class DtBuoyBeaconModelStringParserCreator
 Instances of DtBuoyBeaconModelStringParser must be created through the creator function. More...
 
typedef struct
makVrv::DtBuoyBeaconModelStringParser::buoySymbols 
BuoySymbols
 2D Icon methods More...
 
virtual bool readIconMappingFile (const std::string &path, const std::string &iconMappingFileName)
 Read a file that provides mappings from color and other attributes to model definitions for 2D icon symbols. More...
 
bool isMulticolored () const
 Get whether the buoy is multicolored. More...
 
BuoySymbols buoyIconsByColor (const std::string &color) const
 Get the icons to use for lit and unlit buoys by color. More...
 
BuoySymbols buoyMulticoloredIcons () const
 Get the icons to use for lit and unlit buoys that don't have a specific color mapping but are multicolored. More...
 
BuoySymbols buoyDefaultIcons () const
 Get the icons to use for lit and unlit buoys that don't meet the criteria for colored or multicolored. More...
 
std::string beaconLitIcon () const
 Get the icon used for all lit beacons. More...
 
std::string beaconIconByColor (const std::string &color) const
 Get the beacon icon to use defined by color (for unlit beacons) More...
 
std::string beaconUnnamedIcon () const
 Get the beacon icon to use for unlit beacons that aren't defined by color and are unnamed. More...
 
std::string beaconNamedIcon () const
 Get the beacon icon to use for unlit beacons that aren't defined by color and are named. More...
 

Detailed Description

The DtBuoyBeaconModelStringParser parses the buoy attributes found in the strings used by streamed buoy marker names.

The string is a ':' separated list; the first field is a pattern used to build a model definition based on substituting attributes values specified in square brackets. The subsequent fields provide the attribute/value pairs in the form ATTRIBUTE=VALUE. Value comes directly from an S-57 data (or a shape file extracted from S-57). These values may themselves be comma-separated lists of values. Further, they may be enumerations that need to be mapped to strings. This class reads a enumeration mapping file that it uses to substitute the enumerated values into the build pattern.

Example: The following is specified as the marker name in the .earth file: "Buoys[BOYSHP][COLOUR]"+ ":BOYSHP=" + [BOYSHP] + ":COLOUR=" + [COLOUR] When the marker is streamed in, osgEarth replaces [BOYSHP] and [COLOUR] with the attribute values in the S-57 or shape file, say 3, and 5 respectively. Then the resulting marker string is "Buoys[BOYSHP][COLOUR]:BOYSHP=3:COLOUR=5". The parser uses ""Buoys[BOYSHP][COLOUR]" as the build pattern. It looks up the strings indicated by the enumeration values ("Spherical" and "Blue" using the enumeration mapping file provided) and substitutes these into the build pattern to create the model definition "BuoysSphericalBlue".

A special string called the designator is created from the object name (OBJNAM) attribute if it is provided. Tae object name often ends with the alphanumeric marking that should appear on the buoy itself. If the last word of the object name is 3 characters or less and contains no lower case letters, it will be extracted as the designator, and can be added to a model definition by including "[DESIGNATOR]" in the build patterm

Member Typedef Documentation

typedef boost::unordered_map< std::string, std::string> makVrv::DtBuoyBeaconModelStringParser::ParsedAttributeValueMap

This type defines a map from attribute name to the value we parsed for it.

typedef boost::unordered_map< std::string, std::string> makVrv::DtBuoyBeaconModelStringParser::ModelDefsByNameMap

This type defines a map from a specific buoy name to the model definition requested for it.

2D Icon methods

Buoys have separate icons for lit and unlit. This struct holds both

typedef boost::unordered_map< std::string, std::vector<std::string> > makVrv::DtBuoyBeaconModelStringParser::AttributeEnumerationMap
protected

This is what is read from the importConfig file - attribute names with a vector of strings for each enumerated value.

typedef boost::unordered_map<std::string, std::string> makVrv::DtBuoyBeaconModelStringParser::DefaultMap
protected
typedef boost::unordered_set<std::string> makVrv::DtBuoyBeaconModelStringParser::DesignatorAcceptSet
protected
typedef boost::unordered_map< std::string, BuoySymbols> makVrv::DtBuoyBeaconModelStringParser::BuoyIconsByColorMap
protected
typedef boost::unordered_map< std::string, std::string> makVrv::DtBuoyBeaconModelStringParser::BeaconIconByColorMap
protected

Constructor & Destructor Documentation

virtual makVrv::DtBuoyBeaconModelStringParser::~DtBuoyBeaconModelStringParser ( )
virtual

virtual DTOR

makVrv::DtBuoyBeaconModelStringParser::DtBuoyBeaconModelStringParser ( )
protected

CTOR.

Member Function Documentation

virtual bool makVrv::DtBuoyBeaconModelStringParser::readEnumMappingFile ( const std::string &  path,
const std::string &  enumMappingsFileName 
)
virtual

Read the file that specifies the strings to use for each enumerated value for each attribute.

virtual bool makVrv::DtBuoyBeaconModelStringParser::readModelDefsByNameFile ( const std::string &  path,
const std::string &  modelDefsFileName 
)
virtual

Read a file that lists model definitions that are to be used for specific buoys (indicated by the OBJNAM attribute)

virtual bool makVrv::DtBuoyBeaconModelStringParser::readDefaultsFile ( const std::string &  path,
const std::string &  defaultsFileName 
)
virtual

Read a file that provides default names and model definitions for each feature class.

virtual void makVrv::DtBuoyBeaconModelStringParser::parse ( const std::string &  stringToParse)
virtual

Break the string supplied with a streamed buoy into its component tokens and build the ParsedAttributeValueMap, replacing enumerated values with strings from the enumeration mapping file.

const std::string& makVrv::DtBuoyBeaconModelStringParser::attributeValue ( const std::string &  attrName) const

Get the attribute value for the specified attribute name for the most recently parsed string.

const std::string& makVrv::DtBuoyBeaconModelStringParser::buildPattern ( ) const

Get the build pattern from the most recently parsed string.

const std::string& makVrv::DtBuoyBeaconModelStringParser::designator ( ) const

Get the designator string.

const std::string& makVrv::DtBuoyBeaconModelStringParser::defaultModelDefinition ( const std::string &  featureClass) const

Get the default model definition for the specified feature class.

const std::string& makVrv::DtBuoyBeaconModelStringParser::defaultName ( const std::string &  featureClass) const

Get the default name.

const ParsedAttributeValueMap& makVrv::DtBuoyBeaconModelStringParser::results ( ) const

Get the map of all attributes and associated values for the most recently parsed string.

const ModelDefsByNameMap& makVrv::DtBuoyBeaconModelStringParser::modelDefsByName ( ) const

Get the map of buoy name (OBJNAM attribute) / model definition pairs that indicate an explicit model definition to use for that buoy.

virtual bool makVrv::DtBuoyBeaconModelStringParser::readIconMappingFile ( const std::string &  path,
const std::string &  iconMappingFileName 
)
virtual

Read a file that provides mappings from color and other attributes to model definitions for 2D icon symbols.

bool makVrv::DtBuoyBeaconModelStringParser::isMulticolored ( ) const

Get whether the buoy is multicolored.

BuoySymbols makVrv::DtBuoyBeaconModelStringParser::buoyIconsByColor ( const std::string &  color) const

Get the icons to use for lit and unlit buoys by color.

BuoySymbols makVrv::DtBuoyBeaconModelStringParser::buoyMulticoloredIcons ( ) const

Get the icons to use for lit and unlit buoys that don't have a specific color mapping but are multicolored.

BuoySymbols makVrv::DtBuoyBeaconModelStringParser::buoyDefaultIcons ( ) const

Get the icons to use for lit and unlit buoys that don't meet the criteria for colored or multicolored.

std::string makVrv::DtBuoyBeaconModelStringParser::beaconLitIcon ( ) const

Get the icon used for all lit beacons.

std::string makVrv::DtBuoyBeaconModelStringParser::beaconIconByColor ( const std::string &  color) const

Get the beacon icon to use defined by color (for unlit beacons)

std::string makVrv::DtBuoyBeaconModelStringParser::beaconUnnamedIcon ( ) const

Get the beacon icon to use for unlit beacons that aren't defined by color and are unnamed.

std::string makVrv::DtBuoyBeaconModelStringParser::beaconNamedIcon ( ) const

Get the beacon icon to use for unlit beacons that aren't defined by color and are named.

void makVrv::DtBuoyBeaconModelStringParser::getAttributeValue ( const std::string &  attr,
const std::string &  valueString 
)
protected

Given ATTRIBUTE=VALUE, find the value and place into the results map.

void makVrv::DtBuoyBeaconModelStringParser::createDesignatorString ( )
protected

Generate the designator string.

void makVrv::DtBuoyBeaconModelStringParser::clearParseResultStrings ( )
protected

Clear the results map in preparation for a new parse.

Friends And Related Function Documentation

Instances of DtBuoyBeaconModelStringParser must be created through the creator function.

Member Data Documentation

AttributeEnumerationMap makVrv::DtBuoyBeaconModelStringParser::myAttributeEnumerationMap
protected
ParsedAttributeValueMap makVrv::DtBuoyBeaconModelStringParser::myAttributeValueResultsMap
protected
ModelDefsByNameMap makVrv::DtBuoyBeaconModelStringParser::myModelDefsByNameMap
protected
std::string makVrv::DtBuoyBeaconModelStringParser::myBuildPatternString
protected
std::string makVrv::DtBuoyBeaconModelStringParser::myDesignatorString
protected
DefaultMap makVrv::DtBuoyBeaconModelStringParser::myDefaultModelDefinitions
protected
DefaultMap makVrv::DtBuoyBeaconModelStringParser::myDefaultNames
protected
DesignatorAcceptSet makVrv::DtBuoyBeaconModelStringParser::myDesignatorAcceptSet
protected
bool makVrv::DtBuoyBeaconModelStringParser::myIsMulticolored
protected
BuoyIconsByColorMap makVrv::DtBuoyBeaconModelStringParser::myBuoyIconsByColorMap
protected
BuoySymbols makVrv::DtBuoyBeaconModelStringParser::myBuoyMulticoloredIcons
protected
BuoySymbols makVrv::DtBuoyBeaconModelStringParser::myBuoyDefaultIcons
protected
BeaconIconByColorMap makVrv::DtBuoyBeaconModelStringParser::myBeaconIconByColorMap
protected
std::string makVrv::DtBuoyBeaconModelStringParser::myBeaconLitIcon
protected
std::string makVrv::DtBuoyBeaconModelStringParser::myBeaconUnnamedIcon
protected
std::string makVrv::DtBuoyBeaconModelStringParser::myBeaconNamedIcon
protected

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

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)