OCC Main Page | Visualization | Toolkits | Packages | Class Hierarchy | Data Structures | File List | Data Fields | Globals

Visualization
TKV2d
Graphic2d


Graphic2d_TransientManager Class Reference

This class allows to manage transient graphics
above one View.
A simple way to drawn something very quicly above
a complex scene (Hilighting,Sketching,...)
All transient graphics will be erased at the
next View::Update(),Redraw().
.

#include <Graphic2d_TransientManager.hxx>

Inheritance diagram for Graphic2d_TransientManager:

Inheritance graph
[legend]

Public Member Functions

Standard_EXPORT Graphic2d_TransientManager (const Handle(Graphic2d_View)&aView)
Standard_EXPORT Graphic2d_TransientManager (const Graphic2d_ViewPtr &aView)
 Creates a TransientManager associated to the view <aview>
.
Standard_EXPORT void Destroy ()
 Suppress the TransientManager <me>.
.
 ~Graphic2d_TransientManager ()
Standard_EXPORT Standard_Boolean BeginDraw (const Handle(Aspect_WindowDriver)&aDriver, const Standard_Boolean ClearBefore=Standard_True)
 Begins any graphics in the view <aview> and Driver <adriver>
with the current view attributes in a transient area.
Restore the front buffer from the back before
if <clearbefore> is TRUE.

Warning: Returns TRUE if transient backing-store is enabled in
the associated view.
Returns FALSE ,if nothing works because something
is wrong for the transient principle :
Immediat mode is not implemented depending of the
graphic library used.
MBX,PIXMAP double buffering don't works depending of
the graphic board and the visual of the window supporting
the view.
.
Standard_EXPORT Standard_Boolean BeginDraw (const Handle(Aspect_WindowDriver)&aDriver, const Handle(Graphic2d_ViewMapping)&aViewMapping, const Standard_Real aXPosition, const Standard_Real aYPosition, const Standard_Real aScale, const Standard_Boolean ClearBefore=Standard_True)
 Begins any graphics in the view <aview> and Driver <adriver>
with the view attributes in a transient area defined
by :
<aviewmapping> defines the "map from".
<axposition>, <ayposition>, <ascale> define the "map to".
Restore the front buffer from the back before
if <clearbefore> is TRUE.
.
Standard_EXPORT void EndDraw (const Standard_Boolean Synchronize=Standard_True)
 Flush all graphics to the front buffer.
Synchronize graphics to the screen if <synchronize> is
TRUE (make becarefull to the performances!).
.
Standard_EXPORT Standard_Boolean Restore (const Handle(Aspect_WindowDriver)&aDriver)
 Restore the full transient view,
returns TRUE if the transient area has been restored
correctly or FALSE if the view has been redrawn.
.
Standard_EXPORT Standard_Boolean RestoreArea (const Handle(Aspect_WindowDriver)&aDriver)
 Restore the last updated transient area,
returns TRUE if the transient area has been restored
correctly or FALSE if the view has been redrawn.
.
Standard_EXPORT void Draw (const Handle(Graphic2d_Primitive)&aPrimitive)
 Drawn the primitive <aprimitive>,
with the internal primitive attributes.
.
Standard_EXPORT void Draw (const Handle(Graphic2d_GraphicObject)&aGraphicObject)
 Drawn the graphic object <agraphicobject>.
with the internal graphic object primitives attributes.
.
Standard_EXPORT void DrawElement (const Handle(Graphic2d_Primitive)&aPrimitive, const Standard_Integer anIndex)
 Drawn the element <anindex> from the primitive <aprimitive>,
with the internal primitive attributes.
.
Standard_EXPORT void DrawPickedElements (const Handle(Graphic2d_Primitive)&aPrimitive)
 Draws all picked elements.
.
Standard_EXPORT void DrawVertex (const Handle(Graphic2d_Primitive)&aPrimitive, const Standard_Integer anIndex)
 Drawn the vertex <anindex> from the primitive <aprimitive>,
with the internal primitive attributes.
.
Standard_EXPORT void BeginPrimitive (const Aspect_TypeOfPrimitive aType, const Standard_Integer aSize=0)
 Sets the current type of primitive to be opened.
