Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Altering the selection drawing for a map engine is done by adding a selection tag to the map engine, with the simplest possible configuration disabling selection drawing all together, as follows:

Code Block
xml
xml
linenumberstruexml
  <wms:mapengine id="test">
    ...
    <selection>false</selection>
  </wms:mapengine>

...

The maximum scale beyond which selections won't be drawn can be set with the maxscale value.

Code Block
xml
xml
linenumberstruexml
  <wms:mapengine id="test">
    ...
    <selection>
      <maxscale>50000</maxscale>
    </selection>
  </wns:mapengine>

...

By setting a limit value you can specify that the plugin should draw a maximum of that many features. There is no default value.

Code Block
xml
xml
linenumberstruexml
  <wms:mapengine id="test">
    ...
    <selection>
      <limit>5000</limit>
      <timeout>5</timeout>
    </selection>
  </wms:mapengine>

...

Additionally, if you really want to tweak the performance of the selection rendering you can disable the smoothing of the drawing by turning off anti-aliasing, which may gain a few milliseconds. The default is to anti-alias the selection drawing.

Code Block
xml
xml
linenumberstruexml
  <wms:mapengine id="test">
    ...
    <selection>
      <antialiasing>false</antialiasing>
    </selection>
  </wms:mapengine>

The selected features are drawn in batches and you can alter the number of features that are drawn in each batch. The default batch size is 1000.
Increasing this value will will reduce the overhead that is required for each batch but sometimes there are limits on the underlying infrastructure (database or spatial engine) that limit the number of features that can be retrieved at once. You can try increasing this value and selecting more than that many features and see if the selection is still drawing. If it is then it is safe to use the new limit value, otherwise it should be reduced until a safe value is determined. There is little point in setting this value to more than the limit value, if it has been set.

Code Block
xml
xml
linenumberstruexml
  <wms:mapengine id="test">
    ...
    <selection>
      <batchsize>2500</batchsize>
    </selection>
  </wms:mapengine>

...

If the map engine that you are using produces images that are directly suitable for display in the browser then you can tell the selection drawing plugin to simply draw the selection on top of the original image and forward that on to the client. This is done by setting reuse to true. It is up to you to make sure that the image supports the correct transparency requirements and that it works in the browsers you want to support. 

Code Block
xml
xml
linenumberstruexml
  <wms:mapengine id="test">
    ...
    <selection>
      <reuse>true</reuse>
    </selection>
  </wms:mapengine>

