![]() |
MapLink Pro 11.1.1.0.
Envitia MapLink Pro: The Ultimate Mapping Application Toolkit
|
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
Use the setFeatureRendering method to configure the rendering options for these.
Text rendering styles
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:
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) |
![]() | |
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 |
TSLMGRSGridDataLayer::TSLMGRSGridDataLayer | ( | ) |
Default constructor for the MGRS Grid Data Layer.
bool TSLMGRSGridDataLayer::getCentre | ( | double & | latitude, |
double & | longitude ) |
Gets the latitude and longitude of the centre of the last view displayed.
latitude | [output] centre latitude. |
longitude | [output] centre longitude. |
TSLCoordinateSystem::TSLTransverseMercatorFormula TSLMGRSGridDataLayer::getTransverseMercatorFormula | ( | ) |
Returns the default Transverse Mercator formula used when calculating the MGRS and UTM data.
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.
void TSLMGRSGridDataLayer::localDatum | ( | bool | useLocalDatum | ) |
This sets whether local or WGS84 datum is being used.
useLocalDatum | Pass true to use local datum, false to use WGS84 datum |
void * TSLMGRSGridDataLayer::operator new | ( | size_t | size | ) |
Allocation override for API redirection
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.
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.
dataLayer | The Coordinate Providing Data Layer for the grid to use for its latitude longitude conversions. |
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.
transverseMercatorFormula | The Transverse Mercator formula to use. |
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.
zone | The 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. |
band | The 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. |
bool TSLMGRSGridDataLayer::snap | ( | TSLCoord * | snap_pt, |
bool | force_snap, | ||
int | snapToSquare = 1000, | ||
bool | snapToMiddle = false ) |
Snap a point to a grid square.
snap_pt | on entry the point to snap, on exit this may be changed to the centre or lower left of the grid square. |
force_snap | snap to the grid square even if snapable() would return false. |
snapToSquare | size of the square to snap to in metres (i.e. 1000, 10000, or 100000). |
snapToMiddle | if true then snap the point to the middle of the square |
bool TSLMGRSGridDataLayer::snapable | ( | ) |
Will snap() snap points to the nearest grid square.
void TSLMGRSGridDataLayer::snapable | ( | bool | value | ) |
This controls whether snap() snaps points to the nearest grid square.