After this call, <me> is ready to receive
a definition of an incremental primitive
such as a polyline or polygon with DrawPoint(),
or the definition of a set of primitives such as
a segment with DrawSegment() or DrawMarker().
Warning: The max number of element of the primitive can be defined
with <asize> for optimization.
Example: This sequence drawn a polyline square of size 1.
myTransientManager->BeginDraw(myDriver)
myTransientManager->BeginPrimitive(Aspect_TOP_POLYLINE,5)
myTransientManager->DrawPoint(-0.5,-0.5)
myTransientManager->DrawPoint(-0.5, 0.5)
myTransientManager->DrawPoint( 0.5, 0.5)
myTransientManager->DrawPoint( 0.5,-0.5)
myTransientManager->DrawPoint(-0.5,-0.5)
myTransientManager->ClosePrimitive()
myTransientManager->EndDraw()
.
Standard_EXPORT void ClosePrimitive ()
 After this call, <me> stops the reception of
a definition of a Begin... primitive.
.
Standard_EXPORT void DrawSegment (const Quantity_Length X1, const Quantity_Length Y1, const Quantity_Length X2, const Quantity_Length Y2)
 Draw a segment.
.
Standard_EXPORT void DrawInfiniteLine (const Quantity_Length X, const Quantity_Length Y, const Quantity_Length Dx, const Quantity_Length Dy)
 Draw an infinite line defined by a reference point <X,Y>
and a slope <Dx,Dy>
.
Standard_EXPORT void DrawArc (const Quantity_Length Xc, const Quantity_Length Yc, const Quantity_Length aRadius, const Quantity_PlaneAngle anAngle1=0.0, const Quantity_PlaneAngle anAngle2=0.0)
 Draw a circle arc from the start angle <anangle1>
to the ending angle <anangle2>.
NOTE that if <anangle2> is equal to <anangle1>
a full circle is drawn.
.
Standard_EXPORT void DrawPolyArc (const Quantity_Length Xc, const Quantity_Length Yc, const Quantity_Length aRadius, const Quantity_PlaneAngle anAngle1=0.0, const Quantity_PlaneAngle anAngle2=0.0)
 Draw a filled circle arc from the start angle <anangle1>
to the ending angle <anangle2>.
NOTE that if <anangle2> is equal to <anangle1>
a full circle is drawn.
.
Standard_EXPORT void DrawPoint (const Quantity_Length X, const Quantity_Length Y)
 Draw a marker point.
.
Standard_EXPORT void DrawMarker (const Standard_Integer anIndex, const Quantity_Length X, const Quantity_Length Y, const Quantity_Length aWidth, const Quantity_Length anHeight, const Quantity_PlaneAngle anAngle=0.0)
 Draw an indexed marker.
.
Standard_EXPORT void DrawText (const TCollection_ExtendedString &aText, const Quantity_Length X, const Quantity_Length Y, const Quantity_PlaneAngle anAngle=0.0, const Standard_Real aDeltaX=0.0, const Standard_Real aDeltaY=0.0, const Aspect_TypeOfText aType=Aspect_TOT_SOLID, const Graphic2d_TypeOfAlignment anAlignment=Graphic2d_TOA_LEFT)
 Draw a text at the position <X,Y> added to
the untransformed drawer offset <aDeltaX,aDeltaY> ,
with an orientation <anangle> and a type <atype>.
.
Standard_EXPORT void DrawPolyText (const TCollection_ExtendedString &aText, const Quantity_Length X, const Quantity_Length Y, const Quantity_PlaneAngle anAngle=0.0, const Quantity_Ratio aMargin=0.1, const Standard_Real aDeltaX=0.0, const Standard_Real aDeltaY=0.0, const Aspect_TypeOfText aType=Aspect_TOT_SOLID, const Graphic2d_TypeOfAlignment anAlignment=Graphic2d_TOA_LEFT)
 Draw an hiding text at the position <X,Y> added to
the untransformed offset <aDeltaX,aDeltaY> ,
with an orientation <anangle> and a type <atype>.
<amargin> defined the relative margin factor between
the text string and the frame height.
.
Standard_EXPORT void DrawFramedText (const TCollection_ExtendedString &aText, const Quantity_Length X, const Quantity_Length Y, const Quantity_PlaneAngle anAngle=0.0, const Quantity_Ratio aMargin=0.1, const Standard_Real aDeltaX=0.0, const Standard_Real aDeltaY=0.0, const Aspect_TypeOfText aType=Aspect_TOT_SOLID, const Graphic2d_TypeOfAlignment anAlignment=Graphic2d_TOA_LEFT)
 Draw a framed text at the position <X,Y> added to
the untransformed offset <aDeltaX,aDeltaY> ,
with an orientation <anangle> and a type <atype>.
<amargin> defined the relative margin factor between
the text string and the frame height.
//! Draw a curve.
raises TransientDefinitionError from Graphic2d is static;
.
Standard_EXPORT void SetTextAttrib (const Standard_Integer ColorIndex, const Standard_Integer FontIndex, const Quantity_PlaneAngle aSlant=0.0, const Quantity_Factor aHScale=1.0, const Quantity_Factor aWScale=1.0, const Standard_Boolean isUnderlined=Standard_False, const Standard_Boolean isZoomable=Standard_True)
 Methods to define the Current Text Attributes
