CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Static Public Member Functions | List of all members
CartoType::CFrameworkMapDataSet Class Reference

#include <cartotype_framework.h>

Public Member Functions

 CFrameworkMapDataSet (std::shared_ptr< CFrameworkEngine > aEngine, std::unique_ptr< CMapDataBase > aDb)
 
std::unique_ptr< CFrameworkMapDataSetCopy (TResult &aError, std::shared_ptr< CFrameworkEngine > aEngine, bool aFull=true)
 
TResult LoadMapData (const CString &aMapFileName, const std::string *aEncryptionKey, bool aMapOverlaps)
 
TResult LoadMapData (std::unique_ptr< CMapDataBase > aDb)
 
TResult UnloadMapByHandle (uint32_t aHandle)
 
uint32_t GetLastMapHandle () const
 
TResult CreateWritableMap (TWritableMapType aType, CString aFileName=nullptr)
 
TResult SaveMap (uint32_t aHandle, const CString &aFileName, TFileType aFileType)
 
TResult ReadMap (uint32_t aHandle, const CString &aFileName, TFileType aFileType)
 
TResult ReadMap (uint32_t aHandle, const std::vector< uint8_t > &aData)
 
bool MapIsEmpty (uint32_t aHandle)
 
std::unique_ptr< CMap > CreateMap (int32_t aViewWidth, int32_t aViewHeight)
 
uint32_t GetMainMapHandle () const
 
uint32_t GetMemoryMapHandle () const
 
size_t MapCount () const
 
uint32_t MapHandle (size_t aIndex) const
 
bool MapIsWritable (size_t aIndex) const
 
std::unique_ptr< CMapMetaDataMapMetaData (size_t aIndex) const
 
std::vector< CStringLayerNames ()
 
TResult InsertMapObject (uint32_t aMapHandle, const CString &aLayerName, const MPath &aGeometry, const CString &aStringAttributes, uint32_t aIntAttribute, uint64_t &aId, bool aReplace)
 
TResult InsertPointMapObject (uint32_t aMapHandle, const CString &aLayerName, TPoint aPoint, const CString &aStringAttributes, uint32_t aIntAttribute, uint64_t &aId, bool aReplace)
 
TResult InsertCircleMapObject (uint32_t aMapHandle, const CString &aLayerName, TPoint aCenter, int32_t aRadius, const CString &aStringAttributes, uint32_t aIntAttribute, uint64_t &aId, bool aReplace)
 
TResult InsertEnvelopeMapObject (uint32_t aMapHandle, const CString &aLayerName, const MPath &aGeometry, int32_t aRadius, const CString &aStringAttributes, uint32_t aIntAttribute, uint64_t &aId, bool aReplace)
 
TResult DeleteMapObjectRange (uint32_t aMapHandle, uint64_t aStartId, uint64_t aEndId, uint64_t &aDeletedCount, CString aCondition=nullptr)
 
TResult DeleteMapObjectArray (uint32_t aMapHandle, const uint64_t *aIdArray, size_t aIdCount, uint64_t &aDeletedCount, CString aCondition=nullptr)
 
TResult DeleteAllMapObjects (uint32_t aMapHandle, uint64_t &aDeletedCount)
 
std::unique_ptr< CMapObjectLoadMapObject (TResult &aError, uint32_t aMapHandle, uint64_t aId)
 
TResult ReadGpx (uint32_t aMapHandle, const CString &aFileName)
 
std::string Proj4Param () const
 
std::shared_ptr< CMapDataBaseArray > MapDataBaseArray () const
 
CMapDataBase & MainDb () const
 
CMapDataBase * GetMapDb (uint32_t aHandle, bool aTolerateNonExistentDb=false)
 

Static Public Member Functions

static std::unique_ptr< CFrameworkMapDataSetNew (TResult &aError, std::shared_ptr< CFrameworkEngine > aEngine, const CString &aMapFileName, const std::string *aEncryptionKey=nullptr, bool aMapOverlaps=true)
 
static std::unique_ptr< CFrameworkMapDataSetNew (TResult &aError, std::shared_ptr< CFrameworkEngine > aEngine, std::unique_ptr< CMapDataBase > aDb)
 

Detailed Description

CFrameworkMapDataSet owns a set of map data used to draw a map. Together with a CFrameworkEngine object it makes up the 'model' part of the model-view-controller pattern.

Constructor & Destructor Documentation

◆ CFrameworkMapDataSet()

CartoType::CFrameworkMapDataSet::CFrameworkMapDataSet ( std::shared_ptr< CFrameworkEngine aEngine,
std::unique_ptr< CMapDataBase >  aDb 
)

Creates a CFrameworkMapDataSet object using a given CFrameworkEngine and map database.

Member Function Documentation

◆ Copy()

std::unique_ptr< CFrameworkMapDataSet > CartoType::CFrameworkMapDataSet::Copy ( TResult aError,
std::shared_ptr< CFrameworkEngine aEngine,
bool  aFull = true 
)

