MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches

Detailed Description

This class provides helper functions for use in MapLink WMS plug-ins.

Classes

class  TSLCSVParseResults
 

Public Types

enum  TSLCSVParseErrorTypeEnum {
  TSLCSVParseErrorTypeOK , TSLCSVParseErrorTypeUnknownError , TSLCSVParseErrorTypeUnexpectedDoubleQuote , TSLCSVParseErrorTypeUnexpectedTextAfterDoubleQuote ,
  TSLCSVParseErrorTypeUnterminatedDoubleQuotes
}
 

Static Public Member Functions

static const char * getFileNameFromPath (const char *path)
 
static const TSLCSVParseResultsparseCSVString (const char *str, TSLCSVParseErrorTypeEnum *errorType=0, unsigned int *charPosReached=0, unsigned int *resultIndexReached=0)
 
static bool populateMapPathlist (const char *mapPath, TSLPathList *pathList)
 
static bool splitQuery (const TSLFeatureClassList *mapFeatureList, const char **queryFeatures, int noOfQueryFeatures, TSLWMSSplitQueryResultSet *&results)
 

Member Enumeration Documentation

◆ TSLCSVParseErrorTypeEnum

An error code returned by TSLWMSPluginHelper::parseCSVString.

Enumerator
TSLCSVParseErrorTypeOK 

No error occurred.

TSLCSVParseErrorTypeUnknownError 

Some unknown error occurred.

TSLCSVParseErrorTypeUnexpectedDoubleQuote 

A double-quote was encountered in the middle of a value. To include a double-quote literally, the whole value needs to be enclosed in double-quotes, and the double-quote doubled up.

TSLCSVParseErrorTypeUnexpectedTextAfterDoubleQuote 

Something other that a comma followed a closing double-quote.

TSLCSVParseErrorTypeUnterminatedDoubleQuotes 

A value in the string didn't have a closing double-quote.

Member Function Documentation

◆ getFileNameFromPath()

static const char * TSLWMSPluginHelper::getFileNameFromPath ( const char * path)
static

Given a fully qualified path, this method will return a pointer to the passed string at the index where the path is no longer qualified. Note this function does not check for the existence of the passed path.

Parameters
pathThe fully qualified path
Returns
a pointer to the passed string at the point where the file location is not longer qualified.

◆ parseCSVString()

static const TSLCSVParseResults * TSLWMSPluginHelper::parseCSVString ( const char * str,
TSLCSVParseErrorTypeEnum * errorType = 0,
unsigned int * charPosReached = 0,
unsigned int * resultIndexReached = 0 )
static

Tokenise a string containing comma-separated-values.

All whitespace is significant in the string. To use a comma in a value, enclose the whole value in double-quotes. To use a double-quote in double-quotes, follow it with another double-quote. A double-quote cannot be used outside double-quotes.

Examples: (We use square brackets as string delimiters in the following for clarity.) The input string ["ab,",c ,,d,"","e""",] will produce 7 values as output: [ab,] [c ] [] [d] [] [e"] []. The input [,,,,] will produce 5 empty strings as output. The input [] will produce 1 empty string as output.

Parameters
strInput string to be tokenised.
errorTypeWill be set to the kind of syntax error that occurred, if any. Pass NULL to throw away this information.
charPosReachedWill be set to the character position of the first syntax error, if one occurred, or else the position of the terminating NUL character. Pass NULL to throw away this information.
resultIndexReachedWill be set to the number of delimiters (unquoted commas) before the position of the first syntax error (or the NUL, if no error occurred). Pass NULL to throw away this information.
Returns
the list of strings, if tokenisation succeeded. This list will need to be destroyed when it is no longer needed. Returns NULL, if there was a syntax error in the input string.

◆ populateMapPathlist()

static bool TSLWMSPluginHelper::populateMapPathlist ( const char * mapPath,
TSLPathList * pathList )
static

If a plug-in requires the loading of a MapLink Map, then there is one very important consideration that this methods aids in addressing. When loading a map, the palette file for that map will overwrite the global palette used by all drawing surfaces in that process. Normally in MapLink this isn't an issue as the use of MapLink is usually in a single threaded environment and with only a single drawing surface in existence at anyone time. For the MapLink WMS, where usually many drawing surfaces will be used in a fully multithreaded environment, we have to prevent the loading of the palette file or we will crash the process.

To prevent the TSLMapDataLayer loading the .pal file for the loading map, we provide it with a pathlist before calling TSLMapDataLayer::loadData. This function will populate a TSLPathList object based upon the path for the map so that the palette is not loaded. The user should provide the fully qualified path to the map and TSLPathList which after this call should be given to the map data layer using the TSLMapDataLayer::addPathList call.

When the subsequent TSLMapDataLayer::loadData method is called the user must not provide the fully qualified path to the map. No path, fully qualified or relative, should be included. The removal of the path from the sting passed as the mapPath argument to this function can be achieved using the helper method getFileNameFromPath().

Parameters
mapPathThe fully qualified path to the MapLink map. If this path is invalid or null then the call will return false.
pathListA pathlist object. If this object is not valid then the call will return false;
Returns
true on successful population, false otherwise.

◆ splitQuery()

static bool TSLWMSPluginHelper::splitQuery ( const TSLFeatureClassList * mapFeatureList,
const char ** queryFeatures,
int noOfQueryFeatures,
TSLWMSSplitQueryResultSet *& results )
static

Given a map's feature class list and a set of features that must appear in the order specified, this method will split the query into a set of one or more sub queries. Each of these resultant sub-queries is provided in the form of a feature class list, of which all contained features should be turned on, drawn/queries, and then move on to the next result.

Parameters
mapFeatureListThe feature list of the map data layer
queryFeaturesThe array of strings containing the features to draw/query
noOfQueryFeaturesThe size of the array specified by queryFeatures
resultsThe results of the query. It is up to the user to delete this object.
Returns
true on success, false otherwise.