0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / PrsDim / PrsDim_TangentRelation.hxx
1 // Created on: 1996-12-05
2 // Created by: Jean-Pierre COMBE/Odile Olivier
3 // Copyright (c) 1996-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 _PrsDim_TangentRelation_HeaderFile
18 #define _PrsDim_TangentRelation_HeaderFile
19
20 #include <PrsDim_Relation.hxx>
21
22 DEFINE_STANDARD_HANDLE(PrsDim_TangentRelation, PrsDim_Relation)
23
24 //! A framework to display tangency constraints between
25 //! two or more Interactive Objects of the datum type.
26 //! The datums are normally faces or edges.
27 class PrsDim_TangentRelation : public PrsDim_Relation
28 {
29   DEFINE_STANDARD_RTTIEXT(PrsDim_TangentRelation, PrsDim_Relation)
30 public:
31
32   //! TwoFacesTangent or TwoEdgesTangent relation
33   //! Constructs an object to display tangency constraints.
34   //! This object is defined by the first shape aFShape, the
35   //! second shape aSShape, the plane aPlane and the index anExternRef.
36   //! aPlane serves as an optional axis.
37   //! anExternRef set to 0 indicates that there is no relation.
38   Standard_EXPORT PrsDim_TangentRelation(const TopoDS_Shape& aFShape, const TopoDS_Shape& aSShape, const Handle(Geom_Plane)& aPlane, const Standard_Integer anExternRef = 0);
39   
40   //! Returns the external reference for tangency.
41   //! The values are as follows:
42   //! -   0 - there is no connection;
43   //! -   1 - there is a connection to the first shape;
44   //! -   2 - there is a connection to the second shape.
45   //! This reference is defined at construction time.
46   Standard_Integer ExternRef() { return myExternRef; }
47
48   //! Sets the external reference for tangency, aRef.
49   //! The values are as follows:
50   //! -   0 - there is no connection;
51   //! -   1 - there is a connection to the first shape;
52   //! -   2 - there is a connection to the second shape.
53   //! This reference is initially defined at construction time.
54   void SetExternRef (const Standard_Integer aRef) { myExternRef = aRef; }
55
56 private:
57
58   Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
59   
60   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
61   
62   Standard_EXPORT void ComputeTwoFacesTangent (const Handle(Prs3d_Presentation)& aPresentation);
63   
64   Standard_EXPORT void ComputeTwoEdgesTangent (const Handle(Prs3d_Presentation)& aPresentation);
65
66 private:
67
68   gp_Pnt myAttach;
69   gp_Dir myDir;
70   Standard_Real myLength;
71   Standard_Integer myExternRef;
72
73 };
74
75 #endif // _PrsDim_TangentRelation_HeaderFile