© Pedro Pereira Gonçalves
(pedro@inovagis.org)

Version : 0.3
Last Change : 2003-10-24
File Name : WMSmap.js

mapWMS
    An array of layerWMS. Includes request information status and events.

    create method: function function mapWMS(x1, y1, x2, y2, srs)

    Creates the mapWMS class that defines a list of request to a serie of OpenGIS WMS specification compliant servers, where the parameters are:
    • x1, y1, x2, y2 - geographic coordinates of the study area where (x1, y1) define the bottom-left point and (x2,y2) define the top-right point
    • srs - optional parameter defining the spatial reference system (default value is EPSG:4326)

    Methods
    • refresh = function ()
      Updates all the layers in the mapWMS with a new request (updating any changes made to the class)

    • addLayer = function(url, layer, version)
      Adds a layer from the server expressed in url (without the ? and the http://) with the layer name and using a specific version of the OGC WMS specification. The x1, y1, x2 and y2 are geographic coordinates in the current used SRS where (x1, y1) define the bottom-left point and (x2,y2) define the top-right point.
      Change on Version 0.3 : The url should be given with http:// if the link is not relative to the web page (if it is in a different server)

    • updateBBox = function (x1, y1, x2, y2)
      Updates the current viewing box with the given parameters

    • cancelRequest = function()
      Forces the class to stop its current request and goes the last valid view.

    • zoomTo = function (x, y, zoomFactor)
      Zooms to a give x and y (using the current SRS) with a given ZoomFactor (values bigger than 1 make a zoom in and values lower than 1 make a zoom out)

    • notify= function(mapRef) - not fully implemented

    • addListener = function(mapRef) - Forces the object to be aware of any changes on the mapRef object - check demo of multiple layer request with mouse events, toolbar and dynamic auxiliary map example [view]

    • setStatus = function (value)
      Show the status window using the value parameter for the caption (useful for mapWMS descendents)

    • writeDOM = function (name, left, top, width, height, style)
      Write the full elements necessary for this class with position expressed by the left and top values, with a given width and height. The style value is optional and defines the layer CSS style.


    Properties
    • caption
      Optional parameter for future use on legends and display box

    • SRS
      Optional parameter for defining the Spatial Reference System. Default value is EPSG:4326

    • BBox
      Array defining the current visible geographical bounding box where (BBox[0], BBox[1]) define the bottom-left point and (BBox[2], BBox[3]) define the top-right point.

    • initBBox
      Array defining the initial geographical bounding box where (BBox[0], BBox[1]) define the bottom-left point and (BBox[2], BBox[3]) define the top-right point.

    • lastBBox
      Array containing the last accessed geographical bounding box.

    • layers
      Array of layerWMS classes with the map layers requested.

    • writeHTML
      Array of additional HTML lines to add to the main layer (useful for descendents of mapWMS)

    • listeners
      Array of geographical listeners events - check demo of multiple layer request with mouse events, toolbar and dynamic auxiliary map example [view]

    • directLoading (new on version 0.3)
      Added the option to select direct loading without using the transport image by default is false in all browsers except in IE 6 (because this browsers will always recall the image even if it has an object in memory)


    Events
    • onError = function ( wmsMap, layerIndex ) - not fully implemented
      Event launched when a error happens on loading a given layer (expressed by the layerIndex)

    • onBeforeChange = function (wmsMap, x1, y1, x2, y2)
      Event fired before a given change is executed on the visible bounding box of the map layers. If this functions returns false then the change will not occur.

    • onChange= function ( wmsMap ) :
      Event launched after the successful change of the visible bounding box .

    Examples
    • multiple layer request example [view]

    Change Log
    • 2003-10-24 : Added the option to select direct loading without using the transport image by default is false in all browsers except in IE 6 (because this browsers will always recall the image even if it has a object in memory)