org.geotools.demo.filter.function
Class DynamicFillColor

java.lang.Object
  extended by org.geotools.demo.filter.function.DynamicFillColor

public class DynamicFillColor
extends java.lang.Object

Demonstrates using a custom-written filter function to dynamically set the fill and outline color of polygon features based on the value of a specified feature attribute. Here we use the countries shapefile and the log of population size as the value to base color on.

Author:
Michael Bedward

Constructor Summary
DynamicFillColor()
          Construtor - just initializes our factory objects
 
Method Summary
 Style createColorRampStyle(java.lang.String attrName, float minValue, float maxValue, boolean logValues)
          Creates a new Style object for polygon features in which the fill and outline stroke colors will be based on the specified feature attribute (a numeric field).
static void main(java.lang.String[] args)
          Main method, runs a demo displaying the countries shapefile with fill and outline colors based on population data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicFillColor

public DynamicFillColor()
Construtor - just initializes our factory objects

Method Detail

createColorRampStyle

public Style createColorRampStyle(java.lang.String attrName,
                                  float minValue,
                                  float maxValue,
                                  boolean logValues)
Creates a new Style object for polygon features in which the fill and outline stroke colors will be based on the specified feature attribute (a numeric field).

Parameters:
attrName - the name of the feature attribute to use as the value field
minValue - the minimum expected feature value
maxValue - the maximum expected feature value
logValues - if true, calculations will use the log of feature value (in this case min and max value parameters should be on the log scale); if false feature values are used directly
Returns:
a new Style object containing the dynamic color function

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Main method, runs a demo displaying the countries shapefile with fill and outline colors based on population data

Parameters:
args - ignored
Throws:
java.lang.Exception


Copyright © 1996-2010 Geotools. All Rights Reserved.