Overview

Attaching attributes to graphic objects

In JViews Maps, you can attach properties to IlvGraphic objects using the class IlvNamedProperty of the ilog.views package, thereby saving the properties in an .ivl 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 example attaches an IlvFeatureAttributeProperty object to an object of the IlvGraphic class:
IlvFeatureAttributeProperty attributes = feature.getAttributes();
graphic.setNamedProperty(attributes.copy());
Note that in this example, a copy of the attribute property is made. 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 IlvMapFeatureIterator interface.
To access the attributes that have been attached to a graphic object, you can use the following code:
IlvFeatureAttributeProperty attributes = (IlvFeatureAttributeProperty) 
  graphic.getNamedProperty(IlvFeatureAttributeProperty.NAME);
To save information specific to an application that cannot be saved using the predefined named properties supplied in the ilog.views.maps package, you can write specially named properties as explained in Advanced Features of JViews Framework .