0024547: Convertation of the generic classes to the non-generic (math).
[occt.git] / src / AIS / AIS_RadiusDimension.hxx
CommitLineData
a6eb515f 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
a6eb515f 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
a6eb515f 5//
973c2be1 6// This library is free software; you can redistribute it and / or modify it
7// under the terms of the GNU Lesser General Public version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
a6eb515f 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
a6eb515f 14
a6eb515f 15#ifndef _AIS_RadiusDimension_HeaderFile
16#define _AIS_RadiusDimension_HeaderFile
17
18#include <AIS.hxx>
19#include <AIS_Dimension.hxx>
a6eb515f 20#include <gp_Pnt.hxx>
60bf98ae 21#include <gp_Circ.hxx>
a6eb515f 22#include <Standard.hxx>
23#include <Standard_Macro.hxx>
a6eb515f 24
60bf98ae 25DEFINE_STANDARD_HANDLE (AIS_RadiusDimension,AIS_Dimension)
26
27//! Radius dimension. Can be constructued:
28//! - On generic circle.
29//! - On generic circle with user-defined anchor point on that circle.
30//! - On generic shape containing geometry that can be measured
31//! by diameter dimension: circle wire, arc, circular face, etc.
32//! The anchor point is the location of left attachement point of
33//! dimension on the circle. It can be user-specified, or computed as
34//! middle point on the arc. The radius dimension always lies in the
35//! plane of the measured circle. The dimension is considered as
36//! invalid if the user-specified anchor point is not lying on the circle,
37//! if the radius of the circle is less than Precision::Confusion().
38//! In case if the dimension is built on the arbitrary shape,
39//! it can be considered as invalid if the shape does not contain
40//! circle geometry.
a6eb515f 41class AIS_RadiusDimension : public AIS_Dimension
42{
43public:
a6eb515f 44
60bf98ae 45 //! Create radius dimension for the circle geometry.
46 //! @param theCircle [in] the circle to measure.
47 Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle);
48
49 //! Create radius dimension for the circle geometry and define its
50 //! orientation by location of the first point on that circle.
51 //! @param theCircle [in] the circle to measure.
52 //! @param theAnchorPoint [in] the point to define the position
53 //! of the dimension attachement on the circle.
54 Standard_EXPORT AIS_RadiusDimension (const gp_Circ& theCircle,
55 const gp_Pnt& theAnchorPoint);
56
57 //! Create radius dimension for the arbitrary shape (if possible).
58 //! @param theShape [in] the shape to measure.
59 Standard_EXPORT AIS_RadiusDimension (const TopoDS_Shape& theShape);
60
61public:
62
63 //! @return measured geometry circle.
64 const gp_Circ& Circle() const
65 {
66 return myCircle;
67 }
68
69 //! @return anchor point on circle for radius dimension.
70 const gp_Pnt& AnchorPoint() const
71 {
72 return myAnchorPoint;
73 }
a6eb515f 74
60bf98ae 75 //! @return the measured shape.
76 const TopoDS_Shape& Shape() const
77 {
78 return myShape;
79 }
a6eb515f 80
60bf98ae 81public:
82
83 //! Measure radius of the circle.
84 //! The dimension will become invalid if the radius of the circle
85 //! is less than Precision::Confusion().
86 //! @param theCircle [in] the circle to measure.
87 Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle);
88
89 //! Measure radius of the circle and orient the dimension so
90 //! the dimension lines attaches to anchor point on the circle.
91 //! The dimension will become invalid if the radiuss of the circle
92 //! is less than Precision::Confusion().
93 //! @param theCircle [in] the circle to measure.
94 //! @param theAnchorPoint [in] the point to attach the dimension lines.
95 Standard_EXPORT void SetMeasuredGeometry (const gp_Circ& theCircle,
96 const gp_Pnt& theAnchorPoint);
97
98 //! Measure radius on the passed shape, if applicable.
99 //! The dimension will become invalid if the passed shape is not
100 //! measurable or if measured diameter value is less than Precision::Confusion().
101 //! @param theShape [in] the shape to measure.
102 Standard_EXPORT void SetMeasuredGeometry (const TopoDS_Shape& theShape);
103
104 //! @return the display units string.
105 Standard_EXPORT virtual const TCollection_AsciiString& GetDisplayUnits () const;
106
107 //! @return the model units string.
108 Standard_EXPORT virtual const TCollection_AsciiString& GetModelUnits () const;
109
110 Standard_EXPORT virtual void SetDisplayUnits (const TCollection_AsciiString& theUnits);
111
112 Standard_EXPORT virtual void SetModelUnits (const TCollection_AsciiString& theUnits);
a6eb515f 113
60bf98ae 114public:
115
116 DEFINE_STANDARD_RTTI (AIS_RadiusDimension)
a6eb515f 117
118protected:
d7bffd44 119
60bf98ae 120 Standard_EXPORT virtual void ComputePlane();
d7bffd44 121
60bf98ae 122 //! Checks if anchor point and the center of the circle are on the plane.
123 Standard_EXPORT virtual Standard_Boolean CheckPlane (const gp_Pln& thePlane) const;
a6eb515f 124
60bf98ae 125 Standard_EXPORT virtual Standard_Real ComputeValue() const;
d7bffd44 126
60bf98ae 127 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
128 const Handle(Prs3d_Presentation)& thePresentation,
129 const Standard_Integer theMode = 0);
130
131protected:
132
133 Standard_EXPORT Standard_Boolean IsValidCircle (const gp_Circ& theCircle) const;
134
135 Standard_EXPORT Standard_Boolean IsValidAnchor (const gp_Circ& theCircle,
136 const gp_Pnt& thePnt) const;
a6eb515f 137
d7bffd44 138private:
a6eb515f 139
60bf98ae 140 gp_Circ myCircle;
141 gp_Pnt myAnchorPoint;
142 TopoDS_Shape myShape;
a6eb515f 143};
60bf98ae 144
145#endif // _AIS_RadiusDimension_HeaderFile