0024814: Avoid using explicit names of Handle classes
[occt.git] / src / QABugs / QABugs_4.cxx
1 // Created on: 2002-03-19
2 // Created by: QA Admin
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <QABugs.hxx>
17
18 #include <Draw_Interpretor.hxx>
19 #include <DBRep.hxx>
20 #include <DrawTrSurf.hxx>
21 #include <AIS_InteractiveContext.hxx>
22 #include <ViewerTest.hxx>
23 #include <AIS_Shape.hxx>
24 #include <TopoDS_Shape.hxx>
25
26 #include <BRepPrimAPI_MakeSphere.hxx>
27 #include <Graphic3d_AspectFillArea3d.hxx>
28 #include <AIS_Drawer.hxx>
29 #include <Prs3d_ShadingAspect.hxx>
30
31 //#include <AcisData_AcisModel.hxx>
32 #include <TopTools_HSequenceOfShape.hxx>
33
34 static Standard_Integer BUC60738 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
35 {
36   
37   Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
38   if(aContext.IsNull()) { 
39     di << "use 'vinit' command before " << argv[0] << "\n";
40     return -1;
41   }
42   
43   TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(gp_Pnt(-40,0,0),20).Shape();
44   Handle(AIS_Shape) theAISShape = new AIS_Shape(theSphere);
45
46   //display mode = Shading
47   theAISShape->SetDisplayMode(1);
48
49   //get the drawer
50   Handle(AIS_Drawer) theDrawer = theAISShape->Attributes();
51   Handle(Prs3d_ShadingAspect) theShadingAspect = theDrawer->ShadingAspect();
52   Handle(Graphic3d_AspectFillArea3d) theAspectFillArea3d = theShadingAspect->Aspect();
53
54   //allow to display the edges
55   theAspectFillArea3d->SetEdgeOn();
56   //set the style to Dash
57
58   //but the style is not set to dash : it is always solid
59   theAspectFillArea3d->SetEdgeLineType (Aspect_TOL_DASH); 
60   theAspectFillArea3d->SetEdgeColor(Quantity_Color(Quantity_NOC_GREEN)); 
61   theAspectFillArea3d->SetInteriorStyle(Aspect_IS_EMPTY);
62   theShadingAspect->SetAspect(theAspectFillArea3d);
63   theDrawer->SetShadingAspect(theShadingAspect);
64   theAISShape->SetAttributes(theDrawer);
65
66   aContext->Display(theAISShape);  
67   
68   return 0;
69 }
70
71 void QABugs::Commands_4(Draw_Interpretor& theCommands) {
72   const char *group = "QABugs";
73
74   theCommands.Add("BUC60738","BUC60738",__FILE__,BUC60738,group);
75
76   return;
77 }