CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Static Public Member Functions | List of all members
CartoTypeCore::FrameworkMapDataSet Class Reference

#include <cartotype_framework.h>

Public Member Functions

 FrameworkMapDataSet (std::shared_ptr< FrameworkEngine > aEngine, std::unique_ptr< CMapDataBase > aDb)
 
std::unique_ptr< FrameworkMapDataSetCopy (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::MapMetaDataMapMetaData (size_t aIndex) const
 
std::vector< StringLayerNames ()
 
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< MapObjectLoadMapObject (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< FrameworkMapDataSetNew (Result &aError, std::shared_ptr< FrameworkEngine > aEngine, const String &aMapFileName, const std::string *aEncryptionKey=nullptr)
 
static std::unique_ptr< FrameworkMapDataSetNew (Result &aError, std::shared_ptr< FrameworkEngine > aEngine, std::unique_ptr< CMapDataBase > aDb)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FrameworkMapDataSet()

CartoTypeCore::FrameworkMapDataSet::FrameworkMapDataSet ( std::shared_ptr< FrameworkEngine aEngine,
std::unique_ptr< CMapDataBase >  aDb 
)

Creates a FrameworkMapDataSet object using a given FrameworkEngine and map database.

Member Function Documentation

◆ Copy()

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.

◆ CreateMap()

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.

◆ CreateWritableMap()

Result CartoTypeCore::FrameworkMapDataSet::CreateWritableMap ( WritableMapType  aType,
String  aFileName = nullptr 
)

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

◆ DeleteAllMapObjects()

Result CartoTypeCore::FrameworkMapDataSet::DeleteAllMapObjects ( uint32_t  aMapHandle,
uint64_t &  aDeletedCount 
)

Deletes all the map objects in a given writable map.

◆ DeleteMapObjectArray()

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.

◆ DeleteMapObjectRange()

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.

◆ InsertEllipseMapObject()

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.

See also
Framework::InsertEllipseMapObject

◆ InsertEnvelopeMapObject()

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.

See also
Framework::InsertEnvelopeMapObject

◆ InsertMapObject()

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.

See also
Framework::InsertMapObject

◆ InsertPointMapObject()

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.

See also
Framework::InsertPointMapObject

◆ LastMapHandle()

uint32_t CartoTypeCore::FrameworkMapDataSet::LastMapHandle ( ) const

Get the handle of the most recently loaded map that is still loaded.

◆ LayerNames()

std::vector< String > CartoTypeCore::FrameworkMapDataSet::LayerNames ( )

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

◆ LoadMapData() [1/2]

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.

◆ LoadMapData() [2/2]

Result CartoTypeCore::FrameworkMapDataSet::LoadMapData ( std::unique_ptr< CMapDataBase >  aDb)

Load a map database and take ownership of it.

◆ LoadMapObject()

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.

◆ MainDb()

CMapDataBase & CartoTypeCore::FrameworkMapDataSet::MainDb ( ) const

Returns the main map database. For internal use only.

◆ MainMapHandle()

uint32_t CartoTypeCore::FrameworkMapDataSet::MainMapHandle ( ) const

Get the handle of the main map.

◆ MapCount()

size_t CartoTypeCore::FrameworkMapDataSet::MapCount ( ) const

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

◆ MapDataBaseArray()

std::shared_ptr< CMapDataBaseArray > CartoTypeCore::FrameworkMapDataSet::MapDataBaseArray ( ) const
inline

Returns the map database array. For internal use only.

◆ MapDb()

CMapDataBase * CartoTypeCore::FrameworkMapDataSet::MapDb ( uint32_t  aHandle,
bool  aTolerateNonExistentDb = false 
)

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

◆ MapHandle()

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.

◆ MapIsEmpty()

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.

◆ MapIsWritable()

bool CartoTypeCore::FrameworkMapDataSet::MapIsWritable ( size_t  aIndex) const

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

◆ MapMetaData()

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.

◆ MemoryMapHandle()

uint32_t CartoTypeCore::FrameworkMapDataSet::MemoryMapHandle ( ) const

Get the handle of the in-memory map.

◆ New() [1/2]

std::unique_ptr< FrameworkMapDataSet > CartoTypeCore::FrameworkMapDataSet::New ( Result aError,
std::shared_ptr< FrameworkEngine aEngine,
const String aMapFileName,
const std::string *  aEncryptionKey = nullptr 
)
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.

◆ New() [2/2]

std::unique_ptr< FrameworkMapDataSet > CartoTypeCore::FrameworkMapDataSet::New ( Result aError,
std::shared_ptr< FrameworkEngine aEngine,
std::unique_ptr< CMapDataBase >  aDb 
)
static

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

◆ Proj4Param()

std::string CartoTypeCore::FrameworkMapDataSet::Proj4Param ( ) const

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

◆ ReadGpx()

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.

◆ ReadMap() [1/2]

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.

◆ ReadMap() [2/2]

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.

◆ SaveMap()

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.

◆ UnloadMapByHandle()

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.


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