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

Visualization
TKV2d
Graphic2d


Graphic2d_Buffer Class Reference

This class constructs a 2D graphic buffer in a view. It
manages a set of graphic objects and/or primitives.
To draw the buffer, the following elements are required:
- the override color
- the font
- a solid line type
- thickness of 1 pixel.
With this category , the user can drag the geometry
stored in the buffer without changing the fixed
background. This mechanism is reserved for the
special driver Aspect_WindowDriver: if no other
driver has been defined, nothing will be drawn. Both
this driver and view mapping are used to draw the buffer.
Warning
- This class manages dragging only. It does not
manage "sketching" or "rubberbanding". For example:
- There is no empty constructor for this
primitive. Therefore we must create a primitive
in a dummy object simply to add this primitive to the buffer.
- There is no Buffer->Add (anArrayOfPoints)
method. Therefor it is not possible to add
shapes to the buffer.
- There are no Polyline->ChangeApoint () nor
Circle->ChangeRadius () methods. Therefore
we must call the primitive's destructor to modify
the definition of one primitive in a buffer.
- The Graphic2d_Image class is a primitive. For
this class, we replace the definition of the image
with a rectangle with the same size and the same position.
- You can add or remove primitives to the buffer
after creating and displaying it again.
.

#include <Graphic2d_Buffer.hxx>


Public Member Functions

Standard_EXPORT Graphic2d_Buffer (const Handle(Graphic2d_View)&aView, const Quantity_Length aPivotX, const Quantity_Length aPivotY, const Standard_Integer aWidthIndex=0, const Standard_Integer aColorIndex=0, const Standard_Integer aFontIndex=0, const Aspect_TypeOfDrawMode aDrawMode=Aspect_TODM_REPLACE)
 Creates an empty graphic buffer in the view <aview>.
A graphic buffer manages a set of graphic objects
and/or primitives.
A buffer color and font index can be defined,
in place of the default overrideColor or systemFont.
When the drawmode is REPLACE the buffer is drawn with
the right color and background drawing is used for
restoring it at Erase() time.
When the drawmode is XOR the buffer is drawn or erase
with an optimal color depending of the background color
but some side effects can appears depending of
background drawing pixels values.
.
Standard_EXPORT void Destroy ()
 Deletes the graphic buffer <me>.
.
 ~Graphic2d_Buffer ()
Standard_EXPORT void Add (const Handle(Graphic2d_GraphicObject)&anObject)
 Adds the graphic object <anobject> in the graphic
buffer <me>.
.
Standard_EXPORT void Add (const Handle(Graphic2d_Primitive)&aPrimitive)
 Adds the primitive <aprimitive> in the graphic
buffer <me>.
.
Standard_EXPORT void Remove (const Handle(Graphic2d_GraphicObject)&anObject)
 Removes the object <anobject> from the graphic
buffer <me>.
.
Standard_EXPORT void Remove (const Handle(Graphic2d_Primitive)&aPrimitive)
 Removes the primitive <aprimitive> from the graphic
buffer <me>.
.
Standard_EXPORT void Clear ()
 Clears the graphic buffer <me>.
Removes all the primitives from the graphic buffer <me>.
.
Standard_EXPORT void SetAttrib (const Standard_Integer aWidthIndex, const Standard_Integer aColorIndex, const Standard_Integer aFontIndex, const Aspect_TypeOfDrawMode aDrawMode)
 Updates the default buffer color with a new
color index defines in the user ColorMap.
Update the default buffer font with a new
font index defines in the user FontMap.
Update the default buffer drawmode with
REPLACE or XOR .
You can specify the width index
- -1 draw all lines with the largest width
defined in the buffer <me>
- 0 draw all lines with the default width
defined in the driver (1 pixel)
- draw all lines with the specified width
<awidthindex>
You can specify the color index
- -1 draw all primitives with the color of
the first primitive color defined in the buffer.
- 0 draw all primitives with the default color.
You can specify the font index
- -1 draw all text primitives with the font of
the first primitive text defined in the buffer.
- 0 draw all text primitives with the default font.
Warning: The buffer is redisplayed again if it was posted.
.
Standard_EXPORT void SetPivot (const Quantity_Length aPivotX, const Quantity_Length aPivotY)
 Updates the buffer pivot position.
Warning: The buffer is redisplayed again if it was posted.
.
Standard_EXPORT void SetPivot ()
 Updates the buffer pivot position with the actual position.
.
Standard_EXPORT void Move (const Quantity_Length aDeltaX, const Quantity_Length aDeltaY)
 Moves the graphic buffer <me> at the specified
position. The new position of the buffer is :
(<apivotx> + <adeltax>, <apivoty> + <adeltay>)
.
Standard_EXPORT void Rotate (const Quantity_PlaneAngle anAngle)
 Rotates the graphic buffer <me> with the specified
