b311480e |
1 | // Created on: 1995-12-01 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1995-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 <Draw_Color.hxx> |
19 | #include <Draw_Display.hxx> |
7fd59977 |
20 | #include <Draw_Interpretor.hxx> |
42cf5bc1 |
21 | #include <Draw_Text3D.hxx> |
22 | #include <Geom_Curve.hxx> |
23 | #include <gp_Pnt.hxx> |
24 | #include <Standard_Type.hxx> |
25 | #include <TestTopOpeDraw_DrawableC3D.hxx> |
7fd59977 |
26 | #include <TopOpeBRepTool_define.hxx> |
27 | |
92efcf78 |
28 | IMPLEMENT_STANDARD_RTTIEXT(TestTopOpeDraw_DrawableC3D,DrawTrSurf_Curve) |
29 | |
7fd59977 |
30 | //======================================================================= |
31 | //function : TestTopOpeDraw_DrawableC3D |
32 | //purpose : |
33 | //======================================================================= |
34 | TestTopOpeDraw_DrawableC3D::TestTopOpeDraw_DrawableC3D |
35 | (const Handle(Geom_Curve)& C, const Draw_Color& CColor, |
36 | const Standard_CString Text, const Draw_Color& TextColor, |
37 | const Standard_Integer Discret, const Standard_Real Deflect,const Standard_Integer DrawMode, const Standard_Boolean DispOrigin) : |
38 | DrawTrSurf_Curve(C,CColor,Discret,Deflect,DrawMode,DispOrigin), |
39 | myText(Text),myTextColor(TextColor) |
40 | { |
41 | myText3D = new Draw_Text3D(Pnt(),Text,TextColor); |
42 | } |
43 | |
44 | //======================================================================= |
45 | //function : TestTopOpeDraw_DrawableC3D |
46 | //purpose : |
47 | //======================================================================= |
48 | TestTopOpeDraw_DrawableC3D::TestTopOpeDraw_DrawableC3D |
49 | (const Handle(Geom_Curve)& C, const Draw_Color& CColor) : |
50 | DrawTrSurf_Curve(C,CColor,16,0.01,1), //Discret,Deflect,DrawMode |
51 | myText(""), |
52 | myTextColor(CColor) |
53 | { |
54 | DrawTrSurf_Curve::DisplayOrigin(Standard_True); |
55 | myText3D = new Draw_Text3D(Pnt(),"",CColor); |
56 | } |
57 | |
58 | //======================================================================= |
59 | //function : TestTopOpeDraw_DrawableC3D |
60 | //purpose : |
61 | //======================================================================= |
62 | TestTopOpeDraw_DrawableC3D::TestTopOpeDraw_DrawableC3D |
63 | (const Handle(Geom_Curve)& C, const Draw_Color& CColor, |
64 | const Standard_CString Text, const Draw_Color& TextColor) : |
65 | DrawTrSurf_Curve(C,CColor,16,0.01,1), //Discret,Deflect,DrawMode |
66 | myText(Text), |
67 | myTextColor(TextColor) |
68 | { |
69 | DrawTrSurf_Curve::DisplayOrigin(Standard_True); |
70 | myText3D = new Draw_Text3D(Pnt(),Text,TextColor); |
71 | } |
72 | |
73 | //======================================================================= |
74 | //function : Pnt |
75 | //purpose : |
76 | //======================================================================= |
77 | gp_Pnt TestTopOpeDraw_DrawableC3D::Pnt() const |
78 | { |
79 | const Handle(Geom_Curve)& GC = GetCurve(); |
80 | Standard_Real f = GC->FirstParameter(); |
81 | Standard_Real l = GC->LastParameter(); |
82 | Standard_Real t = 1/2.; |
83 | Standard_Real p = t*f + (1-t)*l; |
84 | gp_Pnt P = GC->Value(p); |
85 | return P; |
86 | } |
87 | |
88 | //======================================================================= |
89 | //function : ChangePnt |
90 | //purpose : |
91 | //======================================================================= |
35e08fe8 |
92 | void TestTopOpeDraw_DrawableC3D::ChangePnt(const gp_Pnt&) |
7fd59977 |
93 | { |
94 | myText3D = new Draw_Text3D(Pnt(),myText,myTextColor); |
95 | } |
96 | |
97 | //======================================================================= |
98 | //function : ChangeCurve |
99 | //purpose : |
100 | //======================================================================= |
101 | void TestTopOpeDraw_DrawableC3D::ChangeCurve(const Handle(Geom_Curve)& GC) |
102 | { |
103 | curv = GC; |
104 | } |
105 | |
106 | //======================================================================= |
107 | //function : ChangeText |
108 | //purpose : |
109 | //======================================================================= |
110 | void TestTopOpeDraw_DrawableC3D::ChangeText(const Standard_CString T) |
111 | { |
112 | myText = T; |
113 | myText3D = new Draw_Text3D(Pnt(),T,myTextColor); |
114 | } |
115 | |
116 | //======================================================================= |
117 | //function : Whatis |
118 | //purpose : |
119 | //======================================================================= |
120 | void TestTopOpeDraw_DrawableC3D::Whatis(Draw_Interpretor& s)const |
121 | { |
122 | if (!curv.IsNull()) s << "DrawableC3D"; |
123 | } |
124 | |
125 | //======================================================================= |
126 | //function : DrawOn |
127 | //purpose : |
128 | //======================================================================= |
129 | void TestTopOpeDraw_DrawableC3D::DrawOn(Draw_Display& dis) const |
130 | { |
131 | DrawTrSurf_Curve::DrawOn(dis); |
132 | myText3D->DrawOn(dis); |
133 | } |
134 | |
135 | //======================================================================= |
136 | //function : Name |
137 | //purpose : |
138 | //======================================================================= |
139 | void TestTopOpeDraw_DrawableC3D::Name(const Standard_CString N) |
140 | { |
141 | char* temp = new char[2]; |
142 | temp[0] = ' ' ; |
143 | temp[1] = 0; |
144 | strcat(temp, N); |
145 | Draw_Drawable3D::Name(temp); |
146 | ChangeText(temp); |
147 | } |