b311480e |
1 | // Created on: 2002-05-22 |
2 | // Created by: QA Admin |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
1cd84fee |
16 | #include <QABugs.hxx> |
7fd59977 |
17 | |
91322f44 |
18 | #include <Draw.hxx> |
7fd59977 |
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 | |
31 | static 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) { |
586db386 |
40 | di << "Usage : " << argv[0] << " x y TypeOfMarker(0-12)\n"; |
7fd59977 |
41 | return 1; |
42 | } |
43 | |
44 | Standard_Integer x,y,TypeOfMarker; |
91322f44 |
45 | x = Draw::Atoi(argv[1]); |
46 | y = Draw::Atoi(argv[2]); |
47 | TypeOfMarker = Draw::Atoi(argv[3]); |
7fd59977 |
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()) { |
ee2be2a8 |
106 | Standard_Real X,Y,Z; |
7fd59977 |
107 | aView->ConvertToGrid(x,y,X,Y,Z); |
108 | } else { |
586db386 |
109 | di << "NOT aViewer->GridEcho()\n"; |
7fd59977 |
110 | return 1; |
111 | } |
112 | } else { |
586db386 |
113 | di << "NOT aViewer->IsActive()\n"; |
7fd59977 |
114 | return 1; |
115 | } |
116 | return 0; |
117 | } |
118 | |
1cd84fee |
119 | void QABugs::Commands_6(Draw_Interpretor& theCommands) { |
1365140b |
120 | const char *group = "QABugs"; |
7fd59977 |
121 | |
122 | theCommands.Add ("OCC281", "OCC281 x y TypeOfMarker(0-12)", __FILE__, OCC281bug, group); |
123 | |
124 | return; |
125 | } |