0028010: Visualization, Prs3d_Arrow - add Shading presentation builder
[occt.git] / src / AIS / AIS_FixRelation.hxx
1 // Created on: 1996-12-05
2 // Created by: Flore Lantheaume/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 _AIS_FixRelation_HeaderFile
18 #define _AIS_FixRelation_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TopoDS_Wire.hxx>
24 #include <gp_Pnt.hxx>
25 #include <AIS_Relation.hxx>
26 #include <Standard_Real.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <PrsMgr_PresentationManager3d.hxx>
29 #include <Standard_Integer.hxx>
30 #include <SelectMgr_Selection.hxx>
31 class TopoDS_Shape;
32 class Geom_Plane;
33 class TopoDS_Wire;
34 class gp_Pnt;
35 class Prs3d_Presentation;
36 class Prs3d_Projector;
37 class Geom_Transformation;
38 class TopoDS_Vertex;
39 class Geom_Curve;
40 class TopoDS_Edge;
41 class gp_Lin;
42 class gp_Circ;
43
44
45 class AIS_FixRelation;
46 DEFINE_STANDARD_HANDLE(AIS_FixRelation, AIS_Relation)
47
48 //! Constructs and manages a constraint by a fixed
49 //! relation between two or more interactive datums. This
50 //! constraint is represented by a wire from a shape -
51 //! point, vertex, or edge - in the first datum and a
52 //! corresponding shape in the second.
53 //! Warning: This relation is not bound with any kind of parametric
54 //! constraint : it represents the "status" of an parametric
55 //! object.
56 class AIS_FixRelation : public AIS_Relation
57 {
58
59 public:
60
61   
62   //! initializes the vertex aShape, the
63   //! plane aPlane and the wire aWire, which connects
64   //! the two vertices in a fixed relation.
65   Standard_EXPORT AIS_FixRelation(const TopoDS_Shape& aShape, const Handle(Geom_Plane)& aPlane, const TopoDS_Wire& aWire);
66   
67   //! initializes the vertex aShape, the
68   //! plane aPlane and the wire aWire, the position
69   //! aPosition, the arrow size anArrowSize and the
70   //! wire aWire, which connects the two vertices in a fixed relation.
71   Standard_EXPORT AIS_FixRelation(const TopoDS_Shape& aShape, const Handle(Geom_Plane)& aPlane, const TopoDS_Wire& aWire, const gp_Pnt& aPosition, const Standard_Real anArrowSize = 0.01);
72   
73   //! initializes the edge aShape and the plane aPlane.
74   Standard_EXPORT AIS_FixRelation(const TopoDS_Shape& aShape, const Handle(Geom_Plane)& aPlane);
75   
76   //! initializes the edge aShape, the
77   //! plane aPlane, the position aPosition and the arrow
78   //! size anArrowSize.
79   Standard_EXPORT AIS_FixRelation(const TopoDS_Shape& aShape, const Handle(Geom_Plane)& aPlane, const gp_Pnt& aPosition, const Standard_Real anArrowSize = 0.01);
80   
81   //! Returns the wire which connects vertices in a fixed relation.
82   Standard_EXPORT TopoDS_Wire Wire();
83   
84   //! Constructs the wire aWire. This connects vertices
85   //! which are in a fixed relation.
86   Standard_EXPORT void SetWire (const TopoDS_Wire& aWire);
87   
88   //! Returns true if the Interactive Objects in the relation
89   //! are movable.
90     virtual Standard_Boolean IsMovable() const Standard_OVERRIDE;
91   
92   //! computes the presentation according to a point of view
93   //! given by <aProjector>.
94   //! To be Used when the associated degenerated Presentations
95   //! have been transformed by <aTrsf> which is not a Pure
96   //! Translation. The HLR Prs can't be deducted automatically
97   //! WARNING :<aTrsf> must be applied
98   //! to the object to display before computation  !!!
99   Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
100
101
102
103
104   DEFINE_STANDARD_RTTIEXT(AIS_FixRelation,AIS_Relation)
105
106 protected:
107
108
109
110
111 private:
112
113   
114   Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE;
115   
116   Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE;
117   
118   Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE;
119   
120   //! computes the presentation for <myFixShape> if it's a
121   //! vertex.
122   Standard_EXPORT void ComputeVertex (const TopoDS_Vertex& FixVertex, gp_Pnt& curpos);
123   
124   Standard_EXPORT gp_Pnt ComputePosition (const Handle(Geom_Curve)& curv1, const Handle(Geom_Curve)& curv2, const gp_Pnt& firstp1, const gp_Pnt& lastp1, const gp_Pnt& firstp2, const gp_Pnt& lastp2) const;
125   
126   Standard_EXPORT gp_Pnt ComputePosition (const Handle(Geom_Curve)& curv, const gp_Pnt& firstp, const gp_Pnt& lastp) const;
127   
128   //! computes the presentation for <myFixShape> if it's a
129   //! edge.
130   Standard_EXPORT void ComputeEdge (const TopoDS_Edge& FixEdge, gp_Pnt& curpos);
131   
132   Standard_EXPORT void ComputeLinePosition (const gp_Lin& glin, gp_Pnt& pos, Standard_Real& pfirst, Standard_Real& plast);
133   
134   Standard_EXPORT void ComputeCirclePosition (const gp_Circ& gcirc, gp_Pnt& pos, Standard_Real& pfirst, Standard_Real& plast);
135   
136   Standard_EXPORT static Standard_Boolean ConnectedEdges (const TopoDS_Wire& aWire, const TopoDS_Vertex& aVertex, TopoDS_Edge& Edge1, TopoDS_Edge& Edge2);
137
138   TopoDS_Wire myWire;
139   gp_Pnt myPntAttach;
140
141
142 };
143
144
145 #include <AIS_FixRelation.lxx>
146
147
148
149
150
151 #endif // _AIS_FixRelation_HeaderFile