1 // Created on: 2017-07-25
2 // Created by: Anastasia BOBYLEVA
3 // Copyright (c) 2017-2019 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _AIS_ViewCube_HeaderFile
17 #define _AIS_ViewCube_HeaderFile
19 #include <AIS_InteractiveObject.hxx>
20 #include <Graphic3d_Camera.hxx>
21 #include <Graphic3d_Vec2.hxx>
22 #include <Prs3d_DatumParts.hxx>
23 #include <Prs3d_ShadingAspect.hxx>
24 #include <Prs3d_TextAspect.hxx>
25 #include <SelectMgr_EntityOwner.hxx>
26 #include <V3d_TypeOfOrientation.hxx>
28 class AIS_AnimationCamera;
29 class AIS_ViewCubeOwner;
30 class Graphic3d_ArrayOfTriangles;
33 //! Interactive object for displaying the view manipulation cube.
35 //! View cube consists of several parts that are responsible for different camera manipulations:
36 //! @li Cube sides represent main views: top, bottom, left, right, front and back.
37 //! @li Edges represent rotation of one of main views on 45 degrees.
38 //! @li Vertices represent rotation of one of man views in two directions.
40 //! The object is expected to behave like a trihedron in the view corner,
41 //! therefore its position should be defined using transformation persistence flags:
42 //! @code SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_LOWER, Graphic3d_Vec2i (100, 100)); @endcode
44 //! View Cube parts are sensitive to detection, or dynamic highlighting (but not selection),
45 //! and every its owner AIS_ViewCubeOwner corresponds to camera transformation.
47 //! for (aViewCube->StartAnimation (aDetectedOwner); aViewCube->HasAnimation(); )
49 //! aViewCube->UpdateAnimation();
50 //! ... // updating of application window
54 //! @code aViewCube->HandleClick (aDetectedOwner); @endcode
55 //! that includes transformation loop.
56 //! This loop allows external actions like application updating. For this purpose AIS_ViewCube has virtual interface onAfterAnimation(),
57 //! that is to be redefined on application level.
58 class AIS_ViewCube : public AIS_InteractiveObject
60 DEFINE_STANDARD_RTTIEXT(AIS_ViewCube, AIS_InteractiveObject)
63 //! Return TRUE if specified orientation belongs to box side.
64 Standard_EXPORT static bool IsBoxSide (V3d_TypeOfOrientation theOrient);
66 //! Return TRUE if specified orientation belongs to box edge.
67 Standard_EXPORT static bool IsBoxEdge (V3d_TypeOfOrientation theOrient);
69 //! Return TRUE if specified orientation belongs to box corner (vertex).
70 Standard_EXPORT static bool IsBoxCorner (V3d_TypeOfOrientation theOrient);
74 //! Empty constructor.
75 Standard_EXPORT AIS_ViewCube();
77 //! Return view animation.
78 const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; }
80 //! Set view animation.
81 void SetViewAnimation (const Handle(AIS_AnimationCamera)& theAnimation) { myViewAnimation = theAnimation; }
83 //! Return TRUE if automatic camera transformation on selection (highlighting) is enabled; TRUE by default.
84 Standard_Boolean ToAutoStartAnimation() const { return myToAutoStartAnim; }
86 //! Enable/disable automatic camera transformation on selection (highlighting).
87 //! The automatic logic can be disabled if application wants performing action manually
88 //! basing on picking results (AIS_ViewCubeOwner).
89 void SetAutoStartAnimation (bool theToEnable) { myToAutoStartAnim = theToEnable; }
91 //! Return TRUE if camera animation should be done in uninterruptible loop; TRUE by default.
92 Standard_Boolean IsFixedAnimationLoop() const { return myIsFixedAnimation; }
94 //! Set if camera animation should be done in uninterruptible loop.
95 void SetFixedAnimationLoop (bool theToEnable) { myIsFixedAnimation = theToEnable; }
97 //! Reset all size and style parameters to default.
98 //! @warning It doesn't reset position of View Cube
99 Standard_EXPORT void ResetStyles();
103 //! Set default visual attributes
104 Standard_EXPORT void setDefaultAttributes();
106 //! Set default dynamic highlight properties
107 Standard_EXPORT void setDefaultHighlightAttributes();
109 public: //! @name Geometry management API
111 //! @return size (width and height) of View cube sides; 100 by default.
112 Standard_Real Size() const { return mySize; }
114 //! Sets size (width and height) of View cube sides.
115 //! @param theToAdaptAnother if TRUE, then other parameters will be adapted to specified size
116 Standard_EXPORT void SetSize (Standard_Real theValue,
117 Standard_Boolean theToAdaptAnother = true);
119 //! Return box facet extension to edge/corner facet split; 10 by default.
120 Standard_Real BoxFacetExtension() const { return myBoxFacetExtension; }
122 //! Set new value of box facet extension.
123 void SetBoxFacetExtension (Standard_Real theValue)
125 if (Abs (myBoxFacetExtension - theValue) > Precision::Confusion())
127 myBoxFacetExtension = theValue;
132 //! Return padding between axes and 3D part (box); 10 by default.
133 Standard_Real AxesPadding() const { return myAxesPadding; }
135 //! Set new value of padding between axes and 3D part (box).
136 void SetAxesPadding (Standard_Real theValue)
138 if (Abs (myAxesPadding - theValue) > Precision::Confusion())
140 myAxesPadding = theValue;
145 //! Return gap between box edges and box sides; 0 by default.
146 Standard_Real BoxEdgeGap() const { return myBoxEdgeGap; }
148 //! Set new value of box edges gap.
149 void SetBoxEdgeGap (Standard_Real theValue)
151 if (Abs (myBoxEdgeGap - theValue) > Precision::Confusion())
153 myBoxEdgeGap = theValue;
158 //! Return minimal size of box edge; 2 by default.
159 Standard_Real BoxEdgeMinSize() const { return myBoxEdgeMinSize; }
161 //! Set new value of box edge minimal size.
162 void SetBoxEdgeMinSize (Standard_Real theValue)
164 if (Abs (myBoxEdgeMinSize - theValue) > Precision::Confusion())
166 myBoxEdgeMinSize = theValue;
171 //! Return minimal size of box corner; 2 by default.
172 Standard_Real BoxCornerMinSize() const { return myCornerMinSize; }
174 //! Set new value of box corner minimal size.
175 void SetBoxCornerMinSize (Standard_Real theValue)
177 if (Abs (myCornerMinSize - theValue) > Precision::Confusion())
179 myCornerMinSize = theValue;
184 //! Return relative radius of side corners (round rectangle); 0.0 by default.
185 //! The value in within [0, 0.5] range meaning absolute radius = RoundRadius() / Size().
186 Standard_Real RoundRadius() const { return myRoundRadius; }
188 //! Set relative radius of View Cube sides corners (round rectangle).
189 //! The value should be within [0, 0.5] range.
190 Standard_EXPORT void SetRoundRadius (const Standard_Real theValue);
192 //! @return TRUE if trihedron is drawn; TRUE by default.
193 Standard_Boolean ToDrawAxes() const { return myToDisplayAxes; }
195 //! Enable/disable drawing of trihedron.
196 void SetDrawAxes (Standard_Boolean theValue)
198 if (myToDisplayAxes != theValue)
200 myToDisplayAxes = theValue;
205 //! @return TRUE if edges of View Cube is drawn; TRUE by default.
206 Standard_Boolean ToDrawEdges() const { return myToDisplayEdges; }
208 //! Enable/disable drawing of edges of View Cube.
209 void SetDrawEdges (Standard_Boolean theValue)
211 if (myToDisplayEdges != theValue)
213 myToDisplayEdges = theValue;
218 //! Return TRUE if vertices (vertex) of View Cube is drawn; TRUE by default.
219 Standard_Boolean ToDrawVertices() const { return myToDisplayVertices; }
221 //! Enable/disable drawing of vertices (corners) of View Cube.
222 void SetDrawVertices (Standard_Boolean theValue)
224 if (myToDisplayVertices != theValue)
226 myToDisplayVertices = theValue;
231 //! Return TRUE if application expects Y-up viewer orientation instead of Z-up; FALSE by default.
232 Standard_Boolean IsYup() const { return myIsYup; }
234 //! Set if application expects Y-up viewer orientation instead of Z-up.
235 Standard_EXPORT void SetYup (Standard_Boolean theIsYup,
236 Standard_Boolean theToUpdateLabels = Standard_True);
238 public: //! @name Style management API
240 //! Return shading style of box sides.
241 const Handle(Prs3d_ShadingAspect)& BoxSideStyle() const { return myDrawer->ShadingAspect(); }
243 //! Return shading style of box edges.
244 const Handle(Prs3d_ShadingAspect)& BoxEdgeStyle() const { return myBoxEdgeAspect; }
246 //! Return shading style of box corners.
247 const Handle(Prs3d_ShadingAspect)& BoxCornerStyle() const { return myBoxCornerAspect; }
249 //! Return value of front color for the 3D part of object.
250 const Quantity_Color& BoxColor() const { return myDrawer->ShadingAspect()->Color(); }
252 //! Set new value of front color for the 3D part of object.
253 //! @param theColor [in] input color value.
254 void SetBoxColor (const Quantity_Color& theColor)
256 if (!myDrawer->ShadingAspect()->Color().IsEqual (theColor)
257 || !myBoxEdgeAspect ->Color().IsEqual (theColor)
258 || !myBoxCornerAspect->Color().IsEqual (theColor))
260 myDrawer->ShadingAspect()->SetColor (theColor);
261 myBoxEdgeAspect->SetColor (theColor);
262 myBoxCornerAspect->SetColor (theColor);
263 SynchronizeAspects();
267 //! Return transparency for 3D part of object.
268 Standard_Real BoxTransparency() const { return myDrawer->ShadingAspect()->Transparency(); }
270 //! Set new value of transparency for 3D part of object.
271 //! @param theValue [in] input transparency value
272 void SetBoxTransparency (Standard_Real theValue)
274 if (Abs (myDrawer->ShadingAspect()->Transparency() - theValue) > Precision::Confusion()
275 || Abs (myBoxEdgeAspect ->Transparency() - theValue) > Precision::Confusion()
276 || Abs (myBoxCornerAspect->Transparency() - theValue) > Precision::Confusion())
278 myDrawer->ShadingAspect()->SetTransparency (theValue);
279 myBoxEdgeAspect->SetTransparency (theValue);
280 myBoxCornerAspect->SetTransparency (theValue);
281 SynchronizeAspects();
285 //! Return color of sides back material.
286 const Quantity_Color& InnerColor() const { return myDrawer->ShadingAspect()->Color (Aspect_TOFM_BACK_SIDE); }
288 //! Set color of sides back material. Alias for:
289 //! @code Attributes()->ShadingAspect()->Aspect()->ChangeBackMaterial().SetColor() @endcode
290 void SetInnerColor (const Quantity_Color& theColor)
292 myDrawer->ShadingAspect()->SetColor (theColor, Aspect_TOFM_BACK_SIDE);
293 SynchronizeAspects();
296 //! Return box side label or empty string if undefined.
297 //! Default labels: FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM.
298 TCollection_AsciiString BoxSideLabel (V3d_TypeOfOrientation theSide) const
300 const TCollection_AsciiString* aLabel = myBoxSideLabels.Seek (theSide);
301 return aLabel != NULL ? *aLabel : TCollection_AsciiString();
304 //! Set box side label.
305 void SetBoxSideLabel (const V3d_TypeOfOrientation theSide,
306 const TCollection_AsciiString& theLabel)
308 if (!IsBoxSide (theSide))
310 throw Standard_ProgramError ("AIS_ViewCube::SetBoxSideLabel(), invalid enumeration value");
312 myBoxSideLabels.Bind (theSide, theLabel);
316 //! Return text color of labels of box sides; BLACK by default.
317 const Quantity_Color& TextColor() const { return myDrawer->TextAspect()->Aspect()->Color(); }
319 //! Set color of text labels on box sides. Alias for:
320 //! @code Attributes()->TextAspect()->SetColor() @endcode
321 void SetTextColor (const Quantity_Color& theColor)
323 myDrawer->TextAspect()->SetColor (theColor);
324 SynchronizeAspects();
327 //! Return font name that is used for displaying of sides and axes text. Alias for:
328 //! @code Attributes()->TextAspect()->Aspect()->SetFont() @endcode
329 const TCollection_AsciiString& Font() const { return myDrawer->TextAspect()->Aspect()->Font(); }
331 //! Set font name that is used for displaying of sides and axes text. Alias for:
332 //! @code Attributes()->TextAspect()->SetFont() @endcode
333 void SetFont (const TCollection_AsciiString& theFont)
335 myDrawer->TextAspect()->Aspect()->SetFont (theFont);
336 SynchronizeAspects();
339 //! Return height of font
340 Standard_Real FontHeight() const { return myDrawer->TextAspect()->Height(); }
342 //! Change font height. Alias for:
343 //! @code Attributes()->TextAspect()->SetHeight() @endcode
344 void SetFontHeight (Standard_Real theValue)
346 if (Abs (myDrawer->TextAspect()->Height() - theValue) > Precision::Confusion())
348 myDrawer->TextAspect()->SetHeight (theValue);
353 //! Return axes labels or empty string if undefined.
354 //! Default labels: X, Y, Z.
355 TCollection_AsciiString AxisLabel (Prs3d_DatumParts theAxis) const
357 const TCollection_AsciiString* aLabel = myAxesLabels.Seek (theAxis);
358 return aLabel != NULL ? *aLabel : TCollection_AsciiString();
362 void SetAxesLabels (const TCollection_AsciiString& theX,
363 const TCollection_AsciiString& theY,
364 const TCollection_AsciiString& theZ)
366 myAxesLabels.Bind (Prs3d_DP_XAxis, theX);
367 myAxesLabels.Bind (Prs3d_DP_YAxis, theY);
368 myAxesLabels.Bind (Prs3d_DP_ZAxis, theZ);
374 //! Set new value of color for the whole object.
375 //! @param theColor [in] input color value.
376 virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE
378 SetBoxColor (theColor);
381 //! Reset color for the whole object.
382 virtual void UnsetColor() Standard_OVERRIDE
384 myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
385 myBoxEdgeAspect ->SetColor (Quantity_NOC_GRAY30);
386 myBoxCornerAspect->SetColor (Quantity_NOC_GRAY30);
387 SynchronizeAspects();
390 //! Set new value of transparency for the whole object.
391 //! @param theValue [in] input transparency value.
392 virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE
394 SetBoxTransparency (theValue);
397 //! Reset transparency for the whole object.
398 virtual void UnsetTransparency() Standard_OVERRIDE
400 SetBoxTransparency (0.0f);
403 //! Sets the material for the interactive object.
404 virtual void SetMaterial (const Graphic3d_MaterialAspect& theMat) Standard_OVERRIDE
406 myDrawer->ShadingAspect()->SetMaterial (theMat);
407 myBoxEdgeAspect ->SetMaterial (theMat);
408 myBoxCornerAspect->SetMaterial (theMat);
409 SynchronizeAspects();
412 //! Sets the material for the interactive object.
413 virtual void UnsetMaterial() Standard_OVERRIDE
415 Graphic3d_MaterialAspect aMat (Graphic3d_NOM_UserDefined);
416 aMat.SetColor (Quantity_NOC_WHITE);
417 aMat.SetAmbientColor (Quantity_NOC_GRAY60);
418 myDrawer->ShadingAspect()->SetMaterial (aMat);
419 myBoxEdgeAspect ->SetMaterial (aMat);
420 myBoxEdgeAspect ->SetColor (Quantity_NOC_GRAY30);
421 myBoxCornerAspect->SetMaterial (aMat);
422 myBoxCornerAspect->SetColor (Quantity_NOC_GRAY30);
423 SynchronizeAspects();
426 public: //! @name animation methods
428 //! Return duration of animation in seconds; 0.5 sec by default
429 Standard_Real Duration() const { return myDuration; }
431 //! Set duration of animation.
432 //! @param theValue [in] input value of duration in seconds
433 void SetDuration (Standard_Real theValue) { myDuration = theValue; }
435 //! Return TRUE if new camera Up direction should be always set to default value for a new camera Direction; FALSE by default.
436 //! When this flag is FALSE, the new camera Up will be set as current Up orthogonalized to the new camera Direction,
437 //! and will set to default Up on second click.
438 Standard_Boolean ToResetCameraUp() const { return myToResetCameraUp; }
440 //! Set if new camera Up direction should be always set to default value for a new camera Direction.
441 void SetResetCamera (Standard_Boolean theToReset) { myToResetCameraUp = theToReset; }
443 //! Return TRUE if animation should fit selected objects and FALSE to fit entire scene; TRUE by default.
444 Standard_Boolean ToFitSelected() const { return myToFitSelected; }
446 //! Set if animation should fit selected objects or to fit entire scene.
447 void SetFitSelected (Standard_Boolean theToFitSelected) { myToFitSelected = theToFitSelected; }
449 //! @return TRUE if View Cube has unfinished animation of view camera.
450 Standard_EXPORT Standard_Boolean HasAnimation() const;
452 //! Start camera transformation corresponding to the input detected owner.
453 //! @param theOwner [in] detected owner.
454 Standard_EXPORT virtual void StartAnimation (const Handle(AIS_ViewCubeOwner)& theOwner);
456 //! Perform one step of current camera transformation.
457 //! theToUpdate [in] enable/disable update of view.
458 //! @return TRUE if animation is not stopped.
459 Standard_EXPORT virtual Standard_Boolean UpdateAnimation (const Standard_Boolean theToUpdate);
461 //! Perform camera transformation corresponding to the input detected owner.
462 Standard_EXPORT virtual void HandleClick (const Handle(AIS_ViewCubeOwner)& theOwner);
466 //! Perform internal single step of animation.
467 //! @return FALSE if animation has been finished
468 Standard_EXPORT Standard_Boolean updateAnimation();
470 //! Fit selected/all into view.
471 //! @param theView [in] view definition to retrieve scene bounding box
472 //! @param theCamera [in,out] camera definition
473 Standard_EXPORT virtual void viewFitAll (const Handle(V3d_View)& theView,
474 const Handle(Graphic3d_Camera)& theCamera);
476 protected: //! @name protected virtual API
478 //! Method that is called after one step of transformation.
479 virtual void onAfterAnimation() {}
481 //! Method that is called after transformation finish.
482 virtual void onAnimationFinished() {}
484 public: //! @name Presentation computation
486 //! Return TRUE for supported display mode.
487 virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
489 //! Global selection has no meaning for this class.
490 virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE { return Handle(SelectMgr_EntityOwner)(); }
492 //! Compute 3D part of View Cube.
493 //! @param thePrsMgr [in] presentation manager.
494 //! @param thePrs [in] input presentation that is to be filled with flat presentation primitives.
495 //! @param theMode [in] display mode.
496 //! @warning this object accept only 0 display mode.
497 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
498 const Handle(Prs3d_Presentation)& thePrs,
499 const Standard_Integer theMode = 0) Standard_OVERRIDE;
501 //! Redefine computing of sensitive entities for View Cube.
502 //! @param theSelection [in] input selection object that is to be filled with sensitive entities.
503 //! @param theMode [in] selection mode.
504 //! @warning object accepts only 0 selection mode.
505 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
506 const Standard_Integer theMode) Standard_OVERRIDE;
508 //! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
509 virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return Standard_False; }
511 //! Method which clear all selected owners belonging to this selectable object.
512 //! @warning this object does not support selection.
513 virtual void ClearSelected() Standard_OVERRIDE {}
515 //! Method which highlights input owner belonging to this selectable object.
516 //! @param thePM [in] presentation manager
517 //! @param theStyle [in] style for dynamic highlighting.
518 //! @param theOwner [in] input entity owner.
519 Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
520 const Handle(Prs3d_Drawer)& theStyle,
521 const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
523 //! Method which draws selected owners.
524 Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM,
525 const SelectMgr_SequenceOfOwner& theSeq) Standard_OVERRIDE;
527 //! Set default parameters for visual attributes
529 virtual void UnsetAttributes() Standard_OVERRIDE
531 setDefaultAttributes();
535 //! Set default parameters for dynamic highlighting attributes, reset highlight attributes
536 virtual void UnsetHilightAttributes() Standard_OVERRIDE
538 myHilightDrawer.Nullify();
539 setDefaultHighlightAttributes();
543 protected: //! @name Auxiliary classes to fill presentation with proper primitives
545 //! Create triangulation for a box part - for presentation and selection purposes.
546 //! @param theTris [in,out] triangulation to fill, or NULL to return size
547 //! @param theNbNodes [in,out] should be incremented by a number of nodes defining this triangulation
548 //! @param theNbTris [in,out] should be incremented by a number of triangles defining this triangulation
549 //! @param theDir [in] part to define
550 Standard_EXPORT virtual void createBoxPartTriangles (const Handle(Graphic3d_ArrayOfTriangles)& theTris,
551 Standard_Integer& theNbNodes,
552 Standard_Integer& theNbTris,
553 V3d_TypeOfOrientation theDir) const;
555 //! Create triangulation for a box side.
556 //! @param theTris [in,out] triangulation to fill, or NULL to return size
557 //! @param theNbNodes [in,out] should be incremented by a number of nodes defining this triangulation
558 //! @param theNbTris [in,out] should be incremented by a number of triangles defining this triangulation
559 //! @param theDir [in] part to define
560 Standard_EXPORT virtual void createBoxSideTriangles (const Handle(Graphic3d_ArrayOfTriangles)& theTris,
561 Standard_Integer& theNbNodes,
562 Standard_Integer& theNbTris,
563 V3d_TypeOfOrientation theDir) const;
565 //! Create triangulation for a box edge.
566 //! @param theTris [in,out] triangulation to fill, or NULL to return size
567 //! @param theNbNodes [in,out] should be incremented by a number of nodes defining this triangulation
568 //! @param theNbTris [in,out] should be incremented by a number of triangles defining this triangulation
569 //! @param theDir [in] part to define
570 Standard_EXPORT virtual void createBoxEdgeTriangles (const Handle(Graphic3d_ArrayOfTriangles)& theTris,
571 Standard_Integer& theNbNodes,
572 Standard_Integer& theNbTris,
573 V3d_TypeOfOrientation theDir) const;
575 //! Create triangulation for a box corner (vertex).
576 //! @param theTris [in,out] triangulation to fill, or NULL to return size
577 //! @param theNbNodes [in,out] should be incremented by a number of nodes defining this triangulation
578 //! @param theNbTris [in,out] should be incremented by a number of triangles defining this triangulation
579 //! @param theDir [in] part to define
580 Standard_EXPORT virtual void createBoxCornerTriangles (const Handle(Graphic3d_ArrayOfTriangles)& theTris,
581 Standard_Integer& theNbNodes,
582 Standard_Integer& theNbTris,
583 V3d_TypeOfOrientation theDir) const;
587 //! Create triangulation for a rectangle with round corners.
588 //! @param theTris [in,out] triangulation to fill, or NULL to return size
589 //! @param theNbNodes [in,out] should be incremented by a number of nodes defining this triangulation
590 //! @param theNbTris [in,out] should be incremented by a number of triangles defining this triangulation
591 //! @param theSize [in] rectangle dimensions
592 //! @param theRadius [in] radius at corners
593 //! @param theTrsf [in] transformation
594 Standard_EXPORT static void createRoundRectangleTriangles (const Handle(Graphic3d_ArrayOfTriangles)& theTris,
595 Standard_Integer& theNbNodes,
596 Standard_Integer& theNbTris,
597 const gp_XY& theSize,
598 Standard_Real theRadius,
599 const gp_Trsf& theTrsf);
603 //! Trivial hasher to avoid ambiguity with enumeration type.
606 static Standard_Integer HashCode (Standard_Integer theValue, Standard_Integer theUpper) { return ::HashCode (theValue, theUpper); }
607 static Standard_Boolean IsEqual (Standard_Integer theA, Standard_Integer theB) { return theA == theB; }
612 NCollection_DataMap<V3d_TypeOfOrientation, TCollection_AsciiString, IntegerHasher>
613 myBoxSideLabels; //!< map with box side labels
614 NCollection_DataMap<Prs3d_DatumParts, TCollection_AsciiString, IntegerHasher>
615 myAxesLabels; //!< map with axes labels
616 Handle(Prs3d_ShadingAspect) myBoxEdgeAspect; //!< style for box edges
617 Handle(Prs3d_ShadingAspect) myBoxCornerAspect; //!< style for box corner
619 Standard_Real mySize; //!< size of box side, length of one axis
620 Standard_Real myBoxEdgeMinSize; //!< minimal size of box edge
621 Standard_Real myBoxEdgeGap; //!< gap between box side and box edge
622 Standard_Real myBoxFacetExtension; //!< box facet extension
623 Standard_Real myAxesPadding; //!< Padding between box and axes
624 Standard_Real myCornerMinSize; //!< minimal size of box corner
625 Standard_Real myRoundRadius; //!< relative round radius within [0; 0.5] range
626 Standard_Boolean myToDisplayAxes; //!< trihedron visibility
627 Standard_Boolean myToDisplayEdges; //!< box edges visibility
628 Standard_Boolean myToDisplayVertices; //!< box corners (vertices) visibility
629 Standard_Boolean myIsYup; //!< flag indicating that application expects Y-up viewer orientation instead of Z-up
631 protected: //! @name Animation options
633 Handle(AIS_AnimationCamera) myViewAnimation; //!< Camera animation object
634 Handle(Graphic3d_Camera) myStartState; //!< Start state of view camera
635 Handle(Graphic3d_Camera) myEndState; //!< End state of view camera
636 Standard_Real myDuration; //!< Duration of animation. By default it is half a second
637 Standard_Boolean myToAutoStartAnim; //!< start animation automatically on click
638 Standard_Boolean myIsFixedAnimation; //!< fixed-loop animation
639 Standard_Boolean myToFitSelected; //!< fit selected or fit entire scene
640 Standard_Boolean myToResetCameraUp; //!< always reset camera up direction to default
644 //! Redefined entity owner that is highlighted when owner is detected,
645 //! even if Interactive Context highlighted on last detection procedure.
646 class AIS_ViewCubeOwner : public SelectMgr_EntityOwner
648 DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner)
651 //! Main constructor.
652 AIS_ViewCubeOwner (const Handle(AIS_ViewCube)& theObject,
653 V3d_TypeOfOrientation theOrient,
654 Standard_Integer thePriority = 5)
655 : SelectMgr_EntityOwner ((const Handle(SelectMgr_SelectableObject)& )theObject, thePriority),
656 myMainOrient (theOrient)
658 myFromDecomposition = true;
661 //! @return TRUE. This owner will always call method
662 //! Hilight for its Selectable Object when the owner is detected.
663 virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE { return Standard_True; }
665 //! Return new orientation to set.
666 V3d_TypeOfOrientation MainOrientation() const { return myMainOrient; }
668 //! Handle mouse button click event.
669 virtual Standard_Boolean HandleMouseClick (const Graphic3d_Vec2i& thePoint,
670 Aspect_VKeyMouse theButton,
671 Aspect_VKeyFlags theModifiers,
672 bool theIsDoubleClick) Standard_OVERRIDE
674 (void )thePoint; (void )theButton; (void )theModifiers; (void )theIsDoubleClick;
675 AIS_ViewCube* aCubePrs = dynamic_cast<AIS_ViewCube* >(mySelectable);
676 aCubePrs->HandleClick (this);
677 return Standard_True;
682 V3d_TypeOfOrientation myMainOrient; //!< new orientation to set
686 #endif // _AIS_ViewCube_HeaderFile