Class: TLine

Declaration: Graphics.h

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.

Member Function: TLine::TLine

  1. TLine ()
  2. TLine (const TLine &)
  3. TLine (TGPoint startPt, TGPoint endPt)
  4. TLine (const TGLine & line, TGrafBundle * adoptBundle =NIL)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.
  3. Constructor that takes two TGPoint parameters.
  4. Constructor that takes a TGLine and a TGrafBundle as parameters.

Calling Context:

  1. Called by the stream-in operators. You can also call this function directly.
  2. Called to copy an object. You can also call this function directly.
  3. Call this function directly.
  4. 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::~TLine

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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.