InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PMPathPoint Class Reference

#include <PMPathPoint.h>

Public Types

typedef base_type data_type
 

Public Member Functions

constexpr PMPathPoint () noexcept
 
 PMPathPoint (PMPathPointType pointType, const PMPointList &ptList)
 
 PMPathPoint (PMPathPointType pointType, const PMPoint &leftDirPt, const PMPoint &anchorPt, const PMPoint &rightDirPt)
 
 PMPathPoint (const PMPointList &ptList)
 
 PMPathPoint (const PMPoint &linePt) noexcept
 
 PMPathPoint (const PMPoint &leftDirPt, const PMPoint &anchorPt, const PMPoint &rightDirPt)
 
const PMPointGetPoint (PathPointIndex ptIndex) const
 
const PMPointGetLeftDirPoint () const noexcept
 
const PMPointGetAnchorPoint () const noexcept
 
const PMPointGetRightDirPoint () const noexcept
 
PMPathPointType GetAnchorType () const noexcept
 
void ModifyPoint (PathPointIndex ptIndex, const PMPoint &newPoint, bool16 bMirrorPt=kFalse, PMRect *constrainRect=nil)
 
void SetPoint (PathPointIndex ptIndex, const PMPoint &newPoint)
 
void SetLeftDirPoint (const PMPoint &newPoint) noexcept
 
void SetAnchorPoint (const PMPoint &newPoint) noexcept
 
void SetRightDirPoint (const PMPoint &newPoint) noexcept
 
void Flip ()
 
void ModifyAnchorType (PMPathPointType newType)
 
PMRect GetBoundingBox () const
 
void TransformPoints (const PMMatrix &xForm)
 
bool16 HitTest (const PMRect &hitRect, PathPointIndex &whichPt, const PMReal &handleSize=0.0) const
 
void ReadWrite (IPMStream *iPMStream)
 
void operator*= (const PMReal &a)
 
void operator/= (const PMReal &a)
 
 PMPathPoint (const PMPathPoint &rhs) noexcept=default
 
 PMPathPoint (PMPathPoint &&rhs) noexcept=default
 
PMPathPointoperator= (const PMPathPoint &rhs) noexcept=default
 
PMPathPointoperator= (PMPathPoint &&rhs) noexcept=default
 

Friends

PMPathPoint operator* (const PMReal &c, const PMPathPoint &pt)
 
PMPathPoint operator* (const PMPathPoint &pt, const PMReal &c)
 
PMPathPoint operator/ (const PMPathPoint &numer, const PMReal &denom)
 
bool16 operator== (const PMPathPoint &a, const PMPathPoint &b) noexcept
 
bool16 operator!= (const PMPathPoint &a, const PMPathPoint &b) noexcept
 

Detailed Description

Data class for a InDesign path point.

Constructor & Destructor Documentation

constexpr PMPathPoint::PMPathPoint ()
inlinenoexcept

Constructs a line path point at 0,0.

PMPathPoint::PMPathPoint (PMPathPointType pointType,
const PMPointListptList 
)

Construct a path point of type PMPathPointType fromt a list of points. If pointType is kL, ptList.Length() == 1. If pointType is kCS or kCK ptList.Length() == 3. For both kCS and kCK the first point is the left dir pt, the second point is the anchor point, and the third point is the right dir pt.

Parameters
pointTypespecifies the path point type.
See Also
PathTypes.h
Parameters
ptListis the list of points.
PMPathPoint::PMPathPoint (PMPathPointType pointType,
const PMPointleftDirPt,
const PMPointanchorPt,
const PMPointrightDirPt 
)

Construct a path point of type PMPathPointType. If pointType is kL, only leftDirPt needs to be specified. For both kCS and kCK, three points are required.

Parameters
pointTypespecifies the path point type.
See Also
PathTypes.h
Parameters
leftDirPtis the first point.
anchorPtis the second point.
rightDirPtis the third point.
PMPathPoint::PMPathPoint (const PMPointListptList)

Construct a path point heuristically. If the length of ptList is 1 then create a line (kL) path point. If the length of ptList is 3 then create a kCS if the direction points are on the same line, or create a kCK if the direction points are discontinuous. If length is 3 the order is leftDirPt, anchorPt, rightDirPt.

