Maps > Rogue Wave Views Maps Reader Framework > Map Features > Attaching Attributes to Graphic Objects
 
Attaching Attributes to Graphic Objects
In Rogue Wave® Views, you can attach properties to IlvGraphic objects using the class IlvNamedProperty, saving the properties in an .ilv file together with the related object.
The IlvFeatureAttributeProperty class, which stores all the attributes of a map feature inherits from the IlvNamedProperty class and can therefore be attached to any graphic object.
The following code sample attaches an IlvFeatureAttributeProperty object to an object of the IlvGraphic class:
const IlvFeatureAttributeProperty* attributeProperty;
attributeProperty = feature->getAttributes();
graphic->setNamedProperty(attributeProperty->copy());
Note that in this example, we have made a copy of the attribute property. The reason for this is that map features, along with their geometry and attributes, are volatile and get lost when another map feature is read. For more information about map feature volatility, see the section Overview of IlvMapFeatureIterator.
To access the attributes that have been attached to a graphic object, you can use the following code:
IlvNamedProperty* namedProperty;
const IlvSymbol* symbol = IlvFeatureAttributeProperty::GetName();
namedProperty = graphic->getNamedProperty(symbol);
To save information specific to an application that cannot be saved using the predefined named properties supplied in the maps package, you can write specially named properties as explained in the section Named Properties of the Rogue Wave Views Foundation User’s Manual.

Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.