7fd59977 |
1 | // File: Viewer2dTest_GeneralCommands.cxx |
2 | // Created: 22.01.02 16:21:20 |
3 | // Author: Julia DOROVSKIKH |
4 | // Copyright: Open Cascade 2001 |
5 | |
6 | #include <Viewer2dTest.hxx> |
7 | |
8 | #include <Viewer2dTest_DoubleMapOfInteractiveAndName.hxx> |
9 | #include <Viewer2dTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx> |
10 | |
11 | #include <Draw_Interpretor.hxx> |
12 | #include <TCollection_AsciiString.hxx> |
13 | #include <DBRep.hxx> |
14 | |
15 | //#include <V2d_Viewer.hxx> |
16 | |
17 | #include <TopoDS_Shape.hxx> |
18 | //#include <TopTools_ListOfShape.hxx> |
19 | //#include <TopTools_HArray1OfShape.hxx> |
20 | |
21 | #include <BRepTools.hxx> |
22 | #include <BRep_Builder.hxx> |
23 | //#include <BRepOffsetAPI_MakeThickSolid.hxx> |
24 | |
25 | //#include <TColStd_ListIteratorOfListOfInteger.hxx> |
26 | |
27 | //#include <OSD_Directory.hxx> |
28 | //#include <OSD_File.hxx> |
29 | //#include <OSD_Path.hxx> |
30 | //#include <OSD_Timer.hxx> |
31 | |
32 | //#include <gp_Trsf.hxx> |
33 | //#include <gp_Ax1.hxx> |
34 | |
35 | //#include <AIS2D_ProjShape.hxx> |
36 | //#include <AIS2D_InteractiveContext.hxx> |
37 | |
38 | Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D(); |
39 | //Handle(AIS2D_InteractiveContext)& TheAIS2DContext(); |
40 | |
41 | //======================================================================= |
42 | //function : GetTypeNames2d |
43 | //purpose : |
44 | //======================================================================= |
45 | //static char** GetTypeNames2d () |
46 | //{ |
47 | // static char* names[14] = {"Point","Axis","Trihedron","PlaneTrihedron", "Line","Circle","Plane", |
48 | // "Shape","ConnectedShape","MultiConn.Shape", |
49 | // "ConnectedInter.","MultiConn.", |
50 | // "Constraint","Dimension"}; |
51 | // static char** ThePointer = names; |
52 | // return ThePointer; |
53 | //} |
54 | |
55 | //======================================================================= |
56 | //function : GetTypeAndSignfromString2d |
57 | //purpose : |
58 | //======================================================================= |
59 | /*void GetTypeAndSignfromString2d (char* name, AIS_KindOfInteractive& TheType, |
60 | Standard_Integer& TheSign) |
61 | { |
62 | char ** thefullnames = GetTypeNames2d(); |
63 | Standard_Integer index(-1); |
64 | |
65 | for (Standard_Integer i = 0; i <= 13 && index == -1; i++) |
66 | if (!strcasecmp(name, thefullnames[i])) |
67 | index = i; |
68 | |
69 | if (index == -1) |
70 | { |
71 | TheType = AIS_KOI_None; |
72 | TheSign = -1; |
73 | return; |
74 | } |
75 | |
76 | if (index <= 6) |
77 | { |
78 | TheType = AIS_KOI_Datum; |
79 | TheSign = index+1; |
80 | } |
81 | else if (index <= 9) |
82 | { |
83 | TheType = AIS_KOI_Shape; |
84 | TheSign = index-7; |
85 | } |
86 | else if (index <= 11) |
87 | { |
88 | TheType = AIS_KOI_Object; |
89 | TheSign = index-10; |
90 | } |
91 | else |
92 | { |
93 | TheType = AIS_KOI_Relation; |
94 | TheSign = index-12; |
95 | } |
96 | }*/ |
97 | |
98 | //======================================================================= |
99 | //function : Get Context and active view.. |
100 | //purpose : |
101 | //======================================================================= |
102 | //void GetCtxAndView2d (Handle(AIS2D_InteractiveContext)& Ctx, |
103 | // Handle(V2d_View)& Viou) |
104 | //{ |
105 | // Ctx = Viewer2dTest::GetAIS2DContext(); |
106 | // const Handle(V2d_Viewer)& Vwr = Ctx->CurrentViewer(); |
107 | // Vwr->InitActiveViews(); |
108 | // if (Vwr->MoreActiveViews()) |
109 | // Viou = Vwr->ActiveView(); |
110 | //} |
111 | |
112 | //============================================================================== |
113 | //function : GetShapeFromName2d |
114 | //purpose : Compute an Shape from a draw variable or a file name |
115 | //============================================================================== |
116 | TopoDS_Shape GetShapeFromName2d (const char* name) |
117 | { |
118 | TopoDS_Shape S = DBRep::Get(name); |
119 | |
120 | if (S.IsNull()) |
121 | { |
122 | BRep_Builder aBuilder; |
123 | BRepTools::Read( S, name, aBuilder); |
124 | } |
125 | |
126 | return S; |
127 | } |
128 | /* |
129 | //============================================================================== |
130 | //function : V2dDispAreas |
131 | //purpose : Redraw the view |
132 | //Draw arg : No args |
133 | //============================================================================== |
134 | static int V2dDispAreas (Draw_Interpretor& ,Standard_Integer , const char** ) |
135 | { |
136 | Handle(AIS2D_InteractiveContext) Ctx; |
137 | Handle(V2d_View) Viou; |
138 | GetCtxAndView2d(Ctx,Viou); |
139 | // Ctx->DisplayActiveAreas(Viou); |
140 | return 0; |
141 | } |
142 | |
143 | //============================================================================== |
144 | //function : V2dClearAreas |
145 | //purpose : Redraw the view |
146 | //Draw arg : No args |
147 | //============================================================================== |
148 | static int V2dClearAreas (Draw_Interpretor& ,Standard_Integer , const char** ) |
149 | { |
150 | Handle(AIS2D_InteractiveContext) Ctx; |
151 | Handle(V2d_View) Viou; |
152 | GetCtxAndView2d(Ctx,Viou); |
153 | // Ctx->ClearActiveAreas(Viou); |
154 | return 0; |
155 | } |
156 | |
157 | //============================================================================== |
158 | //function : V2dDispSensi |
159 | //purpose : |
160 | //Draw arg : No args |
161 | //============================================================================== |
162 | static int V2dDispSensi (Draw_Interpretor& ,Standard_Integer , const char** ) |
163 | { |
164 | Handle(AIS2D_InteractiveContext) Ctx; |
165 | Handle(V2d_View) Viou; |
166 | GetCtxAndView2d(Ctx,Viou); |
167 | // Ctx->DisplayActiveSensitive(Viou); |
168 | return 0; |
169 | |
170 | } |
171 | |
172 | //============================================================================== |
173 | //function : V2dClearSensi |
174 | //purpose : |
175 | //Draw arg : No args |
176 | //============================================================================== |
177 | static int V2dClearSensi (Draw_Interpretor& ,Standard_Integer , const char** ) |
178 | { |
179 | Handle(AIS2D_InteractiveContext) Ctx; |
180 | Handle(V2d_View) Viou; |
181 | GetCtxAndView2d(Ctx,Viou); |
182 | // Ctx->ClearActiveSensitive(Viou); |
183 | return 0; |
184 | } |
185 | */ |
186 | //============================================================================== |
187 | //function : V2dDebug |
188 | //purpose : To list the displayed object with their attributes |
189 | //Draw arg : No args |
190 | //============================================================================== |
191 | static int V2dDebug (Draw_Interpretor& di, Standard_Integer , const char** ) |
192 | { |
193 | if (!Viewer2dTest::CurrentView().IsNull()) |
194 | { |
195 | di << "List of object in the viewer :" << "\n"; |
196 | |
197 | Viewer2dTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS2D()); |
198 | |
199 | while (it.More()) |
200 | { |
201 | di << "\t" << it.Key2().ToCString() << "\n"; |
202 | it.Next(); |
203 | } |
204 | } |
205 | |
206 | return 0; |
207 | } |
208 | |
209 | //======================================================================= |
210 | //function :V2dSubInt |
211 | //purpose : |
212 | //======================================================================= |
213 | /*static int V2dSubInt (Draw_Interpretor& , Standard_Integer argc, const char** argv) |
214 | { |
215 | if (argc == 1) return 1; |
216 | Standard_Integer On = atoi(argv[1]); |
217 | const Handle(AIS2D_InteractiveContext)& Ctx = Viewer2dTest::GetAIS2DContext(); |
218 | |
219 | if (argc == 2) |
220 | { |
221 | if (!Ctx->HasOpenedContext()) |
222 | { |
223 | cout << "sub intensite "; |
224 | if (On == 1) cout << "On"; |
225 | else cout << "Off"; |
226 | // cout<<"pour "<<Ctx->NbCurrents()<<" objets"<<endl; |
227 | for (Ctx->InitCurrent();Ctx->MoreCurrent();Ctx->NextCurrent()) |
228 | { |
229 | if(On==1){ |
230 | Ctx->SubIntensityOn(Ctx->Current(),Standard_False);} |
231 | else{ |
232 | cout <<"passage dans off"<<endl; |
233 | Ctx->SubIntensityOff(Ctx->Current(),Standard_False); |
234 | } |
235 | } |
236 | } |
237 | else |
238 | { |
239 | for(Ctx->InitSelected();Ctx->MoreSelected();Ctx->NextSelected()){ |
240 | if(On==1){ |
241 | Ctx->SubIntensityOn(Ctx->Interactive(),Standard_False);} |
242 | else{ |
243 | Ctx->SubIntensityOff(Ctx->Interactive(),Standard_False);} |
244 | } |
245 | } |
246 | Ctx->UpdateCurrentViewer(); |
247 | } |
248 | else |
249 | { |
250 | Handle(AIS2D_InteractiveObject) IO; |
251 | TCollection_AsciiString name = argv[2]; |
252 | if (GetMapOfAIS2D().IsBound2(name)) |
253 | { |
254 | IO = GetMapOfAIS2D().Find2(name); |
255 | if (On == 1) Ctx->SubIntensityOn(IO); |
256 | else Ctx->SubIntensityOff(IO); |
257 | } |
258 | else return 1; |
259 | } |
260 | return 0; |
261 | }*/ |
262 | |
263 | //============================================================================== |
264 | //function : GetTypeNameFromShape2d |
265 | //purpose : get the shape type as a string from a shape |
266 | //============================================================================== |
267 | //static char *GetTypeNameFromShape2d (const TopoDS_Shape& aShape) |
268 | //{ |
269 | // char *ret = "????"; |
270 | // |
271 | // if (aShape.IsNull()) ret = "Null Shape"; |
272 | // |
273 | // switch (aShape.ShapeType()) |
274 | // { |
275 | // case TopAbs_COMPOUND : ret = "COMPOUND" ; break; |
276 | // case TopAbs_COMPSOLID : ret = "COMPSOLID" ; break; |
277 | // case TopAbs_SOLID : ret = "SOLID" ; break; |
278 | // case TopAbs_SHELL : ret = "SHELL" ; break; |
279 | // case TopAbs_FACE : ret = "FACE" ; break; |
280 | // case TopAbs_WIRE : ret = "WIRE" ; break; |
281 | // case TopAbs_EDGE : ret = "EDGE" ; break; |
282 | // case TopAbs_VERTEX : ret = "VERTEX" ; break; |
283 | // case TopAbs_SHAPE : ret = "SHAPE" ; break; |
284 | // } |
285 | // return ret; |
286 | //} |
287 | |
288 | //============================================================================== |
289 | //function : GetEnvir2d |
290 | //purpose : |
291 | //============================================================================== |
292 | /*static TCollection_AsciiString GetEnvir2d () |
293 | { |
294 | static Standard_Boolean IsDefined = Standard_False ; |
295 | static TCollection_AsciiString VarName; |
296 | if (!IsDefined) |
297 | { |
298 | char *envir, *casroot ; |
299 | envir = getenv("CSF_MDTVTexturesDirectory") ; |
300 | |
301 | Standard_Boolean HasDefinition = Standard_False ; |
302 | if (!envir) |
303 | { |
304 | casroot = getenv("CASROOT"); |
305 | if (casroot) |
306 | { |
307 | VarName = TCollection_AsciiString (casroot); |
308 | VarName += "/src/Textures"; |
309 | HasDefinition = Standard_True; |
310 | } |
311 | } |
312 | else |
313 | { |
314 | VarName = TCollection_AsciiString(envir); |
315 | HasDefinition = Standard_True; |
316 | } |
317 | |
318 | if (HasDefinition) |
319 | { |
320 | OSD_Path aPath (VarName); |
321 | OSD_Directory aDir (aPath); |
322 | if (aDir.Exists()) |
323 | { |
324 | TCollection_AsciiString aTexture = VarName + "/2d_MatraDatavision.rgb"; |
325 | OSD_File TextureFile (aTexture); |
326 | if (!TextureFile.Exists()) |
327 | { |
328 | cout << " CSF_MDTVTexturesDirectory or CASROOT not correctly setted " << endl; |
329 | cout << " not all files are found in : "<<VarName.ToCString() << endl; |
330 | Standard_Failure::Raise("CSF_MDTVTexturesDirectory or CASROOT not correctly setted "); |
331 | } |
332 | } |
333 | else |
334 | { |
335 | cout << " CSF_MDTVTexturesDirectory or CASROOT not correctly setted " << endl; |
336 | cout << " Directory : "<< VarName.ToCString() << " not exist " << endl; |
337 | Standard_Failure::Raise("CSF_MDTVTexturesDirectory or CASROOT not correctly setted "); |
338 | } |
339 | return VarName ; |
340 | } |
341 | else |
342 | { |
343 | cout << " CSF_MDTVTexturesDirectory and CASROOT not setted " << endl; |
344 | cout << " one of these variable are mandatory to use this fonctionnality" << endl; |
345 | Standard_Failure::Raise("CSF_MDTVTexturesDirectory and CASROOT not setted "); |
346 | } |
347 | IsDefined = Standard_True ; |
348 | } |
349 | |
350 | return VarName ; |
351 | }*/ |
352 | |
353 | //============================================================================== |
354 | //function : V2dPerf |
355 | //purpose : Test the annimation of an object along a |
356 | // predefined traectory |
357 | //Draw arg : vperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF) |
358 | //============================================================================== |
359 | /*static int V2dPerf (Draw_Interpretor& , Standard_Integer , const char** argv) |
360 | { |
361 | OSD_Timer myTimer; |
362 | TheAIS2DContext()->CloseLocalContext(); |
363 | |
c6541a0c |
364 | Standard_Real Step = 4*M_PI/180; |
7fd59977 |
365 | Standard_Real Angle = 0; |
366 | |
367 | Handle(AIS2D_InteractiveObject) aIO; |
368 | aIO = GetMapOfAIS2D().Find2(argv[1]); |
369 | Handle(AIS2D_ProjShape) aShape = Handle(AIS2D_ProjShape)::DownCast(aIO); |
370 | |
371 | myTimer.Start(); |
372 | |
373 | if (atoi(argv[3]) == 1) |
374 | { |
375 | cout << " Primitives sensibles OFF" << endl; |
376 | // TheAIS2DContext()->Deactivate(aIO); |
377 | } |
378 | else |
379 | { |
380 | cout << " Primitives sensibles ON" << endl; |
381 | } |
382 | // Movement par transformation |
383 | if (atoi(argv[2]) == 1) |
384 | { |
385 | cout << " Calcul par Transformation" << endl; |
c6541a0c |
386 | for (Standard_Real myAngle = 0; Angle < 10*2*M_PI; myAngle++) |
7fd59977 |
387 | { |
388 | Angle = Step*myAngle; |
389 | gp_Trsf myTransfo; |
390 | myTransfo.SetRotation(gp_Ax1(gp_Pnt(0,0,0), gp_Dir(0,0,1)), Angle); |
391 | // TheAIS2DContext()->SetLocation(aShape,myTransfo); |
392 | TheAIS2DContext()->UpdateCurrentViewer(); |
393 | } |
394 | } |
395 | else |
396 | { |
397 | cout << " Calcul par Locations" << endl; |
398 | gp_Trsf myAngleTrsf; |
399 | myAngleTrsf.SetRotation(gp_Ax1(gp_Pnt(0,0,0), gp_Dir(0,0,1)), Step); |
400 | TopLoc_Location myDeltaAngle (myAngleTrsf); |
401 | TopLoc_Location myTrueLoc; |
402 | |
c6541a0c |
403 | for (Standard_Real myAngle = 0; Angle < 10*2*M_PI; myAngle++) |
7fd59977 |
404 | { |
405 | Angle = Step*myAngle; |
406 | myTrueLoc = myTrueLoc*myDeltaAngle; |
407 | // TheAIS2DContext()->SetLocation(aShape, myTrueLoc); |
408 | TheAIS2DContext()->UpdateCurrentViewer(); |
409 | } |
410 | } |
411 | if (atoi(argv[3]) == 1) |
412 | { |
413 | // On reactive la selection des primitives sensibles |
414 | // TheAIS2DContext()->Activate(aIO,0); |
415 | } |
416 | // Viewer2dTest::CurrentView()->Redraw(); |
417 | myTimer.Stop(); |
418 | cout << " Temps ecoule " << endl; |
419 | myTimer.Show(); |
420 | return 0; |
421 | }*/ |
422 | |
423 | //================================================================================== |
424 | // Function : V2dAnimation |
425 | //================================================================================== |
426 | /*static int V2dAnimation (Draw_Interpretor& , Standard_Integer , const char** ) |
427 | { |
428 | Standard_Real thread = 4; |
429 | Standard_Real angleA = 0; |
430 | Standard_Real angleB; |
431 | Standard_Real X; |
432 | gp_Ax1 Ax1 (gp_Pnt(0,0,0), gp_Vec(0,0,1)); |
433 | |
434 | BRep_Builder B; |
435 | TopoDS_Shape CrankArm; |
436 | TopoDS_Shape CylinderHead; |
437 | TopoDS_Shape Propeller; |
438 | TopoDS_Shape EngineBlock; |
439 | |
440 | BRepTools::Read(CrankArm,"/dp_26/Indus/ege/assemblage/CrankArm.rle",B); |
441 | BRepTools::Read(CylinderHead,"/dp_26/Indus/ege/assemblage/CylinderHead.rle",B); |
442 | BRepTools::Read(Propeller,"/dp_26/Indus/ege/assemblage/Propeller.rle",B); |
443 | BRepTools::Read(EngineBlock,"/dp_26/Indus/ege/assemblage/EngineBlock.rle",B); |
444 | |
445 | if (CrankArm.IsNull() || CylinderHead.IsNull() || Propeller.IsNull() || EngineBlock.IsNull()) |
446 | { |
447 | cout << " Syntaxe error:loading failure." << endl; |
448 | } |
449 | |
450 | OSD_Timer myTimer; |
451 | myTimer.Start(); |
452 | |
453 | Handle(AIS2D_ProjShape) myAisCylinderHead = new AIS2D_ProjShape(); |
454 | Handle(AIS2D_ProjShape) myAisEngineBlock = new AIS2D_ProjShape(); |
455 | Handle(AIS2D_ProjShape) myAisCrankArm = new AIS2D_ProjShape(); |
456 | Handle(AIS2D_ProjShape) myAisPropeller = new AIS2D_ProjShape(); |
457 | |
458 | myAisCylinderHead->Add(CylinderHead); |
459 | myAisCylinderHead->Add(EngineBlock); |
460 | myAisCylinderHead->Add(CrankArm); |
461 | myAisCylinderHead->Add(Propeller); |
462 | |
463 | GetMapOfAIS2D().Bind(myAisCylinderHead,"a"); |
464 | GetMapOfAIS2D().Bind(myAisEngineBlock,"b"); |
465 | GetMapOfAIS2D().Bind(myAisCrankArm,"c"); |
466 | GetMapOfAIS2D().Bind(myAisPropeller,"d"); |
467 | |
468 | // TheAIS2DContext()->SetColor(myAisCylinderHead, Quantity_NOC_INDIANRED); |
469 | // TheAIS2DContext()->SetColor(myAisEngineBlock , Quantity_NOC_RED); |
470 | // TheAIS2DContext()->SetColor(myAisPropeller , Quantity_NOC_GREEN); |
471 | |
472 | TheAIS2DContext()->Display(myAisCylinderHead,Standard_False); |
473 | TheAIS2DContext()->Display(myAisEngineBlock,Standard_False ); |
474 | TheAIS2DContext()->Display(myAisCrankArm,Standard_False ); |
475 | TheAIS2DContext()->Display(myAisPropeller,Standard_False); |
476 | |
477 | // TheAIS2DContext()->Deactivate(myAisCylinderHead); |
478 | // TheAIS2DContext()->Deactivate(myAisEngineBlock ); |
479 | // TheAIS2DContext()->Deactivate(myAisCrankArm ); |
480 | // TheAIS2DContext()->Deactivate(myAisPropeller ); |
481 | |
482 | // Boucle de mouvement |
c6541a0c |
483 | for (Standard_Real myAngle = 0; angleA < 2*M_PI*10.175; myAngle++) |
7fd59977 |
484 | { |
c6541a0c |
485 | angleA = thread*myAngle*M_PI/180; |
7fd59977 |
486 | X = Sin(angleA)*3/8; |
487 | angleB = atan(X / Sqrt(-X * X + 1)); |
488 | // Standard_Real decal(25*0.6); |
489 | |
490 | //Build a transformation on the display |
491 | gp_Trsf aPropellerTrsf; |
492 | aPropellerTrsf.SetRotation(Ax1,angleA); |
493 | // TheAIS2DContext()->SetLocation(myAisPropeller,aPropellerTrsf); |
494 | |
495 | // gp_Ax3 base(gp_Pnt(3*decal*(1-Cos(angleA)),-3*decal*Sin(angleA),0),gp_Vec(0,0,1),gp_Vec(1,0,0)); |
496 | // gp_Trsf aCrankArmTrsf; |
497 | // aCrankArmTrsf.SetTransformation( base.Rotated(gp_Ax1(gp_Pnt(3*decal,0,0),gp_Dir(0,0,1)),angleB)); |
498 | // TheAIS2DContext()->SetLocation(myAisCrankArm,aCrankArmTrsf); |
499 | |
500 | TheAIS2DContext()->UpdateCurrentViewer(); |
501 | } |
502 | |
503 | TopoDS_Shape myNewCrankArm; //=myAisCrankArm ->Shape().Located(myAisCrankArm ->Location()); |
504 | TopoDS_Shape myNewPropeller; //=myAisPropeller->Shape().Located(myAisPropeller->Location()); |
505 | |
506 | // myAisCrankArm ->ResetLocation(); |
507 | // myAisPropeller->ResetLocation(); |
508 | |
509 | // myAisCrankArm ->Set(myNewCrankArm ); |
510 | // myAisPropeller->Set(myNewPropeller); |
511 | |
512 | // TheAIS2DContext()->Activate(myAisCylinderHead,0); |
513 | // TheAIS2DContext()->Activate(myAisEngineBlock,0 ); |
514 | // TheAIS2DContext()->Activate(myAisCrankArm ,0 ); |
515 | // TheAIS2DContext()->Activate(myAisPropeller ,0 ); |
516 | |
517 | myTimer.Stop(); |
518 | myTimer.Show(); |
519 | myTimer.Start(); |
520 | |
521 | TheAIS2DContext()->Redisplay(myAisCrankArm ,Standard_False); |
522 | TheAIS2DContext()->Redisplay(myAisPropeller,Standard_False); |
523 | |
524 | TheAIS2DContext()->UpdateCurrentViewer(); |
525 | // Viewer2dTest::CurrentView()->Redraw(); |
526 | |
527 | myTimer.Stop(); |
528 | myTimer.Show(); |
529 | |
530 | return 0; |
531 | }*/ |
532 | |
533 | //============================================================================== |
534 | //function : HaveMode2d |
535 | //use : V2dActivatedModes |
536 | //============================================================================== |
537 | /*Standard_Boolean HaveMode2d (const Handle(AIS2D_InteractiveObject)& TheAisIO, const Standard_Integer mode) |
538 | { |
539 | // TColStd_ListOfInteger List; |
540 | // TheAIS2DContext()->ActivatedModes (TheAisIO,List); |
541 | // TColStd_ListIteratorOfListOfInteger it; |
542 | Standard_Boolean Found=Standard_False; |
543 | // for (it.Initialize(List); it.More()&&!Found; it.Next() ){ |
544 | // if (it.Value()==mode ) Found=Standard_True; |
545 | // } |
546 | return Found; |
547 | }*/ |
548 | |
549 | //============================================================================== |
550 | //function : V2dActivatedMode |
551 | //purpose : permet d'attribuer a chacune des shapes un mode d'activation |
552 | // (edges,vertex...)qui lui est propre et le mode de selection standard. |
553 | // La fonction s'applique aux shapes selectionnees(current ou selected dans le viewer) |
554 | // Dans le cas ou on veut psser la shape en argument, la fonction n'autorise |
555 | // qu'un nom et qu'un mode. |
556 | //Draw arg : vsetam [ShapeName] mode(0,1,2,3,4,5,6,7) |
557 | //============================================================================== |
558 | //#include <AIS2D_ListIteratorOfListOfInteractive.hxx> |
559 | /* |
560 | static int V2dActivatedMode (Draw_Interpretor& ,Standard_Integer argc,const char** argv) |
561 | { |
562 | Standard_Boolean HaveToSet; |
563 | Standard_Boolean ThereIsName = Standard_False ; |
564 | |
565 | if (!Viewer2dTest::CurrentView().IsNull()) |
566 | { |
567 | if (!strcasecmp(argv[0],"vsetam")) HaveToSet = Standard_True; |
568 | else HaveToSet = Standard_False; |
569 | |
570 | // verification des arguments |
571 | if (HaveToSet) { |
572 | if (argc<2||argc>3) { cout<<" Syntaxe error"<<endl;return 1;} |
573 | if (argc==3) ThereIsName=Standard_True; |
574 | else ThereIsName=Standard_False; |
575 | } |
576 | else { |
577 | // vunsetam |
578 | if (argc>1) {cout<<" Syntaxe error"<<endl;return 1;} |
579 | else { |
580 | cout<<" R.A.Z de tous les modes de selecion"<<endl; |
581 | cout<<" Fermeture du Context local"<<endl; |
582 | TheAIS2DContext()->CloseLocalContext(); |
583 | } |
584 | |
585 | } |
586 | |
587 | |
588 | // IL n'y a aps de nom de shape passe en argument |
589 | if (HaveToSet && !ThereIsName){ |
590 | Standard_Integer aMode=atoi(argv [1]); |
591 | |
592 | char *cmode="???"; |
593 | |
594 | switch (aMode) { |
595 | case 0: cmode = "Shape"; break; |
596 | case 1: cmode = "Vertex"; break; |
597 | case 2: cmode = "Edge"; break; |
598 | case 3: cmode = "Wire"; break; |
599 | case 4: cmode = "Face"; break; |
600 | case 5: cmode = "Shell"; break; |
601 | case 6: cmode = "Solid"; break; |
602 | case 7: cmode = "Compound"; break; |
603 | } |
604 | |
605 | if( !TheAIS2DContext()->HasOpenedContext() ) { |
606 | // il n'y a pas de Context local d'ouvert |
607 | // on en ouvre un et on charge toutes les shapes displayees |
608 | // on load tous les objets displayees et on Activate les objets de la liste |
609 | AIS2D_ListOfInteractive ListOfIO; |
610 | // on sauve dans une AIS2DListOfInteractive tous les objets currents |
611 | if (TheAIS2DContext()->NbCurrents()>0 ){ |
612 | TheAIS2DContext()->UnhilightCurrents(Standard_False); |
613 | |
614 | for (TheAIS2DContext()->InitCurrent(); TheAIS2DContext()->MoreCurrent(); TheAIS2DContext()->NextCurrent() ){ |
615 | ListOfIO.Append(TheAIS2DContext()->Current() ); |
616 | |
617 | } |
618 | } |
619 | |
620 | TheAIS2DContext()->OpenLocalContext(Standard_False); |
621 | Viewer2dTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS2D()); |
622 | while(it.More()){ |
623 | Handle(AIS2D_InteractiveObject) aIO=it.Key1(); |
624 | TheAIS2DContext()->Load(aIO,0,Standard_False); |
625 | it.Next(); |
626 | } |
627 | // traitement des objets qui etaient currents dans le Contexte global |
628 | if (!ListOfIO.IsEmpty() ) { |
629 | // il y avait des objets currents |
630 | AIS2D_ListIteratorOfListOfInteractive iter; |
631 | for (iter.Initialize(ListOfIO); iter.More() ; iter.Next() ) { |
632 | Handle(AIS2D_InteractiveObject) aIO=iter.Value(); |
633 | TheAIS2DContext()->Activate(aIO,aMode); |
634 | cout<<" Mode: "<<cmode<<" ON pour "<<GetMapOfAIS2D().Find1(aIO) <<endl; |
635 | } |
636 | } |
637 | else { |
638 | // On applique le mode a tous les objets displayes |
639 | Viewer2dTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS2D()); |
640 | while(it.More()){ |
641 | Handle(AIS2D_InteractiveObject) aIO=it.Key1(); |
642 | cout<<" Mode: "<<cmode<<" ON pour "<<it.Key2() <<endl; |
643 | TheAIS2DContext()->Activate(aIO,aMode); |
644 | it.Next(); |
645 | } |
646 | } |
647 | |
648 | } |
649 | |
650 | else { |
651 | // un Context local est deja ouvert |
652 | // Traitement des objets du Context local |
653 | if (TheAIS2DContext()->NbSelected()>0 ){ |
654 | TheAIS2DContext()->UnhilightSelected(Standard_False); |
655 | // il y a des objets selected,on les parcourt |
656 | for (TheAIS2DContext()->InitSelected(); TheAIS2DContext()->MoreSelected(); TheAIS2DContext()->NextSelected() ){ |
657 | Handle(AIS2D_InteractiveObject) aIO=TheAIS2DContext()->Interactive(); |
658 | |
659 | |
660 | if (HaveMode2d(aIO,aMode) ) { |
661 | cout<<" Mode: "<<cmode<<" OFF pour "<<GetMapOfAIS2D().Find1(aIO) <<endl; |
662 | TheAIS2DContext()->Deactivate(aIO,aMode); |
663 | } |
664 | else{ |
665 | cout<<" Mode: "<<cmode<<" ON pour "<<GetMapOfAIS2D().Find1(aIO) <<endl; |
666 | TheAIS2DContext()->Activate(aIO,aMode); |
667 | } |
668 | |
669 | } |
670 | } |
671 | else{ |
672 | // il n'y a pas d'objets selected |
673 | // tous les objets diplayes sont traites |
674 | Viewer2dTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS2D()); |
675 | while(it.More()){ |
676 | Handle(AIS2D_InteractiveObject) aIO=it.Key1(); |
677 | if (HaveMode2d(aIO,aMode) ) { |
678 | cout<<" Mode: "<<cmode<<" OFF pour "<<GetMapOfAIS2D().Find1(aIO) <<endl; |
679 | TheAIS2DContext()->Deactivate(aIO,aMode); |
680 | } |
681 | else{ |
682 | cout<<" Mode: "<<cmode<<" ON pour"<<GetMapOfAIS2D().Find1(aIO) <<endl; |
683 | TheAIS2DContext()->Activate(aIO,aMode); |
684 | } |
685 | it.Next(); |
686 | } |
687 | |
688 | } |
689 | } |
690 | } |
691 | else if (HaveToSet && ThereIsName){ |
692 | Standard_Integer aMode=atoi(argv [2]); |
693 | Handle(AIS2D_InteractiveObject) aIO=GetMapOfAIS2D().Find2(argv[1]); |
694 | |
695 | char *cmode="???"; |
696 | |
697 | switch (aMode) { |
698 | case 0: cmode = "Shape"; break; |
699 | case 1: cmode = "Vertex"; break; |
700 | case 2: cmode = "Edge"; break; |
701 | case 3: cmode = "Wire"; break; |
702 | case 4: cmode = "Face"; break; |
703 | case 5: cmode = "Shell"; break; |
704 | case 6: cmode = "Solid"; break; |
705 | case 7: cmode = "Compound"; break; |
706 | } |
707 | |
708 | if( !TheAIS2DContext()->HasOpenedContext() ) { |
709 | TheAIS2DContext()->OpenLocalContext(Standard_False); |
710 | // On charge tous les objets de la map |
711 | Viewer2dTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS2D()); |
712 | while(it.More()){ |
713 | Handle(AIS2D_InteractiveObject) aShape=it.Key1(); |
714 | TheAIS2DContext()->Load(aShape,0,Standard_False); |
715 | it.Next(); |
716 | } |
717 | TheAIS2DContext()->Activate(aIO,aMode); |
718 | cout<<" Mode: "<<cmode<<" ON pour "<<argv[1]<<endl; |
719 | } |
720 | |
721 | else { |
722 | // un Context local est deja ouvert |
723 | if (HaveMode2d(aIO,aMode) ) { |
724 | cout<<" Mode: "<<cmode<<" OFF pour "<<argv[1]<<endl; |
725 | TheAIS2DContext()->Deactivate(aIO,aMode); |
726 | } |
727 | else{ |
728 | cout<<" Mode: "<<cmode<<" ON pour "<<argv[1]<<endl; |
729 | TheAIS2DContext()->Activate(aIO,aMode); |
730 | } |
731 | } |
732 | |
733 | } |
734 | } |
735 | return 0; |
736 | |
737 | } |
738 | */ |
739 | |
740 | //============================================================================== |
741 | //function : v2dtoto |
742 | //============================================================================== |
743 | //#include <tcl.h> |
744 | //static int V2dToto (Draw_Interpretor& , Standard_Integer argc, const char** ) |
745 | //{ |
746 | // cout << " Fonction toto" << endl; |
747 | // Tcl_Interp *interp; |
748 | // int code; |
749 | // if (argc > 1) |
750 | // { |
751 | // cout << " Syntaxe error" << endl; |
752 | // return 0; |
753 | // } |
754 | // interp = Tcl_CreateInterp(); |
755 | // code = Tcl_EvalFile(interp,"/adv_12/DESIGN/k4dev/ege/work/test.tcl"); |
756 | //code= Tcl_Eval(interp,riri) |
757 | // cout << *interp->result << endl; |
758 | // return 0; |
759 | //} |
760 | |
761 | //============================================================================== |
762 | // function : WhoAmI |
763 | // user : vState |
764 | //============================================================================== |
765 | /*void WhoAmI (const Handle(AIS2D_InteractiveObject )& theShape ) { |
766 | |
767 | // AIS2D_Datum |
768 | if (theShape->Type()==AIS2D_KOI_Datum) { |
769 | if (theShape->Signature()==3 ) { cout<<" AIS2D_Trihedron"; } |
770 | else if (theShape->Signature()==2 ) { cout<<" AIS2D_Axis"; } |
771 | else if (theShape->Signature()==6 ) { cout<<" AIS2D_Circle"; } |
772 | else if (theShape->Signature()==5 ) { cout<<" AIS2D_Line"; } |
773 | else if (theShape->Signature()==7 ) { cout<<" AIS2D_Plane"; } |
774 | else if (theShape->Signature()==1 ) { cout<<" AIS2D_Point"; } |
775 | else if (theShape->Signature()==4 ) { cout<<" AIS2D_PlaneTrihedron"; } |
776 | } |
777 | // AIS2D_ProjShape |
778 | else if (theShape->Type()==AIS2D_KOI_Shape && theShape->Signature()==0 ) { cout<<" AIS2D_ProjShape"; } |
779 | // AIS2D_Dimentions et AIS2D_Relations |
780 | else if (theShape->Type()==AIS2D_KOI_Relation) { |
781 | Handle(AIS2D_Relation) TheShape= ((*(Handle(AIS2D_Relation)*)&theShape)); |
782 | |
783 | if (TheShape->KindOfDimension()==AIS2D_KOD_PLANEANGLE) {cout<<" AIS2D_AngleDimension";} |
784 | else if (TheShape->KindOfDimension()==AIS2D_KOD_LENGTH ) {cout<<" AIS2D_Chamf2/3dDimension/AIS2D_LengthDimension "; } |
785 | else if (TheShape->KindOfDimension()==AIS2D_KOD_DIAMETER ) {cout<<" AIS2D_DiameterDimension ";} |
786 | else if (TheShape->KindOfDimension()==AIS2D_KOD_ELLIPSERADIUS ) {cout<<" AIS2D_EllipseRadiusDimension ";} |
787 | //else if (TheShape->KindOfDimension()==AIS2D_KOD_FILLETRADIUS ) {cout<<" AIS2D_FilletRadiusDimension "<<endl;} |
788 | else if (TheShape->KindOfDimension()==AIS2D_KOD_OFFSET ) {cout<<" AIS2D_OffsetDimension ";} |
789 | else if (TheShape->KindOfDimension()==AIS2D_KOD_RADIUS ) {cout<<" AIS2D_RadiusDimension ";} |
790 | // AIS2D no repertorie. |
791 | else {cout<<" Type Unknown.";} |
792 | } |
793 | }*/ |
794 | |
795 | //============================================================================== |
796 | //function : V2dState |
797 | //purpose : |
798 | //Draw arg : v2dstate [nameA] ... [nameN] |
799 | //============================================================================== |
800 | /*static int V2dState (Draw_Interpretor& , Standard_Integer argc, const char** argv) |
801 | { |
802 | Standard_Boolean ThereIsCurrent = Standard_False; |
803 | Standard_Boolean ThereIsArguments = Standard_False; |
804 | TheAIS2DContext()->CloseAllContext(); |
805 | if (argc >= 2 ) |
806 | { |
807 | ThereIsArguments = Standard_True; |
808 | } |
809 | // if (TheAIS2DContext()->NbCurrents()>0 ) { |
810 | // ThereIsCurrent=Standard_True; |
811 | // } |
812 | |
813 | if (ThereIsArguments) |
814 | { |
815 | for (int cpt = 1; cpt < argc; cpt++) |
816 | { |
817 | // Verification que lq piece est bien bindee. |
818 | if (GetMapOfAIS2D().IsBound2(argv[cpt])) |
819 | { |
820 | Handle(AIS2D_InteractiveObject) theShape = GetMapOfAIS2D().Find2(argv[cpt]); |
821 | cout << argv[cpt]; |
822 | // WhoAmI(theShape); |
823 | if (TheAIS2DContext()->IsDisplayed(theShape)) |
824 | { |
825 | cout << " Displayed" << endl; |
826 | } |
827 | else |
828 | { |
829 | cout << " Not Displayed" << endl; |
830 | } |
831 | } |
832 | else |
833 | { |
834 | cout << "vstate error: Shape " << cpt << " doesn't exist;" << endl; |
835 | return 1; |
836 | } |
837 | } |
838 | } |
839 | else if (ThereIsCurrent) |
840 | { |
841 | for (TheAIS2DContext() -> InitCurrent() ; TheAIS2DContext() -> MoreCurrent() ; TheAIS2DContext() ->NextCurrent() ) |
842 | { |
843 | Handle(AIS2D_InteractiveObject) theShape=TheAIS2DContext()->Current(); |
844 | cout<<GetMapOfAIS2D().Find1(theShape);WhoAmI(theShape ); |
845 | if (TheAIS2DContext()->IsDisplayed(theShape) ) { |
846 | cout<<" Displayed"<<endl; |
847 | } |
848 | else { |
849 | cout<<" Not Displayed"<<endl; |
850 | } |
851 | } |
852 | } |
853 | else |
854 | { |
855 | Viewer2dTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS2D()); |
856 | while (it.More()) |
857 | { |
858 | Handle(AIS2D_InteractiveObject) theShape = it.Key1(); |
859 | cout << it.Key2(); |
860 | // WhoAmI(theShape); |
861 | if (TheAIS2DContext()->IsDisplayed(theShape)) |
862 | { |
863 | cout << " Displayed" << endl; |
864 | } |
865 | else |
866 | { |
867 | cout << " Not Displayed" << endl; |
868 | } |
869 | it.Next(); |
870 | } |
871 | } |
872 | |
873 | return 0; |
874 | }*/ |
875 | |
876 | //======================================================================= |
877 | //function : V2dPickShape |
878 | //purpose : |
879 | //======================================================================= |
880 | /*static int V2dPickShape (Draw_Interpretor& , Standard_Integer argc, const char** argv) |
881 | { |
882 | TopoDS_Shape PickSh; |
883 | TopAbs_ShapeEnum theType = TopAbs_COMPOUND; |
884 | |
885 | if (argc == 1) theType = TopAbs_SHAPE; |
886 | else |
887 | { |
888 | if (!strcasecmp(argv[1],"V" )) theType = TopAbs_VERTEX; |
889 | else if (!strcasecmp(argv[1],"E" )) theType = TopAbs_EDGE; |
890 | else if (!strcasecmp(argv[1],"W" )) theType = TopAbs_WIRE; |
891 | else if (!strcasecmp(argv[1],"F" )) theType = TopAbs_FACE; |
892 | else if (!strcasecmp(argv[1],"SHAPE" )) theType = TopAbs_SHAPE; |
893 | else if (!strcasecmp(argv[1],"SHELL" )) theType = TopAbs_SHELL; |
894 | else if (!strcasecmp(argv[1],"SOLID" )) theType = TopAbs_SOLID; |
895 | } |
896 | |
897 | static Standard_Integer nbOfSub[8] = {0,0,0,0,0,0,0,0}; |
898 | static TCollection_AsciiString nameType[8] = {"COMPS","SOL","SHE","F","W","E","V","SHAP"}; |
899 | |
900 | TCollection_AsciiString name; |
901 | |
902 | Standard_Integer NbToPick = argc>2 ? argc-2 : 1; |
903 | if (NbToPick == 1) |
904 | { |
905 | PickSh = Viewer2dTest::PickShape(theType); |
906 | |
907 | if (PickSh.IsNull()) return 1; |
908 | if (argc > 2) |
909 | { |
910 | name += argv[2]; |
911 | } |
912 | else |
913 | { |
914 | if (!PickSh.IsNull()) |
915 | { |
916 | nbOfSub[Standard_Integer(theType)]++; |
917 | name += "Picked_"; |
918 | name += nameType[Standard_Integer(theType)]; |
919 | TCollection_AsciiString indxstring(nbOfSub[Standard_Integer(theType)]); |
920 | name +="_"; |
921 | name+=indxstring; |
922 | } |
923 | } |
924 | // si on avait une petite methode pour voir si la shape |
925 | // est deja dans la Double map, ca eviterait de creer.... |
926 | DBRep::Set(name.ToCString(),PickSh); |
927 | |
928 | Handle(AIS2D_ProjShape) newsh = new AIS2D_ProjShape(); |
929 | newsh->Add(PickSh); |
930 | GetMapOfAIS2D().Bind(newsh, name); |
931 | TheAIS2DContext()->Display(newsh); |
932 | cout << "Nom de la shape pickee : " << name << endl; |
933 | } |
934 | |
935 | // Plusieurs objets a picker, vite vite vite.... |
936 | // |
937 | else |
938 | { |
939 | Standard_Boolean autonaming = !strcasecmp(argv[2],"."); |
940 | Handle(TopTools_HArray1OfShape) arr = new TopTools_HArray1OfShape(1,NbToPick); |
941 | if (Viewer2dTest::PickShapes(theType,arr)) |
942 | { |
943 | for (Standard_Integer i = 1; i <= NbToPick; i++) |
944 | { |
945 | PickSh = arr->Value(i); |
946 | if (!PickSh.IsNull()) |
947 | { |
948 | if (autonaming) |
949 | { |
950 | nbOfSub[Standard_Integer(theType)]++; |
951 | name.Clear(); |
952 | name += "Picked_"; |
953 | name += nameType[Standard_Integer(theType)]; |
954 | TCollection_AsciiString indxstring (nbOfSub[Standard_Integer(theType)]); |
955 | name +="_"; |
956 | name+=indxstring; |
957 | } |
958 | } |
959 | else |
960 | name = argv[1+i]; |
961 | |
962 | DBRep::Set(name.ToCString(),PickSh); |
963 | Handle(AIS2D_ProjShape) newsh = new AIS2D_ProjShape(); |
964 | newsh->Add(PickSh); |
965 | GetMapOfAIS2D().Bind(newsh, name); |
966 | cout << "display of picke shape #" << i << " - nom : " << name << endl; |
967 | TheAIS2DContext()->Display(newsh); |
968 | } |
969 | } |
970 | } |
971 | |
972 | return 0; |
973 | }*/ |
974 | |
975 | //======================================================================= |
976 | //function : V2dIOTypes |
977 | //purpose : list of known objects |
978 | //======================================================================= |
979 | /*static int V2dIOTypes (Draw_Interpretor& , Standard_Integer , const char** ) |
980 | { |
981 | // 1234567890 12345678901234567 123456789 |
982 | TCollection_AsciiString Colum [3] = {"Standard Types","Type Of Object","Signature"}; |
983 | TCollection_AsciiString BlankLine(64, '_'); |
984 | Standard_Integer i; |
985 | |
986 | cout << "/n" << BlankLine << endl; |
987 | |
988 | for (i = 0; i <= 2; i++) Colum[i].Center(20,' '); |
989 | for (i = 0; i <= 2; i++) cout << "|" << Colum[i]; |
990 | cout << "|" << endl; |
991 | |
992 | cout << BlankLine << endl; |
993 | |
994 | // TCollection_AsciiString thetypes[5]={"Datum","Shape","Object","Relation","None"}; |
995 | char ** names = GetTypeNames2d(); |
996 | |
997 | TCollection_AsciiString curstring; |
998 | TCollection_AsciiString curcolum[3]; |
999 | |
1000 | // les objets de type Datum.. |
1001 | curcolum[1] += "Datum"; |
1002 | for (i = 0; i <= 6; i++) |
1003 | { |
1004 | curcolum[0].Clear(); |
1005 | curcolum[0] += names[i]; |
1006 | |
1007 | curcolum[2].Clear(); |
1008 | curcolum[2]+=TCollection_AsciiString(i+1); |
1009 | |
1010 | for (Standard_Integer j = 0; j <= 2; j++) |
1011 | { |
1012 | curcolum[j].Center(20,' '); |
1013 | cout << "|" << curcolum[j]; |
1014 | } |
1015 | cout << "|" << endl; |
1016 | } |
1017 | cout << BlankLine << endl; |
1018 | |
1019 | // les objets de type shape |
1020 | curcolum[1].Clear(); |
1021 | curcolum[1] += "Shape"; |
1022 | curcolum[1].Center(20,' '); |
1023 | |
1024 | for (i = 0; i <= 2; i++) |
1025 | { |
1026 | curcolum[0].Clear(); |
1027 | curcolum[0] += names[7+i]; |
1028 | curcolum[2].Clear(); |
1029 | curcolum[2] += TCollection_AsciiString(i); |
1030 | |
1031 | for (Standard_Integer j = 0; j <= 2; j++) |
1032 | { |
1033 | curcolum[j].Center(20,' '); |
1034 | cout << "|" << curcolum[j]; |
1035 | } |
1036 | cout << "|" << endl; |
1037 | } |
1038 | cout << BlankLine << endl; |
1039 | // les IO de type objet... |
1040 | curcolum[1].Clear(); |
1041 | curcolum[1] += "Object"; |
1042 | curcolum[1].Center(20,' '); |
1043 | for (i = 0;i <= 1; i++) |
1044 | { |
1045 | curcolum[0].Clear(); |
1046 | curcolum[0] += names[10+i]; |
1047 | curcolum[2].Clear(); |
1048 | curcolum[2] += TCollection_AsciiString(i); |
1049 | |
1050 | for (Standard_Integer j = 0; j <= 2; j++) |
1051 | { |
1052 | curcolum[j].Center(20,' '); |
1053 | cout << "|" << curcolum[j]; |
1054 | } |
1055 | cout << "|" << endl; |
1056 | } |
1057 | cout << BlankLine << endl; |
1058 | |
1059 | // les contraintes et dimensions. |
1060 | // pour l'instant on separe juste contraintes et dimensions... |
1061 | // plus tard, on detaillera toutes les sortes... |
1062 | curcolum[1].Clear(); |
1063 | curcolum[1] += "Relation"; |
1064 | curcolum[1].Center(20,' '); |
1065 | for (i = 0; i <= 1; i++) |
1066 | { |
1067 | curcolum[0].Clear(); |
1068 | curcolum[0] += names[12+i]; |
1069 | curcolum[2].Clear(); |
1070 | curcolum[2] += TCollection_AsciiString(i); |
1071 | |
1072 | for (Standard_Integer j = 0; j <= 2; j++) |
1073 | { |
1074 | curcolum[j].Center(20,' '); |
1075 | cout << "|" << curcolum[j]; |
1076 | } |
1077 | cout << "|" << endl; |
1078 | } |
1079 | cout << BlankLine << endl; |
1080 | |
1081 | return 0; |
1082 | }*/ |
1083 | |
1084 | //======================================================================= |
1085 | //function : v2dr |
1086 | //purpose : reading of the shape |
1087 | //======================================================================= |
1088 | /*static Standard_Integer v2dr (Draw_Interpretor& , Standard_Integer , const char** a) |
1089 | { |
1090 | ifstream s (a[1]); |
1091 | BRep_Builder builder; |
1092 | TopoDS_Shape shape; |
1093 | BRepTools::Read(shape, s, builder); |
1094 | DBRep::Set(a[1], shape); |
1095 | Handle(AIS2D_InteractiveContext) Ctx = Viewer2dTest::GetAIS2DContext(); |
1096 | Handle(AIS2D_ProjShape) ais = new AIS2D_ProjShape(); |
1097 | ais->Add(shape); |
1098 | Ctx->Display(ais); |
1099 | return 0; |
1100 | }*/ |
1101 | |
1102 | //============================================================================== |
1103 | //function : Viewer2dTest::GeneralCommands |
1104 | //purpose : Add all the general commands in the Draw_Interpretor |
1105 | //============================================================================== |
1106 | void Viewer2dTest::GeneralCommands (Draw_Interpretor& theCommands) |
1107 | { |
1108 | const char *group = "2D AIS Viewer"; |
1109 | |
1110 | theCommands.Add("v2ddir", |
1111 | "v2ddir - list interactive objects", |
1112 | __FILE__, V2dDebug, group); |
1113 | |
1114 | /* theCommands.Add("v2dsub", |
1115 | "v2dsub 0/1(off/on) [obj] : Subintensity(on/off) of selected objects", |
1116 | __FILE__, V2dSubInt, group); |
1117 | |
1118 | theCommands.Add("v2dardis", |
1119 | "v2dardis : Display active areas", |
1120 | __FILE__, V2dDispAreas, group); |
1121 | |
1122 | theCommands.Add("v2darera", |
1123 | "v2darera : Erase active areas", |
1124 | __FILE__, V2dClearAreas, group); |
1125 | |
1126 | theCommands.Add("v2dsensdis", |
1127 | "v2dsensdis : display active entities", |
1128 | __FILE__, V2dDispSensi, group); |
1129 | |
1130 | theCommands.Add("v2dsensera", |
1131 | "v2dsensera : erase active entities", |
1132 | __FILE__, V2dClearSensi, group); |
1133 | |
1134 | theCommands.Add("v2dperf", |
1135 | "v2dperf ShapeName 1/0(Transfo/Location) 1/0(Primitives sensibles ON/OFF)", |
1136 | __FILE__, V2dPerf, group); |
1137 | |
1138 | theCommands.Add("v2danimation", |
1139 | "v2danimation", |
1140 | __FILE__, V2dAnimation, group); |
1141 | */ |
1142 | /*theCommands.Add("v2dtexscale", |
1143 | "'v2dtexscale NameOfShape ScaleU ScaleV' \n \ |
1144 | or 'vtexscale NameOfShape ScaleUV' \n \ |
1145 | or 'vtexscale NameOfShape' to disable scaling\n", |
1146 | __FILE__,VTexture,group); |
1147 | |
1148 | theCommands.Add("v2dtexorigin", |
1149 | "'v2dtexorigin NameOfShape UOrigin VOrigin' \n \ |
1150 | or 'vtexorigin NameOfShape UVOrigin' \n \ |
1151 | or 'vtexorigin NameOfShape' to disable origin positioning\n", |
1152 | __FILE__,VTexture,group); |
1153 | |
1154 | theCommands.Add("v2dtexrepeat", |
1155 | "'v2dtexrepeat NameOfShape URepeat VRepeat' \n \ |
1156 | or 'vtexrepeat NameOfShape UVRepeat \n \ |
1157 | or 'vtexrepeat NameOfShape' to disable texture repeat \n ", |
1158 | VTexture,group); |
1159 | |
1160 | theCommands.Add("v2dtexdefault", |
1161 | "'v2dtexdefault NameOfShape' to set texture mapping default parameters \n", |
1162 | VTexture,group);*/ |
1163 | |
1164 | // theCommands.Add("v2dsetam", |
1165 | // "v2dsetActivatedModes: vsetam mode(1->7)", |
1166 | // __FILE__,VActivatedMode,group); |
1167 | |
1168 | // theCommands.Add("v2dunsetam", |
1169 | // "v2dunsetActivatedModes: vunsetam", |
1170 | // __FILE__,VActivatedMode,group); |
1171 | |
1172 | /* theCommands.Add("v2dtoto", |
1173 | "v2dtoto", |
1174 | __FILE__, V2dToto, group); |
1175 | |
1176 | theCommands.Add("v2dstate", |
1177 | "vstate [Name1] ... [NameN] : No arg, select currents; no currrent select all", |
1178 | __FILE__,V2dState,group); |
1179 | |
1180 | theCommands.Add("v2dpickshapes", |
1181 | "v2dpickshape subtype(VERTEX,EDGE,WIRE,FACE,SHELL,SOLID) [name1 or .] [name2 or .] [name n or .]", |
1182 | __FILE__, V2dPickShape, group); |
1183 | |
1184 | theCommands.Add("v2dtypes", |
1185 | "v2dtypes : list of known types and signatures in AIS2D - To be Used in vpickobject command for selection with filters", |
1186 | V2dIOTypes,group); |
1187 | |
1188 | theCommands.Add("v2dr", |
1189 | "v2dr : reading of the shape", |
1190 | __FILE__, v2dr, group);*/ |
1191 | } |