Geomajas geomajas-widget-featureinfo plug-in guide

Geomajas Developers and Geosparc

1.15.1


Table of Contents

1. Introduction
2. Configuration
1. Dependencies
3. How-to
1. How to put the mouse over tool in the tool bar
2. How to configure additional tool parameters

List of Examples

2.1. Plug-in GWT dependency
2.2. GWT module include featureinfo
3.1. Basic bean configuration in application context
3.2. toolbar property in the ClientMapInfo bean definition
3.3. Advanced bean configuration in application context

Chapter 1. Introduction

This plugin contains some more advanced functionality for viewing and formatting feature attribute information such as:

  • Hover-over Feature Info: provides Feature Info (show the feature label) when the mouse cursor hovers a feature on the map

  • Custom Feature Info Window supporting a.o.: fetching feature info from an external URL, grouping of attributes and custom styling.

Chapter 2. Configuration

Table of Contents

1. Dependencies

1. Dependencies

Make sure sure you include the correct version of the plug-in in your project. Use the following excerpt (with the correct version) in the dependencyManagement section of your project:

<dependency>
    <groupId>org.geomajas.plugin</groupId>
    <artifactId>geomajas-client-gwt-widget-featureinfo-parent</artifactId>
		  <version>1.15.1</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

If you are using geomajas-project-client-gwt, this includes the latest released version of the featurinfo plug-in (at the time of publishing of that version). If you want to overwrite the featurinfo plug-in version, make sure to include this excerpt before the geomajas-project-client-gwt dependency.

You can now include the actual dependency without explicit version:

Example 2.1. Plug-in GWT dependency

<dependency>
    <groupId>org.geomajas.widget</groupId>
    <artifactId>geomajas-widget-featureinfo-gwt</artifactId>
</dependency>

To use the widget, you have to include the geocoder GWT module description in your project gwt.xml file:

Example 2.2. GWT module include featureinfo

<module>
    <inherits name="com.smartgwt.tools.SmartGwtTools"/>
    <inherits name="org.geomajas.gwt.GeomajasClient"/>
    <inherits name="org.geomajas.widget.featureinfo.Featureinfo"/>


    <entry-point class="my.gwt.example.client.EntryPoint"/>
</module>

Chapter 3. How-to

1. How to put the mouse over tool in the tool bar

First you need to define the TooltipOnMouseOverMode in your application context:

Example 3.1. Basic bean configuration in application context

<bean name="TooltipOnMouseOverMode" class="org.geomajas.configuration.client.ClientToolInfo" />


Example 3.2. toolbar property in the ClientMapInfo bean definition

<property name="toolbar">
 <bean class="org.geomajas.configuration.client.ClientToolbarInfo">
  <property name="tools">
   <list>
...
    <ref bean="TooltipOnMouseOverMode" />
...
   </list>
  </property>
 </bean>
</property> 


2. How to configure additional tool parameters

Some additional parameters can be configured, following example shows all possible parameters:

Example 3.3. Advanced bean configuration in application context

<bean name="TooltipOnMouseOverMode" class="org.geomajas.configuration.client.ClientToolInfo">
 <property name="parameters">
  <list>

   <bean class="org.geomajas.configuration.Parameter">
    <property name="name" value="pixelTolerance"/>
    <property name="value" value="5"/> 
    <!-- Features withing this distance will be shown in the tooltip -->
   </bean>

   <bean class="org.geomajas.configuration.Parameter">
    <property name="name" value="showEmptyResult"/>
    <property name="value" value="true"/> 
    <!-- Whether to show a message when no results are found -->
   </bean>

   <bean class="org.geomajas.configuration.Parameter">
    <property name="name" value="minimalMoveDistance"/>
    <property name="value" value="5"/> 
    <!-- The minimal amount of pixels that the mouse should move before a new tooltip pops up -->
   </bean>

   <bean class="org.geomajas.configuration.Parameter">
    <!-- if true shows all the identifying attributes of features instead of (only) the label attribute -->
    <property name="name" value="tooltipUseFeatureDetail"/>
    <property name="value" value="true"/>
   </bean>

   <bean class="org.geomajas.configuration.Parameter">
    <property name="name" value="layersToExclude"/>
    <property name="value" value="osm,google"/> 
    <!-- Comma separated list of layers that should not show in the tooltip (referenced by client layer id) -->
   </bean>

   <bean class="org.geomajas.configuration.Parameter">
    <property name="name" value="tooltipMaxLabelCount"/>
    <property name="value" value="6"/> 
    <!-- the maximum number of features for which the attributes (details) will be shown -->
   </bean>

  </list>
 </property>
</bean>