NOTE that ,if isZoomable is TRUE the text size follow
the scale factor of the view and the current transformation
scale factor.
.
Standard_EXPORT void SetHidingTextAttrib (const Standard_Integer ColorIndex, const Standard_Integer HidingColorIndex, const Standard_Integer FrameColorIndex, const Standard_Integer FrameWidthIndex, const Standard_Integer FontIndex, const Quantity_PlaneAngle aSlant=0.0, const Quantity_Factor aHScale=1.0, const Quantity_Factor aWScale=1.0, const Standard_Boolean isUnderlined=Standard_False, const Standard_Boolean isZoomable=Standard_True)
 Methods to define the Current Hiding Text Attributes
NOTE that ,if isZoomable is TRUE the text size follow
the scale factor of the view and the current transformation
scale factor.
.
Standard_EXPORT void SetFramedTextAttrib (const Standard_Integer ColorIndex, const Standard_Integer FrameColorIndex, const Standard_Integer FrameWidthIndex, const Standard_Integer FontIndex, const Quantity_PlaneAngle aSlant=0.0, const Quantity_Factor aHScale=1.0, const Quantity_Factor aWScale=1.0, const Standard_Boolean isUnderlined=Standard_False, const Standard_Boolean isZoomable=Standard_True)
 Methods to define the Current Framed Text Attributes
NOTE that ,if isZoomable is TRUE the text size follow
the scale factor of the view and the current transformation
scale factor.
.
Standard_EXPORT void SetTransform (const gp_GTrsf2d &aTrsf, const Graphic2d_TypeOfComposition aType=Graphic2d_TOC_REPLACE)
 Sets the current transformation <atrsf> applied to
the primitives.
.
Standard_EXPORT void SetMapping (const Standard_Boolean aStatus=Standard_True)
 Enable/Disable the mapping conversion between
the view and the driver system coordinates.
.
Standard_EXPORT Standard_Boolean MinMax (Quantity_Length &XMin, Quantity_Length &YMin, Quantity_Length &XMax, Quantity_Length &YMax) const
 Returns the world coordinates of the boundary box
of the Transient graphics actually drawn
since BeginDraw() has been call.
Warning: If nothing has been drawn then :
XMin = YMin = RealFirst ().
XMax = YMax = RealLast ().
and returns a min-max status to FALSE;
.
Standard_EXPORT gp_GTrsf2d Transform () const
 Returns the current transformation.
.
Standard_EXPORT const Handle (Standard_Type)&DynamicType() const

Private Member Functions

Standard_EXPORT void Redraw (const Handle(Aspect_WindowDriver)&aDriver)
 Redraw the view.
.
Standard_EXPORT void EnableMinMax (const Standard_Boolean aStatus=Standard_True, const Standard_Boolean Reset=Standard_True)
 Enable/Disable the min-max computation.
and reset the boundary-box if <reset> is TRUE.
.
Standard_EXPORT Standard_Boolean MinMax (Standard_Integer &aMinX, Standard_Integer &aMaxX, Standard_Integer &aMinY, Standard_Integer &aMaxY) const
 Returns TRUE if the returned pixel space min max
boundary box has been computed correctly arround
all the primitives drawn in the driver.
Warning: the boundary box size cannot be greater that
the associated window space size.
Returns FALSE if the min-max boundary box is NULL.
.

Private Attributes

Graphic2d_ViewPtr myPView
gp_GTrsf2d myTrsf
gp_GTrsf2d myCompositeTrsf
Graphic2d_TypeOfComposition myTypeOfComposition
Standard_Boolean myDrawingIsStarted
Standard_Boolean myTrsfIsDefined
Standard_Boolean myMappingIsEnable
Aspect_TypeOfPrimitive myTypeOfPrimitive

Constructor & Destructor Documentation

Standard_EXPORT Graphic2d_TransientManager::Graphic2d_TransientManager const Handle(Graphic2d_View)&  aView  ) 
 

Standard_EXPORT Graphic2d_TransientManager::Graphic2d_TransientManager const Graphic2d_ViewPtr aView  ) 
 

Graphic2d_TransientManager::~Graphic2d_TransientManager  )  [inline]
 


Member Function Documentation

Standard_EXPORT Standard_Boolean Graphic2d_TransientManager::BeginDraw const Handle(Aspect_WindowDriver)&  aDriver,
const Handle(Graphic2d_ViewMapping)&  aViewMapping,
const Standard_Real  aXPosition,
const Standard_Real  aYPosition,
const Standard_Real  aScale,
const Standard_Boolean  ClearBefore = Standard_True
 

