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

Detailed Description

Specialist data layer for the display of MGRS, UTM, UPS and Lat/Lon grids.

This adds special features to allow configuration of the rendering. At present, these are:

Line rendition styles

  • "lon6Degree" : major longitude lines between zones
  • "lonDegree" : longitude lines at degree intervals
  • "lonMinute" : longitude lines at minute intervals
  • "lat8Degree" : major latitude lines between zones
  • "latDegree" : latitude lines at degree intervals
  • "latMinute" : latitude lines at minute intervals
  • "utm1km" : UTM and MGRS grid lines for 1km squares
  • "utm10km" : UTM and MGRS grid lines for 10km squares
  • "utm100km" : UTM and MGRS grid lines for 100km squares

Use the setFeatureRendering method to configure the rendering options for these.

Text rendering styles

  • "utmLabel" : text style of the UTM square (e.g. "30T")
  • "mgrsLabel" : text style of the MGRS 100km square (e.g. "BA")
  • "mgrsFullLabel" : text style of the Fully labelled MGRS 100km square (e.g. "30TBA")
  • "gridLineLabel" : text style of the label applied to a grid line - value is relative to UTM zone
  • "mgrsGridLineLabel" : text style of the label applied to a grid line - value is relative to MGRS 100km
  • "degreeLineLabel" : text style of the label applied to a line of latitude or longitude.

NOTE: mgrsLabel and mgrsFullLabel are mutually exclusive - an application should use only one. gridLineLabel and mgrsGridLineLabel are mutually exclusive - an application should use only one.

Use the setFeatureRendering method to configure the rendering options for these.

features used for these text styles are:

TSLRenderingAttributeRenderLevel,
TSLRenderingAttributeTextFont,
TSLRenderingAttributeTextColour,
TSLRenderingAttributeTextSizeFactor,
TSLRenderingAttributeTextSizeFactorUnits,
TSLRenderingAttributeTextHorizontalAlignment,
TSLRenderingAttributeTextVerticalAlignment,
TSLRenderingAttributeTextBackgroundMode,
TSLRenderingAttributeTextBackgroundColour,
TSLRenderingAttributeTextBackgroundStyle,
TSLRenderingAttributeTextBackgroundEdgeColour,
TSLRenderingAttributeTextOffsetUnits,
TSLRenderingAttributeTextRotatable,
TSLRenderingAttributeTextMinPixelHeight,
TSLRenderingAttributeTextMaxPixelHeight

The intersections (or centres) of the gridlines (or squares or any size) may be snapped to, using the 'snapPoint' method.

Instances of this class should be destroyed using the destroy method.

The layer works in two modes:

  • single zone : only the MGRS/UTM grid for a single zone and band is displayed at all zoom factors.
  • multiple zone : the default the layer chooses which portions of a zone or multiple zones to display depending on the zoom factor. At high zoom factors a single MGRS grid square will be displayed near a 6 degree longitude boundary it is chosen to be the one for the centre of the window.

Use setZone() to set the zone and band and set the layer single zone mode. A value of -1 for the zone switches to multiple zone mode.

When the "mgrsLabel" or "mgrsFullLabel" text style is defined the grid will be an MGRS grid, otherwise it will display a UTM grid if "utmLabel" text style is defined.

A modified Lat/Lon grid is displayed (as long as the "lon6Degree" , "lonDegree", "lonMinute" , "lat8Degree", "latDegree", "latMinute" line styles are set). The modifications are due to the variations in size of Zone 30 between 56N and 64N latitudes and zones 31-37 between 72N and 84N latitudes. If an MGRS or UTM grid is displayed then only the 6x8 degree grid is displayed. If only a lat/lon grid is desired use the TSLLatLongGridDataLayer instead.

Coordinate Systems:

The layer requires a Coordinate System 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.

The grid uses the layer passed rather then taking a copy of the coordinate system as such you should make sure that the layer continues to be in existence in the case of passing a layer to addDataLayer.

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.

