// GlobalMapperInterface.h - interface for Global Mapper DLL exports
//
// Developed by: Mike Childs
//      Started: 5/16/03

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#ifndef _GLOBALMAPPERINTERFACE_H_
#define _GLOBALMAPPERINTERFACE_H_

/*--------------------------------------------------------------------
                            GENERAL INCLUDES
--------------------------------------------------------------------*/

#include "GlobalMapperTypes.h"
#include "FeatureClass.h"
#include "ProjectionTypes.h"

#include <time.h>

// Make sure the whole thing is packed to 8 byte structure alignment
// like the SDK expects
#pragma pack( push, 8 )

/*--------------------------------------------------------------------
                            LITERAL CONSTANTS
--------------------------------------------------------------------*/

#define GM_MAX_NON_REGISTERED_VECTOR_IDX    5

/*--------------------------------------------------------------------
                                 TYPES
--------------------------------------------------------------------*/

// Error codes
typedef uint32 GM_Error_t32; enum
{
    GM_Error_None = 0,

    GM_Error_InvalidLayer = 1,          // The provided layer is not open
    GM_Error_InvalidParam = 2,          // A parameter was invalid
    GM_Error_LoadError = 3,             // Unable to load layer
    GM_Error_MultipleLayers = 4,        // Multiple layers were found in the file being loaded (call GM_LoadLayerList instead)
    GM_Error_CollarSetup = 5,           // Unable to automatically crop the collar
    GM_Error_DrawError = 6,             // An unknown error occured drawing the layer(s)
    GM_Error_ExportError = 7,           // An unknown error occured exporting the layer(s)
    GM_Error_NothingToExport = 8,       // No data was available to export
    GM_Error_InvalidFormat = 9,         // An invalid export format was specified
    GM_Error_RectifyError = 10,         // An error occured rectifying the image
    GM_Error_NotSupported = 11,         // The operation is not supported for the layer
    GM_Error_NotRegistered = 12,        // No registry key was found to enable this functionality
    GM_Error_NoDataAtLocation = 13,     // No data was found at the specified location
	GM_Error_OutOfMemory = 14,          // Not enough memory to complete the requested operation
	GM_Error_Projection = 15,           // An error occured projecting a coordinate
    GM_Error_NoProjectionSet = 16,      // No view/export projection is currently set
    GM_Error_ViewShedCalc = 17,         // An error occurred performing the view shed analysis
    GM_Error_OperationCanceled = 18,    // The user canceled the operation
    GM_Error_TerraServerConnect = 19,   // A connection to the TerraService could not be established
    GM_Error_TerraServerBadTheme = 20,  // No TerraServer theme with the theme name provided could be found
    GM_Error_GenerateContours = 21,     // An error occurred generating the contours
    GM_Error_NotRasterLayer = 22,       // The layer provided is not a raster or elevation layer
    GM_Error_InvalidPackage = 23,       // The provided handle is not a valid package
    GM_Error_InvalidFeatureIndex = 24,  // There was no feature at the given index in the layer
    GM_Error_InvalidDrawStyle = 25,     // The drawing style passed in is not valid
    GM_Error_InvalidSymbolName = 26,    // The symbol name provided does not match any available point symbols
    GM_Error_SymbolAlreadyCreated = 27, // The symbol name specified has already been added
    GM_Error_MissingFile = 28,          // The file specified could not be found
    GM_Error_GPSDataNotValid = 29,      // The GPS data requested does not currently have a valid value available
    GM_Error_GPSAlreadyTracking = 30,   // A GPS device is already being tracked, call GM_GPSStopTracking
    GM_Error_VolumeCalcFailed = 31,     // An error occurred calculating the volume
    GM_Error_InvalidHoleIndex = 32,     // The area does not have a hole at the index provided
    GM_Error_InvalidMapIndex = 33,      // There is no map at the given index in the map catalog
    GM_Error_3DNotOpen = 34,            // No 3D view window is currently open
    GM_Error_3DLibraryNotFound = 35,    // The ExternalViewerIntf.dll library was not found
    GM_Error_3DLibraryBadInterface = 36,// The ExternalViewerIntf.dll library did not have the proper interface
    GM_Error_3DCreateError = 37,        // Unexpected error creating 3D view
    GM_Error_3DSetViewError = 38,       // Unexpected error setting 3D view
    GM_Error_NothingFound = 39,         // No features were found within the search area
    GM_Error_SearchError = 40,          // Unexpected search error
    GM_Error_LowMemory = 41,            // Some data was not drawn or loaded due to low available memory
    GM_Error_NotElevationLayer = 42,    // The layer provided is not an elevation layer
    GM_Error_FileAlreadyInCatalog = 43, // The provided file was already in the map catalog to which it was being added.
    GM_Error_TypeAlreadyExists = 44,    // The provided type name was already used by an existing type
    GM_Error_DatumAlreadyExists = 45,   // A built-in datum with the given name already exists
    GM_Error_UnknownEllipsoid = 46,     // The ellipsoid name provided does not match a known ellipsoid
    GM_Error_GridError = 47,            // Error generating grid from 3D vector data
    GM_Error_InvalidShaderName = 48,    // The shader name provided was not found
    GM_Error_SymbolNotCustom = 49,      // The symbol name provided is not a custom one that can be deleted
    GM_Error_MGRSParseError = 50,       // Error parsing MGRS coordinate string
    GM_Error_CreateBufferError = 51,    // Error creating a buffer around a feature
    GM_Error_CopyrightedData = 52,      // The data attempting to be exported or fetched is copyrighted
    GM_Error_BrushAlreadyCreated = 53,  // A fill style with the provided name already exists
    GM_Error_BrushError = 54,           // An error was encountered adding the custom fill brush
    GM_Error_EllipsoidAlreadyExists = 55, // An ellipsoid with the given name already exists
    GM_Error_CombineError = 56,         // An error occurred combining the areas

    GM_Error_NumCodes,
    
    GM_Error_NotImplemented = 0xFFFF    // The given function hasn't been implemented yet
};

// Flags describing the type of feature class (i.e. area, point, or line) to work on
typedef uint8 GM_FeatureClassType_t8; enum
{
    GM_FeatureClass_Area,       // The feature class is for an area feature
    GM_FeatureClass_Line,       // The feature class is for a line feature
    GM_FeatureClass_Point,      // The feature class is for a point feature

    GM_FeatureClass_NumTypes
};

// Flags when loading new layres
typedef uint32 GM_LoadFlags_t32; enum
{
    GM_LoadFlags_HideProgress       = 0x00000001,   // Don't show load progress
    GM_LoadFlags_NoProjPrompt       = 0x00000002,   // Don't prompt the user for unknown projections
    GM_LoadFlags_UseDefaultProj     = 0x00000004,   // Use default projection if none provided
    GM_LoadFlags_HideWarnings       = 0x00000008,   // Hide any load warnings (load errors will still be displayed)
    GM_LoadFlags_HideUnknownPrompt  = 0x00000010,   // Do not prompt the user to select the file type for unknown file formats
    GM_LoadFlags_UseDefaultPos      = 0x00000020,   // Use default positioning if none provided (raster files only)
    GM_LoadFlags_HideAllPrompts     = 0x00000040,   // Use the default value for any prompts that display during the load
};

// List of supported raster export types
typedef uint32 GM_RasterExportFormat_t32; enum
{
    GM_Export_GeoTIFF,          // GeoTIFF format
    GM_Export_JPG,              // JPG format
    GM_Export_PNG,              // PNG format
    GM_Export_Erdas_Imagine,    // Erdas Imagine IMG format
    GM_Export_BMP,              // BMP (Windows) format
    GM_Export_ECW,              // ECW format
    GM_Export_BIL_Raster,       // BIL format raster (RGB or grayscale)
    GM_Export_JPEG2000,         // JPEG 2000 format
    GM_Export_NITF,             // NITF format

    GM_Export_NumRasterFormats
};

// List of supported elevation export types
typedef uint32 GM_ElevationExportFormat_t32; enum
{
    GM_Export_GMG,                  // Global Mapper Grid format
    GM_Export_BIL,                  // BIL format
    GM_Export_Erdas_Elevation,      // Erdas Imagine IMG format with elevation data
    GM_Export_Surfer_ASCII,         // Surfer ASCII Grid
    GM_Export_Surfer_Binary_v6,     // Surfer Binary Grid v6
    GM_Export_Surfer_Binary_v7,     // Surfer Binary Grid v7
    GM_Export_DEM,                  // USGS ASCII DEM format
    GM_Export_XYZ_ASCII_Grid,       // XYZ ASCII Grid file
    GM_Export_Arc_ASCII_Grid,       // Arc Info ASCII Grid format
    GM_Export_ElevGeoTIFF,          // Vertical GeoTIFF format
    GM_Export_DXF_Point,            // DXF 3D Point format
    GM_Export_Float_Grid,           // Float/Grid format
    GM_Export_DTED,                 // DTED format
    GM_Export_Vertical_Mapper_Grid, // Vertical Mapper (MapInfo) grid format
    GM_Export_Windsim_GWS,          // Windsim GWS

    GM_Export_NumElevationFormats
};

// List of supported vector export types
typedef uint32 GM_VectorExportFormat_t32; enum
{
    GM_Export_DXF,              // DXF format - use GM_ExportOptsDXF_t for <aFormatOptions> parameter to GM_ExportVector (can be NULL)
    GM_Export_Shapefile,        // Shapefile format - use GM_ExportOptsSHP_t for <aFormatOptions> parameter to GM_ExportVector (can be NULL)
    GM_Export_KML,              // KML format - use GM_ExportOptsKML_t for <aFormatOptions> parameter to GM_ExportVector (can be NULL) - pass .KMZ filename to create KMZ file
    GM_Export_MapInfo_MIF,      // MapInfo MIF/MID format - pass NULL for <aFormatOptions> parameter to GM_ExportVector
    GM_Export_MapInfo_TAB,      // MapInfo TAB/MAP format - pass NULL for <aFormatOptions> parameter to GM_ExportVector
    GM_Export_WaspMap,          // WaSP Map format - pass NULL for <aFormatOptions> parameter to GM_ExportVector
    GM_Export_SimpleText,       // Simple ASCII Text file format - use GM_ExportOptsSimpleText_t for <aFormatOptions> parameter to GM_ExportVector (can be NULL)
    GM_Export_CSV,              // CSV file format - pass NULL for <aFormatOptions> parameter to GM_ExportVector
    GM_Export_SVG,              // SVG file format - pass NULL for <aFormatOptions> parameter to GM_ExportVector

    GM_Export_NumVectorFormats
};

// List of supported web export types
typedef uint32 GM_WebExportFormat_t32; enum
{
    GM_Export_GoogleMaps,       // Google Maps format
    GM_Export_VirtualEarth,     // Virtual Earth (Bing Maps) format
    GM_Export_KMLRaster,        // KML/KMZ raster format
    GM_Export_WorldWind,        // WorldWind tile format
    GM_Export_TMS,              // TMS (Tile Map Service) tile format
    GM_Export_OSM,              // OSM (OpenStreetMap) tile format

    GM_Export_NumWebFormats
};

// Flags for raster (i.e. GeoTIFF, JPG) image and elevation grid export
typedef uint32 GM_RasterExportFlags_t32; enum
{
    GM_ExportFlags_GenWorldFile         = 0x00000001,   // Generate a world file
    GM_ExportFlags_GenPRJFile           = 0x00000002,   // Generate a projection (PRJ) file
    GM_ExportFlags_GenTABFile           = 0x00000004,   // Generate a MapInfo TAB file
    GM_ExportFlags_Grayscale            = 0x00000008,   // Generate a grayscale image (raster only)
    GM_ExportFlags_Palette              = 0x00000010,   // Generate a paletted image (raster only)
    GM_ExportFlags_HideProgress         = 0x00000020,   // Don't show export progress
    GM_ExportFlags_JPGinTIFF            = 0x00000040,   // Create a JPG compressed GeoTIFF file (GM_Export_GeoTIFF format only)
    GM_ExportFlags_FillSmallGaps        = 0x00000080,   // Fill small gaps in data when exporting elevation data
    GM_ExportFlags_AllowLossy           = 0x00000100,   // Allow lossy export to GMG
    GM_ExportFlags_16BitSamples         = 0x00000200,   // Use signed 16-bit integer elevation values (GM_Export_BIL and GM_Export_Erdas_Elevation formats only)
    GM_ExportFlags_UseLZW               = 0x00000400,   // Use LZW compression for GeoTIFF file (GM_Export_GeoTIFF format only)
    GM_ExportFlags_NoTransparent        = 0x00000800,   // Don't mark background pixels transparent for PNG file (GM_Export_PNG format only)
    GM_ExportFlags_AddAlpha             = 0x00001000,   // Add an alpha channel to formats that support it (need for GM_Export_GeoTIFF [24-bit only], enabled by default for GM_Export_PNG)
    GM_ExportFlags_SeparateVectorLayers = 0x00002000,   // Draw each vector separately rather than drawing all at once when exporting vector data
    GM_ExportFlags_HidePartialLabels    = 0x00004000,   // Don't draw any labels that are only partially within the export box
    GM_ExportFlags_ExportSlopeValues    = 0x00008000,   // Export slope values rather than elevation values (GM_Export_FloatGrid only)
    GM_ExportFlags_ExportSlopeDirValues = 0x00010000,   // Export slope direction values rather than elevation values (GM_Export_FloatGrid only)
    GM_ExportFlags_UseEsriHdrFormat     = 0x00020000,   // Export ESRI format HDR for GM_Export_BIL format
    GM_ExportFlags_BigEndian            = 0x00040000,   // Save big endian elevation samples for GM_Export_BIL format
    GM_ExportFlags_ForceSquareSamples   = 0x00080000,   // Force square samples in the export. The provided pixel dimensions will be altered to get close, then the provided bounds will grow in one direction to make this happen
    GM_ExportFlags_NoCompression        = 0x00100000,   // Disable compression (GM_Export_GeoTIFF format only)

    // Flags for choosing best out of provided raster layers for export
    GM_ExportFlags_BestRasterLayers     = 0x10000000,   // Only draw the best raster layers for this zoom scale
    GM_ExportFlags_BestRasterLayersHiRes= 0x30000000,   // Same as GM_ExportFlags_BestRasterLayers, only it shows higher resolution layers a bit sooner
    GM_ExportFlags_LowResRasterLayers   = 0x20000000,   // Only draw the lowest resolution raster layers
    GM_ExportFlags_HiResRasterLayers    = 0x40000000,   // Only draw the highest resolution raster layers
    GM_ExportFlags_BestRasterChart      = 0x50000000,   // Only draw the best raster chart (this is tuned for marine chart display)

    // Definitions for masks of various option bits
    GM_ExportFlags_RasterMask           = 0xF0000000,   // Mask for raster draw options
};

// Flags for vector (i.e. DXF, Shapefile) export
typedef uint32 GM_VectorExportFlags_t32; enum
{
    GM_VectorExportFlags_GenPRJFile         = 0x00000001, // Generate a projection (PRJ) file
    GM_VectorExportFlags_HideProgress       = 0x00000002, // Don't show export progress
    GM_VectorExportFlags_ExportAreas        = 0x00000004, // Export area features
    GM_VectorExportFlags_ExportLines        = 0x00000008, // Export line features
    GM_VectorExportFlags_ExportPoints       = 0x00000010, // Export point/text features
    GM_VectorExportFlags_ExportAttrs        = 0x00000020, // Export feature attributes (when applicable)
    GM_VectorExportFlags_Export3D           = 0x00000040, // Export 3D features if applicable
    GM_VectorExportFlags_NoHeaderRow        = 0x00000080, // (GM_Export CSV only) Don't include a header row
    GM_VectorExportFlags_IncludeLatLonCols  = 0x00000100, // (GM_Export CSV only) Include latitude and longitude columns
    GM_VectorExportFlags_NoLatLonFormatting = 0x00000200, // (GM_Export CSV only) Export lat/lon columns as raw numbers (i.e. no breaking into DD MM SS, etc.)

    GM_VectorExportFlags_ExportAll = GM_VectorExportFlags_ExportAreas |
                                     GM_VectorExportFlags_ExportLines |
                                     GM_VectorExportFlags_ExportPoints,
};

// Flags for package export
typedef uint32 GM_PackageExportFlags_t32; enum
{
    GM_ExportPackage_LatLongWGS84       = 0x00000001,   // Export data in lat/lon/WGS84 coordinates rather than the current projection or native projection of each layer
    GM_ExportPackage_DoublePrecision    = 0x00000002,   // Use double-precision coordinates for vector data.
    GM_ExportPackage_DiscardAttributes  = 0x00000004,   // Discard vector feature attributes 
    GM_ExportPackage_HideProgress       = 0x00000008,   // Don't show export progress
    GM_ExportPackage_KeepAllStyles      = 0x00000010,   // Keep all style information, even if features are using default style
    GM_ExportPackage_UseNativeProj      = 0x00000020,   // Use the native projection for each layer rather than the current projection or lat/lon/WGS84
    GM_ExportPackage_CombineVectorLayers= 0x00000040,   // Specifies that all compatible vector layers should be combined into a single layer instead of maintained in their original layers
    GM_ExportPackage_ExtraElevPrecision = 0x00000080,   // Store elevation values from elevation grid files with extra precision
};

// List of supported grid layouts for GM_CreateCustomElevGridLayer
typedef uint8 GM_GridLayout_t8; enum
{
    GM_GridLayout_SInt16        = 0,            // Each sample is a signed 16-bit integer
    GM_GridLayout_SInt32        = 1,            // Each sample is a signed 32-bit integer
    GM_GridLayout_Float         = 2,            // Each sample is an IEEE 32-bit floating point number

    GM_GridLayout_NumLayouts
};

