1 // Created on: 1997-01-21 2 // Created by: Prestataire Christiane ARMAND 3 // Copyright (c) 1997-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _AIS_Circle_HeaderFile 18 #define _AIS_Circle_HeaderFile 19 20 #include <AIS_InteractiveObject.hxx> 21 22 class Geom_Circle; 23 24 //! Constructs circle datums to be used in construction of 25 //! composite shapes. 26 class AIS_Circle : public AIS_InteractiveObject 27 { 28 DEFINE_STANDARD_RTTIEXT(AIS_Circle, AIS_InteractiveObject) 29 public: 30 31 //! Initializes this algorithm for constructing AIS circle 32 //! datums initializes the circle aCircle 33 Standard_EXPORT AIS_Circle(const Handle(Geom_Circle)& aCircle); 34 35 //! Initializes this algorithm for constructing AIS circle datums. 36 //! Initializes the circle theCircle, the arc 37 //! starting point theUStart, the arc ending point theUEnd, 38 //! and the type of sensitivity theIsFilledCircleSens. 39 Standard_EXPORT AIS_Circle(const Handle(Geom_Circle)& theCircle, const Standard_Real theUStart, const Standard_Real theUEnd, const Standard_Boolean theIsFilledCircleSens = Standard_False); 40 41 //! computes the presentation according to a point of view 42 //! given by <aProjector>. 43 //! To be Used when the associated degenerated Presentations 44 //! have been transformed by <aTrsf> which is not a Pure 45 //! Translation. The HLR Prs can't be deducted automatically 46 //! WARNING :<aTrsf> must be applied 47 //! to the object to display before computation !!! 48 Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; 49 50 //! Returns index 6 by default. Signature() const51 virtual Standard_Integer Signature() const Standard_OVERRIDE { return 6; } 52 53 //! Indicates that the type of Interactive Object is a datum. Type() const54 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } 55 56 //! Returns the circle component defined in SetCircle. Handle(Geom_Circle)57 const Handle(Geom_Circle)& Circle() const { return myComponent; } 58 59 //! Constructs instances of the starting point and the end 60 //! point parameters, theU1 and theU2. Parameters(Standard_Real & theU1,Standard_Real & theU2) const61 void Parameters (Standard_Real& theU1, Standard_Real& theU2) const 62 { 63 theU1 = myUStart; 64 theU2 = myUEnd; 65 } 66 67 //! Allows you to provide settings for the circle datum aCircle. SetCircle(const Handle (Geom_Circle)& theCircle)68 void SetCircle (const Handle(Geom_Circle)& theCircle) { myComponent = theCircle; } 69 70 //! Allows you to set the parameter theU for the starting point of an arc. SetFirstParam(const Standard_Real theU)71 void SetFirstParam (const Standard_Real theU) 72 { 73 myUStart = theU; 74 myCircleIsArc = Standard_True; 75 } 76 77 //! Allows you to provide the parameter theU for the end point of an arc. SetLastParam(const Standard_Real theU)78 void SetLastParam (const Standard_Real theU) 79 { 80 myUEnd = theU; 81 myCircleIsArc = Standard_True; 82 } 83 84 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; 85 86 //! Assigns the width aValue to the solid line boundary of the circle datum. 87 Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE; 88 89 //! Removes color from the solid line boundary of the circle datum. 90 Standard_EXPORT void UnsetColor() Standard_OVERRIDE; 91 92 //! Removes width settings from the solid line boundary of the circle datum. 93 Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; 94 95 //! Returns the type of sensitivity for the circle; IsFilledCircleSens() const96 Standard_Boolean IsFilledCircleSens() const { return myIsFilledCircleSens; } 97 98 //! Sets the type of sensitivity for the circle. If theIsFilledCircleSens set to Standard_True 99 //! then the whole circle will be detectable, otherwise only the boundary of the circle. SetFilledCircleSens(const Standard_Boolean theIsFilledCircleSens)100 void SetFilledCircleSens (const Standard_Boolean theIsFilledCircleSens) { myIsFilledCircleSens = theIsFilledCircleSens; } 101 102 private: 103 104 Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; 105 106 Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; 107 108 Standard_EXPORT void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; 109 110 Standard_EXPORT void ComputeCircle (const Handle(Prs3d_Presentation)& aPresentation); 111 112 Standard_EXPORT void ComputeArc (const Handle(Prs3d_Presentation)& aPresentation); 113 114 Standard_EXPORT void ComputeCircleSelection (const Handle(SelectMgr_Selection)& aSelection); 115 116 Standard_EXPORT void ComputeArcSelection (const Handle(SelectMgr_Selection)& aSelection); 117 118 //! Replace aspects of already computed groups with the new value. 119 void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect); 120 121 private: 122 123 Handle(Geom_Circle) myComponent; 124 Standard_Real myUStart; 125 Standard_Real myUEnd; 126 Standard_Boolean myCircleIsArc; 127 Standard_Boolean myIsFilledCircleSens; 128 129 }; 130 131 DEFINE_STANDARD_HANDLE(AIS_Circle, AIS_InteractiveObject) 132 133 #endif // _AIS_Circle_HeaderFile 134