Geomajas Community Documentation
For the layer configuration, you have to create the layer info object.
<bean name="airportsInfo" class="org.geomajas.configuration.VectorLayerInfo"> <property name="layerType" value="POINT" /> <property name="crs" value="EPSG:4326" /> <property name="maxExtent"> <bean class="org.geomajas.geometry.Bbox"> <property name="x" value="-87.4" /> <property name="y" value="24.3" /> <property name="width" value="8.8" /> <property name="height" value="6.4" /> </bean> </property> <property name="featureInfo" ref="airportsFeatureInfo" /> <property name="namedStyleInfos"> <list> <ref bean="airportsStyleInfo" /> </list> </property> </bean>
Example 12.1. Style info
This defines the details common to both raster and vector layers, like layer id, crs, layer type, max extent (bounding box) etc.
The following table describes the properties of the
VectorLayerInfo
object:
Property | Description |
---|---|
layerType | This property determines the type of the default geometry of the features. The following types are supported: POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING and MULTIPOLYGON |
crs | The coordinate reference system, expressed as "EPSG:<srid>". This is probably determined by the layer, but has to be specified anyhow as we have no autodetection in place yet.. |
maxExtent | The bounds of the layer, specified in layer coordinates. After transformation to map coordinates, this determines the locations and absolute size of the tiles. |
featureInfo | The feature metadata |
namedStyleInfos | The list of predefined style metadata objects which define the named styles for this layer |
Table 12.2. VectorLayer info
The feature metadata can be found in the
FeatureInfo
object. This objects contains the complete
feature type description (id, attributes and geometry) as well as the
validation rules for the attributes. An example definition of this
object is given below:
<bean class="org.geomajas.configuration.FeatureInfo" name="airportsFeatureInfo"> <property name="dataSourceName" value="airprtx020" /> <property name="identifier"> <bean class="org.geomajas.configuration.PrimitiveAttributeInfo"> <property name="label" value="Id" /> <property name="name" value="ID" /> <property name="type" value="LONG" /> </bean> </property> <property name="geometryType"> <bean class="org.geomajas.configuration.GeometryAttributeInfo"> <property name="name" value="the_geom" /> <property name="editable" value="true" /> </bean> </property> <property name="attributes"> <list> <bean class="org.geomajas.configuration.PrimitiveAttributeInfo"> <property name="label" value="Name" /> <property name="name" value="NAME" /> <property name="editable" value="true" /> <property name="identifying" value="true" /> <property name="type" value="STRING" /> </bean> <bean class="org.geomajas.configuration.PrimitiveAttributeInfo"> <property name="label" value="County" /> <property name="name" value="COUNTY" /> <property name="editable" value="true" /> <property name="identifying" value="false" /> <property name="type" value="STRING" /> </bean> </list> </property> </bean>
Example 12.2. Feature info
The following table describes the properties of the
FeatureInfo
object:
Name | Description |
---|---|
dataSourceName | This name is used by the layer to internally reference the source that provides the data. Depending on the type of layer, this could be a table name (geotools-postgis), a shape file name (geotools-shapeinmem, in this case there is a 1-to-1 correspondence withe the geotools datastore), a WFS layer name (geotools-wfs) or a java class name (hibernate). |
identifier | Metadata of the primitive attribute that provides a unique identification of the feature. |
geometryType | Metadata of the geometrical attribute that provides the default geometry of the feature. |
attributes | Metadata of all other attributes |
Table 12.3. Feature info configuration
This defines the identifier, geometry object and attributes for the feature.
Attributes can be either primitive attributes or association
attributes. Primitive attributes represent primitive Java types as
well as some common types like Date and String. The following
primitive attribute types are defined: BOOLEAN, SHORT, INTEGER, LONG,
FLOAT, DOUBLE, CURRENCY, STRING, DATE, URL and IMGURL. Association
attributes represent non-primitive Java types. There are two types of
association attributes defined: MANY_TO_ONE and ONE_TO_MANY. These
reflect the many-to-one and one-to-many relationships as defined in an
entity-relationship model and can only be used in conjunction with the
HibernateLayer
.
Last but not least, you can define one or more named style
definitions which should be used for rendering of the layer. The
actual style that is being used by the client is determined in the
client configuration, but you predefine a number of styles (of type
NamedStyleInfo
) here for later reference in the client
configuration.
Each style object is itself composed of a number of feature
styles (FeatureStyleinfo
) and a label style
(LabelStyleInfo
). You can define formulas to determine
which feature style should be used. The first style whose formula
passes will be applied for the feature.
<bean class="org.geomajas.configuration.NamedStyleInfo" name="airportsStyleInfo"> <property name="featureStyles"> <list> <bean class="org.geomajas.configuration.FeatureStyleInfo"> <property name="name" value="Airports (Florida)" /> <property name="fillColor" value="#FF3333" /> <property name="fillOpacity" value=".7" /> <property name="strokeColor" value="#333333" /> <property name="strokeOpacity" value="1" /> <property name="strokeWidth" value="1" /> <property name="symbol"> <bean class="org.geomajas.configuration.SymbolInfo"> <property name="rect"> <bean class="org.geomajas.configuration.RectInfo"> <property name="w" value="12" /> <property name="h" value="12" /> </bean> </property> </bean> </property> </bean> </list> </property> <property name="labelStyle"> <bean class="org.geomajas.configuration.LabelStyleInfo"> <property name="labelAttributeName" value="NAME" /> <property name="fontStyle"> <bean class="org.geomajas.configuration.FontStyleInfo"> <property name="color" value="#FEFEFE" /> <property name="opacity" value="1" /> </bean> </property> <property name="backgroundStyle"> <bean class="org.geomajas.configuration.FeatureStyleInfo"> <property name="fillColor" value="#888888" /> <property name="fillOpacity" value=".8" /> <property name="strokeColor" value="#CC0000" /> <property name="strokeOpacity" value=".7" /> <property name="strokeWidth" value="1" /> </bean> </property> </bean> </property> </bean>
Example 12.3. Style info