0030869: Modeling Data - BRepAdaptor_CompCurve incorrectly evaluates the boundary...
[occt.git] / src / AIS / AIS_ViewCube.hxx
CommitLineData
2108d9a2 1// Created on: 2017-07-25
2// Created by: Anastasia BOBYLEVA
3// Copyright (c) 2017-2019 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _AIS_ViewCube_HeaderFile
17#define _AIS_ViewCube_HeaderFile
18
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>
27
28class AIS_AnimationCamera;
29class AIS_ViewCubeOwner;
30class Graphic3d_ArrayOfTriangles;
31
32//! Interactive object for displaying the view manipulation cube.
33//!
34//! View cube consists of several parts that are responsible for different camera manipulations:
35//! @li Cube sides represent main views: top, bottom, left, right, front and back.
36//! @li Edges represent rotation of one of main views on 45 degrees.
37//! @li Vertices represent rotation of one of man views in two directions.
38//!
39//! The object is expected to behave like a trihedron in the view corner,
40//! therefore its position should be defined using transformation persistence flags:
41//! @code SetTransformPersistence (new Graphic3d_TransformPers (Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_LOWER, Graphic3d_Vec2i (100, 100)); @endcode
42//!
43//! View Cube parts are sensitive to detection, or dynamic highlighting (but not selection),
44//! and every its owner AIS_ViewCubeOwner corresponds to camera transformation.
45//! @code
46//! for (aViewCube->StartAnimation (aDetectedOwner); aViewCube->HasAnimation(); )
47//! {
48//! aViewCube->UpdateAnimation();
49//! ... // updating of application window
50//! }
51//! @endcode
52//! or
53//! @code aViewCube->HandleClick (aDetectedOwner); @endcode
54//! that includes transformation loop.
55//! This loop allows external actions like application updating. For this purpose AIS_ViewCube has virtual interface onAfterAnimation(),
56//! that is to be redefined on application level.
57class AIS_ViewCube : public AIS_InteractiveObject
58{
59 DEFINE_STANDARD_RTTIEXT(AIS_ViewCube, AIS_InteractiveObject)
60public:
61
62 //! Return TRUE if specified orientation belongs to box side.
63 Standard_EXPORT static bool IsBoxSide (V3d_TypeOfOrientation theOrient);
64
65 //! Return TRUE if specified orientation belongs to box edge.
66 Standard_EXPORT static bool IsBoxEdge (V3d_TypeOfOrientation theOrient);
67
68 //! Return TRUE if specified orientation belongs to box corner (vertex).
69 Standard_EXPORT static bool IsBoxCorner (V3d_TypeOfOrientation theOrient);
70
71public:
72
73 //! Empty constructor.
74 Standard_EXPORT AIS_ViewCube();
75
76 //! Return view animation.
77 const Handle(AIS_AnimationCamera)& ViewAnimation() const { return myViewAnimation; }
78
79 //! Set view animation.
80 void SetViewAnimation (const Handle(AIS_AnimationCamera)& theAnimation) { myViewAnimation = theAnimation; }
81
82 //! Return TRUE if automatic camera transformation on selection (highlighting) is enabled; TRUE by default.
83 Standard_Boolean ToAutoStartAnimation() const { return myToAutoStartAnim; }
84
85 //! Enable/disable automatic camera transformation on selection (highlighting).
86 //! The automatic logic can be disabled if application wants performing action manually
87 //! basing on picking results (AIS_ViewCubeOwner).
88 void SetAutoStartAnimation (bool theToEnable) { myToAutoStartAnim = theToEnable; }
89
90 //! Return TRUE if camera animation should be done in uninterruptible loop; TRUE by default.
91 Standard_Boolean IsFixedAnimationLoop() const { return myIsFixedAnimation; }
92
93 //! Set if camera animation should be done in uninterruptible loop.
94 void SetFixedAnimationLoop (bool theToEnable) { myIsFixedAnimation = theToEnable; }
95
96 //! Reset all size and style parameters to default.
97 //! @warning It doesn't reset position of View Cube
98 Standard_EXPORT void ResetStyles();
99
100protected:
101
102 //! Set default visual attributes
103 Standard_EXPORT void setDefaultAttributes();
104
105 //! Set default dynamic highlight properties
106 Standard_EXPORT void setDefaultHighlightAttributes();
107
108public: //! @name Geometry management API
109
110 //! @return size (width and height) of View cube sides; 100 by default.
111 Standard_Real Size() const { return mySize; }
112
113 //! Sets size (width and height) of View cube sides.
114 //! @param theToAdaptAnother if TRUE, then other parameters will be adapted to specified size
115 Standard_EXPORT void SetSize (Standard_Real theValue,
116 Standard_Boolean theToAdaptAnother = true);
117
118 //! Return box facet extension to edge/corner facet split; 10 by default.
119 Standard_Real BoxFacetExtension() const { return myBoxFacetExtension; }
120
121 //! Set new value of box facet extension.
122 void SetBoxFacetExtension (Standard_Real theValue)
123 {
124 if (Abs (myBoxFacetExtension - theValue) > Precision::Confusion())
125 {
126 myBoxFacetExtension = theValue;
127 SetToUpdate();
128 }
129 }
130
131 //! Return padding between axes and 3D part (box); 10 by default.
132 Standard_Real AxesPadding() const { return myAxesPadding; }
133
134 //! Set new value of padding between axes and 3D part (box).
135 void SetAxesPadding (Standard_Real theValue)
136 {
137 if (Abs (myAxesPadding - theValue) > Precision::Confusion())
138 {
139 myAxesPadding = theValue;
140 SetToUpdate();
141 }
142 }
143
144 //! Return gap between box edges and box sides; 0 by default.
145 Standard_Real BoxEdgeGap() const { return myBoxEdgeGap; }
146
147 //! Set new value of box edges gap.
148 void SetBoxEdgeGap (Standard_Real theValue)
149 {
150 if (Abs (myBoxEdgeGap - theValue) > Precision::Confusion())
151 {
152 myBoxEdgeGap = theValue;
153 SetToUpdate();
154 }
155 }
156
157 //! Return minimal size of box edge; 2 by default.
158 Standard_Real BoxEdgeMinSize() const { return myBoxEdgeMinSize; }
159
160 //! Set new value of box edge minimal size.
161 void SetBoxEdgeMinSize (Standard_Real theValue)
162 {
163 if (Abs (myBoxEdgeMinSize - theValue) > Precision::Confusion())
164 {
165 myBoxEdgeMinSize = theValue;
166 SetToUpdate();
167 }
168 }
169
170 //! Return minimal size of box corner; 2 by default.
171 Standard_Real BoxCornerMinSize() const { return myCornerMinSize; }
172
173 //! Set new value of box corner minimal size.
174 void SetBoxCornerMinSize (Standard_Real theValue)
175 {
176 if (Abs (myCornerMinSize - theValue) > Precision::Confusion())
177 {
178 myCornerMinSize = theValue;
179 SetToUpdate();
180 }
181 }
182
183 //! Return relative radius of side corners (round rectangle); 0.0 by default.
184 //! The value in within [0, 0.5] range meaning absolute radius = RoundRadius() / Size().
185 Standard_Real RoundRadius() const { return myRoundRadius; }
186
187 //! Set relative radius of View Cube sides corners (round rectangle).
188 //! The value should be within [0, 0.5] range.
189 Standard_EXPORT void SetRoundRadius (const Standard_Real theValue);
190
191 //! @return TRUE if trihedron is drawn; TRUE by default.
192 Standard_Boolean ToDrawAxes() const { return myToDisplayAxes; }
193
194 //! Enable/disable drawing of trihedron.
195 void SetDrawAxes (Standard_Boolean theValue)
196 {
197 if (myToDisplayAxes != theValue)
198 {
199 myToDisplayAxes = theValue;
200 SetToUpdate();
201 }
202 }
203
204 //! @return TRUE if edges of View Cube is drawn; TRUE by default.
205 Standard_Boolean ToDrawEdges() const { return myToDisplayEdges; }
206
207 //! Enable/disable drawing of edges of View Cube.
208 void SetDrawEdges (Standard_Boolean theValue)
209 {
210 if (myToDisplayEdges != theValue)
211 {
212 myToDisplayEdges = theValue;
213 SetToUpdate();
214 }
215 }
216
217 //! Return TRUE if vertices (vertex) of View Cube is drawn; TRUE by default.
218 Standard_Boolean ToDrawVertices() const { return myToDisplayVertices; }
219
220 //! Enable/disable drawing of vertices (corners) of View Cube.
221 void SetDrawVertices (Standard_Boolean theValue)
222 {
223 if (myToDisplayVertices != theValue)
224 {
225 myToDisplayVertices = theValue;
226 SetToUpdate();
227 }
228 }
229
230 //! Return TRUE if application expects Y-up viewer orientation instead of Z-up; FALSE by default.
231 Standard_Boolean IsYup() const { return myIsYup; }
232
233 //! Set if application expects Y-up viewer orientation instead of Z-up.
234 Standard_EXPORT void SetYup (Standard_Boolean theIsYup,
235 Standard_Boolean theToUpdateLabels = Standard_True);
236
237public: //! @name Style management API
238
239 //! Return shading style of box sides.
240 const Handle(Prs3d_ShadingAspect)& BoxSideStyle() const { return myDrawer->ShadingAspect(); }
241
242 //! Return shading style of box edges.
243 const Handle(Prs3d_ShadingAspect)& BoxEdgeStyle() const { return myBoxEdgeAspect; }
244
245 //! Return shading style of box corners.
246 const Handle(Prs3d_ShadingAspect)& BoxCornerStyle() const { return myBoxCornerAspect; }
247
248 //! Return value of front color for the 3D part of object.
249 const Quantity_Color& BoxColor() const { return myDrawer->ShadingAspect()->Color(); }
250
251 //! Set new value of front color for the 3D part of object.
252 //! @param theColor [in] input color value.
253 void SetBoxColor (const Quantity_Color& theColor)
254 {
255 if (!myDrawer->ShadingAspect()->Color().IsEqual (theColor)
256 || !myBoxEdgeAspect ->Color().IsEqual (theColor)
257 || !myBoxCornerAspect->Color().IsEqual (theColor))
258 {
259 myDrawer->ShadingAspect()->SetColor (theColor);
260 myBoxEdgeAspect->SetColor (theColor);
261 myBoxCornerAspect->SetColor (theColor);
262 SynchronizeAspects();
263 }
264 }
265
266 //! Return transparency for 3D part of object.
267 Standard_Real BoxTransparency() const { return myDrawer->ShadingAspect()->Transparency(); }
268
269 //! Set new value of transparency for 3D part of object.
270 //! @param theValue [in] input transparency value
271 void SetBoxTransparency (Standard_Real theValue)
272 {
273 if (Abs (myDrawer->ShadingAspect()->Transparency() - theValue) > Precision::Confusion()
274 || Abs (myBoxEdgeAspect ->Transparency() - theValue) > Precision::Confusion()
275 || Abs (myBoxCornerAspect->Transparency() - theValue) > Precision::Confusion())
276 {
277 myDrawer->ShadingAspect()->SetTransparency (theValue);
278 myBoxEdgeAspect->SetTransparency (theValue);
279 myBoxCornerAspect->SetTransparency (theValue);
280 SynchronizeAspects();
281 }
282 }
283
284 //! Return color of sides back material.
285 const Quantity_Color& InnerColor() const { return myDrawer->ShadingAspect()->Color (Aspect_TOFM_BACK_SIDE); }
286
287 //! Set color of sides back material. Alias for:
288 //! @code Attributes()->ShadingAspect()->Aspect()->ChangeBackMaterial().SetColor() @endcode
289 void SetInnerColor (const Quantity_Color& theColor)
290 {
291 myDrawer->ShadingAspect()->SetColor (theColor, Aspect_TOFM_BACK_SIDE);
292 SynchronizeAspects();
293 }
294
295 //! Return box side label or empty string if undefined.
296 //! Default labels: FRONT, BACK, LEFT, RIGHT, TOP, BOTTOM.
297 TCollection_AsciiString BoxSideLabel (V3d_TypeOfOrientation theSide) const
298 {
299 const TCollection_AsciiString* aLabel = myBoxSideLabels.Seek (theSide);
300 return aLabel != NULL ? *aLabel : TCollection_AsciiString();
301 }
302
303 //! Set box side label.
304 void SetBoxSideLabel (const V3d_TypeOfOrientation theSide,
305 const TCollection_AsciiString& theLabel)
306 {
307 if (!IsBoxSide (theSide))
308 {
309 throw Standard_ProgramError ("AIS_ViewCube::SetBoxSideLabel(), invalid enumeration value");
310 }
311 myBoxSideLabels.Bind (theSide, theLabel);
312 SetToUpdate();
313 }
314
315 //! Return text color of labels of box sides; BLACK by default.
316 const Quantity_Color& TextColor() const { return myDrawer->TextAspect()->Aspect()->Color(); }
317
318 //! Set color of text labels on box sides. Alias for:
319 //! @code Attributes()->TextAspect()->SetColor() @endcode
320 void SetTextColor (const Quantity_Color& theColor)
321 {
322 myDrawer->TextAspect()->SetColor (theColor);
323 SynchronizeAspects();
324 }
325
326 //! Return font name that is used for displaying of sides and axes text. Alias for:
327 //! @code Attributes()->TextAspect()->Aspect()->SetFont() @endcode
328 const TCollection_AsciiString& Font() const { return myDrawer->TextAspect()->Aspect()->Font(); }
329
330 //! Set font name that is used for displaying of sides and axes text. Alias for:
331 //! @code Attributes()->TextAspect()->SetFont() @endcode
332 void SetFont (const TCollection_AsciiString& theFont)
333 {
334 myDrawer->TextAspect()->Aspect()->SetFont (theFont);
335 SynchronizeAspects();
336 }
337
338 //! Return height of font
339 Standard_Real FontHeight() const { return myDrawer->TextAspect()->Height(); }
340
341 //! Change font height. Alias for:
342 //! @code Attributes()->TextAspect()->SetHeight() @endcode
343 void SetFontHeight (Standard_Real theValue)
344 {
345 if (Abs (myDrawer->TextAspect()->Height() - theValue) > Precision::Confusion())
346 {
347 myDrawer->TextAspect()->SetHeight (theValue);
348 SetToUpdate();
349 }
350 }
351
352 //! Return axes labels or empty string if undefined.
353 //! Default labels: X, Y, Z.
354 TCollection_AsciiString AxisLabel (Prs3d_DatumParts theAxis) const
355 {
356 const TCollection_AsciiString* aLabel = myAxesLabels.Seek (theAxis);
357 return aLabel != NULL ? *aLabel : TCollection_AsciiString();
358 }
359
360 //! Set axes labels.
361 void SetAxesLabels (const TCollection_AsciiString& theX,
362 const TCollection_AsciiString& theY,
363 const TCollection_AsciiString& theZ)
364 {
365 myAxesLabels.Bind (Prs3d_DP_XAxis, theX);
366 myAxesLabels.Bind (Prs3d_DP_YAxis, theY);
367 myAxesLabels.Bind (Prs3d_DP_ZAxis, theZ);
368 SetToUpdate();
369 }
370
371public:
372
373 //! Set new value of color for the whole object.
374 //! @param theColor [in] input color value.
375 virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE
376 {
377 SetBoxColor (theColor);
378 }
379
380 //! Reset color for the whole object.
381 virtual void UnsetColor() Standard_OVERRIDE
382 {
383 myDrawer->ShadingAspect()->SetColor (Quantity_NOC_WHITE);
384 myBoxEdgeAspect ->SetColor (Quantity_NOC_GRAY30);
385 myBoxCornerAspect->SetColor (Quantity_NOC_GRAY30);
386 SynchronizeAspects();
387 }
388
389 //! Set new value of transparency for the whole object.
390 //! @param theValue [in] input transparency value.
391 virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE
392 {
393 SetBoxTransparency (theValue);
394 }
395
396 //! Reset transparency for the whole object.
397 virtual void UnsetTransparency() Standard_OVERRIDE
398 {
399 SetBoxTransparency (0.0f);
400 }
401
402 //! Sets the material for the interactive object.
403 virtual void SetMaterial (const Graphic3d_MaterialAspect& theMat) Standard_OVERRIDE
404 {
405 myDrawer->ShadingAspect()->SetMaterial (theMat);
406 myBoxEdgeAspect ->SetMaterial (theMat);
407 myBoxCornerAspect->SetMaterial (theMat);
408 SynchronizeAspects();
409 }
410
411 //! Sets the material for the interactive object.
412 virtual void UnsetMaterial() Standard_OVERRIDE
413 {
414 Graphic3d_MaterialAspect aMat (Graphic3d_NOM_UserDefined);
415 aMat.SetColor (Quantity_NOC_WHITE);
416 aMat.SetAmbientColor (Quantity_NOC_GRAY60);
417 myDrawer->ShadingAspect()->SetMaterial (aMat);
418 myBoxEdgeAspect ->SetMaterial (aMat);
419 myBoxEdgeAspect ->SetColor (Quantity_NOC_GRAY30);
420 myBoxCornerAspect->SetMaterial (aMat);
421 myBoxCornerAspect->SetColor (Quantity_NOC_GRAY30);
422 SynchronizeAspects();
423 }
424
425public: //! @name animation methods
426
427 //! Return duration of animation in seconds; 0.5 sec by default
428 Standard_Real Duration() const { return myDuration; }
429
430 //! Set duration of animation.
431 //! @param theValue [in] input value of duration in seconds
432 void SetDuration (Standard_Real theValue) { myDuration = theValue; }
433
434 //! Return TRUE if new camera Up direction should be always set to default value for a new camera Direction; FALSE by default.
435 //! When this flag is FALSE, the new camera Up will be set as current Up orthogonalized to the new camera Direction,
436 //! and will set to default Up on second click.
437 Standard_Boolean ToResetCameraUp() const { return myToResetCameraUp; }
438
439 //! Set if new camera Up direction should be always set to default value for a new camera Direction.
440 void SetResetCamera (Standard_Boolean theToReset) { myToResetCameraUp = theToReset; }
441
442 //! Return TRUE if animation should fit selected objects and FALSE to fit entire scene; TRUE by default.
443 Standard_Boolean ToFitSelected() const { return myToFitSelected; }
444
445 //! Set if animation should fit selected objects or to fit entire scene.
446 void SetFitSelected (Standard_Boolean theToFitSelected) { myToFitSelected = theToFitSelected; }
447
448 //! @return TRUE if View Cube has unfinished animation of view camera.
449 Standard_EXPORT Standard_Boolean HasAnimation() const;
450
451 //! Start camera transformation corresponding to the input detected owner.
452 //! @param theOwner [in] detected owner.
453 Standard_EXPORT virtual void StartAnimation (const Handle(AIS_ViewCubeOwner)& theOwner);
454
455 //! Perform one step of current camera transformation.
456 //! theToUpdate [in] enable/disable update of view.
457 //! @return TRUE if animation is not stopped.
458 Standard_EXPORT virtual Standard_Boolean UpdateAnimation (const Standard_Boolean theToUpdate);
459
460 //! Perform camera transformation corresponding to the input detected owner.
461 Standard_EXPORT virtual void HandleClick (const Handle(AIS_ViewCubeOwner)& theOwner);
462
463protected:
464
465 //! Perform internal single step of animation.
466 //! @return FALSE if animation has been finished
467 Standard_EXPORT Standard_Boolean updateAnimation();
468
469protected: //! @name protected virtual API
470
471 //! Method that is called after one step of transformation.
472 virtual void onAfterAnimation() {}
473
474 //! Method that is called after transformation finish.
475 virtual void onAnimationFinished() {}
476
477public: //! @name Presentation computation
478
479 //! Return TRUE for supported display mode.
480 virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE { return theMode == 0; }
481
482 //! Global selection has no meaning for this class.
483 virtual Handle(SelectMgr_EntityOwner) GlobalSelOwner() const Standard_OVERRIDE { return Handle(SelectMgr_EntityOwner)(); }
484
485 //! Compute 3D part of View Cube.
486 //! @param thePrsMgr [in] presentation manager.
487 //! @param thePrs [in] input presentation that is to be filled with flat presentation primitives.
488 //! @param theMode [in] display mode.
489 //! @warning this object accept only 0 display mode.
490 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
491 const Handle(Prs3d_Presentation)& thePrs,
492 const Standard_Integer theMode = 0) Standard_OVERRIDE;
493
494 //! Redefine computing of sensitive entities for View Cube.
495 //! @param theSelection [in] input selection object that is to be filled with sensitive entities.
496 //! @param theMode [in] selection mode.
497 //! @warning object accepts only 0 selection mode.
498 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
499 const Standard_Integer theMode) Standard_OVERRIDE;
500
501 //! Disables auto highlighting to use HilightSelected() and HilightOwnerWithColor() overridden methods.
502 virtual Standard_Boolean IsAutoHilight() const Standard_OVERRIDE { return Standard_False; }
503
504 //! Method which clear all selected owners belonging to this selectable object.
505 //! @warning this object does not support selection.
506 virtual void ClearSelected() Standard_OVERRIDE {}
507
508 //! Method which highlights input owner belonging to this selectable object.
509 //! @param thePM [in] presentation manager
510 //! @param theStyle [in] style for dynamic highlighting.
511 //! @param theOwner [in] input entity owner.
512 Standard_EXPORT virtual void HilightOwnerWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
513 const Handle(Prs3d_Drawer)& theStyle,
514 const Handle(SelectMgr_EntityOwner)& theOwner) Standard_OVERRIDE;
515
516 //! Method which draws selected owners.
517 Standard_EXPORT virtual void HilightSelected (const Handle(PrsMgr_PresentationManager3d)& thePM,
518 const SelectMgr_SequenceOfOwner& theSeq) Standard_OVERRIDE;
519
520 //! Set default parameters for visual attributes
521 //! @sa Attributes()
522 virtual void UnsetAttributes() Standard_OVERRIDE
523 {
524 setDefaultAttributes();
525 SetToUpdate();
526 }
527
528 //! Set default parameters for dynamic highlighting attributes, reset highlight attributes
529 virtual void UnsetHilightAttributes() Standard_OVERRIDE
530 {
531 myHilightDrawer.Nullify();
532 setDefaultHighlightAttributes();
533 SetToUpdate();
534 }
535
536protected: //! @name Auxiliary classes to fill presentation with proper primitives
537
538 //! Create triangulation for a box part - for presentation and selection purposes.
539 Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) createBoxPartTriangles (V3d_TypeOfOrientation theDir) const;
540
541 //! Create triangulation for a box side.
542 Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) createBoxSideTriangles (V3d_TypeOfOrientation theDir) const;
543
544 //! Create triangulation for a box edge.
545 Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) createBoxEdgeTriangles (V3d_TypeOfOrientation theDir) const;
546
547 //! Create triangulation for a box corner (vertex).
548 Standard_EXPORT virtual Handle(Graphic3d_ArrayOfTriangles) createBoxCornerTriangles (V3d_TypeOfOrientation theDir) const;
549
550protected:
551
552 //! Create triangulation for a rectangle with round corners.
553 //! @param theSize rectangle dimensions
554 //! @param theRadius radius at corners
555 //! @param theTrsf transformation
556 Standard_EXPORT static Handle(Graphic3d_ArrayOfTriangles) createRoundRectangleTriangles (const gp_XY& theSize,
557 Standard_Real theRadius,
558 const gp_Trsf& theTrsf);
559
560protected:
561
562 //! Trivial hasher to avoid ambiguity with enumeration type.
563 struct IntegerHasher
564 {
565 static Standard_Integer HashCode (Standard_Integer theValue, Standard_Integer theUpper) { return ::HashCode (theValue, theUpper); }
566 static Standard_Boolean IsEqual (Standard_Integer theA, Standard_Integer theB) { return theA == theB; }
567 };
568
569protected:
570
571 NCollection_DataMap<V3d_TypeOfOrientation, TCollection_AsciiString, IntegerHasher>
572 myBoxSideLabels; //!< map with box side labels
573 NCollection_DataMap<Prs3d_DatumParts, TCollection_AsciiString, IntegerHasher>
574 myAxesLabels; //!< map with axes labels
575 Handle(Prs3d_ShadingAspect) myBoxEdgeAspect; //!< style for box edges
576 Handle(Prs3d_ShadingAspect) myBoxCornerAspect; //!< style for box corner
577
578 Standard_Real mySize; //!< size of box side, length of one axis
579 Standard_Real myBoxEdgeMinSize; //!< minimal size of box edge
580 Standard_Real myBoxEdgeGap; //!< gap between box side and box edge
581 Standard_Real myBoxFacetExtension; //!< box facet extension
582 Standard_Real myAxesPadding; //!< Padding between box and axes
583 Standard_Real myCornerMinSize; //!< minimal size of box corner
584 Standard_Real myRoundRadius; //!< relative round radius within [0; 0.5] range
585 Standard_Boolean myToDisplayAxes; //!< trihedron visibility
586 Standard_Boolean myToDisplayEdges; //!< box edges visibility
587 Standard_Boolean myToDisplayVertices; //!< box corners (vertices) visibility
588 Standard_Boolean myIsYup; //!< flag indicating that application expects Y-up viewer orientation instead of Z-up
589
590protected: //! @name Animation options
591
592 Handle(AIS_AnimationCamera) myViewAnimation; //!< Camera animation object
593 Handle(Graphic3d_Camera) myStartState; //!< Start state of view camera
594 Handle(Graphic3d_Camera) myEndState; //!< End state of view camera
595 Standard_Real myDuration; //!< Duration of animation. By default it is half a second
596 Standard_Boolean myToAutoStartAnim; //!< start animation automatically on click
597 Standard_Boolean myIsFixedAnimation; //!< fixed-loop animation
598 Standard_Boolean myToFitSelected; //!< fit selected or fit entire scene
599 Standard_Boolean myToResetCameraUp; //!< always reset camera up direction to default
600
601};
602
603//! Redefined entity owner that is highlighted when owner is detected,
604//! even if Interactive Context highlighted on last detection procedure.
605class AIS_ViewCubeOwner : public SelectMgr_EntityOwner
606{
607 DEFINE_STANDARD_RTTIEXT(AIS_ViewCubeOwner, SelectMgr_EntityOwner)
608public:
609
610 //! Main constructor.
611 AIS_ViewCubeOwner (const Handle(AIS_ViewCube)& theObject,
612 V3d_TypeOfOrientation theOrient,
613 Standard_Integer thePriority = 5)
614 : SelectMgr_EntityOwner ((const Handle(SelectMgr_SelectableObject)& )theObject, thePriority),
615 myMainOrient (theOrient)
616 {
617 myFromDecomposition = true;
618 }
619
620 //! @return TRUE. This owner will always call method
621 //! Hilight for its Selectable Object when the owner is detected.
622 virtual Standard_Boolean IsForcedHilight() const Standard_OVERRIDE { return Standard_True; }
623
624 //! Return new orientation to set.
625 V3d_TypeOfOrientation MainOrientation() const { return myMainOrient; }
626
627 //! Handle mouse button click event.
628 virtual Standard_Boolean HandleMouseClick (const Graphic3d_Vec2i& thePoint,
629 Aspect_VKeyMouse theButton,
630 Aspect_VKeyFlags theModifiers,
631 bool theIsDoubleClick) Standard_OVERRIDE
632 {
633 (void )thePoint; (void )theButton; (void )theModifiers; (void )theIsDoubleClick;
634 AIS_ViewCube* aCubePrs = dynamic_cast<AIS_ViewCube* >(mySelectable);
635 aCubePrs->HandleClick (this);
636 return Standard_True;
637 }
638
639protected:
640
641 V3d_TypeOfOrientation myMainOrient; //!< new orientation to set
642
643};
644
645#endif // _AIS_ViewCube_HeaderFile