absolute counter clockwise angle from the pivot X axis.
.
Standard_EXPORT void Scale (const Quantity_Factor aFactor)
 Scales the graphic buffer <me> with the specified
absolute scale factor from the pivot point.
.
Standard_EXPORT Handle_Graphic2d_View View () const
 Returns the view which manages the graphic buffer <me>.
.
Standard_EXPORT Standard_Boolean IsEmpty () const
 Returns Standard_True if the graphic buffer <me>
is empty, Standard_False if not.
.
Standard_EXPORT Standard_Boolean IsIn (const Handle(Graphic2d_Primitive)&aPrimitive) const
 Returns Standard_True if the primitive <aprimitive>
is in the graphic buffer <me>, Standard_False if not.
.
Standard_EXPORT Standard_Boolean IsIn (const Handle(Graphic2d_GraphicObject)&anObject) const
 Returns Standard_True if the graphic object <anobject>
is in the graphic buffer <me>, Standard_False if not.
.
Standard_EXPORT void Post ()
 Post the graphic buffer in the current View driver
and display it.
Warning: The view driver must be defined and of type WindowDriver
or nothing is drawn .
.
Standard_EXPORT void Post (const Handle(Aspect_WindowDriver)&aDriver, const Handle(Graphic2d_ViewMapping)&aViewMapping, const Standard_Real aXPosition, const Standard_Real aYPosition, const Standard_Real aScale)
 Post the graphic buffer in a View driver and display it.
.
Standard_EXPORT void UnPost ()
 Unpost the graphic buffer from the view and erase it.
.
Standard_EXPORT Standard_Boolean IsPosted () const
 Returns Standard_True if the graphic buffer <me>
is posted in the view, Standard_False if not.
.
Standard_EXPORT Quantity_PlaneAngle Angle () const
 Returns the value of the rotation angle of the
graphic buffer <me>.
.
Standard_EXPORT Quantity_Factor Scale () const
 Returns the value of the scale factor of the
graphic buffer <me>.
.
Standard_EXPORT Quantity_Length Xpivot () const
 Returns the actual value of the X pivot point.
of the graphic buffer <me>.
.
Standard_EXPORT Quantity_Length Ypivot () const
 Returns the actual value of the Y pivot point.
of the graphic buffer <me>.
.
Standard_EXPORT const Handle (Standard_Type)&DynamicType() const

Private Member Functions

Standard_EXPORT Standard_Boolean IsPosted (const Handle(Aspect_WindowDriver)&aDriver) const
 Returns Standard_True if the graphic buffer <me>
is posted in the view with the driver <adriver>,
Standard_False if not.
.
Standard_EXPORT void Draw ()
 Update the internal buffer with new primitives
if any and draw it at screen.
.
Standard_EXPORT void Erase ()
 Erase the internal buffer from the screen.
.
Standard_EXPORT void ReLoad (const Standard_Boolean ResetPosition=Standard_True)
 Erase and Reload the internal graphic buffer before
drawing to the current drawer.
Keep the actual position if <resetposition> is FALSE.
.
Standard_EXPORT Standard_Boolean MaxWidth (Quantity_Length &theWidth, Standard_Integer &theIndex) const
 Returns Standard_True if the buffer contains
lines and the maximum width of the lines in the
buffer <me>
.

Private Attributes

Standard_Integer myBufferId
Standard_Boolean myBufferIsPosted
Handle_Aspect_WindowDriver myDriver
Standard_ShortReal myPivotX
Standard_ShortReal myPivotY
Standard_Integer myWidthIndex
Standard_Integer myColorIndex
Standard_Integer myFontIndex
Aspect_TypeOfDrawMode myDrawMode
Graphic2d_ViewPtr myPView
Graphic2d_SequenceOfPrimitives myPrimitives
Graphic2d_SequenceOfGraphicObject myObjects


Constructor & Destructor Documentation

Standard_EXPORT Graphic2d_Buffer::Graphic2d_Buffer const Handle(Graphic2d_View)&  aView,
const Quantity_Length  aPivotX,
const Quantity_Length  aPivotY,
const Standard_Integer  aWidthIndex = 0,
const Standard_Integer  aColorIndex = 0,
const Standard_Integer  aFontIndex = 0,
const Aspect_TypeOfDrawMode  aDrawMode = Aspect_TODM_REPLACE
 

Graphic2d_Buffer::~Graphic2d_Buffer  )  [inline]
 


Member Function Documentation

Standard_EXPORT void Graphic2d_Buffer::Add const Handle(Graphic2d_Primitive)&  aPrimitive  ) 
 

Standard_EXPORT void Graphic2d_Buffer::Add const Handle(Graphic2d_GraphicObject)&  anObject  ) 
 

