Geomajas, Geomajas server: Main - commands 1.15.1

org.geomajas.command.feature
Class SearchByLocationCommand

java.lang.Object
  extended by org.geomajas.command.feature.SearchByLocationCommand
All Implemented Interfaces:
Command<SearchByLocationRequest,SearchByLocationResponse>

@Api
@Component
@Transactional(readOnly=true,
               rollbackFor=java.lang.Exception.class)
public class SearchByLocationCommand
extends Object
implements Command<SearchByLocationRequest,SearchByLocationResponse>

Execute a search for features by location. The location can be any type of geometry. Although this will mostly be a coordinate, it is possible to search using a Polygon or LineString as location. The command only expects the location to be described using the map's coordinate system. Also, if a buffer is specified, this buffer will be added to the location geometry before executing the search.

In addition to the location, it is also possible to describe what kind of geometric query to use (supported are: intersects, contains, touches and within) and in case of the "intersects" query, it is even possible to describe what ratio of intersection is required (number between 0 and 1). The default query will also be an intersection. For example, if queryType = 1 (intersects) and ratio = 0.7, then only features whose geometry lies 70% within the given location will be accepted.

Last but not least, it is required that at least one layer-ID is given to search in. If multiple layers are given, an extra parameter comes into play: searchType. This searchType specifies whether to search features in all given layers, to to start searching from the first layer, and stop once features are found (can be in the first layer, or in the second, ...).

It will go over all given layers (provided they're vector layers), and fetch the features, using the location geometry and the query type. In case the query type is "intersects", the overlapping ratio is also checked. The resulting list of features is added to the command result so it can be send back to the client.

Since:
1.6.0
Author:
Pieter De Graef, An Buyle

Constructor Summary
SearchByLocationCommand()
           
 
Method Summary
 void execute(SearchByLocationRequest request, SearchByLocationResponse response)
          The command's execution method.
 SearchByLocationResponse getEmptyCommandResponse()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchByLocationCommand

public SearchByLocationCommand()
Method Detail

execute

public void execute(SearchByLocationRequest request,
                    SearchByLocationResponse response)
             throws Exception
The command's execution method. It will go over all given layers (provided they're vector layers), and fetch the features, using the location geometry and the query type. In case the query type is "intersects", the overlapping ratio is also checked. The resulting list of features is added to the command result so it can be send back to the client.

Specified by:
execute in interface Command<SearchByLocationRequest,SearchByLocationResponse>
Throws:
Exception

getEmptyCommandResponse

public SearchByLocationResponse getEmptyCommandResponse()
Specified by:
getEmptyCommandResponse in interface Command<SearchByLocationRequest,SearchByLocationResponse>

Geomajas, Geomajas server: Main - commands 1.15.1

Copyright © 2014 Geosparc. All Rights Reserved.