0022898: IGES import fails in german environment
[occt.git] / src / QABugs / QABugs_6.cxx
1 // Created on: 2002-05-22
2 // Created by: QA Admin
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
4 //
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.
9 //
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.
12 //
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.
19
20 #include <QABugs.hxx>
21
22 #include <Draw.hxx>
23 #include <Draw_Interpretor.hxx>
24 #include <DBRep.hxx>
25 #include <DrawTrSurf.hxx>
26 #include <AIS_InteractiveContext.hxx>
27 #include <ViewerTest.hxx>
28 #include <AIS_Shape.hxx>
29 #include <TopoDS_Shape.hxx>
30
31 #include <V3d_Viewer.hxx>
32 #include <V3d_View.hxx>
33 #include <Graphic3d_AspectMarker3d.hxx>
34
35 static Standard_Integer OCC281bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
36 {
37   Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
38   if(aContext.IsNull()) 
39     { 
40     cerr << "use 'vinit' command before " << argv[0] << "\n";
41     return -1;
42     }
43   if(argc < 4) {
44     di << "Usage : " << argv[0] << " x y TypeOfMarker(0-12)" << "\n";
45     return 1;
46   }
47
48   Standard_Integer x,y,TypeOfMarker;
49   x = Draw::Atoi(argv[1]);
50   y = Draw::Atoi(argv[2]);
51   TypeOfMarker = Draw::Atoi(argv[3]);
52   if( x <= 0) {
53     di << "Bad value x=" << x << "\n";
54     return 1;
55   }
56   if( y <= 0) {
57     di << "Bad value y=" << y << "\n";
58     return 1;
59   }
60   if( TypeOfMarker < 0 || TypeOfMarker > 12) {
61     di << "Bad value TypeOfMarker=" << TypeOfMarker << "\n";
62     return 1;
63   }
64   Aspect_TypeOfMarker AspectTypeOfMarker( (Aspect_TypeOfMarker) TypeOfMarker);
65   /*
66         enumeration TypeOfMarker is     TOM_POINT,
67                                         TOM_PLUS,
68                                         TOM_STAR,
69                                         TOM_O,
70                                         TOM_X,
71                                         TOM_O_POINT,
72                                         TOM_O_PLUS,
73                                         TOM_O_STAR,
74                                         TOM_O_X,
75                                         TOM_BALL,
76                                         TOM_RING1,
77                                         TOM_RING2,
78                                         TOM_RING3,
79                                         TOM_USERDEFINED 
80         end TypeOfMarker;
81         ---Purpose: Definition of types of markers
82         --
83         --          TOM_POINT   point   .
84         --          TOM_PLUS    plus    +
85         --          TOM_STAR    star    *
86         --          TOM_O       circle  O
87         --          TOM_X       cross   x
88         --          TOM_O_POINT a point in a circle
89         --          TOM_O_PLUS  a plus in a circle
90         --          TOM_O_STAR  a star in a circle
91         --          TOM_O_X     a cross in a circle
92         --          TOM_BALL    a ball with 1 color and different saturations
93         --          TOM_RING1   a large ring
94         --          TOM_RING2   a medium ring
95         --          TOM_RING3   a small ring
96         --          TOM_USERDEFINED     defined by Users
97         --
98         ---Category: Enumerations
99   */
100
101   Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
102   Handle(V3d_View) aView = ViewerTest::CurrentView();
103
104   aViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines);
105   Handle(Graphic3d_AspectMarker3d) GridAsp = new Graphic3d_AspectMarker3d(AspectTypeOfMarker, Quantity_NOC_BLUE1, 10.);
106   aViewer->SetGridEcho(GridAsp);
107
108   if (aViewer->IsActive()) {
109     if (aViewer->GridEcho()) {
110       V3d_Coordinate X,Y,Z;
111       aView->ConvertToGrid(x,y,X,Y,Z);
112     } else {
113       di << "NOT aViewer->GridEcho()" << "\n";
114       return 1;
115     }
116   } else {
117     di << "NOT aViewer->IsActive()" << "\n";
118     return 1;
119   }
120   return 0;
121 }
122
123 void QABugs::Commands_6(Draw_Interpretor& theCommands) {
124   const char *group = "QABugs";
125
126   theCommands.Add ("OCC281", "OCC281 x y TypeOfMarker(0-12)", __FILE__, OCC281bug, group);
127
128   return;
129 }