Standard_EXPORT Quantity_PlaneAngle Graphic2d_Buffer::Angle  )  const
 

Standard_EXPORT void Graphic2d_Buffer::Clear  ) 
 

Standard_EXPORT void Graphic2d_Buffer::Destroy  ) 
 

Standard_EXPORT void Graphic2d_Buffer::Draw  )  [private]
 

Standard_EXPORT void Graphic2d_Buffer::Erase  )  [private]
 

Standard_EXPORT const Graphic2d_Buffer::Handle Standard_Type   )  const
 

Standard_EXPORT Standard_Boolean Graphic2d_Buffer::IsEmpty  )  const
 

Standard_EXPORT Standard_Boolean Graphic2d_Buffer::IsIn const Handle(Graphic2d_GraphicObject)&  anObject  )  const
 

Standard_EXPORT Standard_Boolean Graphic2d_Buffer::IsIn const Handle(Graphic2d_Primitive)&  aPrimitive  )  const
 

Standard_EXPORT Standard_Boolean Graphic2d_Buffer::IsPosted const Handle(Aspect_WindowDriver)&  aDriver  )  const [private]
 

Standard_EXPORT Standard_Boolean Graphic2d_Buffer::IsPosted  )  const
 

Standard_EXPORT Standard_Boolean Graphic2d_Buffer::MaxWidth Quantity_Length &  theWidth,
Standard_Integer &  theIndex
const [private]
 

Standard_EXPORT void Graphic2d_Buffer::Move const Quantity_Length  aDeltaX,
const Quantity_Length  aDeltaY
 

Standard_EXPORT void Graphic2d_Buffer::Post const Handle(Aspect_WindowDriver)&  aDriver,
const Handle(Graphic2d_ViewMapping)&  aViewMapping,
const Standard_Real  aXPosition,
const Standard_Real  aYPosition,
const Standard_Real  aScale
 

Standard_EXPORT void Graphic2d_Buffer::Post  ) 
 

Standard_EXPORT void Graphic2d_Buffer::ReLoad const Standard_Boolean  ResetPosition = Standard_True  )  [private]
 

Standard_EXPORT void Graphic2d_Buffer::Remove const Handle(Graphic2d_Primitive)&  aPrimitive  ) 
 

Standard_EXPORT void Graphic2d_Buffer::Remove const Handle(Graphic2d_GraphicObject)&  anObject  ) 
 

Standard_EXPORT void Graphic2d_Buffer::Rotate const Quantity_PlaneAngle  anAngle  ) 
 

Standard_EXPORT Quantity_Factor Graphic2d_Buffer::Scale  )  const
 

Standard_EXPORT void Graphic2d_Buffer::Scale const Quantity_Factor  aFactor  ) 
 

Standard_EXPORT void Graphic2d_Buffer::SetAttrib const Standard_Integer  aWidthIndex,
const Standard_Integer  aColorIndex,
const Standard_Integer  aFontIndex,
const Aspect_TypeOfDrawMode  aDrawMode
 

Standard_EXPORT void Graphic2d_Buffer::SetPivot  ) 
 

Standard_EXPORT void Graphic2d_Buffer::SetPivot const Quantity_Length  aPivotX,
const Quantity_Length  aPivotY
 

Standard_EXPORT void Graphic2d_Buffer::UnPost  ) 
 

Standard_EXPORT Handle_Graphic2d_View Graphic2d_Buffer::View  )  const
 

Standard_EXPORT Quantity_Length Graphic2d_Buffer::Xpivot  )  const
 

Standard_EXPORT Quantity_Length Graphic2d_Buffer::Ypivot  )  const
 


Field Documentation

Standard_Integer Graphic2d_Buffer::myBufferId [private]
 

Standard_Boolean Graphic2d_Buffer::myBufferIsPosted [private]
 

Standard_Integer Graphic2d_Buffer::myColorIndex [private]
 

Aspect_TypeOfDrawMode Graphic2d_Buffer::myDrawMode [private]
 

Handle_Aspect_WindowDriver Graphic2d_Buffer::myDriver [private]
 

Standard_Integer Graphic2d_Buffer::myFontIndex [private]
 

Graphic2d_SequenceOfGraphicObject Graphic2d_Buffer::myObjects [private]
 

Standard_ShortReal Graphic2d_Buffer::myPivotX [private]
 

Standard_ShortReal Graphic2d_Buffer::myPivotY [private]
 

Graphic2d_SequenceOfPrimitives Graphic2d_Buffer::myPrimitives [private]
 

Graphic2d_ViewPtr Graphic2d_Buffer::myPView [private]
 

Standard_Integer Graphic2d_Buffer::myWidthIndex [private]
 


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