0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- automatic
[occt.git] / samples / mfc / occtdemo / PointOnCurve / PointOnCurve_Presentation.cpp
CommitLineData
7fd59977 1// PointOnCurve_Presentation.cpp: implementation of the PointOnCurve_Presentation class.
2// Calculation of points on Curves
3//////////////////////////////////////////////////////////////////////
4
5#include "stdafx.h"
6#include "PointOnCurve_Presentation.h"
7
8#include <AIS_Point.hxx>
9#include <Precision.hxx>
10
11#include <Geom_Line.hxx>
12#include <Geom_TrimmedCurve.hxx>
13#include <gce_MakeLin.hxx>
14#include <TColgp_Array1OfPnt.hxx>
15#include <TColStd_Array1OfReal.hxx>
16#include <TColStd_Array2OfReal.hxx>
17#include <TCollection_AsciiString.hxx>
18#include <GeomAPI_PointsToBSpline.hxx>
19#include <GCPnts_UniformDeflection.hxx>
20#include <GCPnts_AbscissaPoint.hxx>
21#include <Geom_CartesianPoint.hxx>
22#include <GeomAdaptor_Curve.hxx>
23#include <GCPnts_UniformAbscissa.hxx>
24#include <Geom_BSplineCurve.hxx>
25
26#define DEGMIN 3
27#define DEGMAX 8
28#define SCALE 120
29
30#ifdef WNT
31 #define EOL "\r\n"
32#else
33 #define EOL "\n"
34#endif
35
36
37// Initialization of global variable with an instance of this class
38OCCDemo_Presentation* OCCDemo_Presentation::Current = new PointOnCurve_Presentation;
39
40// Initialization of array of samples
41const PointOnCurve_Presentation::PSampleFuncType PointOnCurve_Presentation::SampleFuncs[] =
42{
43 &PointOnCurve_Presentation::sample1,
44 &PointOnCurve_Presentation::sample2,
45 &PointOnCurve_Presentation::sample3,
46 &PointOnCurve_Presentation::sample4,
47 &PointOnCurve_Presentation::sample5
48};
49
50//////////////////////////////////////////////////////////////////////
51// Construction/Destruction
52//////////////////////////////////////////////////////////////////////
53
54PointOnCurve_Presentation::PointOnCurve_Presentation()
55{
56 FitMode=true;
57 myIndex = 0;
58 myNbSamples = sizeof(SampleFuncs)/sizeof(PSampleFuncType);
59 setName ("Points on Curves");
60}
61
62//////////////////////////////////////////////////////////////////////
63// Sample execution
64//////////////////////////////////////////////////////////////////////
65
66void PointOnCurve_Presentation::DoSample()
67{
68 if (myIndex >=0 && myIndex < myNbSamples)
69 (this->*SampleFuncs[myIndex])();
70}
71
72//////////////////////////////////////////////////////////////////////
73// Sample functions
74//////////////////////////////////////////////////////////////////////
75
76//================================================================
77// Function : CreateCurve
78// Purpose : creating a BSpline Curve
79//================================================================
80
92efcf78 81static Handle(Geom_BSplineCurve) CreateCurve()
7fd59977 82{
83 Standard_Real aCoords[][3] =
84 {
85 {-5,-1,0},{-2,3,0},{3,-2.5,0},{6,2,0}
86 };
87
88 Standard_Integer nPoles = sizeof(aCoords)/(sizeof(Standard_Real)*3);
89 TColgp_Array1OfPnt aCurvePoint (1, nPoles);
90
91 for (Standard_Integer i=0; i < nPoles; i++)
92 aCurvePoint(i+1) = gp_Pnt (aCoords[i][0]*SCALE, aCoords[i][1]*SCALE, aCoords[i][2]*SCALE);
93
94 GeomAPI_PointsToBSpline aPTB (
95 aCurvePoint,DEGMIN,DEGMAX,GeomAbs_C2,Precision::Confusion());
96
97 Handle (Geom_BSplineCurve) aCurve = aPTB.Curve();
98 return aCurve;
99}
100
101//================================================================
102// Function : PointOnCurve_Presentation::sample1
103// Purpose :
104//================================================================
105
106void PointOnCurve_Presentation::sample1()
107{
108 Standard_CString aTitle = "Uniform deflection distribution";
109 setResultTitle (aTitle);
110 TCollection_AsciiString aText (
111 "////////////////////////////////////////////////////////////////" EOL
112 "// Computing a distribution of points on a curve." EOL
113 "////////////////////////////////////////////////////////////////" EOL EOL
114
115 "//==============================================================" EOL
116 "// Uses a criterion of maximum deflection between" EOL
117 "//the curve and the polygon. The maximum distance between curve" EOL
118 "//and the polygon that results from the points of the " EOL
119 "//distribution is not greater than Deflection." EOL
120 "//===============================================================" EOL EOL
121
122 "// Data used by various samples:" EOL
123 "Standard_Real aCoords[][3] = " EOL
124 "{" EOL
125 "{-5,-1,0},{-2,3,0},{3,-2.5,0},{6,2,0}" EOL
126 "};" EOL EOL
127
128 "// Creating and initializing array of points:" EOL
129 "#define SCALE 120" EOL
130 "Standard_Integer nPoles = sizeof(aCoords)/(sizeof(Standard_Real)*3);" EOL
131 "TColgp_Array1OfPnt aCurvePoint (1, nPoles);" EOL
132 "for (Standard_Integer i=0; i < nPoles; i++)" EOL
133 " aCurvePoint(i+1) = " EOL
134 " gp_Pnt(aCoords[i][0]*SCALE, aCoords[i][1]*SCALE, aCoords[i][2]*SCALE);" EOL EOL
135
136 "// Creating a BSpline Curve with DegMin = 3, DegMax = 8" EOL
137 "//using defined above array of poles:" EOL
138 "GeomAPI_PointsToBSpline aPTB (aCurvePoint,DEGMIN,DEGMAX," EOL
139 " GeomAbs_C2,Precision::Confusion());" EOL EOL
140
141 "// The adapted curve is created in the following way:" EOL
142 "Handle (Geom_BSplineCurve) aCurve = aPTB.Curve();" EOL
143 "GeomAdaptor_Curve adapCurve (aCurve) ;" EOL EOL
144
145 "// Computing a distribution:" EOL
146 "Standard_Real Deflection = 0.6*SCALE ;" EOL
147 "//After that Deflection *= 0.2" EOL
148 "GCPnts_UniformDeflection aDefPoint(adapCurve,Deflection,Standard_True);" EOL EOL
149
150 "if ( aDefPoint.IsDone() )" EOL
151 "{ " EOL
152 " // Get the number of points of the distribution:" EOL
153 " Standard_Integer nbr = aDefPoint.NbPoints() ;" EOL
154 " // Getting the values of the point of index <i> in the distribution:" EOL
155 " for ( i = 1 ; i <= nbr ; i++ )" EOL
156 " {" EOL
157 " gp_Pnt aValueOfPoint = aDefPoint.Value(i);" EOL
158 " }" EOL
159 "}" EOL EOL
160 "//====================================================================" EOL EOL
161 );
162
163 setResultText(aText.ToCString());
164
165 Handle (Geom_BSplineCurve) aCurve = CreateCurve();
166
167 GeomAdaptor_Curve adapCurve (aCurve) ;
168
169 Standard_Real Deflection = 0.6*SCALE ;
170 Standard_Integer nbr;
171 for (Standard_Integer j = 1 ; j <=3 ; j++)
172 {
173 if (WAIT_A_LITTLE) return;
174 getAISContext()->EraseAll();
175 drawCurve(aCurve);
176
177 GCPnts_UniformDeflection aDefPoint(adapCurve,Deflection,Standard_True);
178 if ( aDefPoint.IsDone() )
179 {
180 if (WAIT_A_LITTLE) return;
181
182 nbr = aDefPoint.NbPoints() ;
183 for ( Standard_Integer i = 1 ; i <= nbr ; i++ )
184 {
185 drawPoint(aDefPoint.Value(i));
186 }
187
188 if (WAIT_A_LITTLE) return;
189
190 for ( i = 1 ; i <= nbr-1 ; i++ )
191 {
192 gp_Pnt aPoint1 = aDefPoint.Value(i);
193 gp_Pnt aPoint2 = aDefPoint.Value(i+1);
194 Standard_Real aDist = aPoint1.Distance(aPoint2);
195
196 gce_MakeLin aLin(aPoint1, aPoint2);
197
198 Standard_Real aParam = aPoint1.Distance(aPoint2);
92efcf78 199 Handle(Geom_TrimmedCurve) aSeg = new Geom_TrimmedCurve(new Geom_Line(aLin), 0, aParam);
7fd59977 200 drawCurve(aSeg, Quantity_NOC_GREEN1);
201 }
202 if (WAIT_A_LITTLE) return;
203 }
204
205 Standard_CString aString = "Deflection = ";
206 Comment(aString,aText,Deflection,nbr);
207 Deflection *= 0.2;
208 }
209
210}
211
212//================================================================
213// Function : PointOnCurve_Presentation::sample2
214// Purpose :
215//================================================================
216
217void PointOnCurve_Presentation::sample2()
218{
219 Standard_CString aTitle = "Computing a point by length" ;
220 setResultTitle (aTitle);
221 TCollection_AsciiString aText (
222 "////////////////////////////////////////////////////////////////" EOL
223 "// Computing a point on a curve." EOL
224 "////////////////////////////////////////////////////////////////" EOL EOL
225
226 "//==============================================================" EOL
227 "// Computes the point on the curve located at the curvilinear" EOL
228 "//distance Abscissa from the point of parameter U0. The distance " EOL
229 "//being measured along the curve (curvilinear abscissa on the curve)." EOL
230 "//==============================================================" EOL EOL
231
232 "// Data used by various samples:" EOL
233 "Standard_Real aCoords[][3] = " EOL
234 "{" EOL
235 " {-5,-1,0},{-2,3,0},{3,-2.5,0},{6,2,0}" EOL
236 "};" EOL EOL
237
238 "// Creating and initializing array of points:" EOL
239 "#define SCALE 120" EOL
240 "Standard_Integer nPoles = sizeof(aCoords)/(sizeof(Standard_Real)*3);" EOL
241 "TColgp_Array1OfPnt aCurvePoint (1, nPoles);" EOL
242 "for (Standard_Integer i=0; i < nPoles; i++)" EOL
243 " aCurvePoint(i+1) = " EOL
244 " gp_Pnt(aCoords[i][0]*SCALE, aCoords[i][1]*SCALE, aCoords[i][2]*SCALE);" EOL EOL
245
246 "// Creating a BSpline Curve with DegMin = 3, DegMax = 8" EOL
247 "//using defined above array of poles:" EOL
248 "GeomAPI_PointsToBSpline aPTB (aCurvePoint,DEGMIN,DEGMAX," EOL
249 " GeomAbs_C2,Precision::Confusion());" EOL EOL
250
251 "//The adapted curve is created in the following way:" EOL
252 "Handle (Geom_BSplineCurve) aCurve = aPTB.Curve();" EOL
253 "GeomAdaptor_Curve adapCurve (aCurve) ;" EOL EOL
254
255 "//Computing a point:" EOL
256 "Standard_Real Abscissa = 3*SCALE , U0 = 0.27 ;" EOL
257 "//After that Abscissa *= 2 " EOL
258 "GCPnts_AbscissaPoint absPoint( adapCurve , Abscissa , U0 ) ;" EOL EOL
259
260 "if ( absPoint.IsDone() )" EOL
261 "{" EOL
262 " //Getting the value of the point:" EOL
263 " gp_Pnt aPnt;" EOL
264 " Standard_Real aParam = absPoint.Parameter() ;" EOL
265 " aCurve->D0(aParam,aPnt);" EOL
266 "}" EOL EOL
267
268 "//====================================================================" EOL EOL
269 );
270
271 setResultText(aText.ToCString());
272
273 Handle (Geom_BSplineCurve) aCurve = CreateCurve();
274
275 GeomAdaptor_Curve adapCurve (aCurve);
276
277 gp_Pnt aPnt1,aPnt2;
278 Standard_Real Abscissa = 3*SCALE , U0 = 0.27 ;
279 for (Standard_Integer j = 1 ; j <=3 ; j++)
280 {
281 if (WAIT_A_LITTLE) return;
282 getAISContext()->EraseAll();
283 drawCurve(aCurve);
284
285 GCPnts_AbscissaPoint absPoint( adapCurve , Abscissa , U0 ) ;
286 if ( absPoint.IsDone() )
287 {
288 if (WAIT_A_LITTLE) return;
289
290 Standard_Real aParam = absPoint.Parameter() ;
291 aCurve->D0(U0,aPnt1);
292 aCurve->D0(aParam,aPnt2);
293 drawPoint(aPnt1);
294 if (WAIT_A_LITTLE) return;
295 drawCurve(new Geom_TrimmedCurve(aCurve,U0,aParam),Quantity_NOC_GREEN1);
296 if (WAIT_A_LITTLE) return;
297 drawPoint(aPnt2);
298 }
299
300 Abscissa *= 2;
301 }
302
303}
304
305//================================================================
306// Function : PointOnCurve_Presentation::sample3
307// Purpose :
308//================================================================
309
310void PointOnCurve_Presentation::sample3()
311{
312 Standard_CString aTitle = "Uniform abscissa distribution";
313 setResultTitle (aTitle);
314 TCollection_AsciiString aText (
315 "////////////////////////////////////////////////////////////////" EOL
316 "// Computing a distribution of points on a curve." EOL
317 "////////////////////////////////////////////////////////////////" EOL EOL
318
319 "//==============================================================" EOL
320 "// Computes a uniform abscissa distribution of points on a curve." EOL
321 "//The distance between two consecutive points is measured along " EOL
322 "//the curve." EOL
323 "//==============================================================" EOL EOL
324
325 "// Data used by various samples:" EOL
326 "Standard_Real aCoords[][3] = " EOL
327 "{" EOL
328 " {-5,-1,0},{-2,3,0},{3,-2.5,0},{6,2,0}" EOL
329 "};" EOL EOL
330
331 "// Creating and initializing array of points:" EOL
332 "#define SCALE 120" EOL
333 "Standard_Integer nPoles = sizeof(aCoords)/(sizeof(Standard_Real)*3);" EOL
334 "TColgp_Array1OfPnt aCurvePoint (1, nPoles);" EOL
335 "for (Standard_Integer i=0; i < nPoles; i++)" EOL
336 " aCurvePoint(i+1) = " EOL
337 " gp_Pnt(aCoords[i][0]*SCALE, aCoords[i][1]*SCALE, aCoords[i][2]*SCALE);" EOL EOL
338
339 "// Creating a BSpline Curve with DegMin = 3, DegMax = 8" EOL
340 "//using defined above array of poles:" EOL
341 "GeomAPI_PointsToBSpline aPTB (aCurvePoint,DEGMIN,DEGMAX," EOL
342 " GeomAbs_C2,Precision::Confusion());" EOL EOL
343
344 "//The adapted curve is created in the following way:" EOL
345 "Handle (Geom_BSplineCurve) aCurve = aPTB.Curve();" EOL
346 "GeomAdaptor_Curve adapCurve (aCurve) ;" EOL EOL
347
348 "// Computing a distribution:" EOL
349 "Standard_Real Abscissa = 5*SCALE ;" EOL
350 "//After that Abscissa *= 0.5 " EOL
351 "GCPnts_UniformAbscissa absPoint( adapCurve , Abscissa ) ;" EOL EOL
352
353 "if ( absPoint.IsDone() )" EOL
354 "{" EOL
355 " // Get the number of points of the distribution:" EOL
356 " Standard_Integer nbr = absPoint.NbPoints() ;" EOL
357 " // Getting the values of the point of index <i> in the distribution:" EOL
358 " for ( i = 1 ; i <= nbr ; i++ )" EOL
359 " {" EOL
360 " aParam = absPoint.Parameter (i) ;" EOL
361 " gp_Pnt aPnt1;" EOL
362 " aCurve->D0(aParam,aPnt1);" EOL
363 " }" EOL
364 "}" EOL EOL
365
366 "//====================================================================" EOL EOL
367 );
368
369 setResultText(aText.ToCString());
370
371 Handle (Geom_BSplineCurve) aCurve = CreateCurve();
372 GeomAdaptor_Curve adapCurve (aCurve) ;
373
374 Standard_Real Abscissa = 5*SCALE ;
375 gp_Pnt aPnt1,aPnt2;
376 Standard_Integer nbr;
377
378 for (Standard_Integer j = 1 ; j <=3 ; j++)
379 {
380 if (WAIT_A_LITTLE) return;
381 getAISContext()->EraseAll();
382 drawCurve(aCurve);
383
384 GCPnts_UniformAbscissa absPoint( adapCurve , Abscissa ) ;
385 if ( absPoint.IsDone() )
386 {
387 Standard_Real aParam ;
388 nbr = absPoint.NbPoints() ;
389 if (WAIT_A_LITTLE) return;
390 for ( Standard_Integer i = 1 ; i <= nbr ; i++ )
391 {
392 aParam = absPoint.Parameter (i) ;
393 aCurve->D0(aParam,aPnt1);
394 drawPoint(aPnt1);
395 }
396 if (WAIT_A_LITTLE) return;
397 }
398 Standard_CString aString = "Abscissa = ";
399 Comment(aString,aText,Abscissa,nbr);
400 Abscissa *= 0.5;
401 }
402}
403
404//================================================================
405// Function : PointOnCurve_Presentation::sample4
406// Purpose :
407//================================================================
408
409void PointOnCurve_Presentation::sample4()
410{
411 Standard_CString aTitle = "Length between two points";
412 setResultTitle (aTitle);
413 TCollection_AsciiString aText (
414 "////////////////////////////////////////////////////////////////" EOL
415 "// Computes the length of curve between two points " EOL
416 "//of parameters U1 and U2." EOL
417 "////////////////////////////////////////////////////////////////" EOL EOL
418
419 "// Data used by various samples:" EOL
420 "Standard_Real aCoords[][3] = " EOL
421 "{" EOL
422 " {-5,-1,0},{-2,3,0},{3,-2.5,0},{6,2,0}" EOL
423 "};" EOL EOL
424
425 "// Creating and initializing array of points:" EOL
426 "#define SCALE 120" EOL
427 "Standard_Integer nPoles = sizeof(aCoords)/(sizeof(Standard_Real)*3);" EOL
428 "TColgp_Array1OfPnt aCurvePoint (1, nPoles);" EOL
429 "for (Standard_Integer i=0; i < nPoles; i++)" EOL
430 " aCurvePoint(i+1) = " EOL
431 " gp_Pnt(aCoords[i][0]*SCALE, aCoords[i][1]*SCALE, aCoords[i][2]*SCALE);" EOL EOL
432
433 "// Creating a BSpline Curve with DegMin = 3, DegMax = 8" EOL
434 "//using defined above array of poles:" EOL
435 "GeomAPI_PointsToBSpline aPTB (aCurvePoint,DEGMIN,DEGMAX," EOL
436 " GeomAbs_C2,Precision::Confusion());" EOL EOL
437
438 "//The adapted curve is created in the following way:" EOL
439 "Handle (Geom_BSplineCurve) aCurve = aPTB.Curve();" EOL
440 "GeomAdaptor_Curve adapCurve (aCurve) ;" EOL EOL
441
442 "//Creating and initializing array of parameters" EOL
443 "TColStd_Array2OfReal aArrayOfParameters(1,3,1,2);" EOL
444 "aArrayOfParameters.SetValue(1,1,0.6);" EOL
445 "aArrayOfParameters.SetValue(1,2,0.8);" EOL
446 "aArrayOfParameters.SetValue(2,1,0);" EOL
447 "aArrayOfParameters.SetValue(2,2,0.5);" EOL
448 "aArrayOfParameters.SetValue(3,1,0.3);" EOL
449 "aArrayOfParameters.SetValue(3,2,0.855);" EOL EOL
450
451 "// Computing the length of curve between points :" EOL
452 "for (Standard_Integer i = 1 ; i <=3 ; i++)" EOL
453 " Standard_Real aLength = GCPnts_AbscissaPoint::Length(adapCurve," EOL
454 " aArrayOfParameters(i,j),aArrayOfParameters(i,j+1));" EOL EOL
455
456 "//======================================================================" EOL EOL
457 );
458
459 setResultText(aText.ToCString());
460
461 Handle (Geom_BSplineCurve) aCurve = CreateCurve();
462 GeomAdaptor_Curve adapCurve (aCurve) ;
463
464 gp_Pnt aPnt1,aPnt2;
465 TColStd_Array2OfReal aArrayOfParameters(1,3,1,2);
466 aArrayOfParameters.SetValue(1,1,0.6);
467 aArrayOfParameters.SetValue(1,2,0.8);
468 aArrayOfParameters.SetValue(2,1,0);
469 aArrayOfParameters.SetValue(2,2,0.5);
470 aArrayOfParameters.SetValue(3,1,0.3);
471 aArrayOfParameters.SetValue(3,2,0.855);
472
473 for (Standard_Integer i = 1 ; i <=3 ; i++)
474 {
475 if (WAIT_A_LITTLE) return;
476 getAISContext()->EraseAll();
477 drawCurve(aCurve);
478
479 if (WAIT_A_LITTLE) return;
480 Standard_Integer j = 1 ;
481
482 aCurve->D0(aArrayOfParameters(i,j),aPnt1);
483 drawPoint(aPnt1);
484 if (WAIT_A_LITTLE) return;
485
486 aCurve->D0(aArrayOfParameters(i,j+1),aPnt2);
487 drawPoint(aPnt2);
488 if (WAIT_A_LITTLE) return;
489
490 drawCurve(new Geom_TrimmedCurve(aCurve,aArrayOfParameters(i,j),
491 aArrayOfParameters(i,j+1)),Quantity_NOC_GREEN1);
492
493 Standard_Real aLength = GCPnts_AbscissaPoint::Length(adapCurve,aArrayOfParameters(i,j),
494 aArrayOfParameters(i,j+1));
495
496 Standard_CString aString = "Length = ";
497 Comment(aString,aText,aLength,aArrayOfParameters(i,j),aArrayOfParameters(i,j+1));
498 }
499}
500
501//================================================================
502// Function : PointOnCurve_Presentation::sample5
503// Purpose :
504//================================================================
505
506void PointOnCurve_Presentation::sample5()
507{
508 Standard_CString aTitle = "Length of a curve";
509 setResultTitle (aTitle);
510 TCollection_AsciiString aText (
511 "////////////////////////////////////////////////////////////////" EOL
512 "// Computes the length of curve ." EOL
513 "////////////////////////////////////////////////////////////////" EOL EOL
514
515 "// Data used by various samples:" EOL
516 "Standard_Real aCoords[][3] = " EOL
517 "{" EOL
518 " {-5,-1,0},{-2,3,0},{3,-2.5,0},{6,2,0}" EOL
519 "};" EOL EOL
520
521 "// Creating and initializing array of points:" EOL
522 "#define SCALE 120" EOL
523 "Standard_Integer nPoles = sizeof(aCoords)/(sizeof(Standard_Real)*3);" EOL
524 "TColgp_Array1OfPnt aCurvePoint (1, nPoles);" EOL
525 "for (Standard_Integer i=0; i < nPoles; i++)" EOL
526 " aCurvePoint(i+1) = " EOL
527 " gp_Pnt(aCoords[i][0]*SCALE, aCoords[i][1]*SCALE, aCoords[i][2]*SCALE);" EOL EOL
528
529 "// Creating a BSpline Curve with DegMin = 3, DegMax = 8" EOL
530 "//using defined above array of poles:" EOL
531 "GeomAPI_PointsToBSpline aPTB (aCurvePoint,DEGMIN,DEGMAX," EOL
532 " GeomAbs_C2,Precision::Confusion());" EOL EOL
533
534 "//The adapted curve is created in the following way:" EOL
535 "Handle (Geom_BSplineCurve) aCurve = aPTB.Curve();" EOL
536 "GeomAdaptor_Curve adapCurve (aCurve) ;" EOL EOL
537
538 "// Computing the length of curve:" EOL
539 "Standard_Real aLength = GCPnts_AbscissaPoint::Length(adapCurve);" EOL EOL
540
541 "//======================================================================" EOL EOL
542 );
543
544 setResultText(aText.ToCString());
545
546 getAISContext()->EraseAll();
547 Handle (Geom_BSplineCurve) aCurve = CreateCurve();
548 drawCurve(aCurve);
549 GeomAdaptor_Curve adapCurve (aCurve) ;
550
551 gp_Pnt aPnt1,aPnt2;
552 if (WAIT_A_LITTLE) return;
553 Standard_Real aLength = GCPnts_AbscissaPoint::Length(adapCurve);
554
555 aCurve->D0(0,aPnt1);
556 aCurve->D0(1,aPnt2);
557 drawPoint(aPnt1);
558 if (WAIT_A_LITTLE) return;
559 drawPoint(aPnt2);
560 if (WAIT_A_LITTLE) return;
561
562 drawCurve(aCurve,Quantity_NOC_GREEN1);
563 Standard_CString aString = "Length of the curve : " ;
564 Comment(aString,aText,aLength);
565}
566
567
568void PointOnCurve_Presentation::Comment(const Standard_CString theString,
569 TCollection_AsciiString& theText, const Standard_Real theNum1,const Standard_Real theNum2,
570 const Standard_Real theNum3)
571{
572 theText += EOL;
573 if( theNum3 > 0 )
574 {
575 theText += " Parameters of points :" EOL;
576 theText += " U1 = ";
577 theText += TCollection_AsciiString (theNum2);
578 theText += " U2 = ";
579 theText += TCollection_AsciiString (theNum3);
580 theText += EOL;
581 theText += " Result: " ;
582 }
583 else
584 {
585 theText += " Result: " ;
586 theText += EOL;
587 }
588 theText += theString ;
589 theText += TCollection_AsciiString (theNum1);
590 theText += EOL ;
591
592 setResultText (theText.ToCString());
593
594}
595
596
597void PointOnCurve_Presentation::Comment(const Standard_CString theString,
598 TCollection_AsciiString& theText,const Standard_Real theDistance,const Standard_Integer theNum)
599{
600 theText += EOL EOL;
601 theText += theString;
602 theText += TCollection_AsciiString(theDistance);
603 theText += EOL;
604 theText += "Result: ";
605 theText += EOL ;
606 theText += "Number of points of the distribution: ";
607 theText += TCollection_AsciiString (theNum);
608 setResultText (theText.ToCString());
609}