Class: MCanvasGraphic

Declaration: GrafEdit.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MGraphic

Inherited By:

TBasicCanvasGraphic TCanvasCurve TCanvasLine TCanvasPolygon TCanvasPolyline TCanvasTextGraphic TSRTFeedbacker

Purpose:

Canvas graphics are the graphics that are drawn in a TCanvasView derived class, stored in an MCanvasRepresentation derived class, and interacted upon with TCanvasInteractor derived classes. MCanvasGraphic is an abstract base class from which all canvas graphics are derived. Derived classes implement functions that start with Handle, for example, HandleDraw. Clients call corresponding functions without the Handle prefix, such as Draw. MCanvasGraphic manages the bundle and transform so that a typical derived class need not. For example, Draw links the current bundle and matrix to the port that it is given and passes the linked port to HandleDraw. The implementor of HandleDraw can therefore draw the graphic geometry. Derived classes can override MGraphic functions like AdoptBundle for more sophisticated management of the bundle and transform.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Abstract base class; must be derived.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: MCanvasGraphic::~MCanvasGraphic

virtual ~ MCanvasGraphic ()

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: MCanvasGraphic::Hash

virtual long Hash () const

Interface Category:

API.

Purpose:

Returns a unique value that can assist in identifying the object or comparing it to other objects.

Calling Context:

Called to generate a hash value.

Parameters:

Return Value:

long -The hash value.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::operator=

MCanvasGraphic & operator =(const MCanvasGraphic & source)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-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: MCanvasGraphic::operator>>=

virtual TStream & operator >>=(TStream & toWhere) 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: MCanvasGraphic::operator<<=

virtual TStream & operator <<= (TStream & fromWhere)

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 TStandardException (kStreamBadVersion,0) if streaming in a version other than kOriginalVersion. Passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::HandleDraw

virtual void HandleDraw (TGrafPort &) const

Interface Category:

API.

Purpose:

Derived classes override to draw their untransformed geometries.

Calling Context:

Called by MCanvasGraphic::Draw.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

MCanvasGraphic::Draw links the graphic's transform and bundle to the port before calling HandleDraw.

Member Function: MCanvasGraphic::HandleGetBounds

virtual TGRect HandleGetBounds () const

Interface Category:

API.

Purpose:

Derived classes override to return the geometric bounds of their untransformed geometry.

Calling Context:

Called by MCanvasGraphic::GetLooseFitBounds and MCanvasGraphic::GetGeometricBounds.

Parameters:

Return Value:

TGRect -The bounds.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::HandleHit

virtual bool HandleHit (const TGPoint &) const

Interface Category:

API.

Purpose:

Derived classes override to detect an intersection with the point and their untransformed geometry.

Calling Context:

Called by MCanvasGraphic::Hit.

Parameters:

Return Value:

Returns true if the point hits the graphic.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::HandleCreateInteractor

virtual TCanvasInteractor * HandleCreateInteractor ( MCanvasSelection * adoptTarget, MToolHandler *, const TGPoint &) const

Interface Category:

API.

Purpose:

Derived classes override to create and return an interactor for manipulating the graphic, such as for curve editing.

Calling Context:

Called from TCanvasView::CreateToolInteractor.

Parameters:

Return Value:

TCanvasInteractor * -An interactor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::HandleCreateFeedbacker

virtual MCanvasGraphic * HandleCreateFeedbacker () const

Interface Category:

API.

Purpose:

Derived classes override to create and return a feedbacker for the graphic, such as a line point editing feedbacker.

Calling Context:

Currently not used.

Parameters:

Return Value:

MCanvasGraphic * -A graphic to use as a feedbacker.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::Draw

virtual void Draw (TGrafPort &) const

Interface Category:

API.

Purpose:

Draws the graphic.

Calling Context:

Called by clients to draw the graphic.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes typically override HandleDraw and not Draw.

Member Function: MCanvasGraphic::ScaleBy

virtual void ScaleBy (const TGPoint & scaleFactor, const TGPoint & center)