Standard_EXPORT Standard_Boolean Graphic2d_TransientManager::BeginDraw const Handle(Aspect_WindowDriver)&  aDriver,
const Standard_Boolean  ClearBefore = Standard_True
 

Standard_EXPORT void Graphic2d_TransientManager::BeginPrimitive const Aspect_TypeOfPrimitive  aType,
const Standard_Integer  aSize = 0
 

Standard_EXPORT void Graphic2d_TransientManager::ClosePrimitive  ) 
 

Standard_EXPORT void Graphic2d_TransientManager::Destroy  ) 
 

Standard_EXPORT void Graphic2d_TransientManager::Draw const Handle(Graphic2d_GraphicObject)&  aGraphicObject  ) 
 

Standard_EXPORT void Graphic2d_TransientManager::Draw const Handle(Graphic2d_Primitive)&  aPrimitive  ) 
 

Standard_EXPORT void Graphic2d_TransientManager::DrawArc const Quantity_Length  Xc,
const Quantity_Length  Yc,
const Quantity_Length  aRadius,
const Quantity_PlaneAngle  anAngle1 = 0.0,
const Quantity_PlaneAngle  anAngle2 = 0.0
 

Standard_EXPORT void Graphic2d_TransientManager::DrawElement const Handle(Graphic2d_Primitive)&  aPrimitive,
const Standard_Integer  anIndex
 

Standard_EXPORT void Graphic2d_TransientManager::DrawFramedText const TCollection_ExtendedString &  aText,
const Quantity_Length  X,
const Quantity_Length  Y,
const Quantity_PlaneAngle  anAngle = 0.0,
const Quantity_Ratio  aMargin = 0.1,
const Standard_Real  aDeltaX = 0.0,
const Standard_Real  aDeltaY = 0.0,
const Aspect_TypeOfText  aType = Aspect_TOT_SOLID,
const Graphic2d_TypeOfAlignment  anAlignment = Graphic2d_TOA_LEFT
 

Standard_EXPORT void Graphic2d_TransientManager::DrawInfiniteLine const Quantity_Length  X,
const Quantity_Length  Y,
const Quantity_Length  Dx,
const Quantity_Length  Dy
 

Standard_EXPORT void Graphic2d_TransientManager::DrawMarker const Standard_Integer  anIndex,
const Quantity_Length  X,
const Quantity_Length  Y,
const Quantity_Length  aWidth,
const Quantity_Length  anHeight,
const Quantity_PlaneAngle  anAngle = 0.0
 

Standard_EXPORT void Graphic2d_TransientManager::DrawPickedElements const Handle(Graphic2d_Primitive)&  aPrimitive  ) 
 

Standard_EXPORT void Graphic2d_TransientManager::DrawPoint const Quantity_Length  X,
const Quantity_Length  Y
 

Standard_EXPORT void Graphic2d_TransientManager::DrawPolyArc const Quantity_Length  Xc,
const Quantity_Length  Yc,
const Quantity_Length  aRadius,
const Quantity_PlaneAngle  anAngle1 = 0.0,
const Quantity_PlaneAngle  anAngle2 = 0.0
 

Standard_EXPORT void Graphic2d_TransientManager::DrawPolyText const TCollection_ExtendedString &  aText,
const Quantity_Length  X,
const Quantity_Length  Y,
const Quantity_PlaneAngle  anAngle = 0.0,
const Quantity_Ratio  aMargin = 0.1,
const Standard_Real  aDeltaX = 0.0,
const Standard_Real  aDeltaY = 0.0,
const Aspect_TypeOfText  aType = Aspect_TOT_SOLID,
const Graphic2d_TypeOfAlignment  anAlignment = Graphic2d_TOA_LEFT
 

Standard_EXPORT void Graphic2d_TransientManager::DrawSegment const Quantity_Length  X1,
const Quantity_Length  Y1,
const Quantity_Length  X2,
const Quantity_Length  Y2
 

Standard_EXPORT void Graphic2d_TransientManager::DrawText const TCollection_ExtendedString &  aText,
const Quantity_Length  X,
const Quantity_Length  Y,
const Quantity_PlaneAngle  anAngle = 0.0,
const Standard_Real  aDeltaX = 0.0,
const Standard_Real  aDeltaY = 0.0,
const Aspect_TypeOfText  aType = Aspect_TOT_SOLID,
const Graphic2d_TypeOfAlignment  anAlignment = Graphic2d_TOA_LEFT
 

