![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
A data layer that supports loading of versions 1.1.0, 1.1.1 and 1.3.0 OGC compliant Web Map Services (WMS).
The WMS data layer is intended to absolve the user of the responsibility of having to specify the query parameters that are used when making requests to the WMS. Therefore, the user does not need to specify the BBOX, WIDTH or HEIGHT values that are used when making the request and instead they should provide the address of the WMS server to the loadData method. The address URL should either be terminated with a "?" or a "&" character. E.G. "http://my.host.com/wms?" or "http://my.otherhost.com/wms?foo=bar&"
During construction, the data layer must be provided with a user callback class instance that derives from TSLWMSServiceSettingsCallbacks. Optionally, this callback class may derive from TSLWMSECPServiceSettingsCallbacks instead, allowing the ECP functionality of the layer to be used. The OASIS 'Security Assertion Markup Language' (SAML) version 2.0 'Enhanced Client or Proxy' profile (ECP) functionality of the layer can be used to access WMS servers that use the ECP security model. Refer to the documentation for the TSLWMSECPServiceSettingsCallback class for more details.
The user will be prompted via the callback interface for additional information should the data layer require it. The callback interface is also used, however, to set which of the WMS layers should be visible, the WMS STYLES to be used for each visible layer and WMS defined 'Dimension' values, such as a TIME parameter.
When the data layer is added to a drawing surface and a draw request is made, the WMS data layer will then fire off requests to the WMS service using the draw area and tile sizes that it deems suitable (although the tile size is configurable via the setDefaultTileLoadSize method on the layer).
Once a successful GetMap request has been made to the WMS, the map tile will be stored in the layer's internal cache to reduce the number of server transactions. By default this cache is 32 MB in size but can be configured via the layer's methods.
When using a TSLWMSDataLayer with an accelerated surface the user should ensure that the setSynchronousLoading method has been called with the synchronousLoading parameter set to 'true'.
Public Types | |
enum | TileLoadOrderStrategy { VerticallyStriped_BottomLeftStart = 0 , VerticallyStriped_BottomRightStart = 1 , VerticallyStriped_TopLeftStart = 2 , VerticallyStriped_TopRightStart = 3 , HorizontallyStriped_BottomLeftStart = 4 , HorizontallyStriped_BottomRightStart = 5 , HorizontallyStriped_TopLeftStart = 6 , HorizontallyStriped_TopRightStart = 7 , ClockwiseSpiral_BottomLeftStart = 8 , ClockwiseSpiral_BottomRightStart = 9 , ClockwiseSpiral_TopLeftStart = 10 , ClockwiseSpiral_TopRightStart = 11 , ClockwiseSpiral_CentreStart = 12 , AntiClockwiseSpiral_BottomLeftStart = 13 , AntiClockwiseSpiral_BottomRightStart = 14 , AntiClockwiseSpiral_TopLeftStart = 15 , AntiClockwiseSpiral_TopRightStart = 16 , AntiClockwiseSpiral_CentreStart = 17 } |
enum | TileLevelStrategy { TileLevelStrategyUseLevels = 0 , TileLevelStrategyUseZoomScale = 1 , TileLevelStrategyDetect = 2 } |
Public Member Functions | |
TSLWMSDataLayer (TSLWMSServiceSettingsCallbacks *callbacks) | |
TSLWMSDataLayer (const TSLWMSDataLayer &) | |
copy constructor that clones all the layer parameters. | |
const char * | activeCRS () const |
void | cacheFlushLimit (int flush_limit) |
int | cacheFlushLimit () |
void | cacheSize (int new_size) |
int | cacheSize () |
const TSLWMSServiceCapability * | capabilityInformation () const |
void | clearBackgroundColour () |
bool | clearCache () |
void | clearTransparent () |
bool | configurePersistentCache (const TSLPersistentCacheData *settings, TSLTileValidationFn validFn=NULL, void *arg=NULL) |
void | extentExpansion (double percent) |
double | extentExpansion () const |
bool | getBackgroundColour (unsigned char &r, unsigned char &g, unsigned char &b) const |
const char * | getCurrentImageRequestFormat () const |
bool | getGetMapFormats (char **&formats, int &noOfFormats, bool onlyStandard=true) const |
bool | getGetFeatureInfoFormats (char **&formats, int &noOfFormats, bool onlyStandard=true) const |
const char * | getOutputFormat () const |
bool | setOutputFormat (const char *format, bool checkStandard=true) |
void | setLogWMSOutputRequests (bool value) |
const char * | getImageRequestFormatAt (int index) const |
TSLWMSVersionEnum | getInitialRequestWMSVersion () const |
void | getLinearTransformParameters (bool &automatic, double &muShiftX, double &muShiftY, double &tmcPerMU) const |
bool | getSynchronousLoading () |
bool | getTransparent (bool &value) const |
bool | getTransverseMercatorJHSFormula () const |
void | invertXYAxis (bool invert) |
bool | loadDataWithECP (const char *serviceURL, const char *federationMetadataURL) |
bool | userLoadData (TSLWMSServiceUserSettingsCallbacks *userCallBack) |
bool | setActiveCRS (const char *crs) |
const char ** | getSupportedCRSs (int &noOfCRSChoices) |
bool | loadWmsRequest (const char *inputRequest, char *&output) |
int | noOfImageRequestFormats () const |
void | pyramidScaleFactor (double factor) |
double | pyramidScaleFactor () const |
const TSLCoordinateSystem * | queryCoordinateSystem () const |
bool | reset () |
const TSLWMSServiceLayer * | rootServiceLayer () const |
TSLWMSServiceLayer * | rootServiceLayer () |
const TSLWMSServiceInfo * | serviceInformation () const |
void | setBackgroundColour (unsigned char r, unsigned char g, unsigned char b) |
void | setDefaultLoaderCallbacks (TSLLoaderAppCallback callback, void *arg, TSLAllLoadedCallback allLoadedCallback=0, void *arg2=0) |
bool | setDefaultTileLoadSize (int sizeX=512, int sizeY=512) |
bool | setImageRequestFormat (int index) |
bool | setImageRequestFormat (const char *format) |
bool | setInitialRequestWMSVersion (TSLWMSVersionEnum version) |
bool | setLinearTransformParameters (bool automatic, double muShiftX, double muShiftY, double tmcPerMU) |
void | setSynchronousLoading (bool synchronousLoading) |
void | setTransparent (bool value) |
void | setTransverseMercatorJHSFormula (bool jhs) |
bool | synchronousLoadStrategy () const |
void | synchronousLoadStrategy (bool useSynchronousStrategy) |
TileLevelStrategy | tileLevelStrategy () const |
void | tileLevelStrategy (TileLevelStrategy strategy) |
TileLoadOrderStrategy | tileLoadOrder () const |
void | tileLoadOrder (TileLoadOrderStrategy strategy) |
void | tileRequests (bool tile) |
bool | tileRequests () const |
void | useDynamicArcForWGS84 (bool useDynamicArc) |
bool | useDynamicArcForWGS84 () const |
bool | validateCache () |
void | validateGetMapRequest (bool validate) |
bool | validateGetMapRequest () const |
void * | operator new (size_t size, char *filename, int line) |
![]() | |
void | addDrawingCallback (TSLDataLayerDrawingCallback *drawingCallback) |
bool | addFeatureRendering (const char *featureName, TSLFeatureID featureID) |
bool | addLoader (TSLFileLoader *loader, TSLLoaderAppCallback callback, void *arg, TSLAllLoadedCallback allLoadedCallback=0, void *arg2=0) |
bool | addPathList (const TSLPathList *path_list) |
void | cancelFlashback () |
bool | clearFeatureRendering (const char *featureName, TSLFeatureID featureID) |
TSLDataHandler * | createDataHandler (const char *config_file=0) |
TSLHistoryVersion | currentVersion () const |
TSLDataHandler * | dataHandler () |
const TSLDataHandler * | dataHandler () const |
void | destroy () |
bool | entityIsVisible (const TSLEntity *entity, const TSLDrawingSurface *drawingSurface) const |
const TSLFeatureClassList * | featureList () const |
const TSLFeatureClassList * | featureList (const char *detailLayerName) const |
bool | fileModificationTime (const char *filename, TSLTimeType &lastModificationTime) |
TSLEntity * | findEntity (TSLTMC x, TSLTMC y, TSLTMC aperture, int depth, const char *featureName=0, int drawingSurfaceID=-1) |
bool | findFile (const char *filename, TSLSimpleString &foundPath) const |
void | flashbackToTimestamp (TSLHistoryTimestamp timestamp, TSLLayerArchiveCallback archiveCallback, void *arg=0) |
void | flashbackToTimestamp (TSLHistoryTimestamp timestamp, TSLLayerArchiveTileCallback archiveTileCallback, void *arg=0) |
void | flashbackToVersion (TSLHistoryVersion version, TSLLayerArchiveCallback archiveCallback, void *arg=0) |
void | flashbackToVersion (TSLHistoryVersion version, TSLLayerArchiveTileCallback archiveTileCallback, void *arg=0) |
bool | getActiveLayerName (const TSLEnvelope &extent, double screenResolution, TSLSimpleString &activeLayerName) const |
TSLEntityIterator * | getEntityIterator (const char *detailLayer, TSLSelector *selector=NULL, TSLEnvelope *extent=NULL, bool splitOptimisedPrimitives=true) |
bool | getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeInt attribute, int *result) const |
bool | getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeDouble attribute, double *result) const |
bool | getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeBool attribute, bool *result) const |
bool | getFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributes *result) const |
TSLFileLoader * | getLoader () |
bool | getMUExtent (double *x1, double *y1, double *x2, double *y2, int drawingSurfaceID=-1) const |
bool | getTMCExtent (TSLTMC *x1, TSLTMC *y1, TSLTMC *x2, TSLTMC *y2, int drawingSurfaceID=-1) const |
bool | getUUExtent (double *x1, double *y1, double *x2, double *y2, const TSLDrawingSurface *drawingSurface) const |
bool | importHistory (TSLHistoryVersion mapVersion, TSLHistoryTimestamp timestamp, TSLHistoryImportSet *historySet) |
bool | latLongToTMC (double latitude, double longitude, TSLTMC *x, TSLTMC *y, bool local=false) const |
bool | latLongToTMC (int num, double *latitudes, double *longitudes, TSLTMC *xs, TSLTMC *ys, bool local=false) const |
TSLDataLayerTypeEnum | layerType () const |
bool | loadData (const char *filename) |
bool | loadRendering (const char *filename) |
void | notifyChanged (bool changed=true) |
TSLMapQuery * | query (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2, int depth=-1, const char *featureName=NULL, int drawingSurfaceID=-1) const |
TSLMapQuery * | query (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2, TSLSelector *selector, int drawingSurfaceID=-1) const |
const TSLCoordinateSystem * | getCoordinateSystem () const |
bool | queryVersionHistory (const TSLEnvelope &extent, TSLVersionHistorySet &history) |
void | refreshFlashback () |
bool | removeData () |
void | releaseResources (int surfaceID) |
bool | saveRendering (const char *filename, TSLMapLinkVersion ver=TSL_CURRENT_MAPLINK_VERSION) |
bool | setCoordinateSystem (const TSLCoordinateSystem *coordinateSystem) |
bool | setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeInt attribute, int value) |
bool | setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeDouble attribute, double value) |
bool | setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributeBool attribute, bool value) |
bool | setFeatureRendering (const char *featureName, TSLFeatureID featureID, TSLRenderingAttributes *value) |
bool | TMCToLatLong (TSLTMC x, TSLTMC y, double *latitude, double *longitude, bool local=false, bool boundCheck=true) const |
bool | TMCToLatLong (int num, TSLTMC *xs, TSLTMC *ys, double *latitudes, double *longitudes, bool local=false) const |
const TSLVersionHistorySet * | versionHistory () const |
Static Public Member Functions | |
static bool | crsIsSupported (const char *crs) |
Enumeration that describes how tile levels are determined. In versions of MapLink prior to MapLink 7.0, tiles were always loaded in levels which can cause vector data to appear distorted. It is now possible to load tiles at the current zoom level or by detecting whether levels should be used or not based upon the service's capabilities.
Enumeration that determines the order in which tiles should be loaded for a view.
TSLWMSDataLayer::TSLWMSDataLayer | ( | TSLWMSServiceSettingsCallbacks * | callbacks | ) |
Constructor for the TSLWMSDataLayer
callbacks | The user implemented callback interface class that will be queried if the data layer has insufficient information to use the WMS. It is also used for setting which WMS layers should be set to visible. |
TSLWMSDataLayer::TSLWMSDataLayer | ( | const TSLWMSDataLayer & | ) |
copy constructor that clones all the layer parameters.
const char * TSLWMSDataLayer::activeCRS | ( | ) | const |
Returns the current Coordinate Reference System (CRS) string used by the data layer in requests to the server. This string corresponds to the selection returned from TSLWMSServiceSettingsCallbacks::onChoiceOfServiceCRSs.
If no service has been loaded or the callback sequence has not completed this method returns NULL.
int TSLWMSDataLayer::cacheFlushLimit | ( | ) |
Query the current flush limit.
When the cache is full the system will remove the least recently used files to make room for the new data to load. The cache flush limit indicates the number of most recently used data files that the system will try keep in memory while flushing the cache. If the system cannot free enough memory and keep the flush limit number of files it will temporarily halve the flush limit until the cache memory usage is below 90% of the allowable cache size.
Returns the current flush limit.
void TSLWMSDataLayer::cacheFlushLimit | ( | int | flush_limit | ) |
Sets cache flush limit.
This method allows the user to set the cache flush limit for the TSLWMSDataLayer. When the cache is full the system will remove the least recently used files to make room for the new data to load. The cache flush limit indicates the number of most recently used data files that the system will try keep in memory while flushing the cache. If the system cannot free enough memory and keep the flush limit number of files it will temporarily halve the flush limit until the cache memory usage is below 90% of the allowable cache size.
flush_limit | Number of most recently used data files that the system will try to keep in memory while flushing the cache. |
int TSLWMSDataLayer::cacheSize | ( | ) |
Query the amount of memory that the cache may currently use, in kilobytes.
void TSLWMSDataLayer::cacheSize | ( | int | new_size | ) |
Set maximum size of the tile cache.
This method allows the user to set the amount of memory that the tile cache can use. To reduce the number of server transactions, the TSLWMSDataLayer holds recent tiles in memory so that it does not need to re-request data from the WMS every time a draw request is made. The larger the cache size the more data can be held in memory and draw requests are handled much more efficiently. However the client application must find a compromise between a large cache size and the memory requirements of the application itself.
The default tile cache is 32Mb (32768 KB)
new_size | Allowable size of the cache in kilobytes. |
const TSLWMSServiceCapability * TSLWMSDataLayer::capabilityInformation | ( | ) | const |
Returns details of the capability element of the service's capabilities.
If a service has not been loaded yet, null will be returned.
void TSLWMSDataLayer::clearBackgroundColour | ( | ) |
Clears the value of the bgcolor parameter passed to the server when performing GetMap requests, meaning that the parameter will no longer be passed. This will mean that the server will use the default value of this parameter.
bool TSLWMSDataLayer::clearCache | ( | ) |
Clear the tile cache for this TSLWMSDataLayer.
This method requests the TSLWMSDataLayer to clear all cached data from memory. After a call to clearCache any draw operation involving the TSLWMSDataLayer will re-load all tiles from the WMS server.
Returns true on success, false otherwise.
void TSLWMSDataLayer::clearTransparent | ( | ) |
Clears the value of the transparent parameter passed to the server when performing GetMap requests, meaning that the parameter will no longer be passed. This will mean that the server will use the default value of this parameter.
bool TSLWMSDataLayer::configurePersistentCache | ( | const TSLPersistentCacheData * | settings, |
TSLTileValidationFn | validFn = NULL, | ||
void * | arg = NULL ) |
Adds and configures a persistent tile cache.
A persistent tile cache may be used to speed up the loading of tiles which have been downloaded via a slow connection, eg. web-based.
A persistent tile cache works in parallel to the memory tile cache. If a tile is not found in memory, then the persistent tile cache is searched. If it is found in the persistent tile cache, then the (optional) tile validation function is called to verify that the file is up-to-date. If so, then the tile is loaded and added to the memory tile cache. If the tile is not found in the persistent tile cache, then if configured, a local search may be performed using the TSLPathList added to the TSLDataLayer. If the tile is found locally or is invalid, it is added to the memory cache and optionally to the persistent cache. If the tile is not found locally, then it may be returned in the failure list of the draw function, if specified.
settings | A TSLPersistentCacheData object containing the settings to use for the persistent cache. |
validFn | This is an optional function that may be used to validate any tiles that are in the cache, prior to them being used. If not specified, then all tiles in the cache are deemed to be valid. |
arg | An optional argument that will be passed to the user's validation function. |
|
static |
Returns whether the given Coordinate Reference System (CRS) string is supported by MapLink, and thus whether a layer from a WMS service that uses this CRS can be used with the TSLWMSDataLayer.
CRS strings can be retrieved through TSLWMSServiceLayer::getCRSAt once the data layer has been connected to a service. During the callback sequence when connecting to a data layer MapLink will internally validate that the selected layers use a supported coordinate system and will not allow the use of layers that have no supported coordinate systems, so using this method is not mandatory.
This method is provided to allow an application to test whether the use of a specific CRS advertised by a TSLWMSServiceLayer is valid while the data layer's callback sequence is still in progress, which can be useful when presenting the available layers on the service as part of a user interface.
double TSLWMSDataLayer::extentExpansion | ( | ) | const |
Gets the percentage by which the data extent should be expanded.
Returns the percentage by which the data extent should be expanded. Should either be a non-negative value, in which case data extent expansion is turned on and the data extent is expanded by the specified percentage, or it should be -1, in which case data extent expansion is turned off. By default, data extent expansion is turned off (i.e. the initial value is -1)
void TSLWMSDataLayer::extentExpansion | ( | double | percent | ) |
Sets the percentage by which the data extent should be expanded. Should either be a non-negative value, in which case data extent expansion is turned on and the data extent is expanded by the specified percentage, or it should be -1, in which case data extent expansion is turned off. By default, data extent expansion is turned off (i.e. the initial value is -1)
percent | The percentage by which the data extent should be expanded. |
bool TSLWMSDataLayer::getBackgroundColour | ( | unsigned char & | r, |
unsigned char & | g, | ||
unsigned char & | b ) const |
Queries the value of the bgcolor parameter passed to the server when performing GetMap requests. This value can be set via the setBackgroundColour method or cleared so that the parameter is not passed via the clearBackground method.
r | The red component of the value that will be passed in the transparent bgcolor of each GetMap request. |
g | The green component of the value that will be passed in the transparent bgcolor of each GetMap request. |
b | The blue component of the value that will be passed in the transparent bgcolor of each GetMap request. |
const char * TSLWMSDataLayer::getCurrentImageRequestFormat | ( | ) | const |
Returns the image format currently used by the data layer in requests to the service.
If no service has been loaded into the data layer, or the callback sequence has not been completed this method will return NULL.
bool TSLWMSDataLayer::getGetFeatureInfoFormats | ( | char **& | formats, |
int & | noOfFormats, | ||
bool | onlyStandard = true ) const |
get all getfeatureinfo output formats that the layer supports
bool TSLWMSDataLayer::getGetMapFormats | ( | char **& | formats, |
int & | noOfFormats, | ||
bool | onlyStandard = true ) const |
get all getmap output formats that the layer supports
const char * TSLWMSDataLayer::getImageRequestFormatAt | ( | int | index | ) | const |
Returns the image format advertised by the service at the given index. If no service has been loaded into the data layer, or the callback sequence has not been completed this method will return NULL.
TSLWMSVersionEnum TSLWMSDataLayer::getInitialRequestWMSVersion | ( | ) | const |
This function returns the WMS version the WMSDataLayer initially requests. This is defaulted to the highest supported WMS version.
void TSLWMSDataLayer::getLinearTransformParameters | ( | bool & | automatic, |
double & | muShiftX, | ||
double & | muShiftY, | ||
double & | tmcPerMU ) const |
This method should be used to query the linear transform that is used to convert from the WMS layers' MU values to TMC. By default, the parameters of this transform are determined automatically by the data layer, but if the layer is to be used in conjunction with other map data, for instance from a map data layer, it may be desired to use a common transform so that all data in the drawing surface appears correctly positioned. The transform parameters may be set via the setLinearTransformParameters method.
This method may be called at any point in the lifetime of the data layer.
automatic | If this parameter returns true then the data layer will attempt to determine a valid transform so that all visible WMS layers will fit into the available TMC space and the remaining parameters to this method should be ignored. If set to false then the remaining parameters will be valid. |
muShiftX | If the automatic parameter is set to false, then the value that this parameter will return defines the x origin for the TMC coordinate system |
muShiftY | If the automatic parameter is set to false, then the value that this parameter will return defines the y origin for the TMC coordinate system |
tmcPerMU | If the automatic parameter is set to false, then the value that this parameter will return defines the relationship between internal units (TMCs) and map units. |
const char * TSLWMSDataLayer::getOutputFormat | ( | ) | const |
get current getmap output format
const char ** TSLWMSDataLayer::getSupportedCRSs | ( | int & | noOfCRSChoices | ) |
Get supported CRSs by the data layer [this is set once after loading the data layer]. The client application is responsible for deleting the returned array.
Example: int noOfCRSChoices = 0; const char ** crsNames = wmsDataLayer->getSupportedCRSs( noOfCRSChoices ); delete [] crsNames;
noOfCRSChoices | The size of the array passed as crsChoices. |
bool TSLWMSDataLayer::getSynchronousLoading | ( | ) |
This method returns the current status of the synchronous loading flag.
Note: This method queries whether the map data is loaded synchronously or asynchronously and is different from the 'synchronousLoadStrategy' method contained within this class.
bool TSLWMSDataLayer::getTransparent | ( | bool & | value | ) | const |
Queries the value of the transparent parameter passed to the server when performing GetMap requests. This value can be set via the setTransparent method or cleared so that the parameter is not passed via the clearTransparent method.
value | The value that will be passed in the transparent parameter of each GetMap request. |
bool TSLWMSDataLayer::getTransverseMercatorJHSFormula | ( | ) | const |
Queries if the Transverse Mercator JHS formula is to be used when data is in a Transverse Mercator projection.
The setting will be used to create a local Coordinate System to place the retrieved data. If the setting is changed after the layer has been configured or during layer configuration you may either end up using the USGS Snyder or JHS formula, which you end up with is undefined in these cases.
The default setting is to use the USGS Snyder formula.
Returns true if the layer is set to use the JHS formula for Transverse Mercator.
void TSLWMSDataLayer::invertXYAxis | ( | bool | invert | ) |
Controls whether the X and Y axis will be reversed in requests made to the WMS. This option is only needed for some non-compliant WMS servers when using the EPSG:4326 or CRS:84 coordinate systems, and should normally be left on the default value.
If tiles do not appear in the correct place in the data layer when using one of the above coordinate systems, enabling this option may allow layers from the server to be displayed correctly.
bool TSLWMSDataLayer::loadDataWithECP | ( | const char * | serviceURL, |
const char * | federationMetadataURL ) |
This method should be called instead of the loadData when wanting to access a WMS using the 'Enhanced Client or Proxy' (ECP) profile of the 'Security Assertion Markup Language' (SAML) version 2.0 standard. SAML v2.0 ECP is basically a standardised way of communicating with a remote server from a client application securely and with authentication.
In order to use ECP, the callback class that was provided during construction of the data layer must have derived from TSLWMSECPServiceSettingsCallbacks or this call will fail.
serviceURL | The url of the WMS server. This should be in the same form as would be passed to the loadData method of this class. |
federationMetadataURL | The url of the SAML v2.0 federation metadata. The federation metadata is used to determine the various 'Identity Providers' (IDPs) and the profiles, such as ECP, that they support. An IDP is used to authenticate against in order to access the WMS service. |
bool TSLWMSDataLayer::loadWmsRequest | ( | const char * | inputRequest, |
char *& | output ) |
Send wms request and return its request (used to send getfeatureinfo request and return its string output)..
inputRequest | The request to send to the wms server. |
output | The output response from the server. |
int TSLWMSDataLayer::noOfImageRequestFormats | ( | ) | const |
Returns the number of image formats that the WMS the data layer is connected to supports. If no service has been loaded into the data layer, or the callback sequence has not been completed this method will return 0.
void * TSLWMSDataLayer::operator new | ( | size_t | size, |
char * | filename, | ||
int | line ) |
When included in an MFC application in debug mode, the debug new expects this to be here. Override it and return the same as the normal one. The library must include it when compiled in release mode, since the user's application may be in debug mode.
double TSLWMSDataLayer::pyramidScaleFactor | ( | ) | const |
Returns the level at which the data layer will switch to the next detail level in its internal pyramid.
A value of 1.0 means the layer will switch when tiles in the current level of the pyramid would be of a lower resolution than the displayed area. Values less than 1.0 mean that tiles will be stretched to cover the relevant area, while values greater than 1.0 mean tiles will be requested in higher resolution than the displayed area.
The default value is 1.4.
This setting may be ignored based upon the tileLevelStrategy setting used or if tiling of requests is turned off.
void TSLWMSDataLayer::pyramidScaleFactor | ( | double | factor | ) |
Sets the level at which the data layer will switch to the next detail level in its internal pyramid.
A value of 1.0 means the layer will switch when tiles in the current level of the pyramid would be of a lower resolution than the displayed area. Values less than 1.0 mean that tiles will be stretched to cover the relevant area, while values greater than 1.0 mean tiles will be requested in higher resolution than the displayed area.
The default value is 1.4.
This setting may be ignored based upon the tileLevelStrategy setting used or if tiling of requests is turned off.
const TSLCoordinateSystem * TSLWMSDataLayer::queryCoordinateSystem | ( | ) | const |
Query for the coordinate system used by this layer to convert between map units and lat/long.
This method requests the TSLWMSDataLayer to return a TSLCoordinateSystem object which allows the user to access information concerning the transforms used to create the layer. The TSLCoordinateSystem is only valid as long as no new service has been loaded into the layer since last obtaining the component.
bool TSLWMSDataLayer::reset | ( | ) |
Resets the visibility, dimensions and style values associated with each layer and causes the callbacks to be restarted. If the callback loop is currently running or no data is loaded then this method will return false.
NOTE: The callbacks made during this call will always be synchronous.
TSLWMSServiceLayer * TSLWMSDataLayer::rootServiceLayer | ( | ) |
Provides access to the root layer of the loaded service, allowing for changes to be made to the data layer's configuration after the callback sequence has completed.
Applications should not store the returned pointer from this function as it will become immediately invalid following a call to loadData(), reset() or removeData().
The data layer does not enforce thread safety on access through this object, therefore an application should only modify settings in the same thread as the drawing surface containing the TSLWMSDataLayer.
If no service has been loaded into the data layer or the callback sequence has not completed this method will return NULL.
const TSLWMSServiceLayer * TSLWMSDataLayer::rootServiceLayer | ( | ) | const |
Provides access to the root layer of the loaded service.
Applications should not store the returned pointer from this function as it will become immediately invalid following a call to loadData(), reset() or removeData().
const TSLWMSServiceInfo * TSLWMSDataLayer::serviceInformation | ( | ) | const |
Returns details of the service element of the service's capabilities.
If a service has not been loaded yet, null will be returned.
bool TSLWMSDataLayer::setActiveCRS | ( | const char * | crs | ) |
Set the active CRS.
Since the default behaviour is that while loading the datalayer, (onChoiceOfServiceCRSs) call back method is called to ask the application to choose one of the available coordinate systems to be used by the datalayer. This method allow changing the CRS on the go after the loading.
crs | coordinate system to be set. It must be supported by the data layer. |
void TSLWMSDataLayer::setBackgroundColour | ( | unsigned char | r, |
unsigned char | g, | ||
unsigned char | b ) |
Sets the value of the bgcolor parameter passed to the server when performing GetMap requests. This value can be queried via the getBackgroundColour method or cleared so that the parameter is not passed via the clearBackground method.
r | The red component of the value that will be passed in the transparent bgcolor of each GetMap request. |
g | The green component of the value that will be passed in the transparent bgcolor of each GetMap request. |
b | The blue component of the value that will be passed in the transparent bgcolor of each GetMap request. |
void TSLWMSDataLayer::setDefaultLoaderCallbacks | ( | TSLLoaderAppCallback | callback, |
void * | arg, | ||
TSLAllLoadedCallback | allLoadedCallback = 0, | ||
void * | arg2 = 0 ) |
By default, if the user does not provide a TSLFileLoaderRemote object to the data layer, the layer will use its own internal loader. This method allows the callbacks to this internal loader to be set. Calling this method having already provided a file loader via the TSLDataLayer::addLoader will revert the file loader to the internal loader.
callback | A callback that provides feedback on the progress of loading the layers data |
arg | The user value that will be provided during each call the callback function |
allLoadedCallback | A callback that will be called when all of the visible tiles have been loaded. If all of the tiles are loaded from the tilecache then this callback will not be made. |
arg2 | The user value that will be provided during each call the allLoadedCallback function |
bool TSLWMSDataLayer::setDefaultTileLoadSize | ( | int | sizeX = 512, |
int | sizeY = 512 ) |
By default tiles are loaded from the WMS using the size 512x512. When the layer has no data loaded onto it, these values can be changed via this method.
NOTE: If the service dictates a fixed request size, these default values will be ignored.
sizeX | The default width of a tile |
sizeY | The default height of a tile. |
bool TSLWMSDataLayer::setImageRequestFormat | ( | const char * | format | ) |
Changes the image format used in requests by the data layer to the given format. This method allows the image format used by the data layer to be changed after the callback sequence is complete. Calling this method before the callback sequence has completed will have no effect.
Changing the request image format will automatically clear the layer's internal cache.
If no service has been loaded into the data layer, the callback sequence has not been completed or the currently connected service does not support the given format then this method will not change the request format and return false.
bool TSLWMSDataLayer::setImageRequestFormat | ( | int | index | ) |
Changes the image format used in requests by the data layer to the format as returned by getImageRequestFormatAt(index). This method allows the image format used by the data layer to be changed after the callback sequence is complete. Calling this method before the callback sequence has completed will have no effect.
Changing the request image format will automatically clear the layer's internal cache.
If no service has been loaded into the data layer, or the callback sequence has not been completed this method will not change the request format and return false.
bool TSLWMSDataLayer::setInitialRequestWMSVersion | ( | TSLWMSVersionEnum | version | ) |
This function overrides the WMS version that the data layer starts the version negotiation with the remote server the WMSDataLayer initially requests. The default value is the highest currently supported version. WMS version 1.0.0 is not supported by the TSLWMSDataLayer and the equivalent enumeration value should not be passed to this function. For unsupported versions: false will be returned and no action taken.
Note:This should not be necessary for servers that return OGC Standard Compliant responses and is provided to enable Users to force a server to return a request in a specified version.
bool TSLWMSDataLayer::setLinearTransformParameters | ( | bool | automatic, |
double | muShiftX, | ||
double | muShiftY, | ||
double | tmcPerMU ) |
This method should be used to set the linear transform that is used to convert from the WMS layers' MU values to TMC. By default, the parameters of this transform are determined automatically by the data layer, but if the layer is to be used in conjunction with other map data, for instance from a map data layer, it may be desired to use a common transform so that all data in the drawing surface appears correctly positioned.
This method may be called either before the loadData method is made, during the onCapabilitiesLoaded or onUserLinearTransformInvalid callbacks to the TSLWMSServiceSettingsCallback or before a reset call is made to the data layer. Calling this method during or after the onServiceSettingsComplete callback has been made will have no effect. If the linear transform parameters passed to this method will not allow all the visible WMS data to fit into the available TMC space, then the onUserLinearTransformInvalid callback will be invoked, allowing the user to specify new transform parameters.
automatic | If set to true then the data layer will attempt to determine a valid transform so that all visible WMS layers will fit into the available TMC space and the remaining parameters to this method will be ignored. If set to false then the layer will use the remaining parameters. |
muShiftX | Defines the x origin for the TMC coordinate system |
muShiftY | Defines the y origin for the TMC coordinate system |
tmcPerMU | Defines the relationship between internal units (TMCs) and map units. |
void TSLWMSDataLayer::setLogWMSOutputRequests | ( | bool | value | ) |
std::cout the output WMS requests [ONLY for Debugging]
bool TSLWMSDataLayer::setOutputFormat | ( | const char * | format, |
bool | checkStandard = true ) |
set getmap output format specifically
format | The format that will be used to send getMap requests |
onlyStandard | allow changing the format only if it is standard |
void TSLWMSDataLayer::setSynchronousLoading | ( | bool | synchronousLoading | ) |
Call with the synchronous parameter set to true to load map data synchronously, it also inhibits callbacks after each map tile is loaded.
Note: This method sets whether the map data is loaded synchronously or asynchronously and is different from the 'synchronousLoadStrategy' method contained within this class.
void TSLWMSDataLayer::setTransparent | ( | bool | value | ) |
Sets the value of the transparent parameter passed to the server when performing GetMap requests. This value can be queried via the getTransparent method or cleared so that the parameter is not passed via the clearTransparent method.
value | The value that will be passed in the transparent parameter of each GetMap request. |
void TSLWMSDataLayer::setTransverseMercatorJHSFormula | ( | bool | jhs | ) |
If passed true then the Transverse Mercator JHS formula will be used when using a WMS Server that provides data in a Transverse Mercator projection..
The setting will be used to create a local Coordinate System to place the retrieved data. If the setting is changed after the layer has been configured or during layer configuration you may either end up using the USGS Snyder or JHS formula, which you end up with is undefined in these cases.
The default setting is to use the USGS Snyder formula.
jhs | pass true to use the JHS formula, pass false to use the USGS Snyder formula. |
bool TSLWMSDataLayer::synchronousLoadStrategy | ( | ) | const |
Queries whether during the next load (of a service) the user callbacks will be made synchronously or asynchronously.
void TSLWMSDataLayer::synchronousLoadStrategy | ( | bool | useSynchronousStrategy | ) |
Specifies whether during the next load (of a service) the user callbacks will be made synchronously or asynchronously.
TileLevelStrategy TSLWMSDataLayer::tileLevelStrategy | ( | ) | const |
Queries the tile level strategy. The default is TileLevelStrategyUseLevels.
The strategy determines the whether tile levels are used to load data, which can reduce traffic to the server but also distort images created from vector features or containing text.
See the documentation for the TileLevelStrategy enumeration for further details.
This setting will be ignored if tiling of requests is turned off.
void TSLWMSDataLayer::tileLevelStrategy | ( | TileLevelStrategy | strategy | ) |
Set the tile level strategy. The default is TileLevelStrategyUseLevels.
The strategy determines the whether tile levels are used to load data, which can reduce traffic to the server but also distort images created from vector features or containing text.
See the documentation for the TileLevelStrategy enumeration for further details.
This setting will be ignored if tiling of requests is turned off.
TileLoadOrderStrategy TSLWMSDataLayer::tileLoadOrder | ( | ) | const |
Query the tile load order strategy.
The strategy determines the order that the tiles required for a particular view are requested. Refer to the documentation for the TileLoadOrderStrategy enumeration for details of the choices.
This setting will be ignored if tiling of requests is turned off.
void TSLWMSDataLayer::tileLoadOrder | ( | TileLoadOrderStrategy | strategy | ) |
Set the tile load order strategy.
The strategy determines the order that the tiles required for a particular view are requested. Refer to the documentation for the TileLoadOrderStrategy enumeration for details of the choices.
This setting will be ignored if tiling of requests is turned off.
bool TSLWMSDataLayer::tileRequests | ( | ) | const |
Returns whether the data layer will request one tile covering the extent of the view when drawing, or splits the requests into a series of smaller tiles. Tiling allows the data layer to retain and display previous data retrieved from the WMS when panning and zooming.
By default tiling is enabled.
void TSLWMSDataLayer::tileRequests | ( | bool | tile | ) |
Sets whether the data layer will request one tile covering the extent of the view when drawing, or splits the requests into a series of smaller tiles. Tiling allows the data layer to retain and display previous data retrieved from the WMS when panning and zooming.
By default tiling is enabled.
bool TSLWMSDataLayer::useDynamicArcForWGS84 | ( | ) | const |
Returns whether the data layer should treat EPSG:4326 and CRS:84 coordinate systems as Dynamic Arc.
If true, when the data layer is used with a WMS server that only advertises support for the EPSG:4326 or CRS:84 coordinate system, or the application's TSLWMSServiceSettings::onChoiceOfServiceCRSs callback implementation chooses to use either EPSG:4326 or CRS:84 the data layer will create and return a Dynamic Arc coordinate system from queryCoordinateSystem(). If false, the data layer will create and return a WGS84 coordinate system from queryCoordinateSystem() in this case.
When using multiple data layers in the same drawing surface it is necessary to ensure all the layers have compatible coordinate systems in order for them to align correctly. This method allows the application to ensure that the correct type of coordinate system is used by the WMS data layer when overlaying it on top other data layers which use either Dynamic Arc or WGS84 coordinate systems.
The default is to use a Dynamic Arc coordinate system to represent EPSG:4326 and CRS:84.
void TSLWMSDataLayer::useDynamicArcForWGS84 | ( | bool | useDynamicArc | ) |
Controls whether the data layer should treat EPSG:4326 and CRS:84 coordinate systems as Dynamic Arc.
If true, when the data layer is used with a WMS server that only advertises support for the EPSG:4326 or CRS:84 coordinate system, or the application's TSLWMSServiceSettings::onChoiceOfServiceCRSs callback implementation chooses to use either EPSG:4326 or CRS:84 the data layer will create and return a Dynamic Arc coordinate system from queryCoordinateSystem(). If false, the data layer will create and return a WGS84 coordinate system from queryCoordinateSystem() in this case.
When using multiple data layers in the same drawing surface it is necessary to ensure all the layers have compatible coordinate systems in order for them to align correctly. This method allows the application to ensure that the correct type of coordinate system is used by the WMS data layer when overlaying it on top other data layers which use either Dynamic Arc or WGS84 coordinate systems.
The default is to use a Dynamic Arc coordinate system to represent EPSG:4326 and CRS:84.
bool TSLWMSDataLayer::userLoadData | ( | TSLWMSServiceUserSettingsCallbacks * | userCallBack | ) |
This method should be called instead of the loadData when the user wants to provide the layer's information without calling the default getcapabilities. So it loads the data layer with the user custom information instead of getcapabilities information.
The default loading behaviour is done by calling the method (loadData) which performs getCapabilities to extract the WMS DataLayer's information and update the layer's objects.
This new method uses a call back class so that the user can provide the main information without calling getCapabilities.This is supposed to speed up the loading process in the cases that we know the layer's main information [for example: saved in a database].
The application needs to provide the data layer with a user callback class instance that derives from TSLWMSServiceUserSettingsCallbacks.
userCallBack | user callback class instance that derives from TSLWMSServiceUserSettingsCallbacks to provide the layer's information. |
bool TSLWMSDataLayer::validateCache | ( | ) |
Validate the tiles in the persistent tile cache for this layer
Returns true on success, false otherwise.
bool TSLWMSDataLayer::validateGetMapRequest | ( | ) | const |
Queries whether or not the GetMap HTTP GET address queried from the capabilities document of a WMS is validated before being used.
The standard mandates that the OnlineResource entry should end in '?' or '&'.
If validation is set to true, the data layer will ensure that the address either ends with a '?' or '&'. If it does not, then a check is made to see whether a '?' exists in the address; if it is then an '&' is appended, otherwise a '?'.
By default this setting is off.
Note: The value of this flag will be applied immediately after the onServiceSettingsComplete() callback has been invoked. This will happen during a loadData() or reset() call.
void TSLWMSDataLayer::validateGetMapRequest | ( | bool | validate | ) |
Sets whether or not the GetMap HTTP GET address queried from the capabilities document of a WMS is validated before being used.
The standard mandates that the OnlineResource entry should end in '?' or '&'.
If validation is set to true, the data layer will ensure that the address either ends with a '?' or '&'. If it does not, then a check is made to see whether a '?' exists in the address; if it is then an '&' is appended, otherwise a '?'.
By default this setting is off.
Note: The value of this flag will be applied immediately after the onServiceSettingsComplete() callback has been invoked. This will happen during a loadData() or reset() call.
validate | A flag to set whether or not validation is turned on. |