0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / src / DrawDim / DrawDim_PlanarRadius.cxx
CommitLineData
b311480e 1// Created on: 1996-01-12
2// Created by: Denis PASCAL
3// Copyright (c) 1996-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
42cf5bc1 17
18#include <BRep_Tool.hxx>
19#include <Draw_Color.hxx>
20#include <Draw_Display.hxx>
7fd59977 21#include <DrawDim.hxx>
42cf5bc1 22#include <DrawDim_PlanarRadius.hxx>
23#include <ElCLib.hxx>
7fd59977 24#include <Geom_Circle.hxx>
42cf5bc1 25#include <Geom_Curve.hxx>
7fd59977 26#include <gp_Circ.hxx>
42cf5bc1 27#include <gp_Pnt.hxx>
28#include <Standard_Type.hxx>
7fd59977 29#include <TCollection_AsciiString.hxx>
7fd59977 30#include <TopExp.hxx>
31#include <TopoDS.hxx>
42cf5bc1 32#include <TopoDS_Face.hxx>
33#include <TopoDS_Shape.hxx>
7fd59977 34#include <TopoDS_Vertex.hxx>
35
92efcf78 36IMPLEMENT_STANDARD_RTTIEXT(DrawDim_PlanarRadius,DrawDim_PlanarDimension)
37
7fd59977 38//=======================================================================
39//function : DrawDim_PlanarRadius
40//purpose :
41//=======================================================================
7fd59977 42DrawDim_PlanarRadius::DrawDim_PlanarRadius(const TopoDS_Face& face, const TopoDS_Shape& c)
43{
44 myPlane = face;
45 myCircle = c;
46}
47
48
49//=======================================================================
50//function : DrawDim_PlanarRadius
51//purpose :
52//=======================================================================
53
54DrawDim_PlanarRadius::DrawDim_PlanarRadius(const TopoDS_Shape& c)
55{
56 myCircle = c;
57}
58
59
60//=======================================================================
61//function : DrawOn
62//purpose :
63//=======================================================================
64
65void DrawDim_PlanarRadius::DrawOn(Draw_Display& dis) const
66{
67 if (myCircle.ShapeType() == TopAbs_EDGE) {
68 Standard_Real f,l;
69 Handle(Geom_Curve) curve = BRep_Tool::Curve (TopoDS::Edge(myCircle),f,l);
70 if (curve->IsKind(STANDARD_TYPE(Geom_Circle))) {
71 gp_Circ circle = Handle(Geom_Circle)::DownCast(curve)->Circ();
72 const gp_Pnt& first = circle.Location();
73 TopoDS_Vertex vf, vl;
74 TopExp::Vertices(TopoDS::Edge(myCircle),vf,vl);
75 const gp_Pnt last = BRep_Tool::Pnt(vf);
76 //
77 dis.Draw (first,last);
78 gp_Pnt p ((first.X()+ last.X())/2,(first.Y()+ last.Y())/2,(first.Z()+ last.Z())/2);
79 DrawText(p,dis);
80 return;
81 }
82 }
0797d9d3 83#ifdef OCCT_DEBUG
7fd59977 84 cout << " DrawDim_PlanarRadius::DrawOn : dimension error" << endl;
63c629aa 85#endif
7fd59977 86}