Skip to content

Commit

Permalink
GEOS-11488: MapML Double click to copy attributes to feature caption …
Browse files Browse the repository at this point in the history
…template
  • Loading branch information
dromagnoli committed Aug 1, 2024
1 parent 6efa6ae commit 429da1f
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions doc/en/user/source/extensions/mapml/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ Configuration can be done using the Geoserver administrator GUI. The MapML confi

.. figure:: images/mapml_config_ui.png

*Attributes to <feature caption> mapping* section allows to define a template
so that feature caption can include attribute values.
Double clicking on one entry of the List of Attributes,
will append an *${attribute}* placeholder at the end of the Feature Caption Template String text area.

For example, for the State layer, you can define a template showing the State Name and the number of persons,
by following these steps:

#. Write "State Name:" on the text area
#. Double click on the *STATE_NAME* attribute from the list of attributes, which will result in appending the *${STATE_NAME}* placeholder to the previous text.
#. Continue writing ", Persons:" on the text area
#. Double click on the *PERSONS* attribute from the list of attributes, which will result in appending the *${PERSONS}* placeholder to the previous text.

See the following gif showing the result.

.. figure:: images/mapml_feature_caption.gif

After having saved the configuration, the WFS output will looks like this, where on mouseover, you can see the feature caption being setup on top of the defined template:

.. figure:: images/mapml_feature_captions_wfs.png




There is also a MapML-specific global WMS setting in the *MapML Extension* section of the ``WMS`` Services Settings Page. This setting is used to control the handling of multi-layer requests.

.. figure:: images/mapml_config_wms.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ <h3>
</label>
<textarea id="featureCaptionTemplate" wicket:id="featureCaptionTemplate"
class="field textarea" rows="5" cols="30"></textarea>
<script src="mapml/js/feature-caption-selector.js" type="text/javascript"></script>
</li>
</ul>
</fieldset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<constructor-arg ref="wms"/>
</bean>
<mvc:resources mapping="/mapml/viewer/**" location="classpath:/viewer/"/>
<mvc:resources mapping="/mapml/js/**" location="classpath:/org/geoserver/mapml/"/>
<bean class="org.geoserver.mapml.MapMLMessageConverter" id="mapmlMessageConverter"/>
<util:map id="prefixMap" value-type="java.lang.String" key-type="java.lang.String" map-class="java.util.HashMap">
<entry key="http://www.w3.org/1999/xhtml" value=""/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
$(document).ready(function() {
$(this).on('dblclick', 'option', function() {
var selectedAttribute = $(this).text();
var formattedAttribute = '${' + selectedAttribute + '}';
var textbox = $('#featureCaptionTemplate');
var prevVal = textbox.val();
textbox.val(prevVal + formattedAttribute);
});
});

0 comments on commit 429da1f

Please sign in to comment.