mapfish. Searcher.Map

Use this class to create a Map searcher.  A Map searcher sends search requests as the user clicks, pauses or draws boxes on the map.

Typical usage

var searcher = new mapfish.Searcher.Map({
    mode: mapfish.Searcher.Map.HOVER,
    url: "countries",
    protocol: {
        params: {
            limit: 10
        }
    },
    displayDefaultPopup: true,
    delay: 400
});
map.addControl(searcher);
searcher.activate();

Inherits from

  • mapfish.Searcher
  • OpenLayers.Control
Summary
mapfish. Searcher.MapUse this class to create a Map searcher.
Constants
EVENT_TYPES{Array(String)} Supported event types.
Properties
protocol{OpenLayers.Protocol} A protocol instance, if not set in the config passed to the constructor, and if the url option is set, a MapFish protocol is created using the url option.
mode{String} Either mapfish.Searcher.Map.CLICK or mapfish.Searcher.Map.HOVER or mapfish.Searcher.Map.BOX, or mapfish.Searcher.Map.EXTENT, defaults to mapfish.Searcher.Map.CLICK.
searchTolerance{Integer} The search tolerance.
searchToleranceUnits{String} Tolerance units.
pointAsBBOX{Boolean} If true, the filter sent to server will be of BBOX type.
pixelTolerance{Integer} This property has no effect if mode is set to mapfish.Searcher.Map.BOX or to mapfish.Searcher.Map.EXTENT, and it’s meaning depends whether mode is set to mapfish.Searcher.Map.CLICK or mapfish.Searcher.Map.HOVER.
delay{Integer} This property has no effect if mode is set to mapfish.Searcher.Map.BOX or to mapfish.Searcher.Map.EXTENT, and it’s meaning depends whether mode is set to mapfish.Searcher.Map.CLICK or mapfish.Searcher.Map.HOVER.
boxDivClassName{String} The CSS class to use for drawing the box, applies only if mode is mapfish.Searcher.Map.BOX, default is olHandlerBoxZoomBox.
displayDefaultPopup{Boolean} Display a default popup with the search results, does not apply if mode is set to mapfish.Searcher.Map.EXTENT; defaults to false.
onMouseMove{Function} Method called if mode is mapfish.Searcher.Map.HOVER, when the mouse moves.
projection{OpenLayers.Projection} When passed the bounds or point set in the filter are reprojected.
Constructor
mapfish. Searcher.Mapoptions {Object} Optional object whose properties will be set on the instance.
Constants
mapfish. Searcher. Map. CLICKSet the searcher mode to this constant if you want search on click.
mapfish. Searcher. Map. HOVERSet the searcher mode to this constant if you want search on hover.
mapfish. Searcher. Map.BOXSet the searcher mode to this constant if you want search on box drawing.
mapfish. Searcher. Map. EXTENTSet the searcher mode to this constant if you want search on map extent.

Constants

EVENT_TYPES

{Array(String)} Supported event types.

Supported events

  • searchcomplete triggered when the search response is received, listeners receive an object with a “response” property referencing the OpenLayers.Protocol.Response object.
  • searchcanceled triggered when the search request is canceled, listeners receive an object with a “response” property referencing the OpenLayers.Protocol.Response object representing the ongoing request.

Properties

protocol

{OpenLayers.Protocol} A protocol instance, if not set in the config passed to the constructor, and if the url option is set, a MapFish protocol is created using the url option.

searchTolerance

{Integer} The search tolerance.  The units are given by the searchToleranceUnits property.  Defaults to 3.

searchToleranceUnits

{String} Tolerance units.  Possible values are ‘pixels’ and ‘geo’.  The latter means that tolerance is given in the current map units.  Defaults to pixels.

pointAsBBOX

{Boolean} If true, the filter sent to server will be of BBOX type.  If false, the filter will be of DWITHIN type.  If you’re experiencing performance issues don’t hesitate to set it to true.  Defaults to false.

pixelTolerance

{Integer} This property has no effect if mode is set to mapfish.Searcher.Map.BOX or to mapfish.Searcher.Map.EXTENT, and it’s meaning depends whether mode is set to mapfish.Searcher.Map.CLICK or mapfish.Searcher.Map.HOVER.  If mode is mapfish.Searcher.Map.CLICK pixelTolerance is the maximum number of pixels between mouseup and mousedown for an event to be considered a click.  If mode is mapfish.Searcher.Map.HOVER pixelTolerance is the maximum number of pixels between mousemoves for an event to be considered a pause.  Default is 2 pixels.

delay

{Integer} This property has no effect if mode is set to mapfish.Searcher.Map.BOX or to mapfish.Searcher.Map.EXTENT, and it’s meaning depends whether mode is set to mapfish.Searcher.Map.CLICK or mapfish.Searcher.Map.HOVER.  If mode is mapfish.Searcher.Map.CLICK delay is the number of milliseconds between clicks before the event is considered a double-click.  If mode is mapfish.Searcher.Map.HOVER delay is the number of milliseconds between mousemoves before the event is considered a pause.  Default is 300.

boxDivClassName

{String} The CSS class to use for drawing the box, applies only if mode is mapfish.Searcher.Map.BOX, default is olHandlerBoxZoomBox.

displayDefaultPopup

{Boolean} Display a default popup with the search results, does not apply if mode is set to mapfish.Searcher.Map.EXTENT; defaults to false.

onMouseMove

{Function} Method called if mode is mapfish.Searcher.Map.HOVER, when the mouse moves.  Can be used to close a tooltip, for example.  The event is passed in parameter and “this” will be the Map instance.

projection

{OpenLayers.Projection} When passed the bounds or point set in the filter are reprojected.  In order to reproject, a projection transformation function for the specified projections must be available.  This support may be provided via proj4js or via a custom transformation function.  See {OpenLayers.Projection.addTransform} for more information on custom transformations.

Constructor

mapfish. Searcher.Map

Parameters

options {Object} Optional object whose properties will be set on the instance.

Returns

{mapfish.Searcher.Map}

Constants

mapfish. Searcher. Map. CLICK

Set the searcher mode to this constant if you want search on click.

mapfish. Searcher. Map. HOVER

Set the searcher mode to this constant if you want search on hover.

mapfish. Searcher. Map.BOX

Set the searcher mode to this constant if you want search on box drawing.

mapfish. Searcher. Map. EXTENT

Set the searcher mode to this constant if you want search on map extent.

Abstract vector layer protocol class.
Set the searcher mode to this constant if you want search on click.
Set the searcher mode to this constant if you want search on hover.
Set the searcher mode to this constant if you want search on box drawing.
Set the searcher mode to this constant if you want search on map extent.
Class for coordinate transforms between coordinate systems.
Protocols return Response objects to their users.
OpenLayers.Projection.addTransform = function(from,
to,
method)
Set a custom transform method between two projections.
options {Object} Optional object whose properties will be set on the instance.
Close