Interface Category:

API.

Purpose:

Scales the graphic by the specified scale factor around the specified center of scale.

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: MCanvasGraphic::RotateBy

virtual void RotateBy (GDegrees angle, const TGPoint & center)

Interface Category:

API.

Purpose:

Rotates the graphic by the specified angle around the specified center of rotation.

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: MCanvasGraphic::TranslateBy

virtual void TranslateBy (const TGPoint & offset)

Interface Category:

API.

Purpose:

Translates the graphic by the specified offset.

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: MCanvasGraphic::TransformBy

virtual void TransformBy (const TGrafMatrix &)

Interface Category:

API.

Purpose:

Transforms the graphic by the specified matrix.

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: MCanvasGraphic::GetTransform

virtual const TGrafMatrix * GetTransform () const

Interface Category:

API.

Purpose:

Provides access to the graphic's transform.

Calling Context:

Called by SRT feedbackers that orient themselves to their graphics.

Parameters:

Return Value:

const TGrafMatrix * -The graphic's transform.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::GetGeometricBounds

virtual TGRect GetGeometricBounds () const

Interface Category:

API.

Purpose:

Returns the geometric bounds of the graphic.

Calling Context:

Call this function directly.

Parameters:

Return Value:

TGRect -The bounds.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes typically override HandleGetBounds and not GetGeometricBounds.

Member Function: MCanvasGraphic::GetLooseFitBounds

virtual TGRect GetLooseFitBounds (const TGrafPort * port =NIL) const

Interface Category:

API.

Purpose:

Returns the loose fit bounds of the graphic.

Calling Context:

Call this function directly.

Parameters:

Return Value:

TGRect -The bounds.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes typically override HandleGetBounds and not GetLooseFitBounds.

Member Function: MCanvasGraphic::CreateInteractor

virtual TCanvasInteractor * CreateInteractor ( MCanvasSelection * adoptTarget, MToolHandler *, const TGPoint &) const

Interface Category:

API.

Purpose:

Creates a graphic-specific interactor, if supported.

Calling Context:

Typically called by the canvas view or an interactor.

Parameters:

Return Value:

TCanvasInteractor * -The interactor, if supported, else NIL.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes typically override HandleCreateInteractor and not CreateInteractor.

Member Function: MCanvasGraphic::CreateFeedbacker

virtual MCanvasGraphic * CreateFeedbacker () const

Interface Category:

API.

Purpose:

Creates a graphic-specific feedbacker, if supported.

Calling Context:

Typically called by the canvas view.

Parameters:

Return Value:

MCanvasGraphic * -The feedbacker graphic, if supported, else NIL.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes typically override HandleCreateFeedbacker and not CreateFeedbacker.

Member Function: MCanvasGraphic::Hit

virtual bool Hit (const TGPoint &) const

Interface Category:

API.

Purpose:

Determines if the point intersects the graphic.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the point hits the graphic.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Derived classes typically override HandleHit and not Hit.

Member Function: MCanvasGraphic::GetID

TCanvasGraphicID GetID () const

Interface Category:

API.

Purpose:

Gets the graphic's unique ID.

Calling Context:

Call this function directly.

Parameters:

Return Value:

TCanvasGraphicID -The ID.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::SetID

void SetID (const TCanvasGraphicID &)

Interface Category:

API.

Purpose:

Sets the unique ID of the graphic.

Calling Context:

Called by MCanvasRepresentation::Swap implementations.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::MCanvasGraphic

  1. MCanvasGraphic ()
  2. MCanvasGraphic (const MCanvasGraphic &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators and constructors of derived classes.
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::GetFeedbacker

virtual MCanvasGraphic * GetFeedbacker () const

Interface Category:

API.

Purpose:

Gives access to the feedbacker for this graphic object.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Pointer to the resulting feedbacker.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: MCanvasGraphic::TransformTo

virtual void TransformTo (const TGrafMatrix &)

Interface Category:

API.

Purpose:

Moves the canvas graphic to the specified location and 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.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.