# WPS.Control.ObjectVisualizer

The Object visualizer gives access to the legato map client. It is possible to visualize GeoJSON objects with styles and set the visible area of the map via a bounding box or a center point with a minimum and maximum scale.

Inherits from: | WPS.Control

Summary

WPS.Control.ObjectVisualizer | The Object visualizer gives access to the legato map client.
Functions |
initialize | Basic constructor
destroy | WPS.Control
setBoundingBox | Sets the map extent to the bounding box with given coordinates.
setCenterAndScale | Sets the map extent based on the center point with given coordinates and the scale.
visualize | Shows the given objects with styles and map tips on the map.
lwpsc:ObjectVisualizer | XML based configuration for a WPS.Control.ObjectVisualizer.

### Functions

### initialize

> initialize : function( | options | )

Basic constructor

#### Parameters

options | {Object} A Hashmap containing option parameters for this control The following keys are supported

- map {<OpenLayers.Map>} The current map

### destroy

> destroy : function()

#### See Also

WPS.Control

### setBoundingBox

> setBoundingBox : function( | left,
> | bottom,
> | right,
> | top | )

Sets the map extent to the bounding box with given coordinates.

#### Parameters

left | {Number} Minimum horizontal coordinate.
bottom | {Number} Minimum vertical coordinate.
right | {Number} Maximum horizontal coordinate.
top | {Number} Maximum vertical coordinate.

### setCenterAndScale

> setCenterAndScale : function( | x,
> | y,
> | scale | )

Sets the map extent based on the center point with given coordinates and the scale.

#### Parameters

x | {Number} Horizontal coordinate of the center point.
y | {Number} Vertical coordinate of the center point.
scale | {Number} Denominator value of scale. If null, the minimum possible scale will be used.

### visualize

> visualize : function( | layerName,
> | objects | )

Shows the given objects with styles and map tips on the map. All the given objects will be in the same layer. After adding the objects, the map client zooms to the newly added objects.

#### Parameters

layerName | {String} The name of the layer where the given geometry objects should be added. If this parameter is null, then a new layer will be created and its name will be generated automatically. Otherwise, the method looks for the layer with the given name. If the layer is found, then the objects will be in that layer. Otherwise, a new layer with the given name is created.
objects | {Array} An array of geometry objects to add. The following keys are supported:

- geometry {GeoJSON} Mandatory. A GeoJSON Object representing the geometry for visualizing in the map client.
- mapTip {String} Optional. If exists, the visualized object will have a map tip that is shown when the mouse is over the geometry object.
- style {Object} Optional. This object contains styling attributes corresponding to SVG definition. The following SVG styling attributes are supported:
- fill
- stroke
- stroke-width

## lwpsc:ObjectVisualizer

XML based configuration for a WPS.Control.ObjectVisualizer.

#### A valid configuration example for a ObjectVisualizer would be

>     <lwpsc:ObjectVisualizer>
>       <map>
>         <lb:Reference target="map" />
>       </map>
>     </lwpsc:ObjectVisualizer>

> initialize : function( | options | )

Basic constructor

> destroy : function()

WPS.Control
Abstract base class for all WPS control classes

> setBoundingBox : function( | left,
> | bottom,
> | right,
> | top | )

Sets the map extent to the bounding box with given coordinates.

> setCenterAndScale : function( | x,
> | y,
> | scale | )

Sets the map extent based on the center point with given coordinates and the scale.

> visualize : function( | layerName,
> | objects | )

Shows the given objects with styles and map tips on the map.
The Object visualizer gives access to the legato map client.