Styling

Now we implement style commands to our configuration file. We can specify a configuration for a type of feature on our map. To do this we introduce a new keyword "FeatureType". Then for each new feature type we create a factory. Then when we encounter that feature type in our configuration file we use the factory for that feature type. In this way we can set a style for each type of feature.

Here is an example of a configuration file with style.


Look at the source. We have added a Hashtable to store the new factories. When a "FeatureType" keyword is encountered we create a new factory and add it to the Hashtable indexed by its name. Later we may come across a name that is not a keyword. Before we would just display an error Now we check the hashtable to see if it's one of our features. If it is, we add it using the factory found in the Hashtable.

Exercises

  1. Experiment with other feature types by editing the above text box and clicking the button.

Next: Data Adapters