Note: If the UTM rendering or the UTM single zone functionality is used, then the coordinate systems need to have been loaded via the static TSLCoordinateSystem::loadCoordinateSystems function.

Public Member Functions

 TSLMGRSGridDataLayer ()
 
bool getCentre (double &latitude, double &longitude)
 
TSLCoordinateSystem::TSLTransverseMercatorFormula getTransverseMercatorFormula ()
 
bool localDatum () const
 
void localDatum (bool useLocalDatum)
 
void setDataLayer (TSLDataLayer *dataLayer)
 
void setTransverseMercatorFormula (TSLCoordinateSystem::TSLTransverseMercatorFormula transverseMercatorFormula)
 
void setZone (int zone, char band)
 
bool snap (TSLCoord *snap_pt, bool force_snap, int snapToSquare=1000, bool snapToMiddle=false)
 
void snapable (bool value)
 
bool snapable ()
 
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
 

Constructor & Destructor Documentation

◆ TSLMGRSGridDataLayer()

TSLMGRSGridDataLayer::TSLMGRSGridDataLayer ( )

Default constructor for the MGRS Grid Data Layer.

Member Function Documentation

◆ getCentre()

bool TSLMGRSGridDataLayer::getCentre ( double & latitude,
double & longitude )

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.

◆ getTransverseMercatorFormula()

TSLCoordinateSystem::TSLTransverseMercatorFormula TSLMGRSGridDataLayer::getTransverseMercatorFormula ( )

Returns the default Transverse Mercator formula used when calculating the MGRS and UTM data.

◆ localDatum() [1/2]

bool TSLMGRSGridDataLayer::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 TSLMGRSGridDataLayer::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 * TSLMGRSGridDataLayer::operator new ( size_t size)

Allocation override for API redirection

◆ operator new() [2/2]

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

◆ setTransverseMercatorFormula()

void TSLMGRSGridDataLayer::setTransverseMercatorFormula ( TSLCoordinateSystem::TSLTransverseMercatorFormula transverseMercatorFormula)

Sets the default Transverse Mercator formula to use when calculating the MGRS and UTM data.

The default is the 'USGS Snyder' formula.

If the layer has access to a Transverse Mercator projection either by setDataLayer or the Drawing Surface it will use the formula specified by the projection.

Parameters
transverseMercatorFormulaThe Transverse Mercator formula to use.

◆ setZone()

void TSLMGRSGridDataLayer::setZone ( int zone,
char band )

This function sets the data layer to work in single UTM zone mode, i.e. only a single UTM zone is displayed.

Parameters
zoneThe UTM zone to display. There are 60 zones,each 6 degrees wide, between latitudes 84 degrees north and 80 degrees south. Zone 1 is bounded by longitude 180 to 174 degrees west. Zone numbering increases in an eastward direction. Valid values are 1 to 60.
bandThe latitude band character. Each latitude band is 8 degrees high and is lettered starting from 'C' at 80 degrees south, increasing up the alphabet until 'X', omitting the letters 'I' and 'O'. Only uppercase letters are valid.

◆ snap()

bool TSLMGRSGridDataLayer::snap ( TSLCoord * snap_pt,
bool force_snap,
int snapToSquare = 1000,
bool snapToMiddle = false )

Snap a point to a grid square.

Parameters
snap_pton entry the point to snap, on exit this may be changed to the centre or lower left of the grid square.
force_snapsnap to the grid square even if snapable() would return false.
snapToSquaresize of the square to snap to in metres (i.e. 1000, 10000, or 100000).
snapToMiddleif true then snap the point to the middle of the square

◆ snapable() [1/2]

bool TSLMGRSGridDataLayer::snapable ( )

Will snap() snap points to the nearest grid square.

◆ snapable() [2/2]

void TSLMGRSGridDataLayer::snapable ( bool value)

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