Chapter 5. Configuring MAJAS Applications

After the users have been defined, we are ready to define applications. To define a MAJAS Application, you need to add a new directory under the /data/ggis/applications directory. The simplest way, is to make a copy of another directory that's already there. The name of this directory is also the name in the url-parameter that you use to access the application. (remember the /application.do?app=....). Inside this directory, there should be some .svg files (application.svg, overview.svg, legend.svg) and an application.xml. Let us first start with the .svg files. There is no need to adjust these, unless you want point-layers in your application. The features of a point layer are displayed using SVG symbols. These symbols are predefined, inside the SVG files. So if you want your own symbols, you have to add them to the list inside the SVG file.

Next there is the application.xml. This is the main configuration file for an application. In the programlisting beneath, you see a simple example of such an application configuration. We will now go over every one of the attributes, to explain their purpose and usage.

Example application.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<mc:application xmlns:mc="http://www.majas.org/schema/2006/configuration/" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:ns2="http://www.w3.org/1999/xhtml" 
    xmlns:ns="http://www.majas.org/schema/2006/configuration/" 
    xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty" 
    xsi:schemaLocation="http://www.majas.org/schema/2006/configuration/ file://xsd/majas-application.xsd ">

        <url ref="test-application" value="url-param" />
        <backgroundColor value="#FFFFFF" />
        <lineSelectStyle value="stroke:yellow; stroke-opacity: 0.5;" />
        <pointSelectStyle value="#selectedPoint" />
        <polygonSelectStyle value="color:yellow;fill:yellow;fill-opacity: 0.5;" />
        <name value="test-application" />
        <crs value="EPSG:31300" />
        <preferredWMSFormat value="image/jpeg" />
        <layerFactory value="com.cadrie.majas.core.application.DefaultLayerFactory" />
        <users>
                <user ref="guest" />
                <user ref="anotheruser" />
        </users>

        <layers>

                <layer id="1" xsi:type="mc:nodeLayerType">
                        <layerName value="Feature Layer Group" />
                        <defaultVisible value="true" />
                        <displayOrderMap value="1" />
                        <displayOrderTOC value="3" />

                        <childLayers>
                                <layer id="2" xsi:type="mc:leafyLayerType">
                                        <layerName value="First-layer" />
                                        <defaultVisible value="true" />
                                        <displayOrderMap value="2" />
                                        <displayOrderTOC value="1" />

                                        <activatable value="true" />
                                        <active value="false" />
                                        <exportable value="true" />
                                        <urlProperty value="url" />
                                        <layerType value="4" />
                                        <viewScale min="0.0001" max="1000" />
                                        <showLabels value="false" />
                                        <editableSupported value="true" />

                                        <attribFeatureId value="feature_id" />
                                        <attribVersion value="version" />
                                        <attribEditDate value="edit_date" />
                                        <attribUserId value="user_id" />
                                        <attribEditState value="edit_state" />
                                        <attribFlowState value="flow_state" />

                                        <featureType value="postgis:tablename" />
                                        <crudValue value="7" />

                                        <snappingRules>
                                                <snappingRule>
                                                        <snapDistance value="100" />
                                                        <snappingLayer value="First-layer" />
                                                        <snappingType value="1" />
                                                </snappingRule>
                                        </snappingRules>
                                      

                                        <identifyingAttributes>
                                                <identifyingAttribute>
                                                        <attributeLabel value="Identifier" />
                                                        <attributeName value="id"/>
                                                </identifyingAttribute>
                                        </identifyingAttributes>

                                        <viewableAttributes>
                                                <viewableAttribute>
                                                        <attributeLabel value="Identifier" />
                                                        <attributeName value="id"/>
                                                        <attributeValidator value="" />
                                                </viewableAttribute>
                                                <viewableAttribute>
                                                        <attributeLabel value="Name" />
                                                        <attributeName value="name"/>
                                                        <attributeValidator value="" />
                                                </viewableAttribute>
                                        </viewableAttributes>

                                        <labelConfig>
                                                <labelAttributeName value="name" />
                                        </labelConfig>

                                        <styleDefs>
                                                <styleDef>
                                                        <id value="1" />
                                                        <name value="Some Style" />
                                                        <svgStyle value="stroke:#CC3311;stroke-width:0.2%;stroke-opacity:1;" />
                                                        <formula value="" />
                                                </styleDef>
                                        </styleDefs>
                                </layer>

                        </childLayers>
                </layer>

        </layers>

        <gridConfig>
                <transformationFunction value="tmp=configuration.fullMapExtent.upperRightCorner.y+configuration.fullMapExtent.lowerLeftCorner.y; newPoint = new Point(); newPoint.x = point.x; newPoint.y = tmp-point.y; return newPoint;" />
                <fullMapExtent minX="20000" maxX="260000" minY="150000" maxY="245000" />
                <rasterZoomLevels>
                        <rasterZoomLevel>
                                <minViewScale value="0.0001" />
                                <maxViewScale value="0.01" />
                        </rasterZoomLevel>
                        <rasterZoomLevel>
                                <minViewScale value="0.01" />
                                <maxViewScale value="0.03" />
                        </rasterZoomLevel>
                        <rasterZoomLevel>
                                <minViewScale value="0.03" />
                                <maxViewScale value="0.07" />
                        </rasterZoomLevel>
                        <rasterZoomLevel>
                                <minViewScale value="0.07" />
                                <maxViewScale value="0.1" />
                        </rasterZoomLevel>
                        <rasterZoomLevel>
                                <minViewScale value="0.1" />
                                <maxViewScale value="0.3" />
                        </rasterZoomLevel>
                        <rasterZoomLevel>
                                <minViewScale value="0.3" />
                                <maxViewScale value="0.5" />
                        </rasterZoomLevel>
                        <rasterZoomLevel>
                                <minViewScale value="0.5" />
                                <maxViewScale value="2" />
                        </rasterZoomLevel>
                        <rasterZoomLevel>
                                <minViewScale value="2" />
                                <maxViewScale value="1000" />
                        </rasterZoomLevel>
                </rasterZoomLevels>
        </gridConfig>

The structure of this configuration file is defined in the majas-application.xsd (see majas-application.xsd).