1 // Created on: 1995-12-01
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1995-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Draw_Color.hxx>
19 #include <Draw_Display.hxx>
20 #include <Draw_Interpretor.hxx>
21 #include <Draw_Text2D.hxx>
22 #include <Geom2d_Curve.hxx>
23 #include <gp_Pnt2d.hxx>
24 #include <Standard_Type.hxx>
25 #include <TestTopOpeDraw_DrawableC2D.hxx>
26 #include <TopOpeBRepTool_define.hxx>
28 IMPLEMENT_STANDARD_RTTIEXT(TestTopOpeDraw_DrawableC2D,DrawTrSurf_Curve2d)
30 //=======================================================================
31 //function : TestTopOpeDraw_DrawableC2D
33 //=======================================================================
34 TestTopOpeDraw_DrawableC2D::TestTopOpeDraw_DrawableC2D
35 (const Handle(Geom2d_Curve)& C, const Draw_Color& CColor,
36 const Standard_CString Text, const Draw_Color& TextColor,
37 const Standard_Integer Discret, const Standard_Boolean DispOrigin, const Standard_Boolean DispCurvRadius,
38 const Standard_Real RadiusMax, const Standard_Real RadiusRatio) :
39 DrawTrSurf_Curve2d(C,CColor,Discret,DispOrigin,DispCurvRadius,RadiusMax,RadiusRatio),
41 myTextColor(TextColor)
43 myText2D = new Draw_Text2D(Pnt2d(),Text,TextColor);
46 //=======================================================================
47 //function : TestTopOpeDraw_DrawableC2D
49 //=======================================================================
51 TestTopOpeDraw_DrawableC2D::TestTopOpeDraw_DrawableC2D
52 (const Handle(Geom2d_Curve)& C, const Draw_Color& CColor) :
53 DrawTrSurf_Curve2d(C,CColor,16,Standard_True,Standard_False,0.01,1), //Discret,Deflect,DrawMode
57 myText2D = new Draw_Text2D(Pnt2d(),"",CColor);
60 //=======================================================================
61 //function : TestTopOpeDraw_DrawableC2D
63 //=======================================================================
65 TestTopOpeDraw_DrawableC2D::TestTopOpeDraw_DrawableC2D
66 (const Handle(Geom2d_Curve)& C, const Draw_Color& CColor,
67 const Standard_CString Text, const Draw_Color& TextColor) :
68 DrawTrSurf_Curve2d(C,CColor,16,Standard_True,Standard_False,0.01,1), //Discret,Deflect,DrawMode
70 myTextColor(TextColor)
72 myText2D = new Draw_Text2D(Pnt2d(),Text,TextColor);
75 //=======================================================================
78 //=======================================================================
80 gp_Pnt2d TestTopOpeDraw_DrawableC2D::Pnt2d() const
82 const Handle(Geom2d_Curve)& GC = GetCurve();
83 Standard_Real f = GC->FirstParameter();
84 Standard_Real l = GC->LastParameter();
85 Standard_Real t = 1/2.;
86 Standard_Real p = t*f + (1-t)*l;
87 gp_Pnt2d P = GC->Value(p);
91 //=======================================================================
92 //function : ChangePnt2d
94 //=======================================================================
96 void TestTopOpeDraw_DrawableC2D::ChangePnt2d(const gp_Pnt2d&)
98 myText2D = new Draw_Text2D(Pnt2d(),myText,myTextColor);
101 //=======================================================================
102 //function : ChangeCurve
104 //=======================================================================
106 void TestTopOpeDraw_DrawableC2D::ChangeCurve(const Handle(Geom2d_Curve)& GC)
111 //=======================================================================
112 //function : ChangeText
114 //=======================================================================
116 void TestTopOpeDraw_DrawableC2D::ChangeText(const Standard_CString T)
119 myText2D = new Draw_Text2D(Pnt2d(),T,myTextColor);
122 //=======================================================================
125 //=======================================================================
127 void TestTopOpeDraw_DrawableC2D::Whatis(Draw_Interpretor& s)const
133 //=======================================================================
136 //=======================================================================
137 void TestTopOpeDraw_DrawableC2D::DrawOn(Draw_Display& dis) const
139 DrawTrSurf_Curve2d::DrawOn(dis);
140 myText2D->DrawOn(dis);
143 //=======================================================================
146 //=======================================================================
148 void TestTopOpeDraw_DrawableC2D::Name(const Standard_CString N)
150 char* temp = new char[2];
154 Draw_Drawable3D::Name(temp);