Creates a copy of a map dataset object to access the same set of maps in a thread-safe way. If aFull is false the copy is being made for graphics-accelerated drawing only, and data not needed for that purpose, such as the full-text index, is not loaded.

◆ CreateMap()

std::unique_ptr< CMap > CartoType::CFrameworkMapDataSet::CreateMap ( int32_t  aViewWidth,
int32_t  aViewHeight 
)

Create a CMap object referring to the main database in the CFrameworkMapDataSet. This is an internal function used by CFramework.

◆ CreateWritableMap()

TResult CartoType::CFrameworkMapDataSet::CreateWritableMap ( TWritableMapType  aType,
CString  aFileName = nullptr 
)

Creates a new writable map as part of this map data set.

◆ DeleteAllMapObjects()

TResult CartoType::CFrameworkMapDataSet::DeleteAllMapObjects ( uint32_t  aMapHandle,
uint64_t &  aDeletedCount 
)

Deletes all the map objects in a given writable map.

◆ DeleteMapObjectArray()

TResult CartoType::CFrameworkMapDataSet::DeleteMapObjectArray ( uint32_t  aMapHandle,
const uint64_t *  aIdArray,
size_t  aIdCount,
uint64_t &  aDeletedCount,
CString  aCondition = nullptr 
)

Deletes map objects defined by an array of IDs.

◆ DeleteMapObjectRange()

TResult CartoType::CFrameworkMapDataSet::DeleteMapObjectRange ( uint32_t  aMapHandle,
uint64_t  aStartId,
uint64_t  aEndId,
uint64_t &  aDeletedCount,
CString  aCondition = nullptr 
)

Deletes map objects with IDs in the range aStartId...aEndId inclusive.

The map from which the objects are deleted is identified by aMapHandle. If aMapHandle is zero the in-memory map used for routing is used.

If aCondition is not empty this function deletes objects satisfying aCondition only.

◆ GetLastMapHandle()

uint32_t CartoType::CFrameworkMapDataSet::GetLastMapHandle ( ) const

Get the handle of the map most recently loaded.

◆ GetMainMapHandle()

uint32_t CartoType::CFrameworkMapDataSet::GetMainMapHandle ( ) const

Get the handle of the main map.

◆ GetMapDb()

CMapDataBase * CartoType::CFrameworkMapDataSet::GetMapDb ( uint32_t  aHandle,
bool  aTolerateNonExistentDb = false 
)

Gets a map database by its handle. For internal use only.

◆ GetMemoryMapHandle()

uint32_t CartoType::CFrameworkMapDataSet::GetMemoryMapHandle ( ) const

Get the handle of the in-memory map.

◆ InsertCircleMapObject()

TResult CartoType::CFrameworkMapDataSet::InsertCircleMapObject ( uint32_t  aMapHandle,
const CString aLayerName,
TPoint  aCenter,
int32_t  aRadius,
const CString aStringAttributes,
uint32_t  aIntAttribute,
uint64_t &  aId,
bool  aReplace 
)

Inserts a circle map object. For internal use only.

See also
CFramework::InsertCircleMapObject

◆ InsertEnvelopeMapObject()

TResult CartoType::CFrameworkMapDataSet::InsertEnvelopeMapObject ( uint32_t  aMapHandle,
const CString aLayerName,
const MPath aGeometry,
int32_t  aRadius,
const CString aStringAttributes,
uint32_t  aIntAttribute,
uint64_t &  aId,
bool  aReplace 
)

Inserts a map object that is an envelope around some geometry. For internal use only.

See also
CFramework::InsertEnvelopeMapObject

◆ InsertMapObject()

TResult CartoType::CFrameworkMapDataSet::InsertMapObject ( uint32_t  aMapHandle,
const CString aLayerName,
const MPath aGeometry,
const CString aStringAttributes,
uint32_t  aIntAttribute,
uint64_t &  aId,
bool  aReplace 
)

Inserts a map object into one of the writable maps.

See also
CFramework::InsertMapObject

◆ InsertPointMapObject()

TResult CartoType::CFrameworkMapDataSet::InsertPointMapObject ( uint32_t  aMapHandle,
const CString aLayerName,
TPoint  aPoint,
const CString aStringAttributes,
uint32_t  aIntAttribute,
uint64_t &  aId,
bool  aReplace 
)

Inserts a point map object. For internal use only.

See also
CFramework::InsertPointMapObject

◆ LayerNames()

std::vector< CString > CartoType::CFrameworkMapDataSet::LayerNames ( )

Returns the names of all the layers in the map data.

◆ LoadMapData() [1/2]

TResult CartoType::CFrameworkMapDataSet::LoadMapData ( const CString aMapFileName,
const std::string *  aEncryptionKey,
bool  aMapOverlaps 
)

Loads map data from the file aMapFileName. If the data is encrypted the key must be supplied in aEncryptionKey and its length in aEncryptionKeyLength.