Standard_EXPORT void Graphic2d_TransientManager::DrawVertex const Handle(Graphic2d_Primitive)&  aPrimitive,
const Standard_Integer  anIndex
 

Standard_EXPORT void Graphic2d_TransientManager::EnableMinMax const Standard_Boolean  aStatus = Standard_True,
const Standard_Boolean  Reset = Standard_True
[private]
 

Standard_EXPORT void Graphic2d_TransientManager::EndDraw const Standard_Boolean  Synchronize = Standard_True  ) 
 

Standard_EXPORT const Graphic2d_TransientManager::Handle Standard_Type   )  const
 

Reimplemented from Graphic2d_Drawer.

Standard_EXPORT Standard_Boolean Graphic2d_TransientManager::MinMax Standard_Integer &  aMinX,
Standard_Integer &  aMaxX,
Standard_Integer &  aMinY,
Standard_Integer &  aMaxY
const [private]
 

Standard_EXPORT Standard_Boolean Graphic2d_TransientManager::MinMax Quantity_Length &  XMin,
Quantity_Length &  YMin,
Quantity_Length &  XMax,
Quantity_Length &  YMax
const
 

Standard_EXPORT void Graphic2d_TransientManager::Redraw const Handle(Aspect_WindowDriver)&  aDriver  )  [private]
 

Standard_EXPORT Standard_Boolean Graphic2d_TransientManager::Restore const Handle(Aspect_WindowDriver)&  aDriver  ) 
 

Standard_EXPORT Standard_Boolean Graphic2d_TransientManager::RestoreArea const Handle(Aspect_WindowDriver)&  aDriver  ) 
 

Standard_EXPORT void Graphic2d_TransientManager::SetFramedTextAttrib const Standard_Integer  ColorIndex,
const Standard_Integer  FrameColorIndex,
const Standard_Integer  FrameWidthIndex,
const Standard_Integer  FontIndex,
const Quantity_PlaneAngle  aSlant = 0.0,
const Quantity_Factor  aHScale = 1.0,
const Quantity_Factor  aWScale = 1.0,
const Standard_Boolean  isUnderlined = Standard_False,
const Standard_Boolean  isZoomable = Standard_True
 

Standard_EXPORT void Graphic2d_TransientManager::SetHidingTextAttrib const Standard_Integer  ColorIndex,
const Standard_Integer  HidingColorIndex,
const Standard_Integer  FrameColorIndex,
const Standard_Integer  FrameWidthIndex,
const Standard_Integer  FontIndex,
const Quantity_PlaneAngle  aSlant = 0.0,
const Quantity_Factor  aHScale = 1.0,
const Quantity_Factor  aWScale = 1.0,
const Standard_Boolean  isUnderlined = Standard_False,
const Standard_Boolean  isZoomable = Standard_True
 

Standard_EXPORT void Graphic2d_TransientManager::SetMapping const Standard_Boolean  aStatus = Standard_True  ) 
 

Standard_EXPORT void Graphic2d_TransientManager::SetTextAttrib const Standard_Integer  ColorIndex,
const Standard_Integer  FontIndex,
const Quantity_PlaneAngle  aSlant = 0.0,
const Quantity_Factor  aHScale = 1.0,
const Quantity_Factor  aWScale = 1.0,
const Standard_Boolean  isUnderlined = Standard_False,
const Standard_Boolean  isZoomable = Standard_True
 

Standard_EXPORT void Graphic2d_TransientManager::SetTransform const gp_GTrsf2d &  aTrsf,
const Graphic2d_TypeOfComposition  aType = Graphic2d_TOC_REPLACE
 

Standard_EXPORT gp_GTrsf2d Graphic2d_TransientManager::Transform  )  const
 


Field Documentation

gp_GTrsf2d Graphic2d_TransientManager::myCompositeTrsf [private]
 

Standard_Boolean Graphic2d_TransientManager::myDrawingIsStarted [private]
 

Standard_Boolean Graphic2d_TransientManager::myMappingIsEnable [private]
 

Graphic2d_ViewPtr Graphic2d_TransientManager::myPView [private]
 

gp_GTrsf2d Graphic2d_TransientManager::myTrsf [private]
 

Standard_Boolean Graphic2d_TransientManager::myTrsfIsDefined [private]
 

Graphic2d_TypeOfComposition Graphic2d_TransientManager::myTypeOfComposition [private]
 

Aspect_TypeOfPrimitive Graphic2d_TransientManager::myTypeOfPrimitive [private]
 


The documentation for this class was generated from the following file:
Generated on Mon Aug 25 13:55:37 2008 for OpenCASCADE by  doxygen 1.4.1