0024591: Modification of tests in group "sewing"
[occt.git] / src / QABugs / QABugs_19.cxx
CommitLineData
b311480e 1// Created on: 2002-05-21
2// Created by: QA Admin
973c2be1 3// Copyright (c) 2002-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
973c2be1 7// This library is free software; you can redistribute it and / or modify it
8// under the terms of the GNU Lesser General Public 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
1cd84fee 16#include <QABugs.hxx>
7fd59977 17
18#include <Draw_Interpretor.hxx>
19#include <DBRep.hxx>
20#include <DrawTrSurf.hxx>
21#include <AIS_InteractiveContext.hxx>
22#include <ViewerTest.hxx>
23#include <AIS_Shape.hxx>
24#include <TopoDS_Shape.hxx>
25
26#include <gp_Pnt2d.hxx>
f6f03db9 27#include <gp_Ax1.hxx>
7fd59977 28#include <GCE2d_MakeSegment.hxx>
29#include <Geom2d_TrimmedCurve.hxx>
30#include <DrawTrSurf.hxx>
31
f6f03db9 32#include <Precision.hxx>
33
7fd59977 34#include <PCollection_HAsciiString.hxx>
35
c2ae831c 36#include <cstdio>
37#include <cmath>
38#include <iostream>
39#include <OSD_PerfMeter.hxx>
40#include <OSD_Timer.hxx>
41#include <BRepPrimAPI_MakeBox.hxx>
42#include <BRepPrimAPI_MakeSphere.hxx>
43#include <BRepAlgo_Cut.hxx>
ab2db9a5 44#include <NCollection_Map.hxx>
29cb310a 45#include <TCollection_HAsciiString.hxx>
46
05d7de53 47#include <Standard_Version.hxx>
48
29cb310a 49#define QCOMPARE(val1, val2) \
50 di << "Checking " #val1 " == " #val2 << \
51 ((val1) == (val2) ? ": OK\n" : ": Error\n")
d2786814 52
7fd59977 53static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
54{
55 if ( argc != 4) {
56 di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d" << "\n";
57 return 1;
58 }
59
60 gp_Pnt2d P1, P2;
61 if ( !DrawTrSurf::GetPoint2d(argv[2],P1)) {
62 di << "ERROR OCC230: " << argv[2] << " is not Pnt2d" << "\n";
63 return 1;
64 }
65 if ( !DrawTrSurf::GetPoint2d(argv[3],P2)) {
66 di << "ERROR OCC230: " << argv[3] << " is not Pnt2d" << "\n";
67 return 1;
68 }
69
70 GCE2d_MakeSegment MakeSegment(P1,P2);
71 Handle(Geom2d_TrimmedCurve) TrimmedCurve = MakeSegment.Value();
72 DrawTrSurf::Set(argv[1], TrimmedCurve);
73 return 0;
74}
75
76static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
77{
78 for(Standard_Integer i= 0;i <= 20;i++){
79 Handle(PCollection_HAsciiString) pstr = new PCollection_HAsciiString("TEST");
80 pstr->Clear();
81 }
82 di << "OCC142: OK" << "\n";
83 return 0;
84}
85
f6f03db9 86static Standard_Integer OCC23361 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
87{
88 gp_Pnt p(0, 0, 2);
89
90 gp_Trsf t1, t2;
91 t1.SetRotation(gp_Ax1(p, gp_Dir(0, 1, 0)), -0.49328285294022267);
92 t2.SetRotation(gp_Ax1(p, gp_Dir(0, 0, 1)), 0.87538474718473880);
93
94 gp_Trsf tComp = t2 * t1;
95
96 gp_Pnt p1(10, 3, 4);
97 gp_Pnt p2 = p1.Transformed(tComp);
98 gp_Pnt p3 = p1.Transformed(t1);
99 p3.Transform(t2);
100
101 // points must be equal
102 if ( ! p2.IsEqual(p3, Precision::Confusion()) )
103 di << "ERROR OCC23361: equivalent transformations does not produce equal points" << "\n";
104 else
105 di << "OCC23361: OK" << "\n";
106
107 return 0;
108}
109
c2ae831c 110static Standard_Integer OCC23237 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
111{
112 OSD_PerfMeter aPM("TestMeter",0);
113 OSD_Timer aTM;
114
115 // run some operation in cycle for about 2 seconds to have good values of times to compare
116 int count = 0;
117 printf("OSD_PerfMeter test.\nRunning Boolean operation on solids in loop.\n");
118 for (; aTM.ElapsedTime() < 2.; count++)
119 {
120 aPM.Start();
121 aTM.Start();
122
b3a7aa39 123 // do some operation that will take considerable time compared with time of starting / stopping timers
c2ae831c 124 BRepPrimAPI_MakeBox aBox (10., 10., 10.);
125 BRepPrimAPI_MakeSphere aSphere (10.);
b3a7aa39 126 BRepAlgo_Cut aCutter (aBox.Shape(), aSphere.Shape());
c2ae831c 127
128 aTM.Stop();
129 aPM.Stop();
130 }
131
132 int aNbEnters = 0;
133 Standard_Real aPerfMeter_CPUtime = 0., aTimer_ElapsedTime = aTM.ElapsedTime();
134
135 perf_get_meter("TestMeter", &aNbEnters, &aPerfMeter_CPUtime);
136
137 Standard_Real aTimeDiff = (fabs(aTimer_ElapsedTime - aPerfMeter_CPUtime) / aTimer_ElapsedTime);
138
139 printf("\nMeasurement results (%d cycles):\n", count);
140 printf("\nOSD_PerfMeter CPU time: %lf\nOSD_Timer elapsed time: %lf\n", aPerfMeter_CPUtime, aTimer_ElapsedTime);
141 printf("Time delta is: %.3lf %%\n", aTimeDiff * 100);
142
143 if (aTimeDiff > 0.2)
144 di << "OCC23237: Error: too much difference between CPU and elapsed times";
145 else if (aNbEnters != count)
146 di << "OCC23237: Error: counter reported by PerfMeter (" << aNbEnters << ") does not correspond to actual number of cycles";
147 else
148 di << "OCC23237: OK";
149
150 return 0;
151}
152
1365140b
RL
153#ifdef HAVE_TBB
154
155#include <Standard_Atomic.hxx>
156#include <tbb/blocked_range.h>
157#include <tbb/parallel_for.h>
158
159class IncrementerDecrementer
160{
161public:
162 IncrementerDecrementer (Standard_Integer* theVal, Standard_Boolean thePositive) : myVal (theVal), myPositive (thePositive)
163 {}
164 void operator() (const tbb::blocked_range<size_t>& r) const
165 {
166 if (myPositive)
167 for (size_t i = r.begin(); i != r.end(); ++i)
168 Standard_Atomic_Increment (myVal);
169 else
170 for (size_t i = r.begin(); i != r.end(); ++i)
171 Standard_Atomic_Decrement (myVal);
172 }
173private:
174 Standard_Integer* myVal;
175 Standard_Boolean myPositive;
176};
177#endif
178
1365140b
RL
179#ifdef HAVE_TBB
180static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
181{
182 int aSum = 0;
183
184 //check returned value
185 QCOMPARE (Standard_Atomic_Decrement (&aSum), -1);
186 QCOMPARE (Standard_Atomic_Increment (&aSum), 0);
187 QCOMPARE (Standard_Atomic_Increment (&aSum), 1);
188 QCOMPARE (Standard_Atomic_Increment (&aSum), 2);
189// QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 0);
190// QCOMPARE (Standard_Atomic_DecrementTest (&aSum), 1);
191
192 //check atomicity
193 aSum = 0;
194 const int N = 1 << 24; //big enough to ensure concurrency
195
196 //increment
197 tbb::parallel_for (tbb::blocked_range<size_t> (0, N), IncrementerDecrementer (&aSum, true));
198 QCOMPARE (aSum, N);
199
200 //decrement
201 tbb::parallel_for (tbb::blocked_range<size_t> (0, N), IncrementerDecrementer (&aSum, false));
202 QCOMPARE (aSum, 0);
203
204 return 0;
205}
206
207#else /* HAVE_TBB */
208
209static Standard_Integer OCC22980 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char **argv)
210{
211 di << "Test skipped: command " << argv[0] << " requires TBB library\n";
212 return 0;
213}
214
215#endif /* HAVE_TBB */
216
e6aad0ee
RL
217#include <TDocStd_Application.hxx>
218#include <XCAFApp_Application.hxx>
219#include <TDocStd_Document.hxx>
220#include <XCAFDoc_ShapeTool.hxx>
221#include <XCAFDoc_DocumentTool.hxx>
222#include <TDF_Label.hxx>
223#include <TDataStd_Name.hxx>
224
773f53f1 225static Standard_Integer OCC23595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char** /*argv*/)
e6aad0ee
RL
226{
227 const Handle(TDocStd_Application)& anApp = XCAFApp_Application::GetApplication();
228 Handle(TDocStd_Document) aDoc;
229 anApp->NewDocument ("XmlXCAF", aDoc);
230 QCOMPARE (!aDoc.IsNull(), Standard_True);
231
232 Handle(XCAFDoc_ShapeTool) aShTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
233
234 //check default value
235 Standard_Boolean aValue = XCAFDoc_ShapeTool::AutoNaming();
236 QCOMPARE (aValue, Standard_True);
237
238 //true
239 XCAFDoc_ShapeTool::SetAutoNaming (Standard_True);
240 TopoDS_Shape aShape = BRepPrimAPI_MakeBox (100., 200., 300.).Shape();
241 TDF_Label aLabel = aShTool->AddShape (aShape);
242 Handle(TDataStd_Name) anAttr;
243 QCOMPARE (aLabel.FindAttribute (TDataStd_Name::GetID(), anAttr), Standard_True);
244
245 //false
246 XCAFDoc_ShapeTool::SetAutoNaming (Standard_False);
247 aShape = BRepPrimAPI_MakeBox (300., 200., 100.).Shape();
248 aLabel = aShTool->AddShape (aShape);
249 QCOMPARE (!aLabel.FindAttribute (TDataStd_Name::GetID(), anAttr), Standard_True);
250
251 //restore
252 XCAFDoc_ShapeTool::SetAutoNaming (aValue);
253
254 return 0;
255}
256
5d1833ef 257#include <ExprIntrp_GenExp.hxx>
258Standard_Integer OCC22611 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
259{
260
261 if (argc != 3) {
262 di << "Usage : " << argv[0] << " string nb\n";
263 return 1;
264 }
265
266 TCollection_AsciiString aToken = argv[1];
267 Standard_Integer aNb = atoi(argv[2]);
268
269 Handle(ExprIntrp_GenExp) aGen = ExprIntrp_GenExp::Create();
270 for (Standard_Integer i=0; i < aNb; i++)
271 {
272 aGen->Process(aToken);
273 Handle(Expr_GeneralExpression) aExpr = aGen->Expression();
274 }
275
276 return 0;
277}
278
35e08fe8 279Standard_Integer OCC22595 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
e187cc0a 280{
281 gp_Mat M0;
282 di << "M0 = "
283 << " {" << M0(1,1) << "} {" << M0(1,2) << "} {" << M0(1,3) <<"}"
284 << " {" << M0(2,1) << "} {" << M0(2,2) << "} {" << M0(2,3) <<"}"
285 << " {" << M0(1,1) << "} {" << M0(1,2) << "} {" << M0(1,3) <<"}";
286 return 0;
287}
288
bead40f2 289#include <TopoDS_Face.hxx>
290#include <TopoDS_Face.hxx>
291#include <TopoDS.hxx>
292#include <BRepBuilderAPI_Transform.hxx>
293#include <BRepExtrema_DistShapeShape.hxx>
294#include <BRepTools.hxx>
295
f24125b9 296static Standard_Boolean OCC23774Test(const TopoDS_Face& grossPlateFace, const TopoDS_Shape& originalWire, Draw_Interpretor& di)
bead40f2 297{
298 BRepExtrema_DistShapeShape distShapeShape(grossPlateFace,originalWire,Extrema_ExtFlag_MIN);
299 if(!distShapeShape.IsDone()) {
300 di <<"Distance ShapeShape is Not Done\n";
301 return Standard_False;
302 }
303
304 if(distShapeShape.Value() > 0.01) {
305 di << "Wrong Dist = " <<distShapeShape.Value() << "\n";
306 return Standard_False;
307 } else
308 di << "Dist0 = " <<distShapeShape.Value() <<"\n";
309
310 //////////////////////////////////////////////////////////////////////////
311 /// First Flip Y
312 const gp_Pnt2d axis1P1(1474.8199035519228,1249.9995745636970);
313 const gp_Pnt2d axis1P2(1474.8199035519228,1250.9995745636970);
314
315 gp_Vec2d mirrorVector1(axis1P1,axis1P2);
316
317 gp_Trsf2d mirror1;
318 mirror1.SetMirror(gp_Ax2d(axis1P1,mirrorVector1));
319
320 BRepBuilderAPI_Transform transformer1(mirror1);
321 transformer1.Perform(originalWire);
322 if(!transformer1.IsDone()) {
323 di << "Not Done1 " << "\n";
324 return Standard_False;
325 }
326 const TopoDS_Shape& step1ModifiedShape = transformer1.ModifiedShape(originalWire);
327
328 BRepExtrema_DistShapeShape distShapeShape1(grossPlateFace,step1ModifiedShape,Extrema_ExtFlag_MIN);
329 if(!distShapeShape1.IsDone())
330 return Standard_False;
331 if(distShapeShape1.Value() > 0.01) {
332 di << "Dist = " <<distShapeShape1.Value() <<"\n";
333 return Standard_False;
334 } else
335 di << "Dist1 = " <<distShapeShape1.Value() <<"\n";
336
337 //////////////////////////////////////////////////////////////////////////
338 /// Second flip Y
339 transformer1.Perform(step1ModifiedShape);
340 if(!transformer1.IsDone()) {
341 di << "Not Done1 \n";
342 return Standard_False;
343 }
344 const TopoDS_Shape& step2ModifiedShape = transformer1.ModifiedShape(step1ModifiedShape);
bead40f2 345
346 //This is identity matrix for values but for type is gp_Rotation ?!
347 gp_Trsf2d mirror11 = mirror1;
348 mirror11.PreMultiply(mirror1);
349
350 BRepExtrema_DistShapeShape distShapeShape2(grossPlateFace,step2ModifiedShape);//,Extrema_ExtFlag_MIN);
351 if(!distShapeShape2.IsDone())
352 return Standard_False;
353
354 //This last test case give error (the value is 1008.8822038689706)
355 if(distShapeShape2.Value() > 0.01) {
356 di << "Wrong Dist2 = " <<distShapeShape2.Value() <<"\n";
357 Standard_Integer N = distShapeShape2.NbSolution();
358 di << "Nb = " <<N <<"\n";
359 for (Standard_Integer i=1;i <= N;i++)
360 di <<"Sol(" <<i<<") = " <<distShapeShape2.PointOnShape1(i).Distance(distShapeShape2.PointOnShape2(i)) <<"\n";
361 return Standard_False;
362 }
363 di << "Distance2 = " <<distShapeShape2.Value() <<"\n";
364
365 return Standard_True;
366}
367static Standard_Integer OCC23774(Draw_Interpretor& di, Standard_Integer n, const char** a)
368{
369
370 if (n != 3) {
371 di <<"OCC23774: invalid number of input parameters\n";
372 return 1;
373 }
374
375 const char *ns1 = (a[1]), *ns2 = (a[2]);
376 TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2));
377 if (S1.IsNull() || S2.IsNull()) {
378 di <<"OCC23774: Null input shapes\n";
379 return 1;
380 }
381 const TopoDS_Face& aFace = TopoDS::Face(S1);
382 if(!OCC23774Test(aFace, S2, di))
383 di << "Something is wrong\n";
384
385 return 0;
386}
387
1ef32e96
RL
388#include <GeomConvert_ApproxSurface.hxx>
389#include <Geom_BSplineSurface.hxx>
390#include <Draw.hxx>
391#include <OSD_Thread.hxx>
392static void GeomConvertTest (Draw_Interpretor& di, Standard_Integer theTargetNbUPoles, Standard_CString theFileName)
393{
394 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(theFileName);
395 GeomConvert_ApproxSurface aGAS (aSurf, 1e-4, GeomAbs_C1, GeomAbs_C1, 9, 9, 100, 1);
396 if (!aGAS.IsDone()) {
397 di << "ApproxSurface is not done!" << "\n";
398 return;
399 }
400 const Handle(Geom_BSplineSurface)& aBSurf = aGAS.Surface();
401 if (aBSurf.IsNull()) {
402 di << "BSplineSurface is not created!" << "\n";
403 return;
404 }
405 di << "Number of UPoles:" << aBSurf->NbUPoles() << "\n";
406 QCOMPARE (aBSurf->NbUPoles(), theTargetNbUPoles);
407}
408
409struct aData {
410 Draw_Interpretor* di;
411 Standard_Integer nbupoles;
412 Standard_CString filename;
413};
414
415Standard_EXPORT Standard_Address convert(Standard_Address data)
416{
417 aData* info = (aData*) data;
418 GeomConvertTest(*(info->di),info->nbupoles,info->filename);
419 return NULL;
420}
421
422static Standard_Integer OCC23952sweep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
423{
424 if (argc != 3) {
425 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
426 return 1;
427 }
428 struct aData aStorage;
429 aStorage.di = &di;
430 aStorage.nbupoles = Draw::Atoi(argv[1]);
431 aStorage.filename = argv[2];
432
433 OSD_Thread aThread1(convert);
434 aThread1.Run(&aStorage);
435 GeomConvertTest(di,aStorage.nbupoles,aStorage.filename);
85c44a05 436 cout << "result of thread: " << aThread1.Wait() << endl;
1ef32e96
RL
437
438 return 0;
439}
d2786814 440
1ef32e96
RL
441#include <GeomInt_IntSS.hxx>
442static void GeomIntSSTest (Draw_Interpretor& di, Standard_Integer theNbSol, Standard_CString theFileName1, Standard_CString theFileName2)
443{
444 Handle(Geom_Surface) aSurf1 = DrawTrSurf::GetSurface(theFileName1);
445 Handle(Geom_Surface) aSurf2 = DrawTrSurf::GetSurface(theFileName2);
446 GeomInt_IntSS anInter;
447 anInter.Perform(aSurf1, aSurf2, Precision::Confusion(), Standard_True);
448 if (!anInter.IsDone()) {
449 di << "An intersection is not done!" << "\n";
450 return;
451 }
452
453 di << "Number of Lines:" << anInter.NbLines() << "\n";
454 QCOMPARE (anInter.NbLines(), theNbSol);
455}
456
457struct aNewData {
458 Draw_Interpretor* di;
459 Standard_Integer nbsol;
460 Standard_CString filename1;
461 Standard_CString filename2;
462};
463Standard_EXPORT Standard_Address convert_inter(Standard_Address data)
464{
465 aNewData* info = (aNewData*) data;
466 GeomIntSSTest(*(info->di),info->nbsol,info->filename1,info->filename2);
467 return NULL;
468}
469
470static Standard_Integer OCC23952intersect (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
471{
472 if (argc != 4) {
473 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
474 return 1;
475 }
476 struct aNewData aStorage;
477 aStorage.di = &di;
478 aStorage.nbsol = Draw::Atoi(argv[1]);
479 aStorage.filename1 = argv[2];
480 aStorage.filename2 = argv[3];
481
482 OSD_Thread aThread1(convert_inter);
483 aThread1.Run(&aStorage);
484 GeomIntSSTest(di,aStorage.nbsol,aStorage.filename1,aStorage.filename2);
85c44a05 485 cout << "result of thread: " << aThread1.Wait() << endl;
1ef32e96
RL
486
487 return 0;
488}
489
490#include <Geom_SurfaceOfRevolution.hxx>
06be28a4
RL
491static Standard_Integer OCC23683 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
492{
493 if (argc < 2) {
494 di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n";
495 return 1;
496 }
497
498 Standard_Integer ucontinuity = 1;
499 Standard_Integer vcontinuity = 1;
500 Standard_Boolean iscnu = false;
501 Standard_Boolean iscnv = false;
502
503 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[1]);
504
505 QCOMPARE (aSurf->IsCNu (ucontinuity), iscnu);
506 QCOMPARE (aSurf->IsCNv (vcontinuity), iscnv);
507
508 return 0;
509}
510
1939140c 511#include <gp_Ax1.hxx>
512#include <gp_Ax22d.hxx>
513#include <Geom_Plane.hxx>
514#include <Geom2d_Circle.hxx>
515#include <Geom2d_TrimmedCurve.hxx>
516#include <BRepBuilderAPI_MakeEdge.hxx>
517#include <BRepPrimAPI_MakeRevol.hxx>
518#include <Geom2d_OffsetCurve.hxx>
519
520static int test_offset(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
521{
522 // Check the command arguments
523 if ( argc != 1 )
524 {
525 di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
526 di << "Usage: type help " << argv[0] << "\n";
527 return 1; // TCL_ERROR
528 }
529
530 gp_Ax1 RotoAx( gp::Origin(), gp::DZ() );
531 gp_Ax22d Ax2( gp::Origin2d(), gp::DY2d(), gp::DX2d() );
532 Handle(Geom_Surface) Plane = new Geom_Plane( gp::YOZ() );
533
534 di << "<<<< Preparing sample surface of revolution based on trimmed curve >>>>" << "\n";
535 di << "-----------------------------------------------------------------------" << "\n";
536
537 Handle(Geom2d_Circle) C2d1 = new Geom2d_Circle(Ax2, 1.0);
538 Handle(Geom2d_TrimmedCurve) C2d1Trimmed = new Geom2d_TrimmedCurve(C2d1, 0.0, M_PI/2.0);
539 TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(C2d1Trimmed, Plane);
540
541 DBRep::Set("e1", E1);
542
543 BRepPrimAPI_MakeRevol aRevolBuilder1(E1, RotoAx);
544 TopoDS_Face F1 = TopoDS::Face( aRevolBuilder1.Shape() );
545
546 DBRep::Set("f1", F1);
547
548 di << "Result: f1" << "\n";
549
550 di << "<<<< Preparing sample surface of revolution based on offset curve >>>>" << "\n";
551 di << "-----------------------------------------------------------------------" << "\n";
552
553 Handle(Geom2d_OffsetCurve) C2d2Offset = new Geom2d_OffsetCurve(C2d1Trimmed, -0.5);
554 TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(C2d2Offset, Plane);
555
556 DBRep::Set("e2", E2);
557
558 BRepPrimAPI_MakeRevol aRevolBuilder2(E2, RotoAx);
559 TopoDS_Face F2 = TopoDS::Face( aRevolBuilder2.Shape() );
560
561 DBRep::Set("f2", F2);
562
563 di << "Result: f2" << "\n";
564
565 return 0;
566}
567
2e9fd4bc 568#include <Geom_Curve.hxx>
569#include <Geom_Surface.hxx>
570#include <Precision.hxx>
571#include <ShapeConstruct_ProjectCurveOnSurface.hxx>
572//=======================================================================
573//function : OCC24008
574//purpose :
575//=======================================================================
576static Standard_Integer OCC24008 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
577{
578 if (argc != 3) {
579 di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
580 return 1;
581 }
582 Handle(Geom_Curve) aCurve = DrawTrSurf::GetCurve(argv[1]);
583 Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[2]);
584 if (aCurve.IsNull()) {
585 di << "Curve was not read" << "\n";
586 return 1;
587 }
588 if (aSurf.IsNull()) {
589 di << "Surface was not read" << "\n";
590 return 1;
591 }
592 ShapeConstruct_ProjectCurveOnSurface aProj;
593 aProj.Init (aSurf, Precision::Confusion());
594 try {
595 Handle(Geom2d_Curve) aPCurve;
596 aProj.Perform (aCurve, aCurve->FirstParameter(), aCurve->LastParameter(), aPCurve);
597 if (aPCurve.IsNull()) {
598 di << "PCurve was not created" << "\n";
599 return 1;
600 }
601 } catch (...) {
602 di << "Exception was caught" << "\n";
603 }
604 return 0;
605}
606
470ebb43 607#include <GeomAdaptor_Surface.hxx>
608#include <Draw.hxx>
609//=======================================================================
610//function : OCC23945
611//purpose :
612//=======================================================================
613
35e08fe8 614static Standard_Integer OCC23945 (Draw_Interpretor& /*di*/,Standard_Integer n, const char** a)
470ebb43 615{
616 if (n < 5) return 1;
617
618 Handle(Geom_Surface) aS = DrawTrSurf::GetSurface(a[1]);
619 if (aS.IsNull()) return 1;
620
621 GeomAdaptor_Surface GS(aS);
622
623 Standard_Real U = Draw::Atof(a[2]);
624 Standard_Real V = Draw::Atof(a[3]);
625
626 Standard_Boolean DrawPoint = ( n%3 == 2);
627 if ( DrawPoint) n--;
628
629 gp_Pnt P;
630 if (n >= 13) {
631 gp_Vec DU,DV;
632 if (n >= 22) {
633 gp_Vec D2U,D2V,D2UV;
634 GS.D2(U,V,P,DU,DV,D2U,D2V,D2UV);
635 Draw::Set(a[13],D2U.X());
636 Draw::Set(a[14],D2U.Y());
637 Draw::Set(a[15],D2U.Z());
638 Draw::Set(a[16],D2V.X());
639 Draw::Set(a[17],D2V.Y());
640 Draw::Set(a[18],D2V.Z());
641 Draw::Set(a[19],D2UV.X());
642 Draw::Set(a[20],D2UV.Y());
643 Draw::Set(a[21],D2UV.Z());
644 }
645 else
646 GS.D1(U,V,P,DU,DV);
647
648 Draw::Set(a[7],DU.X());
649 Draw::Set(a[8],DU.Y());
650 Draw::Set(a[9],DU.Z());
651 Draw::Set(a[10],DV.X());
652 Draw::Set(a[11],DV.Y());
653 Draw::Set(a[12],DV.Z());
654 }
655 else
656 GS.D0(U,V,P);
657
658 if ( n > 6) {
659 Draw::Set(a[4],P.X());
660 Draw::Set(a[5],P.Y());
661 Draw::Set(a[6],P.Z());
662 }
663 if ( DrawPoint) {
664 DrawTrSurf::Set(a[n],P);
665 }
666
667 return 0;
668}
669
4bee43a9
P
670#include <Voxel_BoolDS.hxx>
671#include <Voxel_FastConverter.hxx>
672#include <Voxel_BooleanOperation.hxx>
673static Standard_Integer OCC24019 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
674{
675 if ( argc != 2 ) {
676 di << "Error: " << argv[0] << " - invalid number of arguments" << "\n";
677 return 1;
678 }
679
680 TCollection_AsciiString aFileName = argv[1];
681 TopoDS_Shape aShape;
682 BRep_Builder aBuilder;
683
684 if (!BRepTools::Read(aShape, aFileName.ToCString(), aBuilder)) {
685 di << "Error: Could not read a shape!" << "\n";
686 return 1;
687 }
688
689 TopoDS_Solid aShape1 = BRepPrimAPI_MakeSphere(gp_Pnt(20,25,35), 7);
690
691 Standard_Real deflection = 0.005;
692 Standard_Integer nbThreads = 1;
693 Standard_Integer nbx = 200, nby = 200, nbz = 200;
694 Voxel_BoolDS theVoxels(0,0,0, 50, 50, 50, nbx, nby, nbz);
695 Voxel_BoolDS theVoxels1(0,0,0, 50, 50, 50, nbx, nby, nbz);
696
697 Standard_Integer progress = 0;
698 Voxel_FastConverter fcp(aShape, theVoxels, deflection, nbx, nby, nbz, nbThreads);
699 fcp.ConvertUsingSAT(progress, 1);
700 fcp.FillInVolume(1);
701
702 Voxel_FastConverter fcp1(aShape1, theVoxels1, deflection, nbx, nby, nbz, nbThreads);
703 fcp1.ConvertUsingSAT(progress, 1);
704 fcp1.FillInVolume(1);
705
706 Voxel_BooleanOperation op;
707 Standard_Boolean result = op.Cut(theVoxels1, theVoxels);
708 if ( result != 1 ) {
709 di << "Error: invalid boolean operation" << "\n";
710 } else {
711 di << "OK: boolean operation is ok" << "\n";
712 }
713
714 return 0;
715}
716
29cb310a 717//=======================================================================
718//function : OCC11758
719//purpose :
720//=======================================================================
498ce76b 721static Standard_Integer OCC11758 (Draw_Interpretor& di, Standard_Integer n, const char**)
29cb310a 722{
723 if (n != 1) return 1;
724
725 const char* theStr = "0123456789";
726 Standard_Integer i, j;
727 for ( i = 0; i < 5; ++i ) {
728 // TCollection_AsciiString(const Standard_CString astring)
729 TCollection_AsciiString a(theStr+i);
730 // IsEqual (const Standard_CString other)const
731 //assert( a == theStr+i );
732 QCOMPARE ( a , theStr+i );
733
734 //TCollection_AsciiString(const Standard_CString astring,const Standard_Integer aLen )
735 TCollection_AsciiString b(theStr+i, 3);
736 //assert( b.Length() == 3 );
737 //assert( strncmp( b.ToCString(), theStr+i, 3 ) == 0 );
738 //assert( strlen( b.ToCString() ) == 3 );
739 QCOMPARE ( b.Length() , 3 );
740 QCOMPARE ( strncmp( b.ToCString() , theStr+i, 3 ) , 0 );
741 QCOMPARE ( b.Length() , 3 );
742
743 //TCollection_AsciiString(const Standard_Integer aValue)
744 TCollection_AsciiString c(i);
745 //assert( c.IsIntegerValue() );
746 //assert( c.IntegerValue() == i );
747 QCOMPARE ( c.IsIntegerValue() , Standard_True );
748 QCOMPARE ( c.IntegerValue() , i );
749
750 //TCollection_AsciiString(const Standard_Real aValue)
751 TCollection_AsciiString d( 0.1*i );
752 //assert( d.IsRealValue() );
753 //assert( TCollection_AsciiString(3.3) == "3.3");
754 QCOMPARE ( d.IsRealValue() , Standard_True );
755 QCOMPARE ( TCollection_AsciiString(3.3) , "3.3" );
756
757 //TCollection_AsciiString(const TCollection_AsciiString& astring)
758 TCollection_AsciiString e(d);
759 //assert( e == d );
760 //assert( e.Length() == d.Length() );
761 //assert( strcmp( e.ToCString(), d.ToCString() ) == 0 );
762 QCOMPARE ( e ,d );
763 QCOMPARE ( e.Length() , d.Length() );
764 QCOMPARE ( strcmp( e.ToCString(), d.ToCString() ) , 0 );
765
766 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
767 // const Standard_Character other )
768 TCollection_AsciiString f(e,'\a');
769 //assert( f.Length() == e.Length() + 1 );
770 //assert( strncmp( f.ToCString(), e.ToCString(), e.Length() ) == 0 );
771 //assert( f.Value( f.Length() ) == '\a');
772 QCOMPARE ( f.Length() , e.Length() + 1 );
773 QCOMPARE ( strncmp( f.ToCString(), e.ToCString(), e.Length() ) , 0 );
774 QCOMPARE ( f.Value( f.Length() ) , '\a' );
775
776 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
777 // const Standard_CString other )
778 TCollection_AsciiString g(f, theStr);
779 //assert( g.Length() == f.Length() + strlen( theStr ));
780 //assert( strncmp( g.ToCString(), f.ToCString(), f.Length() ) == 0 );
781 //assert( g.Search( theStr ) == f.Length() + 1 );
782 QCOMPARE ( g.Length() , f.Length() + (Standard_Integer)strlen( theStr ) );
783 QCOMPARE ( strncmp( g.ToCString(), f.ToCString(), f.Length() ) , 0 );
784 QCOMPARE ( g.Search( theStr ) , f.Length() + 1 );
785
786 // TCollection_AsciiString(const TCollection_AsciiString& astring ,
787 // const TCollection_AsciiString& other )
788 TCollection_AsciiString h(d,a);
789 //assert( h.Length() == d.Length() + a.Length() );
790 //assert( strncmp( h.ToCString(), d.ToCString(), d.Length() ) == 0 );
791 //assert( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) == 0 );
792 QCOMPARE ( h.Length() , d.Length() + a.Length() );
793 QCOMPARE ( strncmp( h.ToCString(), d.ToCString(), d.Length() ) , 0 );
794 QCOMPARE ( strncmp( h.ToCString() + d.Length(), a.ToCString(), a.Length() ) , 0 );
795
796 // AssignCat(const Standard_CString other)
797 c.AssignCat( a.ToCString() );
798 //assert( c.Length() == 1 + a.Length() );
799 //assert( c.Search( a ) == 2 );
800 QCOMPARE ( c.Length() , 1 + a.Length() );
801 QCOMPARE ( c.Search( a ) , 2 );
802
803 // AssignCat(const TCollection_AsciiString& other)
804 Standard_Integer dl = d.Length();
805 d.AssignCat( a );
806 //assert( d.Length() == dl + a.Length() );
807 //assert( d.Search( a ) == dl + 1 );
808 QCOMPARE ( d.Length() , dl + a.Length() );
809 QCOMPARE ( d.Search( a ) , dl + 1 );
810
811 // Capitalize()
812 TCollection_AsciiString capitalize("aBC");
813 capitalize.Capitalize();
814 //assert( capitalize == "Abc" );
815 QCOMPARE ( capitalize , "Abc" );
816
817 // Copy(const Standard_CString fromwhere)
818 d = theStr+i;
819 //assert( d == theStr+i );
820 QCOMPARE ( d , theStr+i );
821
822 // Copy(const TCollection_AsciiString& fromwhere)
823 d = h;
824 // IsEqual (const TCollection_AsciiString& other)const
825 //assert( d == h );
826 QCOMPARE ( d , h );
827
828 // Insert(const Standard_Integer where, const Standard_CString what)
829 dl = d.Length();
830 d.Insert( 2, theStr );
831 //assert( d.Length() == dl + strlen( theStr ));
832 //assert( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) == 0 );
833 QCOMPARE ( d.Length() , dl + (Standard_Integer)strlen( theStr ) );
834 QCOMPARE ( strncmp( d.ToCString() + 1, theStr, strlen( theStr )) , 0 );
835
836 //Insert(const Standard_Integer where,const Standard_Character what)
837 d = theStr;
838 d.Insert( i+1, 'i' );
839 //assert( d.Length() == strlen( theStr ) + 1 );
840 //assert( d.Value( i+1 ) == 'i');
841 //assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
842 QCOMPARE ( d.Length() , (Standard_Integer)strlen( theStr ) + 1 );
843 QCOMPARE ( d.Value( i+1 ) , 'i' );
844 QCOMPARE ( strcmp( d.ToCString() + i + 1, theStr+i ) , 0 );
845
846 //Insert(const Standard_Integer where,const TCollection_AsciiString& what)
847 d = theStr;
848 d.Insert( i+1, TCollection_AsciiString( "i" ));
849 //assert( d.Length() == strlen( theStr ) + 1 );
850 //assert( d.Value( i+1 ) == 'i');
851 //assert( strcmp( d.ToCString() + i + 1, theStr+i ) == 0 );
852 QCOMPARE ( d.Length() , (Standard_Integer)strlen( theStr ) + 1 );
853 QCOMPARE ( d.Value( i+1 ) , 'i' );
854 QCOMPARE ( strcmp( d.ToCString() + i + 1, theStr+i ) , 0 );
855
856 // IsDifferent (const Standard_CString other)const
857 //assert( d.IsDifferent( theStr ));
858 //assert( d.IsDifferent( "theStr" ));
859 //assert( d.IsDifferent( "" ));
860 //assert( !d.IsDifferent( d.ToCString() ));
861 QCOMPARE ( d.IsDifferent( theStr ) , Standard_True );
862 QCOMPARE ( d.IsDifferent( "theStr" ) , Standard_True );
863 QCOMPARE ( d.IsDifferent( "" ) , Standard_True );
864 QCOMPARE ( !d.IsDifferent( d.ToCString() ) , Standard_True );
865
866 // IsDifferent (const TCollection_AsciiString& other)const
867 //assert( d.IsDifferent( TCollection_AsciiString() ));
868 //assert( d.IsDifferent( a ));
869 //assert( d.IsDifferent( h ));
870 //assert( !d.IsDifferent( d ));
871 QCOMPARE ( d.IsDifferent( TCollection_AsciiString() ) , Standard_True );
872 QCOMPARE ( d.IsDifferent( a ) , Standard_True );
873 QCOMPARE ( d.IsDifferent( h ) , Standard_True );
874 QCOMPARE ( !d.IsDifferent( d ) , Standard_True );
875
876 // IsLess (const Standard_CString other)const
877 //assert( TCollection_AsciiString ("0"). IsLess("1"));
878 //assert( TCollection_AsciiString ("0"). IsLess("00"));
879 //assert( TCollection_AsciiString (""). IsLess("0"));
880 //assert( !TCollection_AsciiString("1"). IsLess("0"));
881 //assert( !TCollection_AsciiString("00").IsLess("0"));
882 //assert( !TCollection_AsciiString("0"). IsLess(""));
883 //assert( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1));
884 QCOMPARE ( TCollection_AsciiString ("0"). IsLess("1") , Standard_True );
885 QCOMPARE ( TCollection_AsciiString ("0"). IsLess("00") , Standard_True );
886 QCOMPARE ( TCollection_AsciiString (""). IsLess("0") , Standard_True );
887 QCOMPARE ( !TCollection_AsciiString("1"). IsLess("0"), Standard_True );
888 QCOMPARE ( !TCollection_AsciiString("00").IsLess("0") , Standard_True );
889 QCOMPARE ( !TCollection_AsciiString("0"). IsLess("") , Standard_True );
890 QCOMPARE ( TCollection_AsciiString (theStr+i).IsLess(theStr+i+1) , Standard_True );
891
892 // IsLess (const TCollection_AsciiString& other)const
893 //assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )));
894 //assert( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")));
895 //assert( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )));
896 //assert( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )));
897 //assert( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )));
898 //assert( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )));
899 //assert( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)));
900 QCOMPARE ( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("1" )) , Standard_True );
901 QCOMPARE ( TCollection_AsciiString ("0"). IsLess(TCollection_AsciiString("00")) , Standard_True );
902 QCOMPARE ( TCollection_AsciiString (""). IsLess(TCollection_AsciiString("0" )) , Standard_True );
903 QCOMPARE ( !TCollection_AsciiString("1"). IsLess(TCollection_AsciiString("0" )) , Standard_True );
904 QCOMPARE ( !TCollection_AsciiString("00").IsLess(TCollection_AsciiString("0" )) , Standard_True );
905 QCOMPARE ( !TCollection_AsciiString("0"). IsLess(TCollection_AsciiString("" )) , Standard_True );
906 QCOMPARE ( TCollection_AsciiString (theStr+i).IsLess(TCollection_AsciiString(theStr+i+1)) , Standard_True );
907
908 // IsGreater (const Standard_CString other)const
909 //assert( !TCollection_AsciiString("0"). IsGreater("1"));
910 //assert( !TCollection_AsciiString("0"). IsGreater("00"));
911 //assert( !TCollection_AsciiString(""). IsGreater("0"));
912 //assert( TCollection_AsciiString ("1"). IsGreater("0"));
913 //assert( TCollection_AsciiString ("00").IsGreater("0"));
914 //assert( TCollection_AsciiString ("0"). IsGreater(""));
915 //assert( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i));
916 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater("1") , Standard_True );
917 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater("00") , Standard_True );
918 QCOMPARE ( !TCollection_AsciiString(""). IsGreater("0") , Standard_True );
919 QCOMPARE ( TCollection_AsciiString ("1"). IsGreater("0") , Standard_True );
920 QCOMPARE ( TCollection_AsciiString ("00").IsGreater("0") , Standard_True );
921 QCOMPARE ( TCollection_AsciiString ("0"). IsGreater("") , Standard_True );
922 QCOMPARE ( TCollection_AsciiString (theStr+i+1).IsGreater(theStr+i) , Standard_True );
923
924 // IsGreater (const TCollection_AsciiString& other)const
925 //assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )));
926 //assert( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")));
927 //assert( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )));
928 //assert( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )));
929 //assert( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )));
930 //assert( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )));
931 //assert( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)));
932 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("1" )) , Standard_True );
933 QCOMPARE ( !TCollection_AsciiString("0"). IsGreater(TCollection_AsciiString("00")) , Standard_True );
934 QCOMPARE ( !TCollection_AsciiString(""). IsGreater(TCollection_AsciiString("0" )) , Standard_True );
935 QCOMPARE ( TCollection_AsciiString ("1"). IsGreater(TCollection_AsciiString("0" )) , Standard_True );
936 QCOMPARE ( TCollection_AsciiString ("00").IsGreater(TCollection_AsciiString("0" )) , Standard_True );
937 QCOMPARE ( TCollection_AsciiString ("0"). IsGreater(TCollection_AsciiString("" )) , Standard_True );
938 QCOMPARE ( TCollection_AsciiString (theStr+i+1).IsGreater(TCollection_AsciiString(theStr+i)) , Standard_True );
939
940 // void Read(Standard_IStream& astream)
941 std::istringstream is( theStr );
942 e.Read( is );
943 //assert( e == theStr );
944 QCOMPARE ( e , theStr );
945
946 // Standard_Integer SearchFromEnd (const Standard_CString what)const
947 //assert( e.SearchFromEnd( theStr + i ) == i + 1 );
948 QCOMPARE ( e.SearchFromEnd( theStr + i ) , i + 1 );
949
950 // SetValue(const Standard_Integer where, const Standard_CString what)
951 e.SetValue( i+1, "what");
952 //assert( e.Search( "what" ) == i+1 );
953 //assert( e.Length() == strlen( theStr ));
954 QCOMPARE ( e.Search( "what" ) , i+1 );
955 QCOMPARE ( e.Length() , (Standard_Integer)strlen( theStr ) );
956
957 // TCollection_AsciiString Split (const Standard_Integer where)
958 e = theStr;
959 d = e.Split( i+1 );
960 //assert( d.Length() + e.Length() == strlen( theStr ));
961 QCOMPARE ( d.Length() + e.Length() , (Standard_Integer)strlen( theStr ) );
962
963 // TCollection_AsciiString SubString (const Standard_Integer FromIndex,
964 // const Standard_Integer ToIndex) const
965 e = theStr;
966 d = e.SubString( (unsigned int)i+1, (unsigned int)i+3 );
967 //assert( d.Length() == 3 );
968 //assert( d.Value(1) == theStr[ i ]);
969 QCOMPARE ( d.Length() , 3 );
970 QCOMPARE ( d.Value(1) , theStr[ i ] );
971
972 // TCollection_AsciiString Token (const Standard_CString separators,
973 // const Standard_Integer whichone) const
974 e = " ";
975 for ( j = 0; j < i; ++j ) {
976 e += TCollection_AsciiString( theStr[j] ) + " ";
977 //assert( e.Token(" ", j+1 ) == TCollection_AsciiString( theStr+j, 1 ));
978 QCOMPARE ( e.Token(" ", j+1 ) , TCollection_AsciiString( theStr+j, 1 ) );
979 }
980 }
981 for ( i = 0; i < 5; ++i )
982 {
983 // TCollection_ExtendedString (const Standard_CString astring,
984 // const Standard_Boolean isMultiByte)
985 const TCollection_ExtendedString a( theStr+i );
986 //assert( TCollection_AsciiString( a ) == theStr+i );
987 QCOMPARE ( TCollection_AsciiString( a ) , theStr+i );
988
989 //TCollection_ExtendedString (const Standard_ExtString astring)
990 const TCollection_ExtendedString b( a.ToExtString() );
991 //assert( a == b );
992 QCOMPARE ( a , b );
993
994 // TCollection_ExtendedString (const Standard_Integer length,
995 // const Standard_ExtCharacter filler )
996 const TCollection_ExtendedString c( i, 1 );
997 //assert( c.Length() == i );
998 QCOMPARE ( c.Length() , i );
999 if ( c.Length() > 0 ) {
1000 //assert( c.Value( i ) == 1 );
1001 QCOMPARE ( c.Value( i ) , 1 );
1002 }
1003
1004 // TCollection_ExtendedString (const Standard_Integer aValue)
1005 TCollection_ExtendedString d( i );
1006 const TCollection_AsciiString da( d );
1007 //assert( da.IsIntegerValue() );
1008 //assert( da.IntegerValue() == i );
1009 QCOMPARE ( da.IsIntegerValue() , Standard_True );
1010 QCOMPARE ( da.IntegerValue(), i );
1011
1012 // TCollection_ExtendedString (const Standard_Real aValue)
1013 const TCollection_ExtendedString e( 0.1 * i );
1014 const TCollection_AsciiString ea( e );
1015 //assert( ea.IsRealValue() );
1016 //assert( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 );
1017 QCOMPARE ( ea.IsRealValue() , Standard_True );
1018 QCOMPARE ( Abs( ea.RealValue() - 0.1 * i ) < 1e-10 , Standard_True );
1019
1020 // TCollection_ExtendedString (const TCollection_ExtendedString& astring)
1021 const TCollection_ExtendedString f(e);
1022 //assert( f.Length() == e.Length());
1023 //assert( f == e );
1024 QCOMPARE ( f.Length() , e.Length() );
1025 QCOMPARE ( f , e );
1026
1027 // TCollection_ExtendedString (const TCollection_AsciiString& astring)
1028 const TCollection_ExtendedString g( ea );
1029 //assert( g.Length() == ea.Length() );
1030 //assert( TCollection_AsciiString( g ) == ea );
1031 QCOMPARE ( g.Length() , ea.Length() );
1032 QCOMPARE ( TCollection_AsciiString( g ) , ea );
1033
1034 // AssignCat (const TCollection_ExtendedString& other)
1035 const TCollection_ExtendedString sep(",");
1036 d.AssignCat( sep );
1037 d.AssignCat( g );
1038 //assert( d.Length() == 2 + g.Length() );
1039 //assert( d.Token( sep.ToExtString(), 1 ) == TCollection_ExtendedString( i ));
1040 //assert( d.Token( sep.ToExtString(), 2 ) == g );
1041 QCOMPARE ( d.Length() , 2 + g.Length() );
1042 QCOMPARE ( d.Token( sep.ToExtString(), 1 ) , TCollection_ExtendedString( i ) );
1043 QCOMPARE ( d.Token( sep.ToExtString(), 2 ) , g );
1044
1045 // TCollection_ExtendedString Cat (const TCollection_ExtendedString& other) const
1046 const TCollection_ExtendedString cat = a.Cat( sep );
1047 //assert( cat.Length() == a.Length() + sep.Length() );
1048 //assert( cat.Search( a ) == 1 );
1049 //assert( cat.Search( sep ) == a.Length() + 1 );
1050 QCOMPARE ( cat.Length() , a.Length() + sep.Length() );
1051 QCOMPARE ( cat.Search( a ) , 1 );
1052 QCOMPARE ( cat.Search( sep ) , a.Length() + 1 );
1053
1054 // Copy (const TCollection_ExtendedString& fromwhere)
1055 d = cat;
1056 //assert( d.Length() == cat.Length() );
1057 //assert( d == cat );
1058 QCOMPARE ( d.Length() , cat.Length() );
1059 QCOMPARE ( d , cat );
1060
1061 // IsEqual (const Standard_ExtString other) const
1062 //assert( d.IsEqual( d.ToExtString() ));
1063 QCOMPARE ( d.IsEqual( d.ToExtString() ) , Standard_True );
1064
1065 // IsDifferent (const Standard_ExtString other ) const
1066 //assert( d.IsDifferent( a.ToExtString() ));
1067 QCOMPARE ( d.IsDifferent( a.ToExtString() ) , Standard_True );
1068
1069 // IsDifferent (const TCollection_ExtendedString& other) const
1070 //assert( d.IsDifferent( a ));
1071 QCOMPARE ( d.IsDifferent( a ) , Standard_True );
1072
1073 // IsLess (const Standard_ExtString other) const
1074 const TCollection_ExtendedString l0("0"), l1("1"), l00("00"), l, ls(theStr+i), ls1(theStr+i+1);
1075 //assert( l0. IsLess( l1.ToExtString() ));
1076 //assert( l0. IsLess( l00.ToExtString() ));
1077 //assert( l. IsLess( l0.ToExtString() ));
1078 //assert( ! l1. IsLess( l0.ToExtString() ));
1079 //assert( ! l00.IsLess( l0.ToExtString() ));
1080 //assert( ! l0. IsLess( l.ToExtString() ));
1081 //assert( ls.IsLess( ls1.ToExtString() ));
1082 QCOMPARE ( l0. IsLess( l1.ToExtString() ) , Standard_True );
1083 QCOMPARE ( l0. IsLess( l00.ToExtString() ) , Standard_True );
1084 QCOMPARE ( l. IsLess( l0.ToExtString() ) , Standard_True );
1085 QCOMPARE ( ! l1. IsLess( l0.ToExtString() ) , Standard_True );
1086 QCOMPARE ( ! l00.IsLess( l0.ToExtString() ) , Standard_True );
1087 QCOMPARE ( ! l0. IsLess( l.ToExtString() ) , Standard_True );
1088 QCOMPARE ( ls.IsLess( ls1.ToExtString() ) , Standard_True );
1089
1090 // IsLess (const TCollection_ExtendedString& other) const
1091 //assert( l0. IsLess( l1 ));
1092 //assert( l0. IsLess( l00 ));
1093 //assert( l. IsLess( l0 ));
1094 //assert( ! l1. IsLess( l0 ));
1095 //assert( ! l00.IsLess( l0 ));
1096 //assert( ! l0. IsLess( l ));
1097 //assert( ls.IsLess( ls1 ));
1098 QCOMPARE ( l0. IsLess( l1 ) , Standard_True );
1099 QCOMPARE ( l0. IsLess( l00 ) , Standard_True );
1100 QCOMPARE ( l. IsLess( l0 ) , Standard_True );
1101 QCOMPARE ( ! l1. IsLess( l0 ) , Standard_True );
1102 QCOMPARE ( ! l00.IsLess( l0 ) , Standard_True );
1103 QCOMPARE ( ! l0. IsLess( l ) , Standard_True );
1104 QCOMPARE ( ls.IsLess( ls1 ) , Standard_True );
1105
1106 // IsGreater (const Standard_ExtString other) const
1107 //assert( ! l0.IsGreater( l1.ToExtString() ));
1108 //assert( ! l0.IsGreater( l00.ToExtString() ));
1109 //assert( ! l. IsGreater( l0.ToExtString() ));
1110 //assert( l1. IsGreater( l0.ToExtString() ));
1111 //assert( l00.IsGreater( l0.ToExtString() ));
1112 //assert( l0. IsGreater( l.ToExtString() ));
1113 //assert( ls1.IsGreater( ls.ToExtString() ));
1114 QCOMPARE ( ! l0.IsGreater( l1.ToExtString() ) , Standard_True );
1115 QCOMPARE ( ! l0.IsGreater( l00.ToExtString() ) , Standard_True );
1116 QCOMPARE ( ! l. IsGreater( l0.ToExtString() ) , Standard_True );
1117 QCOMPARE ( l1. IsGreater( l0.ToExtString() ) , Standard_True );
1118 QCOMPARE ( l00.IsGreater( l0.ToExtString() ) , Standard_True );
1119 QCOMPARE ( l0. IsGreater( l.ToExtString() ) , Standard_True );
1120 QCOMPARE ( ls1.IsGreater( ls.ToExtString() ) ,Standard_True );
1121
1122 // IsGreater (const TCollection_ExtendedString& other) const
1123 //assert( ! l0.IsGreater( l1));
1124 //assert( ! l0.IsGreater( l00));
1125 //assert( ! l. IsGreater( l0));
1126 //assert( l1. IsGreater( l0));
1127 //assert( l00.IsGreater( l0));
1128 //assert( l0. IsGreater( l));
1129 //assert( ls1.IsGreater( ls));
1130 QCOMPARE ( ! l0.IsGreater( l1) , Standard_True );
1131 QCOMPARE ( ! l0.IsGreater( l00) , Standard_True );
1132 QCOMPARE ( ! l. IsGreater( l0) , Standard_True );
1133 QCOMPARE ( l1. IsGreater( l0) , Standard_True );
1134 QCOMPARE ( l00.IsGreater( l0) , Standard_True );
1135 QCOMPARE ( l0. IsGreater( l) , Standard_True );
1136 QCOMPARE ( ls1.IsGreater( ls) , Standard_True );
1137
1138 // ==========================
1139 //TCollection_HAsciiString::
1140 // ==========================
1141
1142 // IsDifferent(const Handle(TCollection_HAsciiString)& S)
1143 Handle(TCollection_HAsciiString) ha1 = new TCollection_HAsciiString( theStr+i );
1144 Handle(TCollection_HAsciiString) ha2 = new TCollection_HAsciiString( theStr+i+1 );
1145 //assert( ha1->IsDifferent( ha2 ));
1146 //assert( !ha1->IsDifferent( ha1 ));
1147 QCOMPARE ( ha1->IsDifferent( ha2 ) , Standard_True );
1148 QCOMPARE ( !ha1->IsDifferent( ha1 ) , Standard_True );
1149
1150 // IsSameString (const Handle(TCollection_HAsciiString)& S)
1151 //assert( !ha1->IsSameString( ha2 ));
1152 //assert( ha1->IsSameString( ha1 ));
1153 QCOMPARE ( !ha1->IsSameString( ha2 ) , Standard_True );
1154 QCOMPARE ( ha1->IsSameString( ha1 ) , Standard_True );
1155
1156 // IsSameState (const Handle(TCollection_HAsciiString)& other) const
1157 //assert( !ha1->IsSameState( ha2 ));
1158 //assert( ha1->IsSameState( ha1 ));
1159 QCOMPARE ( !ha1->IsSameState( ha2 ) , Standard_True );
1160 QCOMPARE ( ha1->IsSameState( ha1 ) , Standard_True );
1161
1162 // IsSameString (const Handle(TCollection_HAsciiString)& S ,
1163 // const Standard_Boolean CaseSensitive) const
1164 //assert( !ha1->IsSameString( ha2, true ));
1165 //assert( ha1->IsSameString( ha1, true ));
1166 //assert( !ha1->IsSameString( ha2, false ));
1167 //assert( ha1->IsSameString( ha1, false ));
1168 QCOMPARE ( !ha1->IsSameString( ha2, Standard_True ) , Standard_True );
1169 QCOMPARE ( ha1->IsSameString( ha1, Standard_True ) , Standard_True );
1170 QCOMPARE ( !ha1->IsSameString( ha2, Standard_False ) , Standard_True );
1171 QCOMPARE ( ha1->IsSameString( ha1, Standard_False ) , Standard_True );
1172
1173 ha1->SetValue( 1, "AbC0000000");
1174 ha2->SetValue( 1, "aBc0000000");
1175 //assert( !ha1->IsSameString( ha2, true ));
1176 //assert( ha1->IsSameString( ha2, false ));
1177 QCOMPARE ( !ha1->IsSameString( ha2, Standard_True ) , Standard_True );
1178 QCOMPARE ( ha1->IsSameString( ha2, Standard_False ), Standard_True );
1179 }
1180 return 0;
1181}
1182
788cbaf4 1183#include <Geom_CylindricalSurface.hxx>
1184#include <IntTools_FaceFace.hxx>
1185#include <IntTools_Curve.hxx>
1186#include <IntTools_PntOn2Faces.hxx>
1187
1188static Standard_Integer OCC24005 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
1189{
1190 if(theNArg < 2)
1191 {
1192 theDI << "Wrong a number of arguments!\n";
1193 return 1;
1194 }
1195
1196 Handle_Geom_Plane plane(new Geom_Plane(
1197 gp_Ax3( gp_Pnt(-72.948737453424499, 754.30437716359393, 259.52151854671678),
1198 gp_Dir(6.2471473085930200e-007, -0.99999999999980493, 0.00000000000000000),
1199 gp_Dir(0.99999999999980493, 6.2471473085930200e-007, 0.00000000000000000))));
1200 Handle(Geom_CylindricalSurface) cylinder(
1201 new Geom_CylindricalSurface(
1202 gp_Ax3(gp_Pnt(-6.4812490053250649, 753.39408794522092, 279.16400974257465),
1203 gp_Dir(1.0000000000000000, 0.0, 0.00000000000000000),
1204 gp_Dir(0.0, 1.0000000000000000, 0.00000000000000000)),
1205 19.712534607908712));
1206
1207 DrawTrSurf::Set("pln", plane);
1208 theDI << "pln\n";
1209 DrawTrSurf::Set("cyl", cylinder);
1210 theDI << "cyl\n";
1211
1212 BRep_Builder builder;
1213 TopoDS_Face face1, face2;
1214 builder.MakeFace(face1, plane, Precision::Confusion());
1215 builder.MakeFace(face2, cylinder, Precision::Confusion());
1216 IntTools_FaceFace anInters;
1217 anInters.SetParameters(false, true, true, Precision::Confusion());
1218 anInters.Perform(face1, face2);
1219
1220 if (!anInters.IsDone())
1221 {
1222 theDI<<"No intersections found!"<<"\n";
1223
1224 return 1;
1225 }
1226
1227 //Handle(Geom_Curve) aResult;
1228 //gp_Pnt aPoint;
1229
1230 const IntTools_SequenceOfCurves& aCvsX=anInters.Lines();
1231 const IntTools_SequenceOfPntOn2Faces& aPntsX=anInters.Points();
1232
1233 char buf[1024];
1234 Standard_Integer aNbCurves, aNbPoints;
1235
1236 aNbCurves=aCvsX.Length();
1237 aNbPoints=aPntsX.Length();
1238
1239 if (aNbCurves >= 2)
1240 {
1241 for (Standard_Integer i=1; i<=aNbCurves; ++i)
1242 {
1243 Sprintf(buf, "%s_%d",theArgv[1],i);
1244 theDI << buf << " ";
1245
1246 const IntTools_Curve& aIC = aCvsX(i);
1247 const Handle(Geom_Curve)& aC3D= aIC.Curve();
1248 DrawTrSurf::Set(buf,aC3D);
1249 }
1250 }
1251 else if (aNbCurves == 1)
1252 {
1253 const IntTools_Curve& aIC = aCvsX(1);
1254 const Handle(Geom_Curve)& aC3D= aIC.Curve();
1255 Sprintf(buf, "%s",theArgv[1]);
1256 theDI << buf << " ";
1257 DrawTrSurf::Set(buf,aC3D);
1258 }
1259
1260 for (Standard_Integer i = 1; i<=aNbPoints; ++i)
1261 {
1262 const IntTools_PntOn2Faces& aPi=aPntsX(i);
1263 const gp_Pnt& aP=aPi.P1().Pnt();
1264
1265 Sprintf(buf,"%s_p_%d",theArgv[1],i);
1266 theDI << buf << " ";
1267 DrawTrSurf::Set(buf, aP);
1268 }
1269
1270 return 0;
1271}
1272
89d8607f 1273#include <Extrema_FuncExtPS.hxx>
1274#include <math_FunctionSetRoot.hxx>
1275#include <math_Vector.hxx>
1276#include <BRepBuilderAPI_MakeVertex.hxx>
1277static Standard_Integer OCC24137 (Draw_Interpretor& theDI, Standard_Integer theNArg, const char** theArgv)
1278{
1279 Standard_Integer anArgIter = 1;
1280 if (theNArg < 5)
1281 {
1282 theDI <<"Usage: " << theArgv[0] << " face vertex U V [N]"<<"\n";
1283 return 1;
1284 }
1285
1286 // get target shape
1287 Standard_CString aFaceName = theArgv[anArgIter++];
1288 Standard_CString aVertName = theArgv[anArgIter++];
1289 const TopoDS_Shape aShapeF = DBRep::Get (aFaceName);
1290 const TopoDS_Shape aShapeV = DBRep::Get (aVertName);
1291 const Standard_Real aUFrom = Atof (theArgv[anArgIter++]);
1292 const Standard_Real aVFrom = Atof (theArgv[anArgIter++]);
1293 const Standard_Integer aNbIts = (anArgIter < theNArg) ? atol (theArgv[anArgIter++]) : 100;
1294 if (aShapeF.IsNull() || aShapeF.ShapeType() != TopAbs_FACE)
1295 {
1296 std::cout << "Error: " << aFaceName << " shape is null / not a face" << std::endl;
1297 return 1;
1298 }
1299 if (aShapeV.IsNull() || aShapeV.ShapeType() != TopAbs_VERTEX)
1300 {
1301 std::cout << "Error: " << aVertName << " shape is null / not a vertex" << std::endl;
1302 return 1;
1303 }
1304 const TopoDS_Face aFace = TopoDS::Face (aShapeF);
1305 const TopoDS_Vertex aVert = TopoDS::Vertex (aShapeV);
1306 GeomAdaptor_Surface aSurf (BRep_Tool::Surface (aFace));
1307
1308 gp_Pnt aPnt = BRep_Tool::Pnt (aVert), aRes;
1309
1310 Extrema_FuncExtPS anExtFunc;
1311 math_FunctionSetRoot aRoot (anExtFunc, aNbIts);
1312
1313 math_Vector aTolUV (1, 2), aUVinf (1, 2), aUVsup (1, 2), aFromUV (1, 2);
1314 aTolUV (1) = Precision::Confusion(); aTolUV (2) = Precision::Confusion();
1315 aUVinf (1) = -Precision::Infinite(); aUVinf (2) = -Precision::Infinite();
1316 aUVsup (1) = Precision::Infinite(); aUVsup (2) = Precision::Infinite();
1317 aFromUV(1) = aUFrom; aFromUV(2) = aVFrom;
1318
1319 anExtFunc.Initialize (aSurf);
1320 anExtFunc.SetPoint (aPnt);
1321 aRoot.SetTolerance (aTolUV);
1322 aRoot.Perform (anExtFunc, aFromUV, aUVinf, aUVsup);
1323 if (!aRoot.IsDone())
1324 {
1325 std::cerr << "No results!\n";
1326 return 1;
1327 }
1328
1329 theDI << aRoot.Root()(1) << " " << aRoot.Root()(2) << "\n";
1330
1331 aSurf.D0 (aRoot.Root()(1), aRoot.Root()(2), aRes);
1332 DBRep::Set ("result", BRepBuilderAPI_MakeVertex (aRes));
1333 return 0;
1334}
1335
ab2db9a5 1336//! Check boolean operations on NCollection_Map
1337static Standard_Integer OCC24271 (Draw_Interpretor& di,
1338 Standard_Integer /*theArgNb*/,
1339 const char** /*theArgVec*/)
1340{
1341 // input data
1342 const Standard_Integer aLeftLower = 1;
1343 const Standard_Integer aLeftUpper = 10;
1344 const Standard_Integer aRightLower = 5;
1345 const Standard_Integer aRightUpper = 15;
1346
1347 // define arguments
1348 NCollection_Map<Standard_Integer> aMapLeft;
1349 for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aLeftUpper; ++aKeyIter)
1350 {
1351 aMapLeft.Add (aKeyIter);
1352 }
1353
1354 NCollection_Map<Standard_Integer> aMapRight;
1355 for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aRightUpper; ++aKeyIter)
1356 {
1357 aMapRight.Add (aKeyIter);
1358 }
1359
1360 QCOMPARE (aMapLeft .Contains (aMapRight), Standard_False);
1361 QCOMPARE (aMapRight.Contains (aMapLeft), Standard_False);
1362
1363 // validate Union operation
1364 NCollection_Map<Standard_Integer> aMapUnion;
1365 aMapUnion.Union (aMapLeft, aMapRight);
1366 QCOMPARE (aMapUnion.Extent(), aRightUpper - aLeftLower + 1);
1367 for (Standard_Integer aKeyIter = aLeftLower; aKeyIter <= aRightUpper; ++aKeyIter)
1368 {
1369 QCOMPARE (aMapUnion.Contains (aKeyIter), Standard_True);
1370 }
1371
1372 // validate Intersection operation
1373 NCollection_Map<Standard_Integer> aMapSect;
1374 aMapSect.Intersection (aMapLeft, aMapRight);
1375 QCOMPARE (aMapSect.Extent(), aLeftUpper - aRightLower + 1);
1376 for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter)
1377 {
1378 QCOMPARE (aMapSect.Contains (aKeyIter), Standard_True);
1379 }
1380 QCOMPARE (aMapLeft .Contains (aMapSect), Standard_True);
1381 QCOMPARE (aMapRight.Contains (aMapSect), Standard_True);
1382
1383 // validate Substruction operation
1384 NCollection_Map<Standard_Integer> aMapSubsLR;
1385 aMapSubsLR.Subtraction (aMapLeft, aMapRight);
1386 QCOMPARE (aMapSubsLR.Extent(), aRightLower - aLeftLower);
1387 for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter)
1388 {
1389 QCOMPARE (aMapSubsLR.Contains (aKeyIter), Standard_True);
1390 }
1391
1392 NCollection_Map<Standard_Integer> aMapSubsRL;
1393 aMapSubsRL.Subtraction (aMapRight, aMapLeft);
1394 QCOMPARE (aMapSubsRL.Extent(), aRightUpper - aLeftUpper);
1395 for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter < aRightUpper; ++aKeyIter)
1396 {
1397 QCOMPARE (aMapSubsRL.Contains (aKeyIter), Standard_True);
1398 }
1399
1400 // validate Difference operation
1401 NCollection_Map<Standard_Integer> aMapDiff;
1402 aMapDiff.Difference (aMapLeft, aMapRight);
1403 QCOMPARE (aMapDiff.Extent(), aRightLower - aLeftLower + aRightUpper - aLeftUpper);
1404 for (Standard_Integer aKeyIter = aLeftLower; aKeyIter < aRightLower; ++aKeyIter)
1405 {
1406 QCOMPARE (aMapDiff.Contains (aKeyIter), Standard_True);
1407 }
1408 for (Standard_Integer aKeyIter = aLeftUpper + 1; aKeyIter < aRightUpper; ++aKeyIter)
1409 {
1410 QCOMPARE (aMapDiff.Contains (aKeyIter), Standard_True);
1411 }
1412
1413 // validate Exchange operation
1414 NCollection_Map<Standard_Integer> aMapSwap;
1415 aMapSwap.Exchange (aMapSect);
1416 for (Standard_Integer aKeyIter = aRightLower; aKeyIter <= aLeftUpper; ++aKeyIter)
1417 {
1418 QCOMPARE (aMapSwap.Contains (aKeyIter), Standard_True);
1419 }
1420 QCOMPARE (aMapSect.IsEmpty(), Standard_True);
1421 aMapSwap.Add (34);
1422 aMapSect.Add (43);
1423
1424 NCollection_Map<Standard_Integer> aMapCopy (aMapSwap);
1425 QCOMPARE (aMapCopy.IsEqual (aMapSwap), Standard_True);
1426 aMapCopy.Remove (34);
1427 aMapCopy.Add (43);
1428 QCOMPARE (aMapCopy.IsEqual (aMapSwap), Standard_False);
1429
1430 return 0;
1431}
1432
e3096dec 1433#include <ShapeFix_EdgeProjAux.hxx>
1434static Standard_Integer OCC24370 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
1435{
1436 if (argc < 5) {
1437 di<<"Usage: " << argv[0] << " invalid number of arguments"<<"\n";
1438 return 1;
1439 }
1440
1441 TopoDS_Shape aSh = DBRep::Get(argv[1]);
1442 if (aSh.IsNull()) {
1443 di << argv[0] << " Error: Null input edge\n";
1444 return 1;
1445 }
1446 const TopoDS_Edge& anEdge = TopoDS::Edge (aSh);
1447
1448 Handle(Geom2d_Curve) aC = DrawTrSurf::GetCurve2d(argv[2]);
1449 if (aC.IsNull()) {
1450 di << argv[0] << " Error: Null input curve\n";
1451 return 1;
1452 }
1453
1454 Handle(Geom_Surface) aS = DrawTrSurf::GetSurface(argv[3]);
1455 if (aS.IsNull()) {
1456 di << argv[0] << " Error: Null input surface\n";
1457 return 1;
1458 }
1459
1460 Standard_Real prec = Draw::Atof(argv[4]);
1461
1462 //prepare data
1463 TopoDS_Face aFace;
1464 BRep_Builder aB;
1465 aB.MakeFace (aFace, aS, Precision::Confusion());
1466 aB.UpdateEdge (anEdge, aC, aFace, Precision::Confusion());
1467 aB.Range (anEdge, aFace, aC->FirstParameter(), aC->LastParameter());
1468
1469 //call algorithm
1470 ShapeFix_EdgeProjAux aProj (aFace, anEdge);
1471 aProj.Compute (prec);
1472
1473 Standard_Boolean isfirstdone = aProj.IsFirstDone();
1474 Standard_Boolean islastdone = aProj.IsLastDone();
1475
1476 Standard_Real first = 0.;
1477 Standard_Real last = 0.;
1478 Standard_Integer isfirstdoneInteger = 0;
1479 Standard_Integer islastdoneInteger = 0;
1480
1481
1482 if (isfirstdone) {
1483 first = aProj.FirstParam();
1484 isfirstdoneInteger = 1;
1485 }
1486
1487 if (islastdone) {
1488 last= aProj.LastParam();
1489 islastdoneInteger = 1;
1490 }
1491
1492 di << isfirstdoneInteger << " "<< islastdoneInteger << " "<< first << " "<< last << " \n";
1493
1494 return 0;
1495}
1496
05d7de53 1497template<typename T, typename HT>
1498static void DoIsNull(Draw_Interpretor& di)
1499{
1500 HT aHandle;
1501 // QVERIFY (aHandle.IsNull());
1502 QCOMPARE (aHandle.IsNull(), Standard_True);
1503 const T* p = aHandle.Access();
1504#if OCC_VERSION_HEX > 0x060700
1505 //QVERIFY (!p);
1506 //QVERIFY (p == 0);
1507 QCOMPARE (!p, Standard_True);
1508 QCOMPARE (p == 0, Standard_True);
1509#endif
1510
1511 aHandle = new T;
1512 //QVERIFY (!aHandle.IsNull());
1513 QCOMPARE (!aHandle.IsNull(), Standard_True);
1514 p = aHandle.Access();
1515 //QVERIFY (p);
1516 //QVERIFY (p != 0);
1517 QCOMPARE (p != NULL, Standard_True);
1518 QCOMPARE (p != 0, Standard_True);
1519}
1520
1521//=======================================================================
1522//function : OCC24533
1523//purpose :
1524//=======================================================================
1525static Standard_Integer OCC24533 (Draw_Interpretor& di, Standard_Integer n, const char**)
1526{
1527 if (n != 1) return 1;
1528
1529 DoIsNull<Standard_Transient, Handle_Standard_Transient>(di);
1530 DoIsNull<Standard_Persistent, Handle_Standard_Persistent>(di);
1531
1532 return 0;
1533}
1534
1cd84fee 1535void QABugs::Commands_19(Draw_Interpretor& theCommands) {
1365140b 1536 const char *group = "QABugs";
7fd59977 1537
1538 theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
1539 theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
f6f03db9 1540 theCommands.Add ("OCC23361", "OCC23361", __FILE__, OCC23361, group);
1365140b
RL
1541 theCommands.Add ("OCC23237", "OCC23237", __FILE__, OCC23237, group);
1542 theCommands.Add ("OCC22980", "OCC22980", __FILE__, OCC22980, group);
e6aad0ee 1543 theCommands.Add ("OCC23595", "OCC23595", __FILE__, OCC23595, group);
5d1833ef 1544 theCommands.Add ("OCC22611", "OCC22611 string nb", __FILE__, OCC22611, group);
e187cc0a 1545 theCommands.Add ("OCC22595", "OCC22595", __FILE__, OCC22595, group);
bead40f2 1546 theCommands.Add ("OCC23774", "OCC23774 shape1 shape2", __FILE__, OCC23774, group);
06be28a4 1547 theCommands.Add ("OCC23683", "OCC23683 shape", __FILE__, OCC23683, group);
1ef32e96
RL
1548 theCommands.Add ("OCC23952sweep", "OCC23952sweep nbupoles shape", __FILE__, OCC23952sweep, group);
1549 theCommands.Add ("OCC23952intersect", "OCC23952intersect nbsol shape1 shape2", __FILE__, OCC23952intersect, group);
1939140c 1550 theCommands.Add ("test_offset", "test_offset", __FILE__, test_offset, group);
05d7de53 1551 theCommands.Add ("OCC23945", "OCC23945 surfname U V X Y Z [DUX DUY DUZ DVX DVY DVZ [D2UX D2UY D2UZ D2VX D2VY D2VZ D2UVX D2UVY D2UVZ]]", __FILE__, OCC23945,group);
2e9fd4bc 1552 theCommands.Add ("OCC24008", "OCC24008 curve surface", __FILE__, OCC24008, group);
4bee43a9 1553 theCommands.Add ("OCC24019", "OCC24019 aShape", __FILE__, OCC24019, group);
29cb310a 1554 theCommands.Add ("OCC11758", "OCC11758", __FILE__, OCC11758, group);
788cbaf4 1555 theCommands.Add ("OCC24005", "OCC24005 result", __FILE__, OCC24005, group);
89d8607f 1556 theCommands.Add ("OCC24137", "OCC24137 face vertex U V [N]", __FILE__, OCC24137, group);
ab2db9a5 1557 theCommands.Add ("OCC24271", "Boolean operations on NCollection_Map", __FILE__, OCC24271, group);
e3096dec 1558 theCommands.Add ("OCC24370", "OCC24370 edge pcurve surface prec", __FILE__, OCC24370, group);
05d7de53 1559 theCommands.Add ("OCC24533", "OCC24533", __FILE__, OCC24533, group);
7fd59977 1560 return;
1561}