// Flags to control the GM_DrawLayerList and GM_DrawPackageList operations
typedef uint32 GM_DrawFlags_t32; enum
{
    GM_DrawFlags_BestRasterLayers       = 0x00000001,   // Only draw the best raster layers for this zoom scale
    GM_DrawFlags_BestRasterLayersHiRes  = 0x00000003,   // Same as GM_DrawFlags_BestRasterLayers, only it shows higher resolution layers a bit sooner
    GM_DrawFlags_LowResRasterLayers     = 0x00000002,   // Only draw the lowest resolution raster layers
    GM_DrawFlags_HiResRasterLayers      = 0x00000004,   // Only draw the highest resolution raster layers
    GM_DrawFlags_BestRasterChart        = 0x00000005,   // Only draw the best raster chart (this is tuned for marine chart display)

    GM_DrawFlags_EraseBackground        = 0x00000100,   // Erase the background with the current background color (GM_SetBackgroundColor)
    GM_DrawFlags_HideAreas              = 0x00000200,   // Do not draw any area features from vector layers
    GM_DrawFlags_HideLines              = 0x00000400,   // Do not draw any line features from vector layers
    GM_DrawFlags_HidePoints             = 0x00000800,   // Do not draw any point features from vector layers
    GM_DrawFlags_SeparateVectorLayers   = 0x00001000,   // Draw each vector separately rather than drawing all at once.
    GM_DrawFlags_HideLabels             = 0x00002000,   // Do not label any rendered features
    GM_DrawFlags_DontMaintainAspectRatio= 0x00004000,   // Do NOT maintain the aspect ratio when drawing (this allows stretched views)
    GM_DrawFlags_HidePartialLabels      = 0x00008000,   // Hide labels that are not entirely in the draw window
    GM_DrawFlags_ShowRenderProgress     = 0x00010000,   // Show render progress dialog or call progress callback if provided
    GM_DrawFlags_HideExtraIconText      = 0x00020000,   // Hide any extra text shown below road icons
    GM_DrawFlags_HideNonIconRoadLabels  = 0x00040000,   // Hide any road line labels that are not iconized
    GM_DrawFlags_RenderVertices         = 0x00080000,   // Render vertices for area and line features
    GM_DrawFlags_IncrementalRender      = 0x00100000,   // Do an incremental render so that draw progress can be seen as layers complete rendering
    GM_DrawFlags_NoAutoInterpolation    = 0x00200000,   // Disable automatic interpolation of rasters at intermediate zoom ranges (results in faster renders w/ less quality)

    // Definitions for masks of various option bits
    GM_DrawFlags_RasterMask             = 0x00000007,   // Mask for raster draw options
};

// Misc. advanced options flags used with GM_SetMiscOption
typedef uint32 GM_MiscOpt_t32; enum
{
    GM_MiscOpt_DXFInsertsAsPoints = 0,         // Import DXF INSERT entities as points
    GM_MiscOpt_TIFFPreferTFW = 1,               // Prefer TFW coordinates for GeoTIFF files
    GM_MiscOpt_ExportOldFormatPRJ = 2,          // Export old format PRJ instead of new format
    GM_MiscOpt_DXFLayersAsCustomTypes = 3,      // Add new custom types for DXF layers
    GM_MiscOpt_HideNonIconRoadLabels = 4,       // Hide any road labels that are not icons
    GM_MiscOpt_ClampGridToDataBounds = 5,       // Don't expand grid lines beyond the edge of loaded data
    GM_MiscOpt_BILQueryFor16BitType = 7,        // When loading BIL (and other similar) imagery that is 16-bit and single band, ask the user if it is elevation or imagery data
    GM_MiscOpt_BorderHighlightAreas = 8,        // Only draw a thick border for highlighted areas rather than a filled cross-hatch
    GM_MiscOpt_AddRecIDAttribute = 9,           // Add record ID (index) as attribute for vector features from some file types
    GM_MiscOpt_DefaultToOEMCharset = 11,        // Make default font display use the OEM character set (codepage 437) rather than the ANSI character set (codepage 1252)
    GM_MiscOpt_CenterLabelsTransparent= 12,     // Make labels centered on lines use transparent background rather than opaque
    GM_MiscOpt_MarkAddressedSegments = 13,      // Mark line segments with addressing with dashed styles on the side(s) of the line with addressing
    GM_MiscOpt_HideOffscreenLabels = 14,        // Don't display any labels that aren't completely onscreen
    GM_MiscOpt_UseCRLFInWorldFiles = 15,        // Use CR/LF to terminate lines in exported world files rather than just LF
    GM_MiscOpt_LogDebugMessages = 16,           // Log debug messages to a file or via message callback
    GM_MiscOpt_DontCropAtATM = 17,              // Don't crop lat/lon area and line features that cross the ATM or have bad lat/lon values
    GM_MiscOpt_DisableAutoSmooth = 18,          // Disable automatic interpolation of raster data at intermediate zoom levels
    GM_MiscOpt_UseFilePathForExport = 19,       // Use path to first loaded file as default export path
    GM_MiscOpt_MarkTurnRestrictions = 20,       // Mark the ends of lines involved in turn restrictions
    GM_MiscOpt_DontAutoContrastDGTiffs = 21,    // Disable automatic contrast adjustment for Digital Globe imagery
    GM_MiscOpt_HideMeasureAttrUnitNames = 22,   // Hide the unit names on measure unit text
    GM_MiscOpt_DGNImportCellsAsPoints=27,       // Import DGN cells as point features rather than exploding them
    GM_MiscOpt_DGNAddColorToDesc = 28,          // Add DGN feature color to description in addition to level
    GM_MiscOpt_MaintainExportBounds = 32,       // Maintain export bounds over spacing
    GM_MiscOpt_AutoIconizeRoadNames = 33,       // Automatically iconize road type names on import
    GM_MiscOpt_RenderEndpoints = 34,            // Render area and line start and end vertices
    GM_MiscOpt_KeepPixelIfAnyInCropPoly = 37,   // Keep pixel on export if any part of the pixel is inside the crop polygon rather than just the center
    GM_MiscOpt_LabelLinesOnLongestSeg = 38,     // Always label lines along longest segment
    GM_MiscOpt_AreaLabelsMustFitInArea = 40,    // Only display area labels if the label fits inside the area feature.
    GM_MiscOpt_TreatDbfTextAsUtf8 = 42,         // Treat DBF file text as UTF-8 encoded
    GM_MiscOpt_AlwaysInterpolateRasters = 43,   // Always enable interpolation for raster layers when loading them
    GM_MiscOpt_DisableAutoExportInterp = 45,    // Disable automatic interpolation of reprojected layers during export
    GM_MiscOpt_UsePenUpBorderDrawMode = 47,     // When duplicate vertex is encountered in area feature, turn off next border segment
    GM_MiscOpt_UseGridDistance = 51,            // Measure using grid distance instead of Vincenty lat/lon distance
    GM_MiscOpt_AlwaysFakeRasterPos = 53,        // Always fake the positioning information for unknown raster files
    GM_MiscOpt_PlacePRJAfterFullFName = 55,     // Place PRJ after full filename, like test.ecw.prj for test.ecw, when generating PRJ files on export
    GM_MiscOpt_IncludeDatumXFormInPRJ = 59,     // Include datum transformation parameters (TOWGS84) in generated PRJ files
    GM_MiscOpt_UseRhumbLineDistance = 63,       // Measure using rhumb line distance instead of Vincenty lat/lon or grid distance
    GM_MiscOpt_DisableAutoContrast = 64,        // Disable automatic constrast adjustment for high bit depth images
    GM_MiscOpt_SnapExportToPixel = 65,          // Snap non-reprojected exports to raster data pixel boundary
    GM_MiscOpt_DrawFatRoads = 256,              // Draw roads with fat style when zoomed in
    GM_MiscOpt_LinearMeasureUnits = 257,        // Linear measurement units (value is GM_LinearUnits_t8 type)
    GM_MiscOpt_AllowUnlimitedECWExportSize=258, // Allow ECW exports greater than 500MB uncompressed. You must have the appropriate license from Erdas to do this.
    GM_MiscOpt_SetVectorExportElevUnits = 259,  // Specifies the elevation units to use when exporting 3D features with per-vertex elevations or associated single elevation values (value is GM_ElevUnits_t8, but must be meters or feet)
};

// Flags to control the GM_FindNearestFeatures function
typedef uint32 GM_FindFlags_t32; enum
{
    GM_FindFlags_FindAreas              = 0x00000001,   // Search area features
    GM_FindFlags_FindLines              = 0x00000002,   // Search line features
    GM_FindFlags_FindPoints             = 0x00000004,   // Search point features
    GM_FindFlags_GetAllFeatures         = 0x00000008,   // Return all features in bounds (ignore search radius)

    // Definitions for masks of various option bits
    GM_FindFlags_FindAll                = 0x00000007,   // Mask for search all feature class (areas, lines, and points)
};

// Flags to control the behavior of path profile/line of sight analysis
typedef uint32 GM_PathProfileLOSFlags_t32; enum
{
    GM_PathProfile_LOSValid             = 0x00000001,   // Perform line-of-sight analysis
    GM_PathProfile_LOSIgnoreEndpoints   = 0x00000002,   // Ignore endpoints when performing line-of-sight analysis (i.e. end points can't block line of sight)
    GM_PathProfile_LOSFromHeightAbsolute= 0x00000004,   // Line-of-sight from height is absolute height above sea level rather than height above ground
    GM_PathProfile_LOSToHeightAbsolute  = 0x00000008,   // Line-of-sight to height is absolute height above sea level rathern than height above ground
    GM_PathProfile_IgnoreEarthCurvature = 0x00000010,   // Ignore earth curvature in any line-of-sight analysis
};

// List of supported color formats for GM_DrawLayerListToMemory
typedef uint32 GM_ColorFormat_t32; enum
    {
    GM_ColorFormat_32Bit_ABGR   = 0,        // 32-bit color (alpha, blue, green, red)
    GM_ColorFormat_32Bit_ARGB   = 1,        // 32-bit color (alpha, red, green, blue)
    GM_ColorFormat_16Bit_565    = 2,        // 16-bit color (5 bits red, 6 bits green, 5 bits blue)

    GM_ColorFormat_NumFormats
    };

// List of supported elevation units
typedef sint8 GM_ElevUnits_t8; enum
    {
    GM_ElevUnit_Meters = 0,
    GM_ElevUnit_Decimeters = 1,
    GM_ElevUnit_Centimeters = 2,
    GM_ElevUnit_Millimeters = 3,
    GM_ElevUnit_Feet = 4,
    GM_ElevUnit_Decifeet = 5,
    GM_ElevUnit_Inches = 6,
    GM_ElevUnit_Centifeet = 7,

    GM_ElevUnit_NumUnits
    };

// List of flags for selecting a projection
typedef uint32 GM_SelectProjFlags_t32; enum
{
    GM_SelectProj_NoInterplanetaryDatums    = 0x00000001,   // do not display interplanetary datums in projection selection dialog
};

// This type is used to reference a single layer loaded by the DLL.
typedef void* GM_LayerHandle_t32;

// This type is used to reference a single package loaded by the DLL
typedef void* GM_PackageHandle_t32;

// This describes a single point location
typedef struct
{
    double  mX;     // X (or longitude) coordinate
    double  mY;     // Y (or latitude) coordinate
} GM_Point_t;

// This type describes a bounding rectangle in world coordinates
typedef struct
{
    double  mMinX;  // Minimum x/easting/longitude coordinate
    double  mMinY;  // Minimum y/northing/latitude coordinate
    double  mMaxX;  // Maximum x/easting/longitude coordinate
    double  mMaxY;  // Maximum y/northing/latitude coordinate
} GM_Rectangle_t;

// This type describes a bounding rectangle in pixel coordinates
typedef struct
{
    sint32  mLeft;  // Left coordinate of rectangle
    sint32  mRight; // Right coordinate of rectangle
    sint32  mTop;   // Top coordinate of rectangle
    sint32  mBottom;// Bottom coordinate of rectangle
} GM_PixelRect_t;

// This type is used when rectifying imagery
typedef struct
{
    double  mPixelX;    // x pixel coordinate of GCP
    double  mPixelY;    // y pixel coordinate of GCP (top is 0, increases down)
    double  mGroundX;   // x ground coordinate of GCP (in provided projection)
    double  mGroundY;   // y ground coordinate of GCP (in provided projection)
} GM_GroundControlPoint_t;

// This type is used to represent a single attribute value pair
typedef struct
{
    char*   mName;      // Name of the attribute
    char*   mVal;       // Value of the attribute
} GM_AttrValue_t;

// This type is used to represent a single color palette entry
typedef struct
{
    COLORREF    mColor; // Palette entry RGB color
    char*       mName;  // Name associated with the palette entry
} GM_PaletteEntry_t;

// This type is used when returning information about a layer
typedef struct
{
    char*                       mDescription;       // Description string
    GM_Rectangle_t              mNativeRect;        // Bounding rect of layer in native coordinates
    GM_Rectangle_t              mGlobalRect;        // Bounding rect of layer in global coordinates
    uint32                      mPixelWidth;        // RASTER/ELEV ONLY: Number of pixels wide layer is
    uint32                      mPixelHeight;       // RASTER/ELEV ONLY: Number of pixels tall layer is
    GM_Projection_t             mNativeProj;        // Native projection of layer
    GM_GroundControlPoint_t*    mControlPoints;     // RASTER ONLY: Ground control points list
    uint32                      mNumGCPs;           // RASTER ONLY: Number of ground control points in list
    float                       mMinElevation;      // ELEV ONLY: Minimum elevation in meters
    float                       mMaxElevation;      // ELEV ONLY: Maximum elevation in meters
    uint32                      mNumAreas;          // VECTOR ONLY: Number of area features
    uint32                      mNumLines;          // VECTOR ONLY: Number of line features
    uint32                      mNumPoints;         // VECTOR ONLY: Number of point features
    double                      mPixelSizeX;        // RASTER/ELEV ONLY: Pixel size in meters in the x direction
    double                      mPixelSizeY;        // RASTER/ELEV ONLY: Pixel size in meters in the y direction
    boolean                     mHasRasterData;     // Does this layer have raster or elevation data?
    boolean                     mEnabled;           // Is this layer enabled for display or it it hidden?
    boolean                     mHasVectorData;     // Does this layer have vector data (the features counts can all be 0 for things like map catalogs)
    boolean                     mUsedDefaultPos;    // RASTER/ELEV ONLY: Was the default position used for this layer since the file could not be automatically positioned?
    char*                       mFilename;          // Filename from which layer was loaded (if this is an archive file, like .zip, then the name of the actual loaded file will be in mArchiveFilename
    char*                       mArchiveFilename;   // Filename within archive file (e.g. .zip or .tar.gz) from which layer was loaded, if any (might be NULL)
    char*                       mTypeName;          // Layer type name
    uint32                      mGlobalPixelWidth;  // RASTER/ELEV ONLY: Approximate number of pixels required in width for a 1:1 pixel mapping in the current projection
    uint32                      mGlobalPixelHeight; // RASTER/ELEV ONLY: Approximate number of pixels required in height for a 1:1 pixel mapping in the current projection
    GM_AttrValue_t*             mMetadataList;      // List of metadata attributes and values for the layer
    uint32                      mMetadataListSize;  // Number of entries in mMetadataList
    uint32                      mNumBands;          // Number of bands in a raster image (use GM_SetRasterDisplayOptions to change color band layout)
    char*                       mExtraLoadFlags;    // Additional load flags with options selected by user during load. Pass these to GM_LoadLayerListEx to remember options.
    GM_PaletteEntry_t*          mPalette;           // List of palette entries for palette-based raster layer
    uint32                      mPaletteSize;       // Number of entries in palette list
    void*                       mUserData;          // Custom data associated with layer provided by user via GM_SetLayerUserData function
    GM_ElevUnits_t8             mElevUnits;         // Elevation units for layer

} GM_LayerInfo_t;

// This type is used when returning a color
typedef struct
{
    uint8   mRed;       // Red component of color
    uint8   mGreen;     // Green component of color
    uint8   mBlue;      // Blue component of color
} GM_Color_t;

// This type represents the different font background options
typedef uint8 GM_FontBackground_t8; enum
{
    GM_Font_BgAuto          = 0,    // Automatically choose transparent or opaque background (all transparent except when centered on line)
    GM_Font_BgOpaque        = 1,    // Fill label background with current background color
    GM_Font_BgTransparent   = 2,    // Make label background transparent
};

// This type is used to describe a font used for rendering text
typedef struct
{
    const char*             mFaceName;  // name of font face used
    COLORREF                mColor;     // RGB color of font
    uint16                  mWeight;    // weight of font (use Win32 constants, like FW_BOLD, FW_THIN, FW_NORMAL, etc.)
    uint8                   mPointSize; // font point size (set mFixedHgt value to non-zero to use fixed height)
    boolean                 mItalicize; // draw text with italics?
    boolean                 mUnderline; // underline text?
    boolean                 mStrikeout; // strikeout text?
    uint8                   mCharset;   // character set (use OEM_CHARSET for default behavior)
    GM_FontBackground_t8    mBgMode;    // background fill mode (i.e. opaque or transparent)
    float                   mFixedHgt;  // fixed height of font in meters (use 0.0 for normal point-size font)
    GM_LabelPlacement_t8    mPlacement; // label placement relative to point features (only applies for point features)
    boolean                 mHalo;      // draw thin halo around text to make it visible on any background.
    uint8                   mReserved2; // reserved, must be 0
    uint8                   mReserved3; // reserved, must be 0
    float                   mAngle;     // counter-clockwise rotation angle of angle (0 is horizontal left to right)
} GM_FontDef_t;

// This type is used to describe a style used for drawing an area feature
// and its label (if any)
typedef struct
{
    GM_PenStyle_t16     mBorderPenStyle;    // border pen style (i.e. solid, dash, etc.)
    uint16              mBorderPenWidth;    // width to draw border pen in
    COLORREF            mBorderPenColor;    // color to use for border pen
    COLORREF            mBrushColor;        // color of brush to fill area with (when applicable to brush style). The color is defined as ARGB where the upper 8 bits are alpha. The exception is a value of 0 in the A is treated as no alpha.
    GM_BrushStyle_t16   mBrushStyle;        // style of brush to fill area with
    boolean             mDrawLabel;         // render the label for this area if there is one
    boolean             mDrawLabelAlways;   // render the label for this area even if it collides with another display label
    GM_FontDef_t        mFont;              // font to use to render label
} GM_AreaStyle_t;

// This type is used to describe a style used for drawing a line feature
// and its label (if any)
typedef struct
{
    GM_PenStyle_t16 mPenStyle;          // pen style (i.e. solid, dash, etc.)
    uint16          mPenWidth;          // width in pixels to draw pen in (set to 0 for fixed width lines)
    COLORREF        mPenColor;          // color to use for pen
    boolean         mDrawLabel;         // render the label for this line if there is one
    boolean         mDrawLabelAlways;   // render the label for this line even if it collides with another display label
    boolean         mDrawLabelOnLine;   // render the label for this line (if any) directly on the line rather than offset from it
    uint8           mReserved;          // must be 0
    GM_FontDef_t    mFont;              // font to use to render label
    sint32          mLabelSegment;      // segment number (1-based) on which to render label (use 0 to use default label placement)
    float           mFixedWidthMeters;  // fixed width in meters to use for pen (only used if mPenWidth is zero)
} GM_LineStyle_t;