Parameters
ptListis the list of at least one point or at most three points.
PMPathPoint::PMPathPoint (const PMPointlinePt)
noexcept

Construct a line path point

PMPathPoint::PMPathPoint (const PMPointleftDirPt,
const PMPointanchorPt,
const PMPointrightDirPt 
)

Construct a curve pt, determining kCK or kCS from the direction points

Member Function Documentation

void PMPathPoint::Flip ()

Set right direction point to location of left direciont pt and vice versa

const PMPoint& PMPathPoint::GetAnchorPoint () const
noexcept
Returns
the anchor point.
PMPathPointType PMPathPoint::GetAnchorType () const
noexcept

Returns the anchor type. This should be one of kL, kCS, or kCK.

See Also
PathTypes.h
PMRect PMPathPoint::GetBoundingBox () const

Returns the bounding box of the point. If a single point the bbox is empty centered on the point.

Returns
the bounding box of the point.
const PMPoint& PMPathPoint::GetLeftDirPoint () const
noexcept
Returns
the left direciton point.
const PMPoint& PMPathPoint::GetPoint (PathPointIndex ptIndex) const
Returns
the point at the given index.
const PMPoint& PMPathPoint::GetRightDirPoint () const
noexcept
Returns
the right direction point.
bool16 PMPathPoint::HitTest (const PMRecthitRect,
PathPointIndex & whichPt,
const PMRealhandleSize = 0.0 
) const

Return the point that falls inside of hitRect. The anchor point is checked first before direction handles.

Parameters
hitRectis the rectangle to test.
whichPtis the index of the path point to test.
handleSizeis the optional parameter inciating the size of the relevant handles.
Returns
kTrue if point falls inside of hitRect. Otherwise returns kFalse.
void PMPathPoint::ModifyAnchorType (PMPathPointType newType)

Change the type of the anchor point. If changing to a kL, it removes the extra direction points, if changing to a kCS or kCK from kL it creates the direction points equal to the anchor point.

Parameters
newTypeis the type of anchor point to change to.
void PMPathPoint::ModifyPoint (PathPointIndex ptIndex,
const PMPointnewPoint,
bool16 bMirrorPt = kFalse,
PMRectconstrainRect = nil 
)

Modify the point. The point is modified so that the entire path point fits inside the constrain rectangle. bMirrorPt is ignored if the ptIndex points to an anchor point. If ptIndex points to a direction point and the anchor point is kCS then the other direction point is mirrored. if ptIndex points to a direction point, bMirrorPt is false, and the anchor point is kCS, them the other direction point is projected onto the tangent line.

Parameters
ptIndexis the path point index to modify.
newPointis the new point to set to.
bMirrorPtis ignored if ptIndex points to an anchor point.
constrainRectis the constraining rectangle.
void PMPathPoint::ReadWrite (IPMStreamiPMStream)

Read/Write to the specified stream.

Parameters
iPMStreamis the stream to read from or write to.
void PMPathPoint::SetAnchorPoint (const PMPointnewPoint)
noexcept

Sets the anchor point with the specified new point.

Parameters
newPointis the new point to set to.
void PMPathPoint::SetLeftDirPoint (const PMPointnewPoint)
noexcept

Sets the left direction point with the specified new point.

Parameters
newPointis the new point to set to.
void PMPathPoint::SetPoint (PathPointIndex ptIndex,
const PMPointnewPoint 
)

Generally you will want to use ModifyPoint to get the expected behavior for the UI, but sometimes you just want to directly set the point.Sets the point index with the new point.

Parameters
ptIndexis the point index to set.
newPointis the new point to set to.
void PMPathPoint::SetRightDirPoint (const PMPointnewPoint)
noexcept

Sets the right direction point with the specified new point.

Parameters
newPointis the new point to set to.
void PMPathPoint::TransformPoints (const PMMatrixxForm)

Transform the points with the given matrix.

Parameters
xFormis the matrix to transform with.

Friends And Related Function Documentation

bool16 operator!= (const PMPathPointa,
const PMPathPointb 
)
friend

Compare two PMPathPoint.

Returns
true if two PMPathPoint are not equal.
bool16 operator== (const PMPathPointa,
const PMPathPointb 
)
friend

Compare two PMPathPoint.

Returns
true if two PMPathPoint are equal.