CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
|
#include <cartotype_framework.h>
Public Member Functions | |
CFrameworkMapDataSet (std::shared_ptr< CFrameworkEngine > aEngine, std::unique_ptr< CMapDataBase > aDb) | |
std::unique_ptr< CFrameworkMapDataSet > | Copy (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< CMapMetaData > | MapMetaData (size_t aIndex) const |
std::vector< CString > | LayerNames () |
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< CMapObject > | LoadMapObject (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< CFrameworkMapDataSet > | New (TResult &aError, std::shared_ptr< CFrameworkEngine > aEngine, const CString &aMapFileName, const std::string *aEncryptionKey=nullptr, bool aMapOverlaps=true) |
static std::unique_ptr< CFrameworkMapDataSet > | New (TResult &aError, std::shared_ptr< CFrameworkEngine > aEngine, std::unique_ptr< CMapDataBase > aDb) |
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.
CartoType::CFrameworkMapDataSet::CFrameworkMapDataSet | ( | std::shared_ptr< CFrameworkEngine > | aEngine, |
std::unique_ptr< CMapDataBase > | aDb | ||
) |
Creates a CFrameworkMapDataSet object using a given CFrameworkEngine and map database.
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.
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.
TResult CartoType::CFrameworkMapDataSet::CreateWritableMap | ( | TWritableMapType | aType, |
CString | aFileName = nullptr |
||
) |
Creates a new writable map as part of this map data set.
TResult CartoType::CFrameworkMapDataSet::DeleteAllMapObjects | ( | uint32_t | aMapHandle, |
uint64_t & | aDeletedCount | ||
) |
Deletes all the map objects in a given writable map.
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.
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.
uint32_t CartoType::CFrameworkMapDataSet::GetLastMapHandle | ( | ) | const |
Get the handle of the map most recently loaded.
uint32_t CartoType::CFrameworkMapDataSet::GetMainMapHandle | ( | ) | const |
Get the handle of the main map.
CMapDataBase * CartoType::CFrameworkMapDataSet::GetMapDb | ( | uint32_t | aHandle, |
bool | aTolerateNonExistentDb = false |
||
) |
Gets a map database by its handle. For internal use only.
uint32_t CartoType::CFrameworkMapDataSet::GetMemoryMapHandle | ( | ) | const |
Get the handle of the in-memory map.
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.
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.
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.
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.
std::vector< CString > CartoType::CFrameworkMapDataSet::LayerNames | ( | ) |
Returns the names of all the layers in the map data.
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.
TResult CartoType::CFrameworkMapDataSet::LoadMapData | ( | std::unique_ptr< CMapDataBase > | aDb | ) |
Load a map database and take ownership of it.
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.
CMapDataBase & CartoType::CFrameworkMapDataSet::MainDb | ( | ) | const |
Returns the main map database. For internal use only.
size_t CartoType::CFrameworkMapDataSet::MapCount | ( | ) | const |
Returns the number of maps currently loaded, including the main map and the in-memory map.
|
inline |
Returns the map database array. For internal use only.
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.
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.
bool CartoType::CFrameworkMapDataSet::MapIsWritable | ( | size_t | aIndex | ) | const |
Returns true if a map, identified by its index, is writable.
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.
|
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.
|
static |
Creates a CFrameworkMapDataSet object. This function loads the map database aDb. You can load more maps using LoadMapData later.
std::string CartoType::CFrameworkMapDataSet::Proj4Param | ( | ) | const |
Returns the projection parameters in proj.4 format if possible. If not, returns the empty string.
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.
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.
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.