42cf5bc1 |
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 | |
787ff240 |
17 | #ifndef _PrsDim_IdenticRelation_HeaderFile |
18 | #define _PrsDim_IdenticRelation_HeaderFile |
42cf5bc1 |
19 | |
787ff240 |
20 | #include <PrsDim_Relation.hxx> |
2b886265 |
21 | #include <gp_Pnt.hxx> |
42cf5bc1 |
22 | #include <PrsMgr_PresentationManager3d.hxx> |
42cf5bc1 |
23 | #include <SelectMgr_Selection.hxx> |
2b886265 |
24 | #include <TColStd_ListOfTransient.hxx> |
25 | |
42cf5bc1 |
26 | class TopoDS_Shape; |
27 | class Geom_Plane; |
42cf5bc1 |
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 | |
787ff240 |
36 | DEFINE_STANDARD_HANDLE(PrsDim_IdenticRelation, PrsDim_Relation) |
42cf5bc1 |
37 | |
38 | //! Constructs a constraint by a relation of identity |
39 | //! between two or more datums figuring in shape |
40 | //! Interactive Objects. |
787ff240 |
41 | class PrsDim_IdenticRelation : public PrsDim_Relation |
42cf5bc1 |
42 | { |
787ff240 |
43 | DEFINE_STANDARD_RTTIEXT(PrsDim_IdenticRelation, PrsDim_Relation) |
42cf5bc1 |
44 | public: |
45 | |
42cf5bc1 |
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. |
787ff240 |
50 | Standard_EXPORT PrsDim_IdenticRelation(const TopoDS_Shape& FirstShape, const TopoDS_Shape& SecondShape, const Handle(Geom_Plane)& aPlane); |
2ec85268 |
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(); } |
42cf5bc1 |
59 | |
60 | //! Returns true if the interactive object is movable. |
b31fbc83 |
61 | virtual Standard_Boolean IsMovable() const Standard_OVERRIDE { return Standard_True; } |
42cf5bc1 |
62 | |
42cf5bc1 |
63 | private: |
64 | |
65 | |
66 | Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; |
67 | |
42cf5bc1 |
68 | Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; |
69 | |
70 | Standard_EXPORT void ComputeOneEdgeOVertexPresentation (const Handle(Prs3d_Presentation)& aPresentation); |
71 | |
72 | Standard_EXPORT void ComputeTwoEdgesPresentation (const Handle(Prs3d_Presentation)& aPresentation); |
73 | |
74 | 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); |
75 | |
76 | 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); |
77 | |
78 | //! Computes the presentation of the identic constraint |
79 | //! between 2 arcs in the case of automatic presentation |
80 | Standard_EXPORT void ComputeAutoArcPresentation (const Handle(Geom_Circle)& aCircle, const gp_Pnt& firstp, const gp_Pnt& lastp, const Standard_Boolean isstatic = Standard_False); |
81 | |
82 | //! Computes the presentation of the identic constraint |
83 | //! between 2 circles in the case of non automatic presentation |
84 | Standard_EXPORT void ComputeNotAutoCircPresentation (const Handle(Geom_Circle)& aCircle); |
85 | |
86 | //! Computes the presentation of the identic constraint |
87 | //! between 2 arcs in the case of non automatic presentation |
88 | Standard_EXPORT void ComputeNotAutoArcPresentation (const Handle(Geom_Circle)& aCircle, const gp_Pnt& pntfirst, const gp_Pnt& pntlast); |
89 | |
90 | 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); |
91 | |
92 | //! Computes the presentation of the identic constraint |
93 | //! between 2 arcs in the case of automatic presentation |
94 | Standard_EXPORT void ComputeAutoArcPresentation (const Handle(Geom_Ellipse)& theEll, const gp_Pnt& firstp, const gp_Pnt& lastp, const Standard_Boolean isstatic = Standard_False); |
95 | |
96 | //! Computes the presentation of the identic constraint |
97 | //! between 2 ellipses in the case of non automatic presentation |
98 | Standard_EXPORT void ComputeNotAutoElipsPresentation (const Handle(Geom_Ellipse)& theEll); |
99 | |
100 | //! Computes the presentation of the identic constraint |
101 | //! between 2 arcs in the case of non automatic presentation |
102 | Standard_EXPORT void ComputeNotAutoArcPresentation (const Handle(Geom_Ellipse)& theEll, const gp_Pnt& pntfirst, const gp_Pnt& pntlast); |
103 | |
104 | Standard_EXPORT void ComputeTwoVerticesPresentation (const Handle(Prs3d_Presentation)& aPresentation); |
105 | |
106 | Standard_EXPORT Standard_Real ComputeSegSize() const; |
107 | |
108 | Standard_EXPORT Standard_Boolean ComputeDirection (const TopoDS_Wire& aWire, const TopoDS_Vertex& aVertex, gp_Dir& aDir) const; |
109 | |
110 | Standard_EXPORT gp_Dir ComputeLineDirection (const Handle(Geom_Line)& aLin, const gp_Pnt& anExtremity) const; |
111 | |
112 | Standard_EXPORT gp_Dir ComputeCircleDirection (const Handle(Geom_Circle)& aCirc, const TopoDS_Vertex& ConnectedVertex) const; |
113 | |
2ec85268 |
114 | private: |
115 | |
116 | TColStd_ListOfTransient myUsers; |
42cf5bc1 |
117 | Standard_Boolean isCircle; |
118 | gp_Pnt myFAttach; |
119 | gp_Pnt mySAttach; |
120 | gp_Pnt myCenter; |
121 | |
42cf5bc1 |
122 | }; |
123 | |
787ff240 |
124 | #endif // _PrsDim_IdenticRelation_HeaderFile |