0024389: Invalid hilight of AIS dimension line in local selection
[occt.git] / src / AIS / AIS_LengthDimension.hxx
1 // Copyright (c) 1999-2013 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #ifndef _AIS_LengthDimension_HeaderFile
19 #define _AIS_LengthDimension_HeaderFile
20
21 #include <AIS.hxx>
22 #include <AIS_Dimension.hxx>
23 #include <AIS_Drawer.hxx>
24 #include <AIS_KindOfDimension.hxx>
25 #include <Geom_Plane.hxx>
26 #include <Geom_Transformation.hxx>
27 #include <gp_Pnt.hxx>
28 #include <gp_Dir.hxx>
29 #include <Prs3d_DimensionAspect.hxx>
30 #include <Prs3d_Presentation.hxx>
31 #include <Prs3d_Projector.hxx>
32 #include <PrsMgr_PresentationManager3d.hxx>
33 #include <SelectMgr_Selection.hxx>
34 #include <Standard.hxx>
35 #include <Standard_Macro.hxx>
36 #include <Standard_DefineHandle.hxx>
37 #include <TopoDS.hxx>
38 #include <TopoDS_Vertex.hxx>
39 #include <TCollection_ExtendedString.hxx>
40
41 class TopoDS_Face;
42 class TCollection_ExtendedString;
43 class gp_Pnt;
44 class TopoDS_Edge;
45 class TopoDS_Shape;
46 class Geom_Plane;
47 class PrsMgr_PresentationManager3d;
48 class Prs3d_Presentation;
49 class Prs3d_Projector;
50 class Geom_Transformation;
51 class SelectMgr_Selection;
52 class AIS_Drawer;
53 class Bnd_Box;
54 class gp_Dir;
55 class TopoDS_Vertex;
56 class Standard_Transient;
57 class Handle(Standard_Type);
58 class Handle(AIS_Relation);
59 class AIS_LengthDimension;
60
61 DEFINE_STANDARD_HANDLE(AIS_LengthDimension,AIS_Dimension)
62
63 //! A dimension  to display lengths. <br>
64 //! These can be lengths along a face or edge, or <br>
65 //! between two faces or two edges.
66 class AIS_LengthDimension : public AIS_Dimension
67 {
68 public:
69
70   Standard_EXPORT  AIS_LengthDimension (const gp_Pnt& theFirstPoint,
71                                         const gp_Pnt& theSecondPoint,
72                                         const gp_Pln& theDimensionPlane);
73
74   //! Constructs a length dimension between two shapes(vertices, edges, shapes) with custom working plane
75   Standard_EXPORT AIS_LengthDimension (const TopoDS_Shape& theFirstShape,
76                                        const TopoDS_Shape& theSecondShape,
77                                        const gp_Pln& theWorkingPlane);
78
79   Standard_EXPORT  AIS_LengthDimension (const TopoDS_Edge& theEdge,
80                                         const gp_Pln& theWorkingPlane);
81
82   Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFirstFace,
83                                        const TopoDS_Face& theSecondFace);
84
85   Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFace,
86                                        const TopoDS_Edge& theEdge);
87
88 public:
89
90   DEFINE_STANDARD_RTTI(AIS_LengthDimension)
91
92 private:
93
94   Standard_Boolean initTwoEdgesLength (const TopoDS_Edge & theFirstEdge,
95                                        const TopoDS_Edge& theSecondEdge,
96                                        gp_Dir& theDirAttach);
97
98   //! Auxiliary method for <InitTwoShapesPoints()>
99   //! in case of the distance between edge and vertex
100   Standard_Boolean initEdgeVertexLength (const TopoDS_Edge & theEdge,
101                                          const TopoDS_Vertex & theVertex,
102                                          gp_Dir & theDirAttach,
103                                          Standard_Boolean isInfinite);
104
105   //! Auxiliary method for <InitTwoShapesPoints()>
106   //! in case of the distance between face and edge
107   Standard_Boolean initEdgeFaceLength (const TopoDS_Edge& theEdge,
108                                        const TopoDS_Face& theFace,
109                                        gp_Dir& theDirAttach);
110
111   //! Initialization of two attach points in case of two owner shapes
112   Standard_Boolean initTwoShapesPoints (const TopoDS_Shape& theFirstShape,
113                                         const TopoDS_Shape& theSecondShape);
114
115   //! Initialization of two attach points in case of one owner shape
116   Standard_Boolean initOneShapePoints (const TopoDS_Shape& theShape);
117
118   //! Compute length in display units.
119   virtual void computeValue();
120
121   virtual  void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
122                          const Handle(Prs3d_Presentation)& thePresentation,
123                          const Standard_Integer theMode = 0) ;
124 };
125
126 #endif