MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLFeature Class Reference

Detailed Description

The definition of a MapLink feature, for use with TSLFeatureList and TSLFeatureClassConfig classes.

A feature is defined by a feature name. For each TSLFeature instance this will be a singular string such as 'roads' or 'motorways'. Some methods on TSLFeature and the TSLFeatureList will allow hierarchical names such as 'roads.motorways'. In this example the parent feature called 'roads' has a child feature called 'motorways'.

Each TSLFeature contains an instance of TSLRenderingAttributes. These attributes will be used by the TSLFeatureClassConfig when styling data. Rendering attributes will be inherited by a feature's children, however they may be overridden by the child's rendering attributes if specified.

See also
TSLFeatureClassConfig
TSLFeatureList

Public Member Functions

 TSLFeature ()
 Default Constructor.
 
 TSLFeature (const char *name, const char *product=NULL)
 
 TSLFeature (const char *name, const TSLRenderingAttributes &renderingAttributes, const char *product=NULL)
 
 TSLFeature (const TSLFeature &other)
 
void destroy ()
 Delete this feature.
 
TSLRenderingAttributesrendering ()
 
const TSLRenderingAttributesgetRendering () const
 
void setRendering (const TSLRenderingAttributes &attribs)
 
void getRenderingIncludingParent (TSLRenderingAttributes &attribs) const
 
void clearRendering ()
 Clear the rendering attributes of this feature.
 
unsigned int numAttributes () const
 
const char * getAttribute (unsigned int index) const
 
void addAttribute (const char *attributeName)
 
bool removeAttribute (unsigned int index)
 
bool removeAttribute (const char *attributeName)
 
const char * getTextLabelAttribute () const
 
void setTextLabelAttribute (const char *attributeName)
 
TSLFeatureparent () const
 
unsigned int numChildren () const
 
void addChild (TSLFeature *child)
 
TSLFeaturegetChild (unsigned int index) const
 
TSLFeaturegetChild (const char *featureName, bool caseSensitive=false) const
 
bool removeChild (unsigned int index)
 
bool removeChild (const char *featureName, bool caseSensitive=false)
 
bool renameChild (const char *featureName, const char *newFeatureName, bool caseSensitive=false)
 
const char * getName () const
 Query the name of this feature.
 
void getFullName (TSLSimpleString &name) const
 
bool setName (const char *name)
 
const char * getProduct () const
 
void setProduct (const char *product)
 
TSLFeatureListfeatureList () const
 
void * operator new (size_t size) TSL_NO_THROW
 
void * operator new (size_t size, char *filename, int line)
 

Constructor & Destructor Documentation

◆ TSLFeature() [1/4]

TSLFeature::TSLFeature ( )

Default Constructor.

◆ TSLFeature() [2/4]

TSLFeature::TSLFeature ( const char * name,
const char * product = NULL )

Constructor.

Parameters
nameThe name of this feature, not including any parent features.
productThe product specification of the feature.

◆ TSLFeature() [3/4]

TSLFeature::TSLFeature ( const char * name,
const TSLRenderingAttributes & renderingAttributes,
const char * product = NULL )

Constructor.

Parameters
nameThe name of this feature, not including any prefixes or parents.
renderingAttributesThe rendering attributes for this feature.
productThe product specification of the feature.

◆ TSLFeature() [4/4]

TSLFeature::TSLFeature ( const TSLFeature & other)

Copy constructor.

Note
The parent of the other feature will not be copied. If a non-root feature is copied a standalone sub-set of the feature hierarchy will be created.

Member Function Documentation

◆ addAttribute()

void TSLFeature::addAttribute ( const char * attributeName)

Add an attribute definition to this feature.

This function will silently fail if the attribute name already exists.

Parameters
attributeNameThe name of the attribute.

◆ addChild()

void TSLFeature::addChild ( TSLFeature * child)

Add a child feature.

This feature will take ownership of the provided child feature. The application must not delete the child once this method has been called.

Parameters
childThe child feature to add.

◆ clearRendering()

void TSLFeature::clearRendering ( )

Clear the rendering attributes of this feature.

◆ destroy()

void TSLFeature::destroy ( )

Delete this feature.

◆ featureList()

TSLFeatureList * TSLFeature::featureList ( ) const

Query the feature list containing this feature.

Returns
The feature list which contains this feature, or null if the feature is not contained within a feature list.

◆ getAttribute()

const char * TSLFeature::getAttribute ( unsigned int index) const

Query an attribute name.

Parameters
indexThe index of the attribute.
Returns
The name of the attribute at index, or null on error.

◆ getChild() [1/2]

TSLFeature * TSLFeature::getChild ( const char * featureName,
bool caseSensitive = false ) const

Query a child feature.

The provided feature name may be a direct child of this feature, or a feature within the hierarchy.

Parameters
featureNameThe name of the child to query.
caseSensitiveWhether the string comparison should be case sensitive or not.
Returns
The requested child, or null if the child could not be located.

◆ getChild() [2/2]

TSLFeature * TSLFeature::getChild ( unsigned int index) const

Query a child feature.

The returned feature may be modified, but must not be deleted by the application.

Parameters
indexThe index of the child.
Returns
The child at index, or null on error.

◆ getFullName()

void TSLFeature::getFullName ( TSLSimpleString & name) const

