0028631: Modeling Algorithms - Crash while building a 2D circle tangent to another...
[occt.git] / src / GeometryTest / GeometryTest_DrawableQualifiedCurve2d.cxx
1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <GeometryTest_DrawableQualifiedCurve2d.hxx>
17
18 #include <GccEnt.hxx>
19 #include <Geom2d_Circle.hxx>
20 #include <Geom2d_Curve.hxx>
21 #include <Geom2d_Line.hxx>
22
23 IMPLEMENT_STANDARD_RTTIEXT(GeometryTest_DrawableQualifiedCurve2d, DrawTrSurf_Curve2d)
24
25 //=======================================================================
26 //function : GeometryTest_DrawableQualifiedCurve2d
27 //purpose  : 
28 //=======================================================================
29
30 GeometryTest_DrawableQualifiedCurve2d::GeometryTest_DrawableQualifiedCurve2d (const Handle(Geom2d_Curve)& theCurve,
31                                                                               const GccEnt_Position thePosition,
32                                                                               const Standard_Boolean theDispOrigin)
33 : DrawTrSurf_Curve2d (theCurve, theDispOrigin), myPosition (thePosition)
34 {
35   look = Draw_orange;
36 }
37
38 //=======================================================================
39 //function : GeometryTest_DrawableQualifiedCurve2d
40 //purpose  : 
41 //=======================================================================
42
43 GeometryTest_DrawableQualifiedCurve2d::GeometryTest_DrawableQualifiedCurve2d (const Handle(Geom2d_Curve)& theCurve,
44                                                                               const Draw_Color& theColor,
45                                                                               const Standard_Integer theDiscret,
46                                                                               const GccEnt_Position thePosition,
47                                                                               const Standard_Boolean theDispOrigin,
48                                                                               const Standard_Boolean theDispCurvRadius,
49                                                                               const Standard_Real theRadiusMax,
50                                                                               const Standard_Real theRatioOfRadius)
51 : DrawTrSurf_Curve2d (theCurve, theColor, theDiscret, theDispOrigin, theDispCurvRadius, theRadiusMax, theRatioOfRadius),
52   myPosition (thePosition)
53 {
54   look = Draw_orange;
55 }
56
57 //=======================================================================
58 //function : DrawOn
59 //purpose  : 
60 //=======================================================================
61
62 void GeometryTest_DrawableQualifiedCurve2d::DrawOn (Draw_Display& theDisplay) const
63 {
64   DrawTrSurf_Curve2d::DrawOn (theDisplay);
65 }
66
67 //=======================================================================
68 //function : Dump
69 //purpose  : 
70 //=======================================================================
71
72 void  GeometryTest_DrawableQualifiedCurve2d::Dump (Standard_OStream& theStream) const 
73 {
74   theStream << "Qualified curve 2D: \n";
75   theStream << "Position :" << GccEnt::PositionToString (myPosition) << "\n";
76   DrawTrSurf_Curve2d::Dump (theStream);
77 }
78
79 //=======================================================================
80 //function : Whatis
81 //purpose  : 
82 //=======================================================================
83
84 void  GeometryTest_DrawableQualifiedCurve2d::Whatis (Draw_Interpretor& theDI)const 
85 {
86   Handle(Standard_Type) aType = GetCurve()->DynamicType();
87
88   if (aType == STANDARD_TYPE (Geom2d_Circle))
89   {
90     theDI << "qualified 2d Circle";
91   }
92   else if (aType == STANDARD_TYPE (Geom2d_Line))
93   {
94     theDI << "qualified 2d Line";
95   }
96 }