|
CartoType API
|
#include <cartotype_map.h>
Public Types | |
| enum | { EMinScale = 500, EMaxScale = 1000000000 } |
Public Member Functions | |
| CT_IMPORT TResult | Draw (CGraphicsContext &aGc, const TPoint &aTopLeft, MInputStream &aStyleSheet, const CMapDrawParam *aParam=NULL) |
| CT_IMPORT void | ClearStyleSheet () |
| CT_IMPORT TResult | SetProjection (TCoordinateTransform *aProjection) |
| CT_IMPORT TResult | SetPixelSize (double aSize) |
| CT_IMPORT TResult | SetViewCenter (const TPoint &aPoint) |
| CT_IMPORT TResult | SetViewCenterFromMapCoordinates (const TPoint &aPoint) |
| CT_IMPORT TResult | SetViewCenterFromLatLong (const TPoint &aPoint, TPoint *aNewCenter=0) |
| CT_IMPORT TResult | ConvertLatLongToMapCoordinates (const TPoint &aLatLong, TPoint &aMapPoint) const |
| CT_IMPORT TResult | ConvertLatLongToMapCoordinates (double aLong, double aLat, TPoint &aMapPoint) const |
| CT_IMPORT TResult | ConvertMapCoordinatesToLatLong (const TPoint &aMapPoint, double &aLong, double &aLat) const |
| CT_IMPORT TResult | ConvertMapCoordinatesToLatLong (const TPoint &aMapPoint, TPoint &aLatLong) const |
| CT_IMPORT TResult | ConvertDisplayPixelsToMapCoordinates (const TPoint &aDisplayPoint, TPoint &aMapPoint, CGraphicsContext *aGc=NULL) const |
| CT_IMPORT TResult | ConvertMapCoordinatesToDisplayPixels (const TPoint &aMapPoint, TPoint &aDisplayPoint, CGraphicsContext *aGc=NULL) const |
| CT_IMPORT TResult | SetViewArea (const TRect &aRect) |
| CT_IMPORT TResult | SetViewAreaFromMapCoordinates (const TRect &aMapRect) |
| CT_IMPORT void | GetViewAreaInMapCoordinates (TRect &aMapRect) const |
| CT_IMPORT TResult | Find (const TPoint &aPoint, int32 aRadius, CPointerArray< CMapObject > &aObject, int32 aMaxObjects=INT32_MAX, CMapDataBase *aAuxDataBase=NULL) |
| CT_IMPORT TResult | FindInLayer (const MString &aLayer, const TPoint &aPoint, int32 aRadius, CPointerArray< CMapObject > &aObject, int32 aMaxObjects=INT32_MAX, bool aClearArray=true, CMapDataBase *aAuxDataBase=NULL) |
| CT_IMPORT TResult | Find (const TPoint &aTopLeft, MInputStream &aStyleSheet, const TPoint &aPoint, int32 aRadius, CPointerArray< CMapObject > &aObject, int32 aMaxObjects=INT32_MAX, const CMapDrawParam *aParam=NULL, CGraphicsContext *aTransformingGc=NULL) |
| CT_IMPORT TResult | Find (const TPoint &aTopLeft, const MString &aLabel, TLabelMatchMethod aLabelMatchMethod, const MString *const *aLayer, int32 aLayers, CPointerArray< CMapObject > &aObject, int32 aMaxObjects=INT32_MAX, bool aProject=false, bool aClearArray=true) |
| CT_IMPORT TResult | Resize (int32 aWidth, int32 aHeight) |
| CT_IMPORT TResult | GetScrollInfo (int32 &aXRange, int32 &aYRange, TRect &aPosition) const |
| CT_IMPORT TResult | SetScrollInfo (const TPoint &aPosition) |
| CT_IMPORT TResult | ZoomIn (double aZoomFactor) |
| CT_IMPORT TResult | ZoomOut (double aZoomFactor) |
| CT_IMPORT TResult | SetScale (double aScaleDenominator) |
| CT_IMPORT TResult | Pan (int aXPixels, int aYPixels) |
| CT_IMPORT TResult | ScrollUp (double aPages) |
| CT_IMPORT TResult | ScrollDown (double aPages) |
| CT_IMPORT TResult | ScrollLeft (double aPages) |
| CT_IMPORT TResult | ScrollRight (double aPages) |
| CT_IMPORT TResult | Rotate (double aAngle) |
| CT_IMPORT TResult | RotateDegrees (double aAngle) |
| CT_IMPORT TResult | SetRotation (double aAngle) |
| CT_IMPORT TResult | SetRotationDegrees (double aAngle) |
| CT_IMPORT CLayerStyle * | CopyLayerStyle (TResult &aError, MInputStream &aStyleSheet, const MString &aLayerName, const CMapDrawParam *aParam=NULL, bool aAllowCustomStyles=false) |
| CT_IMPORT TResult | GetBackground (MInputStream &aStyleSheet, TPaint &aBackground, const CMapDrawParam *aParam=NULL) |
| CT_IMPORT TResult | SetStyleSheetVariable (const MString &aVariableName, int32 aValue) |
| CT_IMPORT TResult | SetStyleSheetVariable (const char *aVariableName, int32 aValue) |
| CT_IMPORT TResult | SetTerrainHighlightRangeInFeet (int32 aLow, int32 aHigh, TColor aColor) |
| CT_IMPORT double | ScaleDenominatorFromZoomLevel (double aZoomLevel) const |
| CT_IMPORT double | ZoomLevelFromScaleDenominator (double aScaleDenominator) const |
| TResult | SetLanguage (const char *aLanguage) |
| TResult | SetLanguage (const MString &aLanguage) |
| CEngine & | Engine () |
| const CMapStyle * | Style () const |
| const TCoordinateTransform * | Projection () const |
| double | PixelSize () const |
| int32 | Scale () const |
| int32 | FullMapScale () const |
| int32 | WidthInPixels () const |
| int32 | HeightInPixels () const |
| const MString & | DefaultLabelFormat () const |
| CT_IMPORT TResult | SetPixelSize (TFixed aSize) |
| CT_IMPORT TResult | ZoomIn (TFixed aZoomFactor) |
| CT_IMPORT TResult | ZoomOut (TFixed aZoomFactor) |
| CT_IMPORT TResult | ScrollUp (TFixed aPages) |
| CT_IMPORT TResult | ScrollDown (TFixed aPages) |
| CT_IMPORT TResult | ScrollLeft (TFixed aPages) |
| CT_IMPORT TResult | ScrollRight (TFixed aPages) |
| CT_IMPORT TResult | Rotate (TFixed aAngle) |
| CT_IMPORT TResult | SetRotation (TFixed aAngle) |
Static Public Member Functions | |
| static CT_IMPORT CMap * | New (TResult &aError, CEngine *aEngine, CMapDataBase *aDb, TCoordinateTransform *aProjection, int32 aWidth, int32 aHeight) |
Friends | |
| class | CMapDrawIter |
| class | CMapPainter |
| class | CTileServer |
A map, containing among other things a data accessor, cached map objects, and a projection.
| anonymous enum |
| CT_EXPORT void CMap::ClearStyleSheet | ( | ) |
Clear out any cached information about the last style sheet that was used to draw the map. Call this function if drawing with a new style sheet, after the map has been drawn at least once.
| CT_EXPORT TResult CMap::ConvertDisplayPixelsToMapCoordinates | ( | const TPoint & | aDisplayPoint, |
| TPoint & | aMapPoint, | ||
| CGraphicsContext * | aGc = NULL |
||
| ) | const |
Convert display pixels to map coordinates. If aGc is non-null apply any transformation it uses; this allows perspective transforms applied by the graphics context to be taken into account.
| CT_EXPORT TResult CMap::ConvertLatLongToMapCoordinates | ( | const TPoint & | aLatLong, |
| TPoint & | aMapPoint | ||
| ) | const |
Convert latitude and longitude represented as 65536ths of degrees to map coordinates. The error code KErrorNoProjection is returned if the relationship between latitude and longitude and map coordinates is unknown.
| CT_EXPORT TResult CMap::ConvertLatLongToMapCoordinates | ( | double | aLong, |
| double | aLat, | ||
| TPoint & | aMapPoint | ||
| ) | const |
Convert latitude and longitude to map coordinates. The error code KErrorNoProjection is returned if the relationship between latitude and longitude and map coordinates is unknown.
| CT_EXPORT TResult CMap::ConvertMapCoordinatesToDisplayPixels | ( | const TPoint & | aMapPoint, |
| TPoint & | aDisplayPoint, | ||
| CGraphicsContext * | aGc = NULL |
||
| ) | const |
Convert map coordinates to display pixels. If aGc is non-null apply any transformation it uses; this allows perspective transforms applied by the graphics context to be taken into account.
| CT_EXPORT TResult CMap::ConvertMapCoordinatesToLatLong | ( | const TPoint & | aMapPoint, |
| double & | aLong, | ||
| double & | aLat | ||
| ) | const |
Convert map coordinates to latitude and longitude. The error code KErrorNoProjection is returned if the relationship between latitude and longitude and map coordinates is unknown.
| CT_EXPORT TResult CMap::ConvertMapCoordinatesToLatLong | ( | const TPoint & | aMapPoint, |
| TPoint & | aLatLong | ||
| ) | const |
Convert map coordinates to latitude and longitude represented as 65536ths of degrees. The error code KErrorNoProjection is returned if the relationship between latitude and longitude and map coordinates is unknown.
| CT_EXPORT CLayerStyle * CMap::CopyLayerStyle | ( | TResult & | aError, |
| MInputStream & | aStyleSheet, | ||
| const MString & | aLayerName, | ||
| const CMapDrawParam * | aParam = NULL, |
||
| bool | aAllowCustomStyles = false |
||
| ) |
Create a copy of the style for the layer aLayer when drawn at the map's current scale using the style sheet aStyleSheet. If the style sheet has been changed since the last call to a CMap function call ClearStyleSheet first, because CMap caches the style sheet until the scale changes.
If aParam is non-null it provides optional advanced parameters including custom styles and icons.
However, custom styles are ignored unless aAllowCustomStyles is true. That is because one of the purposes of this function is to allow custom styles to be created as modified copies of styles defined in the style sheet.
| const MString& CartoType::CMap::DefaultLabelFormat | ( | ) | const [inline] |
Return the default label format.
| CT_EXPORT TResult CMap::Draw | ( | CGraphicsContext & | aGc, |
| const TPoint & | aTopLeft, | ||
| MInputStream & | aStyleSheet, | ||
| const CMapDrawParam * | aParam = NULL |
||
| ) |
Draw the map to the graphics context aGc, with its top left corner at aTopLeft, using the style sheet supplied by the input stream aStyleSheet. If aParam is non-null it provides optional advanced parameters including objects to be highlit and layers to be omitted.
The style sheet is provided as an input stream aStyleSheet. The function Seek(0) is called on aStyleSheet before the map is drawn so that the style sheet is read from the beginning. This makes it easier to call Draw more than once with the same value for aStyleSheet.
If drawing is interrupted because another thread has set the paint interrupt flag, the code KErrorInterrupt is returned.
| CEngine& CartoType::CMap::Engine | ( | ) | [inline] |
Return a reference to the graphics engine.
| CT_EXPORT TResult CMap::Find | ( | const TPoint & | aPoint, |
| int32 | aRadius, | ||
| CPointerArray< CMapObject > & | aObject, | ||
| int32 | aMaxObjects = INT32_MAX, |
||
| CMapDataBase * | aAuxDataBase = NULL |
||
| ) |
Find objects within the distance aRadius of aPoint, which is in map coordinates. The objects that are returned are unprojected. The objects are actually within the square centred on aRadius, not the circle, which makes searching easier.
The number of objects returned can be limited by setting aMaxObjects to an appropriate value.
If aAuxDataBase is non-null it is searched in addition to the main database.
| CT_EXPORT TResult CMap::Find | ( | const TPoint & | aTopLeft, |
| MInputStream & | aStyleSheet, | ||
| const TPoint & | aPoint, | ||
| int32 | aRadius, | ||
| CPointerArray< CMapObject > & | aObject, | ||
| int32 | aMaxObjects = INT32_MAX, |
||
| const CMapDrawParam * | aParam = NULL, |
||
| CGraphicsContext * | aTransformingGc = NULL |
||
| ) |
Find objects on a map drawn at aTopLeft that intersect a circle of radius aRadius with its center at aPoint; both aRadius and aPoint are specified in pixels on the map. The objects must also intersect the map's client area. Objects less than aRadius pixels from aPoint, but off the edge of the map, are not found. The purpose of this is to fulfil user expectations when clicking on a map to get more information about an object that is clicked on. Thus the normal intended use of the Find function requires small values of aRadius.
The objects that are returned are projected using the current projection and offset to be drawn on a map with its top left corner at aTopLeft.
The style sheet is provided as an input stream aStyleSheet. The function Seek(0) is called on aStyleSheet before the search so that the style sheet is read from the beginning. This makes it easier to call Find more than once with the same value for aStyleSheet.
The number of objects returned can be limited by setting aMaxObjects to an appropriate value.
If aParam is non-null it provides optional advanced parameters including layers to be omitted and an auxiliary database to be searched.
If aTransformingGc is non-null it is the graphics context used to draw the map - usually a perspective graphics context. You have to provide this if the map is drawn using any GC that transforms points, so that the transformation can be applied when finding objects.
| CT_EXPORT TResult CMap::Find | ( | const TPoint & | aTopLeft, |
| const MString & | aLabel, | ||
| TLabelMatchMethod | aLabelMatchMethod, | ||
| const MString *const * | aLayer, | ||
| int32 | aLayers, | ||
| CPointerArray< CMapObject > & | aObject, | ||
| int32 | aMaxObjects = INT32_MAX, |
||
| bool | aProject = false, |
||
| bool | aClearArray = true |
||
| ) |
Find objects on a map with a specified label, in selected layers. The label to be matched is passed in aLabel, and an array of pointers to layer names is specified by aLayer and aLayers. The objects are returned in the array aObject.
If aProject is true the objects that are returned are projected using the current projection and offset to be drawn on a map with its top left corner at aTopLeft. It is usually more convenient and faster not to project the objects, but to view them if desired by calling SetViewAreaFromMapCoordinates with the bounding rectangle of the object or objects to be viewed.
The number of objects returned can be limited by setting aMaxObjects to an appropriate value.
If aLayer is null, all map layers are searched.
If aClearArray is true (which is the default), the destination array aObject is cleared before any new objects are added to it.
| CT_EXPORT TResult CMap::FindInLayer | ( | const MString & | aLayer, |
| const TPoint & | aPoint, | ||
| int32 | aRadius, | ||
| CPointerArray< CMapObject > & | aObject, | ||
| int32 | aMaxObjects = INT32_MAX, |
||
| bool | aClearArray = true, |
||
| CMapDataBase * | aAuxDataBase = NULL |
||
| ) |
Find objects in a named layer, within the distance aRadius of aPoint, which is in map coordinates. The objects that are returned are unprojected. The objects are actually within the square centred on aRadius, not the circle, which makes searching easier.
The number of objects in aObject can be limited by setting aMaxObjects to an appropriate value.
If aClearArray is true the destination array is cleared before the objects are appended.
If aAuxDataBase is non-null it is searched in addition to the main database.
| int32 CartoType::CMap::FullMapScale | ( | ) | const [inline] |
Return the scale used when displaying the whole map on the current display.
| CT_EXPORT TResult CMap::GetBackground | ( | MInputStream & | aStyleSheet, |
| TPaint & | aBackground, | ||
| const CMapDrawParam * | aParam = NULL |
||
| ) |
Return the background paint for the map when drawn at its current scale using the style sheet aStyleSheet. If the style sheet has been changed since the last call to a CMap function call ClearStyleSheet first, because CMap caches the style sheet until the scale changes.
If aParam is non-null it provides optional advanced parameters including custom styles and icons.
Return information to support scroll bars: the x and y ranges in aRange and the x and y position and page size in aPosition.
| CT_EXPORT void CMap::GetViewAreaInMapCoordinates | ( | TRect & | aMapRect | ) | const |
Get the view area in the coordinate system of the current map database.
| int32 CartoType::CMap::HeightInPixels | ( | ) | const [inline] |
Return the height of the map in pixels.
| CT_EXPORT CMap * CMap::New | ( | TResult & | aError, |
| CEngine * | aEngine, | ||
| CMapDataBase * | aDb, | ||
| TCoordinateTransform * | aProjection, | ||
| int32 | aWidth, | ||
| int32 | aHeight | ||
| ) | [static] |
Create a new map object that receives its data from the database aDb (which remains in the ownership of the caller) and uses the projection aProjection, which it takes ownership of. Set the map's width and height in pixels to aWidth and aHeight. If aProjection is null create a projection to view the full map. For a map with input in degrees create a UTM projection. For a map with input in metres create a simple coordinate transform.
| CT_EXPORT TResult CMap::Pan | ( | int | aXPixels, |
| int | aYPixels | ||
| ) |
Pan by a certain distance in pixels, horizontally or vertically or both.
| double CartoType::CMap::PixelSize | ( | ) | const [inline] |
Return the size of a pixel in points (1/72in).
| const TCoordinateTransform* CartoType::CMap::Projection | ( | ) | const [inline] |
Return a pointer to the current projection.
| CT_EXPORT TResult CMap::Resize | ( | int32 | aWidth, |
| int32 | aHeight | ||
| ) |
Resize a map, adjusting the projection such that the same map area is visible in the resized map.
| CT_EXPORT TResult CMap::Rotate | ( | double | aAngle | ) |
Rotate the map about its center by an angle given in radians.
Rotate the map about its center by an angle given in radians.
| CT_EXPORT TResult CMap::RotateDegrees | ( | double | aAngle | ) |
Rotate the map about its center by an angle given in degrees.
| int32 CartoType::CMap::Scale | ( | ) | const [inline] |
Return the scale as the denominator of a fraction with numerator 1. For example, if the scale is returned as 25000 that means 1:25000.
| CT_EXPORT double CMap::ScaleDenominatorFromZoomLevel | ( | double | aZoomLevel | ) | const |
Calculate the scale denominator at the equator for a certain Open Street Map zoom level (0 maps the length of the equator to 256 pixels, 1 = half the length of the equator, etc.).
| CT_EXPORT TResult CMap::ScrollDown | ( | double | aPages | ) |
Scroll down by aPages times the current map height.
Scroll down by aPages times the current map height.
| CT_EXPORT TResult CMap::ScrollLeft | ( | double | aPages | ) |
Scroll left by aPages times the current map width.
Scroll left by aPages times the current map width.
| CT_EXPORT TResult CMap::ScrollRight | ( | double | aPages | ) |
Scroll right by aPages times the current map width.
Scroll right by aPages times the current map width.
| CT_EXPORT TResult CMap::ScrollUp | ( | double | aPages | ) |
Scroll up by aPages times the current map height.
Scroll up by aPages times the current map height.
| TResult CartoType::CMap::SetLanguage | ( | const char * | aLanguage | ) | [inline] |
Set the current language tag.
Set the current language tag.
| CT_EXPORT TResult CMap::SetPixelSize | ( | double | aSize | ) |
Set the pixel size used for style sheet dimensions, in pt (1/72in). The default size is 1, meaning 1/72in. Pixel sizes are clamped to the range 1/256pt to 256pt. Pixels must be square in CartoType so only one dimension is stored.
Set the pixel size used for style sheet dimensions, in pt (1/72in). The default size is 1, meaning 1/72in. Pixel sizes are clamped to the range 1/256pt to 256pt. Pixels must be square in CartoType so only one dimension is stored.
| CT_EXPORT TResult CMap::SetProjection | ( | TCoordinateTransform * | aProjection | ) |
Set the map projection to aProjection, taking ownership of it. Return an error code; recalculating the scale will cause an arithmetic overflow for unreasonable projections.
| CT_EXPORT TResult CMap::SetRotation | ( | double | aAngle | ) |
Set the map's orientation to an absolute angle given in radians.
Set the map's orientation to an absolute angle given in radians.
| CT_EXPORT TResult CMap::SetRotationDegrees | ( | double | aAngle | ) |
Set the map's orientation to an absolute angle given in degrees.
| CT_EXPORT TResult CMap::SetScale | ( | double | aNewScale | ) |
Set the scale of the map. The number aNewScale is the denominator of the scale fraction; 50000 means 1:50000, etc.
Set the current position of the map to the scroll position in aPosition.
Set a variable used in conditional compilation of the style sheet.
| CT_EXPORT TResult CMap::SetStyleSheetVariable | ( | const char * | aVariableName, |
| int32 | aValue | ||
| ) |
Set a variable used in conditional compilation of the style sheet.
Set the terrain height range (in feet) to be highlighted, and the highlight color. These parameters are set using the reserved style sheet variables _terrain_highlight_low, _terrain_highlight_high and _terrain_highlight_color, which can also be set manually if desired.
This function will give correct results only if the height ramp for terrain height is called 'terrain-feet-height-ramp'.
Set the view area of the map. The view area is in pixels relative to the current map origin. The projection is scaled and shifted so that the projected map contains the specified area.
Set the view area of the map. The view area is in the coordinate system of the current map database. The projection is scaled and shifted so that the projected map will contain the specified area.
Set the center of the view area of the map. The center, aPoint, is in pixels relative to the current map origin.
Set the center of the view area of a map. The center, aPoint, is in latitude and longitude expressed as 65536ths of a degree. The error code KErrorNoProjection is returned if the relationship between latitude and longitude and map coordinates is unknown. If aNewCenter is non-null it is used to return the new center in map coordinates.
Set the center of the view area of the map. The center, aPoint, is in map coordinates.
| const CMapStyle* CartoType::CMap::Style | ( | ) | const [inline] |
Return a pointer to the compiled style if any.
| int32 CartoType::CMap::WidthInPixels | ( | ) | const [inline] |
Return the width of the map in pixels.
| CT_EXPORT TResult CMap::ZoomIn | ( | double | aZoomFactor | ) |
Zoom in by a specified zoom factor, or zoom out if the zoom factor is less than 1. Return KErrorZoomLimitReached if there is an attempt to zoom in beyond the minimum scale denominator (CMap::EMinScale) or to zoom out beyond the maximum scale denominator (CMap::EMaxScale) or beyond a size where the map occupies the whole display.
Zoom in by a specified zoom factor, or zoom out if the zoom factor is less than 1. Return KErrorZoomLimitReached if there is an attempt to zoom in beyond the minimum scale denominator (CMap::EMinScale) or to zoom out beyond the maximum scale denominator (CMap::EMaxScale) or beyond a size where the map occupies the whole display.
| CT_EXPORT double CMap::ZoomLevelFromScaleDenominator | ( | double | aScaleDenominator | ) | const |
Calculate Open Street Map zoom level (0 maps the length of the equator to 256 pixels, 1 = half the length of the equator, etc.). for a certain scale denominator.
| CT_EXPORT TResult CMap::ZoomOut | ( | double | aZoomFactor | ) |
Zoom out by a specified zoom factor.
Zoom out by a specified zoom factor.
1.7.5.1