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