◆ LoadMapData() [2/2]

TResult CartoType::CFrameworkMapDataSet::LoadMapData ( std::unique_ptr< CMapDataBase >  aDb)

Load a map database and take ownership of it.

◆ LoadMapObject()

std::unique_ptr< CMapObject > CartoType::CFrameworkMapDataSet::LoadMapObject ( TResult aError,
uint32_t  aMapHandle,
uint64_t  aId 
)

Loads a map object from a given map, specified by its ID.

◆ MainDb()

CMapDataBase & CartoType::CFrameworkMapDataSet::MainDb ( ) const

Returns the main map database. For internal use only.

◆ MapCount()

size_t CartoType::CFrameworkMapDataSet::MapCount ( ) const

Returns the number of maps currently loaded, including the main map and the in-memory map.

◆ MapDataBaseArray()

std::shared_ptr< CMapDataBaseArray > CartoType::CFrameworkMapDataSet::MapDataBaseArray ( ) const
inline

Returns the map database array. For internal use only.

◆ MapHandle()

uint32_t CartoType::CFrameworkMapDataSet::MapHandle ( size_t  aIndex) const

Returns the handle of one of the currently loaded maps. Returns 0 if aIndex is out of range.

◆ MapIsEmpty()

bool CartoType::CFrameworkMapDataSet::MapIsEmpty ( uint32_t  aHandle)

Returns true if the map identified by aHandle is empty. A handle of zero refers to the in-memory map.

◆ MapIsWritable()

bool CartoType::CFrameworkMapDataSet::MapIsWritable ( size_t  aIndex) const

Returns true if a map, identified by its index, is writable.

◆ MapMetaData()

std::unique_ptr< CMapMetaData > CartoType::CFrameworkMapDataSet::MapMetaData ( size_t  aIndex) const

Returns the metadata for a map, identified by its index, if available. Returns null if no metadata is available. Metadata is currently available only for CTM1 maps.

◆ New() [1/2]

std::unique_ptr< CFrameworkMapDataSet > CartoType::CFrameworkMapDataSet::New ( TResult aError,
std::shared_ptr< CFrameworkEngine aEngine,
const CString aMapFileName,
const std::string *  aEncryptionKey = nullptr,
bool  aMapOverlaps = true 
)
static

Creates a CFrameworkMapDataSet object. This function loads the map aMapFileName. You can load more maps using LoadMapData later. If the map is encrypted the key must be supplied in aEncryptionKey.

◆ New() [2/2]

std::unique_ptr< CFrameworkMapDataSet > CartoType::CFrameworkMapDataSet::New ( TResult aError,
std::shared_ptr< CFrameworkEngine aEngine,
std::unique_ptr< CMapDataBase >  aDb 
)
static

Creates a CFrameworkMapDataSet object. This function loads the map database aDb. You can load more maps using LoadMapData later.

◆ Proj4Param()

std::string CartoType::CFrameworkMapDataSet::Proj4Param ( ) const

Returns the projection parameters in proj.4 format if possible. If not, returns the empty string.

◆ ReadGpx()

TResult CartoType::CFrameworkMapDataSet::ReadGpx ( uint32_t  aMapHandle,
const CString aFileName 
)

Reads route and track objects from a GPX file and inserts them into the map identified by aMapHandle. This function fails if the map is not writable.

Waypoint objects (wpt) are made into points in the gpx/wpt layer. Route objects (rte) are made into lines in the gpx/rte layer. Track objects (trk) are made into lines in the gpx/trk layer.

◆ ReadMap() [1/2]

TResult CartoType::CFrameworkMapDataSet::ReadMap ( uint32_t  aHandle,
const CString aFileName,
TFileType  aFileType 
)

Reads map data from the format given by aFileType and merges it into the map identified by aHandle. Only writable map databases may be modified in this way. The CTMS (CartoType Map Serialized), CTSQL (CartoType SQLite) and Keyhole Markup Language (KML) formats are supported.

◆ ReadMap() [2/2]

TResult CartoType::CFrameworkMapDataSet::ReadMap ( uint32_t  aHandle,
const std::vector< uint8_t > &  aData 
)

Reads map data from aData in CTMS format and merges it into the map identified by aHandle, which must refer to a writable map database. If aMapHandle is zero it means the in-memory map used for routing.

◆ SaveMap()

TResult CartoType::CFrameworkMapDataSet::SaveMap ( uint32_t  aHandle,
const CString aFileName,
TFileType  aFileType 
)

Save a map identified by its handle by writing it in the specified format. Only writable map databases may be saved in this way. The CTMS (CartoType Map Serialized), CTSQL (CartoType SQLite) and Keyhole Markup Language (KML) formats are supported.

◆ UnloadMapByHandle()

TResult CartoType::CFrameworkMapDataSet::UnloadMapByHandle ( uint32_t  aHandle)

Unload a map, selecting it by handle. It is impossible to unload the main map database or the in-memory database.


The documentation for this class was generated from the following files: