MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
Loading...
Searching...
No Matches
TSLLatLongGridDataLayer Class Reference
Inheritance diagram for TSLLatLongGridDataLayer:

Detailed Description

This draws a Latitude / Longitude grid over a map data layer.

This adds special features to allow configuration of the rendering. Use the setFeatureRendering() method to configure the rendering options for these.

At present, the available feature names are:

  • Line rendition styles:
    • "lonMajorDegree" : longitude lines (multiples of a degree)
    • "lonDegree" : longitude lines at degree intervals
    • "lonMinute" : longitude lines at minute intervals
    • "lonTenths" : longitude lines at tenth intervals
    • "latMajorDegree" : latitude lines (multiples of a degree)
    • "latDegree" : latitude lines at degree intervals
    • "latMinute" : latitude lines at minute intervals
    • "latTenths" : latitude lines at tenth intervals
  • Text rendering styles:
    • "degreeLineLabel" : text style of the label applied to a line of latitude or longitude.
    • "subgridLineLabel" : text style of the label applied to a subgrid (minor) line, e.g. a minute or tenths line.

Label Positioning:

Line labels are setup by default to be positioned with latitude labels at the left hand side of the projection or screen and longitude labels at the bottom of the projection or screen. This can be modified by the user using the functions setLatitudeLabelPosition and setLongitudeLabelPosition. These functions take a bitmask value, see TSLGridLabelPosition, allowing a single option (e.g. latitude labels displayed on the RHS of the projection/screen) or a combination of options (e.g. latitude labels displayed on top and bottom of the projection/screen). The current values of the label position bitmasks can be obtained using the functions getLatitudeLabelPosition and getLongitudeLabelPosition.

The setSpacing() method with feature set to "lonMajorDegree" or "latMajorDegree" sets the distance between the major grid lines (in degrees). The default is 10 degrees.

The line rendering can be disabled by setting the edge style to 0. If the edge style is 0 then a symbol will be drawn if the feature rendering for a symbol is setup.

If the rendering for display of tenths and minutes are both setup, then neither is displayed.

The user can provide a TSLLatLongGridDataLayerFormatCallback to format the text drawn at each grid interval. If a callback is not supplied then it will default to decimal degrees. The user can also provide a TSLLatLongGridDataLayerFormatCallback to format the text drawn for subgrid labels. If a callback is not supplied then it will default to decimal degrees with a maximum of 3 decimal places.

Coordinate Systems:

The layer requires a Coordinate Systems to allow it to work out the grid points. The layer by default will use the Drawing Surface Coordinate System. This may be changed by the user by a call to addDataLayer with a coordinate system providing layer.

In both cases the Coordinate System must be correctly setup before the first draw of the grid layer or before calling addDataLayer as the layer takes a copy of the Coordinate System.

If the coordinate system is changed on the Drawing Surface or a map with a new coordinate system is loaded into the map data-layer then notifiedChanged should be called with true. This will cause the cache to be flushed and the Coordinate System to be queried again.

If you delete the map data-layer associated with the layer then you should call setDataLayer with NULL.

Public Types

enum  TSLSubGridLabelPositionEnum {
  TSLSubGridLabelDefaultCentre = 0 , TSLSubGridLabelLHSBottom = 1 , TSLSubGridLabelRHSBottom = 2 , TSLSubGridLabelLHSTop = 3 ,
  TSLSubGridLabelRHSTop = 4
}
 
enum  TSLGridLabelPosition {
  TSLGridLabelLegacy = 0 , TSLGridLabelLHS = 1 , TSLGridLabelRHS = 2 , TSLGridLabelTop = 4 ,
  TSLGridLabelBottom = 8
}
 
typedef TSLSubGridLabelPositionEnum TSLSubGridLabelPosEnum
 deprecated
 

Public Member Functions

 TSLLatLongGridDataLayer ()
 
bool getCentre (double &latitude, double &longitude) const
 
TSLLatLongGridDataLayerFormatCallbackgetFormatCallback (void **arg) const
 
