0023885: Inclusion of X11 header should be protected with macro
[occt.git] / src / QADraw / QADraw.cxx
CommitLineData
b311480e 1// Created on: 2002-02-04
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
7fd59977 20#include <QADraw.hxx>
21#include <QADraw_DataMapOfAsciiStringOfAddress.hxx>
22#include <Draw_Interpretor.hxx>
692613e5 23#include <Image_AlienPixMap.hxx>
7fd59977 24#include <V3d_View.hxx>
25#include <ViewerTest.hxx>
26#include <ViewerTest_EventManager.hxx>
27#include <TColStd_StackOfInteger.hxx>
28#include <TColStd_ListOfInteger.hxx>
29#include <TColStd_ListIteratorOfListOfInteger.hxx>
30#include <TColStd_HSequenceOfReal.hxx>
31#include <AIS_InteractiveContext.hxx>
91322f44 32#include <Draw.hxx>
7fd59977 33#include <Draw_Window.hxx>
34#include <Draw_Viewer.hxx>
35#include <Aspect_WindowDriver.hxx>
36#include <stdio.h>
dc3fe572 37#include <Aspect_DisplayConnection.hxx>
38#include <Graphic3d.hxx>
87225ffd 39#include <Aspect_Window.hxx>
7fd59977 40
87225ffd 41#if defined(_WIN32) || defined(__WIN32__)
42# include <windows.h>
43# include <io.h>
7fd59977 44#else
87225ffd 45# include <unistd.h>
7fd59977 46#endif
47
48#include <tcl.h>
49
50#if ! defined(STDOUT_FILENO)
51#define STDOUT_FILENO fileno(stdout)
52#endif
53
54// mkv 15.07.03
55#if ! defined(STDERR_FILENO)
56#define STDERR_FILENO fileno(stderr)
57#endif
58
59Draw_Interpretor *thePCommands = NULL;
60
61#if ! defined(WNT)
62//extern Draw_Interpretor theCommands;
63
64extern void (*Draw_BeforeCommand)();
65extern void (*Draw_AfterCommand)(Standard_Integer);
66#else
67//Standard_EXPORT Draw_Interpretor theCommands;
68
69Standard_EXPORT void (*Draw_BeforeCommand)();
70Standard_EXPORT void (*Draw_AfterCommand)(Standard_Integer);
71#endif
72
73
74#include <Draw_PluginMacro.hxx>
75
76// avoid warnings on 'extern "C"' functions returning C++ classes
77#ifdef WNT
78#pragma warning(4:4190)
79#endif
80
81
82int st_err = 0;
83
84void (*Draw_BeforeCommand_old)();
85void (*Draw_AfterCommand_old)(Standard_Integer);
86
87static Standard_Boolean should_be_printed = Standard_True;
88
89static Standard_Boolean shouldDUP() {
90 // MKV 30.03.05
91#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
92 const Standard_Character * adup = Tcl_GetVar(thePCommands->Interp(),
93 "QA_DUP",TCL_GLOBAL_ONLY);
94#else
95 Standard_Character * adup = Tcl_GetVar(thePCommands->Interp(),
96 "QA_DUP",TCL_GLOBAL_ONLY);
97#endif
98 Standard_Integer aDUP=1;
91322f44 99 if((adup != NULL) && (Draw::Atof(adup) == 0)) {
7fd59977 100 aDUP = 0;
101 }
102
103 return aDUP;
104}
105
106static void before() {
107 should_be_printed = Standard_True;
108 if(Draw_BeforeCommand_old) (*Draw_BeforeCommand_old) ();
109}
110
111static void after(Standard_Integer a)
112{
113 if(Draw_AfterCommand_old) (*Draw_AfterCommand_old) (a);
114 if(!should_be_printed) {
115// Tcl_ResetResult(theCommands.Interp());
116 }
117}
118
119static QADraw_DataMapOfAsciiStringOfAddress stFuncMap;
120
121 // MKV 30.03.05
122#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
123static Standard_Integer (*CommandCmd_Old)
124(ClientData clientData, Tcl_Interp *interp,
125 Standard_Integer argc, const char* argv[]) = NULL;
126#else
127static Standard_Integer (*CommandCmd_Old)
128(ClientData clientData, Tcl_Interp *interp,
129 Standard_Integer argc, char* argv[]) = NULL;
130#endif
131
132 // MKV 30.03.05
133#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
134static Standard_Integer CommandCmd
135(ClientData clientData, Tcl_Interp *interp,
136 Standard_Integer argc, const char* argv[])
137#else
138static Standard_Integer CommandCmd
139(ClientData clientData, Tcl_Interp *interp,
140 Standard_Integer argc, char* argv[])
141#endif
142{
143 Standard_Integer old_out = 0;
144 Standard_Integer old_err = 0;
145 Standard_Integer fd_out = 0;
146 Standard_Integer fd_err = 0;
147
148 FILE * aFile_out = NULL;
149 FILE * aFile_err = NULL;
150
151 char *nameo = NULL;
152 char *namee = NULL;
153#ifdef WNT
154 if(strlen(getenv("TEMP")) == 0) {
155 cerr << "The TEMP variable is not set." << endl;
156 aFile_out = tmpfile();
157 aFile_err = tmpfile();
158 } else {
159 nameo = _tempnam(getenv("TEMP"),"tmpo");
160 namee = _tempnam(getenv("TEMP"),"tmpe");
161 aFile_out=fopen(nameo, "w+");
162 aFile_err=fopen(namee, "w+");
163 }
164#else
165 aFile_out = tmpfile();
166 aFile_err = tmpfile();
167#endif
168 fd_out = fileno(aFile_out);
169 fd_err = fileno(aFile_err);
170 if(fd_out !=-1 && fd_err !=-1) {
171 old_err = dup(STDERR_FILENO);
172 old_out = dup(STDOUT_FILENO);
173 dup2(fd_err,STDERR_FILENO);
174 dup2(fd_out,STDOUT_FILENO);
175 } else
176 cout << "Faulty : Can not create temporary file." << endl;
177
178 Standard_Integer clen = sizeof(Standard_Character);
179
180 Standard_Character * QA = getenv("QA_print_command");
181 if((QA != NULL) && (!strcmp(QA,"1"))) {
182 for(Standard_Integer i=0;i<argc;i++) {
183 write(st_err,argv[i],clen*strlen(argv[i]));
184 write(st_err," ",clen);
185 }
186 write(st_err,"\n",clen);
187 }
188
189 // MKV 30.03.05
190#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
191 TCollection_AsciiString aName((char *) argv[0]);
192#else
193 TCollection_AsciiString aName(argv[0]);
194#endif
195
196 Standard_Integer res = 0;
197
198 if(stFuncMap.IsBound(aName)) {
199 // MKV 30.03.05
200#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
201 CommandCmd_Old = (int(*)(void*, Tcl_Interp*, int, const char**)) stFuncMap((char *) argv[0]);
202#else
203 CommandCmd_Old = (int(*)(void*, Tcl_Interp*, int, char**)) stFuncMap(argv[0]);
204#endif
205 res = (*CommandCmd_Old) (clientData,interp,argc,argv);
206 }
207
208 fflush(stderr);
209 fflush(stdout);
210 close(STDERR_FILENO);
211 close(STDOUT_FILENO);
212 dup2(old_err,STDERR_FILENO);
213 dup2(old_out,STDOUT_FILENO);
214 close(old_err);
215 close(old_out);
216
217 Standard_Character buf[256];
218 Standard_Integer len = 0;
219
220 rewind(aFile_err);
221 while((len = read(fd_err,buf,clen*255)/clen) > 0) {
222 buf[len]='\0';
223 if(shouldDUP()) {
224 (*thePCommands) << buf;
225 } else {
226 write(st_err,buf,clen*len);
227 }
228 }
229 close(fd_err);
230
231 rewind(aFile_out);
232 buf[0] = '\0';
233 len = 0;
234 while((len = read(fd_out,buf,clen*255)/clen) > 0) {
235 buf[len]='\0';
236 if(shouldDUP()) {
237 (*thePCommands) << buf;
238 } else {
239 write(st_err,buf,clen*len);
240 }
241 }
242 close(fd_out);
243
244 if(shouldDUP()) {
245 Standard_Character *Result = (Standard_Character *)thePCommands->Result();
246 if(Result[0] != '\0') {
247 Standard_Integer pos = 0;
248 Standard_Integer rlen = strlen(Result);
249 while(pos < rlen) {
250 Standard_Integer nb = 256;
251 if((rlen - pos) <= 256) {
252 nb = rlen - pos;
253 }
254 write(st_err,Result+pos,nb*clen);
255 pos += nb;
256 }
257 write(st_err,"\n",clen);
258 should_be_printed = Standard_False ;
259 }
260 } //else {
261 if(nameo)
262 free(nameo);
263 if(namee)
264 free(namee);
265 return res;
266}
267
268static Standard_Integer QARebuild (Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
269{
270
271 Tcl_CmdInfo *infoPtr = new Tcl_CmdInfo;
272
273 if(!strcmp(a[0],a[1]))
274 return 0;
275
276 char* var_a = (char*)a[1];
277 Standard_Integer res = Tcl_GetCommandInfo(di.Interp(),var_a,infoPtr);
278 if(res && (infoPtr->proc != &CommandCmd)) {
279 TCollection_AsciiString aName(var_a);
280 if (!stFuncMap.IsBound(aName)) {
281 stFuncMap.Bind(aName, (Standard_Address) infoPtr->proc);
282
283 infoPtr->proc = &CommandCmd;
284#if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 3
285 infoPtr->isNativeObjectProc = 0;
286 infoPtr->objProc = NULL;
287#endif
288 Tcl_SetCommandInfo(di.Interp(),var_a,infoPtr);
289 }
290 }
291
292 return 0;
293}
294
692613e5 295Handle(TColStd_HSequenceOfReal) GetColorOfPixel (const Image_PixMap& theImage,
7fd59977 296 const Standard_Integer theCoordinateX,
297 const Standard_Integer theCoordinateY,
298 const Standard_Integer theRadius)
299{
300 Handle(TColStd_HSequenceOfReal) aSeq = new TColStd_HSequenceOfReal();
692613e5 301 if (theImage.IsEmpty()) {
7fd59977 302 std::cerr << "The image is null.\n";
303 return aSeq;
304 }
692613e5 305 Standard_Integer aWidth = (Standard_Integer )theImage.SizeX();
306 Standard_Integer anHeight = (Standard_Integer )theImage.SizeY();
7fd59977 307
308 Quantity_Color aColorTmp;
309 for (Standard_Integer anXIter = theCoordinateX - theRadius;
310 anXIter <= theCoordinateX + theRadius; ++anXIter)
311 {
312 if (anXIter < 0 || anXIter >= aWidth)
313 {
314 continue;
315 }
316 for (Standard_Integer anYIter = theCoordinateY - theRadius;
317 anYIter <= theCoordinateY + theRadius; ++anYIter)
318 {
319 if (anYIter < 0 || anYIter >= anHeight)
320 {
321 continue;
322 }
323 // Image_PixMap stores image upside-down in memory!
692613e5 324 aColorTmp = theImage.PixelColor (anXIter, anYIter);
7fd59977 325 aSeq->Append (aColorTmp.Red());
326 aSeq->Append (aColorTmp.Green());
327 aSeq->Append (aColorTmp.Blue());
328 }
329 }
330 return aSeq;
331}
332
792c785c 333static Standard_Integer QAAISGetPixelColor (Draw_Interpretor& theDi,
334 Standard_Integer theArgsNb,
335 const char** theArgs)
7fd59977 336{
128cc8df 337 if (theArgsNb != 3 && theArgsNb != 6)
338 {
339 theDi << "Usage : " << theArgs[0] << " coordinate_X coordinate_Y [color_R color_G color_B]" << "\n";
340 return 1; // TCL_ERROR
341 }
342
343 Handle(V3d_View) aView3d = ViewerTest::CurrentView();
344 if (aView3d.IsNull())
345 {
346 theDi << "You must initialize AISViewer before this command.\n";
347 return 1; // TCL_ERROR
348 }
349
350 const Handle(Aspect_Window) anAISWindow = aView3d->Window();
351 Standard_Integer aWindowSizeX = 0;
352 Standard_Integer aWindowSizeY = 0;
353 anAISWindow->Size (aWindowSizeX, aWindowSizeY);
354
355 Standard_Integer anArgIter = 1;
91322f44 356 const Standard_Integer aPickCoordX = Draw::Atoi (theArgs[anArgIter++]);
357 const Standard_Integer aPickCoordY = Draw::Atoi (theArgs[anArgIter++]);
128cc8df 358 const Standard_Integer aRadius = (theArgsNb == 3) ? 0 : 1;
359
360 Image_ColorRGBF aColorInput = {{ 0.0f, 0.0f, 0.0f }};
361 if (theArgsNb == 6)
362 {
91322f44 363 aColorInput.r() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]);
364 aColorInput.g() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]);
365 aColorInput.b() = (Standard_ShortReal )Draw::Atof (theArgs[anArgIter++]);
128cc8df 366 }
367
368 Image_PixMap anImage;
369 aView3d->ToPixMap (anImage, aWindowSizeX, aWindowSizeY);
370 const Handle(TColStd_HSequenceOfReal) aSeq = GetColorOfPixel (anImage, aPickCoordX, aPickCoordY, aRadius);
371 cout << "Length = " << aSeq->Length() << endl;
372
373 Image_ColorRGBF aColorPicked = {{ 0.0f, 0.0f, 0.0f }};
374 Standard_Boolean isNotEqual = Standard_True;
375 for (Standard_Integer i = 1; i <= aSeq->Length(); i += 3)
376 {
377 aColorPicked.r() = (Standard_ShortReal )aSeq->Value (i + 0);
378 aColorPicked.g() = (Standard_ShortReal )aSeq->Value (i + 1);
379 aColorPicked.b() = (Standard_ShortReal )aSeq->Value (i + 2);
380
381 if (theArgsNb == 3 ||
382 ((Abs (aColorPicked.r() - aColorInput.r()) <= Precision::Confusion())
383 && (Abs (aColorPicked.g() - aColorInput.g()) <= Precision::Confusion())
384 && (Abs (aColorPicked.b() - aColorInput.b()) <= Precision::Confusion())))
385 {
386 isNotEqual = Standard_False;
387 break;
388 }
389 }
390
391 theDi << "RED : " << aColorPicked.r() << " "
392 << "GREEN : " << aColorPicked.g() << " "
393 << "BLUE : " << aColorPicked.b() << "\n";
394
395 if (theArgsNb == 6)
396 {
397 theDi << "User color: \n"
398 << "RED : " << aColorInput.r() << " "
399 << "GREEN : " << aColorInput.g() << " "
400 << "BLUE : " << aColorInput.b() << "\n";
401 }
402
403 if (isNotEqual)
404 {
405 theDi << "Faulty : colors are not equal.\n";
406 return 1; // TCL_ERROR
407 }
408 return 0;
7fd59977 409}
410
411#if ! defined(WNT)
412extern int ViewerMainLoop (Standard_Integer argc, const char ** argv);
413#else
414Standard_EXPORT int ViewerMainLoop (Standard_Integer argc, const char ** argv);
415#endif
7fd59977 416
417static Standard_Integer QAAISGetMousePoint (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
418{
128cc8df 419 if ( argc != 1 ) {
420 di << "Usage : " << argv[0] << "\n";
421 return 1;
422 }
423 Handle (V3d_View) QAAISView = ViewerTest::CurrentView ();
424 if ( QAAISView.IsNull () ) {
425 di << "You must initialize AISViewer before this command." << "\n";
426 return 1;
427 }
428 Standard_Integer QAAISMouseCoordinateX = 0;
429 Standard_Integer QAAISMouseCoordinateY = 0;
430 Standard_Integer argccc = 5;
431 const char *bufff[] = { "A", "B", "C", "D", "E" };
432 const char **argvvv = (const char **) bufff;
433 while ( ViewerMainLoop (argccc, argvvv) ) {
434 ViewerTest::GetMousePosition (QAAISMouseCoordinateX, QAAISMouseCoordinateY);
435 }
436 ViewerTest::GetMousePosition (QAAISMouseCoordinateX, QAAISMouseCoordinateY);
437 di << "X-coordinate: " << QAAISMouseCoordinateX << "; Y-coordinate: " << QAAISMouseCoordinateY << "\n";
438 return 0;
7fd59977 439}
440
7fd59977 441//==============================================================================
442// VIEWER GLOBALs
443//==============================================================================
7fd59977 444#ifndef WNT
445extern Draw_Viewer dout;
7fd59977 446#else
447Standard_IMPORT Draw_Viewer dout;
7fd59977 448#endif
449
7fd59977 450//=======================================================================
7fd59977 451#if ! defined(WNT)
452extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
453extern Handle(AIS_InteractiveContext)& TheAISContext();
454#else
455Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
456Standard_EXPORT Handle(AIS_InteractiveContext)& TheAISContext();
457#endif
458#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
459#include <AIS_Trihedron.hxx>
460#include <AIS_Axis.hxx>
461#include <Geom_Line.hxx>
462#include <AIS_Line.hxx>
463
464//==============================================================================
465// function : VTrihedronOrigins
466// author : ota
467// purpose : draws triheron axis origin lines.
468// Draw arg : vtri_orig trihedron_name
469//==============================================================================
470static int VTrihedronOrigins(Draw_Interpretor& di,
471 Standard_Integer argc,
472 const char ** argv)
473{
474 if(argc != 2){
475 di <<"Usage : vtri_orig tri_name"<<"\n";
476 return 1;
477 }
478
479 if(TheAISContext().IsNull()){
480 di<<"Make 'vinit' before this method call"<<"\n";
481 return 1;
482 }
483
484 //get trihedron from AIS map.
485 TCollection_AsciiString aName(argv[1]);
486 if(!GetMapOfAIS().IsBound2(aName)){
487 di<<"No object named '"<<argv[1]<<"'"<<"\n";
488 return 1;
489 }
490
491 Handle(AIS_Trihedron) aTrih =
492 Handle(AIS_Trihedron)::DownCast(GetMapOfAIS().Find2(aName));
493 if(aTrih.IsNull()){
494 di<<"Trihedron is not found, try another name"<<"\n";
495 return 1;
496 }
497
498 //get axis
499 Handle(AIS_Axis) XAxis = aTrih->XAxis();
500 Handle(AIS_Axis) YAxis = aTrih->YAxis();
501 Handle(AIS_Axis) ZAxis = aTrih->Axis();
502
503 //get geometrical lines
504 Handle(Geom_Line) XGLine = XAxis->Component();
505 Handle(Geom_Line) YGLine = YAxis->Component();
506 Handle(Geom_Line) ZGLine = ZAxis->Component();
507
508 //make AIS_Lines
509 Handle(AIS_Line) XLine = new AIS_Line(XGLine);
510 Handle(AIS_Line) YLine = new AIS_Line(YGLine);
511 Handle(AIS_Line) ZLine = new AIS_Line(ZGLine);
512
513 //put them into AIS map:
514 GetMapOfAIS().Bind(XLine,aName+"_X");
515 GetMapOfAIS().Bind(YLine,aName+"_Y");
516 GetMapOfAIS().Bind(ZLine,aName+"_Z");
517 //print names of created objects:
518 di<<argv[1]<<"_X "<<argv[1]<<"_Y "<<argv[1]<<"_Z"<<"\n";
519
520 //try to draw them:
521 TheAISContext()->Display(XLine);
522 TheAISContext()->Display(YLine);
523 TheAISContext()->Display(ZLine);
524
525 return 0;
526}
527
7fd59977 528#include <Draw_Viewer.hxx>
529#include <Draw.hxx>
530
7fd59977 531static Standard_Integer ViewId(const Standard_CString a)
532{
91322f44 533 Standard_Integer id = Draw::Atoi(a);
7fd59977 534 if ((id < 0) || (id >= MAXVIEW)) {
535 cout << "Incorrect view-id, must be in 0.."<<MAXVIEW-1<<endl;
536 return -1;
537 }
538 if (!dout.HasView(id)) {
539 cout <<"View "<<id<<" does not exist."<<endl;
540 return -1;
541 }
542 return id;
543}
544
7fd59977 545#include <Draw_Display.hxx>
546
7fd59977 547//=======================================================================
548// QArename
549//=======================================================================
550
551static Standard_Integer QArename(Draw_Interpretor& di, Standard_Integer n, const char** a)
552{
553 if (n < 3) return 1;
554 Standard_Boolean cop = !strcasecmp(a[0],"copy");
555
556 Handle(Draw_Drawable3D) D;
557 for (Standard_Integer i = 1; i < n; i += 2) {
558 if (i+1 >= n) return 0;
559 D = Draw::Get(a[i]);
560 if (!D.IsNull()) {
561 if (cop)
562 D = D->Copy();
563 else
564 // clear old name
565 Draw::Set(a[i],Handle(Draw_Drawable3D()));
566
567 Draw::Set(a[i+1],D);
568 }
569 }
570 return 0;
571}
572
7fd59977 573//#if defined(V2D)
574//#include <AIS2D_InteractiveContext.hxx>
575//static Standard_Integer QANbSelected2d (Draw_Interpretor& /*di*/, Standard_Integer argc, char** argv)
576//{
577// if(argc != 1) {
578// cout << "Usage : " << argv[0] << endl;
579// return 1;
580// }
581// Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
582// if(aContext.IsNull()) {
583// cerr << "use 'v2dinit' command before " << argv[0] << endl;
584// return 1;
585// }
586// cout << aContext->NbSelected() << endl;
587// return 0;
588//}
589//#endif
590
7fd59977 591void QADraw::CommonCommands(Draw_Interpretor& theCommands)
592{
593 ios::sync_with_stdio();
594
595 st_err = dup(STDERR_FILENO);
596
597 Draw_BeforeCommand_old = Draw_BeforeCommand;
598 Draw_AfterCommand_old = Draw_AfterCommand;
599
600 Draw_BeforeCommand = &before;
601 Draw_AfterCommand = &after;
602
603 const char* group = "QA_Commands";
604
605 theCommands.Add("QARebuild","QARebuild command_name",__FILE__,QARebuild,group);
7fd59977 606 theCommands.Add("QAGetPixelColor", "QAGetPixelColor coordinate_X coordinate_Y [color_R color_G color_B]", __FILE__,QAAISGetPixelColor, group);
7fd59977 607 theCommands.Add("QAGetMousePoint", "QAGetMousePoint", __FILE__,QAAISGetMousePoint, group);
7fd59977 608 theCommands.Add("vtri_orig",
609 "vtri_orig : vtri_orig trihedron_name - draws axis origin lines",
610 __FILE__,VTrihedronOrigins,group);
7fd59977 611
319e4241 612// adding commands "rename" leads to the fact that QA commands doesn't work properly OCC23410, use function "renamevar"
613// theCommands.Add("rename","rename name1 toname1 name2 toname2 ...",__FILE__,QArename,group);
7fd59977 614}
615/*
616extern "C" int Tkqadraw_Init(Tcl_Interp *);
617
618int Tkqadraw_Init(Tcl_Interp * ) {
619
620 ios::sync_with_stdio();
621
622 QADraw::CommonCommands(theCommands);
623 QADraw::AdditionalCommands(theCommands);
624
625 ViewerTest::Commands (theCommands);
626 ViewerTest::ViewerCommands (theCommands);
627
628 Viewer2dTest::Commands(theCommands);
629// if (Tcl_PkgProvide(theCommands.Interp(), "Qa", "1.0") != TCL_OK) {
630// return TCL_ERROR;
631// }
632
633 return TCL_OK;
634}
635*/
636//==============================================================================
637// QADraw::Factory
638//==============================================================================
639void QADraw::Factory(Draw_Interpretor& theCommands)
640{
641 thePCommands = &theCommands;
642
643 // definition of QA Command
644 QADraw::CommonCommands(theCommands);
645 QADraw::AdditionalCommands(theCommands);
646
647 //ViewerTest::Commands (theCommands);
648 //ViewerTest::ViewerCommands (theCommands);
649
650//#if defined(V2D)
651// Viewer2dTest::Commands(theCommands);
652//#endif
653
654//#ifdef DEB
655// cout << "Draw Plugin : QA commands are loaded" << endl;
656//#endif
657}
658
659// Declare entry point PLUGINFACTORY
660DPLUGIN(QADraw)