// This type is OR'd with the mRotation member of the GM_PointStyle_t structure to specify
// symbol rotation sense.
typedef uint16 GM_RotationSense_t16; enum
{
    GM_RotateSense_TopOfMap  = 0x0000,  // Rotation is to top of map (default)
    GM_RotateSense_TrueNorth = 0x1000,  // Rotation is relative to true north
    GM_RotateSense_MagNorth  = 0x2000,  // Rotation is relative to magnetic north

    GM_RotateSense_Mask      = 0xF000,
    GM_RotateAngle_Mask      = 0x0FFF
};

// This type is used to describe a style used for drawing a point feature
// and its label (if any)
typedef struct
{
    const char*     mSymbolName;        // name of symbol
    GM_FontDef_t    mFont;              // font to use to render label
    boolean         mDrawLabel;         // render the label for this point if there is one
    boolean         mDrawLabelAlways;   // render the label for this point even if it collides with another display label
    uint16          mRotation;          // rotation angle in degrees (0 is up/north, 90 right/east, etc.) and rotation sense flags
    float           mScale;             // symbol scaling factor to apply (use negative values to make symbol a fixed height in meters, i.e. -10 would make symbol 10 meters high)
} GM_PointStyle_t;

// This type is used as the base for any vector feature information
typedef struct
{
    char*               mName;      // Name of the feature
    char*               mDesc;      // Description of the feature
    FeatureClass_t16    mClass;     // Global Mapper classification assigned to the feature
    GM_AttrValue_t*     mAttrList;  // List of attributes associated with feature
    uint16              mNumAttrs;  // Number of attributes in mAttrList
} GM_VectorFeature_t;

// This type is used to store information about holes within area features
typedef struct
{
    GM_Point_t* mPoints;    // List of points in the hole in global coordinates
    uint32      mNumPoints; // Number of points in the list
} GM_HoleInArea_t;

// This type is used to return information about area features
typedef struct
{
    GM_VectorFeature_t  mFeatureInfo;   // General feature info
    GM_Point_t*         mPointList;     // List of points in the area (global coordinates when getting, native when adding feature)
    uint32              mNumPoints;     // Number of points in the list
    GM_HoleInArea_t*    mHoleList;      // List of holes in the area
    uint32              mNumHoles;      // Number of holes in the list of holes
    GM_AreaStyle_t      mAreaStyle;     // Area render style
    float*              mVertexElevList;// Optional list of elevations for each point in area. If present, must have <mNumPoints> values
} GM_AreaFeature_t;

// This type is used to return information about line features
typedef struct
{
    GM_VectorFeature_t  mFeatureInfo;   // General feature info
    GM_Point_t*         mPointList;     // List of points in the line (global coordinates when getting, native when adding feature)
    uint32              mNumPoints;     // Number of points in the list
    GM_LineStyle_t      mLineStyle;     // Line render style
    float*              mVertexElevList;// Optional list of elevations for each point in line. If present, must have <mNumPoints> values
} GM_LineFeature_t;

// This type is used to return information about point features
typedef struct
{
    GM_VectorFeature_t  mFeatureInfo;   // General feature info
    GM_Point_t          mPos;           // Location of the point (global coordinates when getting, native when adding feature)
    GM_PointStyle_t     mPointStyle;    // Point render style (symbol and font)
} GM_PointFeature_t;

// This type is used to return information about a given feature classification
typedef struct
{
    boolean             mIsEnabled;     // Is display of this class enabled?
    const char*         mDesc;          // Description string for this feature
} GM_FeatureClassInfo_t;

// This type is used to return information about found features
typedef struct
{
    GM_LayerHandle_t32      mLayer;             // Layer the feature is in
    GM_FeatureClassType_t8  mFeatureClassType;  // Type of feature class (area, point, line)
    uint32                  mFeatureIndex;      // Index of feature in layer
    uint32                  mDistance;          // Distance in pixels of feature from search location
} GM_FoundFeature_t;

// This enumeration lists the ways that line and area labels can be
// exported to DXF files.
typedef uint8 GM_ExportOptsDXFLabels_t8; enum
{
    GM_ExportDXF_NoLabels,      // No line or area feature labels will be exported
    GM_ExportDXF_LabelsAsPoints,// Line and area feature labels will be exported as separate text entities
    GM_ExportDXF_LabelsAsAttrs, // Line and area feature labels will be exported as attributes of those entities
    
    GM_ExportDXF_LabelsNumOpts
};

// This type is used to describe custom export options for DXF vector exports
typedef struct
{
    float                       mTenPointFontHeight;    // Height (in ground units) to use for 10 pt label fonts (other sizes will be scaled appropriately)
    GM_ExportOptsDXFLabels_t8   mLabelType;             // Export setting for area and line feature labels
    boolean                     mUseLabelsForLayers;    // Use feature labels, if present, for layer names rather than feature types/descriptions
    boolean                     mUseZeroWidthLines;     // Export all lines as 0 width to prevent compatibility problems with some software
} GM_ExportOptsDXF_t;

// This type is used to describe custom export options for KML vector exports.
// To create a KMZ file, pass a filename with a .kmz extension to the GM_ExportVector function.
typedef struct
{
    float   mAreaOpacity;           // area translucency - percent (0.0 - 100.0)
    bool    mAreaDisplayAtElev;     // display area features at feature elevation
    bool    mAreaElevsRelative;     // area elevations relative to ground (only valid if mAreaDisplayAtElev set)
    bool    mExtrudeAreas;          // extrude 3D areas to make 3D shapes like buildings (only valid if mAreaDisplayAtElev set)
    bool    mLineDisplayAtElev;     // display line features at feature elevation
    bool    mLineElevsRelative;     // line elevations relative to ground (only valid if mLineDisplayAtElev set)
    bool    mHidePointsInitially;   // initially hide point features when displayed in Google Earth
} GM_ExportOptsKML_t;

// This enumeration lists various flags for a PDF export
typedef uint32 GM_PDFExportFlags_t32; enum
{
    GM_PDF_FillPage                 = 0x00000001,   // Expand export bounds to fill page
    GM_PDF_Landscape                = 0x00000002,   // Use landscape orientation
    GM_PDF_UseFilenamesForLayers    = 0x00000004,   // Use name of file features are from for layer names instead of feature type name
    GM_PDF_BorderStyleValid         = 0x00000008,   // Use border style settings
    GM_PDF_HideProgress             = 0x00000010,   // Disable progress display during export
    GM_PDF_NoJPGCompression         = 0x00000020,   // Don't use JPG compression for images
};

typedef struct
    {
    GM_PDFExportFlags_t32   mFlags;         // Export flags
    const char*             mPageSizeName;  // Name of page size, like "Letter", "Legal", "A0", etc.
    uint32                  mDPI;           // Export DPI
    GM_Rectangle_t          mMarginRect;    // Margins for each side in inches
    const char*             mHeaderStr;     // Header for page (NULL for none)
    const GM_FontDef_t*     mHeaderFont;    // Header font (NULL for default)
    const char*             mFooterStr;     // Footer for page (NULL for none)
    const GM_FontDef_t*     mFooterFont;    // Footer font (NULL for default)
    double                  mSymbolScale;   // Point symbol scaling factor (0.0 will be treated as 1.0, use 2.0 to double size, 0.5 to half size, etc.)
    GM_PenStyle_t16         mBorderStyle;   // Border pen style (i.e. solid, dash, etc.)
    uint16                  mBorderWidth;   // Border width in PDF points (pixels)
    COLORREF                mBorderColor;   // Border line color

} GM_ExportOptsPDF_t;

// This type is used to describe custom export options for Shapefile vector exports
typedef struct
{
    boolean mAddLabelAttr;          // include the display label as a LABEL attribute if present
    boolean mAddLayerAttr;          // add LAYER and GM_TYPE attribute values
} GM_ExportOptsSHP_t;

// This type is used to describe custom export options for Simple Text vector exports
typedef struct
{
    const char* mCoordSep;          // coordinate separator (use NULL for default of comma)
    const char* mFeatureSep;        // feature separator (use NULL for default of blank line)
    boolean     mAddStyleAttrs;     // include style attributes if attributes are included
    boolean     mYCoordFirst;       // export Y/latitude/northing before X/longitude/easting
    uint8       mReserved1;         // reserved (for padding), must be 0
    uint8       mReserved2;         // reserved (for padding), must be 0

} GM_ExportOptsSimpleText_t;

// This type is used to provide the parameters for performing a view shed
// analysis
typedef struct
{
    uint32              mSize;              // Size of structure
    float               mAngleEnd;          // End angle in radians for radar sweep
    float               mAngleStart;        // Start angle in radians for radar sweep
    double              mAtmosphericCorr;   // Atmospheric correction value (1.0 for none)
    GM_Point_t          mCenterPoint;       // Center point in global coordinates
    COLORREF            mColor;             // Color to display view shed data in
    const char*         mDesc;              // View shed description
    double              mRadius;            // Search radius in meters
    double*             mReceiverAngle;     // Angle (in degrees) above horizon to test at (NULL for none)
    float               mReceiverHeight;    // Height at which transmitter must be visible
    boolean             mReceiverHeightAbs; // Is the receiver height absolute or relative to the ground?
    boolean             mShowHiddenPoints;  // Make hidden points visible instead of viewable points.
    boolean             mShowProgress;      // Display view shed calculation progress?
    boolean             mGenCoveragePolys;  // Generate area/polygon features for the covered area (these are vector and exportable to vector formats)
    float               mTransmitterHeight; // Transmitter height in meters
    boolean             mTransmitterHeightAbs; // Is the transmitter height absolute or relative to the ground?
    boolean             mUseEarthCurvature; // Use the curvature of the earth in the analysis?
    boolean             mVectorElevsAbs;    // Are vector elevations absolute (i.e. relative to sea level) or relative to ground level?
    GM_LayerHandle_t32* mVectorLayerList;   // List of vector layers to use features with elevation attributes from
    uint32              mVectorLayerListCnt;// Number of vector layers in list    
    double              mXSpacing;          // X sample spacing (use 0.0 for default spacing)
    double              mYSpacing;          // Y sample spacing (use 0.0 for default spacing)
    GM_Rectangle_t*     mFilterRect;        // Optional rectangle for filtering view shed to a certain area of interest
    double*             mReceiverAngleEnd;  // Angle (in degrees) above horizon to stop test at (NULL for none) - if this and mReceiverAngle are provided, an angle range view shed test is done (like a flashlight beam)
    double              mFresnelFreq;       // Frequency (in GHz) to use for testing clearance of first Fresnel zone (use 0.0 to not do Fresnel testing)
    double              mFresnelPctClear;   // Percentage of first Fresnel zone that must be clear of obstacles (use 0.6 for 60%). If 0 is specified, the default of 60% is used.

} GM_ViewShedParams_t;

// This type is used to provide the parameters for generating contours
typedef struct
{
    uint32              mSize;              // Size of structure
    const char*         mDesc;              // Contour layer description
    GM_Rectangle_t      mContourBounds;     // Bounds of contour lines to create. Pass empty rectangle to use entirety of passed in layer(s).
    float               mContourInterval;   // Contour interval
    boolean             mIntervalInFeet;    // Set to TRUE if the contour interval is in feet rather than meters
    boolean             mGenerateAreas;     // Generate iso-height areas in addition to contour lines
    boolean             mGenerateSpotElevs; // Generate spot elevation points at minimum and maximum elevations
    boolean             mNumberOnlyLabels;  // Only include the value (and not the units string) in the contour labels
    boolean             mShowProgress;      // Display contour generation progress dialog
    boolean             mDisableSmoothing;  // Do not smooth the generated contour lines to improve their appearance
    double              mXSpacing;          // Sample spacing in the x direction
    double              mYSpacing;          // Sample spacing in the y direction
    double              mSimpThreshold;     // Simplification threshold, use 0.0 for no simplification
} GM_ContourParams_t;

// This type is used to provide the parameters for calculating path profiles and 
// performing line of sight analysis
typedef struct
{
    uint32                      mSize;              // IN: Size of structure
    GM_PathProfileLOSFlags_t32  mFlags;             // IN: Flags controlling behavior
    double                      mStartX;            // IN: Start X coord in current projection
    double                      mStartY;            // IN: Start Y coord in current projection
    double                      mEndX;              // IN: End X coord in current projection
    double                      mEndY;              // IN: End Y coord in current projection
    float*                      mElevList;          // OUT: Buffer to hold list of elevations (set to NULL if you don't care)
    uint32                      mListSize;          // IN: Number of elevations to retrieve
    float                       mDfltElev;          // IN: Elev to use when none could be found
    char*                       mDetailsStr;        // OUT: String containing path details (set to NULL if you don't care)
    uint32                      mDetailsStrMaxLen;  // IN: Maximum length of details string
    double                      mAtmosphericCorr;   // IN: Atmospheric correction for LOS (1.3333 is standard for radio waves, 1.0 is no correction)
    float                       mLOSFromHeight;     // IN: Line-of-sight from height in meters
    float                       mLOSToHeight;       // IN: Line-of-sight to height in meters
    float                       mLOSMinClearance;   // OUT: Minimum line-of-sight clearance in meters (will be negative if the line of sight is not clear)
    GM_Point_t                  mLOSMinClearancePos;// OUT: Location of minimum line-of-sight clearance
    double                      mFresnelFreq;       // IN: Frequency (in GHz) to use for testing clearance of first Fresnel zone (use 0.0 to not do Fresnel testing)
    double                      mFresnelPctClear;   // IN: Percentage of first Fresnel zone that must be clear of obstacles (use 0.6 for 60%). If 0 is specified, the default of 60% is used.
    GM_Point_t                  mLOSFirstBlockedPos;// OUT: Location of first blocked location along path (only valid if mLOSMinClearance is negative)
    GM_Point_t                  mLOSLastBlockedPos; // OUT: Location of last blocked location along path (only valid if mLOSMinClearance is negative)

} GM_PathProfileLOSParams_t;

// This type is used to provide the parameters for calculating cut-and-fill volumes
// within an area feature
typedef struct
{
    uint32              mSize;              // Size of structure
    const GM_Point_t*   mPoints;            // List of points in area in global coordinate system
    uint32              mNumPoints;         // Number of points in mPoints
    float               mCutHeight;         // Cut height in meters above sea level
    double              mXSpacing;          // Sample spacing in the x direction in global units
    double              mYSpacing;          // Sample spacing in the y direction in global units

} GM_AreaVolumeParams_t;

// This type is used to provide the parameters for calculating cut-and-fill volumes
// along a line feature
typedef struct
{
    uint32              mSize;              // Size of structure
    const GM_Point_t*   mPoints;            // List of points in line in global coordinate system
    float*              mCutHeights;        // Cut heights for each point in meters
    uint32              mNumPoints;         // Number of points in mPoints and mCutHeights
    boolean             mCutHeightsAbsolute;// Are the cut heights in mCutHeights relative to sea level (TRUE) or ground level (FALSE)
    double              mCorridorWidth;     // Width (i.e. diameter) in meters of corridor around line in which to calculate volume
    double              mXSpacing;          // Sample spacing in the x direction in global units
    double              mYSpacing;          // Sample spacing in the y direction in global units

} GM_LineVolumeParams_t;

// This type is used for returning the calculated elevation statistics within an area
typedef struct
{   
    uint32              mSize;              // Size of structure
    uint64              mNumSamples;        // Number of locations sampled to compute statistics
    double              mAvgElev;           // Average elevation in meters
    double              mMinElev;           // Minimum elevation in meters
    double              mMaxElev;           // Maximum elevation in meters
    double              mStdDevElev;        // Standard deviation of elevation in meters
    double              mModeElev;          // Approximate mode value of elevation in meters
    double              mAvgSlope;          // Average slope in degrees
    double              mMaxSlope;          // Maximum slope in degrees
    double              mStdDevSlope;       // Standard deviation of slope in degrees
    uint64              mNumIgnoredSamples; // Number of samples that were ignored due to being outside the crop areas or having no elevation

} GM_AreaElevStats_t;

// This type represents the different contrast adjustment modes that are available
typedef uint8 GM_ContrastMode_t8; enum
{
    GM_Contrast_None = 0,
    GM_Contrast_PercentageStretch,  // Stretch within some std-dev of mean to 0-255 range
    GM_Contrast_RangeStretch,       // Stretch entire valid range to 0-255 range

    GM_Contrast_NumModes,
    GM_Contrast_DefaultAuto = GM_Contrast_PercentageStretch
};

// This type represents the different blend modes available
typedef uint8 GM_BlendMode_t8; enum
    {
    GM_BlendMode_None = 0,
    GM_BlendMode_Multiple,
    GM_BlendMode_Screen,
    GM_BlendMode_Overlay,
    GM_BlendMode_HardLight,
    GM_BlendMode_ColorBurn,
    GM_BlendMode_ColorDodge,
    GM_BlendMode_ApplyColor,
    GM_BlendMode_ApplyColorReverse,
    GM_BlendMode_Darken,
    GM_BlendMode_Lighten,
    GM_BlendMode_Difference,
    GM_BlendMode_Exclusion,
    GM_BlendMode_KeepRedChannel,
    GM_BlendMode_KeepGreenChannel,
    GM_BlendMode_KeepBlueChannel,
    GM_BlendMode_SpotNaturalColor,      // view SPOT images as natural color
    GM_BlendMode_PsuedoNaturalColor,    // simple weighted average
    GM_BlendMode_ColorToGrayscale,      // convert RGB color image to grayscale

    // IMPORTANT NOTE: When adding new blend modes also add to the GM_BlendMode_t8 enumeration
    // in GlobalMapperInterface.h, which should match this.

    GM_BlendMode_NumModes
    };

