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 //! Returns index 6 by default. Signature() const42 virtual Standard_Integer Signature() const Standard_OVERRIDE { return 6; } 43 44 //! Indicates that the type of Interactive Object is a datum. Type() const45 virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KindOfInteractive_Datum; } 46 47 //! Returns the circle component defined in SetCircle. Handle(Geom_Circle)48 const Handle(Geom_Circle)& Circle() const { return myComponent; } 49 50 //! Constructs instances of the starting point and the end 51 //! point parameters, theU1 and theU2. Parameters(Standard_Real & theU1,Standard_Real & theU2) const52 void Parameters (Standard_Real& theU1, Standard_Real& theU2) const 53 { 54 theU1 = myUStart; 55 theU2 = myUEnd; 56 } 57 58 //! Allows you to provide settings for the circle datum aCircle. SetCircle(const Handle (Geom_Circle)& theCircle)59 void SetCircle (const Handle(Geom_Circle)& theCircle) { myComponent = theCircle; } 60 61 //! Allows you to set the parameter theU for the starting point of an arc. SetFirstParam(const Standard_Real theU)62 void SetFirstParam (const Standard_Real theU) 63 { 64 myUStart = theU; 65 myCircleIsArc = Standard_True; 66 } 67 68 //! Allows you to provide the parameter theU for the end point of an arc. SetLastParam(const Standard_Real theU)69 void SetLastParam (const Standard_Real theU) 70 { 71 myUEnd = theU; 72 myCircleIsArc = Standard_True; 73 } 74 75 Standard_EXPORT void SetColor (const Quantity_Color& aColor) Standard_OVERRIDE; 76 77 //! Assigns the width aValue to the solid line boundary of the circle datum. 78 Standard_EXPORT void SetWidth (const Standard_Real aValue) Standard_OVERRIDE; 79 80 //! Removes color from the solid line boundary of the circle datum. 81 Standard_EXPORT void UnsetColor() Standard_OVERRIDE; 82 83 //! Removes width settings from the solid line boundary of the circle datum. 84 Standard_EXPORT void UnsetWidth() Standard_OVERRIDE; 85 86 //! Returns the type of sensitivity for the circle; IsFilledCircleSens() const87 Standard_Boolean IsFilledCircleSens() const { return myIsFilledCircleSens; } 88 89 //! Sets the type of sensitivity for the circle. If theIsFilledCircleSens set to Standard_True 90 //! then the whole circle will be detectable, otherwise only the boundary of the circle. SetFilledCircleSens(const Standard_Boolean theIsFilledCircleSens)91 void SetFilledCircleSens (const Standard_Boolean theIsFilledCircleSens) { myIsFilledCircleSens = theIsFilledCircleSens; } 92 93 private: 94 95 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, 96 const Handle(Prs3d_Presentation)& theprs, 97 const Standard_Integer theMode) Standard_OVERRIDE; 98 99 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel, 100 const Standard_Integer theMode) Standard_OVERRIDE; 101 102 Standard_EXPORT void ComputeCircle (const Handle(Prs3d_Presentation)& aPresentation); 103 104 Standard_EXPORT void ComputeArc (const Handle(Prs3d_Presentation)& aPresentation); 105 106 Standard_EXPORT void ComputeCircleSelection (const Handle(SelectMgr_Selection)& aSelection); 107 108 Standard_EXPORT void ComputeArcSelection (const Handle(SelectMgr_Selection)& aSelection); 109 110 //! Replace aspects of already computed groups with the new value. 111 void replaceWithNewLineAspect (const Handle(Prs3d_LineAspect)& theAspect); 112 113 private: 114 115 Handle(Geom_Circle) myComponent; 116 Standard_Real myUStart; 117 Standard_Real myUEnd; 118 Standard_Boolean myCircleIsArc; 119 Standard_Boolean myIsFilledCircleSens; 120 121 }; 122 123 DEFINE_STANDARD_HANDLE(AIS_Circle, AIS_InteractiveObject) 124 125 #endif // _AIS_Circle_HeaderFile 126