0029936: Documentation - improve description of AIS_Animation class
[occt.git] / src / AIS / AIS_IdenticRelation.hxx
1 // Created on: 1997-03-03
2 // Created by: Jean-Pierre COMBE
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_IdenticRelation_HeaderFile
18 #define _AIS_IdenticRelation_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Standard_Boolean.hxx>
24 #include <gp_Pnt.hxx>
25 #include <AIS_Relation.hxx>
26 #include <PrsMgr_PresentationManager3d.hxx>
27 #include <Standard_Integer.hxx>
28 #include <SelectMgr_Selection.hxx>
29 #include <Standard_Real.hxx>
30 class TopoDS_Shape;
31 class Geom_Plane;
32 class Prs3d_Presentation;
33 class Prs3d_Projector;
34 class Geom_Transformation;
35 class Geom_Line;
36 class gp_Pnt;
37 class Geom_Circle;
38 class Geom_Ellipse;
39 class TopoDS_Wire;
40 class TopoDS_Vertex;
41 class gp_Dir;
42
43
44 class AIS_IdenticRelation;
45 DEFINE_STANDARD_HANDLE(AIS_IdenticRelation, AIS_Relation)
46
47 //! Constructs a constraint by a relation of identity
48 //! between two or more datums figuring in shape
49 //! Interactive Objects.
50 class AIS_IdenticRelation : public AIS_Relation
51 {
52
53 public:
54
55   //! Initializes the relation of identity between the two
56   //! entities, FirstShape and SecondShape. The plane
57   //! aPlane is initialized in case a visual reference is
58   //! needed to show identity.
59   Standard_EXPORT AIS_IdenticRelation(const TopoDS_Shape& FirstShape, const TopoDS_Shape& SecondShape, const Handle(Geom_Plane)& aPlane);
60
61   Standard_Boolean HasUsers() const { return !myUsers.IsEmpty(); }
62
63   const TColStd_ListOfTransient& Users() const { return myUsers; }
64
65   void AddUser (const Handle(Standard_Transient)& theUser) { myUsers.Append (theUser); }
66
67   void ClearUsers() { myUsers.Clear(); }
68
69   //! Returns true if the interactive object is movable.
70     virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
71   
72   //! computes the presentation according to a point of view
73   //! given by <aProjector>.
74   //! To be Used when the associated degenerated Presentations
75   //! have been transformed by <aTrsf> which is not a Pure
76   //! Translation. The HLR Prs can't be deducted automatically
77   //! WARNING :<aTrsf> must be applied
78   //! to the object to display before computation  !!!
79   Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
80
81   DEFINE_STANDARD_RTTIEXT(AIS_IdenticRelation,AIS_Relation)
82
83 private:
84
85   
86   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
87   
88   Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
89   
90   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
91   
92   Standard_EXPORT void ComputeOneEdgeOVertexPresentation (const Handle(Prs3d_Presentation)& aPresentation);
93   
94   Standard_EXPORT void ComputeTwoEdgesPresentation (const Handle(Prs3d_Presentation)& aPresentation);
95   
96   Standard_EXPORT void ComputeTwoLinesPresentation (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Geom_Line)& aLin, gp_Pnt& Pnt1On1, gp_Pnt& Pnt2On1, gp_Pnt& Pnt1On2, gp_Pnt& Pnt2On2, const Standard_Boolean isInf1, const Standard_Boolean isInf2);
97   
98   Standard_EXPORT void ComputeTwoCirclesPresentation (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Geom_Circle)& aCircle, const gp_Pnt& Pnt1On1, const gp_Pnt& Pnt2On1, const gp_Pnt& Pnt1On2, const gp_Pnt& Pnt2On2);
99   
100   //! Computes the presentation of the identic constraint
101   //! between 2 arcs in the case of automatic presentation
102   Standard_EXPORT void ComputeAutoArcPresentation (const Handle(Geom_Circle)& aCircle, const gp_Pnt& firstp, const gp_Pnt& lastp, const Standard_Boolean isstatic = Standard_False);
103   
104   //! Computes the presentation of the identic constraint
105   //! between 2 circles in the case of non automatic presentation
106   Standard_EXPORT void ComputeNotAutoCircPresentation (const Handle(Geom_Circle)& aCircle);
107   
108   //! Computes the presentation of the identic constraint
109   //! between 2 arcs in the case of non automatic presentation
110   Standard_EXPORT void ComputeNotAutoArcPresentation (const Handle(Geom_Circle)& aCircle, const gp_Pnt& pntfirst, const gp_Pnt& pntlast);
111   
112   Standard_EXPORT void ComputeTwoEllipsesPresentation (const Handle(Prs3d_Presentation)& aPrs, const Handle(Geom_Ellipse)& anEll, const gp_Pnt& Pnt1On1, const gp_Pnt& Pnt2On1, const gp_Pnt& Pnt1On2, const gp_Pnt& Pnt2On2);
113   
114   //! Computes the presentation of the identic constraint
115   //! between 2 arcs in the case of automatic presentation
116   Standard_EXPORT void ComputeAutoArcPresentation (const Handle(Geom_Ellipse)& theEll, const gp_Pnt& firstp, const gp_Pnt& lastp, const Standard_Boolean isstatic = Standard_False);
117   
118   //! Computes the presentation of the identic constraint
119   //! between 2 ellipses in the case of non automatic presentation
120   Standard_EXPORT void ComputeNotAutoElipsPresentation (const Handle(Geom_Ellipse)& theEll);
121   
122   //! Computes the presentation of the identic constraint
123   //! between 2 arcs in the case of non automatic presentation
124   Standard_EXPORT void ComputeNotAutoArcPresentation (const Handle(Geom_Ellipse)& theEll, const gp_Pnt& pntfirst, const gp_Pnt& pntlast);
125   
126   Standard_EXPORT void ComputeTwoVerticesPresentation (const Handle(Prs3d_Presentation)& aPresentation);
127   
128   Standard_EXPORT Standard_Real ComputeSegSize() const;
129   
130   Standard_EXPORT Standard_Boolean ComputeDirection (const TopoDS_Wire& aWire, const TopoDS_Vertex& aVertex, gp_Dir& aDir) const;
131   
132   Standard_EXPORT gp_Dir ComputeLineDirection (const Handle(Geom_Line)& aLin, const gp_Pnt& anExtremity) const;
133   
134   Standard_EXPORT gp_Dir ComputeCircleDirection (const Handle(Geom_Circle)& aCirc, const TopoDS_Vertex& ConnectedVertex) const;
135
136 private:
137
138   TColStd_ListOfTransient myUsers;
139   Standard_Boolean isCircle;
140   gp_Pnt myFAttach;
141   gp_Pnt mySAttach;
142   gp_Pnt myCenter;
143
144 };
145
146
147 #include <AIS_IdenticRelation.lxx>
148
149
150
151
152
153 #endif // _AIS_IdenticRelation_HeaderFile