Query the full name of this feature, including any parents.

The returned name will be the full hierarchical name of the feature, including all parent features, separated by '.'.

The returned name will not include the feature section.

If this feature has no parent this will return the same as getName.

Parameters
nameThe string (TSLSimpleString) will be populated with the full hierarchical name of this feature.

◆ getName()

const char * TSLFeature::getName ( ) const

Query the name of this feature.

◆ getProduct()

const char * TSLFeature::getProduct ( ) const

Query this feature's product specification.

This string represents a product specification, or feature book section in MapLink Studio. This allows the feature to be marked as part of a product, to avoid collisions with otherwise identical features. This product name will be used when processing the data through TSLFeatureClassConfig::getProcessedFeatureList and TSLFeatureClassConfig::processGeometry.

If this feature has a parent then the parent's section will be returned.

Returns
The product specification of this feature.

◆ getRendering()

const TSLRenderingAttributes & TSLFeature::getRendering ( ) const

Query the rendering attributes of this feature.

These rendering attributes do not include those inherited from parent features.

Returns
A reference to the rendering attributes (TSLRenderingAttributes) of this feature.

◆ getRenderingIncludingParent()

void TSLFeature::getRenderingIncludingParent ( TSLRenderingAttributes & attribs) const

Query the effective rendering attributes of this feature, including those inherited from parent features.

Any rendering attributes which are not defined for this feature, but defined for the parent feature, will be inherited from the parent.

Parameters
attribsWill be set to the effective rendering attributes of this feature.

◆ getTextLabelAttribute()

const char * TSLFeature::getTextLabelAttribute ( ) const

Query the name of the attribute to display as a text label.

This value may be inherited from a parent feature.

Returns
The label as a string. If the label for this attribute is empty, returns the label for the parent (if any), otherwise null.

◆ numAttributes()

unsigned int TSLFeature::numAttributes ( ) const

Query the number of attributes defined for this feature.

Returns
The number of attributes defined.

◆ numChildren()

unsigned int TSLFeature::numChildren ( ) const

Query the number of child features under this feature.

Returns
The number of child features.

◆ operator new() [1/2]

void * TSLFeature::operator new ( size_t size)

◆ operator new() [2/2]

void * TSLFeature::operator new ( size_t size,
char * filename,
int line )

◆ parent()

TSLFeature * TSLFeature::parent ( ) const

Query the parent of this feature.

Returns
The parent feature, or null if this feature has no parent.

◆ removeAttribute() [1/2]

bool TSLFeature::removeAttribute ( const char * attributeName)

Remove an attribute definition from this feature.

Parameters
attributeNameThe name of the attribute.
Returns
true if the attribute was removed, false otherwise.

◆ removeAttribute() [2/2]

bool TSLFeature::removeAttribute ( unsigned int index)

Remove an attribute definition from this feature.

Parameters
indexThe index of the attribute.
Returns
true if the attribute was removed, false otherwise.

◆ removeChild() [1/2]

bool TSLFeature::removeChild ( const char * featureName,
bool caseSensitive = false )

Remove a child feature.

The provided feature name may be a direct child of this feature, or a feature within the hierarchy.

Parameters
featureNameThe name of the child to remove.
caseSensitiveWhether the string comparison should be case sensitive or not.
Returns
true if the child was removed, false otherwise.

◆ removeChild() [2/2]

bool TSLFeature::removeChild ( unsigned int index)

Remove a child feature.

Parameters
indexThe index of the child to remove.
Returns
true if the child was removed, false otherwise.

◆ renameChild()

bool TSLFeature::renameChild ( const char * featureName,
const char * newFeatureName,
bool caseSensitive = false )

Rename a child feature.

Parameters
featureNameThe name of the child to rename.
newFeatureNameThe new name for the child.
caseSensitiveWhether the string comparison should be case sensitive or not.
Returns
true if the child was renamed, false otherwise.

◆ rendering()

TSLRenderingAttributes & TSLFeature::rendering ( )

Access the rendering attributes of this feature.

These rendering attributes may be modified, but they do not include those inherited from parent features.

Returns
A reference to this feature's rendering attributes.

◆ setName()

bool TSLFeature::setName ( const char * name)

Set the name of this feature.

This name does not include any prefixes or parent feature names. Any '.' in the provided name will be replaced with '_'.

If this feature is contained within a TSLFeatureList it may only be renamed by calling TSLFeatureList::renameFeature.

Parameters
nameThe new name of the feature.
Returns
true if the name was set, false otherwise.

◆ setProduct()

void TSLFeature::setProduct ( const char * product)

Set this feature's product specification.

Note
If this feature has a parent with a different product, this setting will be ignored.
Parameters
productThe product specification to assign this feature to.

◆ setRendering()

void TSLFeature::setRendering ( const TSLRenderingAttributes & attribs)

Set the rendering attributes of this feature.

Parameters
attribsThe new rendering attributes (TSLRenderingAttributes) for this feature.

◆ setTextLabelAttribute()

void TSLFeature::setTextLabelAttribute ( const char * attributeName)

Set the attribute to display as a text label.

When this feature is processed the value of this attribute will be added to any displayed data as a textual entity. Rendering attributes for this entity will be taken from this feature's rendering attributes.

This setting will be inherited by any child features.

Parameters
attributeNameA string containing the attribute name.