27 #ifndef GEOM_Annotation_HeaderFile
28 #define GEOM_Annotation_HeaderFile
30 #include <AIS_InteractiveObject.hxx>
31 #include <Bnd_Box.hxx>
32 #include <Font_FontAspect.hxx>
34 #include <NCollection_Handle.hxx>
35 #include <NCollection_String.hxx>
36 #include <OpenGl_Element.hxx>
37 #include <Prs3d_Presentation.hxx>
38 #include <Prs3d_LineAspect.hxx>
39 #include <Prs3d_TextAspect.hxx>
40 #include <PrsMgr_PresentationManager3d.hxx>
41 #include <Select3D_SensitiveBox.hxx>
42 #include <SelectMgr_EntityOwner.hxx>
43 #include <StdSelect_Shape.hxx>
44 #include <TCollection_ExtendedString.hxx>
46 #include <Basics_OCCTVersion.hxx>
47 #if OCC_VERSION_LARGE >= 0x07040000
48 #include <Graphic3d_Text.hxx>
50 #include <OpenGl_TextParam.hxx>
53 class OpenGl_GraphicDriver;
54 class OpenGl_PrimitiveArray;
87 Standard_EXPORT
void SetText(
const TCollection_ExtendedString& theText );
98 Standard_EXPORT
void SetPosition(
const gp_Pnt& thePosition );
140 Standard_EXPORT
virtual void SetColor(
const Quantity_Color& theColor ) Standard_OVERRIDE;
143 Standard_EXPORT
void SetTextColor(
const Quantity_Color& theColor );
146 Quantity_Color
GetTextColor()
const {
return myDrawer->TextAspect()->Aspect()->Color(); }
149 Standard_EXPORT
void SetLineColor(
const Quantity_Color& theColor);
152 Quantity_Color
GetLineColor()
const {
return myDrawer->LineAspect()->Aspect()->Color(); }
155 Standard_EXPORT
void SetLineWidth(
const Standard_Real theLineWidth );
158 Standard_Real
GetLineWidth()
const {
return myDrawer->LineAspect()->Aspect()->Width(); }
161 Standard_EXPORT
void SetLineStyle(
const Aspect_TypeOfLine theStyle );
164 Aspect_TypeOfLine
GetLineStyle()
const {
return myDrawer->LineAspect()->Aspect()->Type(); }
170 Aspect_TypeOfLine
GetHiddenLineStyle()
const {
return myDrawer->HiddenLineAspect()->Aspect()->Type(); }
173 Standard_EXPORT
void SetTextHeight(
const Standard_Real theHeight );
176 Standard_Real
GetTextHeight()
const {
return myDrawer->TextAspect()->Height(); }
179 Standard_EXPORT
void SetFontAspect(
const Font_FontAspect theFontAspect );
182 Font_FontAspect
GetFontAspect()
const {
return myDrawer->TextAspect()->Aspect()->GetTextFontAspect(); }
185 Standard_EXPORT
void SetFont(
const TCollection_AsciiString& theFont );
188 TCollection_AsciiString
GetFont()
const {
return myDrawer->TextAspect()->Aspect()->Font(); }
211 Standard_EXPORT
void SetDepthCulling(
const Standard_Boolean theToEnable );
228 Standard_EXPORT
static gp_Pnt
GetDefaultPosition(
const Standard_Boolean theIsScreenFixed,
229 const gp_Pnt& theAttachPnt,
230 const Standard_Real theOffset,
231 const Handle(V3d_View)& theView );
238 const gp_Pnt& theAttach,
239 const Handle(V3d_View)& theView );
246 const gp_Pnt& theAttach,
247 const Handle(V3d_View)& theView );
258 Standard_EXPORT
void Drag(
const Standard_Integer theDx,
259 const Standard_Integer theDy,
260 const Handle(V3d_View)& theView );
263 Standard_EXPORT
void EndDrag();
270 virtual void Compute(
const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
271 const Handle(Prs3d_Presentation)& thePresentation,
272 const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
275 const Standard_Integer theMode ) Standard_OVERRIDE;
277 #if OCC_VERSION_LARGE >= 0x070400ff
287 void SetPosition(
const gp_Pnt& thePosition,
const Standard_Boolean theUpdateSelection );
315 const Standard_Integer theTextHeight,
316 const OpenGl_GraphicDriver* theDriver );
322 virtual void Release( OpenGl_Context* theCtx ) Standard_OVERRIDE;
325 virtual void Render(
const Handle(OpenGl_Workspace)& theWorkspace )
const Standard_OVERRIDE;
340 #if OCC_VERSION_LARGE >= 0x07040000
367 const Handle(SelectMgr_SelectableObject)& theSelectable,
368 const Standard_Integer thePriority )
378 const Handle(Prs3d_Drawer)& theStyle,
379 const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
384 const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
389 Clear ( const
Handle(PrsMgr_PresentationManager)& thePM,
390 const Standard_Integer theMode = 0 ) Standard_OVERRIDE;
406 const Bnd_Box& theBox,
407 const Standard_Boolean theIsDepthCulling )
412 virtual Standard_Boolean
Matches( SelectBasics_SelectingVolumeManager& theMgr,
413 SelectBasics_PickResult& thePickResult ) Standard_OVERRIDE
415 const Standard_Boolean isMatches = Select3D_SensitiveBox::Matches( theMgr, thePickResult );
418 thePickResult = SelectBasics_PickResult( -DBL_MAX, thePickResult.DistToGeomCenter(), thePickResult.PickedPoint() );
Handle(TColStd_HSequenceOfTransient) AdvancedEngine_IOperations
Create a T-shape object with specified caracteristics for the main and the incident pipes (radius,...
Definition: AdvancedEngine_IOperations.cxx:1907
DEFINE_STANDARD_HANDLE(GEOM_Field, GEOM_BaseObject) DEFINE_STANDARD_HANDLE(GEOM_FieldStep
Custom entity owner implementing correct highlight for topmost mode.
Definition: GEOM_Annotation.hxx:362
TopoDS_Shape myShape
Definition: GEOM_Annotation.hxx:394
GEOM_AnnotationOwner(const TopoDS_Shape &theShape, const Handle(SelectMgr_SelectableObject)&theSelectable, const Standard_Integer thePriority)
Constructor.
Definition: GEOM_Annotation.hxx:366
virtual void HilightWithColor(const Handle(PrsMgr_PresentationManager3d)&thePM, const Handle(Prs3d_Drawer)&theStyle, const Standard_Integer theMode=0) Standard_OVERRIDE
Perform highlighting of the presentation.
Definition: GEOM_Annotation.cxx:913
virtual void Unhilight(const Handle(PrsMgr_PresentationManager)&thePM, const Standard_Integer theMode=0) Standard_OVERRIDE
Removes highlighting from the type of shape.
Definition: GEOM_Annotation.cxx:949
virtual void Clear(const Handle(PrsMgr_PresentationManager)&thePM, const Standard_Integer theMode=0) Standard_OVERRIDE
Clears the presentation manager object aPM of all shapes with the given selection mode.
Definition: GEOM_Annotation.cxx:962
Handle(StdSelect_Shape) myPrsSh
Custom sensitive entity with implementing option to support selection with depth culling flag turned ...
Definition: GEOM_Annotation.hxx:401
Standard_Boolean myIsDepthCulling
Definition: GEOM_Annotation.hxx:425
GEOM_AnnotationSensEntity(const Handle(SelectMgr_EntityOwner)&theOwner, const Bnd_Box &theBox, const Standard_Boolean theIsDepthCulling)
Constructor.
Definition: GEOM_Annotation.hxx:405
virtual Standard_Boolean Matches(SelectBasics_SelectingVolumeManager &theMgr, SelectBasics_PickResult &thePickResult) Standard_OVERRIDE
Checks whether the box overlaps current selecting volume.
Definition: GEOM_Annotation.hxx:412
Custom element implementing dynamic rendering of 3D annotation and invoking dynamic callback in prese...
Definition: GEOM_Annotation.hxx:306
unsigned int myTextDPI
Text's DPI scale used for last rendering.
Definition: GEOM_Annotation.hxx:353
virtual void Release(OpenGl_Context *theCtx) Standard_OVERRIDE
Releases GL resources with the given GL context.
Definition: GEOM_Annotation.cxx:680
OpenGl_Text * myTextDraw
Text draw element.
Definition: GEOM_Annotation.hxx:345
virtual void Render(const Handle(OpenGl_Workspace)&theWorkspace) const Standard_OVERRIDE
Renders the annotation graphical elements.
Definition: GEOM_Annotation.cxx:700
virtual ~OpenGl_Annotation()
Destructor. Releases GL resources with NULL context.
Definition: GEOM_Annotation.cxx:670
OpenGl_PrimitiveArray * myExtLineDraw
Extension line draw element.
Definition: GEOM_Annotation.hxx:347
GEOM_Annotation * myAISObject
Instance of presentation class.
Definition: GEOM_Annotation.hxx:338
void SetDepthMode(const int theMode)
Definition: GEOM_Annotation.hxx:327
OpenGl_Annotation(GEOM_Annotation *theAnnotation, const Standard_Integer theTextHeight, const OpenGl_GraphicDriver *theDriver)
Constructor.
Definition: GEOM_Annotation.cxx:625
int myDepthMode
Depth mode for drawing hidden line presentation.
Definition: GEOM_Annotation.hxx:349
Graphic3d_Vec2 myTextUnderline
Text's underline position.
Definition: GEOM_Annotation.hxx:352
OpenGl_PrimitiveArray * myTextLineDraw
Text underline draw element.
Definition: GEOM_Annotation.hxx:346
OpenGl_TextParam myTextParams
Text draw parameters.
Definition: GEOM_Annotation.hxx:343
TextSize myTextSize
Text's size parameters.
Definition: GEOM_Annotation.hxx:351
OpenGl_PrimitiveArray * myExtMarkerDraw
Extension marker draw element.
Definition: GEOM_Annotation.hxx:348
float myTextLineY
Text's underlines relative position.
Definition: GEOM_Annotation.hxx:350
NCollection_String myText
Text string of annotation label.
Definition: GEOM_Annotation.hxx:339
Interactive object, representating annotation entity.
Definition: GEOM_Annotation.hxx:63
gp_Pnt myStartPosition
Position before starting dragging operation.
Definition: GEOM_Annotation.hxx:293
Standard_EXPORT void SetText(const TCollection_ExtendedString &theText)
Sets annotation text string.
Definition: GEOM_Annotation.cxx:96
Standard_Boolean myIsScreenFixed
Flag indicating whether "screen fixed" positioning mode is turned on or off.
Definition: GEOM_Annotation.hxx:294
Standard_EXPORT GEOM_Annotation()
Constructor.
Standard_EXPORT void SetDefaultZLayer()
Restores default z-layer for this presentation.
Definition: GEOM_Annotation.cxx:365
Aspect_TypeOfLine GetLineStyle() const
Retusn style of connection line.
Definition: GEOM_Annotation.hxx:164
gp_Pnt myAttach
Attachment point of extension line.
Definition: GEOM_Annotation.hxx:291
Standard_Boolean myIsAutoHide
Flag indicating whether "auto-hiding" option is turned on.
Definition: GEOM_Annotation.hxx:295
Standard_EXPORT void SetLineColor(const Quantity_Color &theColor)
Sets line's color.
Definition: GEOM_Annotation.cxx:253
virtual void Compute(const Handle(PrsMgr_PresentationManager3d)&thePresentationManager, const Handle(Prs3d_Presentation)&thePresentation, const Standard_Integer theMode=0) Standard_OVERRIDE
Definition: GEOM_Annotation.cxx:445
void SetAutoHide(const Standard_Boolean theIsEnable)
Sets annotation auto-hiding option.
Definition: GEOM_Annotation.hxx:194
Standard_EXPORT void SetHiddenLineStyle(const Aspect_TypeOfLine theStyle)
Sets style of hidden connection line.
Definition: GEOM_Annotation.cxx:295
Standard_EXPORT void SetFont(const TCollection_AsciiString &theFont)
Sets font used for drawing the label.
Definition: GEOM_Annotation.cxx:337
virtual void setLocalTransformation(const Handle(Geom_Transformation)&) Standard_OVERRIDE
Definition: GEOM_Annotation.hxx:280
Standard_EXPORT void SetIsScreenFixed(const Standard_Boolean theIsFixed)
Sets or disables "2D screen fixed" positioning mode.
Definition: GEOM_Annotation.cxx:143
Standard_EXPORT void Set3dPosition(const Handle(V3d_View)&theView)
Converts annotation position from screen fixed coordinates to 3D position and modifies its "2D screen...
Definition: GEOM_Annotation.cxx:189
const TCollection_ExtendedString & GetText() const
Returns annotation text string.
Definition: GEOM_Annotation.hxx:90
const gp_Pnt & GetAttachPoint() const
Returns attachment point of extension line.
Definition: GEOM_Annotation.hxx:129
Standard_EXPORT void SetAttachPoint(const gp_Pnt &thePoint)
Sets attachment point of extension line.
Definition: GEOM_Annotation.cxx:207
Standard_Boolean GetAutoHide() const
Returns current state of the auto-hiding option.
Definition: GEOM_Annotation.hxx:197
Standard_EXPORT void SetHilightShape(const TopoDS_Shape &theShape)
Sets shape (annotated shape) that will be used for highlighting.
Definition: GEOM_Annotation.cxx:216
Standard_EXPORT void SetDepthCulling(const Standard_Boolean theToEnable)
Sets special flag that allows disabling depth testing when rendering the graphical presentation.
Definition: GEOM_Annotation.cxx:351
Standard_Boolean GetDepthCulling() const
Returns depth culling state.
Definition: GEOM_Annotation.hxx:214
Standard_Real GetLineWidth() const
Returns line width for drawing the annotation's extension line and underline.
Definition: GEOM_Annotation.hxx:158
Aspect_TypeOfLine GetHiddenLineStyle() const
Retusn style of hidden connection line.
Definition: GEOM_Annotation.hxx:170
Standard_EXPORT void BeginDrag()
Prepares necessary data to perform dragging.
Definition: GEOM_Annotation.cxx:571
void SetHighlightMode(const HighlightMode theMode)
Sets highlight mode used for display of presentation.
Definition: GEOM_Annotation.hxx:201
virtual ~GEOM_Annotation()
Destructor.
Definition: GEOM_Annotation.hxx:83
HighlightMode GetHilightMode() const
Returns highlight mode.
Definition: GEOM_Annotation.hxx:204
Font_FontAspect GetFontAspect() const
Returns label's font aspect.
Definition: GEOM_Annotation.hxx:182
TCollection_ExtendedString myText
Text string of the label presentation.
Definition: GEOM_Annotation.hxx:298
Standard_EXPORT void EndDrag()
Perform necessary update when dragging is finished.
Definition: GEOM_Annotation.cxx:606
Standard_EXPORT void SetLineWidth(const Standard_Real theLineWidth)
Sets line width to be used for drawing the annotation's extension line and underline.
Definition: GEOM_Annotation.cxx:266
Standard_EXPORT void SetLineStyle(const Aspect_TypeOfLine theStyle)
Sets style of connection line.
Definition: GEOM_Annotation.cxx:281
static Standard_EXPORT gp_Pnt GetDefaultPosition(const Standard_Boolean theIsScreenFixed, const gp_Pnt &theAttachPnt, const Standard_Real theOffset, const Handle(V3d_View)&theView)
Returns default position for placing annotation when its attachment point has been determined.
Definition: GEOM_Annotation.cxx:376
HighlightMode myHilightMode
Highlight mode for presentation.
Definition: GEOM_Annotation.hxx:297
static Standard_EXPORT gp_Pnt ConvertPosition2d(const gp_Pnt &thePosition, const gp_Pnt &theAttach, const Handle(V3d_View)&theView)
Converts 3d position to 2d on screen point.
Definition: GEOM_Annotation.cxx:407
virtual void SetTransformPersistence(const Handle(Graphic3d_TransformPers)&) Standard_OVERRIDE
Definition: GEOM_Annotation.hxx:283
Quantity_Color GetTextColor() const
Returns color for the text's label.
Definition: GEOM_Annotation.hxx:146
Standard_EXPORT void Drag(const Standard_Integer theDx, const Standard_Integer theDy, const Handle(V3d_View)&theView)
Drags annotation presentation in the screen plane using the given pixel delta.
Definition: GEOM_Annotation.cxx:580
DEFINE_STANDARD_RTTIEXT(GEOM_Annotation, AIS_InteractiveObject) enum HighlightMode
Enumerates supported highlighting modes.
Definition: GEOM_Annotation.hxx:66
TCollection_AsciiString GetFont() const
Returns font used for drawing the label.
Definition: GEOM_Annotation.hxx:188
TopoDS_Shape myShape
Highlighting shape.
Definition: GEOM_Annotation.hxx:299
const TopoDS_Shape HilightShape() const
Returns the highlighting shape.
Definition: GEOM_Annotation.hxx:135
gp_Pnt myPosition
Position of text label.
Definition: GEOM_Annotation.hxx:292
virtual Standard_EXPORT void SetColor(const Quantity_Color &theColor) Standard_OVERRIDE
Sets color for the presentation.
Definition: GEOM_Annotation.cxx:232
const gp_Pnt & GetPosition() const
Returns position of the annotation text label.
Definition: GEOM_Annotation.hxx:101
Standard_EXPORT void Set2dPosition(const Handle(V3d_View)&theView)
Converts annotation position to screen fixed coordinates and modifies its "2D screen fixed" flag corr...
Definition: GEOM_Annotation.cxx:171
Bnd_Box TextBoundingBox() const
Definition: GEOM_Annotation.cxx:537
Standard_EXPORT void SetTextColor(const Quantity_Color &theColor)
Sets text color.
Definition: GEOM_Annotation.cxx:242
virtual void ComputeSelection(const Handle(SelectMgr_Selection)&theSelection, const Standard_Integer theMode) Standard_OVERRIDE
Definition: GEOM_Annotation.cxx:508
Standard_Real GetTextHeight() const
Returns text's height in pixels.
Definition: GEOM_Annotation.hxx:176
Standard_EXPORT void SetTextHeight(const Standard_Real theHeight)
Sets text height in pixels.
Definition: GEOM_Annotation.cxx:309
Standard_EXPORT void UndoDrag()
Perform necessary update when dragging need undo.
Definition: GEOM_Annotation.cxx:615
Standard_EXPORT void SetPosition(const gp_Pnt &thePosition)
Sets position of the annotation text label.
Definition: GEOM_Annotation.cxx:110
static Standard_EXPORT gp_Pnt ConvertPosition3d(const gp_Pnt &thePosition, const gp_Pnt &theAttach, const Handle(V3d_View)&theView)
Converts 2d position to 3d point.
Definition: GEOM_Annotation.cxx:426
Standard_EXPORT void SetFontAspect(const Font_FontAspect theFontAspect)
Sets font aspect for label.
Definition: GEOM_Annotation.cxx:323
Standard_Boolean GetIsScreenFixed() const
Returns value of "screen fixed" positioning mode.
Definition: GEOM_Annotation.hxx:110
Standard_Boolean myIsDepthCulling
Flag indicating whether the "depth culling" is turned on.
Definition: GEOM_Annotation.hxx:296
Quantity_Color GetLineColor() const
Returns color for the connection line.
Definition: GEOM_Annotation.hxx:152
Definition: GEOM_Annotation.hxx:331
float d
Definition: GEOM_Annotation.hxx:335
float a
Definition: GEOM_Annotation.hxx:334
float x
Definition: GEOM_Annotation.hxx:332
float y
Definition: GEOM_Annotation.hxx:333