Integration of OCCT 6.5.0 from SVN
[occt.git] / src / TestTopOpeDraw / TestTopOpeDraw_DrawableC3D.cxx
CommitLineData
7fd59977 1// File: TestTopOpeDraw_DrawableC3D.cxx
2// Created: Fri Dec 1 18:06:28 1995
3// Author: Jean Yves LEBEY
4// <jyl@meteox>
5
6#include <TestTopOpeDraw_DrawableC3D.ixx>
7#include <Draw_Interpretor.hxx>
8#include <TopOpeBRepTool_define.hxx>
9
10//=======================================================================
11//function : TestTopOpeDraw_DrawableC3D
12//purpose :
13//=======================================================================
14TestTopOpeDraw_DrawableC3D::TestTopOpeDraw_DrawableC3D
15(const Handle(Geom_Curve)& C, const Draw_Color& CColor,
16 const Standard_CString Text, const Draw_Color& TextColor,
17 const Standard_Integer Discret, const Standard_Real Deflect,const Standard_Integer DrawMode, const Standard_Boolean DispOrigin) :
18 DrawTrSurf_Curve(C,CColor,Discret,Deflect,DrawMode,DispOrigin),
19 myText(Text),myTextColor(TextColor)
20{
21 myText3D = new Draw_Text3D(Pnt(),Text,TextColor);
22}
23
24//=======================================================================
25//function : TestTopOpeDraw_DrawableC3D
26//purpose :
27//=======================================================================
28TestTopOpeDraw_DrawableC3D::TestTopOpeDraw_DrawableC3D
29(const Handle(Geom_Curve)& C, const Draw_Color& CColor) :
30 DrawTrSurf_Curve(C,CColor,16,0.01,1), //Discret,Deflect,DrawMode
31 myText(""),
32 myTextColor(CColor)
33{
34 DrawTrSurf_Curve::DisplayOrigin(Standard_True);
35 myText3D = new Draw_Text3D(Pnt(),"",CColor);
36}
37
38//=======================================================================
39//function : TestTopOpeDraw_DrawableC3D
40//purpose :
41//=======================================================================
42TestTopOpeDraw_DrawableC3D::TestTopOpeDraw_DrawableC3D
43(const Handle(Geom_Curve)& C, const Draw_Color& CColor,
44 const Standard_CString Text, const Draw_Color& TextColor) :
45 DrawTrSurf_Curve(C,CColor,16,0.01,1), //Discret,Deflect,DrawMode
46 myText(Text),
47 myTextColor(TextColor)
48{
49 DrawTrSurf_Curve::DisplayOrigin(Standard_True);
50 myText3D = new Draw_Text3D(Pnt(),Text,TextColor);
51}
52
53//=======================================================================
54//function : Pnt
55//purpose :
56//=======================================================================
57gp_Pnt TestTopOpeDraw_DrawableC3D::Pnt() const
58{
59 const Handle(Geom_Curve)& GC = GetCurve();
60 Standard_Real f = GC->FirstParameter();
61 Standard_Real l = GC->LastParameter();
62 Standard_Real t = 1/2.;
63 Standard_Real p = t*f + (1-t)*l;
64 gp_Pnt P = GC->Value(p);
65 return P;
66}
67
68//=======================================================================
69//function : ChangePnt
70//purpose :
71//=======================================================================
72void TestTopOpeDraw_DrawableC3D::ChangePnt(const gp_Pnt& P)
73{
74 myText3D = new Draw_Text3D(Pnt(),myText,myTextColor);
75}
76
77//=======================================================================
78//function : ChangeCurve
79//purpose :
80//=======================================================================
81void TestTopOpeDraw_DrawableC3D::ChangeCurve(const Handle(Geom_Curve)& GC)
82{
83 curv = GC;
84}
85
86//=======================================================================
87//function : ChangeText
88//purpose :
89//=======================================================================
90void TestTopOpeDraw_DrawableC3D::ChangeText(const Standard_CString T)
91{
92 myText = T;
93 myText3D = new Draw_Text3D(Pnt(),T,myTextColor);
94}
95
96//=======================================================================
97//function : Whatis
98//purpose :
99//=======================================================================
100void TestTopOpeDraw_DrawableC3D::Whatis(Draw_Interpretor& s)const
101{
102 if (!curv.IsNull()) s << "DrawableC3D";
103}
104
105//=======================================================================
106//function : DrawOn
107//purpose :
108//=======================================================================
109void TestTopOpeDraw_DrawableC3D::DrawOn(Draw_Display& dis) const
110{
111 DrawTrSurf_Curve::DrawOn(dis);
112 myText3D->DrawOn(dis);
113}
114
115//=======================================================================
116//function : Name
117//purpose :
118//=======================================================================
119void TestTopOpeDraw_DrawableC3D::Name(const Standard_CString N)
120{
121 char* temp = new char[2];
122 temp[0] = ' ' ;
123 temp[1] = 0;
124 strcat(temp, N);
125 Draw_Drawable3D::Name(temp);
126 ChangeText(temp);
127}