Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
MGraphic
Inherited By:
None.
Purpose:
TLine provides a wrapper for the TGLine geometry class, to which it adds the facilities inherited from MGraphic: an attribute bundle, transformations, and hit detection. TLine has a, not is a, TGLine. TLine is used for drawing line segments. Note that there is no TInfiniteLine class corresponding to TGInfiniteLine; you need to create a derived class to get that sort of functionality.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
None.
Concurrency:
Not multithread safe.
Resource Use:
No special requirements.
- TLine ()
- TLine (const TLine &)
- TLine (TGPoint startPt, TGPoint endPt)
- TLine (const TGLine & line, TGrafBundle * adoptBundle =NIL)
Interface Category:
API.
Purpose:
- Default constructor.
- Copy constructor.
- Constructor that takes two TGPoint parameters.
- Constructor that takes a TGLine and a TGrafBundle as parameters.
Calling Context:
- Called by the stream-in operators. You can also call this function directly.
- Called to copy an object. You can also call this function directly.
- Call this function directly.
- Call this function directly.
Parameters:
- Takes no parameters.
- const TLine & -The line to be copied.
- TGPoint startPt -The starting point of this line.
- TGPoint endPt -The endpoint of this line.
- const TGLine & line -The line geometry to be used.
- TGrafBundle * adoptBundle =NIL -The bundle to be adopted.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
virtual ~ TLine ()
Interface Category:
API.
Purpose:
Destructor.
Calling Context:
Called to destroy an object.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::GetStartPoint
TGPoint GetStartPoint () const
Interface Category:
API.
Purpose:
Gets the starting point of this TLine.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns a TGPoint representing the starting point of the line.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::GetEndPoint
TGPoint GetEndPoint () const
Interface Category:
API.
Purpose:
Gets the endpoint of this TLine.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns a TGPoint representing the endpoint of the line.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::GetPoints
void GetPoints (TGPoint & startPt, TGPoint & endPt) const
Interface Category:
API.
Purpose:
Returns, in its parameters, both endpoints of this TLine.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::Evaluate
TGPoint Evaluate (GParametric u) const
Interface Category:
API.
Purpose:
Gets a point corresponding to the specified parametric value on the TLine. A value of 0 corresponds to the starting point, and 1 to the endpoint. Values outside this range return an extrapolated point.
Calling Context:
Call this function directly.
Parameters:
- GParametric u -The parametric position on the TLine.
Return Value:
Returns a TGPoint corresponding to the specified parameter.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::SetStartPoint
void SetStartPoint (const TGPoint & point)
Interface Category:
API.
Purpose:
Sets the starting point of this TLine.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & point -The new starting point.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::SetEndPoint
void SetEndPoint (const TGPoint & point)
Interface Category:
API.
Purpose:
Sets the endpoint of this TLine.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & point -The new endpoint.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::DragPosition
void DragPosition (GCoordinate parametric, const TGPoint & toPoint)
Interface Category:
API.
Purpose:
Moves the TLine so the specified parametric position on it matches the specified point.
Calling Context:
Call this function directly.
Parameters:
- GCoordinate parametric -The parametric position on this line.
- const TGPoint & toPoint -The point to match to the parametric value.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::NearestParametric
GParametric NearestParametric (const TGPoint & test) const
Interface Category:
API.
Purpose:
Finds the parametric value corresponding to the point the TLine that is nearest to the specified TGPoint.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & test -The point whose parametric value is to be found.
Return Value:
Returns a GParametric that best matches the specified point.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::Draw
virtual void Draw (TGrafPort & port) const
Interface Category:
API.
Purpose:
Draws the TLine to the specific TGrafPort. Attributes in the graphic's bundle override those already provided in the port (if any).
Calling Context:
Call this function directly.
Parameters:
- TGrafPort & port -The port to which drawing should go. The port in turn invokes rendering on a particular TGrafDevice.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::GetGeometricBounds
virtual TGRect GetGeometricBounds () const
Interface Category:
API.
Purpose:
Gets the bounding rectangle of the geometry, without considering any area added by the bundle.
Calling Context:
Called during hit detection. You can also call this function directly.
Parameters:
Return Value:
Returns the bounding rectangle, which is the smallest axis-aligned rectangle that encloses the geometry.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::GetLooseFitBounds
virtual TGRect GetLooseFitBounds (const TGrafPort* =NIL) const
Interface Category:
API.
Purpose:
Gets the entire graphic's bounding rectangle, taking into account the bundle information.
Calling Context:
Called during hit detection. You can also call this function directly.
Parameters:
- const TGrafPort * =NIL -The graphics port used for accessing hierarchical bundles.
Return Value:
Returns the bounding rectangle, which is the smallest axis-aligned rectangle that encloses the entire graphic, including any area added by the bundle attributes.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::TransformBy
virtual void TransformBy (const TGrafMatrix &)
Interface Category:
API.
Purpose:
Transforms the graphic's shape and position by applying the specified transformation matrix.
Calling Context:
Called by the Graphics system. You can also call this function directly.
Parameters:
- const TGrafMatrix & -The transformation matrix by which the graphic's points are multiplied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::ScaleBy
virtual void ScaleBy (const TGPoint &, const TGPoint & =TGPoint :: kOrigin)
Interface Category:
API.
Purpose:
Changes the graphic's size according to the specified horizontal and vertical scalars (the coordinates of the first parameter). Because there are two independent scalars, the graphic's shape can change. The second parameter defines the center of scale. Every point is mapped to a new position by applying the scalars to the point's horizontal and vertical displacements from the center of scale. Thus, the scaled graphic does not stay centered at the same point unless the second argument is the old center of the graphic.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & -A vector whose x-coordinate is the horizontal scalar, and whose y-coordinate is the vertical scalar.
- const TGPoint & =TGPoint :: kOrigin -The point from which to measure the horizontal and vertical displacement of each point to be scaled. To create the resulting geometry, the displacements are multiplied by the horizontal and vertical scalars, respectively. The default center of scale is the origin (0,0).
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::TranslateBy
virtual void TranslateBy (const TGPoint &)
Interface Category:
API.
Purpose:
Moves the graphic's position by the specified vector.
Calling Context:
Call this function directly.
Parameters:
- const TGPoint & -The vector whose x- and y-coordinates are to be added to those of each point in the geometry.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::RotateBy
virtual void RotateBy (GDegrees, const TGPoint & =TGPoint :: kOrigin)
Interface Category:
API.
Purpose:
Rotates the TLine by the given number of degrees, using the specified center of rotation. This does not change the size or shape of the graphic, only its orientation.
Calling Context:
Call this function directly.
Parameters:
- GDegrees -The number of degrees to rotate the graphic.
- const TGPoint & =TGPoint :: kOrigin -The point around which the graphic is rotated.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::operator=
TLine & operator =(const TLine & source)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
- const TLine & source -The object to be copied.
Return Value:
Returns a const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::operator==
bool operator ==(const TLine & source) const
Interface Category:
API.
Purpose:
Tests two TLines for equality, by determining whether the geometries are equal and the bundles are equal.
Calling Context:
Call this function by using the operator in an expression.
Parameters:
- const TLine & source -The line to be compared with this one.
Return Value:
Returns true if this TLine and the argument have equal geometries and bundles.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::operator!=
bool operator != (const TLine & source) const
Interface Category:
API.
Purpose:
Tests two TLines for inequality, by seeing whether their geometries and bundles are different.
Calling Context:
Call this function by using the operator in an expression.
Parameters:
- const TLine & source -The line to be compared with this one.
Return Value:
Returns true if the geometries or bundles of this line and the parameter are not equal.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::operator>>=
virtual TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & -The stream that the object is streamed out to.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Member Function: TLine::operator<<=
virtual TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & -The stream that the object is streamed in from.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.