TSLGridDetailLevelChangeEnum getGridLevelChangeMode () const
 
TSLBitMask getLatitudeLabelPosition () const
 
TSLBitMask getLongitudeLabelPosition () const
 
TSLLatLongGridDataLayerFormatCallbackgetSubGridFormatCallback (void **arg) const
 
TSLSubGridLabelPositionEnum getSubGridLabelPosition () const
 
bool localDatum () const
 
void localDatum (bool useLocalDatum)
 
void setDataLayer (TSLDataLayer *dataLayer)
 
void setFormatCallback (TSLLatLongGridDataLayerFormatCallback *callbackFunc, void *arg)
 
void setGridLevelChangeMode (TSLGridDetailLevelChangeEnum mode=TSLGridLevelChangeAutomatic)
 
bool setLatitudeLabelPosition (const TSLBitMask labelPosition=TSLGridLabelLHS)
 
bool setLongitudeLabelPosition (const TSLBitMask labelPosition)
 
bool setSpacing (const char *const feature, int spacing)
 
void setSubGridFormatCallback (TSLLatLongGridDataLayerFormatCallback *callbackFunc, void *arg)
 
void setSubGridLabelPosition (TSLSubGridLabelPositionEnum position=TSLSubGridLabelDefaultCentre)
 
bool snap (TSLCoord *snap_pt, double &latitude, double &longitude, bool force_snap=false, bool snapToMiddle=false)
 
void snapable (bool value)
 
bool snapable () const
 
void tickLength (int degrees, int tenthsMinutes)
 
void ticks (bool ticks)
 
void * operator new (size_t size) TSL_NO_THROW
 
void * operator new (size_t size, char *filename, int line)
 
- Public Member Functions inherited from TSLDataLayer
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)
 
TSLDataHandlercreateDataHandler (const char *config_file=0)
 
TSLHistoryVersion currentVersion () const
 
TSLDataHandlerdataHandler ()
 
const TSLDataHandlerdataHandler () const
 
void destroy ()
 
bool entityIsVisible (const TSLEntity *entity, const TSLDrawingSurface *drawingSurface) const
 
const TSLFeatureClassListfeatureList () const
 
const TSLFeatureClassListfeatureList (const char *detailLayerName) const
 
bool fileModificationTime (const char *filename, TSLTimeType &lastModificationTime)
 
