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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _AIS_IdenticRelation_HeaderFile
18 #define _AIS_IdenticRelation_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Boolean.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>
32 class Prs3d_Presentation;
33 class Prs3d_Projector;
34 class Geom_Transformation;
44 class AIS_IdenticRelation;
45 DEFINE_STANDARD_HANDLE(AIS_IdenticRelation, AIS_Relation)
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
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);
61 Standard_Boolean HasUsers() const { return !myUsers.IsEmpty(); }
63 const TColStd_ListOfTransient& Users() const { return myUsers; }
65 void AddUser (const Handle(Standard_Transient)& theUser) { myUsers.Append (theUser); }
67 void ClearUsers() { myUsers.Clear(); }
69 //! Returns true if the interactive object is movable.
70 virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
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;
81 DEFINE_STANDARD_RTTIEXT(AIS_IdenticRelation,AIS_Relation)
86 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
88 Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
90 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
92 Standard_EXPORT void ComputeOneEdgeOVertexPresentation (const Handle(Prs3d_Presentation)& aPresentation);
94 Standard_EXPORT void ComputeTwoEdgesPresentation (const Handle(Prs3d_Presentation)& aPresentation);
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);
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);
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);
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);
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);
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);
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);
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);
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);
126 Standard_EXPORT void ComputeTwoVerticesPresentation (const Handle(Prs3d_Presentation)& aPresentation);
128 Standard_EXPORT Standard_Real ComputeSegSize() const;
130 Standard_EXPORT Standard_Boolean ComputeDirection (const TopoDS_Wire& aWire, const TopoDS_Vertex& aVertex, gp_Dir& aDir) const;
132 Standard_EXPORT gp_Dir ComputeLineDirection (const Handle(Geom_Line)& aLin, const gp_Pnt& anExtremity) const;
134 Standard_EXPORT gp_Dir ComputeCircleDirection (const Handle(Geom_Circle)& aCirc, const TopoDS_Vertex& ConnectedVertex) const;
138 TColStd_ListOfTransient myUsers;
139 Standard_Boolean isCircle;
147 #include <AIS_IdenticRelation.lxx>
153 #endif // _AIS_IdenticRelation_HeaderFile