new ServerMapRequest(url)
This class constructs a generic server map request to be sent to the server.
The instance, once created, will then be used to add or set attributes and properties to be used
to formulate the map request.
For example:
- baseURL="http://"+document.location.host+"/mapviewer";
- var req = new OM.server.ServerMapRequest(baseURL);
- req.addTheme(myTheme);
- req.setProperties({
- dataSource:"mvdemo",
- basemap: 'demo_map',
- transparent:true,
- antialiase:"false"
- });
Parameters:
| Name | Type | Description |
|---|---|---|
url |
String | The base URL of the mapviewer server. For example:
|
Returns:
An instance of OM.layer.ServerMapRequest
- Type
- OM.layer.ServerMapRequest
Methods
-
addStyle(objStyle)
-
Add a style
Parameters:
Name Type Description objStyleOM.style A OM.style object
Returns:
- Type
- undefined
-
addStyles()
-
Add styles from an array
Parameters:
Type Description Returns:
- Type
- undefined
-
addTheme(objTheme)
-
Add a theme.
Parameters:
Name Type Description objThemeObject A ServerPredefinedTheme object.
Returns:
- Type
- undefined
-
addThemes(arThemes)
-
Add an array of themes.
Parameters:
Name Type Description arThemesarray An array of ServerTheme objects.
Returns:
- Type
- undefined
-
getTheme(themeName)
-
Get the theme instance, null if not found.
Parameters:
Name Type Description themeNameString The theme's name
Returns:
a theme object that has the given name; null if not found.
-
getThemes()
-
Get array of themes in the server map request instance.
Returns:
themes object array
- Type
- array
-
hasTheme(name)
-
Parameters:
Name Type Description nameSring The theme name to search for.
Returns:
return true if a theme with the given name found; false otherwise.
- Type
- Boolean
-
setBasemap(basemap)
-
Set the basemap name
Parameters:
Name Type Description basemapString The basemap name
Returns:
- Type
- undefined
-
setBBox(minx, miny, maxx, maxy, srid)
-
Set the bounding box
Parameters:
Name Type Description minxtype The minimum x
minytype The minimum Y
maxxtype The maximum x
maxytype The maximum y
sridtype The srid. Defautl is 8307
Returns:
- Type
- undefined
-
setBindingParameters(layerbp)
-
Set each theme's binding parameters
Parameters:
Name Type Description layerbparray an array of JSON objects. Each JSON object has a key and value
pair. The key is a theme's name. The value is binding parameters, an array of JSON object containing binding parameters.
For example, a layerbp may look like:
[{'WIND_THEME', [{value:0.0, type:'Double'}, {value:'CA', type:'String'}]}]Returns:
a theme object that has the given name; null if not found.
-
setClientTileRequest(flag)
-
Set the client tile request flag.
Parameters:
Name Type Description flagBoolean The client tile request flag, true or false.
Returns:
- Type
- undefined
-
setEnableUTFGrid(flag)
-
Set the flag to enable or disable the utfgrid generation
Parameters:
Name Type Description flagBoolean Boolean, true or false
Returns:
- Type
- undefined
-
setImageFormat(format)
-
Set the map image format
Parameters:
Name Type Description formatString The map image format, such as PNG_STREAM, PNG_URL
Returns:
- Type
- undefined
-
setImageHeight(w)
-
Parameters:
Name Type Description wint The image width
Returns:
- Type
- undefined
-
setImageWidth(w)
-
Parameters:
Name Type Description wint The image width
Returns:
- Type
- undefined
-
setMapServerURL(url)
-
Set the map server URL
Parameters:
Name Type Description urlstring The map server url. For example, http://localhost:8080/mapviewer
Returns:
- Type
- undefined
-
setProperties(props)
-
Set attributes needed by a map request
Parameters:
Name Type Description propsobject A JSON object containing attributes related with a map request
Returns:
- Type
- null
-
setUTFGridResolution(res)
-
Set the UTFGrid resolution
Parameters:
Name Type Description resInteger The utfgrid resolution. Typical values are 2, 4, or 8
Returns:
- Type
- undefined
-
toXMLString()
-
Build an XML map request string
Returns:
- Type
- String
-
toXMLString_Themes(mapArea)
-
Parameters:
Name Type Description mapAreaOM.geometry.Rectangle Optional parameter with the request map area. In general it is null.
Currently applies just for server GeoRaster class to be used on a binding parameter of type 'Tile_mbr' if it exits.Returns:
The XML string for themes
- Type
- String