TSLEntityfindEntity (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
 
TSLEntityIteratorgetEntityIterator (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
 
TSLFileLoadergetLoader ()
 
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)
 
TSLMapQueryquery (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2, int depth=-1, const char *featureName=NULL, int drawingSurfaceID=-1) const
 
TSLMapQueryquery (TSLTMC x1, TSLTMC y1, TSLTMC x2, TSLTMC y2, TSLSelector *selector, int drawingSurfaceID=-1) const
 
const TSLCoordinateSystemgetCoordinateSystem () 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 TSLVersionHistorySetversionHistory () const
 

Member Typedef Documentation

◆ TSLSubGridLabelPosEnum

Member Enumeration Documentation

◆ TSLGridLabelPosition

Bitmask defining the positions available for the display position of the Major and Degree level Grid labels.

Apart from the TSLGridLabelLegacy position which is mutually exclusive, the positions can be used individually or in combination with each other.

(LHS: Left Hand Side, RHS: Right Hand Side)

Enumerator
TSLGridLabelLegacy 

Label is positioned as in older versions of MapLink (pre 7.0). If the map is fully contained by the display the label is positioned where the line intersects the left screen edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to a point midway up the display left edge and a twentieth of the display width across. If the map is not fully contained by the display, longitude labels are displayed along the latitude line closest to a point a tenth of the display height up the display left edge.

TSLGridLabelLHS 

If the map is fully contained by the display the label is positioned where the line intersects the left display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display left edge and longitude labels are displayed along the latitude line closest to the midpoint of the display left edge.

TSLGridLabelRHS 

If the map is fully contained by the display the label is positioned where the line intersects the right display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display right edge and longitude labels are displayed along the latitude line closest to the midpoint of the display right edge.

TSLGridLabelTop 

If the map is fully contained by the display the label is positioned where the line intersects the top display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display top edge and longitude labels are displayed along the latitude line closest to the midpoint of the display top edge.

TSLGridLabelBottom 

If the map is fully contained by the display the label is positioned where the line intersects the bottom display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display bottom edge and longitude labels are displayed along the latitude line closest to the midpoint of the display bottom edge.

◆ TSLSubGridLabelPositionEnum

Enumeration defining the positions available for the display position of the SubGrid label.

(LHS: Left Hand Side, RHS: Right Hand Side)

Enumerator
TSLSubGridLabelDefaultCentre 

Latitude/Longitude Label is positioned close to Sub Grid Centre

TSLSubGridLabelLHSBottom 

Latitude Label is positioned at screen left, Longitude label is positioned at screen bottom

TSLSubGridLabelRHSBottom 

Latitude Label is positioned at screen right, Longitude label is positioned at screen bottom

TSLSubGridLabelLHSTop 

Latitude Label is positioned at screen left, Longitude label is positioned at screen top

TSLSubGridLabelRHSTop 

Latitude Label is positioned at screen right, Longitude label is positioned at screen top

Constructor & Destructor Documentation

◆ TSLLatLongGridDataLayer()

TSLLatLongGridDataLayer::TSLLatLongGridDataLayer ( )

Member Function Documentation

◆ getCentre()

bool TSLLatLongGridDataLayer::getCentre ( double & latitude,
double & longitude ) const

Gets the latitude and longitude of the centre of the last view displayed.

Parameters
latitude[output] centre latitude.
longitude[output] centre longitude.
Returns
true on success, false otherwise.

◆ getFormatCallback()

TSLLatLongGridDataLayerFormatCallback * TSLLatLongGridDataLayer::getFormatCallback ( void ** arg) const

Queries the data layer to see if a user defined callback, to format the text drawn at each grid interval, has been set.

Parameters
argIf this parameter is provided, it will be pointed to the user defined value passed to the setFormatCallback method. If no callback has been set, it will be pointed at NULL
Returns
the user specified callback function if one has been provided, else NULL

◆ getGridLevelChangeMode()

TSLGridDetailLevelChangeEnum TSLLatLongGridDataLayer::getGridLevelChangeMode ( ) const

This method allows users to retrieve the current Grid Level Change Mode.

◆ getLatitudeLabelPosition()

TSLBitMask TSLLatLongGridDataLayer::getLatitudeLabelPosition ( ) const

This method allows users to retrieve the value of the bitmask used to determine the position of the latitude line labels. The positions available are:

  • TSLGridLabelLegacy: Label is positioned as in older versions of MapLink (pre 7.0). If the map is fully contained by the display the label is positioned where the line intersects the left screen edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to a point midway up the display left edge and a twentieth of the display width across. If the map is not fully contained by the display, longitude labels are displayed along the latitude line closest to a point a tenth of the display height up the display left edge.
  • TSLGridLabelLHS: If the map is fully contained by the display the label is positioned where the line intersects the left display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display left edge and longitude labels are displayed along the latitude line closest to the midpoint of the display left edge.
  • TSLGridLabelRHS: If the map is fully contained by the display the label is positioned where the line intersects the right display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display right edge and longitude labels are displayed along the latitude line closest to the midpoint of the display right edge.
  • TSLGridLabelTop: If the map is fully contained by the display the label is positioned where the line intersects the top display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display top edge and longitude labels are displayed along the latitude line closest to the midpoint of the display top edge.
  • TSLGridLabelBottom: If the map is fully contained by the display the label is positioned where the line intersects the bottom display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display bottom edge and longitude labels are displayed along the latitude line closest to the midpoint of the display bottom edge.

Apart from the TSLGridLabelLegacy position which is mutually exclusive, the positions can be used individually or in combination with each other.

◆ getLongitudeLabelPosition()

TSLBitMask TSLLatLongGridDataLayer::getLongitudeLabelPosition ( ) const

This method allows users to retrieve the value of the bitmask used to determine the position of the longitude line labels. The positions available are:

  • TSLGridLabelLegacy: Label is positioned as in older versions of MapLink (pre 7.0). If the map is fully contained by the display the label is positioned where the line intersects the left screen edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to a point midway up the display left edge and a twentieth of the display width across. If the map is not fully contained by the display, longitude labels are displayed along the latitude line closest to a point a tenth of the display height up the display left edge.
  • TSLGridLabelLHS: If the map is fully contained by the display the label is positioned where the line intersects the left display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display left edge and longitude labels are displayed along the latitude line closest to the midpoint of the display left edge.
  • TSLGridLabelRHS: If the map is fully contained by the display the label is positioned where the line intersects the right display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display right edge and longitude labels are displayed along the latitude line closest to the midpoint of the display right edge.
  • TSLGridLabelTop: If the map is fully contained by the display the label is positioned where the line intersects the top display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display top edge and longitude labels are displayed along the latitude line closest to the midpoint of the display top edge.
  • TSLGridLabelBottom: If the map is fully contained by the display the label is positioned where the line intersects the bottom display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display bottom edge and longitude labels are displayed along the latitude line closest to the midpoint of the display bottom edge.

Apart from the TSLGridLabelLegacy position which is mutually exclusive, the positions can be used individually or in combination with each other.

◆ getSubGridFormatCallback()

TSLLatLongGridDataLayerFormatCallback * TSLLatLongGridDataLayer::getSubGridFormatCallback ( void ** arg) const

Queries the data layer to see if a user defined callback, to format the text drawn for a subgrid label, has been set.

Parameters
argIf this parameter is provided, it will be pointed to the user defined value passed to the setSubGridFormatCallback method. If no callback has been set, it will be pointed at NULL
Returns
the user specified callback function if one has been provided, else NULL

◆ getSubGridLabelPosition()

TSLSubGridLabelPositionEnum TSLLatLongGridDataLayer::getSubGridLabelPosition ( ) const

This method allows users to retrieve the enum denoting the position where the Sub Grid Label is displayed.

◆ localDatum() [1/2]

bool TSLLatLongGridDataLayer::localDatum ( ) const

This returns whether local or WGS84 datum is being used.

Returns true if local datum is used, false if WGS84 datum is used.

◆ localDatum() [2/2]

void TSLLatLongGridDataLayer::localDatum ( bool useLocalDatum)

This sets whether local or WGS84 datum is being used.

Parameters
useLocalDatumPass true to use local datum, false to use WGS84 datum

◆ operator new() [1/2]

void * TSLLatLongGridDataLayer::operator new ( size_t size)

Allocation override for API redirection

◆ operator new() [2/2]

void * TSLLatLongGridDataLayer::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.

◆ setDataLayer()

void TSLLatLongGridDataLayer::setDataLayer ( TSLDataLayer * dataLayer)

This sets the map layer that the grid is to overlay.

You should call this method with the layer whenever the coordinate-system is changed. This will cause the grid cache to be flushed and re-calculated.

Parameters
dataLayerThe Coordinate Providing Data Layer for the grid to use for its latitude longitude conversions.

◆ setFormatCallback()

void TSLLatLongGridDataLayer::setFormatCallback ( TSLLatLongGridDataLayerFormatCallback * callbackFunc,
void * arg )

This method allows users to provide a callback to format the text drawn at each grid interval. If a callback is not supplied then it will default to decimal degrees.

Parameters
callbackFuncThe callback to be used. If NULL is passed then the existing callback will be removed and will revert to the default functionality
argThis user value will be passed to the callback function when it is called. It will remain in the ownership of the user.

◆ setGridLevelChangeMode()

void TSLLatLongGridDataLayer::setGridLevelChangeMode ( TSLGridDetailLevelChangeEnum mode = TSLGridLevelChangeAutomatic)

This method allows users to change the Grid Level Change Mode. The modes available are:

  • TSLGridLevelChangeAutomatic - level changes are determined automatically by the TSLLatLongGridDataLayer
  • TSLGridLevelChangeManual - level changes are determined by the user setting the rendering edge styles of the Latitude/Longitude Grid Lines, e.g. setting the value of the Tenths Longitude and Latitude edge styles to a value greater than 0 will enable the calculation of the Tenths grids.

NOTE: If the Manual mode is used then the User needs to be aware that setting of Sub Grids at too high a zoom level will seriously impinge on performance and memory usage.

Parameters
modeThe Change mode to be used. If NULL is passed then the default functionality i.e. level changes are determined automatically by the TSLLatLongGridDataLayer

◆ setLatitudeLabelPosition()

bool TSLLatLongGridDataLayer::setLatitudeLabelPosition ( const TSLBitMask labelPosition = TSLGridLabelLHS)

This method allows users to change the position of the latitude line labels. The positions available are:

  • TSLGridLabelLegacy: Label is positioned as in older versions of MapLink (pre 7.0). If the map is fully contained by the display the label is positioned where the line intersects the left screen edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to a point midway up the display left edge and a twentieth of the display width across. If the map is not fully contained by the display, longitude labels are displayed along the latitude line closest to a point a tenth of the display height up the display left edge.
  • TSLGridLabelLHS: If the map is fully contained by the display the label is positioned where the line intersects the left display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display left edge and longitude labels are displayed along the latitude line closest to the midpoint of the display left edge.
  • TSLGridLabelRHS: If the map is fully contained by the display the label is positioned where the line intersects the right display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display right edge and longitude labels are displayed along the latitude line closest to the midpoint of the display right edge.
  • TSLGridLabelTop: If the map is fully contained by the display the label is positioned where the line intersects the top display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display top edge and longitude labels are displayed along the latitude line closest to the midpoint of the display top edge.
  • TSLGridLabelBottom: If the map is fully contained by the display the label is positioned where the line intersects the bottom display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display bottom edge and longitude labels are displayed along the latitude line closest to the midpoint of the display bottom edge.

Apart from the TSLGridLabelLegacy position which is mutually exclusive, the positions can be used individually or in combination with each other.

The default position for latitude labels is the TSLGridLabelLegacy, i.e. display left.

Parameters
labelPositionThe bitmask defining the position(s) at which to display the latitude line labels.
Returns
true on success, false if an invalid value is passed (an invalid value a value that has bits set that are not in the TSLGridLabelPosition).

◆ setLongitudeLabelPosition()

bool TSLLatLongGridDataLayer::setLongitudeLabelPosition ( const TSLBitMask labelPosition)

This method allows users to change the position of the longitude line labels. The positions available are:

  • TSLGridLabelLegacy: Label is positioned as in older versions of MapLink (pre 7.0). If the map is fully contained by the display the label is positioned where the line intersects the left screen edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to a point midway up the display left edge and a twentieth of the display width across. If the map is not fully contained by the display, longitude labels are displayed along the latitude line closest to a point a tenth of the display height up the display left edge.
  • TSLGridLabelLHS: If the map is fully contained by the display the label is positioned where the line intersects the left display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display left edge and longitude labels are displayed along the latitude line closest to the midpoint of the display left edge.
  • TSLGridLabelRHS: If the map is fully contained by the display the label is positioned where the line intersects the right display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display right edge and longitude labels are displayed along the latitude line closest to the midpoint of the display right edge.
  • TSLGridLabelTop: If the map is fully contained by the display the label is positioned where the line intersects the top display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display top edge and longitude labels are displayed along the latitude line closest to the midpoint of the display top edge.
  • TSLGridLabelBottom: If the map is fully contained by the display the label is positioned where the line intersects the bottom display edge. If the map is not fully contained by the display, latitude labels are displayed along the longitude line closest to the midpoint of the display bottom edge and longitude labels are displayed along the latitude line closest to the midpoint of the display bottom edge.

Apart from the TSLGridLabelLegacy position which is mutually exclusive, the positions can be used individually or in combination with each other.

The default position for longitude labels is the TSLGridLabelLegacy, i.e. display bottom edge.

Parameters
labelPositionThe bitmask defining the position(s) at which to display the longitude line labels.
Returns
true on success, false if an invalid value is passed (an invalid value being a value that has bits set that are not in the TSLGridLabelPosition).

◆ setSpacing()

bool TSLLatLongGridDataLayer::setSpacing ( const char *const feature,
int spacing )

Set the spacing between the major latitude and longitude grid lines.

The default spacing is 10 degrees.

Parameters
featureeither "lonMajorDegree" or "latMajorDegree"
spacingbetween the grid lines in degrees (range 1 to 30)
Returns
true on success, false otherwise.

◆ setSubGridFormatCallback()

void TSLLatLongGridDataLayer::setSubGridFormatCallback ( TSLLatLongGridDataLayerFormatCallback * callbackFunc,
void * arg )

This method allows users to provide a callback to format the text drawn at for a subgrid label. If a callback is not supplied then it will default to decimal degrees, with a maximum of 3 decimal places.

Parameters
callbackFuncThe callback to be used. If NULL is passed then the existing callback will be removed and will revert to the default functionality
argThis user value will be passed to the callback function when it is called. It will remain in the ownership of the user.

◆ setSubGridLabelPosition()

void TSLLatLongGridDataLayer::setSubGridLabelPosition ( TSLSubGridLabelPositionEnum position = TSLSubGridLabelDefaultCentre)

This method allows users to change the position of the SubGrid label. The positions available are:

  • TSLSubGridLabelDefaultCentre: Latitude/Longitude Label is positioned close to Sub Grid Centre
  • TSLSubGridLabelLHSBottom: Latitude Label is positioned at screen left, Longitude label is positioned at screen bottom
  • TSLSubGridLabelRHSBottom: Latitude Label is positioned at screen right, Longitude label is positioned at screen bottom
  • TSLSubGridLabelLHSTop: Latitude Label is positioned at screen left, Longitude label is positioned at screen top
  • TSLSubGridLabelRHSTop: Latitude Label is positioned at screen right, Longitude label is positioned at screen top

(LHS: Left Hand Side, RHS: Right Hand Side)

Parameters
positionThe position enumeration defining the position at which to display the Sub Grid label. If NULL is passed then the default position is used.

◆ snap()

bool TSLLatLongGridDataLayer::snap ( TSLCoord * snap_pt,
double & latitude,
double & longitude,
bool force_snap = false,
bool snapToMiddle = false )

This method returns the point snapped to given the initial position.

Parameters
snap_pton entry the point to snap, on exit this may be changed to the centre or lower left of the grid square.
latitude[output] latitude of the snapped point
longitude[output] longitude of the snapped point
force_snapsnap to the grid square even if snapable() would return false.
snapToMiddleif true then snap the point to the middle of the square
Returns
true on success, false otherwise.

◆ snapable() [1/2]

bool TSLLatLongGridDataLayer::snapable ( ) const

Returns true if snap() snaps points to the nearest grid square, false otherwise.

◆ snapable() [2/2]

void TSLLatLongGridDataLayer::snapable ( bool value)

This controls whether snap() snaps points to the nearest grid square.

Parameters
valuePass true if snap is to snap to the nearest grid square.

◆ tickLength()

void TSLLatLongGridDataLayer::tickLength ( int degrees,
int tenthsMinutes )

Set the pixel size of the tick lengths.

Parameters
degreesthe length of the degree tick in pixels (default 8 pixels)
tenthsMinutesthe length of the tenths or minutes tick in pixels (default 2 pixels)

◆ ticks()

void TSLLatLongGridDataLayer::ticks ( bool ticks)

Draw ticks on the latitude and longitude lines.

Parameters
ticksIf the value is true then a tick is drawn every degree or 0.1 degree.