Open CASCADE Technology
6.5.4
|
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().
Remember that nothing is stored by this object and
graphic library,the application must managed itself
exposure,resizing,...
The double_buffering must be is activated on the view,
the back buffer is preserved and used for restoring
the front buffer at begin drawing time.
Keywords: TransientManager, Immediate Mode, Line, Polygon
Text, Marker
#include <Graphic2d_TransientManager.hxx>
Public Member Functions | |
Graphic2d_TransientManager (const Handle< Graphic2d_View > &aView) | |
Graphic2d_TransientManager (const Graphic2d_ViewPtr &aView) | |
Creates a TransientManager associated to the view <aView> | |
void | Destroy () |
Suppress the TransientManager <me>. | |
~Graphic2d_TransientManager () | |
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_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. | |
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_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_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. | |
void | Draw (const Handle< Graphic2d_Primitive > &aPrimitive) |
Drawn the primitive <aPrimitive>, with the internal primitive attributes. | |
void | Draw (const Handle< Graphic2d_GraphicObject > &aGraphicObject) |
Drawn the graphic object <aGraphicObject>. with the internal graphic object primitives attributes. | |
void | DrawElement (const Handle< Graphic2d_Primitive > &aPrimitive, const Standard_Integer anIndex) |
Drawn the element <anIndex> from the primitive <aPrimitive>, with the internal primitive attributes. | |
void | DrawPickedElements (const Handle< Graphic2d_Primitive > &aPrimitive) |
Draws all picked elements. | |
void | DrawVertex (const Handle< Graphic2d_Primitive > &aPrimitive, const Standard_Integer anIndex) |
Drawn the vertex <anIndex> from the primitive <aPrimitive>, with the internal primitive attributes. | |
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() | |
void | ClosePrimitive () |
After this call, <me> stops the reception of a definition of a Begin... primitive. | |
void | DrawSegment (const Quantity_Length X1, const Quantity_Length Y1, const Quantity_Length X2, const Quantity_Length Y2) |
Draw a segment. | |
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> | |
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. | |
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. | |
void | DrawPoint (const Quantity_Length X, const Quantity_Length Y) |
Draw a marker point. | |
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. | |
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>. | |
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. | |
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; | |
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. | |
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. | |
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. | |
void | SetTransform (const gp_GTrsf2d &aTrsf, const Graphic2d_TypeOfComposition aType=Graphic2d_TOC_REPLACE) |
Sets the current transformation <aTrsf> applied to the primitives. | |
void | SetMapping (const Standard_Boolean aStatus=Standard_True) |
Enable/Disable the mapping conversion between the view and the driver system coordinates. | |
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; | |
gp_GTrsf2d | Transform () const |
Returns the current transformation. |
Standard_Boolean Graphic2d_TransientManager::BeginDraw | ( | const Handle< Aspect_WindowDriver > & | aDriver, |
const Standard_Boolean | ClearBefore = Standard_True |
||
) |
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 |
||
) |
void Graphic2d_TransientManager::BeginPrimitive | ( | const Aspect_TypeOfPrimitive | aType, |
const Standard_Integer | aSize = 0 |
||
) |
void Graphic2d_TransientManager::Draw | ( | const Handle< Graphic2d_Primitive > & | aPrimitive | ) |
void Graphic2d_TransientManager::Draw | ( | const Handle< Graphic2d_GraphicObject > & | aGraphicObject | ) |
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 |
||
) |
void Graphic2d_TransientManager::DrawElement | ( | const Handle< Graphic2d_Primitive > & | aPrimitive, |
const Standard_Integer | anIndex | ||
) |
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 |
||
) |
void Graphic2d_TransientManager::DrawInfiniteLine | ( | const Quantity_Length | X, |
const Quantity_Length | Y, | ||
const Quantity_Length | Dx, | ||
const Quantity_Length | Dy | ||
) |
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 |
||
) |
void Graphic2d_TransientManager::DrawPickedElements | ( | const Handle< Graphic2d_Primitive > & | aPrimitive | ) |
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 |
||
) |
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 |
||
) |
void Graphic2d_TransientManager::DrawSegment | ( | const Quantity_Length | X1, |
const Quantity_Length | Y1, | ||
const Quantity_Length | X2, | ||
const Quantity_Length | Y2 | ||
) |
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 |
||
) |
void Graphic2d_TransientManager::DrawVertex | ( | const Handle< Graphic2d_Primitive > & | aPrimitive, |
const Standard_Integer | anIndex | ||
) |
void Graphic2d_TransientManager::EndDraw | ( | const Standard_Boolean | Synchronize = Standard_True | ) |
Standard_Boolean Graphic2d_TransientManager::MinMax | ( | Quantity_Length & | XMin, |
Quantity_Length & | YMin, | ||
Quantity_Length & | XMax, | ||
Quantity_Length & | YMax | ||
) | const |
Standard_Boolean Graphic2d_TransientManager::Restore | ( | const Handle< Aspect_WindowDriver > & | aDriver | ) |
Standard_Boolean Graphic2d_TransientManager::RestoreArea | ( | const Handle< Aspect_WindowDriver > & | aDriver | ) |
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 |
||
) |
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 |
||
) |
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 |
||
) |
void Graphic2d_TransientManager::SetTransform | ( | const gp_GTrsf2d & | aTrsf, |
const Graphic2d_TypeOfComposition | aType = Graphic2d_TOC_REPLACE |
||
) |