1 // File: QAMitutoyoUS.cxx
2 // Created: Mon Mar 18 19:04:01 2002
4 // <qa@umnox.nnov.matra-dtv.fr>
7 #include <QAMitutoyoUS.hxx>
9 #include <Draw_Interpretor.hxx>
11 #include <DrawTrSurf.hxx>
12 #include <AIS_InteractiveContext.hxx>
13 #include <ViewerTest.hxx>
14 #include <AIS_Shape.hxx>
15 #include <TopoDS_Shape.hxx>
19 #include <Geom_RectangularTrimmedSurface.hxx>
20 #include <BRepBuilderAPI_MakeFace.hxx>
21 #include <GC_MakeTrimmedCone.hxx>
23 static Standard_Integer BUC60857 (Draw_Interpretor& di, Standard_Integer /*argc*/,const char ** argv)
26 double R1=8, R2=16, H1=20, H2=40, angle;
27 gp_Pnt P0(0,0,0), P1(0,0,20), P2(0,0,45);
30 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
31 if(aContext.IsNull()) {
32 di << "Use vinit command before " << argv[0] << "\n";
36 Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
37 TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
38 DBRep::Set("BUC60857_BLUE",myshape);
39 Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
40 aContext->Display(ais1);
41 aContext->SetColor(ais1, Quantity_NOC_BLUE1);
43 Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2, R1, 0).Value();
44 TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape();
45 DBRep::Set("BUC60857_RED",myshape2);
46 Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
47 aContext->Display(ais2);
48 aContext->SetColor(ais2, Quantity_NOC_RED);
50 Handle(Geom_RectangularTrimmedSurface) S3 = GC_MakeTrimmedCone (P1, P2, R2, R1).Value();
51 TopoDS_Shape myshape3 = BRepBuilderAPI_MakeFace(S3, Precision::Confusion()).Shape();
52 DBRep::Set("BUC60857_GREEN",myshape3);
53 Handle(AIS_Shape) ais3 = new AIS_Shape(myshape3);
54 aContext->Display(ais3);
55 aContext->SetColor(ais3, Quantity_NOC_GREEN);
60 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
61 #include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
62 #include <SelectMgr_Selection.hxx>
63 #include <StdSelect_BRepOwner.hxx>
64 #include <SelectBasics_SensitiveEntity.hxx>
66 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
68 Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
71 static Standard_Integer OCC137 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
73 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
74 if(aContext.IsNull()) {
75 di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
78 if ( argc < 2 || argc > 3) {
79 di << "ERROR : Usage : " << argv[0] << " highlight_mode [shape]" << "\n";
83 ViewerTest_DoubleMapOfInteractiveAndName aMap ;
85 aMap.Assign(GetMapOfAIS());
87 ViewerTest_DoubleMapOfInteractiveAndName& aMap1 = GetMapOfAIS();
88 TCollection_AsciiString aName(argv[2]);
89 Handle(AIS_InteractiveObject) AISObj;
90 if(!aMap1.IsBound2(aName)) {
91 di << "Use 'vdisplay' before" << "\n";
94 AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap1.Find2(aName));
96 di << argv[2] << " : No interactive object" << "\n";
99 aMap.Bind(AISObj,aName);
102 ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
103 while ( it.More() ) {
104 Handle(AIS_InteractiveObject) AISObj = Handle(AIS_InteractiveObject)::DownCast(it.Key1());
105 AISObj->SetHilightMode(atoi(argv[1]));
106 if(AISObj->HasSelection(4)) {
107 //Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
108 const Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
109 if(!aSelection.IsNull()) {
110 for(aSelection->Init();aSelection->More();aSelection->Next()) {
111 Handle(StdSelect_BRepOwner) aO = Handle(StdSelect_BRepOwner)::DownCast(aSelection->Sensitive()->OwnerId());
112 aO->SetHilightMode(atoi(argv[1]));
122 static Standard_Integer OCC137_z (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
124 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
125 if(aContext.IsNull()) {
126 di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
129 if ( argc != 1 && argc != 2) {
130 di << "ERROR : Usage : " << argv[0] << " [ZDetection_mode]" << "\n";
133 aContext->SetZDetection(((argc == 1 || (argc == 2 && atoi(argv[1]) == 1)) ? Standard_True : Standard_False));
137 void QAMitutoyoUS::Commands(Draw_Interpretor& theCommands) {
138 char *group = "QAMitutoyoUS";
140 theCommands.Add ("BUC60857", "BUC60857", __FILE__, BUC60857, group);
141 theCommands.Add("OCC137","OCC137 mode [shape]",__FILE__,OCC137,group);
142 theCommands.Add("OCC137_z","OCC137_z [ZDetection_mode]",__FILE__,OCC137_z,group);