1 // Created on: 2002-03-18
2 // Created by: QA Admin
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
24 #include <Draw_Interpretor.hxx>
26 #include <DrawTrSurf.hxx>
27 #include <AIS_InteractiveContext.hxx>
28 #include <ViewerTest.hxx>
29 #include <AIS_Shape.hxx>
30 #include <TopoDS_Shape.hxx>
34 #include <Geom_RectangularTrimmedSurface.hxx>
35 #include <BRepBuilderAPI_MakeFace.hxx>
36 #include <GC_MakeTrimmedCone.hxx>
38 static Standard_Integer BUC60857 (Draw_Interpretor& di, Standard_Integer /*argc*/,const char ** argv)
41 double R1=8, R2=16, H1=20, H2=40, angle;
42 gp_Pnt P0(0,0,0), P1(0,0,20), P2(0,0,45);
45 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
46 if(aContext.IsNull()) {
47 di << "Use vinit command before " << argv[0] << "\n";
51 Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
52 TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
53 DBRep::Set("BUC60857_BLUE",myshape);
54 Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
55 aContext->Display(ais1);
56 aContext->SetColor(ais1, Quantity_NOC_BLUE1);
58 Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2, R1, 0).Value();
59 TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape();
60 DBRep::Set("BUC60857_RED",myshape2);
61 Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
62 aContext->Display(ais2);
63 aContext->SetColor(ais2, Quantity_NOC_RED);
65 Handle(Geom_RectangularTrimmedSurface) S3 = GC_MakeTrimmedCone (P1, P2, R2, R1).Value();
66 TopoDS_Shape myshape3 = BRepBuilderAPI_MakeFace(S3, Precision::Confusion()).Shape();
67 DBRep::Set("BUC60857_GREEN",myshape3);
68 Handle(AIS_Shape) ais3 = new AIS_Shape(myshape3);
69 aContext->Display(ais3);
70 aContext->SetColor(ais3, Quantity_NOC_GREEN);
75 #include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
76 #include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
77 #include <SelectMgr_Selection.hxx>
78 #include <StdSelect_BRepOwner.hxx>
79 #include <SelectBasics_SensitiveEntity.hxx>
81 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
83 Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
86 static Standard_Integer OCC137 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
88 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
89 if(aContext.IsNull()) {
90 di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
93 if ( argc < 2 || argc > 3) {
94 di << "ERROR : Usage : " << argv[0] << " highlight_mode [shape]" << "\n";
98 ViewerTest_DoubleMapOfInteractiveAndName aMap ;
100 aMap.Assign(GetMapOfAIS());
102 ViewerTest_DoubleMapOfInteractiveAndName& aMap1 = GetMapOfAIS();
103 TCollection_AsciiString aName(argv[2]);
104 Handle(AIS_InteractiveObject) AISObj;
105 if(!aMap1.IsBound2(aName)) {
106 di << "Use 'vdisplay' before" << "\n";
109 AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap1.Find2(aName));
111 di << argv[2] << " : No interactive object" << "\n";
114 aMap.Bind(AISObj,aName);
117 ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
118 while ( it.More() ) {
119 Handle(AIS_InteractiveObject) AISObj = Handle(AIS_InteractiveObject)::DownCast(it.Key1());
120 AISObj->SetHilightMode(atoi(argv[1]));
121 if(AISObj->HasSelection(4)) {
122 //Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
123 const Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
124 if(!aSelection.IsNull()) {
125 for(aSelection->Init();aSelection->More();aSelection->Next()) {
126 Handle(StdSelect_BRepOwner) aO = Handle(StdSelect_BRepOwner)::DownCast(aSelection->Sensitive()->OwnerId());
127 aO->SetHilightMode(atoi(argv[1]));
137 static Standard_Integer OCC137_z (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
139 Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
140 if(aContext.IsNull()) {
141 di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
144 if ( argc != 1 && argc != 2) {
145 di << "ERROR : Usage : " << argv[0] << " [ZDetection_mode]" << "\n";
148 aContext->SetZDetection(((argc == 1 || (argc == 2 && atoi(argv[1]) == 1)) ? Standard_True : Standard_False));
152 void QABugs::Commands_9(Draw_Interpretor& theCommands) {
153 char *group = "QABugs";
155 theCommands.Add ("BUC60857", "BUC60857", __FILE__, BUC60857, group);
156 theCommands.Add("OCC137","OCC137 mode [shape]",__FILE__,OCC137,group);
157 theCommands.Add("OCC137_z","OCC137_z [ZDetection_mode]",__FILE__,OCC137_z,group);