// This type represents the display options available for raster and elevation layers
typedef struct
{
    uint32                  mSize;              // Size of structure
    GM_ContrastMode_t8      mContrastMode;      // Contrast adjustment mode
    boolean                 mAutoClipCollar;    // Automatically crop off a DRG, BSB, or other known collar boundary
    uint8                   mColorIntensity;    // Color intensity (0-20). Lower values are lighter, higher values are darker.
    GM_SamplingMethod_t8    mSamplingMethod;    // Specify how resampling should be done for this layer for display and export
    boolean                 mTextureMap;        // Texture map this raster layer over any underlying elevation layers.
    GM_BlendMode_t8         mBlendMode;         // Blend mode to use to blend this raster layer with underlying layers or to interpret the color values of the layer

    // Translucent/transparency support
    uint16      mTranslucency;          // Translucency level of layer (0 - completely see-through, 512 - completely opaque)
    boolean     mTransparent;           // Is layer transparent?
    COLORREF    mTransparentColor;      // Color to make transparent
    uint8       mTransparentColorDist;  // Fuzzy transparency support. Distance from transparent color to treat nearby colors transparent.

    // Color channel adjustment
    sint8       mRedAdjustPercent;      // Percentage to adjust red color channel by (-100 to 100)
    sint8       mGreenAdjustPercent;    // Percentage to adjust red color channel by (-100 to 100)
    sint8       mBlueAdjustPercent;     // Percentage to adjust red color channel by (-100 to 100)

    // Color band layout support
    boolean     mBandLayoutValid;       // Are the band layout values valid?
    uint8       mBandIdxRed;            // Index of color band (0-based) to use for red color channel
    uint8       mBandIdxGreen;          // Index of color band (0-based) to use for green color channel
    uint8       mBandIdxBlue;           // Index of color band (0-based) to use for blue color channel

    // Contrast adjustment parameters
    double      mContrastNumStdDev;     // Number of standard deviations from mean to stretch for contrast adjustment (if 0 is used the default of 2 will be used)
    boolean     mContrastShared;        // Is the contrast adjustment shared with other loaded layers?

    // Color Grade options
    boolean     mColorGradeValid;       // Are the color grade options valid?
    uint8       mColorGradeRedInMin;    // Minimum red input color value
    uint8       mColorGradeRedInMax;    // Maximum red input color value
    uint8       mColorGradeRedOutMin;   // Minimum red output color value
    uint8       mColorGradeRedOutMax;   // Maximum red output color value
    uint8       mColorGradeBlueInMin;   // Minimum Blue input color value
    uint8       mColorGradeBlueInMax;   // Maximum Blue input color value
    uint8       mColorGradeBlueOutMin;  // Minimum Blue output color value
    uint8       mColorGradeBlueOutMax;  // Maximum Blue output color value
    uint8       mColorGradeGreenInMin;  // Minimum Green input color value
    uint8       mColorGradeGreenInMax;  // Maximum Green input color value
    uint8       mColorGradeGreenOutMin; // Minimum Green output color value
    uint8       mColorGradeGreenOutMax; // Maximum Green output color value
    float       mColorGradeSaturation;  // Saturation (valid 0.0 - 1.0)

} GM_RasterDisplayOptions_t;

// This type represents any adjustments to apply to elevation values within a
// gridded elevation layer.
typedef struct
{
    float               mOffset;        // Offset to apply to elevations in meters
    double              mScale;         // Scale factor to apply
    boolean             mClampVals;     // Clamp out of range values to specified min/max
    boolean             mMinValid;      // Is the new minimum elevation valid
    float               mMinElev;       // Minimum valid elevation (meters)
    boolean             mMaxValid;      // Is the new maximum elevation valid
    float               mMaxElev;       // Maximum valid elevation (meters)
    boolean             mVoidValid;     // Is the void elevation value valid?
    GM_ElevUnits_t8     mElevUnits;     // Native elevation units for file.
    float               mVoidElev;      // Elevation to use for void values
    const char*         mLayerShader;   // Name of elevation shader to use for layer (NULL for default shared shader)

} GM_ElevationOverrides_t;

// This type represents the display options available for the built-in elevation shaders
typedef struct
{
    uint32      mSize;                  // Size of structure
    COLORREF    mDaylightShaderColor;   // Surface color for daylight shader
    COLORREF    mGradientShaderLoColor; // Min elevation color for gradient shader
    COLORREF    mGradientShaderHiColor; // Max elevation color for gradient shader
    COLORREF    mSlopeShaderMinColor;   // Min slope color for slope shader
    float       mSlopeShaderMinSlope;   // Min slope for slope shader in radians
    COLORREF    mSlopeShaderMaxColor;   // Max slope color for slope shader
    float       mSlopeShaderMaxSlope;   // Max slope for slope shader in radians
    double      mHSVShaderLoColorStart; // HSV Shader - Low Color Start in Degrees (0-360)
    double      mHSVShaderSaturation;   // HSV Shader - Saturation (0-1)
    double      mHSVShaderValue;        // HSV Shader - Value (0-1)
    double      mHSVShaderRange;        // HSV Shader - Range (>1)
    boolean     mHSVShaderReverse;      // HSV Shader - Reverse Colors
    boolean     mSlopeShaderCustomValid;// Is the custom slope shader color valid?
    uint8       mReserved[2];           // Reserved padding bytes
    COLORREF    mSlopeShaderCustomColor;// Color to display between min and max slope for slope shader (set mSlopeShaderCustomValid to TRUE to enable)

} GM_ShaderOptions_t;

typedef uint8 GM_MapCatalogDisplayType_t8; enum
{
    GM_MapCatalog_DisplayTypePercent,
    GM_MapCatalog_DisplayTypePixelSize,
    GM_MapCatalog_DisplayTypeScale,
    GM_MapCatalog_DisplayTypeScaleRange,

    GM_MapCatalog_NumDisplayTypes
};

// This type represents information about a map catalog. Use GM_GetLayerInfo
// for more generic information, like bounds.
typedef struct
{
    uint32                      mSize;          // Size of structure
    uint32                      mNumMaps;       // Number of maps in catalog.
    boolean                     mHideBounds;    // Hide layer bounds when not drawing data
    GM_MapCatalogDisplayType_t8 mDisplayType;   // Controls when layers in catalog are displayed
    uint8                       mReserved[2];   // Reserved for future use, must be 0
    double                      mDisplayValue;  // First value related to display type
    double                      mDisplayValue2; // Second value for range of scales

} GM_MapCatalogInfo_t;

// This is a set of bit flags for custom raster layers
typedef uint32 GM_RasterLayoutFlags_t32; enum
{
    GM_RasterLayout_BGROrder    = 0x00000001,   // Color bands are in order BGR rather than RGB
    GM_RasterLayout_AlphaPresent= 0x00000002,   // An alpha band is present. Use mAlphaBandIdx in GM_RasterLayout_t to specify band index.
    GM_RasterLayout_CopyData    = 0x00000004,   // Make copy of data so that caller doesn't have to keep buffer around
};

// This type represents layout information for a new custom raster layer
typedef struct
{
    GM_RasterLayoutFlags_t32    mFlags;         // General flags for layout.
    GM_Point_t                  mTopLeft;       // Ground coordinates of top left corner of the top left pixel
    double                      mXPixelSize;    // Size of each pixel in the x direction
    double                      mYPixelSize;    // Size of each pixel in the y direction
    sint32                      mPixelWidth;    // Number of pixels in the x direction
    sint32                      mPixelHeight;   // Number of pixels in the y direction
    uint32                      mNumBands;      // Number of bands of data (usually 1 for grayscale or 3 for RGB)
    uint32                      mBitsPerBand;   // Number of bits per band of data (usually 8)
    uint32                      mBytesPerRow;   // Number of bytes per row of data in data buffer. If 0 this will be calculated for you.
    COLORREF*                   mPalette;       // Array of colors for palette (set to NULL for no palette)
    uint32                      mPaletteSize;   // Number of colors in palette
    uint32                      mAlphaBandIdx;  // 0-based alpha channel band index (usually 0 or 3). Ignored unless GM_RasterLayout_AlphaPresent flag is set.

} GM_RasterLayout_t;

// Type listing available coordinate delimeters for ASCII import
typedef uint8 GM_AsciiCoordDelim_t8; enum
{
    GM_AsciiDelim_AutoDetect    = 0,
    GM_AsciiDelim_Comma         = 1,
    GM_AsciiDelim_Whitespace    = 2,
    GM_AsciiDelim_Semicolon     = 3,
    GM_AsciiDelim_Tab           = 4,

    GM_AsciiDelim_NumTypes
};

// Type listing available import types for ASCII import
typedef uint8 GM_AsciiImportType_t8; enum
{
    GM_AsciiImport_PointOnly    = 0,    // create point features for every encountered coordinate
    GM_AsciiImport_Vector       = 1,    // create area, line, and point features
    GM_AsciiImport_Elevation    = 2,    // triangulate and grid point cooridnates to generate an elevation grid

    GM_AsciiImport_NumTypes
};

// This type represents layout information for a generic ASCII import
typedef struct
{
    GM_AsciiImportType_t8   mImportType;                // specify import type
    GM_AsciiCoordDelim_t8   mCoordDelim;                // sepcify coordinate delimeter
    boolean                 mYCoordFirst;               // is Y coordinate first or X coordinate?
    boolean                 mIncludeCoordAttrs;         // include attributes from coordinate lines
    boolean                 mColumnHeadersInFirstRow;   // is the first row of the file column headers? (like for CSV files)
    boolean                 mIncludeElevCoords;         // is the 3rd coordinate column an elevation or Z value? Must be TRUE for eAsciiImportElevation import type.
    uint8                   mColumnsToSkip;             // columns to skip before reaching coordinate columns
    uint8                   mLinesToSkip;               // number of lines to skip at start of file
    const char*             mCoordLinePrefix;           // prefix to look for at beginning of coordinate lines (default to NULL or empty)
    AreaFeatureClass_t16    mAreaType;                  // area type to assign to imported created area features
    LineFeatureClass_t16    mLineType;                  // line type to assign to imported created line features
    PointFeatureClass_t16   mPointType;                 // point type to assign to imported point features
    boolean                 mIgnoreZeroElevations;      // ignore features with an elevation of zero
    boolean                 mFillToBounds;              // fill grid to full bounds of data (i.e. don't constrict to convex hull)
    double                  mOffsetX;                   // offset to apply to X coordinates
    double                  mOffsetY;                   // offset to apply to Y coordinates
    double                  mOffsetZ;                   // offset to apply to Z coordinates
    double                  mScaleX;                    // Scale to apply to X coordinates (default is 1.0)
    double                  mScaleY;                    // Scale to apply to Y coordinates (default is 1.0)
    double                  mScaleZ;                    // Scale to apply to Z coordinates (default is 1.0)
    double                  mNoDataDistanceFactor;      // tightness factor to use when gridding 3D data. Use 0.0 for default.
    uint8*                  mBreakOnColumnIdx;          // index of column to break features on when value changes. Pass NULL for default break behavior.

} GM_AsciiFormatInfo_t;

// This type represents the different flags available for elevation grid generation
typedef uint32 GM_GridGenFlags_t32; enum
{
    GM_GridGen_NoConstraints        = 0x00000001,   // Don't treat area and line boundaries as constraints (i.e. break lines)
    GM_GridGen_FlattenAreas         = 0x00000002,   // Flatten 3D areas
    GM_GridGen_FillToBounds         = 0x00000004,   // Fill the grid to the full bounding rectangle of the input data and not just to the convex hull
    GM_GridGen_IgnoreZeroElevs      = 0x00000008,   // Don't use features with an elevation value of 0
    GM_GridGen_HeightsRelative      = 0x00000010,   // Vector elevations are relative to underlying terrain data (if loaded)
};

// This type represents the input needed for gridding a set of vector data
typedef struct
{
    const char*             mDesc;          // Grid description
    GM_GridGenFlags_t32     mFlags;         // Flags for grid generation
    double                  mXRes;          // X resolution (in current proj units) to generate grid at (use 0.0 for auto-spacing determination)
    double                  mYRes;          // Y resolution (in current proj units) to generate grid at (use 0.0 for auto-spacing determination)
    UNIT                    mElevUnits;     // Units to generate grid at (elevation values in other units will be converted as needed)
    const GM_Rectangle_t*   mBounds;        // Bounding box to grid to in current proj units. Pass NULL to use the combined bounds of all input layers (the default).
    double                  mTightnessMult; // Grid tightness multiplier (multiplies resolution) for discarding values far from a sample. Default of zero discards nothing.
    
} GM_GridGenSetup_t;

// This type represents the different available datum transformation methods
typedef uint32 GM_DatumXForm_t32; enum
{
    GM_Datum_Molodensky = 0,    // 3-parameter Molodensky datum transformation
    GM_Datum_BursaWolfe = 1,    // 7-parameter Bursa-Wolfe datum transformation

    GM_Datum_NumXFormMethods
};

// This type represents information about a datum
typedef struct
{
    GM_DatumXForm_t32   mMethod;        // Transformation method
    const char*         mDatumName;     // Name of datum
    const char*         mEllipsoidName; // Name of ellipsoid this datum is based on
    double              mDeltaX;        // Delta X in meters
    double              mDeltaY;        // Delta Y in meters
    double              mDeltaZ;        // Delta Z in meters
    double              mScale;         // Scale factor (GM_Datum_BursaWolfe only)
    double              mRotX;          // Rotation in X in arc seconds (GM_Datum_BursaWolfe only)
    double              mRotY;          // Rotation in Y in arc seconds (GM_Datum_BursaWolfe only)
    double              mRotZ;          // Rotation in Z in arc seconds (GM_Datum_BursaWolfe only)
    double              mPrimeMeridian; // Prime meridian for datum (0.0 for Greenwich)
    const char*         mPrimeMeridianName; // Optional name of prime meridian
    double              mSemiMajor;     // Ellipsoid semi-major axis (output only)
    double              mSemiMinor;     // Ellipsoid semi-major axis (output only)

} GM_DatumInfo_t;

// This type represents a single elevation/color pair for a custom shader
typedef struct
{
    float       mElev;  // Elevation value in meters
    COLORREF    mColor; // Color value

} GM_ElevColor_t;

// This type represents flags available for custom shaders
typedef uint32 GM_CustomShaderFlags_t32; enum
{
    GM_CustomShader_DontBlend       = 0x00000001,   // Don't blend colors between elevation values
    GM_CustomShader_StretchToRange  = 0x00000002,   // Stretch custom shader to cover valid elevation range
};

// This type represents a custom elevation shader
typedef struct
{
    const char*                 mShaderName;    // Name to use for the shader
    GM_CustomShaderFlags_t32    mFlags;         // Shader flags
    uint32                      mNumElevs;      // Number of elevation/color pairs
    GM_ElevColor_t*             mElevColorList; // List of elevation/color pairs for shader

} GM_CustomShader_t;

// This type represents flags available for web format exports
typedef uint32 GM_WebExportFlags_t32; enum
{
    GM_WebExport_NoTransparency     = 0x00000001,   // Don't use transparency in exported files
    GM_WebExport_DisplayResults     = 0x00000002,   // Automatically load the results in a web browser/viewer
    GM_WebExport_HideProgress       = 0x00000004,   // Don't show export progress
    GM_WebExport_AddScaleBar        = 0x00000008,   // Add scale bar control (Google Maps only)
    GM_WebExport_AddMapTypeControl  = 0x00000010,   // Add map type selector control (Google Maps only)
    GM_WebExport_AddOverviewMap     = 0x00000020,   // Add overview map control (Google Maps only)
    GM_WebExport_AutoGrid           = 0x00000040,   // Automatically grid for display (KML only - super overlays)
    GM_WebExport_SkipEmptyTiles     = 0x00000080,   // Don't export empty tiles
    GM_WebExport_WWUseJavaFilenames = 0x00000100,   // Use filenames for WorldWind Java edition
    GM_WebExport_WWTransparentTiles = 0x00000200,   // Create transparent tiles
    GM_WebExport_SkipExistingTiles  = 0x00000400,   // Skip existing tiles
    GM_WebExport_FillToTileBounds   = 0x00000800,   // Fill to tile bounds
};

// This type represents the options when exporting to a web format
typedef struct
{
    const char*                 mMapName;       // Name to use for map set
    sint32                      mMaxZoomLevel;  // Maximum zoom level to export at (Google Maps, Virtual Earth/Bing Maps, and WorldWind exports only)
    uint32                      mNumZoomLevels; // Number of zoom levels to export  (Google Maps, Virtual Earth/Bing Maps, and WorldWind exports only)
    GM_RasterExportFormat_t32   mFormat;        // Image format
    GM_WebExportFlags_t32       mFlags;         // Export flags
    const char*                 mApiKey;        // API key (used for Google Maps export)
    const char*                 mBgMapName;     // Background map name (used for Google Maps export, ie. G_NORMAL_MAP, G_SATELLITE_MAP, etc.)
    double                      mTranslucency;  // Translucency setting for new map (0.0 - 1.0). 1.0 is opaque. If 0.0 is provided, it will be assumed to be 1.0.
    double                      mXRes;          // X resolution in arc degrees for export (KML only, default of 0.0 is full resolution)
    double                      mYRes;          // Y resolution in arc degrees for export (KML only, default of 0.0 is full resolution)
    const char*                 mWWTilePath;    // path to where WorldWind tiles should be stored. If NULL the path to the provide XML file will be used

} GM_WebFormatExportOpts_t;

// Flags to use for adding features to vector layer functions
typedef uint8 GM_AddFeatureFlags_t8; enum
{
    GM_AddFeature_UseDefaultStyle   = 0x01, // Use the default style for this feature rather than the specified style
    GM_AddFeature_MoreAddsToFollow  = 0x02, // There will be more features immediately added to this layer, so don't recalculate the bounding box, etc. based on this feature
};

// Flags to use when using a GM_Get*FeatureEx function
typedef uint32 GM_GetFeatureFlags_t32; enum
{
    GM_GetFeature_UseLayerProj      = 0x01, // Fetch feature coordinates in layer projection instead of current set prjoection
    GM_DontGetPolylineCoords        = 0x02, // Don't get the coordinate list for line and area features
};

// Flags to use when making a GM_CalcBearing call
typedef uint8 GM_BearingFlags_t8; enum
{
    GM_Bearing_LatLon               = 0x01, // The provided coordinates are latitude and longitude coordinates in the current datum rather than coordinates in the current projection
    GM_Bearing_TrueNorth            = 0x00, // The returned bearing will be relative to true north (default)
    GM_Bearing_MagneticNorth        = 0x02, // The returned bearing will be relative to magnetic north
    GM_Bearing_GridNorth            = 0x04, // The returned bearing will be relative to grid north
};

// Callback for displaying error and warning messages.
typedef void (__stdcall *GM_MessageCallbackFunc)
    ( 
    const char* aMessageText
    );

