Styles

 

The final part of a vector layer definition, is the definition of it's styles. A vector layer can have multiple styles, each with it's own formula. These formulae determine which features should have which style.

 

Configuration

<styleDefs>
	<styleDef id="1">
		<name>OPEC and UNESCO Member</name>
		<formula>((OPEC == 1) AND (UNESCO == 1))</formula>
		<style>
			<fillColor>#336633</fillColor>
			<fillOpacity>0.7</fillOpacity>
			<strokeColor>#333333</strokeColor>
			<strokeOpacity>1</strokeOpacity>
			<strokeWidth>1</strokeWidth>
		</style>
	</styleDef>
...

First of all, each style definition has an ID. In this case "1". This is not randomly chosen, the ID's should have continuing numbers (1, 2, 3, ...). Then for each style definition there are the following tags: 

  • name : The name of the style.Used in the LegendWidget on the client.
  • formula : A formula determining which features should get style style. If left empty all features will receive this style. That is, if they have not been granted an earlier style. Styles for features are checked in order. If the formula for the first style does not match the feature's attribute values, the next style will be checked.
  • style : Then finally the style itself. This style definition supports many tags, all of which are optional. Just don't leave any empty tags in the XML file.
    • fillColor : The HTML color code used for filling the geometry's surface. 
    • fillOpacity : Value between 0 and 1, determining the surface opacity. In case of a linestring layer, best set this to 0!
    • strokeColor : The HTML color code used for the lines/edges.
    • strokeOpacity : Value between 0 and 1, determining the edge opacity.
    • strokeWidth : The width of the edges. Expressed in pixels.
    • dashArray : Comma separated list of integers dtermining dashes.
    • symbol : Only used for point layers! Geomajas supports 2 types of symbols: rectangles and circles. 

 

Symbol definitions

The definition of rectangular symbols for point layers, is as follows:

<symbol>
	<rect w="10" h="10"     />
</symbol>

 Where w is the width, and h is the height. Both are expressed in pixels.

 

The definition of circular symbols for point layers, is as follows:

<symbol>
	<circle r="10"     />
</symbol>

 Where r is the radius of the circle, expressed in pixels.