0024389: Invalid hilight of AIS dimension line in local selection
[occt.git] / src / AIS / AIS_AngleDimension.hxx
CommitLineData
a6eb515f 1// Copyright (c) 1995-1999 Matra Datavision
2// Copyright (c) 1999-2013 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
19//! A framework to define display of angles. <br>
20//! These displays are particularly useful in viewing draft prisms. <br>
21//! The angle displayed may define an intersection <br>
22//! can be between two edges or two faces of a shape <br>
23//! or a plane. The display consists of arrows and text. <br>
24
25#ifndef _AIS_AngleDimension_HeaderFile
26#define _AIS_AngleDimension_HeaderFile
27
28#include <AIS_Dimension.hxx>
29#include <Geom_Plane.hxx>
30#include <Geom_Line.hxx>
31#include <Geom_Transformation.hxx>
32#include <gp.hxx>
33#include <gp_Ax1.hxx>
34#include <gp_Dir.hxx>
35#include <gp_Pnt.hxx>
36#include <Prs3d_DimensionAspect.hxx>
37#include <Prs3d_Projector.hxx>
38#include <Prs3d_Presentation.hxx>
39#include <Standard.hxx>
40#include <Standard_Macro.hxx>
41#include <Standard_DefineHandle.hxx>
42#include <TopoDS.hxx>
43#include <TopoDS_Edge.hxx>
44#include <TopoDS_Face.hxx>
45
46DEFINE_STANDARD_HANDLE (AIS_AngleDimension, AIS_Dimension)
47
48class AIS_AngleDimension : public AIS_Dimension
49{
50public:
d7bffd44 51
a6eb515f 52 //! Constructs angle dimension between two edges
53 //! with automatic working plane computing
54 //! if it is possible. In case of PI angle please
55 //! set custom working plane or use constructor with 3 parameters.
56 Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
57 const TopoDS_Edge& theSecondEdge);
58 //! Constructs the angle display object defined by the <br>
59 //! two edges and custom working plane.
60 //! ATTENTION :In case if the working plane is custom and one edge is out of the
61 //! working plane it tries to project this edge line on the plane.
62 //! To avoid this case you can reset the working plane
63 //! using <ResetWorkingPlane ()> method.
64 Standard_EXPORT AIS_AngleDimension (const TopoDS_Edge& theFirstEdge,
65 const TopoDS_Edge& theSecondEdge,
66 const gp_Pln& thePlane);
a6eb515f 67
68 //! Constructs the angle display object defined by three points.
69 Standard_EXPORT AIS_AngleDimension (const gp_Pnt& theFirstPoint,
70 const gp_Pnt& theSecondPoint,
71 const gp_Pnt& theThirdPoint);
72
a6eb515f 73 //! Angle of cone
74 Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theCone);
75
76 //! TwoPlanarFaceAngle dimension
77 Standard_EXPORT AIS_AngleDimension (const TopoDS_Face& theFirstFace,
78 const TopoDS_Face& theSecondFace,
79 const gp_Ax1& theAxis);
80
a6eb515f 81 //! Sets first shape
82 Standard_EXPORT void SetFirstShape (const TopoDS_Shape& theShape,
83 const Standard_Boolean isSingleShape = Standard_False);
84
d7bffd44 85public:
86
87 DEFINE_STANDARD_RTTI (AIS_AngleDimension)
a6eb515f 88
89protected:
90
91 //! Computes dimension value in display units
92 Standard_EXPORT virtual void computeValue();
93
94 Standard_EXPORT void init();
95
96 Standard_EXPORT gp_Pnt getCenterOnArc (const gp_Pnt& theFirstAttach,
97 const gp_Pnt& theSecondAttach);
98
99 Standard_EXPORT void drawArc (const Handle(Prs3d_Presentation)& thePresentation,
100 const gp_Pnt& theFirstAttach,
101 const gp_Pnt& theSecondAttach,
102 const gp_Pnt& theCenter,
103 const Standard_Real theRadius,
fe83e1ea 104 const Standard_Integer theMode);
a6eb515f 105
106 Standard_EXPORT void drawArcWithText (const Handle(Prs3d_Presentation)& thePresentation,
107 const gp_Pnt& theFirstAttach,
108 const gp_Pnt& theSecondAttach,
109 const TCollection_ExtendedString& theText,
fe83e1ea 110 const Standard_Real theTextWidth,
111 const Standard_Integer theMode,
d7bffd44 112 const Standard_Integer theLabelPosition);
a6eb515f 113
114 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePM,
115 const Handle(Prs3d_Presentation)& thePresentation,
116 const Standard_Integer theMode = 0);
117
118 Standard_EXPORT Standard_Boolean initConeAngle (const TopoDS_Face& theCone);
119
120 Standard_EXPORT Standard_Boolean initTwoFacesAngle();
121
122 Standard_EXPORT Standard_Boolean initTwoEdgesAngle();
123
124 //! Auxiliary method to get position of the angle dimension
125 //! if the cone is trimmed
126 //! Returns 1 if <theC> center is above of <theCMin> center;
127 //! 0 if <theC> center is between <theCMin> and <theCMax> centers;
128 //! -1 if <theC> center is below <theCMax> center.
129 Standard_EXPORT Standard_Integer aboveInBelowCone (const gp_Circ &theCMax,
130 const gp_Circ &theCMin,
131 const gp_Circ &theC);
132
a6eb515f 133 //! Fills default plane object if it is possible to count plane automatically.
134 Standard_EXPORT virtual void countDefaultPlane ();
62b6361a 135
136 //! Fills sensitive entity for flyouts and adds it to the selection
137 Standard_EXPORT virtual void computeFlyoutSelection (const Handle(SelectMgr_Selection)& theSelection,
fe83e1ea 138 const Handle(SelectMgr_EntityOwner)& theOwner);
a6eb515f 139
140protected:
141
142 //! Shows if there is necessarily to draw extensions on angle dimension
143 //! It is set to the true value if the attachment point are out of the edges.
144 Standard_Boolean myIsFlyoutLines;
145
146 //! The center of dimension arc
147 gp_Pnt myCenter;
a6eb515f 148};
149
150#endif