CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
|
#include <cartotype_framework.h>
Public Member Functions | |
FrameworkMapDataSet (std::shared_ptr< FrameworkEngine > aEngine, std::unique_ptr< CMapDataBase > aDb) | |
std::unique_ptr< FrameworkMapDataSet > | Copy (Result &aError, std::shared_ptr< FrameworkEngine > aEngine, bool aFull=true) |
Result | LoadMapData (const String &aMapFileName, const std::string *aEncryptionKey) |
Result | LoadMapData (std::unique_ptr< CMapDataBase > aDb) |
Result | UnloadMapByHandle (uint32_t aHandle) |
uint32_t | LastMapHandle () const |
Result | CreateWritableMap (WritableMapType aType, String aFileName=nullptr) |
Result | SaveMap (uint32_t aHandle, const String &aFileName, FileType aFileType) |
Result | ReadMap (uint32_t aHandle, const String &aFileName, FileType aFileType) |
Result | 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 | MainMapHandle () const |
uint32_t | MemoryMapHandle () const |
size_t | MapCount () const |
uint32_t | MapHandle (size_t aIndex) const |
bool | MapIsWritable (size_t aIndex) const |
std::unique_ptr< CartoTypeCore::MapMetaData > | MapMetaData (size_t aIndex) const |
std::vector< String > | LayerNames () |
Result | InsertMapObject (uint32_t aMapHandle, const String &aLayerName, const MPath &aGeometry, const String &aStringAttributes, FeatureInfo aFeatureInfo, uint64_t &aId, bool aReplace) |
Result | InsertPointMapObject (uint32_t aMapHandle, const String &aLayerName, Point aPoint, const String &aStringAttributes, FeatureInfo aFeatureInfo, uint64_t &aId, bool aReplace) |
Result | InsertEllipseMapObject (uint32_t aMapHandle, const String &aLayerName, PointFP aCenter, double aRadiusX, double aRadiusY, double aRotationDegrees, const String &aStringAttributes, FeatureInfo aFeatureInfo, uint64_t &aId, bool aReplace) |
Result | InsertEnvelopeMapObject (uint32_t aMapHandle, const String &aLayerName, const MPath &aGeometry, int32_t aRadius, const String &aStringAttributes, FeatureInfo aFeatureInfo, uint64_t &aId, bool aReplace) |
Result | DeleteMapObjectRange (uint32_t aMapHandle, uint64_t aStartId, uint64_t aEndId, uint64_t &aDeletedCount, String aCondition=nullptr) |
Result | DeleteMapObjectArray (uint32_t aMapHandle, const uint64_t *aIdArray, size_t aIdCount, uint64_t &aDeletedCount, String aCondition=nullptr) |
Result | DeleteAllMapObjects (uint32_t aMapHandle, uint64_t &aDeletedCount) |
std::unique_ptr< MapObject > | LoadMapObject (Result &aError, uint32_t aMapHandle, uint64_t aId) |
Result | ReadGpx (uint32_t aMapHandle, const String &aFileName) |
std::string | Proj4Param () const |
std::shared_ptr< CMapDataBaseArray > | MapDataBaseArray () const |
CMapDataBase & | MainDb () const |
CMapDataBase * | MapDb (uint32_t aHandle, bool aTolerateNonExistentDb=false) |
Static Public Member Functions | |
static std::unique_ptr< FrameworkMapDataSet > | New (Result &aError, std::shared_ptr< FrameworkEngine > aEngine, const String &aMapFileName, const std::string *aEncryptionKey=nullptr) |
static std::unique_ptr< FrameworkMapDataSet > | New (Result &aError, std::shared_ptr< FrameworkEngine > aEngine, std::unique_ptr< CMapDataBase > aDb) |
FrameworkMapDataSet owns a set of map data used to draw a map. Together with a FrameworkEngine object it makes up the 'model' part of the model-view-controller pattern.
CartoTypeCore::FrameworkMapDataSet::FrameworkMapDataSet | ( | std::shared_ptr< FrameworkEngine > | aEngine, |
std::unique_ptr< CMapDataBase > | aDb | ||
) |
Creates a FrameworkMapDataSet object using a given FrameworkEngine and map database.
std::unique_ptr< FrameworkMapDataSet > CartoTypeCore::FrameworkMapDataSet::Copy | ( | Result & | aError, |
std::shared_ptr< FrameworkEngine > | 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 > CartoTypeCore::FrameworkMapDataSet::CreateMap | ( | int32_t | aViewWidth, |
int32_t | aViewHeight | ||
) |
Create a CMap object referring to the main database in the FrameworkMapDataSet. This is an internal function used by Framework.
Result CartoTypeCore::FrameworkMapDataSet::CreateWritableMap | ( | WritableMapType | aType, |
String | aFileName = nullptr |
||
) |
Creates a new writable map as part of this map data set.
Result CartoTypeCore::FrameworkMapDataSet::DeleteAllMapObjects | ( | uint32_t | aMapHandle, |
uint64_t & | aDeletedCount | ||
) |
Deletes all the map objects in a given writable map.
Result CartoTypeCore::FrameworkMapDataSet::DeleteMapObjectArray | ( | uint32_t | aMapHandle, |
const uint64_t * | aIdArray, | ||
size_t | aIdCount, | ||
uint64_t & | aDeletedCount, | ||
String | aCondition = nullptr |
||
) |
Deletes map objects defined by an array of IDs.
Result CartoTypeCore::FrameworkMapDataSet::DeleteMapObjectRange | ( | uint32_t | aMapHandle, |
uint64_t | aStartId, | ||
uint64_t | aEndId, | ||
uint64_t & | aDeletedCount, | ||
String | 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.
Result CartoTypeCore::FrameworkMapDataSet::InsertEllipseMapObject | ( | uint32_t | aMapHandle, |
const String & | aLayerName, | ||
PointFP | aCenter, | ||
double | aRadiusX, | ||
double | aRadiusY, | ||
double | aRotationDegrees, | ||
const String & | aStringAttributes, | ||
FeatureInfo | aFeatureInfo, | ||
uint64_t & | aId, | ||
bool | aReplace | ||
) |
Inserts an elliptical map object. For internal use only.
Result CartoTypeCore::FrameworkMapDataSet::InsertEnvelopeMapObject | ( | uint32_t | aMapHandle, |
const String & | aLayerName, | ||
const MPath & | aGeometry, | ||
int32_t | aRadius, | ||
const String & | aStringAttributes, | ||
FeatureInfo | aFeatureInfo, | ||
uint64_t & | aId, | ||
bool | aReplace | ||
) |
Inserts a map object that is an envelope around some geometry. For internal use only.
Result CartoTypeCore::FrameworkMapDataSet::InsertMapObject | ( | uint32_t | aMapHandle, |
const String & | aLayerName, | ||
const MPath & | aGeometry, | ||
const String & | aStringAttributes, | ||
FeatureInfo | aFeatureInfo, | ||
uint64_t & | aId, | ||
bool | aReplace | ||
) |
Inserts a map object into one of the writable maps.
Result CartoTypeCore::FrameworkMapDataSet::InsertPointMapObject | ( | uint32_t | aMapHandle, |
const String & | aLayerName, | ||
Point | aPoint, | ||
const String & | aStringAttributes, | ||
FeatureInfo | aFeatureInfo, | ||
uint64_t & | aId, | ||
bool | aReplace | ||
) |
Inserts a point map object. For internal use only.
uint32_t CartoTypeCore::FrameworkMapDataSet::LastMapHandle | ( | ) | const |
Get the handle of the most recently loaded map that is still loaded.
std::vector< String > CartoTypeCore::FrameworkMapDataSet::LayerNames | ( | ) |
Returns the names of all the layers in the map data.
Result CartoTypeCore::FrameworkMapDataSet::LoadMapData | ( | const String & | aMapFileName, |
const std::string * | aEncryptionKey | ||
) |
Loads map data from the file aMapFileName. If the data is encrypted the key must be supplied in aEncryptionKey and its length in aEncryptionKeyLength.
Result CartoTypeCore::FrameworkMapDataSet::LoadMapData | ( | std::unique_ptr< CMapDataBase > | aDb | ) |
Load a map database and take ownership of it.
std::unique_ptr< MapObject > CartoTypeCore::FrameworkMapDataSet::LoadMapObject | ( | Result & | aError, |
uint32_t | aMapHandle, | ||
uint64_t | aId | ||
) |
Loads a map object from a given map, specified by its ID.
CMapDataBase & CartoTypeCore::FrameworkMapDataSet::MainDb | ( | ) | const |
Returns the main map database. For internal use only.
uint32_t CartoTypeCore::FrameworkMapDataSet::MainMapHandle | ( | ) | const |
Get the handle of the main map.
size_t CartoTypeCore::FrameworkMapDataSet::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.
CMapDataBase * CartoTypeCore::FrameworkMapDataSet::MapDb | ( | uint32_t | aHandle, |
bool | aTolerateNonExistentDb = false |
||
) |
Returns a map database by its handle. For internal use only.
uint32_t CartoTypeCore::FrameworkMapDataSet::MapHandle | ( | size_t | aIndex | ) | const |
Returns the handle of one of the currently loaded maps. Returns 0 if aIndex is out of range.
bool CartoTypeCore::FrameworkMapDataSet::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 CartoTypeCore::FrameworkMapDataSet::MapIsWritable | ( | size_t | aIndex | ) | const |
Returns true if a map, identified by its index, is writable.
std::unique_ptr< MapMetaData > CartoTypeCore::FrameworkMapDataSet::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.
uint32_t CartoTypeCore::FrameworkMapDataSet::MemoryMapHandle | ( | ) | const |
Get the handle of the in-memory map.
|
static |
Creates a FrameworkMapDataSet 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 FrameworkMapDataSet object. This function loads the map database aDb. You can load more maps using LoadMapData later.
std::string CartoTypeCore::FrameworkMapDataSet::Proj4Param | ( | ) | const |
Returns the projection parameters in proj.4 format if possible. If not, returns the empty string.
Result CartoTypeCore::FrameworkMapDataSet::ReadGpx | ( | uint32_t | aMapHandle, |
const String & | 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.
Result CartoTypeCore::FrameworkMapDataSet::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.
Result CartoTypeCore::FrameworkMapDataSet::ReadMap | ( | uint32_t | aHandle, |
const String & | aFileName, | ||
FileType | 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 (CartoTypeCore Map Serialized), CTSQL (CartoTypeCore SQLite) and Keyhole Markup Language (KML) formats are supported.
Result CartoTypeCore::FrameworkMapDataSet::SaveMap | ( | uint32_t | aHandle, |
const String & | aFileName, | ||
FileType | 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 (CartoTypeCore Map Serialized), CTSQL (CartoTypeCore SQLite) and Keyhole Markup Language (KML) formats are supported.
Result CartoTypeCore::FrameworkMapDataSet::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.