uDig can provide maps symbolized by implementing styles. The style api has two major players.
The udig will use this information as metadata when choosing which Style Object and StyleBlackboardStyle objects are stored a StyleBlackboard. Configurators use the blackboard to collaborate. Objects are stored on the blackboard by id. When a configurator queries the blackboard for an object and it does not exist, a default object should be created and placed on the blackboard. The following is an example: Since different renders can use completely different style objects, the coupling between the render and the style needs to kept low. In order to achieve this, we decided to create the notion of a style blackboard which is associated with a layer. This way the render and configurator can collaborate without talking to each other. The Renderer and the StyleConfigurator look for particular style objects on the blackboard in order to do their part. The style content is responsible for creating, and persiting the style object. Each Layer has a StyleBlackboard. Configurators should not write to this blackboard directly. Each configurator is supplied with a copy of the actual layer blackboard. The StyleConfigurator should store no state. All state should be stored in the style objects on the style blackboard. When a ui widget changes state, the style object should be written to immediately to reflect the change. Whenever style objects are read from the blackboard, void apply() { StyleBlackboard styleBlackboard = getStyleBlackboard(); Point style = styleBlackboard.lookup("point.style"); if (style == null) { style = new Point(); styleBlackboard.put("point.style", style); } style.setX(...) //set to some value from ui style.setY(...) //set to some value from ui } void init() { StyleBlackboard styleBlackboard = getStyleBlackboard(); Point style = styleBlackboard.lookup("point.style"); if (style != null) { //set some ui widget to value of style.getX(); //set some ui widget to value of style.getY(); } } StyleBuilderSince a Style is composed of a complex set of objects, a StyleBuilder object is provided for you to conveniently build simple styles without the need to build all of the style elements by hand. For example, you can create a PolygonSymbolizer and then create a Style out of it with a single method call: the builder will generate a default FeatureTypeStyle and the Rule for you. FeatureTypeStyleA FeatureTypeStyle declares a part of a style that is specifically geared toward a FeatureType, that is, features will be rendered according to this FeatureTypeStyle only if their FeatureType is the same as the FeatureType declared in the FeatureTypeStyle or a descendent. A FeatureTypeStyle contains one or more rules; RuleA Rule contains filters that will decide whether features will be displayed or not, specifically: SymbolizersA Symbolizer describes how to represent a feature on the screen based on the feature contents (geometry and attributes). Each rule can have one or more Symbolizer attached to it.
|
(c) Copyright (c) 2004,2005 Refractions Research Inc. and others. |