...

  • Colours can be specified as either an RGB value, as decimal or hex (e.g., #ff0000), or as one of black, blue, cyan, darkgray, darkgrey, gray, grey, green, lightgray, lightgrey, magenta, orange, pink, red, white, yellow.
  • The word 'colour' or 'color' and hyphens can be used in the property names, for example the following are all equivalent, 'strokecolour', 'strokecolor', 'stroke-colour' and 'stroke-color'.
  • When setting line properties only the stroke settings are read.
  • When setting polygon properties only stroke and fill settings are read.
  • When setting point properties stroke, fill and marker settings are read.
  • You don't need to include point, line and polygon unless you want to change all renderers, you only need to incldue the one(s) you want to change, and you only need to include the properties that you want to change from the defaults
Code Block
xml
xml
linenumberstruexml
<wms:mapengine id="test">
  ...
  <selection>
    <point>
      <active>
        <strokecolour>white</strokecolour>
        <strokewidth>1</strokewidth>
        <strokeopacity>0</strokeopacity>
        <fillcolour>cyan</fillcolour>
        <fillopacity>1</fillopacity>
        <mark>circle</mark>
        <marksize>12</marksize>
      </active>
      <inactive>
        <strokecolour>cyan</strokecolour>
        <strokewidth>2</strokewidth>
        <strokeopacity>1</strokeopacity>
        <fillcolour>white</fillcolour>
        <fillopacity>0</fillopacity>
        <mark>circle</mark>
        <marksize>12</marksize>
      </inactive>
    </point>
    <line>
      <active>
        <strokecolour>cyan</strokecolour>
        <strokewidth>3</strokewidth>
        <strokeopacity>0.75</strokeopacity>
      </active>
      <inactive>
        <strokecolour>#00ffff</strokecolour>
        <strokewidth>2</strokewidth>
        <strokeopacity>0.25</strokeopacity>
      </inactive>
    </line>
    <polygon>
      <active>
        <strokecolour>#00ffff</strokecolour>
        <strokewidth>3</strokewidth>
        <strokeopacity>0.75</strokeopacity>
        <fillcolour>#00ffff</fillcolour>
        <fillopacity>0.125</fillopacity>
      </active>
      <inactive>
        <strokecolour>#00ffff</strokecolour>
        <strokewidth>2</strokewidth>
        <strokeopacity>0.25</strokeopacity>
        <fillcolour>#00ffff</fillcolour>
        <fillopacity>0.025</fillopacity>
      </inactive>
    </polygon>
  </selection>
</wms:mapengine>

...

The first thing to do is to create the new selection map engine.

Code Block
xml
xml
linenumberstruexml
    <wms:mapengine id="raster">
        <url>http://vmrunout:8080/geoserver/wms</url>
        <format>image/jpg</format>
        <transparent>false</transparent>
        <selection>false</selection> <!-- disable selections -->
    </wms:mapengine>

    <arcims:mapengine id="vector">
        <host>vmfadeout</host>
        <service>Vector</service>
        <format>image/png8</format>
        <selection>false</selection> <!-- disable selections -->
    </arcims:mapengine>

    <!-- new map engine based on 'Vector' map service -->
    <arcims:mapengine id="selection">
        <host>vmfadeout</host>
        <service>Vector</service>
        <format>image/png8</format>
        <transparent>true</transparent> <!-- obviously we need a transparent image -->
        <selection>
            <reuse>true</reuse> <!-- this may need to be false if you get a black background -->
            <!-- include any other selection options here -->
        </selection>
        <layers> <!-- filter layers so underlying map engine doesn't actually have any layers so will never draw anything -->
          <layer>dummy</layer>
        </layers>
    </arcims:mapengine>

Then we add the new map engine to the client configuration so that it is drawn on top of the existing layers.

Code Block
xml
xml
linenumberstruexml
    <client:config id="...">
        ...
        <view id="com.cohga.html.client.map.mapView">
            ...
            <mapengine id="raster">
                ....
            </mapengine>

            <mapengine id="vector">
                ....
            </mapengine>

            </mapengine id="selection">
                <options>
                    <selection>true</selection> <!-- tell the client map engine that this layer is for handing selections -->
                    <alpha>true</alpha>
                    <!-- include any other options here -->
                </options>
            </mapengine>
        </view>
    </client:config>

The final step is to switch the toc model to use the new selection map engine for the selection related entries by adding a mapengine tag to the Selection entry.

Code Block
xml
xml
linenumberstruexml
    <toc:model id="toc.manningham">
        <mapengine>vector</mapengine>
        <entry label="Selection" exclusive="true">
            <!-- use the selection map engine for every entry in here -->
            <mapengine>selection</mapengine>
            <entry layer="_selection.active" label="Active" checked="true"/>
            <entry layer="_selection.all" label="All" checked="false"/>
            <entry label="Selected" checked="false">
                <!-- individual selection layer here -->
                ...
            </entry>
        </entry>

        <!-- regular layer entries here -->
        ...

        <entry label="Raster" exclusive="true">
            <!-- use the raster map engine for every entry in here -->
            <mapengine>raster</mapengine>
            ...
        </entry>
    </toc:model>

...

To display a text overlay on the map you can add an attribution (e.g. Watermark) control to the map then include an attribution property for one of your client map engines.

Code Block
xml
xml
titleAdding attribution to the map view
linenumberstruexml
    <client:config id="...">
        ...
        <view id="com.cohga.html.client.map.mapView">
            <control id="com.cohga.client.mapctrl.attribution"/>
            ...
            <mapengine id="raster">
                ....
            </mapengine>

            <mapengine id="vector">
                <attribution>Copyright(c) 2010</attribution>
                ....
            </mapengine>
        </view>
    </client:config>