|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface IlvMapAttributeFilter
The IlvMapAttributeFilter interface represents a filter used
to dynamically change attribute values.
The following code example shows how to implement this interface:
class ColorAttributeFilter implements IlvMapAttributeFilter {
public ColorAttributeFilter() {
// need a public constructor .
}
public ColorAttributeFilter(IlvInputStream stream) {
// need a public constructor with IlvInputStream.
}
Color convertObjectToColor(Object o) {
if(o == null)
return Color.white;
return new Color(o.hashCode());
}
Color computeColorFrom(IlvGraphic g) {
IlvAttributeProperty p = (IlvAttributeProperty) g.getNamedProperty(IlvAttributeProperty.NAME);
if(p == null)
return null;
Object o = p.getValue("VALUE");
return convertObjectToColor(o);
}
public Object get(IlvGraphic g, String attributeName) {
if(IlvPolylineStyle.FOREGROUND.equals(attributeName)) {
Color ret = computeColorFrom(g);
if(ret == null)
return DEFAULT_VALUE;
return ret;
}
return DEFAULT_VALUE;
}
public void write(IlvOutputStream stream) throws IOException {
// implements IlvPersistentObject
}
}
The following code example shows how use your implementation to filter the
color attributes in the IlvMapStyle for an
IlvMapLayer.
IlvMapLayer layer = getLayer(); lvMapStyle style = layer.getStyle(); style.setAttributeFilter(new ColorAttributeFilter());
| Field Summary | |
|---|---|
static Object |
DEFAULT_VALUE
The value returned by the get method if a different
value has not been calculated. |
| Method Summary | |
|---|---|
Object |
get(IlvGraphic g,
String attributeName)
This method is is invoked when the IlvMapStyle instance this
object is attached to attempts to retrieve an attribute value. |
| Methods inherited from interface ilog.views.io.IlvPersistentObject |
|---|
write |
| Field Detail |
|---|
static final Object DEFAULT_VALUE
get method if a different
value has not been calculated.
| Method Detail |
|---|
Object get(IlvGraphic g,
String attributeName)
IlvMapStyle instance this
object is attached to attempts to retrieve an attribute value.
This method can return a value different from the one that is stored in the
style. The value returned depends on the metadata found in the
IlvAttributeProperty instance stored in g.
g - The current IlvGraphic.attributeName - The name of the attribute to be retrieved.
this.DEFAULT_VALUE if no change
is calculated.
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||