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