|
CartoType API
|
#include <cartotype_graphics.h>
Public Types | |
| enum | TClipType { EInside, EMayIntersectAndHasNoCurves, EMayIntersectAndHasCurves } |
Public Member Functions | |
| virtual | ~MPath () |
| virtual int32 | Contours () const =0 |
| virtual void | GetContour (int32 aIndex, TContour &aContour) const =0 |
| CT_IMPORT TResult | Traverse (MPathTraverser &aTraverser, const TRect &aClip) const |
| CT_IMPORT TResult | Traverse (MPathTraverser &aTraverser, const TRect *aClip=NULL) const |
| CT_IMPORT void | GetCBox (TRect &aBox) const |
| CT_IMPORT bool | CBoxBiggerThan (int32 aSize) const |
| CT_IMPORT void | GetExtrema (TExtrema &aExtrema, int32 aFractionalBits, const TPoint &aXAxisVector, const TRect &aClip) const |
| CT_IMPORT bool | IsContainedIn (const TRect &aRect) const |
| CT_IMPORT bool | MayIntersect (const TRect &aRect) const |
| CT_IMPORT bool | MayIntersect (const TRect &aRect, int32 aBorder) const |
| CT_IMPORT bool | Intersects (const TRect &aRect) const |
| CT_IMPORT int32 | MaxDistanceFromOrigin () const |
| CT_IMPORT const MPath * | ClippedPath (TResult &aError, const TRect &aClip) const |
| CT_IMPORT MPath * | FlatPath (TResult &aError, double aMaxDistance) const |
| CT_IMPORT COutline * | TruncatedPath (TResult &aError, double aStart, double aEnd) const |
| CT_IMPORT TResult | GetHorizontalPath (const TRect &aClip, bool aFractionalPixels, int32 aDesiredWidth, TLine &aLine) const |
| CT_IMPORT TClipType | ClipType (const TRect &aRect) const |
Path objects, which are sequences of contours, must implement the MPath interface class.
| virtual CartoType::MPath::~MPath | ( | ) | [inline, virtual] |
A virtual destructor: needed in case paths returned by ClippedPath are not the same as the path passed in and must therefore be deleted by the caller.
| CT_EXPORT bool MPath::CBoxBiggerThan | ( | int32 | aSize | ) | const |
Return true if the bounding box of the control points of the path is bigger than aSize in either width or height.
Return a version of the path clipped to aClip: either this path or a new path. If the returned path is not the same as the one passed in, the caller must delete it.
| virtual int32 CartoType::MPath::Contours | ( | ) | const [pure virtual] |
Return the number of contours.
Implemented in CartoType::CCompoundPath, CartoType::COutline, CartoType::TOutline, CartoType::CTransformedPath, CartoType::CContour, CartoType::TContour, CartoType::CBasicMapObject, CartoType::CType1Array, CartoType::CType1MultipleLineOrPolygon, and CartoType::CType1SingleContourObject.
Return a flattened version of a path.
| CT_EXPORT void MPath::GetCBox | ( | TRect & | aBox | ) | const |
Get the minimal bounding box that contains all the control points of a path. This is not as small as the bounding box of the path itself but is guaranteed to contain it and can be calculated more quickly.
| virtual void CartoType::MPath::GetContour | ( | int32 | aIndex, |
| TContour & | aContour | ||
| ) | const [pure virtual] |
Return the contour indexed by aIndex.
Implemented in CartoType::CCompoundPath, CartoType::COutline, CartoType::TOutline, CartoType::CTransformedPath, CartoType::CContour, CartoType::TContour, CartoType::CBasicMapObject, CartoType::CType1Array, CartoType::CType1MultipleLineOrPolygon, and CartoType::CType1SingleContourObject.
| CT_EXPORT void MPath::GetExtrema | ( | TExtrema & | aExtrema, |
| int32 | aFractionalBits, | ||
| const TPoint & | aXAxisVector, | ||
| const TRect & | aClip | ||
| ) | const |
Get the extrema of an outline in a coordinate system with an x axis on the supplied vector.
By doing this you can get the tangent point of a line at any angle to the convex hull of the outline, on either side of it. This is useful when calculating the envelope of a line drawn using an elliptical pen, or indeed a pen of any convex shape.
| CT_EXPORT TResult MPath::GetHorizontalPath | ( | const TRect & | aClip, |
| bool | aFractionalPixels, | ||
| int32 | aDesiredWidth, | ||
| TLine & | aLine | ||
| ) | const |
Return a horizontal line inside an outline, suitable for drawing a label. The line is returned in aLine. The returned line is the first line that is found at least as long as aDesiredWidth, moving out from the centre of the polygon bounds, or the longest line if none is as long as aDesiredWidth.
| CT_EXPORT bool MPath::Intersects | ( | const TRect & | aRect | ) | const |
Return true if the path intersects a specified rectangle. For single points, this is true if the point is inside the rectangle. For open paths, this is true if at least one line intersects the rectangle. For closed paths, the polygon defined by the control points must intersect the rectangle.
Reimplemented in CartoType::TContour.
| CT_EXPORT int32 MPath::MaxDistanceFromOrigin | ( | ) | const |
Return a distance guaranteed to be greater than the maximum distance of the path from the origin. This is used in ensuring that a margin is drawn round a map so that parts of objects just off it appear, thus enabling tiles to be drawn that match along their edges.
For speed the number returned is simply the ceiling of root-2 times the greatest x or y distance from the origin.
| CT_EXPORT bool MPath::MayIntersect | ( | const TRect & | aRect | ) | const |
Return true if the path may possibly intersect the specified rectangle. Return false if there is definitely no intersection. The return value actually indicates whether the bounding box of the path's control points intersects the rectangle.
Reimplemented in CartoType::TContour.
| CT_EXPORT bool MPath::MayIntersect | ( | const TRect & | aRect, |
| int32 | aBorder | ||
| ) | const |
Return true if the path may possibly intersect the specified rectangle, expanded on all sides by aBorder. Return false if there is definitely no intersection. The return value actually indicates whether the bounding box of the path's control points intersects the rectangle.
| CT_EXPORT TResult MPath::Traverse | ( | MPathTraverser & | aTraverser, |
| const TRect & | aClip | ||
| ) | const |
Traverse a path by traversing each contour.
Return a version of the path truncated by removing a length equal to aStart at the start of each contour, and a length equal to aEnd at the end.
1.7.5.1