Class: Map

WIND. Map

Creates an object of the Map class to be displayed on the web page.

new Map(iddiv, options)

Creates an object of the Map class.
Parameters:
Name Type Description
iddiv string The ID of the Map object.
options JSON string in JSON format to set options for the Map objet.
Map options:
Name Type Description
type string Define the type of the base layer of the map and it can be either "Google Street", "Google Hybrid", "Google Satellite", "Google Terrain", "IGN Route", "IGN Satellite" ou "IGN Terrain" ("Google Street" by default).
top integer Adjust the distance in px between the top border of the map and the top border of its containing element.( 10px by default ).
left integer Adjust the distance in px between the left border of the map and the left border of its containing element.( 10px by default ).
height integer Define the height in px of the map( 400px by default ).
width integer Define the width in px of the map( 600px by default ).
color string Define the color of the header if it exists( #3366CC by default ).
border string Define the color, the thickness and the type of the border. By default "#3366CC 2px solid". See more here CSS Border.
name string Define the map's name( "Map Displayer" by default ).
icon string Define the map's icon in the form of an URL.
latitude float Define the latitude of the centrale point of the map( between -90° and 90° ).
longitude float Define the longitude of the centrale point of the map( between -180° and 180° ).
zoom integer Define the initial zoom of the map( between 0 and 21 ).
draggable boolean If true, enables the map to be dragged on its containing element. Dragging is disabled by default.
resizable boolean If false, prevents the map from being resized. Resizing is disabled by default.
header boolean Says whether the header is enabled or not. The header is disabled by default.
removable boolean If false, prevents the map from being removed. Removing is disabled by default.
configurable boolean If true, enables to configure the map from a menu. Configurable is disabled by default..
zoomable boolean If true, allows the zoom on the map. Zooming is enabled by default.
pannable boolean If false, prevents the map to be panned (Fixed center). Panning is enabled by default.
showscale boolean If true, the scale is diplayed on the map. The scale is displayed by default.
showposition boolean If true, the position of the mouse on the map is diplayed. The position is displayed by default.
showlocation boolean If false, prevents the location from being diplayed. The location is disabled by default.
showitinerary boolean
showtoolbar boolean If true, enables to show a toolbar of drawing tools
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});

Classes

Itinerary
Marker
Part

Methods

addAnnotation(annotation)

Adds an annotation objet to the map.
Parameters:
Name Type Description
annotation Annotation Annotation objet to add.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addAnnotation(annotation);

addDrawing2ToolBar(tool, vl)

Add a drawing tool to the toolbar.
Parameters:
Name Type Argument Description
tool string The type of the tool we want to add. It can be either a "point", a "line" or a "polygon".
vl integer <optional>
Specifies the vector layer'ID. 0 by default.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addToolBarLite();
carte.addDrawing2ToolBar("point");

addItinerary(iti, options)

Add an Itinerary to the map.
Parameters:
Name Type Description
iti Intinerary Add an Itinerary to the map.
options JSON Describes the options of the Itinerary.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
var iti = new WIND.Map.Itinerary(new Array(new OpenLayers.Geometry.Point(2,45), new OpenLayers.Geometry.Point(3,46)));
carte.addItinerary(iti, {'mode':"route"});

addLayer(layerName, isBaseLayer)

Add a layer to the map.
Parameters:
Name Type Argument Description
layerName string Name of the layer to add.
isBaseLayer boolean <optional>
Indicates whether the layer should be the default. Default value is false.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addLayer("Google Terrain");

addLayers(an)

Add multiple layers to the map.
Parameters:
Name Type Description
an string[] array of layer names we want to add.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addLayers(["Google Satellite","Google Hybrid","Google Terrain","OpenStreetMap","Yahoo Street","Yahoo Satellite","Yahoo Hybrid","Bing Road","Bing Hybrid","Bing Aerial","IGN Satellite","IGN Route"]);

addMarker(marker, vl)

Add a marker to the map.
Parameters:
Name Type Argument Description
marker Map.Marker The marker to add to the map.
vl integer <optional>
Specifies the vector layer'ID. 0 by default.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
var marqueur = new WIND.Map.Marker(-1.509136,43.478266);
carte.addMarker(marqueur);

