CartoType API
Public Types | Public Member Functions
CartoType::MPath Class Reference

#include <cartotype_graphics.h>

Inheritance diagram for CartoType::MPath:
CartoType::CCompoundPath CartoType::CContour CartoType::CMapObject CartoType::COutline CartoType::CTransformedPath CartoType::TContour CartoType::TOutline CartoType::CMarker CartoType::CBasicMapObject CartoType::CType1MapObject CartoType::CShpMapObject CartoType::CType1Array CartoType::CType1MultipleLineOrPolygon CartoType::CType1SingleContourObject CartoType::CShpLineOrPolygon CartoType::CShpPointOrMultiPoint CartoType::CType1Point CartoType::CType1SingleLineOrPolygon CartoType::CShpLine CartoType::CShpPolygon CartoType::CShpMultiPoint CartoType::CShpPoint

List of all members.

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 MPathClippedPath (TResult &aError, const TRect &aClip) const
CT_IMPORT MPathFlatPath (TResult &aError, double aMaxDistance) const
CT_IMPORT COutlineTruncatedPath (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

Detailed Description

Path objects, which are sequences of contours, must implement the MPath interface class.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

CT_EXPORT const MPath * MPath::ClippedPath ( TResult aError,
const TRect aClip 
) const

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]
CT_EXPORT MPath * MPath::FlatPath ( TResult aError,
double  aMaxDistance 
) const

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]
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.

CT_EXPORT COutline * MPath::TruncatedPath ( TResult aError,
double  aStart,
double  aEnd 
) const

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.


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