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