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

#include <PMLineSeg.h>

Public Member Functions

 PMLineSeg ()
 
 PMLineSeg (const PMPoint &P1, const PMPoint &P2)
 
 PMLineSeg (const PMPoint &P1, const PMReal &xDistance, const PMReal &yDistance)
 
 PMLineSeg (const PMReal &p1x, const PMReal &p1y, const PMReal &p2x, const PMReal &p2y)
 
bool16 IsHorizontal () const
 
bool16 IsVertical () const
 
PMReal DeltaX () const
 
PMReal DeltaY () const
 
const PMPointTopPoint () const
 
const PMPointBottomPoint () const
 
const PMRealTop () const
 
PMRealTop ()
 
void Top (const PMReal &newP1y)
 
const PMRealBottom () const
 
PMRealBottom ()
 
void Bottom (const PMReal &newP2y)
 
const PMRealLeft () const
 
PMRealLeft ()
 
void Left (const PMReal &newLeft)
 
const PMRealRight () const
 
PMRealRight ()
 
void Right (const PMReal &newRight)
 
void SetX (const PMReal &x1, const PMReal &x2)
 
void SetY (const PMReal &y1, const PMReal &y2)
 
void SetHorizontal (const PMReal &x1, const PMReal &x2)
 
void SetVertical (const PMReal &y1, const PMReal &y2)
 
PMLineSegMoveRel (const PMReal &dx, const PMReal &dy)
 
PMLineSegMoveRel (const PMPoint &point)
 

Friends

bool16 operator== (const PMLineSeg &a, const PMLineSeg &b)
 
bool16 operator!= (const PMLineSeg &a, const PMLineSeg &b)
 

Detailed Description

A C++ class for line segment. This line segment is defined by two points.

Constructor & Destructor Documentation

PMLineSeg::PMLineSeg ()
inline

The default constructor makes no assumptions about what a default line is.

PMLineSeg::PMLineSeg (const PMPointP1,
const PMPointP2 
)
inline

Creates a line given two points. (Current) usage is such that, usually P1 is "less than" P2, resulting in DeltaY being positive. We assert the fact that P1.Y() < P2.Y(). The x-dimension can be arbitrary. Therefore it is assumed that P1 is the top point and P2 the bottom.

Parameters
P1is the first point.
P2is the second point.
PMLineSeg::PMLineSeg (const PMPointP1,
const PMRealxDistance,
const PMRealyDistance 
)
inline

Creates a line given a point and x and y distances. It is assumed that P1 is the top point and P2 the bottom

Parameters
P1is the point.
xDistanceis the distance to the y-axis (P2).
yDistanceis the distance to the x-axis (P2).
PMLineSeg::PMLineSeg (const PMRealp1x,
const PMRealp1y,
const PMRealp2x,
const PMRealp2y 
)
inline

Cosntruct a line given two points as x and y each. It is assumed that P1 is the top point and P2 the bottom

Parameters
p1xis the x position of the first point (P1).
p1yis the y position of the first point (P1).
p1xis the x position of the second point (P2).
p1yis the y position of the second point (P2).

Member Function Documentation

const PMReal& PMLineSeg::Bottom () const
inline

the bottom point y value.

PMReal& PMLineSeg::Bottom ()
inline

Return the bottom point y value. Caution when using this method - you should ASSERT(fTop.Y() <= fBottom.Y()); the bottom point y value.

void PMLineSeg::Bottom (const PMRealnewP2y)
inline

Set the bottom point y value.

Parameters
newP2yis the new y value for bottom point.
const PMPoint& PMLineSeg::BottomPoint () const
inline

the bottom point.

PMReal PMLineSeg::DeltaX () const
inline
Returns
the difference in the x coordinates.
PMReal PMLineSeg::DeltaY () const
inline
Returns
the difference in the y coordinates.
bool16 PMLineSeg::IsHorizontal () const
inline
Returns
true if line is a horizontal line.
bool16 PMLineSeg::IsVertical () const
inline
Returns
true if line is a vertical line.
const PMReal& PMLineSeg::Left () const
inline
Returns
the left point.
PMReal& PMLineSeg::Left ()
inline
Returns
the left point.
void PMLineSeg::Left (const PMRealnewLeft)
inline

Set the new left value

Parameters
newLeftspecifies the new left value.
PMLineSeg& PMLineSeg::MoveRel (const PMRealdx,
const PMRealdy 
)
inline

Move the line segmenet by delta amount in both x and y direction.

Parameters
dxthe amount in x position to move.
dyis the amount in y position to move.
Returns
the new line segment.
PMLineSeg& PMLineSeg::MoveRel (const PMPointpoint)
inline

Move the line segmenet by delta amount in both x and y direction specified by point.

Parameters
pointthe amount to move.
Returns
the new line segment.
const PMReal& PMLineSeg::Right () const
inline
Returns
the right point.
PMReal& PMLineSeg::Right ()
inline
Returns
the right point.
void PMLineSeg::Right (const PMRealnewRight)
inline

Set the new right value

Parameters
newRightspecifies the new right value.
void PMLineSeg::SetHorizontal (const PMRealx1,
const PMRealx2 
)
inline

Turn the line segment to a horizontal line that passes through x1 and x2.

Parameters
x1is the new left value for the horizontal line.
x2is the new right value for the horizontal line.
void PMLineSeg::SetVertical (const PMRealy1,
const PMRealy2 
)
inline

Turn the line segment to a vertical line that passes through y1 and y2.

Parameters
y1is the new top value for the vertical line.
y2is the new bottom value for the vertical line.
void PMLineSeg::SetX (const PMRealx1,
const PMRealx2 
)
inline

Set the new x values for top and bottom points.

Parameters
x1is the x value for the top point.
x2is the x value for the bottom point.
void PMLineSeg::SetY (const PMRealy1,
const PMRealy2 
)
inline

Set the new top and bottom value for the points.

Parameters
y1is the new top value for the top point.
y2is the new bottom value for the bottom point.
const PMReal& PMLineSeg::Top () const
inline

the top point y value.

PMReal& PMLineSeg::Top ()
inline

Return the top point y value. Caution when using this method - you should ASSERT(fTop.Y() <= fBottom.Y()); the top point y value.

void PMLineSeg::Top (const PMRealnewP1y)
inline

Set the top point y value.

Parameters
newP1yis the new y value for top point.
const PMPoint& PMLineSeg::TopPoint () const
inline

the top point.

Friends And Related Function Documentation

bool16 operator!= (const PMLineSega,
const PMLineSegb 
)
friend

Return true if two PMLineSeg are not equal.

Parameters
ais first line segment.
bis second line segment.
Returns
true if a and b are not equal.
bool16 operator== (const PMLineSega,
const PMLineSegb 
)
friend

Return true if two PMLineSeg are equal.

Parameters
ais first line segment.
bis second line segment.
Returns
true if a and b are equal.