addScaleControl()

Adds a tool to resize the map.
Example
carte.addScaleControl();

addSensiblePart(mp, display, vl)

Add a Map.Part object to the default layer vector.
Parameters:
Name Type Description
mp Map.Part the Map.Part object to add to the map.
display boolean Indicates whether Map.Part appears or not.
vl integer Specifies the vector layer'ID. 0by default.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addSensiblePart(mp, true);

addToolBarLite()

Add a toolbar of drawing tools.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addToolBarLite();

addVectorLayer(vl)

Add a new vector layer
Parameters:
Name Type Description
vl integer The new vector layer ID we want to add. By default a vector layer with an ID 0 is added to the Map object.
Example
var carte = new WIND.Map("mymap", {});
carte.addVectorLayer(1);

changeBaseLayer(newBaselayerName)

Change the base layer of the map.
Parameters:
Name Type Description
newBaselayerName string Name of the new base layer.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addLayer("Google Terrain");
carte.addLayer("IGN Street");
carte.changeBaseLayer("IGN Street");

createAnnotation(type, entity, geodata, options, vl) → {Annotation}

Creates ana Annotaion objet on the map.
Parameters:
Name Type Argument Default Description
type string Represents the type of the Annotation objet to add. Its value can be anything.
entity string Name of the annotated entity.
geodata string Type and coordinates of the figure. It can either a "POLYGON", a "MULTIPOLYGON", a "LINEstring", a "MULTILINEstring", a "POINT", a "MULTIPOINT", a "MARKER" or a "MULTIMARKER.
options JSON <optional>
Options for the Annotation object. It may contain up to four parameters:
-projection, the projection we want to use,
-style, the style of the annotation and may contain 5 options: strokeColor, strokeWidth, strokeOpacity, fillColor and fillOpacity,
-display, either we diplay the annotation or not and
-geoname, the name of the geometry.
vl integer <optional>
0 The Id of the vector layer we want to add the annotation to it.
Returns:
returns Annotation object.
Type
Annotation
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.createAnnotation("ville", "Mauléon-Licharre", "POINT(0.567893 45.64124)",{"projection":"EPSG:4326","style":"strokeColor:#0033CC,strokeWidth:3,strokeOpacity:1,fillColor:#FF9900,fillOpacity:1","display":true,"geoname":"point"},0);

destroy()

Destroys the map and remove it from the page.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.destroy();

getValue() → {JSON}

Returns the properties of the Map object in the JSON format.
Returns:
string in the JSON format containing the properties.
Type
JSON
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
var valeur = carte.getValue();

initialize()

Initialize the map.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.initialize();

removeLayer(layerName)

Remove the layer from the map.
Parameters:
Name Type Description
layerName string Name of the layer to remove.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addLayer("IGN Street");
carte.removeLayer("Google Satellite");

removeToolBar()

Remove the toolbar from the map.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.addToolBarLite();
carte.addDrawing2ToolBar("line");
carte.removeToolBar();

SelectVectorLayer(vl, auto)

Select the active vector layer
Parameters:
Name Type Argument Default Description
vl integer | Array.<integer> The vector layers we want to add. If we want to select only one vector layer it's an integer, and if we want to select multiple vector layers it is an array of integer.
auto boolean <optional>
false If true allows to adjust the opacity and border of the all annotations in all the vector layers. If the annotation is in an active vector layer, it will be with a border and will have an important opacity. And if it's in an inactive vector layer, it will be without border and will have 0.3 opacity. By default this parameter is set to false.
Example
var carte = new WIND.Map("mymap", {});
carte.addVectorLayer(1);
carte.SelectVectorLayer(1,true);

zoomIn()

Zoom in on the map.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.zoomIn();

zoomOut()

Zoom out the map.
Example
var carte = new WIND.Map("mymap", {'top': 10, 'left': 20, 'width': 600, 'height': 400, 'name': "carte", 'type': 'Google Street', 'longitude': -0.9331, 'latitude': 45.9236, 'zoom': 5, 'draggable': false, 'resizable' : false,'color': '#FF9900', 'border': '#FF9900 2px solid', 'header': false, 'removable': false, 'configurable': false,'zoomable':true});
carte.zoomOut();