0023024: Update headers of OCCT files
[occt.git] / src / DPrsStd / DPrsStd_AISPresentationCommands.cxx
1 // Created on: 1998-10-07
2 // Created by: Denis PASCAL
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23 #include <DPrsStd.hxx>
24 #include <Draw.hxx>
25 #include <Draw_Appli.hxx>
26 #include <Draw_Interpretor.hxx>
27 #include <Draw_ColorKind.hxx>
28 #include <TCollection_AsciiString.hxx>
29 #include <TDocStd_Document.hxx>
30 #include <TDF_Label.hxx>
31 #include <TDF_Data.hxx> 
32 #include <DDF.hxx>
33 #include <DDocStd.hxx>
34 #include <ViewerTest.hxx>
35
36
37 #include <V3d_View.hxx>
38
39
40 // for AIS
41
42 #include <TPrsStd_AISPresentation.hxx>
43 #include <TPrsStd_AISViewer.hxx>
44 #include <ViewerTest.hxx>
45 #include <AIS_InteractiveContext.hxx> 
46 #include <AIS_InteractiveObject.hxx>
47 #include <AIS_Drawer.hxx> 
48 #include <ViewerTest.hxx>
49 #include <ViewerTest_Tool.hxx>
50 #include <V3d_View.hxx>
51 #include <TCollection_ExtendedString.hxx>
52 #include <Quantity_NameOfColor.hxx>
53 #include <Graphic3d_NameOfMaterial.hxx>
54
55 #include <TDataXtd_Axis.hxx>
56 #include <TDataXtd_Constraint.hxx>
57 #include <TDataXtd_Geometry.hxx>
58 #include <TNaming_NamedShape.hxx>
59 #include <TDataXtd_Plane.hxx>
60 #include <TDataXtd_Point.hxx>
61 #include <Standard_PCharacter.hxx>
62
63 //#include <TSketchStd_Geometry.hxx>
64 //#include <TSketchStd_Edge.hxx>
65
66 //=======================================================================
67 //function : DPrsStd_AISDisplay
68 //purpose  : DDisplay (DOC,entry, not_update)
69 //=======================================================================
70
71 static Standard_Integer DPrsStd_AISDisplay (Draw_Interpretor& di,
72                                           Standard_Integer nb, 
73                                           const char** arg) 
74 {   
75        
76   Handle(TDocStd_Document) D;
77   if (!DDocStd::GetDocument(arg[1],D)) return 1; 
78   TDF_Label L;
79   if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
80   Handle(TPrsStd_AISPresentation) prs;
81   if(!L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) return 1;  
82   if (nb == 3) {
83     prs->Display(Standard_True);
84     TPrsStd_AISViewer::Update(L);
85     return 0;
86   }
87   else {
88     prs->Display();
89     TPrsStd_AISViewer::Update(L);
90     return 0;
91   }
92   di << "DPrsStd_AISDisplay : Error" << "\n";
93   return 1;
94 }
95
96 //=======================================================================
97 //function : DPrsStd_AISRemove
98 //purpose  : AISRemove (DOC,entry)
99 //=======================================================================
100
101 static Standard_Integer DPrsStd_AISRemove (Draw_Interpretor& di,
102                                            Standard_Integer nb, 
103                                            const char** arg) 
104 {   
105    if (nb == 3) {     
106      Handle(TDocStd_Document) D;
107      if (!DDocStd::GetDocument(arg[1],D)) return 1; 
108      TDF_Label L;
109      if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
110      Handle(TPrsStd_AISPresentation) P;
111      if(!L.FindAttribute(TPrsStd_AISPresentation::GetID(), P)) return 1;
112      P->Erase(Standard_True);
113      TPrsStd_AISViewer::Update(L);
114      return 0;
115    }
116    di << "DPrsStd_AISRedisplay : Error" << "\n";
117    return 1;
118 }
119
120
121 //=======================================================================
122 //function : DPrsStd_AISErase
123 //purpose  : AISErase (DOC,entry)
124 //=======================================================================
125
126 static Standard_Integer DPrsStd_AISErase (Draw_Interpretor& di,
127                                         Standard_Integer nb, 
128                                         const char** arg) 
129 {   
130   if (nb == 3) {     
131     Handle(TDocStd_Document) D;
132     if (!DDocStd::GetDocument(arg[1],D)) return 1; 
133     TDF_Label L;
134     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
135     Handle(TPrsStd_AISPresentation) prs;
136     if(!L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) return 1;  
137     prs->Erase();
138     TPrsStd_AISViewer::Update(L);
139     return 0;
140   }
141   di << "DPrsStd_AISErase : Error" << "\n";
142   return 1;
143 }
144
145 //=======================================================================
146 //function : DPrsStd_AISUpdate
147 //purpose  : AISUpdate (DOC,entry)
148 //=======================================================================
149
150 static Standard_Integer DPrsStd_AISUpdate (Draw_Interpretor& di,
151                                          Standard_Integer nb, 
152                                          const char** arg) 
153 {   
154   if (nb == 3) {     
155     Handle(TDocStd_Document) D;
156     if (!DDocStd::GetDocument(arg[1],D)) return 1; 
157     TDF_Label L;
158     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;
159     Handle(TPrsStd_AISPresentation) prs;
160     if(!L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) return 1;  
161     prs->Update();
162     TPrsStd_AISViewer::Update(L);
163     return 0;
164   }
165   di << "DPrsStd_AISUpdate : Error" << "\n";
166   return 1;
167 }
168
169
170 //=======================================================================
171 //function : DPrsStd_AISSet
172 //purpose  : AISSet (DOC,entry, id)
173 //=======================================================================
174
175 static Standard_Integer DPrsStd_AISSet (Draw_Interpretor& di,
176                                         Standard_Integer nb, 
177                                         const char** arg) 
178 {   
179   if (nb == 4) {        
180     Handle(TDocStd_Document) D;
181     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
182     TDF_Label L;
183     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1; 
184     Standard_GUID guid;
185     TCollection_ExtendedString str = arg[3];
186 #ifdef DEB
187     cout << "Inputed parameter > " << str   << endl;
188 #endif
189     if ( str == "A" )  //axis
190       guid = TDataXtd_Axis::GetID();     //"2a96b601-ec8b-11d0-bee7-080009dc3333" 
191     else if( str ==  "C")        //constraint 
192       guid = TDataXtd_Constraint::GetID();    //"2a96b602-ec8b-11d0-bee7-080009dc3333" 
193     else if( str == "NS" )        //namedshape
194       guid = TNaming_NamedShape::GetID();     //"c4ef4200-568f-11d1-8940-080009dc3333" 
195     else if( str == "G" )        //geometry
196       guid = TDataXtd_Geometry::GetID();      //"2a96b604-ec8b-11d0-bee7-080009dc3333"
197     else if( str == "PL" )        //plane
198       guid = TDataXtd_Plane::GetID();    //"2a96b60c-ec8b-11d0-bee7-080009dc3333"
199     else if( str == "PT" )        //point
200       guid = TDataXtd_Point::GetID();    //"2a96b60d-ec8b-11d0-bee7-080009dc3333"
201 //    else if( str == "SG" )        //TSketch_Geometry
202 //      guid = TSketchStd_Geometry::GetID();    //"b3aac909-5b78-11d1-8940-080009dc3333"
203 //    else if( str == "E" )        //TSketch_Edge
204 //      guid = TSketchStd_Edge::GetID();           //"b3aac90a-5b78-11d1-8940-080009dc3333"
205
206     Handle(TPrsStd_AISPresentation) prs= TPrsStd_AISPresentation::Set(L, guid);
207 #ifdef DEB
208     cout << "Driver GUID = ";
209     prs->GetDriverGUID().ShallowDump(cout);
210     cout << "\n";
211 #endif
212     Standard_Character resS[37];
213     Standard_PCharacter presS;
214     presS=resS;
215     guid.ToCString(presS);
216     di<<resS;
217     return 0; 
218   }
219   di << "DPrsStd_AISSet : Error" << "\n";
220   return 1; 
221 }
222
223 //=======================================================================
224 //function : DPrsStd_AISDriver
225 //purpose  : AISDriver (DOC,entry, [ID])
226 //=======================================================================
227
228 static Standard_Integer DPrsStd_AISDriver (Draw_Interpretor& di,
229                                            Standard_Integer nb, 
230                                            const char** arg) 
231 {   
232   if (nb >= 3) {     
233     Handle(TDocStd_Document) D;
234     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
235     TDF_Label L;
236     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1; 
237
238     Standard_GUID guid;
239     Handle(TPrsStd_AISPresentation) prs;
240     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {
241       if( nb == 3 ) {
242         guid = prs->GetDriverGUID();
243         Standard_Character str[37];
244         Standard_PCharacter pstr;
245         pstr=str;
246         guid.ToCString( pstr );
247         di << str ;
248         return 0; 
249       }
250       else {
251         TCollection_ExtendedString str = arg[3];
252 #ifdef DEB
253         cout << "Inputed parameter > " << str   << endl;
254 #endif
255         if ( str == "A" )  //axis
256           guid = TDataXtd_Axis::GetID();     //"2a96b601-ec8b-11d0-bee7-080009dc3333" 
257         else if( str ==  "C")        //constraint 
258           guid = TDataXtd_Constraint::GetID();    //"2a96b602-ec8b-11d0-bee7-080009dc3333" 
259         else if( str == "NS" )        //namedshape
260           guid = TNaming_NamedShape::GetID();     //"c4ef4200-568f-11d1-8940-080009dc3333" 
261         else if( str == "G" )        //geometry
262           guid = TDataXtd_Geometry::GetID();      //"2a96b604-ec8b-11d0-bee7-080009dc3333"
263         else if( str == "PL" )        //plane
264           guid = TDataXtd_Plane::GetID();    //"2a96b60c-ec8b-11d0-bee7-080009dc3333"
265         else if( str == "PT" )        //point
266           guid = TDataXtd_Point::GetID();    //"2a96b60d-ec8b-11d0-bee7-080009dc3333"
267 //      else if( str == "SG" )        //TSketch_Geometry
268 //        guid = TSketchStd_Geometry::GetID();    //"b3aac909-5b78-11d1-8940-080009dc3333"
269 //      else if( str == "E" )        //TSketch_Edge
270 //        guid = TSketchStd_Edge::GetID();           //"b3aac90a-5b78-11d1-8940-080009dc3333"
271
272         prs->SetDriverGUID(guid);
273         Standard_Character resS[37];
274         Standard_PCharacter presS;
275         //modified by NIZNHY-PKV Tue Apr 22 16:15:02 2008f
276         presS=resS;
277         //modified by NIZNHY-PKV Tue Apr 22 16:15:05 2008t
278         guid.ToCString( presS );
279         di << resS ;
280         return 0;
281       }
282     }
283   }
284   di << "DPrsStd_AISDriver : Error" << "\n";
285   return 1;  
286 }
287
288 //=======================================================================
289 //function : DPrsStd_AISUnset
290 //purpose  : AISUnset (DOC,entry)
291 //=======================================================================
292
293 static Standard_Integer DPrsStd_AISUnset (Draw_Interpretor& di,
294                                           Standard_Integer nb, 
295                                           const char** arg) 
296 {   
297   if (nb == 3) {     
298     Handle(TDocStd_Document) D;
299     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
300     TDF_Label L;
301     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1; 
302     TPrsStd_AISPresentation::Unset(L);
303     TPrsStd_AISViewer::Update(L);
304     return 0; 
305   }
306   di << "DPrsStd_AISDriver : Error" << "\n";
307   return 1;  
308 }
309
310
311 //=======================================================================
312 //function : DPrsStd_AISTransparency 
313 //purpose  : AISTransparency  (DOC,entry,[real])
314 //=======================================================================
315
316 static Standard_Integer DPrsStd_AISTransparency (Draw_Interpretor& di,
317                                                  Standard_Integer nb, 
318                                                  const char** arg) 
319 {
320   if (nb >= 3 ) {     
321     Handle(TDocStd_Document) D;
322     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
323     TDF_Label L;
324     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
325
326     Handle(TPrsStd_AISViewer) viewer;
327     if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
328
329     Handle(TPrsStd_AISPresentation) prs;
330     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
331       if( nb == 4 ) {
332         prs->SetTransparency(atof(arg[3]));
333         TPrsStd_AISViewer::Update(L);
334       }
335       else {
336        if (prs->HasOwnTransparency()){ 
337          di << "Transparency = " << prs->Transparency() << "\n";
338          di<<prs->Transparency();
339        }
340        else{
341          di << "DPrsStd_AISTransparency: Warning : Transparency wasn't set" << "\n";
342          di<<(-1);
343        }
344       }
345       return 0;
346     }
347   }
348   di << "DPrsStd_AISTransparency : Error"   << "\n";
349   return 1;
350 }
351
352 //=======================================================================
353 //function : DPrsStd_AISDefaultTransparency
354 //purpose  : AISDefaultTransparency (DOC,entry)
355 //=======================================================================
356
357 static Standard_Integer DPrsStd_AISDefaultTransparency (Draw_Interpretor& di,
358                                                         Standard_Integer nb, 
359                                                         const char** arg) 
360 {   
361   if (nb == 3) {     
362     Handle(TDocStd_Document) D;
363     if (!DDocStd::GetDocument(arg[1],D)) return 1;   
364     TDF_Label L;
365     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;   
366
367     Handle(TPrsStd_AISPresentation) prs;
368     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {    
369       prs->UnsetTransparency();
370       TPrsStd_AISViewer::Update(L);
371       return 0;
372     }
373   }
374   di << "DPrsStd_AISDefaultTransparency : Error"   << "\n";
375   return 1;
376 }
377
378 //=======================================================================
379 //function : DPrsStd_AISColor 
380 //purpose  : AISColor (DOC,entry,[color])
381 //=======================================================================
382
383 static Standard_Integer DPrsStd_AISColor (Draw_Interpretor& di,
384                                           Standard_Integer nb, 
385                                           const char** arg) 
386 {
387   if (nb >= 3) {     
388     Handle(TDocStd_Document) D;
389     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
390     TDF_Label L;
391     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
392
393     Handle(TPrsStd_AISViewer) viewer;
394     if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
395
396     Handle(TPrsStd_AISPresentation) prs;
397     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
398       if( nb == 4 ) {
399         prs->SetColor((Quantity_NameOfColor)atoi(arg[3]));
400         TPrsStd_AISViewer::Update(L);
401       }
402       else
403        if (prs->HasOwnColor()){ 
404          di << "Color = " << prs->Color() << "\n";
405          di<<prs->Color();
406        }
407        else{
408          di << "DPrsStd_AISColor: Warning : Color wasn't set" << "\n";
409          di<<(-1);
410        }
411       return 0; 
412     }
413   }
414   di << "DPrsStd_AISColor : Error"   << "\n";
415   return 1;
416 }
417
418 //=======================================================================
419 //function : DPrsStd_AISDefaultColor 
420 //purpose  : AISDefaultColor (DOC,entry)
421 //=======================================================================
422
423 static Standard_Integer DPrsStd_AISDefaultColor (Draw_Interpretor& di,
424                                                  Standard_Integer nb, 
425                                                  const char** arg) 
426 {
427   if (nb == 3) {     
428     Handle(TDocStd_Document) D;
429     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
430     TDF_Label L;
431     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
432
433     Handle(TPrsStd_AISViewer) viewer;
434     if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
435
436     Handle(TPrsStd_AISPresentation) prs;
437     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
438       prs->UnsetColor();
439       TPrsStd_AISViewer::Update(L);
440       return 0; 
441     }
442   }
443   di << "DPrsStd_AISDefaultColor : Error"   << "\n";
444   return 1;
445 }
446
447 //=======================================================================
448 //function : DPrsStd_AISMaterial
449 //purpose  : AISMaterial (DOC,entry,[material])
450 //=======================================================================
451
452 static Standard_Integer DPrsStd_AISMaterial (Draw_Interpretor& di,
453                                              Standard_Integer nb, 
454                                              const char** arg) 
455 {
456   if (nb >= 3) {     
457     Handle(TDocStd_Document) D;
458     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
459     TDF_Label L;
460     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
461
462     Handle(TPrsStd_AISViewer) viewer;
463     if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
464
465     Handle(TPrsStd_AISPresentation) prs;
466     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
467       if( nb == 4 ) {
468         prs->SetMaterial((Graphic3d_NameOfMaterial)atoi(arg[3]));
469         TPrsStd_AISViewer::Update(L);
470       }
471       else {
472        if (prs->HasOwnMaterial()){ 
473          di << "Material = " << prs->Material() << "\n";
474          di<<prs->Material();
475        }
476        else{
477          di << "DPrsStd_AISMaterial: Warning : Material wasn't set" << "\n";
478          di<<(-1);
479        }
480       }
481       return 0;
482     }
483   }
484   di << "DPrsStd_AISMaterial : Error"   << "\n";
485   return 1;
486 }
487
488 //=======================================================================
489 //function : DPrsStd_AISDefaultMaterial
490 //purpose  : AISDefaultMaterial (DOC,entry)
491 //=======================================================================
492
493 static Standard_Integer DPrsStd_AISDefaultMaterial (Draw_Interpretor& di,
494                                                     Standard_Integer nb, 
495                                                     const char** arg) 
496 {
497   if (nb == 3) {     
498     Handle(TDocStd_Document) D;
499     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
500     TDF_Label L;
501     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
502
503     Handle(TPrsStd_AISViewer) viewer;
504     if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
505
506     Handle(TPrsStd_AISPresentation) prs;
507     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
508       prs->UnsetMaterial();
509       TPrsStd_AISViewer::Update(L);
510       return 0; 
511     }
512   }
513   di << "DPrsStd_AISDefaultMaterial : Error"   << "\n";
514   return 1;
515 }
516
517 //=======================================================================
518 //function : DPrsStd_AISHasOwnColor 
519 //purpose  : AISHasOwnColor (DOC,entry)
520 //return   : Boolean 
521 //=======================================================================
522
523 static Standard_Integer DPrsStd_AISHasOwnColor (Draw_Interpretor& di,
524                                                 Standard_Integer nb, 
525                                                 const char** arg) 
526 {
527   if (nb >= 3) {     
528     if (nb > 3)
529       di << "DPrsStd_AISHasOwnColor : Warning : too many arguments" << "\n";
530
531     Handle(TDocStd_Document) D;
532     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
533     TDF_Label L;
534     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
535
536     Handle(TPrsStd_AISViewer) viewer;
537     if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
538
539     Handle(TPrsStd_AISPresentation) prs;
540     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
541       di<<Standard_Integer(prs->HasOwnColor()); 
542       return 0; 
543     }
544
545   }
546   di << "DPrsStd_AISHasOwnColor : Error"   << "\n";
547   return 1;
548 }
549
550
551 //=======================================================================
552 //function : DPrsStd_AISHasOwnMaterial 
553 //purpose  : AISHasOwnMaterial (DOC,entry)
554 //return   : Boolean 
555 //=======================================================================
556
557 static Standard_Integer DPrsStd_AISHasOwnMaterial (Draw_Interpretor& di,
558                                                    Standard_Integer nb, 
559                                                    const char** arg) 
560 {
561   if (nb >= 3) {     
562     if (nb > 3)
563       di << "DPrsStd_AISHasOwnMaterial : Warning : too many arguments" << "\n";
564
565     Handle(TDocStd_Document) D;
566     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
567     TDF_Label L;
568     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
569
570     Handle(TPrsStd_AISViewer) viewer;
571     if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
572
573     Handle(TPrsStd_AISPresentation) prs;
574     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
575       di<<Standard_Integer(prs->HasOwnMaterial()); 
576       return 0; 
577     }
578
579   }
580   di << "DPrsStd_AISHasOwnMaterial : Error"   << "\n";
581   return 1;
582 }
583
584
585 //=======================================================================
586 //function : DPrsStd_AISHasOwnTransparency 
587 //purpose  : AISHasOwnColor (DOC,entry)
588 //return   : Boolean 
589 //=======================================================================
590
591 static Standard_Integer DPrsStd_AISHasOwnTransparency (Draw_Interpretor& di,
592                                                        Standard_Integer nb, 
593                                                        const char** arg) 
594 {
595   if (nb >= 3) {     
596     if (nb > 3)
597       di << "DPrsStd_AISHasOwnTransparency : Warning : too many arguments" << "\n";
598
599     Handle(TDocStd_Document) D;
600     if (!DDocStd::GetDocument(arg[1],D)) return 1;  
601     TDF_Label L;
602     if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
603
604     Handle(TPrsStd_AISViewer) viewer;
605     if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
606
607     Handle(TPrsStd_AISPresentation) prs;
608     if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
609       di<<Standard_Integer(prs->HasOwnTransparency()); 
610       return 0; 
611     }
612
613   }
614   di << "DPrsStd_AISHasOwnTransparency : Error"   << "\n";
615   return 1;
616 }
617
618
619 //=======================================================================
620 //function : AISPresentationCommands
621 //purpose  :
622 //=======================================================================
623
624
625 void DPrsStd::AISPresentationCommands (Draw_Interpretor& theCommands)
626 {  
627   static Standard_Boolean done = Standard_False;
628   if (done) return;
629   done = Standard_True;
630   const char* g = "DPrsStd : standard presentation commands" ;  
631  
632   // standard commands working on AISPresentation
633
634   theCommands.Add ("AISDisplay", 
635                    "AISDisplay (DOC, entry, [not_update])",
636                    __FILE__, DPrsStd_AISDisplay, g);  
637
638   theCommands.Add ("AISErase", 
639                    "AISErase (DOC, entry)",
640                    __FILE__, DPrsStd_AISErase, g);    
641
642   theCommands.Add ("AISUpdate", 
643                    "AISUpdate (DOC, entry)",
644                    __FILE__, DPrsStd_AISUpdate, g);  
645
646   theCommands.Add ("AISSet", 
647                    "AISSet (DOC, entry, ID)",
648                    __FILE__, DPrsStd_AISSet, g);  
649
650   theCommands.Add ("AISDriver", 
651                    "AISDriver (DOC, entry, [ID]) - returns DriverGUID stored in attribute or sets new one",
652                    __FILE__, DPrsStd_AISDriver, g);  
653
654   theCommands.Add ("AISUnset", 
655                    "AISUnset (DOC, entry)",
656                    __FILE__, DPrsStd_AISUnset, g);   
657
658   theCommands.Add ("AISTransparency", 
659                    "AISTransparency (DOC, entry, [real])",
660                    __FILE__, DPrsStd_AISTransparency, g); 
661
662   theCommands.Add ("AISDefaultTransparency", 
663                    "AISDefaultTransparency (DOC, entry)",
664                    __FILE__, DPrsStd_AISDefaultTransparency, g);
665
666   theCommands.Add ("AISHasOwnTransparency", 
667                    "AISHasOwnTransparency (DOC, entry)  |  AISHasOwnTransparency return Boolean",
668                    __FILE__, DPrsStd_AISHasOwnTransparency, g);
669
670   theCommands.Add ("AISDefaultColor", 
671                    "AISDefaultColor (DOC, entry)",
672                    __FILE__, DPrsStd_AISDefaultColor, g);
673
674   theCommands.Add ("AISColor", 
675                    "AISColor (DOC, entry, [color])",
676                    __FILE__, DPrsStd_AISColor, g);
677
678   theCommands.Add ("AISHasOwnColor", 
679                    "AISHasOwnColor (DOC, entry)  |  AISHasOwnColor return Boolean",
680                    __FILE__, DPrsStd_AISHasOwnColor, g);
681
682   theCommands.Add ("AISMaterial", 
683                    "AISMaterial (DOC, entry, [material])",
684                    __FILE__, DPrsStd_AISMaterial, g); 
685
686   theCommands.Add ("AISDefaultMaterial", 
687                    "AISDefaultMaterial (DOC, entry)",
688                    __FILE__, DPrsStd_AISDefaultMaterial, g); 
689
690   theCommands.Add ("AISHasOwnMaterial", 
691                    "AISHasOwnMaterial (DOC, entry)  |  AISHasOwnMaterial return Boolean",
692                    __FILE__, DPrsStd_AISHasOwnMaterial, g);
693
694   theCommands.Add ("AISRemove", 
695                    "AISRemove (DOC, entry)",
696                    __FILE__, DPrsStd_AISRemove, g);
697 }