0024293: Dimension extensions don't belong to the dimension sensitive entity: compute...
[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 dimention  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   //! Constructor with full parameter list.
71   //! Construct dimension between two vertices.
72   //! Style of line, arrow and text can be set by default.
73   Standard_EXPORT  AIS_LengthDimension (const gp_Pnt& theFirstPoint,
74                                         const gp_Pnt& theSecondPoint,
75                                         const gp_Pln& theDimensionPlane,
76                                         const Handle(Prs3d_DimensionAspect)& theDimensionAspect,
77                                         const Standard_Real theExtensionSize = 1.0);
78
79   Standard_EXPORT  AIS_LengthDimension (const gp_Pnt& theFirstPoint,
80                                         const gp_Pnt& theSecondPoint,
81                                         const gp_Pln& theDimensionPlane);
82
83   //! Constructs a length dimension between two shapes(vertices, edges, shapes) with custom working plane
84   Standard_EXPORT AIS_LengthDimension (const TopoDS_Shape& theFirstShape,
85                                        const TopoDS_Shape& theSecondShape,
86                                        const gp_Pln& theWorkingPlane);
87
88   Standard_EXPORT  AIS_LengthDimension (const TopoDS_Edge& theEdge,
89                                         const gp_Pln& theWorkingPlane);
90
91   Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFirstFace,
92                                        const TopoDS_Face& theSecondFace);
93
94   Standard_EXPORT AIS_LengthDimension (const TopoDS_Face& theFace,
95                                        const TopoDS_Edge& theEdge);
96
97   DEFINE_STANDARD_RTTI(AIS_LengthDimension)
98 private:
99   Standard_Boolean initTwoEdgesLength (const TopoDS_Edge & theFirstEdge,
100                            const TopoDS_Edge& theSecondEdge,
101                            gp_Dir& theDirAttach);
102   //! Auxiliary method for <InitTwoShapesPoints()>
103   //! in case of the distance between edge and vertex
104   Standard_Boolean initEdgeVertexLength (const TopoDS_Edge & theEdge,
105                              const TopoDS_Vertex & theVertex,
106                              gp_Dir & theDirAttach,
107                              Standard_Boolean isInfinite);
108   //! Auxiliary method for <InitTwoShapesPoints()>
109   //! in case of the distance between face and edge
110   Standard_Boolean initEdgeFaceLength (const TopoDS_Edge& theEdge,
111                                        const TopoDS_Face& theFace,
112                                        gp_Dir& theDirAttach);
113   //! Initialization of two attach points in case of two owner shapes
114   Standard_Boolean initTwoShapesPoints (const TopoDS_Shape& theFirstShape,
115                             const TopoDS_Shape& theSecondShape);
116   //! Initialization of two attach points in case of one owner shape
117   Standard_Boolean initOneShapePoints (const TopoDS_Shape& theShape);
118
119   //! Compute length in display units.
120   virtual void computeValue ();
121
122   virtual  void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
123                          const Handle(Prs3d_Presentation)& thePresentation,
124                          const Standard_Integer theMode = 0) ;
125
126 };
127
128 #endif