// Callback for selecting a projection. Return TRUE if the projection structure
// has been filled in and should be used. Return FALSE if the load should be
// aborted.
typedef boolean (__stdcall *GM_QueryProjectionCallbackFunc)
    (
    GM_Projection_t*    aProj,          // OUT: projection structure to fill in
    const GM_Point_t*   aInitialPos,    // IN: optional coordinate in projection of layer to give hint as to what projection might be
    GM_ElevUnits_t8*    aElevUnits      // OUT: optional, set to elevation units to use for layer if applicable and not NULL
    );

/*--------------------------------------------------------------------
                                MACROS
--------------------------------------------------------------------*/

// Define a macro for determining how the exported functions should be declared.
// This will vary depending on whether you're creating the DLL or using it.
#if defined( GM_BUILDING_DLL )
#define GM_DLL_EXPORTED
#elif defined( GM_BUILD_IN_PLACE )
#define GM_DLL_EXPORTED
#else
#define GM_DLL_EXPORTED __declspec(dllimport)
#endif

#ifdef __cplusplus
extern "C" {
#endif

/*--------------------------------------------------------------------
                           LAYER LOAD FUNCTIONS
--------------------------------------------------------------------*/

// Closes a previously opened layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CloseLayer
    ( 
    GM_LayerHandle_t32      aLayer
    );

// Closes a previously opened package that was opened with the GM_LoadPackage function
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ClosePackage
    ( 
    GM_PackageHandle_t32    aPackage
    );

// Flushes any in-memory cache for the layer (mainly useful in low-memory environments)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_FlushLayerCache
    ( 
    GM_LayerHandle_t32      aLayer
    );

// Returns a const pointer to information about the specified layer. Returns
// NULL if the layer is not loaded.
GM_DLL_EXPORTED const GM_LayerInfo_t* __stdcall GM_GetLayerInfo
    (
    GM_LayerHandle_t32      aLayer
    );

// Returns a list of the layers that are in a given package. The pointer
// returned is temporary and will become invalid with the next call to this function.
GM_DLL_EXPORTED GM_LayerHandle_t32* __stdcall GM_GetPackageLayerList
    (
    GM_PackageHandle_t32    aPackage,   // IN: package to get list of layers from
    uint32*                 aLayerCount // OUT: Number of layers in returned list
    );

// Loads a new layer from a simple ASCII text file file. A pointer to the layer is 
// stored for use in later calls.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadGenericAsciiTextLayer
    ( 
    const char*                 aFilename,  // IN: filename of ASCII file to load
    GM_LayerHandle_t32*         aLayer,     // OUT: layer handle for loaded layer
    GM_LoadFlags_t32            aLoadFlags, // IN: load flags
    const GM_AsciiFormatInfo_t* aFormatInfo,// IN: optional format info (use NULL to prompt user)
    const GM_Projection_t*      aProj       // IN: optional projection to use for file (use NULL to prompt user)
    );

// Loads a new layer from a file. A pointer to the layer is stored for
// use in later calls. This function is deprecated. You should use
// GM_LoadLayerList or GM_LoadLayerListEx instead.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadLayer
    ( 
    const char*             aFilename,
    GM_LayerHandle_t32*     aLayer,
    GM_LoadFlags_t32        aLoadFlags
    );

// Loads layer(s) from a file. A pointer to a list containing handles
// to the loaded layers is returned.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadLayerList
    ( 
    const char*             aFilename,
    GM_LayerHandle_t32**    aLayerList,
    uint32*                 aNumLoadedLayers,
    GM_LoadFlags_t32        aLoadFlags
    );

// Loads layer(s) from a file. A pointer to a list containing handles
// to the loaded layers is returned. Additional load options can be
// specified using the aExtraLoadOptions string.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadLayerListEx
    ( 
    const char*             aFilename,
    GM_LayerHandle_t32**    aLayerList,
    uint32*                 aNumLoadedLayers,
    GM_LoadFlags_t32        aLoadFlags,
    const char*             aExtraLoadOptions
    );

// Loads data from an online source, like a WMS server or TerraServer-USA
// (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadOnlineLayer
    (
    const char*             aSourceName,    // in: name of the TerraServer-USA theme or WMS source to load ("drg", "doq", etc.) or NULL to ask user
    const GM_Rectangle_t*   aLatLonRect,    // in: lat/lon rect to import (NULL to ask user)
    GM_LayerHandle_t32*     aLayer,         // out: handle to loaded layer
    void*                   aReserved       // in: reserved parameter (must be NULL)
    );

// Loads a new Global Mapper package (.gmp) file. You can also load package files
// with the GM_LoadLayerList command if you don't need to operate on the package
// as a whole.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadPackage
    ( 
    const char*             aFilename,
    GM_PackageHandle_t32*   aPackage,
    GM_LoadFlags_t32        aLoadFlags
    );

// Loads a new layer from a file. A pointer to the layer is stored for
// use in later calls. The layer will be rectified using the ground
// control points and projection provided.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadRectifiedLayer
    ( 
    const char*                     aFilename,
    GM_LayerHandle_t32*             aLayer,
    GM_LoadFlags_t32                aLoadFlags,
    const GM_GroundControlPoint_t*  aGCPList,
    uint32                          aNumGCPs,
    const GM_Projection_t*          aProj
    );

// Loads data from the TerraServer, including DRG, DOQ, and urban area imagery
// (not implemented on WinCE)
// DEPRECATED: Use GM_LoadOnlineLayer instead
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadTerraServerLayer
    (
    const char*             aThemeName, // in: name of the theme or WMS source to load ("drg", "doq", etc.) or NULL to ask user
    const GM_Rectangle_t*   aLatLonRect,// in: lat/lon rect to import (NULL to ask user)
    GM_LayerHandle_t32*     aLayer      // out: handle to loaded TerraServer layer
    );

// Repositions/reprojects a previously loaded raster layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_RepositionLayer
    ( 
    GM_LayerHandle_t32              aLayer,
    const GM_GroundControlPoint_t*  aGCPList,
    uint32                          aNumGCPs,
    const GM_Projection_t*          aProj
    );

// Saves the current list of loaded layers and display options to a workspace (GMW) file
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SaveWorkspace
    (
    const char* aFilename,  // IN: name of workspace file to save
    void*       aReserved   // IN: reserved for later use, must be NULL
    );

/*--------------------------------------------------------------------
                  DISPLAY OPTIONS/DRAWING FUNCTIONS
--------------------------------------------------------------------*/

// Adds a new custom shader for possible use for elevation layer display
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomShader
    (
    const GM_CustomShader_t*    aShader,    // in: shader to add
    uint32                      aReserved   // reserved, must be 0
    );

// Turn automatic collar cropping on or off for a layer. This function is deprecated. 
// You should use GM_SetRasterDisplayOptions instead.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CropLayerCollar
    (
    GM_LayerHandle_t32      aLayer,         // in: Layer to crop collar from
    boolean                 aCropCollar     // in: Crop the collar? (TRUE or FALSE)
    );

// Draws grid lines (either lat/lon or in the view projection) for the
// specified location.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_DrawGridLines
    (
    HDC                     aDC,            // Device context to draw to
    boolean                 aLatLonGrid,    // Draw a lat/lon grid or a view projection grid
    double                  aGridSpacing,   // Grid spacing (use 0.0 for default)
    const GM_Rectangle_t*   aWorldBounds,   // World bounds to draw or NULL for all
    sint32                  aLeftPixel,     // Left pixel coordinate to draw to
    sint32                  aTopPixel,      // Top pixel coordinate to draw to
    sint32                  aPixelWidth,    // Width in pixels to draw
    sint32                  aPixelHeight    // Height in pixels to draw
    );

// Draws grid lines (either lat/lon or in the view projection) for the
// specified location. This version can override the default extents of the grid
// lines to be whatever they'd like rather than the bounds of all loaded data.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_DrawGridLinesEx
    (
    HDC                     aDC,            // Device context to draw to
    boolean                 aLatLonGrid,    // Draw a lat/lon grid or a view projection grid
    double                  aGridSpacing,   // Grid spacing (use 0.0 for default)
    const GM_Rectangle_t*   aWorldBounds,   // World bounds to draw or NULL for all
    sint32                  aLeftPixel,     // Left pixel coordinate to draw to
    sint32                  aTopPixel,      // Top pixel coordinate to draw to
    sint32                  aPixelWidth,    // Width in pixels to draw
    sint32                  aPixelHeight,   // Height in pixels to draw
    const GM_Rectangle_t*   aMaxGridBounds  // Maximum grid bounds (NULL for loaded data bounds)
    );

// Draws the specified portion of the specified layer to the device context. 
// If no layer is explicitly specified, all loaded layers will be drawn.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_DrawLayer
    (
    HDC                     aDC,            // Device context to draw to
    GM_LayerHandle_t32      aLayer,         // Layer to draw or NULL for all
    const GM_Rectangle_t*   aWorldBounds,   // World bounds to draw or NULL for all
    sint32                  aLeftPixel,     // Left pixel coordinate to draw to
    sint32                  aTopPixel,      // Top pixel coordinate to draw to
    sint32                  aPixelWidth,    // Width in pixels to draw
    sint32                  aPixelHeight    // Height in pixels to draw
    );

// Draws the specified portion of the specified layers to the device context. 
// If no layers are explicitly specified, all loaded layers will be drawn.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_DrawLayerList
    (
    HDC                     aDC,            // Device context to draw to
    GM_LayerHandle_t32*     aLayerList,     // List of layers to draw or NULL for all
    uint32                  aLayerCount,    // Number of layers in list (0 for all)
    GM_DrawFlags_t32        aDrawFlags,     // Flags controlling how the draw is performed
    const GM_Rectangle_t*   aWorldBounds,   // World bounds to draw or NULL for all
    sint32                  aLeftPixel,     // Left pixel coordinate to draw to
    sint32                  aTopPixel,      // Top pixel coordinate to draw to
    sint32                  aPixelWidth,    // Width in pixels to draw
    sint32                  aPixelHeight    // Height in pixels to draw
    );

// Draws the specified portion of the specified layers to the provided memory
// buffer. If no layers are explicitly specified, all loaded layers will be drawn.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_DrawLayerListToMemory
    ( 
    GM_LayerHandle_t32*     aLayerList,     // List of layers to draw or NULL for all
    uint32                  aLayerCount,    // Number of layers in list (0 for all)
    GM_DrawFlags_t32        aDrawFlags,     // Flags controlling how the draw is performed
    const GM_Rectangle_t*   aWorldBounds,   // World bounds to draw or NULL for all
    GM_ColorFormat_t32      aColorFormat,   // Color format used in data buffer
    sint32                  aPixelWidth,    // Width in pixels to draw
    sint32                  aPixelHeight,   // Height in pixels to draw
    void*                   aDataBuf,       // Buffer to hold output color data
    sint32                  aRowWidthBytes  // Width of a single row in the array in bytes
    );

// Draws the specified portion of the specified packages to the device context. 
// If no packages are explicitly specified, all loaded packages will be drawn.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_DrawPackageList
    (
    HDC                     aDC,            // Device context to draw to
    GM_PackageHandle_t32*   aPackageList,   // List of packages to draw or NULL for all
    uint32                  aPackageCount,  // Number of packages in list (0 for all)
    GM_DrawFlags_t32        aDrawFlags,     // Flags controlling how the draw is performed
    const GM_Rectangle_t*   aWorldBounds,   // World bounds to draw or NULL for all
    sint32                  aLeftPixel,     // Left pixel coordinate to draw to
    sint32                  aTopPixel,      // Top pixel coordinate to draw to
    sint32                  aPixelWidth,    // Width in pixels to draw
    sint32                  aPixelHeight    // Height in pixels to draw
    );

// Retrieves the elevation adjusment options to use for a given elevation layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetElevationOverrides
    (
    GM_LayerHandle_t32          aLayer,     // in: layer to get options for
    GM_ElevationOverrides_t*    aOptions    // out: elevation adjustments
    );

// Returns a list of the available elevation shaders
GM_DLL_EXPORTED GM_CustomShader_t* __stdcall GM_GetElevationShaders
    (
    uint32*     aNumShaders,    // OUT: Number of shaders in list returned
    boolean     aCustomOnly     // IN: Do you only want custom shaders returned?
    );

// Return the scale value (i.e. 24000.0 for 1:24K) that data was last rendered at
GM_DLL_EXPORTED double __stdcall GM_GetLastDrawnScale
    (
    HDC                     aDC             // Device context that was drawn to
    );

// Retrieves the options to use when displaying the given raster layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetRasterDisplayOptions
    (
    GM_LayerHandle_t32          aLayer,     // in: layer to get options for
    GM_RasterDisplayOptions_t*  aOptions    // out: display options for raster layer
    );

// Retrieves the options to use for the elevation shaders
GM_DLL_EXPORTED const GM_ShaderOptions_t* __stdcall GM_GetShaderDisplayOptions
    (
    void
    );

// Retrieves the options to use when displaying gridded elevation data.
GM_DLL_EXPORTED const GM_VerticalDisplayOptions_t* __stdcall GM_GetVerticalDisplayOptions
    (
    void
    );

// Removes a custom shader
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_RemoveCustomShader
    (
    const char* aShaderName // in: name of custom shader to remove
    );

// Sets the color to be used for background pixels when drawing and exporting
GM_DLL_EXPORTED COLORREF __stdcall GM_SetBackgroundColor
    (
    COLORREF                aBgColor
    );

// Sets the elevation adjustment values to use for a given elevation layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetElevationOverrides
    (
    GM_LayerHandle_t32                  aLayer,     // in: layer to set options for
    const GM_ElevationOverrides_t*      aOptions    // in: elevation adjustment options for raster layer
    );

// Sets whether or not a given layer is enabled for display. If disabled, the
// layer will never be drawn or used as input for other translucent or
// texture-mapped layers.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLayerEnabled
    (
    GM_LayerHandle_t32  aLayer,         // layer to enable or disable
    boolean             aEnable         // enable or disable the layer?
    );

// Allows for drawing data with a direction other than north to the top of
// the screen for most projections. A value of 0.0 is the default and
// implies no rotation. Technically, the orientation value is the number
// of degrees to rotate the rendered data counter-clockwise.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetOrientation
    (
    double              aOrientation    // Orientation of bitmap (0 is north up, 90 is east up, 180 is south up, 270 is west up)
    );

// Sets the options to use when displaying the given raster layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetRasterDisplayOptions
    (
    GM_LayerHandle_t32                  aLayer,     // in: layer to set options for
    const GM_RasterDisplayOptions_t*    aOptions    // in: display options for raster layer
    );

// Sets the options to use for the elevation shaders (call GM_GetShaderDisplayOptions to initialize)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetShaderDisplayOptions
    (
    const GM_ShaderOptions_t*           aOptions    // in: shader display options
    );

// Specifies the extra scaling factor to apply to line widths, point symbols, and
// fonts when drawing. This is useful when printing to try and keep vector features
// the same size as displayed.
GM_DLL_EXPORTED float __stdcall GM_SetVectorDrawScale
    (
    float   aDrawScale  // in: scale factor to apply to line widths, symbols, and fonts
    );

// Sets the options to use when displaying gridded elevation data. If you're not
// going to change everything, it's suggested that you first call 
// GM_GetVerticalDisplayOptions to initialize the structure to the current
// settings.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetVerticalDisplayOptions
    (
    const GM_VerticalDisplayOptions_t*  aVertDispOpts
    );

// Show display options dialog for layer(s)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ShowLayerOptionsDialog
    ( 
    GM_LayerHandle_t32*     aLayerList,     // List of layers to draw or NULL for all
    uint32                  aLayerCount     // Number of layers in list (0 for all)
    );

/*--------------------------------------------------------------------
              COORDINATE CONVERSION/MEASUREMENT FUNCTIONS
--------------------------------------------------------------------*/

// Calculates the bearing in radians between two points. The points 
// can either be specified as lat/lon values or in the current projection.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcBearing
    (
    double              aFromX,     // IN: start X/longitude coordinate
    double              aFromY,     // IN: start Y/latitude coordinate
    double              aToX,       // IN: stop X/longitude coordinate
    double              aToY,       // IN: stop Y/latitude coordinate
    GM_BearingFlags_t8  aFlags,     // IN: flags controlling coordinate projection and returned bearing sense
    double*             aBearing    // OUT: bearing in radians between the points
    );

// Calculates the great-circle distance in meters between two points. The points 
// can either be specified as lat/lon values or in the current projection.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcDistance
    (
    double  aFromX,     // IN: start X/longitude coordinate
    double  aFromY,     // IN: start Y/latitude coordinate
    double  aToX,       // IN: stop X/longitude coordinate
    double  aToY,       // IN: stop Y/latitude coordinate
    boolean aLatLon,    // IN: TRUE - coordinates are lat/lon, FALSE - coordinates are in the current projection?
    double* aDist       // OUT: distance in meters between the points
    );

// Calculates the enclosed area of a region in square meters.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcEnclosedArea
    (
    const GM_Point_t*       aPtList,    // IN: list of points defining area
    uint32                  aNumPoints, // IN: number of points in list
    const GM_Projection_t*  aProj,      // IN: projection of points in list (use NULL for current projection returned by GM_GetProjection)
    double*                 aArea       // OUT: enclosed area in square meters
    );

// Calculates the location of a new point projected from a start point along
// a given bearing.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcProjectedLocation
    (
    double  aFromX,     // IN: start X/longitude coordinate
    double  aFromY,     // IN: start Y/latitude coordinate
    double  aBearing,   // IN: bearing in degrees to project along (0 is north, 90 is east, 180 is south, 270 is west)
    double  aDist,      // IN: distance to project along bearing in meters
    double* aToX,       // OUT: stop X/longitude coordinate
    double* aToY,       // OUT: stop Y/latitude coordinate
    boolean aLatLon    // IN: TRUE - coordinates are lat/lon, FALSE - coordinates are in the current projection
    );

// Calculate the rectangle in global coordinates required to draw at the provided
// scale to the given device of the given size.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcScaleRectangle
    (
    const GM_Point_t*       aCenterPoint,   // IN: Center point in global coordinates
    double                  aScale,         // IN: Scale to calculate at (i.e. for 1:24K, pass 24000.0)
    HDC                     aDC,            // IN: Device context that will be drawn to
    sint32                  aPixWidth,      // IN: pixel width
    sint32                  aPixHeight,     // IN: pixel height
    GM_Rectangle_t*         aScaleRect      // OUT: rectangle at given scale
    );

// Calculates the width and height of a rectangle in the current projection. The
// rectangle can either be specified or the last drawn rectangle can be used.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcWorldRectSize
    (
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to calc size of or NULL for last drawn
    double*                 aWidthMeters,   // OUT: Width of rectangle in meters
    double*                 aHeightMeters   // OUT: Height of rectangle in meters
    );

// Convert a coordinate between the current projection and a pixel coordinate.
// The conversion space can be either the last drawn coordinate space or
// the caller can provide the coordinate space to work in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordGroundToPixel
    ( 
    double                  aGroundX,       // IN: X Coord in current projection
    double                  aGroundY,       // IN: Y Coord in current projection
    sint32*                 aPixelX,        // OUT: X Coord in pixel space
    sint32*                 aPixelY,        // OUT: Y Coord in pixel space
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect      // IN: Pixel bounds to convert from or NULL for last drawn 
    );

// Convert a coordinate between the current projection and a pixel coordinate.
// The conversion space can be either the last drawn coordinate space or
// the caller can provide the coordinate space to work in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordGroundToPixelDouble
    ( 
    double                  aGroundX,       // IN: X Coord in current projection
    double                  aGroundY,       // IN: Y Coord in current projection
    double*                 aPixelX,        // OUT: X Coord in pixel space
    double*                 aPixelY,        // OUT: Y Coord in pixel space
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect      // IN: Pixel bounds to convert from or NULL for last drawn 
    );

// Convert a coordinate between the current projection and a pixel coordinate.
// The conversion space can be either the last drawn coordinate space or
// the caller can provide the coordinate space to work in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordGroundToPixelWithOrientation
    ( 
    double                  aGroundX,       // IN: X Coord in current projection
    double                  aGroundY,       // IN: Y Coord in current projection
    sint32*                 aPixelX,        // OUT: X Coord in pixel space
    sint32*                 aPixelY,        // OUT: Y Coord in pixel space
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect,     // IN: Pixel bounds to convert from or NULL for last drawn 
    double                  aOrientation    // IN Orientation of coordinate space to use (0 is north up, 90 is east up, 180 is south up, 270 is west up)
    );

// Convert a coordinate between the current projection and a pixel coordinate.
// The conversion space can be either the last drawn coordinate space or
// the caller can provide the coordinate space to work in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordGroundToPixelWithOrientationDouble
    ( 
    double                  aGroundX,       // IN: X Coord in current projection
    double                  aGroundY,       // IN: Y Coord in current projection
    double*                 aPixelX,        // OUT: X Coord in pixel space
    double*                 aPixelY,        // OUT: Y Coord in pixel space
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect,     // IN: Pixel bounds to convert from or NULL for last drawn 
    double                  aOrientation    // IN Orientation of coordinate space to use (0 is north up, 90 is east up, 180 is south up, 270 is west up)
    );

// Convert a coordinate between layer pixel space and the current projection.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordLayerGroundToPixel
    ( 
    GM_LayerHandle_t32      aLayer,         // IN: raster layer to do conversion in
    double                  aGroundX,       // IN: X Coord in current projection
    double                  aGroundY,       // IN: Y Coord in current projection
    double*                 aPixelX,        // OUT: X Coord in layer pixel space
    double*                 aPixelY         // OUT: Y Coord in layer pixel space
    );

// Convert a coordinate between layer pixel space and the current projection.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordLayerPixelToGround
    ( 
    GM_LayerHandle_t32      aLayer,         // IN: raster layer to do conversion in
    double                  aPixelX,        // IN: X Coord in layer pixel space
    double                  aPixelY,        // IN: Y Coord in layer pixel space
    double*                 aGroundX,       // OUT: X Coord in current projection
    double*                 aGroundY        // OUT: Y Coord in current projection
    );

// Convert a coordinate between pixel space and the current projection.
// The conversion space can be either the last drawn coordinate space or
// the caller can provide the coordinate space to work in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordPixelToGround
    ( 
    sint32                  aPixelX,        // IN: X Coord in pixel space
    sint32                  aPixelY,        // IN: Y Coord in pixel space
    double*                 aGroundX,       // OUT: X Coord in current projection
    double*                 aGroundY,       // OUT: Y Coord in current projection
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect      // IN: Pixel bounds to convert from or NULL for last drawn 
    );

// Convert a coordinate between pixel space and the current projection.
// The conversion space can be either the last drawn coordinate space or
// the caller can provide the coordinate space to work in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordPixelToGroundDouble
    ( 
    double                  aPixelX,        // IN: X Coord in pixel space
    double                  aPixelY,        // IN: Y Coord in pixel space
    double*                 aGroundX,       // OUT: X Coord in current projection
    double*                 aGroundY,       // OUT: Y Coord in current projection
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect      // IN: Pixel bounds to convert from or NULL for last drawn 
    );

// Convert a coordinate between pixel space and the current projection.
// The conversion space can be either the last drawn coordinate space or
// the caller can provide the coordinate space to work in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordPixelToGroundWithOrientation
    ( 
    sint32                  aPixelX,        // IN: X Coord in pixel space
    sint32                  aPixelY,        // IN: Y Coord in pixel space
    double*                 aGroundX,       // OUT: X Coord in current projection
    double*                 aGroundY,       // OUT: Y Coord in current projection
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect,     // IN: Pixel bounds to convert from or NULL for last drawn 
    double                  aOrientation    // IN Orientation of coordinate space to use (0 is north up, 90 is east up, 180 is south up, 270 is west up)
    );

// Convert a coordinate between pixel space and the current projection.
// The conversion space can be either the last drawn coordinate space or
// the caller can provide the coordinate space to work in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ConvertCoordPixelToGroundWithOrientationDouble
    ( 
    double                  aPixelX,        // IN: X Coord in pixel space
    double                  aPixelY,        // IN: Y Coord in pixel space
    double*                 aGroundX,       // OUT: X Coord in current projection
    double*                 aGroundY,       // OUT: Y Coord in current projection
    const GM_Rectangle_t*   aWorldBounds,   // IN: World bounds to convert from or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect,     // IN: Pixel bounds to convert from or NULL for last drawn 
    double                  aOrientation    // IN Orientation of coordinate space to use (0 is north up, 90 is east up, 180 is south up, 270 is west up)
    );

/*--------------------------------------------------------------------
                    PROJECTION/DATUM FUNCTIONS
--------------------------------------------------------------------*/

// Adds a new custom datum with the given parameters
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomDatum
    (
    const GM_DatumInfo_t*   aDatumInfo,     // IN: Information about datum transformation to add
    DATUM*                  aDatumCode      // OUT: Datum code assigned to new custom datum
    );

// Adds a new custom ellipsoid with the given parameters
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomEllipsoid
    (
    const char*             aEllipsoidName, // IN: Name of ellipsoid
    double                  aSemiMajor,     // IN: Semi-major axis in meters
    double                  aSemiMinor      // IN: Semi-minor axis in meters
    );

// Decodes a MGRS (military grid reference system) coordinate into a X/Y or lat/lon location
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_DecodeMGRSCoordinates
    (
    const char* aMgrsStr,   // IN: buffer with MGRS coordinate text
    double*     aX,         // OUT: point X/longitude coordinate
    double*     aY,         // OUT: point Y/latitude coordinate
    boolean     aLatLon     // IN: TRUE - return coordinates are lat/lon, FALSE - return coordinates are in the current projection
    );

// Retrieves a list of all available projections and their available parameters, datums, units, etc.
GM_DLL_EXPORTED const GM_ProjectionInfo_t* __stdcall GM_GetAvailableProjectionList
    (
    uint32*             aProjCnt        // OUT: Number of projections returned in list
    );

// Gets the parameters for a particular datum
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetDatumInfo
    (
    DATUM           aDatumCode,     // IN: Datum code to get information about
    GM_DatumInfo_t* aDatumInfo      // OUT: Information about datum transformation for datum
    );

// Gets the MGRS (military grid reference system) coordinates for a location
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetMGRSCoordinates
    (
    double  aX,         // IN: point X/longitude coordinate
    double  aY,         // IN: point Y/latitude coordinate
    boolean aLatLon,    // IN: TRUE - coordinates are lat/lon, FALSE - coordinates are in the current projection?
    char*   aMgrsStr    // OUT: buffer to store MGRS coordinate text in
    );

// Retrieves the global projection that is being used for all
// rendering and exporting.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetProjection
    (
    GM_Projection_t*    aProj           // OUT: Current view/export projection
    );

// Initializes a GM_Projection_t structure from a projection (PRJ, Ozi .map, etc.) file.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadProjectionFile
    (
    const char*             aFilename,  // filename of projection file to load
    GM_Projection_t*        aProj       // buffer in which to place decoded projection.
    );

// Initializes a GM_Projection_t structure from an EPSG code
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadProjectionFromEPSGCode
    (
    uint32                  aEpsgCode,  // IN: EPSG code to get projection from
    GM_Projection_t*        aProj       // OUT: buffer in which to place decoded projection.
    );

// Initializes a GM_Projection_t structure from a WKT projection string
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_LoadProjectionFromWKTString
    (
    const char*             aStr,       // IN: String to decode projection from
    GM_Projection_t*        aProj       // OUT: buffer in which to place decoded projection.
    );

// Retrieves the underlying base projection that forms the basis for a given projection.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ProjectionGetBase
    (
    const GM_Projection_t*  aProjIn,    // IN: projection to convert from (NULL for current)
    GM_Projection_t*        aProjBase   // OUT: projection on which the input projection is based
    );

// Projects a point from one projection to another
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ProjectPoint
    (
    double                  aXIn,       // IN: X coordinate of input point
    double                  aYIn,       // IN: Y coordinate of input point
    double*                 aXOut,      // OUT: X coordinate of output point
    double*                 aYOut,      // OUT: Y coordinate of output point
    const GM_Projection_t*  aProjIn,    // IN: projection to convert from (NULL for current)
    const GM_Projection_t*  aProjOut    // IN: projection to convert to (NULL for current)
    );

// Projects a point from one projection to another at a fixed elevation above the ellipsoid.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ProjectPointAtElev
    (
    double                  aXIn,       // IN: X coordinate of input point
    double                  aYIn,       // IN: Y coordinate of input point
    double*                 aXOut,      // OUT: X coordinate of output point
    double*                 aYOut,      // OUT: Y coordinate of output point
    const GM_Projection_t*  aProjIn,    // IN: projection to convert from (NULL for current)
    const GM_Projection_t*  aProjOut,   // IN: projection to convert to (NULL for current)
    double                  aElev       // IN: elevation in meters above ellipsoid surface to do conversion at
    );

// Projects a list of points from one projection to another.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ProjectPointList
    (
    GM_Point_t*             aPointList, // IN/OUT: List of points to convert and buffer to hold converted points
    uint32                  aNumPoints, // IN: Number of points to convert
    float*                  aElevList,  // IN: Optional list of elevations (in meeters above ellipsoid surface) to do conversions at. Use NULL for default conversion at ellipsoid surface
    const GM_Projection_t*  aProjIn,    // IN: projection to convert from (NULL for current)
    const GM_Projection_t*  aProjOut    // IN: projection to convert to (NULL for current)
    );

// Projects a rectangle from one projection to another
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ProjectRectangle
    (
    const GM_Rectangle_t*   aRectIn,    // IN: Rectangle to convert in input projection
    GM_Rectangle_t*         aRectOut,   // OUT: Rectangle in output projection
    const GM_Projection_t*  aProjIn,    // IN: projection to convert from (NULL for current)
    const GM_Projection_t*  aProjOut    // IN: projection to convert to (NULL for current)
    );

// Saves a GM_Projection_t structure to a projection (PRJ) file.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SaveProjectionToFile
    (
    const char*             aFilename,  // filename of projection file to save to
    const GM_Projection_t*  aProj,      // projection to save
    uint32                  aReserved   // reserved for future use, must be 0
    );

// Saves a GM_Projection_t structure to a WKT projection string.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SaveProjectionToString
    (
    const GM_Projection_t*  aProj,      // projection to save
    char*                   aStrBuf,    // buffer to store string in
    uint32                  aBufSize,   // size of string buffer
    uint32                  aReserved   // reserved for future use, must be 0
    );

// Displays the projection selection dialog to allow the user to select a
// projection
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SelectProjection
    (
    GM_Projection_t*        aSelProj,   // out: projection selected by user
    const GM_Projection_t*  aInitProj   // in: initial projection to use (NULL for default)
    );

// Displays the projection selection dialog to allow the user to select a
// projection
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SelectProjectionEx
    (
    GM_Projection_t*        aSelProj,   // out: projection selected by user
    const GM_Projection_t*  aInitProj,  // in: initial projection to use (NULL for default)
    const POINT*            aDlgPos,    // in: position of top left corner (in screen coordinates) for projection dialog (NULL for default)
    GM_SelectProjFlags_t32  aFlags,     // in: additional flags for projection selection
    void*                   aReserved   // in: reserved for future use (must be NULL)
    );

// Sets the function to call to select a projection for a layer when being
// loaded if the projection for that layer cannot be automatically determined.
// If a callback is provided, it will be called rather than the projection
// selection dialog being displayed.
GM_DLL_EXPORTED void __stdcall GM_SetQueryProjectionCallback
    (
    GM_QueryProjectionCallbackFunc  aCallbackFunc
    );

// Sets the new projection. This is the projection that all draws and
// exports will be done in. It is also the projection that all world bound
// rectangles will be in.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetProjection
    (
    const GM_Projection_t*  aProj
    );

/*--------------------------------------------------------------------
                          EXPORT FUNCTIONS
--------------------------------------------------------------------*/

// Exports one or more layers to a new gridded elevation file (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportElevation
    (
    const char*                     aFilename,      // Name of new file to create
    GM_ElevationExportFormat_t32    aFormat,        // Format to export
    GM_LayerHandle_t32              aLayer,         // Layer to export or NULL for all
    const GM_Rectangle_t*           aWorldBounds,   // World bounds to export or NULL for all
    sint32                          aPixelWidth,    // Width in samples of new image
    sint32                          aPixelHeight,   // Height in samples of new image
    GM_RasterExportFlags_t32        aFlags,         // Export flags
    GM_ElevUnits_t8                 aElevUnits      // Elevation units for export, if applicable
    );

// Exports one or more layers to a new gridded elevation file (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportElevationEx
    (
    const char*                     aFilename,      // Name of new file to create
    GM_ElevationExportFormat_t32    aFormat,        // Format to export
    GM_LayerHandle_t32*             aLayerList,     // List of layers to export or NULL for all
    uint32                          aLayerCount,    // Number of layers in list (0 for all)
    const GM_Rectangle_t*           aWorldBounds,   // World bounds to export or NULL for all
    sint32                          aPixelWidth,    // Width in samples of new image
    sint32                          aPixelHeight,   // Height in samples of new image
    GM_RasterExportFlags_t32        aFlags,         // Export flags
    GM_ElevUnits_t8                 aElevUnits,     // Elevation units for export, if applicable
    const char*                     aExtraFlags     // Additional text-based flags for some formats (use NULL for defaults)
    );

// Exports one or more layers to a new package file
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportPackage
    (
    const char*                 aFilename,      // Name of new file to create
    GM_LayerHandle_t32*         aLayerList,     // List of layers to export or NULL for all
    uint32                      aLayerCount,    // Number of layers in list (0 for all)
    const GM_Rectangle_t*       aWorldBounds,   // World bounds to export or NULL for all
    double                      aSimpThreshold, // Simplification threshold, use 0.0 for no simplification
    GM_PackageExportFlags_t32   aFlags          // Export flags
    );

// Exports one or more layers to a new GeoPDF file (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportPDF
    (
    const char*                 aFilename,      // Name of new file to create
    GM_LayerHandle_t32*         aLayerList,     // List of layers to export or NULL for all
    uint32                      aLayerCount,    // Number of layers in list (0 for all)
    const GM_Rectangle_t*       aWorldBounds,   // World bounds to export or NULL for all
    const GM_ExportOptsPDF_t*   aExportOpts     // PDF export options (NULL for default)
    );

// Exports one or more layers to a new raster file (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportRaster
    (
    const char*                 aFilename,      // Name of new file to create
    GM_RasterExportFormat_t32   aFormat,        // Format to export
    GM_LayerHandle_t32          aLayer,         // Layer to export or NULL for all
    const GM_Rectangle_t*       aWorldBounds,   // World bounds to export or NULL for all
    sint32                      aPixelWidth,    // Width in pixels of new image
    sint32                      aPixelHeight,   // Height in pixels of new image
    GM_RasterExportFlags_t32    aFlags          // Export flags
    );

// Exports one or more layers to a new raster file (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportRasterEx
    (
    const char*                 aFilename,      // Name of new file to create
    GM_RasterExportFormat_t32   aFormat,        // Format to export
    GM_LayerHandle_t32*         aLayerList,     // List of layers to export or NULL for all
    uint32                      aLayerCount,    // Number of layers in list (0 for all)
    const GM_Rectangle_t*       aWorldBounds,   // World bounds to export or NULL for all
    sint32                      aPixelWidth,    // Width in pixels of new image
    sint32                      aPixelHeight,   // Height in pixels of new image
    GM_RasterExportFlags_t32    aFlags,         // Export flags
    const char*                 aExtraFlags     // Additional text-based flags for some formats (use NULL for defaults)
    );

// Exports one or more layers to a new raster file (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportRasterFromBitmap
    (
    const char*                 aFilename,      // Name of new file to create
    HBITMAP                     aBitmap,        // Handle to bitmap to export
    HDC                         aDC,            // Handle to compatible device context
    GM_RasterExportFormat_t32   aFormat,        // Format to export
    const GM_Rectangle_t*       aWorldBounds,   // World bounds of bitmap or NULL for last drawn
    GM_RasterExportFlags_t32    aFlags          // Export flags
    );

// Exports one or more layers to a new vector file (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportVector
    (
    const char*                     aFilename,      // Name of new file to create
    GM_VectorExportFormat_t32       aFormat,        // Format to export
    GM_LayerHandle_t32              aLayer,         // Layer to export or NULL for all
    const GM_Rectangle_t*           aWorldBounds,   // World bounds to export or NULL for all
    GM_VectorExportFlags_t32        aFlags,         // Export flags
    void*                           aFormatOptions  // Format-specific options (NULL for defaults)
    );

// Exports one or more layers to a new web format file (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_ExportWebFormat
    (
    const char*                     aFilename,      // Name of HTML/XML file to create
    GM_WebExportFormat_t32          aWebFormat,     // Format to export
    GM_LayerHandle_t32*             aLayerList,     // List of layers to export or NULL for all
    uint32                          aLayerCount,    // Number of layers in list (0 for all)
    const GM_Rectangle_t*           aWorldBounds,   // World bounds to export or NULL for all
    const GM_WebFormatExportOpts_t* aExportOpts,    // Export options
    void*                           aReserved       // Reserved for future use, must be NULL
    );

// Set the crop area(s) to use when exporting
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetExportCropAreas
    (
    const GM_AreaFeature_t* aAreaList,  // IN: List of areas to crop to (NULL to reset to default crop)
    uint32                  aNumAreas,  // IN: Number of areas in aAreaList
    const GM_Projection_t*  aAreaProj   // IN: Projection system the area coordinates are in (use NULL for current projection)
    );

/*--------------------------------------------------------------------
                RASTER/ELEVATION LAYER QUERY FUNCTIONS
--------------------------------------------------------------------*/

// Retrieves the color at a given location from a provided layer or from the
// list of currently loaded raster and elevation layers (topmost layer first).
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetLocationColor
    (
    GM_LayerHandle_t32      aLayer,     // IN: Layer to get color from or NULL for topmost
    double                  aXCoord,    // IN: X coord in current projection
    double                  aYCoord,    // IN: Y coord in current projection
    GM_Color_t*             aColor      // OUT: Color of pixel at location    
    );

// Retrieves the elevation at a given location from a provided layer or from the
// list of currently loaded elevation layers (topmost elevation layer first).
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetLocationElevation
    (
    GM_LayerHandle_t32      aLayer,     // IN: Layer to get elevation from or NULL for topmost
    double                  aXCoord,    // IN: X coord in current projection
    double                  aYCoord,    // IN: Y coord in current projection
    float*                  aElev       // OUT: Elevation at location in meters
    );

// Retrieves the color at a given pixel location in the provided layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetPixelColor
    (
    GM_LayerHandle_t32      aLayer,     // IN: Layer to get color from
    sint32                  aRow,       // IN: Y coord of pixel (0 is topmost)
    sint32                  aCol,       // IN: X coord of pixel (0 is leftmost)
    GM_Color_t*             aColor      // OUT: Color of pixel at location    
    );

// Retrieves an entire row of color values from the provided layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetPixelColorRow
    (
    GM_LayerHandle_t32      aLayer,     // IN: Layer to get color from
    sint32                  aRow,       // IN: Y coord of pixel (0 is topmost)
    COLORREF*               aColorRow,  // OUT: Buffer to hold color values
    COLORREF                aInvalidVal // IN: Value to use for invalid pixels
    );

// Retrieves the elevation at a given pixel location in the provided layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetPixelElevation
    (
    GM_LayerHandle_t32      aLayer,     // IN: Layer to get elevation from
    sint32                  aRow,       // IN: Y coord of pixel (0 is topmost)
    sint32                  aCol,       // IN: X coord of pixel (0 is leftmost)
    float*                  aElev       // OUT: Elevation at location in meters
    );

// Retrieves an entire row of elevation values from the provided layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetPixelElevationRow
    (
    GM_LayerHandle_t32      aLayer,     // IN: Layer to get elevation from
    sint32                  aRow,       // IN: Y coord of pixel (0 is topmost)
    float*                  aElevRow,   // OUT: Buffer to hold elevation values for row in meters
    float                   aInvalidVal // IN: Value to use for invalid samples (i.e. -9999.9)
    );

/*--------------------------------------------------------------------
                     VECTOR LAYER QUERY FUNCTIONS
--------------------------------------------------------------------*/

// Finds the address closest to the search location
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_FindNearestAddress
    (
    const GM_Point_t*       aSearchPt,          // IN: Search location in current view projection (as returned by GM_SetProjection)
    GM_LayerHandle_t32*     aLayerList,         // IN: List of layers to search or NULL for all vector layers
    uint32                  aLayerCount,        // IN: Number of layers in list (0 for all)
    char*                   aAddressStr,        // I/O: Buffer to hold string for nearest address
    uint32                  aMaxAddressLen,     // IN: Maximum length of string to store in output
    double                  aMaxDistMeters,     // IN: Maximum distance in meters to search around search point
    void*                   aReserved           // IN: Reserved for later use, must be NULL (0)
    );

// Finds features within so many pixels of a given pixel location.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_FindNearestFeatures
    (
    const GM_Point_t*       aPixelSearchPt,     // IN: Search location in pixel coordinates
    GM_LayerHandle_t32*     aLayerList,         // IN: List of layers to search or NULL for all vector layers
    uint32                  aLayerCount,        // IN: Number of layers in list (0 for all)
    GM_FindFlags_t32        aFindFlags,         // IN: Flags controlling how the find is performed
    const GM_Rectangle_t*   aWorldBounds,       // IN: World bounds for search space or NULL for last drawn
    const GM_PixelRect_t*   aPixelRect,         // IN: Pixel bounds for search space or NULL for last drawn 
    GM_FoundFeature_t*      aNearestFeatures,   // OUT: List of nearest features
    uint32                  aMaxFeatures,       // IN: Max number of nearest features to find
    uint32*                 aFoundFeatureCnt,   // OUT: Number of nearest features returned in list
    uint32                  aMaxDistPixels      // IN: Max distance in pixels to search
    );

// Frees the resources used by the given area feature
GM_DLL_EXPORTED void __stdcall GM_FreeAreaFeature
    (
    GM_AreaFeature_t*   aAreaFeature            // Area feature to free
    );

// Frees the resources used by the given line feature
GM_DLL_EXPORTED void __stdcall GM_FreeLineFeature
    (
    GM_LineFeature_t*   aLineFeature            // Line feature to free
    );

// Frees the resources used by the given point feature
GM_DLL_EXPORTED void __stdcall GM_FreePointFeature
    (
    GM_PointFeature_t*  aPointFeature           // Point feature to free
    );

// Retrieves the area feature at the given index from the layer
GM_DLL_EXPORTED GM_AreaFeature_t* __stdcall GM_GetAreaFeature
    (
    GM_LayerHandle_t32  aLayer,                 // Layer to get area from
    uint32              aAreaIndex              // Index of area feature to retrieve
    );

// Retrieves the area feature at the given index from the layer
GM_DLL_EXPORTED GM_AreaFeature_t* __stdcall GM_GetAreaFeatureEx
    (
    GM_LayerHandle_t32      aLayer,             // Layer to get area from
    uint32                  aAreaIndex,         // Index of area feature to retrieve
    GM_GetFeatureFlags_t32  aFlags,             // Flags for getting feature
    void*                   aReserved           // Reserved for future use, must be 0
    );

// Retrieves the line at the given index from the layer
GM_DLL_EXPORTED GM_LineFeature_t* __stdcall GM_GetLineFeature
    (
    GM_LayerHandle_t32  aLayer,                 // Layer to get line from
    uint32              aLineIndex              // Index of line feature to retrieve
    );

// Retrieves the line at the given index from the layer
GM_DLL_EXPORTED GM_LineFeature_t* __stdcall GM_GetLineFeatureEx
    (
    GM_LayerHandle_t32      aLayer,             // Layer to get line from
    uint32                  aLineIndex,         // Index of line feature to retrieve
    GM_GetFeatureFlags_t32  aFlags,             // Flags for getting feature
    void*                   aReserved           // Reserved for future use, must be 0
    );

// Retrieves the point feature at the given index from the layer
GM_DLL_EXPORTED GM_PointFeature_t* __stdcall GM_GetPointFeature
    (
    GM_LayerHandle_t32  aLayer,                 // Layer to get point from
    uint32              aPointIndex             // Index of point feature to retrieve
    );

// Retrieves the point feature at the given index from the layer
GM_DLL_EXPORTED GM_PointFeature_t* __stdcall GM_GetPointFeatureEx
    (
    GM_LayerHandle_t32      aLayer,             // Layer to get point from
    uint32                  aPointIndex,        // Index of point feature to retrieve
    GM_GetFeatureFlags_t32  aFlags,             // Flags for getting feature
    void*                   aReserved           // Reserved for future use, must be 0
    );

/*--------------------------------------------------------------------
                    VECTOR LAYER EDIT FUNCTIONS
--------------------------------------------------------------------*/

// Changes the delete status of the area, line, or point feature at the given 
// index in the layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_DeleteFeature
    (
    GM_LayerHandle_t32      aLayer,             // IN: Layer the point is in
    GM_FeatureClassType_t8  aFeatureClassType,  // IN: Type of feature class (area, point, line)
    uint32                  aFeatureIndex,      // IN: Index of feature in layer
    boolean                 aDelete             // IN: Use TRUE to mark as deleted, FALSE to clear delete flag
    );

// Queries the delete status of the area, line, or point feature at the given 
// index in the layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_IsFeatureDeleted
    (
    GM_LayerHandle_t32      aLayer,             // IN: Layer the point is in
    GM_FeatureClassType_t8  aFeatureClassType,  // IN: Type of feature class (area, point, line)
    uint32                  aFeatureIndex,      // IN: Index of feature in layer
    boolean*                aIsDeleted          // OUT: Returns TRUE if marked as deleted, FALSE if not
    );

// Sets the list of point locations to use for a given area feature
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetAreaFeaturePointList
    (
    GM_LayerHandle_t32      aLayer,             // Layer the area is in
    uint32                  aAreaIndex,         // Index of area in layer
    uint32                  aHoleIndex,         // Index of hole to apply locations to (0 for main parent area, 1 for first hole, etc.)
    const GM_Point_t*       aPointList,         // New list of points for area
    uint32                  aPointCount,        // Number of points in list (must be >= 3)
    boolean                 aPosInLayerCoords   // Are the position in the layer coordinate system or the current coordinate system?
    );

// Sets the list of point locations to use for a given area feature, including per-vertex elevations.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetAreaFeaturePointListEx
    (
    GM_LayerHandle_t32      aLayer,             // Layer the area is in
    uint32                  aAreaIndex,         // Index of area in layer
    uint32                  aHoleIndex,         // Index of hole to apply locations to (0 for main parent area, 1 for first hole, etc.)
    const GM_Point_t*       aPointList,         // New list of points for area
    uint32                  aPointCount,        // Number of points in list (must be >= 3)
    boolean                 aPosInLayerCoords,  // Are the position in the layer coordinate system or the current coordinate system?
    const float*            aElevList           // IN: Per-vertex elevations for area feature, or NULL for none
    );

// Sets the list of attribute/values to use for the specified feature.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetFeatureAttrList
    (
    GM_LayerHandle_t32      aLayer,             // IN: Layer the feature is in
    GM_FeatureClassType_t8  aFeatureClassType,  // IN: Type of feature class (area, point, line)
    uint32                  aFeatureIndex,      // IN: Index of feature in layer
    const GM_AttrValue_t*   aAttrList,          // IN: New list of attributes to associate with feature
    uint16                  aNumAttrs           // IN: Number of attributes in aAttrList
    );

// Sets the classification to use for the given feature.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetFeatureClass
    (
    GM_LayerHandle_t32      aLayer,             // IN: Layer the feature is in
    GM_FeatureClassType_t8  aFeatureClassType,  // IN: Type of feature class (area, point, line)
    uint32                  aFeatureIndex,      // IN: Index of feature in layer
    FeatureClass_t16        aFeatureClass       // IN: New feature class to assign to feature
    );

// Sets the display label to use for the feature.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetFeatureLabel
    (
    GM_LayerHandle_t32      aLayer,             // IN: Layer the feature is in
    GM_FeatureClassType_t8  aFeatureClassType,  // IN: Type of feature class (area, point, line)
    uint32                  aFeatureIndex,      // IN: Index of feature in layer
    const char*             aLabel              // IN: New display label for feature.
    );

// Sets the description for the layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLayerDescription
    (
    GM_LayerHandle_t32  aLayer,         // layer to set description for
    const char*         aDesc           // description to use (pass NULL to restore default)
    );

// Sets the name of the attribute to use for retrieving the elevation value of
// features within this layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLayerElevationAttribute
    (
    GM_LayerHandle_t32      aLayer,             // Layer to modify
    const char*             aAttrName,          // Name of attribute to use for elevations
    uint32                  aReserved           // Reserved value for future expansion (must be zero)
    );

// Sets the elevation units to use for 3D vector features without an elevation unit in the elevation attribute
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLayerElevationUnits
    (
    GM_LayerHandle_t32      aLayer,             // Layer to modify
    GM_ElevUnits_t8         aElevUnits          // Elevation units to interpret values as
    );

// Sets the name of the attribute to use for setting the display label of
// features within this layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLayerLabelAttribute
    (
    GM_LayerHandle_t32      aLayer,             // Layer to modify labels for
    const char*             aAttrName,          // Name of attribute to use for naming labels
    uint32                  aReserved           // Reserved value for future expansion (must be zero)
    );

// Sets the user data for the layer.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLayerUserData
    (
    GM_LayerHandle_t32  aLayer,         // layer to set user data for
    void*               aUserData       // user data pointer/value to associate with layer
    );

// Sets the list of point locations to use for a given line feature
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLineFeaturePointList
    (
    GM_LayerHandle_t32      aLayer,             // Layer the line is in
    uint32                  aLineIndex,         // Index of line in layer
    const GM_Point_t*       aPointList,         // New list of points for line
    uint32                  aPointCount,        // Number of points in list (must be >= 2)
    boolean                 aPosInLayerCoords   // Are the position in the layer coordinate system or the current coordinate system?
    );

// Sets the list of point locations to use for a given line feature, including elevation list.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLineFeaturePointListEx
    (
    GM_LayerHandle_t32      aLayer,             // Layer the line is in
    uint32                  aLineIndex,         // Index of line in layer
    const GM_Point_t*       aPointList,         // New list of points for line
    uint32                  aPointCount,        // Number of points in list (must be >= 2)
    boolean                 aPosInLayerCoords,  // Are the position in the layer coordinate system or the current coordinate system?
    const float*            aElevList           // IN: List of per-vertex elevations. Use NULL if no elevation list
    );

// Sets the location to use for a given point feature
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetPointFeaturePosition
    (
    GM_LayerHandle_t32      aLayer,             // Layer the point is in
    uint32                  aPointIndex,        // Index of point in layer
    const GM_Point_t*       aPosition,          // New location of point
    boolean                 aPosInLayerCoords   // Is the position in the layer coordinate system or the current coordinate system?
    );

/*--------------------------------------------------------------------
                   VECTOR DRAWING STYLE/TYPE FUNCTIONS
--------------------------------------------------------------------*/

// Adds a new custom area classification.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomAreaClass
    (
    const char*             aName,              // IN: Custom type name
    const GM_AreaStyle_t*   aStyle,             // IN: Default draw style for features of this type
    AreaFeatureClass_t16*   aFeatureCode        // OUT: Classification code for new type
    );

// Adds a new custom brush style that can be used when drawing area features
// (see the GM_SetAreaFeatureDrawStyle function)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomBrushStyle
    (
    const char*             aImageFilename,     // IN: Full path to image filename to use for custom fill pattern
    const char*             aStyleName,         // IN: Text name to use when referring to the fill style
    GM_BrushStyle_t16*      aStyleVal           // OUT: Value of created custom fill style
    );

// Adds a new custom line classification.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomLineClass
    (
    const char*             aName,              // IN: Custom type name
    const GM_LineStyle_t*   aStyle,             // IN: Default draw style for features of this type
    LineFeatureClass_t16*   aFeatureCode        // OUT: Classification code for new type
    );

// Adds a new custom point classification.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomPointClass
    (
    const char*             aName,              // IN: Custom type name
    const GM_PointStyle_t*  aStyle,             // IN: Default draw style for features of this type
    PointFeatureClass_t16*  aFeatureCode        // OUT: Classification code for new type
    );

// Adds a new custom symbol that can be used when drawing point features
// (see the GM_SetPointFeatureDrawStyle function)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddCustomSymbol
    (
    const char* aSymbolFilename,                // Full path to symbol file (BMP or ICO)
    const char* aSymbolName                     // Text name to use when referring to the symbol
    );

// Sets the default drawing style to use for a given area feature classification
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetAreaFeatureClassDrawStyle
    (
    AreaFeatureClass_t16    aFeatureClass,      // IN: Feature class to get draw style for
    GM_AreaStyle_t*         aAreaStyle          // OUT: Current draw style for area classification
    );

// Returns the list of available symbol names
GM_DLL_EXPORTED char** __stdcall GM_GetAvailableSymbolNames
    (
    uint32* aNumSymbols                         // OUT: Number of symbols in returned list
    );

// Sets the default drawing style to use for a given line feature classification
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetLineFeatureClassDrawStyle
    (
    LineFeatureClass_t16    aFeatureClass,      // IN: Feature class to get draw style for
    GM_LineStyle_t*         aLineStyle          // OUT: Current draw style for line classification
    );

// Sets the default drawing style to use for a given point feature classification
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetPointFeatureClassDrawStyle
    (
    PointFeatureClass_t16   aFeatureClass,      // IN: Feature class to get draw style for
    GM_PointStyle_t*        aPointStyle         // OUT: Current draw style for point classification
    );

// Removes a custom symbol
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_RemoveCustomSymbol
    (
    const char* aSymbolName                     // IN: Text name to use when referring to the symbol
    );

// Displays a dialog allowing the user to graphically select an area style (not available on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SelectAreaStyle
    (
    GM_AreaStyle_t* aAreaStyle                  // IN/OUT: Area style buffer - make sure to initialize before passing in
    );

// Displays a dialog allowing the user to graphically select a font (not available on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SelectFont
    (
    GM_FontDef_t*   aFontDef                    // IN/OUT: Font buffer - make sure to initialize before passing in
    );

// Displays a dialog allowing the user to graphically select a line style (not available on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SelectLineStyle
    (
    GM_LineStyle_t* aLineStyle                  // IN/OUT: Line style buffer - make sure to initialize before passing in
    );

// Sets the default drawing style to use for a given area feature classification
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetAreaFeatureClassDrawStyle
    (
    AreaFeatureClass_t16    aFeatureClass,      // IN: Feature class to set draw style for
    const GM_AreaStyle_t*   aAreaStyle          // IN: New style to use for area class (NULL to reset to default)
    );

// Sets the drawing style to use for a given area feature
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetAreaFeatureDrawStyle
    (
    GM_LayerHandle_t32      aLayer,             // Layer the area is in
    uint32                  aAreaIndex,         // Index of area in layer
    const GM_AreaStyle_t*   aAreaStyle          // New style to use for area
    );

// Sets the default drawing style to use for a given line feature classification
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLineFeatureClassDrawStyle
    (
    LineFeatureClass_t16    aFeatureClass,      // IN: Feature class to set draw style for
    const GM_LineStyle_t*   aLineStyle          // IN: New style to use for line class (NULL to reset to default)
    );

// Sets the drawing style to use for a given line feature
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetLineFeatureDrawStyle
    (
    GM_LayerHandle_t32      aLayer,             // Layer the line is in
    uint32                  aLineIndex,         // Index of line in layer
    const GM_LineStyle_t*   aLineStyle          // New style to use for line
    );

// Sets the default drawing style to use for a given point feature classification
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetPointFeatureClassDrawStyle
    (
    PointFeatureClass_t16   aFeatureClass,      // IN: Feature class to set draw style for
    const GM_PointStyle_t*  aPointStyle         // IN: New style to use for point class (NULL to reset to default)
    );

// Sets the drawing style to use for a given point feature
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetPointFeatureDrawStyle
    (
    GM_LayerHandle_t32      aLayer,             // Layer the point is in
    uint32                  aPointIndex,        // Index of point in layer
    const GM_PointStyle_t*  aPointStyle         // New style to use for point
    );

/*--------------------------------------------------------------------
                 VECTOR FEATURE FILTERING FUNCTIONS
--------------------------------------------------------------------*/

// Retrieves information about a given feature class
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetFeatureClassInfo
    (
    FeatureClass_t16        aFeatureClass,      // IN: Feature class to get info for
    GM_FeatureClassType_t8  aFeatureClassType,  // IN: Type of feature class (area, point, line)
    GM_FeatureClassInfo_t*  aFeatureClassInfo   // OUT: Info about the feature class
    );

// Enables or disables the display of the given feature class. The previous
// enable/disable state is returned.
GM_DLL_EXPORTED boolean __stdcall GM_SetFeatureClassEnabled
    (
    FeatureClass_t16        aFeatureClass,      // IN: Feature class to get info for
    GM_FeatureClassType_t8  aFeatureClassType,  // IN: Type of feature class (area, point, line)
    boolean                 aEnable             // IN: Enable or disable the feature class
    );

/*--------------------------------------------------------------------
                     SURFACE ANALYSIS FUNCTIONS
--------------------------------------------------------------------*/

// Calculate the elevation statistics within a given area
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcAreaElevStats
    (
    GM_LayerHandle_t32*         aLayerList,     // IN: List of layers to use or NULL for all
    uint32                      aLayerCount,    // IN: Number of layers in list (0 for all)
    GM_AreaElevStats_t*         aElevStats,     // OUT: Calculated area statistics
    const GM_Point_t*           aAreaPoints,    // IN: List of points in area in global coordinate system
    uint32                      aNumPoints,     // IN: Number of points in aAreaPoints
    double                      aXSpacing,      // IN: Sample spacing in the x direction in global units (use 0.0 to get a good default)
    double                      aYSpacing,      // IN: Sample spacing in the y direction in global units (use 0.0 to get a good default)
    void*                       aReserved       // IN: Reserved for future use, must be NULL
    );

// Performs a view-shed analysis on loaded elevation data (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcViewShed
    (
    GM_LayerHandle_t32          aLayer,         // IN: Layer to get elevations from or NULL for topmost layer at each point
    const GM_ViewShedParams_t*  aViewShedParms, // IN: Parameters for creating view shed
    GM_LayerHandle_t32*         aViewShedLayer  // OUT: Created view shed layer
    );

// Calculates the cut-and-fill volumes along a given line (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcVolumeAlongLine
    (
    GM_LayerHandle_t32              aLayer,         // IN: Layer to get elevations from or NULL for topmost layer at each point
    const GM_LineVolumeParams_t*    aVolumeParms,   // IN: Parameters for line volume calculation
    double*                         aCutVolume,     // OUT: Cut volume in cubic meters
    double*                         aFillVolume     // OUT: Fill volume in cubic meters
    );

// Calculates the cut-and-fill volumes within a given area (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CalcVolumeOfArea
    (
    GM_LayerHandle_t32              aLayer,         // IN: Layer to get elevations from or NULL for topmost layer at each point
    const GM_AreaVolumeParams_t*    aVolumeParms,   // IN: Parameters for area volume calculation
    double*                         aCutVolume,     // OUT: Cut volume in cubic meters
    double*                         aFillVolume     // OUT: Fill volume in cubic meters
    );

// Generates contours for the given layer(s) (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GenerateContours
    (
    GM_LayerHandle_t32          aLayer,         // IN: Layer to get elevations from or NULL for topmost layer at each point
    const GM_ContourParams_t*   aContourParms,  // IN: Parameters for generating contours
    GM_LayerHandle_t32*         aContourLayer   // OUT: Created view shed layer
    );

// Generates contours for the given layer(s) (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GenerateContoursEx
    (
    GM_LayerHandle_t32*         aLayerList,     // IN: List of layers to use or NULL for all
    uint32                      aLayerCount,    // IN: Number of layers in list (0 for all)
    const GM_ContourParams_t*   aContourParms,  // IN: Parameters for generating contours
    GM_LayerHandle_t32*         aContourLayer   // OUT: Created view shed layer
    );

// Generates an elevation grid by triangulating and gridding 3D vector layers (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GenerateElevationGrid
    (
    GM_LayerHandle_t32*         aLayerList,     // IN: List of layers to use or NULL for all
    uint32                      aLayerCount,    // IN: Number of layers in list (0 for all)
    const GM_GridGenSetup_t*    aGridSetup,     // IN: Grid setup parameters (pass NULL for default options)
    GM_LayerHandle_t32*         aGridLayer,     // OUT: Created grid layer
    GM_LayerHandle_t32*         aTinLayer       // OUT: Created TIN area layer (optional, set to NULL if you don't want)
    );

// Retrieves a list of elevations along a path in the provided layer or from
// the list of currently loaded elevation layers (topmost elevation layer first).
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetPathProfile
    (
    GM_LayerHandle_t32      aLayer,     // IN: Layer to get elevation from or NULL for topmost
    double                  aStartX,    // IN: Start X coord in current projection
    double                  aStartY,    // IN: Start Y coord in current projection
    double                  aEndX,      // IN: End X coord in current projection
    double                  aEndY,      // IN: End Y coord in current projection
    float*                  aElevList,  // OUT: Buffer to hold list of elevations
    uint32                  aListSize,  // IN: Number of elevations to retrieve
    float                   aDfltElev   // IN: Elev to use when none could be found
    );

// Retrieves a list of elevations along a path in the provided layer or from
// the list of currently loaded elevation layers (topmost elevation layer first).
// Can also perform a line-of-sight calculation and return additional information
// about a 3D path.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetPathProfileLOS
    (
    GM_LayerHandle_t32          aLayer, // IN: Layer to get elevation from or NULL for topmost
    GM_PathProfileLOSParams_t*  aParams // IN/OUT: Calculation parameters
    );

// Retrieves a list of elevations along a path in the provided layer list or from
// the list of currently loaded elevation layers (topmost elevation layer first).
// Can also perform a line-of-sight calculation and return additional information
// about a 3D path.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_GetPathProfileLOSEx
    (
    GM_LayerHandle_t32*         aLayerList,     // IN: List of layers to get elevation from or NULL for topmost
    uint32                      aLayerCount,    // IN: Number of layers in list
    GM_PathProfileLOSParams_t*  aParams         // IN/OUT: Calculation parameters
    );

/*--------------------------------------------------------------------
                        MAP CATALOG FUNCTIONS
--------------------------------------------------------------------*/

// Adds a new map to the map catalog from a file on disk
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_MapCatalogAddFile
    (
    GM_LayerHandle_t32      aCatalogLayer,  // IN: Handle to map catalog layer (either from loading or GM_CreateMapCatalog)
    const char*             aFilename       // IN: Filename of map to add to the catalog
    );

// Adds a new map to the map catalog from a loaded layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_MapCatalogAddLayer
    (
    GM_LayerHandle_t32      aCatalogLayer,  // IN: Handle to map catalog layer (either from loading or GM_CreateMapCatalog)
    GM_LayerHandle_t32      aMapLayer       // IN: Handle of loaded map layer to add to the catalog
    );

// Creates a new map catalog layer for adding map layers to
GM_DLL_EXPORTED GM_LayerHandle_t32 __stdcall GM_MapCatalogCreate
    (
    const char*             aDescription,   // IN: Description to use for layer (can be NULL to use default)
    const GM_Projection_t*  aProj           // IN: Native projection of new layer (NULL for Geographic/WGS84/Arc Degrees)
    );

// Retrieves information and statistics about the catalog (use GM_GetLayerInfo for generic information)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_MapCatalogGetInfo
    (
    GM_LayerHandle_t32      aCatalogLayer,  // IN: Handle to map catalog layer (either from loading or GM_CreateMapCatalog)
    GM_MapCatalogInfo_t*    aCatalogInfo    // OUT: Structure holding catalog information
    );

// Retrieves information about a map in a catalog (use GM_GetMapCatalogInfo to get the map count)
GM_DLL_EXPORTED const GM_LayerInfo_t* __stdcall GM_MapCatalogGetMapInfo
    (
    GM_LayerHandle_t32      aCatalogLayer,  // IN: Handle to map catalog layer (either from loading or GM_CreateMapCatalog)
    uint32                  aMapIndex       // IN: Index of map (0-based) to get info about
    );

// Removes the map at the given index from the catalog
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_MapCatalogRemoveMap
    (
    GM_LayerHandle_t32      aCatalogLayer,  // IN: Handle to map catalog layer (either from loading or GM_CreateMapCatalog)
    uint32                  aMapIndex       // IN: Index of map (0-based) to remove from map catalog
    );

// Saves a map catalog layer to a file on disk
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_MapCatalogSave
    (
    GM_LayerHandle_t32      aCatalogLayer,  // IN: Handle to map catalog layer (either from loading or GM_CreateMapCatalog)
    const char*             aFilename       // IN: Filename to save map catalog to
    );

// Sets when the layers in a map catalog should be displayed
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_MapCatalogSetDisplayInfo
    (
    GM_LayerHandle_t32          aCatalogLayer,  // IN: Handle to map catalog layer (either from loading or GM_CreateMapCatalog)
    GM_MapCatalogDisplayType_t8 aDisplayType,   // IN: Controls when layers in catalog are displayed
    double                      aDisplayValue,  // IN: First value related to display type
    double                      aDisplayValue2, // IN: Optional second value for range of scales (use 0.0 if doesn't apply)
    boolean                     aHideBounds     // IN: Hide layer bounds when not drawing a layer?
    );

/*--------------------------------------------------------------------
              CUSTOM LAYER AND FEATURE CREATION FUNCTIONS
--------------------------------------------------------------------*/

// Adds an area feature to a loaded vector layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddAreaToVectorLayer
    (
    GM_LayerHandle_t32      aLayer,             // IN: Layer to add area to
    const GM_AreaFeature_t* aArea,              // IN: Area feature to add
    GM_AddFeatureFlags_t8   aFlags              // IN: Flags controlling the add
    );

// Adds a line feature to a loaded vector layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddLineToVectorLayer
    (
    GM_LayerHandle_t32      aLayer,             // IN: Layer to add line to
    const GM_LineFeature_t* aLine,              // IN: Line feature to add
    GM_AddFeatureFlags_t8   aFlags              // IN: Flags controlling the add
    );

// Adds a point feature to a loaded vector layer
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_AddPointToVectorLayer
    (
    GM_LayerHandle_t32          aLayer,         // IN: Layer to add point to
    const GM_PointFeature_t*    aPoint,         // IN: Point feature to add
    GM_AddFeatureFlags_t8       aFlags          // IN: Flags controlling the add
    );

// Combines the list of areas and adds them to the specified layer (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CombineAreas 
    (
    const GM_AreaFeature_t**    aAreaList,      // IN: List of areas to combine
    uint32                      aNumAreas,      // IN: Number of areas in aAreaList
    const GM_Projection_t*      aAreaProj,      // IN: Projection system the area coordinates are in (use NULL for current projection)
    GM_LayerHandle_t32          aNewAreaLayer   // IN: Layer to add new combined areas to
    );

// Create a buffer area some distance around the specified feature (not implemented on WinCE)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CreateBufferArea
    (
    GM_LayerHandle_t32      aFeatureLayer,      // IN: Layer the feature is in
    GM_FeatureClassType_t8  aFeatureClassType,  // IN: Type of feature class (area, point, line)
    uint32                  aFeatureIndex,      // IN: Index of feature in layer
    double                  aBufferDistance,    // IN: Distance in meters of buffer to create (use negative values to create a buffer inside an area feature)
    GM_LayerHandle_t32      aBufferLayer        // IN: Layer to add new buffer area(s) to
    );

// Creates a new custom layer for an in-memory elevation grid (not implemented on WinCE)
GM_DLL_EXPORTED GM_LayerHandle_t32 __stdcall GM_CreateCustomElevGridLayer
    (
    const char*             aDescription,       // IN: Description to use for layer (can be NULL to use default)
    const GM_Projection_t*  aProj,              // IN: Native projection of new layer
    const GM_Point_t*       aTopLeft,           // IN: Ground coordinates of top left sample
    double                  aXSampleSize,       // IN: Size of each grid cell in the x direction
    double                  aYSampleSize,       // IN: Size of each grid cell in the y direction
    sint32                  aNumSamplesX,       // IN: Number of samples in the x direction
    sint32                  aNumSamplesY,       // IN: Number of samples in the y direction
    const void*             aElevGrid,          // IN: Grid of elevation values in row-major order
    GM_GridLayout_t8        aGridLayout,        // IN: Layout of elevation grid
    float                   aNoDataValue        // IN: Value of samples for which the value isn't known (i.e. -9999.9)
    );

// Creates a new custom layer for an in-memory raster grid (not implemented on WinCE)
GM_DLL_EXPORTED GM_LayerHandle_t32 __stdcall GM_CreateCustomRasterLayer
    (
    const char*                 aDescription,       // IN: Description to use for layer (can be NULL to use default)
    const GM_Projection_t*      aProj,              // IN: Native projection of new layer
    const GM_RasterLayout_t*    aRasterLayout,      // IN: Raster layer layout
    const void*                 aDataBuf            // IN: Grid of raster data values in row-major order
    );

// Creates a new custom layer for adding vector features to
GM_DLL_EXPORTED GM_LayerHandle_t32 __stdcall GM_CreateCustomVectorLayer
    (
    const char*             aDescription,       // IN: Description to use for layer (can be NULL to use default)
    const GM_Projection_t*  aProj               // IN: Native projection of new layer
    );

/*--------------------------------------------------------------------
                         UTILITY FUNCTIONS
--------------------------------------------------------------------*/

// Create a S-63 user permit file for use by clients to request
// encrypted S-63 chart files from data providers for loading 
// with Global Mapper or your Global Mapper SDK-based application.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_CreateS63UserPermitFile
    (
    const char* aFilename   // IN: Name of user permit file to create
    );

// Returns a string containing the filter to use in a Windows file open
// dialog box for all of the types supported for loading from this DLL.
GM_DLL_EXPORTED const char* __stdcall GM_GetFilterString
    (
    void
    );

// Returns the date that this SDK was built. Use this to provide more resolution
// for beta releases than GM_GetSDKVersion provides.
GM_DLL_EXPORTED time_t __stdcall GM_GetSDKBuildDate
    (
    void
    );

// Returns the version of this SDK. The version is obtained by taking the
// major version number times 100 and adding the minor version number. For
// example, version 1.04 would be returned as 104.
GM_DLL_EXPORTED uint32 __stdcall GM_GetSDKVersion
    (
    void
    );

// Returns TRUE if the current user is registered or currently using a demo
// license.
GM_DLL_EXPORTED boolean __stdcall GM_IsRegistered
    (
    void
    );

// Displays a file dialog that allows the user to select a file to load.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SelectFile
    ( 
    char*       aFilename,  // buffer in which to place selected filename (must be at least _MAX_PATH characters in length)
    const char* aFilterStr, // filter string for open dialog (NULL for default)
    const char* aInitialDir,// initial directory to start in (NULL for current)
    HWND        aParentWnd  // handle to parent window for file selection dialog
    );

// Sets the amount of available memory below which loads should fail and return (GM_Error_LowMemory).
// Set to zero to reset to no memory limit checking. [WinCE only]
GM_DLL_EXPORTED void __stdcall GM_SetMemoryLimit
    (
    uint32      aMemoryLimit
    );

// Sets the function to call to display error and warning messages generated
// during SDK operations. If a message callback is provided, a message
// dialog will not be shown, instead the callback function will be called
// with the error or warning message that would have been displayed.
GM_DLL_EXPORTED void __stdcall GM_SetMessageCallback
    (
    GM_MessageCallbackFunc aCallbackFunc
    );

// Sets an advanced/miscellaneous option to use during operation. Returns the previous value.
GM_DLL_EXPORTED uint8 __stdcall GM_SetMiscOption
    (
    GM_MiscOpt_t32  aOpt,       // IN: Option to set
    uint8           aNewValue   // IN: New value (i.e. 1 to enable or 0 to disable), or value of other setting
    );

// Sets the function to call to report the progress of an operation, like
// the loading of a file. If a progress callback is provided, a progress
// dialog will not be shown, instead the callback function will be called.
GM_DLL_EXPORTED void __stdcall GM_SetProgressCallback
    (
    GM_ProgressCallbackFunc aCallbackFunc
    );

// Sets the QuickPDF library (http://www.quickpdflibrary.com/) unlock code (required for PDF/GeoPDF support)
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetQuickPDFUnlockCode
    (
    const char* aUnlockCode // IN: unlock key for QuickPDFDLL library
    );

// Sets the registration name and code to use for this instance of the DLL.
// This can be used rather than the GMDLL_regkey.txt file to supply the
// registration information. Will return GM_Error_NotRegistered if the key
// is not valid for the name.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetRegistrationInfo
    (
    const char* aRegName,   // name provided for the registration information
    uint32      aRegKey     // registration key
    );

// Sets the base registry key from which settings should be stored/read. Settings
// will be stored in and read from "HKEY_CURRENT_USER\Software\<aKeyName>\Global Mapper".
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetRegistryKey
    (
    const char* aKeyName    // location in registry under which to store settings
    );

// Sets the path where to store settings files, like custom_datums.txt, etc.
GM_DLL_EXPORTED GM_Error_t32 __stdcall GM_SetSettingsFilePath
    (
    const char* aPathName   // full path in which to look for and store settings files
    );

// Restore structure alignment to its old value
#pragma pack( pop )

#ifdef __cplusplus
}
#endif

#endif // end of file GlobalMaperInterface.h
