1 // Created on: 1997-07-30
2 // Created by: Denis PASCAL
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <DDataStd.hxx>
19 #include <Standard_PCharacter.hxx>
22 #include <Draw_Interpretor.hxx>
23 #include <Draw_Appli.hxx>
24 #include <DrawTrSurf.hxx>
27 #include <Message.hxx>
29 #include <TDF_Data.hxx>
30 #include <TDF_Label.hxx>
31 #include <TDF_Tool.hxx>
32 #include <TDF_AttributeSequence.hxx>
33 #include <TDF_AttributeList.hxx>
34 #include <TDF_ListIteratorOfAttributeList.hxx>
36 #include <BRep_Tool.hxx>
40 #include <TopoDS_Vertex.hxx>
41 #include <TopoDS_Edge.hxx>
42 #include <TopoDS_Wire.hxx>
43 #include <TopoDS_Face.hxx>
44 #include <TopoDS_Shell.hxx>
45 #include <TopoDS_Solid.hxx>
46 #include <TopoDS_Shape.hxx>
52 #include <TCollection_AsciiString.hxx>
53 #include <TColStd_HArray1OfReal.hxx>
56 #include <TDataStd.hxx>
57 #include <TDataXtd_Triangulation.hxx>
58 #include <TDataStd_Comment.hxx>
59 #include <TDataStd_Name.hxx>
60 #include <TDataStd_Integer.hxx>
61 #include <TDataStd_Real.hxx>
62 #include <TDF_Reference.hxx>
63 #include <TDataStd_UAttribute.hxx>
64 #include <TDataStd_IntegerArray.hxx>
65 #include <TDataStd_BooleanArray.hxx>
66 #include <TDataStd_RealArray.hxx>
67 #include <TDataStd_BooleanList.hxx>
68 #include <TDataStd_IntegerList.hxx>
69 #include <TDataStd_RealList.hxx>
70 #include <TDataStd_Variable.hxx>
71 #include <TDataStd_ExtStringArray.hxx>
72 #include <TDF_ChildIterator.hxx>
73 #include <TDF_Tool.hxx>
75 #include <TDataStd_NamedData.hxx>
76 #include <TColStd_DataMapOfStringInteger.hxx>
77 #include <TColStd_DataMapIteratorOfDataMapOfStringInteger.hxx>
78 #include <TDataStd_DataMapOfStringReal.hxx>
79 #include <TDataStd_DataMapIteratorOfDataMapOfStringReal.hxx>
80 #include <TDataStd_DataMapOfStringByte.hxx>
81 #include <TDataStd_DataMapIteratorOfDataMapOfStringByte.hxx>
82 #include <TDataStd_DataMapOfStringString.hxx>
83 #include <TDataStd_DataMapIteratorOfDataMapOfStringString.hxx>
84 #include <TDataStd_DataMapOfStringHArray1OfInteger.hxx>
85 #include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger.hxx>
86 #include <TDataStd_DataMapOfStringHArray1OfReal.hxx>
87 #include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal.hxx>
88 #include <TColStd_HArray1OfInteger.hxx>
89 #include <TColStd_HArray1OfReal.hxx>
90 #include <TDataStd_AsciiString.hxx>
91 #include <TDataStd_IntPackedMap.hxx>
92 #include <TColStd_HPackedMapOfInteger.hxx>
93 #include <TColStd_PackedMapOfInteger.hxx>
94 #include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
95 #include <TDataStd_ByteArray.hxx>
96 #include <TDataStd_ListIteratorOfListOfByte.hxx>
97 #include <TColStd_ListIteratorOfListOfInteger.hxx>
98 #include <TColStd_ListIteratorOfListOfReal.hxx>
99 #include <TDataStd_ReferenceArray.hxx>
100 #include <TDataStd_ExtStringList.hxx>
101 #include <TDataStd_ReferenceList.hxx>
102 #include <TDF_ListIteratorOfLabelList.hxx>
103 #include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
109 //#define DEB_DDataStd
111 //=======================================================================
112 //function : DDataStd_SetInteger
113 //purpose : SetInteger (DF, entry, value, [,guid])
114 //=======================================================================
116 static Standard_Integer DDataStd_SetInteger (Draw_Interpretor& di,
122 if (!DDF::GetDF(arg[1],DF)) return 1;
124 DDF::AddLabel(DF, arg[2], L);
126 TDataStd_Integer::Set(L,Draw::Atoi(arg[3]));
128 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
129 di<<"DDataStd_SetInteger: The format of GUID is invalid\n";
132 Standard_GUID guid(arg[4]);
133 TDataStd_Integer::Set(L, guid, Draw::Atoi(arg[3]));
137 di << "DDataStd_SetInteger : Error\n";
141 //=======================================================================
142 //function : DDataStd_SetReal
143 //purpose : SetReal (DF, entry, value [,guid])
144 //=======================================================================
146 static Standard_Integer DDataStd_SetReal (Draw_Interpretor& di,
152 if (!DDF::GetDF(arg[1],DF)) return 1;
154 DDF::AddLabel(DF, arg[2], L);
156 TDataStd_Real::Set(L,Draw::Atof(arg[3]));
158 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
159 di<<"DDataStd_SetReal: The format of GUID is invalid\n";
162 Standard_GUID guid(arg[4]);
163 TDataStd_Real::Set(L, guid, Draw::Atof(arg[3]));
167 di << "DDataStd_SetReal : Error\n";
173 //=======================================================================
174 //function : DDataStd_SetReference
175 //purpose : SetReference (DF, entry, reference)
176 //=======================================================================
178 static Standard_Integer DDataStd_SetReference (Draw_Interpretor& di,
184 if (!DDF::GetDF(arg[1],DF)) return 1;
186 DDF::AddLabel(DF, arg[2], L);
188 if (!DDF::FindLabel(DF,arg[3],LREF)) return 1;
189 TDF_Reference::Set(L,LREF);
192 di << "DDataStd_SetReference : Error\n";
197 //=======================================================================
198 //function : DDataStd_SetComment
199 //purpose : SetComment (DF, entry, Comment)
200 //=======================================================================
202 static Standard_Integer DDataStd_SetComment (Draw_Interpretor& di,
208 if (!DDF::GetDF(arg[1],DF)) return 1;
210 DDF::AddLabel(DF, arg[2], L);
211 TDataStd_Comment::Set(L,TCollection_ExtendedString(arg[3],Standard_True));
214 di << "DDataStd_SetComment : Error\n";
218 //=======================================================================
219 //function : DDataStd_GetInteger
220 //purpose : GetReal (DF, entry, [drawname][, guid])
221 //=======================================================================
223 static Standard_Integer DDataStd_GetInteger (Draw_Interpretor& di,
227 if (nb == 3 || nb == 4 || nb == 5) {
229 if (!DDF::GetDF(arg[1],DF)) return 1;
230 Handle(TDataStd_Integer) A;
232 Standard_GUID aNullGuid("00000000-0000-0000-0000-000000000000");
233 Standard_Boolean isdrawname(Standard_False);
235 if(nb == 4) { //DF, entry, guid
236 if (Standard_GUID::CheckGUIDFormat(arg[3]))
237 aGuid = Standard_GUID(arg[3]);
239 if(Standard_GUID::IsEqual(aGuid, aNullGuid)) {
240 isdrawname = Standard_True;
241 aGuid = TDataStd_Integer::GetID();
244 isdrawname = Standard_True;
245 if (Standard_GUID::CheckGUIDFormat(arg[4]))
246 aGuid = Standard_GUID(arg[4]);
248 di<<"DDataStd_GetInteger: The format of GUID is invalid\n";
253 if (!DDF::Find(DF,arg[2],aGuid,A)) return 1;
254 if (nb == 4 && isdrawname) Draw::Set(arg[3],A->Get());
255 else Draw::Set(arg[2],A->Get());
259 di << "DDataStd_GetInteger : Error\n";
263 //=======================================================================
264 //function : DDataStd_GetReal
265 //purpose : GetReal (DF, entry, [drawname][, guid])
266 //=======================================================================
268 static Standard_Integer DDataStd_GetReal (Draw_Interpretor& di,
272 if (nb == 3 || nb == 4 || nb == 5) {
274 if (!DDF::GetDF(arg[1],DF)) return 1;
275 Handle(TDataStd_Real) A;
277 Standard_GUID aNullGuid("00000000-0000-0000-0000-000000000000");
278 Standard_Boolean isdrawname(Standard_False);
281 if (Standard_GUID::CheckGUIDFormat(arg[3]))
282 aGuid = Standard_GUID(arg[3]);
284 if(Standard_GUID::IsEqual(aGuid, aNullGuid)) {
285 isdrawname = Standard_True;
286 aGuid = TDataStd_Real::GetID();
290 isdrawname = Standard_True;
291 if (Standard_GUID::CheckGUIDFormat(arg[4]))
292 aGuid = Standard_GUID(arg[4]);
294 di<<"DDataStd_GetReal: The format of GUID is invalid\n";
298 if (!DDF::Find(DF,arg[2],aGuid,A)) return 1;
299 if (nb == 4 && isdrawname) Draw::Set(arg[3],A->Get());
300 else Draw::Set(arg[2],A->Get());
304 di << "DDataStd_GetReal : Error\n";
309 //=======================================================================
310 //function : DDataStd_GetReference
311 //purpose : GetShape (DF, entry)
312 //=======================================================================
314 static Standard_Integer DDataStd_GetReference (Draw_Interpretor& di,
320 if (!DDF::GetDF(arg[1],DF)) return 1;
321 Handle(TDF_Reference) REF;
322 if (!DDF::Find(DF,arg[2],TDF_Reference::GetID(),REF)) return 1;
323 TCollection_AsciiString entry; TDF_Tool::Entry(REF->Get(),entry);
324 di << entry.ToCString();
327 di << "DDataStd_GetReference : Error\n";
331 //=======================================================================
332 //function : DDataStd_GetComment
333 //purpose : GetShape (DF, entry)
334 //=======================================================================
336 static Standard_Integer DDataStd_GetComment (Draw_Interpretor& di,
342 if (!DDF::GetDF(arg[1],DF)) return 1;
343 Handle(TDataStd_Comment) A;
344 if (!DDF::Find(DF,arg[2],TDataStd_Comment::GetID(),A)) return 1;
348 di << "DDataStd_GetComment : Error\n";
354 //=======================================================================
356 //purpose : Self (document,label)
357 //=======================================================================
359 static Standard_Integer DDataStd_Self (Draw_Interpretor& di,
363 TCollection_AsciiString s;
366 if (!DDF::GetDF(arg[1],DF)) return 1;
368 if (!DDF::FindLabel(DF,arg[2],L)) return 1;
369 // TDataStd::MakeSelfContained(L,removed);
370 // if (removed.IsEmpty()) std::cout << "noone attriburte removed" << std::endl;
371 // for (TDF_ListIteratorOfAttributeList it(removed);it.More();it.Next()) {
372 // TDF_Tool::Entry(it.Value()->Label(),s); std::cout << s << " ";
373 // std::cout << std::endl;
377 di << "Self : Error\n";
383 //=======================================================================
384 //function : SetUObject (DF, entry, ObjectID)
385 //=======================================================================
386 // static Standard_Integer DDataStd_SetUObject (Draw_Interpretor&,
387 // Standard_Integer nb,
391 // Handle(TDF_Data) DF;
392 // if (!DDF::GetDF(arg[1],DF)) return 1;
394 // DDF::AddLabel(DF, arg[2], label);
396 // Standard_GUID guid(arg[3]); //"00000000-0000-0000-1111-000000000000");
397 // TDataStd_UObject::Set(label, guid);
401 // std::cout << "Wrong arguments" << std::endl;
405 //=======================================================================
406 //function : SetUAttribute (DF, entry, LocalID)
407 //=======================================================================
408 static Standard_Integer DDataStd_SetUAttribute (Draw_Interpretor& di,
414 if (!DDF::GetDF(arg[1],DF)) return 1;
416 DDF::AddLabel(DF, arg[2], label);
418 Standard_GUID guid(arg[3]); //"00000000-0000-0000-2222-000000000000");
419 TDataStd_UAttribute::Set(label, guid);
423 di << "Wrong arguments" << "\n";
427 //=======================================================================
428 //function : GetUAttribute (DF, entry, LoaclID)
429 //=======================================================================
430 static Standard_Integer DDataStd_GetUAttribute (Draw_Interpretor& di,
436 if (!DDF::GetDF(arg[1],DF)) return 1;
438 if( !DDF::FindLabel(DF, arg[2], label) ) {
439 di << "No label for entry" << "\n";
442 Standard_GUID guid(arg[3]); //"00000000-0000-0000-2222-000000000000");
444 Handle(TDataStd_UAttribute) UA;
445 if( !label.FindAttribute(guid, UA) ) {
446 di << "No UAttribute Attribute on label" << "\n";
449 char *aStrGUID = new char[37];
450 UA->ID().ToCString(aStrGUID);
456 di << "Wrong arguments" << "\n";
461 //=======================================================================
462 //function : CheckUObject (DF, entry, ObjectID)
463 //=======================================================================
464 // static Standard_Integer DDataStd_CheckUObject (Draw_Interpretor&,
465 // Standard_Integer nb,
469 // Handle(TDF_Data) DF;
470 // if (!DDF::GetDF(arg[1],DF)) return 1;
472 // if( !DDF::FindLabel(DF, arg[2], label) ) {
473 // std::cout << "No label for entry" << std::endl;
476 // Handle(TDataStd_Object) O;
477 // Handle(TDataStd_UObject) UO;
478 // Standard_GUID guidUO(arg[3]);
480 // if( !label.FindAttribute( TDataStd_Object::GetID(), O) ) {
481 // std::cout << "No Object Attribute on label" << std::endl;
484 // std::cout << "UObject is found with ObjectID = ";
485 // O->Find(label, guidUO, UO);
486 // UO->ObjectID().ShallowDump(std::cout);
487 // std::cout << std::endl;
492 // std::cout << "Wrong arguments" << std::endl;
497 //=======================================================================
498 //function : SetIntArray (DF, entry , isDelta, [-g Guid,] From, To, elmt1, elmt2, ...
499 //=======================================================================
500 static Standard_Integer DDataStd_SetIntArray (Draw_Interpretor& di,
506 if (!DDF::GetDF(arg[1],DF)) return 1;
508 DDF::AddLabel(DF, arg[2], label);
509 Standard_Boolean isDelta = Draw::Atoi(arg[3]) != 0;
511 Standard_Boolean isGuid(Standard_False);
512 Standard_Character c1(arg[4][0]), c2(arg[4][1]);
513 if(c1 == '-' && c2 == 'g') { //guid
514 if (!Standard_GUID::CheckGUIDFormat(arg[5])) {
515 di<<"DDataStd_SetIntArray: The format of GUID is invalid\n";
518 guid = Standard_GUID (arg[5]);
519 isGuid = Standard_True;
521 Standard_Integer j(4);
523 if((strlen(arg[j]) > MAXLENGTH || strlen(arg[j+1]) > MAXLENGTH) ||
524 !TCollection_AsciiString (arg[j]).IsIntegerValue() ||
525 !TCollection_AsciiString (arg[j+1]).IsIntegerValue())
527 di << "DDataStd_SetIntArray: From, To may be wrong\n";
530 Standard_Integer From = Draw::Atoi(arg[j]), To = Draw::Atoi( arg[j+1] );
531 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
532 Handle(TDataStd_IntegerArray) A;
534 A = TDataStd_IntegerArray::Set(label, From, To, isDelta);
536 A = TDataStd_IntegerArray::Set(label, guid, From, To, isDelta);
538 if ((!isGuid && nb > 6) || (isGuid && nb > 8)) {
540 for(Standard_Integer i = From; i<=To; i++) {
541 A->SetValue(i, Draw::Atoi(arg[j]) );
547 di << "DDataStd_SetIntArray: Error\n";
551 //=======================================================================
552 //function : SetIntArrayValue (DF, entry, index, value)
553 //=======================================================================
554 static Standard_Integer DDataStd_SetIntArrayValue (Draw_Interpretor&,
560 if (!DDF::GetDF(arg[1], DF))
565 if (!DDF::AddLabel(DF, arg[2], label))
568 // Get index and value.
569 Standard_Integer index = Draw::Atoi(arg[3]);
570 Standard_Integer value = Draw::Atoi(arg[4]);
573 Handle(TDataStd_IntegerArray) arr;
574 if (label.FindAttribute(TDataStd_IntegerArray::GetID(), arr))
576 arr->SetValue(index, value);
583 //=======================================================================
584 //function : GetIntArray (DF, entry [, guid] )
585 //=======================================================================
586 static Standard_Integer DDataStd_GetIntArray (Draw_Interpretor& di,
594 if (!DDF::GetDF(arg[1],DF)) return 1;
596 if( !DDF::FindLabel(DF, arg[2], label) ) {
597 di << "No label for entry" << "\n";
602 if (Standard_GUID::CheckGUIDFormat(arg[3]))
603 aGuid = Standard_GUID(arg[3]);
605 di << "Wrong GUID format" << "\n";
609 aGuid = TDataStd_IntegerArray::GetID();
610 Handle(TDataStd_IntegerArray) A;
611 if ( !label.FindAttribute(aGuid, A) ) {
612 di << "There is no TDataStd_IntegerArray with the specified GUID under label" << "\n";
616 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
624 di << "DDataStd_GetIntArray: Error\n";
627 //=======================================================================
628 //function : GetIntArrayValue (DF, entry, index)
629 //=======================================================================
630 static Standard_Integer DDataStd_GetIntArrayValue (Draw_Interpretor& di,
635 if (!DDF::GetDF(arg[1],DF))
639 if (!DDF::FindLabel(DF, arg[2], label)) {
640 di << "No label for entry" << "\n";
644 Handle(TDataStd_IntegerArray) A;
645 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
646 di << "There is no TDataStd_IntegerArray under label" << "\n";
650 Standard_Integer index = Draw::Atoi(arg[3]);
651 if (index < A->Lower() || index > A->Upper()) {
652 di << "Index is out of range\n";
655 di << A->Value(index) << "\n";
661 //=======================================================================
662 //function : ChangeIntArray (DF, entry, indx, val )
663 //=======================================================================
664 static Standard_Integer DDataStd_ChangeIntArray (Draw_Interpretor& di,
671 if (!DDF::GetDF(arg[1],DF)) return 1;
673 if( !DDF::FindLabel(DF, arg[2], label) ) {
674 di << "No label for entry" << "\n";
678 Handle(TDataStd_IntegerArray) A;
679 if ( !label.FindAttribute(TDataStd_IntegerArray::GetID(), A) ) {
680 di << "There is no TDataStd_IntegerArray at label" << "\n";
683 Standard_Integer indx = Draw::Atoi(arg[3]);
684 Standard_Integer val = Draw::Atoi(arg[4]);
685 Standard_Integer low = A->Lower(), up = A->Upper();
686 if(low <= indx && indx <= up)
687 A->SetValue(indx, val);
689 Handle(TColStd_HArray1OfInteger) Arr = A->Array();
690 Handle(TColStd_HArray1OfInteger) arr;
694 arr = new TColStd_HArray1OfInteger(low, up);
695 for(i=low; i<= Arr->Upper(); i++)
696 arr->SetValue(i, Arr->Value(i));
697 for(i=Arr->Upper()+1; i<= up; i++) {
699 arr->SetValue(i, val);
703 } else if(indx < up) {//clip array : indx to be negative
705 arr = new TColStd_HArray1OfInteger(low, up);
706 for(i=low; i< up; i++)
707 arr->SetValue(i, Arr->Value(i));
708 arr->SetValue(up, val);
714 di << "DDataStd_ChangeIntArray: Error\n";
718 //=======================================================================
719 //function : SetIntArrayT (DF, entry , isDelta, From, To) - for testing
721 //=======================================================================
722 static Standard_Integer DDataStd_SetIntArrayTest (Draw_Interpretor& di,
729 if (!DDF::GetDF(arg[1],DF)) return 1;
731 DDF::AddLabel(DF, arg[2], label);
732 Standard_Boolean isDelta = Draw::Atoi(arg[3]) != 0;
733 Standard_Integer From = Draw::Atoi(arg[4]), To = Draw::Atoi( arg[5] ), j;
734 di << "Array of Standard_Integer with bounds from = " << From << " to = " << To << "\n";
735 Handle(TDataStd_IntegerArray) A = TDataStd_IntegerArray::Set(label, From, To, isDelta);
738 Standard_Integer k = 100;
739 for(Standard_Integer i = From; i<=To; i++) {
747 //=======================================================================
748 //function : SetRealArray (DF, entry , isDelta, [-g Guid,] From, To, elmt1, elmt2, ...
749 //=======================================================================
750 static Standard_Integer DDataStd_SetRealArray (Draw_Interpretor& di,
756 if (!DDF::GetDF(arg[1],DF)) return 1;
758 DDF::AddLabel(DF, arg[2], label);
759 Standard_Boolean isDelta = Draw::Atoi(arg[3]) != 0;
761 Standard_Boolean isGuid(Standard_False);
762 Standard_Character c1(arg[4][0]), c2(arg[4][1]);
763 if(c1 == '-' && c2 == 'g') { //guid
764 if (!Standard_GUID::CheckGUIDFormat(arg[5])) {
765 di<<"DDataStd_SetRealArray: The format of GUID is invalid\n";
768 guid = Standard_GUID (arg[5]);
769 isGuid = Standard_True;
771 Standard_Integer j(4);
773 if((strlen(arg[j]) > MAXLENGTH || strlen(arg[j+1]) > MAXLENGTH) ||
774 !TCollection_AsciiString (arg[j]).IsIntegerValue() ||
775 !TCollection_AsciiString (arg[j+1]).IsIntegerValue())
777 di << "DDataStd_SetRealArray: From, To may be wrong\n";
780 Standard_Integer From = Draw::Atoi(arg[j]), To = Draw::Atoi( arg[j+1] );
781 di << " Array of Standard_Real with bounds from = " << From << " to = " << To << "\n";
782 Handle(TDataStd_RealArray) A;
784 A = TDataStd_RealArray::Set(label, From, To, isDelta);
786 A = TDataStd_RealArray::Set(label, guid, From, To, isDelta);
787 if ((!isGuid && nb > 6) || (isGuid && nb > 8)) {
789 for(Standard_Integer i = From; i<=To; i++) {
790 A->SetValue(i, Draw::Atof(arg[j]) );
796 di << "DDataStd_SetRealArray: Error\n";
799 //=======================================================================
800 //function : SetRealArrayValue (DF, entry, index value)
801 //=======================================================================
802 static Standard_Integer DDataStd_SetRealArrayValue (Draw_Interpretor&,
808 if (!DDF::GetDF(arg[1], DF))
813 if (!DDF::AddLabel(DF, arg[2], label))
816 // Get index and value.
817 Standard_Integer index = Draw::Atoi(arg[3]);
818 Standard_Real value = Draw::Atof(arg[4]);
821 Handle(TDataStd_RealArray) realArray;
822 if (label.FindAttribute(TDataStd_RealArray::GetID(), realArray))
824 realArray->SetValue(index, value);
831 //=======================================================================
832 //function : GetRealArray (DF, entry [, guid])
833 //=======================================================================
834 static Standard_Integer DDataStd_GetRealArray (Draw_Interpretor& di,
841 if (!DDF::GetDF(arg[1],DF)) return 1;
843 if( !DDF::FindLabel(DF, arg[2], label) ) {
844 di << "No label for entry" << "\n";
849 if (Standard_GUID::CheckGUIDFormat(arg[3]))
850 aGuid = Standard_GUID(arg[3]);
852 di << "Wrong GUID format" << "\n";
856 aGuid = TDataStd_RealArray::GetID();
858 Handle(TDataStd_RealArray) A;
859 if ( !label.FindAttribute(aGuid, A) ) {
860 di << "There is no TDataStd_RealArray with the specified GUID at the label" << "\n";
862 aGuid.ShallowDump(std::cout);
867 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
869 std::cout << A->Value(i) << std::endl;
878 di << "TDataStd_RealArray: Error\n";
881 //=======================================================================
882 //function : GetRealArrayValue (DF, entry, index)
883 //=======================================================================
884 static Standard_Integer DDataStd_GetRealArrayValue (Draw_Interpretor& di,
889 if (!DDF::GetDF(arg[1],DF))
893 if (!DDF::FindLabel(DF, arg[2], label)) {
894 di << "No label for entry" << "\n";
898 Handle(TDataStd_RealArray) A;
899 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
900 di << "There is no TDataStd_RealArray under label" << "\n";
904 Standard_Integer index = Draw::Atoi(arg[3]);
905 if (index < A->Lower() || index > A->Upper()) {
906 di << "Index is out of range\n";
909 di << A->Value(index) << "\n";
915 //=======================================================================
916 //function : ChangeRealArray (DF, entry, indx, val )
917 //=======================================================================
918 static Standard_Integer DDataStd_ChangeRealArray (Draw_Interpretor& di,
925 if (!DDF::GetDF(arg[1],DF)) return 1;
927 if( !DDF::FindLabel(DF, arg[2], label) ) {
928 di << "No label for entry" << "\n";
932 Handle(TDataStd_RealArray) A;
933 if ( !label.FindAttribute(TDataStd_RealArray::GetID(), A) ) {
934 di << "There is no TDataStd_RealArray at label" << "\n";
937 Standard_Integer indx = Draw::Atoi(arg[3]);
938 Standard_Real val = Draw::Atof(arg[4]);
939 Standard_Integer low = A->Lower(), up = A->Upper();
940 if(low <= indx && indx <= up)
941 A->SetValue(indx, val);
943 Handle(TColStd_HArray1OfReal) Arr = A->Array();
944 Handle(TColStd_HArray1OfReal) arr;
948 arr = new TColStd_HArray1OfReal(low, up);
949 for(i=low; i<= Arr->Upper(); i++)
950 arr->SetValue(i, Arr->Value(i));
951 for(i=Arr->Upper()+1; i<= up; i++) {
953 arr->SetValue(i, val);
957 } else if(indx < up) {//clip array : indx to be negative
959 arr = new TColStd_HArray1OfReal(low, up);
960 for(i=low; i< up; i++)
961 arr->SetValue(i, Arr->Value(i));
962 arr->SetValue(up, val);
968 di << "DDataStd_ChangeRealArray: Error\n";
972 //=======================================================================
973 //function : SetVariable (DF, entry, isConstant[0/1], units)
974 //=======================================================================
975 static Standard_Integer DDataStd_SetVariable (Draw_Interpretor& di,
982 if (!DDF::GetDF(arg[1],DF)) return 1;
984 DDF::AddLabel(DF, arg[2], label);
986 Handle(TDataStd_Variable) aV = TDataStd_Variable::Set(label);
988 const char* aUnits = arg[4];
989 aV->Unit(Standard_CString(aUnits));
991 aV->Constant (Draw::Atoi(arg[3]) != 0);
995 di << "Wrong arguments\n";
999 //=======================================================================
1000 //function : GetVariable (DF, entry, [isConstant], [units])
1001 //=======================================================================
1002 static Standard_Integer DDataStd_GetVariable (Draw_Interpretor& di,
1003 Standard_Integer nb,
1008 Handle(TDF_Data) DF;
1009 if (!DDF::GetDF(arg[1],DF)) return 1;
1011 DDF::AddLabel(DF, arg[2], label);
1013 Handle(TDataStd_Variable) aV;
1014 if (!label.FindAttribute(TDataStd_Variable::GetID(), aV))
1016 di << "TDataStd_Variable: no such attribute\n";
1019 Draw::Set(arg[3],TCollection_AsciiString(Standard_Integer(aV->IsConstant())).ToCString());
1020 Draw::Set(arg[4],aV->Unit().ToCString());
1024 di << "Wrong arguments\n";
1028 #include <TDataStd_Relation.hxx>
1029 #include <TDataStd_Variable.hxx>
1030 //=======================================================================
1031 //function : SetRelation (DF, entry, expression, var1[, var2, ...])
1032 //=======================================================================
1033 static Standard_Integer DDataStd_SetRelation (Draw_Interpretor& di,
1034 Standard_Integer nb, const char** arg)
1038 Handle(TDF_Data) DF;
1039 if (!DDF::GetDF(arg[1],DF)) return 1;
1041 DDF::AddLabel(DF, arg[2], label);
1043 Standard_CString expr (arg[3]);
1044 Handle(TDataStd_Relation) aR = TDataStd_Relation::Set(label);
1045 aR->SetRelation(TCollection_ExtendedString (expr, Standard_True));
1046 Handle(TDataStd_Variable) aV;
1048 for (Standard_Integer i = 4; i < nb; i++)
1050 if (!DDF::FindLabel(DF, arg[i], label))
1052 di << "No label for entry" << arg[i] << "\n";
1055 if (!label.FindAttribute(TDataStd_Variable::GetID(), aV))
1057 di << "No TDataStd_Variable Attribute on label\n";
1060 aR->GetVariables().Append(aV);
1064 di << "Usage: SetRelation (DF, entry, expression, var1[, var2, ...])\n";
1068 //=======================================================================
1069 //function : DumpRelation (DF, entry)
1070 //=======================================================================
1071 static Standard_Integer DDataStd_DumpRelation (Draw_Interpretor& di,
1072 Standard_Integer nb, const char** arg)
1076 Handle(TDF_Data) DF;
1077 if (!DDF::GetDF(arg[1],DF)) return 1;
1080 if (!DDF::FindLabel(DF, arg[2], label))
1082 di << "No label for entry " << arg[2] << "\n";
1085 Handle(TDataStd_Relation) aR;
1086 if (!label.FindAttribute(TDataStd_Relation::GetID(), aR))
1088 di << "No TDataStd_Relation Attribute on label " << arg[2] << "\n";
1092 di << "Relation: expression = \"" << aR->GetRelation()
1093 << "\" variables list = (";
1095 Handle(TDF_Attribute) aV;
1096 TCollection_AsciiString anEntry;
1098 TDF_ListIteratorOfAttributeList it;
1099 for (it.Initialize(aR->GetVariables()); it.More(); it.Next())
1104 label = aV->Label();
1105 TDF_Tool::Entry(label, anEntry);
1106 di << anEntry.ToCString() << " ";
1112 di << "Usage: DumpRelation (DF, entry)\n";
1116 #include <TFunction_Function.hxx>
1117 //=======================================================================
1118 //function : SetFunction (DF, entry, guid, failure)
1119 //=======================================================================
1120 static Standard_Integer DDataStd_SetFunction (Draw_Interpretor& di,
1121 Standard_Integer nb, const char** arg)
1125 Handle(TDF_Data) DF;
1126 if (!DDF::GetDF(arg[1],DF)) return 1;
1128 DDF::AddLabel(DF, arg[2], label);
1130 Standard_GUID guid (arg[3]);
1131 Handle(TFunction_Function) aF = TFunction_Function::Set(label, guid);
1133 int fail = Draw::Atoi(arg[4]);
1134 aF->SetFailure(fail);
1139 di << "Wrong arguments" << "\n";
1143 //=======================================================================
1144 //function : GetFunction (DF, entry, guid(out), failure(out))
1145 //=======================================================================
1146 static Standard_Integer DDataStd_GetFunction (Draw_Interpretor& di,
1147 Standard_Integer nb, const char** arg)
1151 Handle(TDF_Data) DF;
1152 if (!DDF::GetDF(arg[1],DF)) return 1;
1154 if (!DDF::FindLabel(DF, arg[2], label))
1156 di << "No label for entry" << "\n";
1160 Handle(TFunction_Function) aF;
1161 if (!label.FindAttribute(TFunction_Function::GetID(), aF))
1163 di << "No TFunction_Function Attribute on label\n";
1167 char *aStrGUID = new char[37];
1168 aF->GetDriverGUID().ToCString(aStrGUID);
1169 Draw::Set(arg[3],aStrGUID);
1171 Draw::Set(arg[4],TCollection_AsciiString(aF->GetFailure()).ToCString());
1176 di << "Wrong arguments" << "\n";
1180 //=======================================================================
1181 //function : SetExtStringArray (DF, entry , isDelta, [-g Guid, ]From, To, elmt1, elmt2, ...
1182 //=======================================================================
1183 static Standard_Integer DDataStd_SetExtStringArray (Draw_Interpretor& di,
1184 Standard_Integer nb,
1188 Handle(TDF_Data) DF;
1189 if (!DDF::GetDF(arg[1],DF)) return 1;
1191 DDF::AddLabel(DF, arg[2], label);
1192 Standard_Boolean isDelta = Draw::Atoi(arg[3]) != 0;
1195 Standard_Boolean isGuid(Standard_False);
1196 Standard_Character c1(arg[4][0]), c2(arg[4][1]);
1197 if(c1 == '-' && c2 == 'g') { //guid
1198 if (!Standard_GUID::CheckGUIDFormat(arg[5])) {
1199 di<<"DDataStd_SetExtStringArray: The format of GUID is invalid\n";
1202 guid = Standard_GUID (arg[5]);
1203 isGuid = Standard_True;
1205 Standard_Integer j(4);
1207 if((strlen(arg[j]) > MAXLENGTH || strlen(arg[j+1]) > MAXLENGTH) ||
1208 !TCollection_AsciiString (arg[j]).IsIntegerValue() ||
1209 !TCollection_AsciiString (arg[j+1]).IsIntegerValue())
1211 di << "DDataStd_SetExtStringArray: From, To may be wrong\n";
1214 Standard_Integer From = Draw::Atoi(arg[j]), To = Draw::Atoi( arg[j+1] );
1215 di << "Array of ExtString with bounds from = " << From << " to = " << To << "\n";
1216 Handle(TDataStd_ExtStringArray) A;
1218 A = TDataStd_ExtStringArray::Set(label, From, To, isDelta);
1220 A = TDataStd_ExtStringArray::Set(label, guid, From, To, isDelta);
1222 if ((!isGuid && nb > 6) || (isGuid && nb > 8)) {
1224 for(Standard_Integer i = From; i<=To; ++i) {
1225 TCollection_ExtendedString aVal (arg[j], Standard_True);
1226 A->SetValue(i, aVal);
1232 di << "TDataStd_ExtStringArray: Error\n";
1236 //=======================================================================
1237 //function : SetExtStringArrayValue (DF, entry, index, value)
1238 //=======================================================================
1239 static Standard_Integer DDataStd_SetExtStringArrayValue (Draw_Interpretor&,
1244 Handle(TDF_Data) DF;
1245 if (!DDF::GetDF(arg[1], DF))
1250 if (!DDF::AddLabel(DF, arg[2], label))
1253 // Get index and value.
1254 Standard_Integer index = Draw::Atoi(arg[3]);
1257 Handle(TDataStd_ExtStringArray) arr;
1258 if (label.FindAttribute(TDataStd_ExtStringArray::GetID(), arr))
1260 TCollection_ExtendedString aVal(arg[4], Standard_True);
1261 arr->SetValue(index, aVal);
1268 //=======================================================================
1269 //function : GetExtStringArray (DF, entry )
1270 //=======================================================================
1271 static Standard_Integer DDataStd_GetExtStringArray (Draw_Interpretor& di,
1272 Standard_Integer nb,
1278 Handle(TDF_Data) DF;
1279 if (!DDF::GetDF(arg[1],DF)) return 1;
1281 if( !DDF::FindLabel(DF, arg[2], label) ) {
1282 di << "No label for entry" << "\n";
1285 Standard_GUID aGuid;
1287 if (Standard_GUID::CheckGUIDFormat(arg[3]))
1288 aGuid = Standard_GUID(arg[3]);
1290 di << "Wrong GUID format" << "\n";
1294 aGuid = TDataStd_ExtStringArray::GetID();
1295 Handle(TDataStd_ExtStringArray) A;
1296 if ( !label.FindAttribute(aGuid, A) ) {
1297 di << "There is no TDataStd_ExtStringArray with the specified GUID at the label" << "\n";
1301 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
1309 di << "DDataStd_GetExtStringArray: Error\n";
1313 //=======================================================================
1314 //function : GetExtStringArrayValue (DF, entry, index)
1315 //=======================================================================
1316 static Standard_Integer DDataStd_GetExtStringArrayValue (Draw_Interpretor& di,
1320 Handle(TDF_Data) DF;
1321 if (!DDF::GetDF(arg[1],DF))
1325 if (!DDF::FindLabel(DF, arg[2], label)) {
1326 di << "No label for entry" << "\n";
1330 Handle(TDataStd_ExtStringArray) A;
1331 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
1332 di << "There is no TDataStd_ExtStringArray under label" << "\n";
1336 Standard_Integer index = Draw::Atoi(arg[3]);
1337 if (index < A->Lower() || index > A->Upper()) {
1338 di << "Index is out of range\n";
1341 const TCollection_ExtendedString& value = A->Value(index);
1348 //=======================================================================
1349 //function : ChangeExtStrArray (DF, entry, indx, val )
1350 //=======================================================================
1351 static Standard_Integer DDataStd_ChangeExtStrArray (Draw_Interpretor& di,
1352 Standard_Integer nb,
1357 Handle(TDF_Data) DF;
1358 if (!DDF::GetDF(arg[1],DF)) return 1;
1360 if( !DDF::FindLabel(DF, arg[2], label) ) {
1361 di << "No label for entry" << "\n";
1365 Handle(TDataStd_ExtStringArray) A;
1366 if ( !label.FindAttribute(TDataStd_ExtStringArray::GetID(), A) ) {
1367 di << "There is no TDataStd_ExtStringArray at label" << "\n";
1370 Standard_Integer indx = Draw::Atoi(arg[3]);
1371 TCollection_ExtendedString val(arg[4]);
1372 Standard_Integer low = A->Lower(), up = A->Upper();
1373 if(low <= indx && indx <= up)
1374 A->SetValue(indx, val);//TColStd_HArray1OfExtendedString
1376 Handle(TColStd_HArray1OfExtendedString) Arr = A->Array();
1377 Handle(TColStd_HArray1OfExtendedString) arr;
1381 arr = new TColStd_HArray1OfExtendedString(low, up);
1382 for(i=low; i<= Arr->Upper(); i++)
1383 arr->SetValue(i, Arr->Value(i));
1384 for(i=Arr->Upper()+1; i<= up; i++) {
1386 arr->SetValue(i, val);
1388 arr->SetValue(i, 0);
1390 } else if(indx < up) {//clip array : indx to be negative
1392 arr = new TColStd_HArray1OfExtendedString(low, up);
1393 for(i=low; i< up; i++)
1394 arr->SetValue(i, Arr->Value(i));
1395 arr->SetValue(up, val);
1397 A->ChangeArray(arr);
1401 di << "DDataStd_ChangeExtStringArray: Error\n";
1406 //=======================================================================
1407 //function : DDataStd_KeepUTF
1408 //purpose : SetUTFName (DF, fatherEntry, fileName)
1409 //=======================================================================
1410 static Standard_Integer DDataStd_KeepUTF (Draw_Interpretor& di,
1411 Standard_Integer nb,
1415 Handle(TDF_Data) DF;
1416 if (!DDF::GetDF(arg[1],DF)) return 1;
1418 DDF::AddLabel(DF, arg[2], L);
1419 Standard_CString aFileName(arg[3]);
1422 std::ifstream anIS (aFileName, std::ios::in | std::ios::binary);
1424 std::ifstream anIS (aFileName);
1427 // Can not open file
1428 Message::SendFail() << "Error: can't open file " << aFileName;
1433 anIS.getline(buf, 1023,'\n');
1434 // 0xEFBBBF - prefix of UTF8
1435 p = &buf[3]; //skip prefix
1436 TCollection_ExtendedString aES1(p, Standard_True);
1437 TDataStd_Name::Set(L.NewChild(), aES1);
1440 while (anIS.good() && !anIS.eof()) {
1441 anIS.getline(buf, 1023,'\n');
1442 TCollection_ExtendedString aES2(buf, Standard_True);
1443 const TDF_Label& aLab = L.NewChild();
1444 TDataStd_Name::Set(aLab, aES2);
1448 di << "SetUTFName : String is not kept in DF\n";
1452 //=======================================================================
1453 //function : DDataStd_GetUTFtoFile
1454 //purpose : GetUTF (DF, fatherEntry, fileName)
1455 // : all strings from sub-labels of the <fatherEntry> concatenated
1456 // : in one, converted to UTF8 and kept in the file
1457 //=======================================================================
1458 static Standard_Integer DDataStd_GetUTFtoFile (Draw_Interpretor& di,
1459 Standard_Integer nb,
1463 Handle(TDF_Data) DF;
1464 if (!DDF::GetDF(arg[1],DF)) return 1;
1466 if (!DDF::FindLabel(DF,arg[2],L)) return 1;
1468 TCollection_ExtendedString aES;
1469 Standard_Boolean aF = Standard_False;
1470 TDF_ChildIterator anIt(L);
1471 for(;anIt.More();anIt.Next()) {
1472 const TDF_Label& aLab = anIt.Value();
1473 if(!aLab.IsNull()) {
1474 Handle(TDataStd_Name) anAtt;
1475 if(aLab.FindAttribute(TDataStd_Name::GetID(), anAtt)) {
1476 if(anAtt->Get().Length()) {
1487 Message::SendFail() << "Data is not found in the Document";
1491 Standard_CString aFileName(arg[3]);
1494 std::ofstream anOS (aFileName, std::ios::in | std::ios::binary | std::ios::ate);
1496 std::ofstream anOS (aFileName, std::ios::ate);
1499 // A problem with the stream
1501 std::cout << "Error: problem with the file stream, rdstate = " <<anOS.rdstate() <<std::endl;
1504 unsigned char prefix[4] = {0xEF,0xBB,0xBF, 0x00};
1505 anOS.write( (char*)&prefix[0], 3);
1506 Standard_Integer n = aES.LengthOfCString();
1507 Standard_PCharacter aCstr = (Standard_PCharacter) Standard::Allocate(n+1);
1508 n = aES.ToUTF8CString(aCstr);
1509 anOS.write( (char*)&aCstr[0], n);
1513 di << "GetUTF : Data is not extracted to the specified file \n";
1517 //=======================================================================
1518 //function : SetByteArray (DF, entry, isDelta, [-g Guid,] From, To, elmt1, elmt2, ... )
1519 //=======================================================================
1520 static Standard_Integer DDataStd_SetByteArray (Draw_Interpretor& di,
1521 Standard_Integer nb,
1525 Handle(TDF_Data) DF;
1526 if (!DDF::GetDF(arg[1],DF)) return 1;
1528 DDF::AddLabel(DF, arg[2], label);
1529 Standard_Boolean isDelta = Draw::Atoi(arg[3]) != 0;
1531 Standard_Boolean isGuid(Standard_False);
1532 Standard_Character c1(arg[4][0]), c2(arg[4][1]);
1533 if(c1 == '-' && c2 == 'g') { //guid
1534 if (!Standard_GUID::CheckGUIDFormat(arg[5])) {
1535 di<<"DDataStd_SetByteArray: The format of GUID is invalid\n";
1538 guid = Standard_GUID (arg[5]);
1539 isGuid = Standard_True;
1541 Standard_Integer j(4);
1543 if((strlen(arg[j]) > MAXLENGTH || strlen(arg[j+1]) > MAXLENGTH) ||
1544 !TCollection_AsciiString (arg[j]).IsIntegerValue() ||
1545 !TCollection_AsciiString (arg[j+1]).IsIntegerValue())
1547 di << "DDataStd_SetByteArray: From, To may be wrong\n";
1550 Standard_Integer From = Draw::Atoi(arg[j]), To = Draw::Atoi( arg[j+1] );
1551 di << "Array of Standard_Byte with bounds from = " << From << " to = " << To << "\n";
1552 Handle(TDataStd_ByteArray) A;
1554 A = TDataStd_ByteArray::Set(label, From, To, isDelta);
1556 A = TDataStd_ByteArray::Set(label, guid, From, To, isDelta);
1558 if ((!isGuid && nb > 6) || (isGuid && nb > 8)) {
1560 for(Standard_Integer i = From; i<=To; ++i) {
1561 Standard_Integer ival = Draw::Atoi(arg[j]);
1562 if(ival < 0 || 255 < ival) {
1563 Message::SendFail() << "Bad value = " << ival;
1566 A->SetValue(i, (Standard_Byte)ival);
1572 di << "DDataStd_SetByteArray: Error\n";
1576 //=======================================================================
1577 //function : SetByteArrayValue (DF, entry, index, value)
1578 //=======================================================================
1579 static Standard_Integer DDataStd_SetByteArrayValue (Draw_Interpretor&,
1584 Handle(TDF_Data) DF;
1585 if (!DDF::GetDF(arg[1], DF))
1590 if (!DDF::AddLabel(DF, arg[2], label))
1593 // Get index and value.
1594 Standard_Integer index = Draw::Atoi(arg[3]);
1595 Standard_Integer value = Draw::Atoi(arg[4]);
1598 if(value < 0 || 255 < value) {
1599 Message::SendFail() << "Bad value = " << value;
1604 Handle(TDataStd_ByteArray) arr;
1605 if (label.FindAttribute(TDataStd_ByteArray::GetID(), arr))
1607 arr->SetValue(index, (Standard_Byte) value);
1614 //=======================================================================
1615 //function : SetBooleanArray (DF, entry, [-g Guid,] From, To, elmt1, elmt2, ... )
1616 //=======================================================================
1617 static Standard_Integer DDataStd_SetBooleanArray (Draw_Interpretor& di,
1618 Standard_Integer nb,
1623 Handle(TDF_Data) DF;
1624 if (!DDF::GetDF(arg[1],DF))
1628 DDF::AddLabel(DF, arg[2], label);
1630 Standard_Boolean isGuid(Standard_False);
1631 Standard_Character c1(arg[3][0]), c2(arg[3][1]);
1632 if(c1 == '-' && c2 == 'g') { //guid
1633 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
1634 di<<"DDataStd_SetBooleanArray: The format of GUID is invalid\n";
1637 guid = Standard_GUID (arg[4]);
1638 isGuid = Standard_True;
1640 Standard_Integer j(3);
1642 if((strlen(arg[j]) > MAXLENGTH || strlen(arg[j+1]) > MAXLENGTH) ||
1643 !TCollection_AsciiString (arg[j]).IsIntegerValue() ||
1644 !TCollection_AsciiString (arg[j+1]).IsIntegerValue())
1646 di << "DDataStd_SetBooleanArray: From, To may be wrong\n";
1649 Standard_Integer From = Draw::Atoi(arg[j]), To = Draw::Atoi( arg[j+1] );
1650 di << "Array of Standard_Boolean with bounds from = " << From << " to = " << To << "\n";
1651 Handle(TDataStd_BooleanArray) A;
1653 A = TDataStd_BooleanArray::Set(label, From, To);
1655 A = TDataStd_BooleanArray::Set(label, guid, From, To);
1657 if ((!isGuid && nb > 5) || (isGuid && nb > 7)) {
1659 for(Standard_Integer i = From; i<=To; i++)
1661 Standard_Integer ival = Draw::Atoi(arg[j]);
1664 Message::SendFail() << "Bad value (" <<i <<") = " << ival<< ". 0 or 1 is expected.";
1667 A->SetValue(i, ival != 0);
1673 di << "DDataStd_SetBooleanArray: Error\n";
1677 //=======================================================================
1678 //function : SetBooleanArrayValue (DF, entry, index, value)
1679 //=======================================================================
1680 static Standard_Integer DDataStd_SetBooleanArrayValue (Draw_Interpretor& di,
1685 Handle(TDF_Data) DF;
1686 if (!DDF::GetDF(arg[1], DF))
1691 if (!DDF::AddLabel(DF, arg[2], label))
1694 // Get index and value.
1695 Standard_Integer index = Draw::Atoi(arg[3]);
1696 Standard_Integer value = Draw::Atoi(arg[4]);
1699 if (value != 0 && value != 1) {
1700 di << "DDataStd_SetBooleanArrayValue: Error! The value should be either 0 or 1.\n";
1705 Handle(TDataStd_BooleanArray) arr;
1706 if (label.FindAttribute(TDataStd_BooleanArray::GetID(), arr))
1708 arr->SetValue(index, value != 0);
1715 //=======================================================================
1716 //function : DDataStd_SetExtStringList (DF, entry, [-g guid,] elmt1, elmt2, ... )
1717 //=======================================================================
1718 static Standard_Integer DDataStd_SetExtStringList (Draw_Interpretor& di,
1719 Standard_Integer nb,
1724 Handle(TDF_Data) DF;
1725 if (!DDF::GetDF(arg[1],DF))
1729 DDF::AddLabel(DF, arg[2], label);
1731 Standard_Boolean isGuid(Standard_False);
1733 Standard_Character c1(arg[3][0]), c2(arg[3][1]);
1734 if(c1 == '-' && c2 == 'g') { //guid
1735 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
1736 di<<"DDataStd_SetExtStringList: The format of GUID is invalid\n";
1739 guid = Standard_GUID (arg[4]);
1740 isGuid = Standard_True;
1743 Standard_Integer j(0);
1744 Handle(TDataStd_ExtStringList) A;
1746 A = TDataStd_ExtStringList::Set(label);
1750 A = TDataStd_ExtStringList::Set(label, guid);
1753 for(Standard_Integer i = j; i <= nb - 1; i++)
1755 TCollection_ExtendedString aValue(arg[i]);
1760 di << "DDataStd_SetExtStringList: Error\n";
1764 //=======================================================================
1765 //function : DDataStd_SetReferenceList (DF, entry, [-g guid] elmt1, elmt2, ... )
1766 //=======================================================================
1767 static Standard_Integer DDataStd_SetReferenceList (Draw_Interpretor& di,
1768 Standard_Integer nb,
1773 Handle(TDF_Data) DF;
1774 if (!DDF::GetDF(arg[1],DF))
1778 DDF::AddLabel(DF, arg[2], label);
1780 Standard_Boolean isGuid(Standard_False);
1782 Standard_Character c1(arg[3][0]), c2(arg[3][1]);
1783 if(c1 == '-' && c2 == 'g') { //guid
1784 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
1785 di<<"DDataStd_SetReferenceList: The format of GUID is invalid\n";
1788 guid = Standard_GUID (arg[4]);
1789 isGuid = Standard_True;
1792 Standard_Integer j(0);
1793 Handle(TDataStd_ReferenceList) A;
1795 A = TDataStd_ReferenceList::Set(label);
1799 A = TDataStd_ReferenceList::Set(label, guid);
1802 for(Standard_Integer i = j; i <= nb - 1; i++)
1804 TDF_Label aValueLabel;
1805 DDF::AddLabel(DF, arg[i], aValueLabel);
1806 if(aValueLabel.IsNull()) continue;
1807 A->Append(aValueLabel);
1811 di << "DDataStd_SetReferenceList: Error\n";
1816 //=======================================================================
1817 //function : SetBooleanList (DF, entry, [-g Guid,] elmt1, elmt2, ... )
1818 //=======================================================================
1819 static Standard_Integer DDataStd_SetBooleanList (Draw_Interpretor& di,
1820 Standard_Integer nb,
1825 Handle(TDF_Data) DF;
1826 if (!DDF::GetDF(arg[1],DF))
1830 DDF::AddLabel(DF, arg[2], label);
1832 Standard_Boolean isGuid(Standard_False);
1834 Standard_Character c1(arg[3][0]), c2(arg[3][1]);
1835 if(c1 == '-' && c2 == 'g') { //guid
1836 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
1837 di<<"DDataStd_SetBooleanList: The format of GUID is invalid\n";
1840 guid = Standard_GUID (arg[4]);
1841 isGuid = Standard_True;
1844 Standard_Integer j(0);
1845 Handle(TDataStd_BooleanList) A;
1847 A = TDataStd_BooleanList::Set(label);
1851 A = TDataStd_BooleanList::Set(label, guid);
1854 for(Standard_Integer i = j; i <= nb - 1; i++)
1856 Standard_Integer ival = Draw::Atoi(arg[i]);
1859 Message::SendFail() << "Bad value = " << ival<< ". 0 or 1 is expected.";
1862 A->Append (ival != 0);
1866 di << "DDataStd_SetBooleanList: Error\n";
1870 //=======================================================================
1871 //function : SetIntegerList (DF, entry, [-g guid] elmt1, elmt2, ... )
1872 //=======================================================================
1873 static Standard_Integer DDataStd_SetIntegerList (Draw_Interpretor& di,
1874 Standard_Integer nb,
1879 Handle(TDF_Data) DF;
1880 if (!DDF::GetDF(arg[1],DF))
1884 DDF::AddLabel(DF, arg[2], label);
1886 Standard_Boolean isGuid(Standard_False);
1888 Standard_Character c1(arg[3][0]), c2(arg[3][1]);
1889 if(c1 == '-' && c2 == 'g') { //guid
1890 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
1891 di<<"DDataStd_SetIntegerList: The format of GUID is invalid\n";
1894 guid = Standard_GUID (arg[4]);
1895 isGuid = Standard_True;
1898 Standard_Integer j(0);
1899 Handle(TDataStd_IntegerList) A;
1901 A = TDataStd_IntegerList::Set(label);
1905 A = TDataStd_IntegerList::Set(label, guid);
1908 for(Standard_Integer i = j; i <= nb - 1; i++)
1910 Standard_Integer ival = Draw::Atoi(arg[i]);
1915 di << "DDataStd_SetIntegerList: Error\n";
1919 //=======================================================================
1920 //function : SetRealList (DF, entry, [-g guid,] elmt1, elmt2, ... )
1921 //=======================================================================
1922 static Standard_Integer DDataStd_SetRealList (Draw_Interpretor& di,
1923 Standard_Integer nb,
1928 Handle(TDF_Data) DF;
1929 if (!DDF::GetDF(arg[1],DF))
1933 DDF::AddLabel(DF, arg[2], label);
1935 Standard_Boolean isGuid(Standard_False);
1937 Standard_Character c1(arg[3][0]), c2(arg[3][1]);
1938 if(c1 == '-' && c2 == 'g') { //guid
1939 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
1940 di<<"DDataStd_SetRealList: The format of GUID is invalid\n";
1943 guid = Standard_GUID (arg[4]);
1944 isGuid = Standard_True;
1947 Standard_Integer j(0);
1948 Handle(TDataStd_RealList) A;
1950 A = TDataStd_RealList::Set(label);
1954 A = TDataStd_RealList::Set(label, guid);
1957 for(Standard_Integer i = j; i <= nb - 1; i++)
1959 Standard_Real fval = Draw::Atof(arg[i]);
1964 di << "DDataStd_SetRealList: Error\n";
1968 //=======================================================================
1969 //function : DDataStd_InsertBeforeExtStringList (DF, entry, index, value )
1970 //=======================================================================
1971 static Standard_Integer DDataStd_InsertBeforeExtStringList (Draw_Interpretor& di,
1972 Standard_Integer nb,
1977 Handle(TDF_Data) DF;
1978 if (!DDF::GetDF(arg[1],DF))
1982 DDF::AddLabel(DF, arg[2], label);
1984 Handle(TDataStd_ExtStringList) A;
1985 if (!label.FindAttribute(TDataStd_ExtStringList::GetID(), A))
1988 Standard_Integer index = Draw::Atoi(arg[3]);
1989 TCollection_ExtendedString value = arg[4];
1991 if (A->InsertBefore(index, value))
1996 di << "DDataStd_InsertBeforeExtStringList: Error\n";
2000 //=======================================================================
2001 //function : DDataStd_InsertAfterExtStringList (DF, entry, index, value )
2002 //=======================================================================
2003 static Standard_Integer DDataStd_InsertAfterExtStringList (Draw_Interpretor& di,
2004 Standard_Integer nb,
2009 Handle(TDF_Data) DF;
2010 if (!DDF::GetDF(arg[1],DF))
2014 DDF::AddLabel(DF, arg[2], label);
2016 Handle(TDataStd_ExtStringList) A;
2017 if (!label.FindAttribute(TDataStd_ExtStringList::GetID(), A))
2020 Standard_Integer index = Draw::Atoi(arg[3]);
2021 TCollection_ExtendedString value = arg[4];
2023 if (A->InsertAfter(index, value))
2028 di << "DDataStd_InsertAfterExtStringList: Error\n";
2032 //=======================================================================
2033 //function : DDataStd_RemoveExtStringList (DF, entry, index )
2034 //=======================================================================
2035 static Standard_Integer DDataStd_RemoveExtStringList (Draw_Interpretor& di,
2036 Standard_Integer nb,
2041 Handle(TDF_Data) DF;
2042 if (!DDF::GetDF(arg[1],DF))
2046 DDF::AddLabel(DF, arg[2], label);
2048 Handle(TDataStd_ExtStringList) A;
2049 if (!label.FindAttribute(TDataStd_ExtStringList::GetID(), A))
2052 Standard_Integer index = Draw::Atoi(arg[3]);
2054 if (A->Remove(index))
2059 di << "DDataStd_RemoveExtStringList: Error\n";
2063 //=======================================================================
2064 //function : DDataStd_InsertBeforeBooleanList (DF, entry, index, value )
2065 //=======================================================================
2066 static Standard_Integer DDataStd_InsertBeforeBooleanList (Draw_Interpretor& di,
2067 Standard_Integer nb,
2072 Handle(TDF_Data) DF;
2073 if (!DDF::GetDF(arg[1],DF))
2077 DDF::AddLabel(DF, arg[2], label);
2079 Handle(TDataStd_BooleanList) A;
2080 if (!label.FindAttribute(TDataStd_BooleanList::GetID(), A))
2083 Standard_Integer index = Draw::Atoi(arg[3]);
2084 Standard_Boolean value = Draw::Atoi(arg[4]) != 0;
2086 if (A->InsertBefore(index, value))
2091 di << "DDataStd_InsertBeforeBooleanList: Error\n";
2095 //=======================================================================
2096 //function : DDataStd_InsertAfterBooleanList (DF, entry, index, value )
2097 //=======================================================================
2098 static Standard_Integer DDataStd_InsertAfterBooleanList (Draw_Interpretor& di,
2099 Standard_Integer nb,
2104 Handle(TDF_Data) DF;
2105 if (!DDF::GetDF(arg[1],DF))
2109 DDF::AddLabel(DF, arg[2], label);
2111 Handle(TDataStd_BooleanList) A;
2112 if (!label.FindAttribute(TDataStd_BooleanList::GetID(), A))
2115 Standard_Integer index = Draw::Atoi(arg[3]);
2116 Standard_Boolean value = Draw::Atoi(arg[4]) != 0;
2118 if (A->InsertAfter(index, value))
2123 di << "DDataStd_InsertAfterBooleanList: Error\n";
2127 //=======================================================================
2128 //function : DDataStd_RemoveBooleanList (DF, entry, index )
2129 //=======================================================================
2130 static Standard_Integer DDataStd_RemoveBooleanList (Draw_Interpretor& di,
2131 Standard_Integer nb,
2136 Handle(TDF_Data) DF;
2137 if (!DDF::GetDF(arg[1],DF))
2141 DDF::AddLabel(DF, arg[2], label);
2143 Handle(TDataStd_BooleanList) A;
2144 if (!label.FindAttribute(TDataStd_BooleanList::GetID(), A))
2147 Standard_Integer index = Draw::Atoi(arg[3]);
2149 if (A->Remove(index))
2154 di << "DDataStd_RemoveBooleanList: Error\n";
2158 //=======================================================================
2159 //function : DDataStd_InsertBeforeIntegerList (DF, entry, index, value )
2160 //=======================================================================
2161 static Standard_Integer DDataStd_InsertBeforeIntegerList (Draw_Interpretor& di,
2162 Standard_Integer nb,
2167 Handle(TDF_Data) DF;
2168 if (!DDF::GetDF(arg[1],DF))
2172 DDF::AddLabel(DF, arg[2], label);
2174 Handle(TDataStd_IntegerList) A;
2175 if (!label.FindAttribute(TDataStd_IntegerList::GetID(), A))
2178 Standard_Integer index = Draw::Atoi(arg[3]);
2179 Standard_Integer value = (Standard_Integer) Draw::Atoi(arg[4]);
2181 if (A->InsertBeforeByIndex(index, value))
2186 di << "DDataStd_InsertBeforeIntegerList: Error\n";
2190 //=======================================================================
2191 //function : DDataStd_InsertAfterIntegerList (DF, entry, index, value )
2192 //=======================================================================
2193 static Standard_Integer DDataStd_InsertAfterIntegerList (Draw_Interpretor& di,
2194 Standard_Integer nb,
2199 Handle(TDF_Data) DF;
2200 if (!DDF::GetDF(arg[1],DF))
2204 DDF::AddLabel(DF, arg[2], label);
2206 Handle(TDataStd_IntegerList) A;
2207 if (!label.FindAttribute(TDataStd_IntegerList::GetID(), A))
2210 Standard_Integer index = Draw::Atoi(arg[3]);
2211 Standard_Integer value = (Standard_Integer) Draw::Atoi(arg[4]);
2213 if (A->InsertAfterByIndex(index, value))
2218 di << "DDataStd_InsertAfterIntegerList: Error\n";
2222 //=======================================================================
2223 //function : DDataStd_RemoveIntegerList (DF, entry, index )
2224 //=======================================================================
2225 static Standard_Integer DDataStd_RemoveIntegerList (Draw_Interpretor& di,
2226 Standard_Integer nb,
2231 Handle(TDF_Data) DF;
2232 if (!DDF::GetDF(arg[1],DF))
2236 DDF::AddLabel(DF, arg[2], label);
2238 Handle(TDataStd_IntegerList) A;
2239 if (!label.FindAttribute(TDataStd_IntegerList::GetID(), A))
2242 Standard_Integer index = Draw::Atoi(arg[3]);
2244 if (A->RemoveByIndex(index))
2249 di << "DDataStd_RemoveIntegerList: Error\n";
2253 //=======================================================================
2254 //function : DDataStd_InsertBeforeRealList (DF, entry, index, value )
2255 //=======================================================================
2256 static Standard_Integer DDataStd_InsertBeforeRealList (Draw_Interpretor& di,
2257 Standard_Integer nb,
2262 Handle(TDF_Data) DF;
2263 if (!DDF::GetDF(arg[1],DF))
2267 DDF::AddLabel(DF, arg[2], label);
2269 Handle(TDataStd_RealList) A;
2270 if (!label.FindAttribute(TDataStd_RealList::GetID(), A))
2273 Standard_Integer index = Draw::Atoi(arg[3]);
2274 Standard_Real value = (Standard_Real) Draw::Atof(arg[4]);
2276 if (A->InsertBeforeByIndex(index, value))
2281 di << "DDataStd_InsertBeforeRealList: Error\n";
2285 //=======================================================================
2286 //function : DDataStd_InsertAfterRealList (DF, entry, index, value )
2287 //=======================================================================
2288 static Standard_Integer DDataStd_InsertAfterRealList (Draw_Interpretor& di,
2289 Standard_Integer nb,
2294 Handle(TDF_Data) DF;
2295 if (!DDF::GetDF(arg[1],DF))
2299 DDF::AddLabel(DF, arg[2], label);
2301 Handle(TDataStd_RealList) A;
2302 if (!label.FindAttribute(TDataStd_RealList::GetID(), A))
2305 Standard_Integer index = Draw::Atoi(arg[3]);
2306 Standard_Real value = (Standard_Real) Draw::Atof(arg[4]);
2308 if (A->InsertAfterByIndex(index, value))
2313 di << "DDataStd_InsertAfterRealList: Error\n";
2317 //=======================================================================
2318 //function : DDataStd_RemoveRealList (DF, entry, index )
2319 //=======================================================================
2320 static Standard_Integer DDataStd_RemoveRealList (Draw_Interpretor& di,
2321 Standard_Integer nb,
2326 Handle(TDF_Data) DF;
2327 if (!DDF::GetDF(arg[1],DF))
2331 DDF::AddLabel(DF, arg[2], label);
2333 Handle(TDataStd_RealList) A;
2334 if (!label.FindAttribute(TDataStd_RealList::GetID(), A))
2337 Standard_Integer index = Draw::Atoi(arg[3]);
2339 if (A->RemoveByIndex(index))
2344 di << "DDataStd_RemoveRealList: Error\n";
2348 //=======================================================================
2349 //function : DDataStd_InsertBeforeReferenceList (DF, entry, index, value )
2350 //=======================================================================
2351 static Standard_Integer DDataStd_InsertBeforeReferenceList (Draw_Interpretor& di,
2352 Standard_Integer nb,
2357 Handle(TDF_Data) DF;
2358 if (!DDF::GetDF(arg[1],DF))
2362 DDF::AddLabel(DF, arg[2], label);
2364 Handle(TDataStd_ReferenceList) A;
2365 if (!label.FindAttribute(TDataStd_ReferenceList::GetID(), A))
2368 Standard_Integer index = Draw::Atoi(arg[3]);
2371 if (!DDF::AddLabel(DF, arg[4], refLabel))
2374 if (A->InsertBefore(index, refLabel))
2379 di << "DDataStd_InsertBeforeReferenceList: Error\n";
2383 //=======================================================================
2384 //function : DDataStd_InsertAfterReferenceList (DF, entry, index, value )
2385 //=======================================================================
2386 static Standard_Integer DDataStd_InsertAfterReferenceList (Draw_Interpretor& di,
2387 Standard_Integer nb,
2392 Handle(TDF_Data) DF;
2393 if (!DDF::GetDF(arg[1],DF))
2397 DDF::AddLabel(DF, arg[2], label);
2399 Handle(TDataStd_ReferenceList) A;
2400 if (!label.FindAttribute(TDataStd_ReferenceList::GetID(), A))
2403 Standard_Integer index = Draw::Atoi(arg[3]);
2406 if (!DDF::AddLabel(DF, arg[4], refLabel))
2409 if (A->InsertAfter(index, refLabel))
2414 di << "DDataStd_InsertAfterReferenceList: Error\n";
2418 //=======================================================================
2419 //function : DDataStd_RemoveReferenceList (DF, entry, index )
2420 //=======================================================================
2421 static Standard_Integer DDataStd_RemoveReferenceList (Draw_Interpretor& di,
2422 Standard_Integer nb,
2427 Handle(TDF_Data) DF;
2428 if (!DDF::GetDF(arg[1],DF))
2432 DDF::AddLabel(DF, arg[2], label);
2434 Handle(TDataStd_ReferenceList) A;
2435 if (!label.FindAttribute(TDataStd_ReferenceList::GetID(), A))
2438 Standard_Integer index = Draw::Atoi(arg[3]);
2440 if (A->Remove(index))
2445 di << "DDataStd_RemoveReferenceList: Error\n";
2449 //=======================================================================
2450 //function : GetByteArray (DF, entry [, guid] )
2451 //=======================================================================
2452 static Standard_Integer DDataStd_GetByteArray (Draw_Interpretor& di,
2453 Standard_Integer nb,
2458 Handle(TDF_Data) DF;
2459 if (!DDF::GetDF(arg[1],DF)) return 1;
2461 if( !DDF::FindLabel(DF, arg[2], label) ) {
2462 di << "No label for entry" << "\n";
2465 Standard_GUID aGuid;
2467 if (Standard_GUID::CheckGUIDFormat(arg[3]))
2468 aGuid = Standard_GUID(arg[3]);
2470 di << "Wrong GUID format" << "\n";
2474 aGuid = TDataStd_ByteArray::GetID();
2475 Handle(TDataStd_ByteArray) A;
2476 if ( !label.FindAttribute(aGuid, A) ) {
2477 di << "There is no TDataStd_ByteArray with the specified GUID at the label" << "\n";
2481 for(Standard_Integer i = A->Lower(); i<=A->Upper(); i++){
2489 di << "DDataStd_GetByteArray: Error\n";
2493 //=======================================================================
2494 //function : GetByteArrayValue (DF, entry, index)
2495 //=======================================================================
2496 static Standard_Integer DDataStd_GetByteArrayValue (Draw_Interpretor& di,
2500 Handle(TDF_Data) DF;
2501 if (!DDF::GetDF(arg[1],DF))
2505 if (!DDF::FindLabel(DF, arg[2], label)) {
2506 di << "No label for entry" << "\n";
2510 Handle(TDataStd_ByteArray) A;
2511 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
2512 di << "There is no TDataStd_ByteArray under label" << "\n";
2516 Standard_Integer index = Draw::Atoi(arg[3]);
2517 if (index < A->Lower() || index > A->Upper()) {
2518 di << "Index is out of range\n";
2521 di << A->Value(index) << "\n";
2527 //=======================================================================
2528 //function : GetBooleanArray (DF, entry [, guid] )
2529 //=======================================================================
2530 static Standard_Integer DDataStd_GetBooleanArray (Draw_Interpretor& di,
2531 Standard_Integer nb,
2536 Handle(TDF_Data) DF;
2537 if (!DDF::GetDF(arg[1],DF))
2541 if ( !DDF::FindLabel(DF, arg[2], label) )
2543 di << "No label for entry" << "\n";
2546 Standard_GUID aGuid;
2548 if (Standard_GUID::CheckGUIDFormat(arg[3]))
2549 aGuid = Standard_GUID(arg[3]);
2551 di << "Wrong GUID format" << "\n";
2555 aGuid = TDataStd_BooleanArray::GetID();
2557 Handle(TDataStd_BooleanArray) A;
2558 if ( !label.FindAttribute(aGuid, A) )
2560 di << "There is no TDataStd_BooleanArray at label" << "\n";
2564 for (Standard_Integer i = A->Lower(); i<=A->Upper(); i++)
2566 di << (Standard_Integer) A->Value(i);
2573 di << "DDataStd_GetBooleanArray: Error\n";
2577 //=======================================================================
2578 //function : GetBooleanArrayValue (DF, entry, index)
2579 //=======================================================================
2580 static Standard_Integer DDataStd_GetBooleanArrayValue (Draw_Interpretor& di,
2584 Handle(TDF_Data) DF;
2585 if (!DDF::GetDF(arg[1],DF))
2589 if (!DDF::FindLabel(DF, arg[2], label)) {
2590 di << "No label for entry" << "\n";
2594 Handle(TDataStd_BooleanArray) A;
2595 if ( !label.FindAttribute(TDataStd_BooleanArray::GetID(), A) ) {
2596 di << "There is no TDataStd_BooleanArray under label" << "\n";
2600 Standard_Integer index = Draw::Atoi(arg[3]);
2601 if (index < A->Lower() || index > A->Upper()) {
2602 di << "Index is out of range\n";
2605 di << ((A->Value(index) == Standard_True) ? "True" : "False") << "\n";
2611 //=======================================================================
2612 //function : ChangeByteArray (DF, entry, indx, val )
2613 //=======================================================================
2614 static Standard_Integer DDataStd_ChangeByteArray (Draw_Interpretor& di,
2615 Standard_Integer nb,
2620 Handle(TDF_Data) DF;
2621 if (!DDF::GetDF(arg[1],DF)) return 1;
2623 if( !DDF::FindLabel(DF, arg[2], label) ) {
2624 di << "No label for entry" << "\n";
2628 Handle(TDataStd_ByteArray) A;
2629 if ( !label.FindAttribute(TDataStd_ByteArray::GetID(), A) ) {
2630 di << "There is no TDataStd_ByteArray at label" << "\n";
2633 Standard_Integer indx = Draw::Atoi(arg[3]);
2634 Standard_Integer ival = Draw::Atoi(arg[4]);
2635 if (ival > 255 || ival < 0) {
2636 di << "DDataStd_ChangeByteArray: Bad value = " <<ival << "\n";
2639 Standard_Integer low = A->Lower(), up = A->Upper();
2640 if(low <= indx && indx <= up)
2641 A->SetValue(indx, (Standard_Byte)ival);
2643 Handle(TColStd_HArray1OfByte) Arr = A->InternalArray();
2644 Handle(TColStd_HArray1OfByte) arr;
2648 arr = new TColStd_HArray1OfByte(low, up);
2649 for(i=low; i<= Arr->Upper(); i++)
2650 arr->SetValue(i, Arr->Value(i));
2651 for(i=Arr->Upper()+1; i<= up; i++) {
2653 arr->SetValue(i, (Standard_Byte)ival);
2655 arr->SetValue(i, 0);
2657 } else if(indx < up) {//clip array : indx to be negative
2659 arr = new TColStd_HArray1OfByte(low, up);
2660 for(i=low; i< up; i++)
2661 arr->SetValue(i, Arr->Value(i));
2662 arr->SetValue(up, (Standard_Byte)ival);
2664 A->ChangeArray(arr);
2668 di << "DDataStd_ChangeByteArray: Error\n";
2672 //=======================================================================
2673 //function : GetBooleanList (DF, entry [, guid])
2674 //=======================================================================
2675 static Standard_Integer DDataStd_GetBooleanList (Draw_Interpretor& di,
2676 Standard_Integer nb,
2680 Handle(TDF_Data) DF;
2681 if (!DDF::GetDF(arg[1],DF))
2685 if ( !DDF::FindLabel(DF, arg[2], label) )
2687 di << "No label for entry" << "\n";
2690 Standard_GUID aGuid;
2692 if (Standard_GUID::CheckGUIDFormat(arg[3]))
2693 aGuid = Standard_GUID(arg[3]);
2695 di << "Wrong GUID format" << "\n";
2699 aGuid = TDataStd_BooleanList::GetID();
2701 Handle(TDataStd_BooleanList) A;
2702 if ( !label.FindAttribute(aGuid, A) )
2704 di << "There is no TDataStd_BooleanList with the specified Guid at the label" << "\n";
2708 const TDataStd_ListOfByte& bList = A->List();
2709 Standard_Boolean isEmpty = (bList.Extent() > 0) ? Standard_False : Standard_True;
2711 TDataStd_ListIteratorOfListOfByte itr(bList);
2712 for (; itr.More(); itr.Next())
2714 di << (Standard_Integer) itr.Value() << " ";
2718 di << "List is empty\n";
2721 di << "DDataStd_GetBooleanList: Error\n";
2725 //=======================================================================
2726 //function : GetIntegerList (DF, entry [, guid])
2727 //=======================================================================
2728 static Standard_Integer DDataStd_GetIntegerList (Draw_Interpretor& di,
2729 Standard_Integer nb,
2733 Handle(TDF_Data) DF;
2734 if (!DDF::GetDF(arg[1],DF))
2738 if ( !DDF::FindLabel(DF, arg[2], label) )
2740 di << "No label for entry" << "\n";
2743 Standard_GUID aGuid;
2745 if (Standard_GUID::CheckGUIDFormat(arg[3]))
2746 aGuid = Standard_GUID(arg[3]);
2748 di << "Wrong GUID format" << "\n";
2752 aGuid = TDataStd_IntegerList::GetID();
2754 Handle(TDataStd_IntegerList) A;
2755 if ( !label.FindAttribute(aGuid, A) )
2757 di << "There is no TDataStd_IntegerList with the specified GUID at the label" << "\n";
2761 const TColStd_ListOfInteger& iList = A->List();
2762 Standard_Boolean isEmpty = (iList.Extent() > 0) ? Standard_False : Standard_True;
2764 TColStd_ListIteratorOfListOfInteger itr(iList);
2765 for (; itr.More(); itr.Next())
2767 di << itr.Value() << " ";
2771 di << "List is empty\n";
2775 di << "DDataStd_GetIntegerList: Error\n";
2779 //=======================================================================
2780 //function : GetRealList (DF, entry [, guid])
2781 //=======================================================================
2782 static Standard_Integer DDataStd_GetRealList (Draw_Interpretor& di,
2783 Standard_Integer nb,
2787 Handle(TDF_Data) DF;
2788 if (!DDF::GetDF(arg[1],DF))
2792 if ( !DDF::FindLabel(DF, arg[2], label) )
2794 di << "No label for entry" << "\n";
2797 Standard_GUID aGuid;
2799 if (Standard_GUID::CheckGUIDFormat(arg[3]))
2800 aGuid = Standard_GUID(arg[3]);
2802 di << "Wrong GUID format" << "\n";
2806 aGuid = TDataStd_RealList::GetID();
2808 Handle(TDataStd_RealList) A;
2809 if ( !label.FindAttribute(aGuid, A) )
2811 di << "There is no TDataStd_RealList with the specified GUID at the label" << "\n";
2815 const TColStd_ListOfReal& rList = A->List();
2816 Standard_Boolean isEmpty = (rList.Extent() > 0) ? Standard_False : Standard_True;
2818 TColStd_ListIteratorOfListOfReal itr(rList);
2819 for (; itr.More(); itr.Next())
2821 di << itr.Value() << " ";
2825 di << "List is empty\n";
2828 di << "DDataStd_GetRealList: Error\n";
2832 //=======================================================================
2833 //function : DDataStd_GetExtStringList (DF, entry [, guid])
2834 //=======================================================================
2835 static Standard_Integer DDataStd_GetExtStringList (Draw_Interpretor& di,
2836 Standard_Integer nb,
2841 Handle(TDF_Data) DF;
2842 if (!DDF::GetDF(arg[1],DF))
2846 if ( !DDF::FindLabel(DF, arg[2], label) )
2848 di << "No label for entry" << "\n";
2851 Standard_GUID aGuid;
2853 if (Standard_GUID::CheckGUIDFormat(arg[3]))
2854 aGuid = Standard_GUID(arg[3]);
2856 di << "Wrong GUID format" << "\n";
2860 aGuid = TDataStd_ExtStringList::GetID();
2862 Handle(TDataStd_ExtStringList) A;
2863 if ( !label.FindAttribute(aGuid, A) )
2865 di << "There is no TDataStd_ExtStringList at label" << "\n";
2869 const TDataStd_ListOfExtendedString& aList = A->List();
2870 Standard_Boolean isEmpty = (aList.Extent() > 0) ? Standard_False : Standard_True;
2872 TDataStd_ListIteratorOfListOfExtendedString itr(aList);
2873 for (; itr.More(); itr.Next())
2875 const TCollection_ExtendedString& aStr = itr.Value();
2881 di << "List is empty\n";
2885 di << "DDataStd_GetExtStringList: Error\n";
2889 //=======================================================================
2890 //function : DDataStd_GetReferenceList (DF, entry [, guid])
2891 //=======================================================================
2892 static Standard_Integer DDataStd_GetReferenceList (Draw_Interpretor& di,
2893 Standard_Integer nb,
2898 Handle(TDF_Data) DF;
2899 if (!DDF::GetDF(arg[1],DF))
2903 if ( !DDF::FindLabel(DF, arg[2], label) )
2905 di << "No label for entry" << "\n";
2908 Standard_GUID aGuid;
2910 if (Standard_GUID::CheckGUIDFormat(arg[3]))
2911 aGuid = Standard_GUID(arg[3]);
2913 di << "Wrong GUID format" << "\n";
2917 aGuid = TDataStd_ReferenceList::GetID();
2919 Handle(TDataStd_ReferenceList) A;
2920 if ( !label.FindAttribute(aGuid, A) )
2922 di << "There is no TDataStd_ReferenceList [with the specified guid] at the label" << "\n";
2926 const TDF_LabelList& aList = A->List();
2927 Standard_Boolean isEmpty = (aList.Extent() > 0) ? Standard_False : Standard_True;
2929 TDF_ListIteratorOfLabelList itr(aList);
2930 for (; itr.More(); itr.Next())
2932 const TDF_Label& aLabel = itr.Value();
2933 if (!aLabel.IsNull()) {
2934 TCollection_AsciiString entry;
2935 TDF_Tool::Entry(aLabel, entry);
2936 di << entry.ToCString() << " ";
2941 di << "List is empty\n";
2944 di << "DDataStd_GetReferenceList: Error\n";
2948 //=======================================================================
2949 //function : SetIntPackedMap (DF, entry, isDelta, key1, key2, ...
2950 //=======================================================================
2952 static Standard_Integer DDataStd_SetIntPackedMap (Draw_Interpretor& di,
2953 Standard_Integer nb,
2958 Handle(TDF_Data) DF;
2959 if (!DDF::GetDF(arg[1],DF)) return 1;
2961 DDF::AddLabel(DF, arg[2], aLabel);
2962 Standard_Boolean isDelta = Draw::Atoi(arg[3]) != 0;
2963 Standard_Integer aNum = nb - 4;
2964 Handle(TDataStd_IntPackedMap) anAtt;
2965 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
2966 anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta);
2967 if(anAtt.IsNull()) {
2968 di << "IntPackedMap attribute is not found or not set" << "\n";
2971 Standard_Integer j = 4;
2972 TColStd_PackedMapOfInteger aMap;
2973 for(Standard_Integer i = 1; i<=aNum; i++) {
2974 aMap.Add (Draw::Atoi(arg[j]));
2977 const Handle(TColStd_HPackedMapOfInteger)& aHMap = new TColStd_HPackedMapOfInteger(aMap);
2978 anAtt->ChangeMap(aHMap);
2979 std::cout << "Map extent = " << anAtt->Extent()<<std::endl;
2982 di << "DDataStd_SetIntPackedMap : Error\n";
2986 //=======================================================================
2987 //function : GetIntPackedMap (DF, entry )
2988 //=======================================================================
2990 static Standard_Integer DDataStd_GetIntPackedMap (Draw_Interpretor& di,
2991 Standard_Integer nb,
2996 Handle(TDF_Data) DF;
2997 if (!DDF::GetDF(arg[1],DF)) return 1;
2999 DDF::AddLabel(DF, arg[2], aLabel);
3000 Handle(TDataStd_IntPackedMap) anAtt;
3001 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt)) {
3002 di << "IntPackedMap attribute is not found or not set" << "\n";
3005 const TColStd_PackedMapOfInteger& aMap = anAtt->GetMap();
3006 TColStd_MapIteratorOfPackedMapOfInteger itr(aMap);
3007 for (Standard_Integer j = 1; itr.More(); itr.Next(),j++){
3008 Standard_Integer aKey(itr.Key());
3013 di << "DDataStd_GetIntPackedMap : Error\n";
3018 //=======================================================================
3019 //function : ChangeIntPackedMap_Add (DF, entry, Key1, Key2,... )
3020 //=======================================================================
3021 static Standard_Integer DDataStd_ChangeIntPackedMap_Add (Draw_Interpretor& di,
3022 Standard_Integer nb,
3027 Handle(TDF_Data) DF;
3028 if (!DDF::GetDF(arg[1],DF)) return 1;
3030 if( !DDF::FindLabel(DF, arg[2], label) ) {
3031 di << "No label for entry" << "\n";
3035 Handle(TDataStd_IntPackedMap) A;
3036 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
3037 di << "There is no TDataStd_IntPackedMap at label" << "\n";
3041 Standard_Integer i, aNum = nb - 3;
3042 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
3043 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
3044 if(!aHMap.IsNull()) {
3045 ahMap->ChangeMap().Assign(aHMap->Map());
3046 for(i=1; i<=aNum;i++) {
3047 Standard_Integer val = Draw::Atoi(arg[i+2]);
3048 if(!ahMap->Map().Contains(val))
3049 ahMap->ChangeMap().Add(val);
3052 A->ChangeMap(ahMap);
3056 di << "DDataStd_ChangeIntPackedMap_Add: Error\n";
3061 //=======================================================================
3062 //function : ChangeIntPackedMap_Rem (DF, entry, Key1, Key2,... )
3063 //=======================================================================
3064 static Standard_Integer DDataStd_ChangeIntPackedMap_Rem (Draw_Interpretor& di,
3065 Standard_Integer nb,
3070 Handle(TDF_Data) DF;
3071 if (!DDF::GetDF(arg[1],DF)) return 1;
3073 if( !DDF::FindLabel(DF, arg[2], label) ) {
3074 di << "No label for entry" << "\n";
3078 Handle(TDataStd_IntPackedMap) A;
3079 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
3080 di << "There is no TDataStd_IntPackedMap at label" << "\n";
3084 Standard_Integer i, aNum = nb - 3;
3085 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
3086 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
3087 if(!aHMap.IsNull()) {
3088 ahMap->ChangeMap().Assign(aHMap->Map());
3089 for(i=1; i<=aNum;i++) {
3090 Standard_Integer val = Draw::Atoi(arg[i+2]);
3091 if(ahMap->Map().Contains(val))
3092 ahMap->ChangeMap().Remove(val);
3095 A->ChangeMap(ahMap);
3099 di << "DDataStd_ChangeIntPackedMap_Rem: Error\n";
3103 //=======================================================================
3104 //function : ChangeIntPackedMap_AddRem (DF, entry, Key1, Key2,... )
3105 // : if Keyi exist in map - remove it, if no - add
3106 //=======================================================================
3107 static Standard_Integer DDataStd_ChangeIntPackedMap_AddRem (Draw_Interpretor& di,
3108 Standard_Integer nb,
3113 Handle(TDF_Data) DF;
3114 if (!DDF::GetDF(arg[1],DF)) return 1;
3116 if( !DDF::FindLabel(DF, arg[2], label) ) {
3117 di << "No label for entry" << "\n";
3121 Handle(TDataStd_IntPackedMap) A;
3122 if ( !label.FindAttribute(TDataStd_IntPackedMap::GetID(), A) ) {
3123 di << "There is no TDataStd_IntPackedMap at label" << "\n";
3127 Standard_Integer i, aNum = nb - 3;
3128 Handle(TColStd_HPackedMapOfInteger) aHMap = A->GetHMap();
3129 Handle(TColStd_HPackedMapOfInteger) ahMap = new TColStd_HPackedMapOfInteger();
3130 if(!aHMap.IsNull()) {
3131 ahMap->ChangeMap().Assign(aHMap->Map());
3132 for(i=1; i<=aNum;i++) {
3133 Standard_Integer val = Draw::Atoi(arg[i+2]);
3134 if(!ahMap->Map().Contains(val))
3135 ahMap->ChangeMap().Add(val);
3137 ahMap->ChangeMap().Remove(val);
3140 A->ChangeMap(ahMap);
3144 di << "DDataStd_ChangeIntPackedMap_AddRem: Error\n";
3148 //=======================================================================
3149 //function : SetIntPHugeMap (DF, entry, isDelta Num)
3150 //=======================================================================
3152 static Standard_Integer DDataStd_SetIntPHugeMap (Draw_Interpretor& di,
3153 Standard_Integer nb,
3158 Handle(TDF_Data) DF;
3159 if (!DDF::GetDF(arg[1],DF)) return 1;
3161 DDF::AddLabel(DF, arg[2], aLabel);
3162 Standard_Boolean isDelta = Draw::Atoi(arg[3]) != 0;
3163 Standard_Integer aNum = Draw::Atoi(arg[4]);
3164 Handle(TDataStd_IntPackedMap) anAtt;
3165 if(!aLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
3166 anAtt = TDataStd_IntPackedMap::Set(aLabel, isDelta);
3167 if(anAtt.IsNull()) {
3168 di << "IntPackedMap attribute is not found or not set" << "\n";
3171 TColStd_PackedMapOfInteger aMap;
3172 for(Standard_Integer i = 1; i<=aNum; i++) {
3175 const Handle(TColStd_HPackedMapOfInteger)& aHMap = new TColStd_HPackedMapOfInteger(aMap);
3176 anAtt->ChangeMap(aHMap);
3177 std::cout << "Map extent = " << anAtt->Extent()<<std::endl;
3180 di << "DDataStd_SetIntPHugeMap : Error\n";
3184 //=======================================================================
3185 //function : SetNDataIntegers (DF, entry , Num
3186 //=======================================================================
3188 static Standard_Integer DDataStd_SetNDataIntegers2 (Draw_Interpretor& di,
3189 Standard_Integer nb,
3194 Handle(TDF_Data) DF;
3195 if (!DDF::GetDF(arg[1],DF)) return 1;
3197 DDF::AddLabel(DF, arg[2], aLabel);
3198 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
3199 Handle(TDataStd_NamedData) anAtt;
3200 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3201 anAtt = TDataStd_NamedData::Set(aLabel);
3202 if(anAtt.IsNull()) {
3203 di << "NamedData attribute is not found or not set" << "\n";
3207 TCollection_ExtendedString aKey("Key_");
3208 anAtt->LoadDeferredData();
3209 for(Standard_Integer i = 1; i<=aNumP; i++) {
3210 TCollection_ExtendedString key = aKey + i;
3211 Standard_Integer aVal = j+i;
3212 anAtt->SetInteger(key, aVal);
3217 di << "DDataStd_SetNDataIntegers2 : Error\n";
3221 //=======================================================================
3222 //function : SetNDataIntArrays2 (DF, entry , key, NumOfArElem )
3223 //=======================================================================
3225 static Standard_Integer DDataStd_SetNDataIntAr2 (Draw_Interpretor& di,
3226 Standard_Integer nb,
3231 Handle(TDF_Data) DF;
3232 if (!DDF::GetDF(arg[1],DF)) return 1;
3234 DDF::AddLabel(DF, arg[2], aLabel);
3237 TCollection_ExtendedString aKey(arg[3]);
3238 Standard_Integer aNum = Draw::Atoi(arg[4]);
3239 if (aNum <= 0) return 1;
3240 Handle(TDataStd_NamedData) anAtt;
3241 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3242 anAtt = TDataStd_NamedData::Set(aLabel);
3243 if(anAtt.IsNull()) {
3244 Message::SendFail() << "NamedData attribute is not found or not set";
3248 Handle(TColStd_HArray1OfInteger) anArr = new TColStd_HArray1OfInteger(1, aNum);
3249 for(Standard_Integer i = 1; i<=aNum; i++) {
3250 Standard_Integer aVal = j++;
3251 anArr->SetValue(i, aVal);
3254 anAtt->LoadDeferredData();
3255 anAtt->SetArrayOfIntegers(aKey, anArr);
3258 di << "DDataStd_SetNDataIntArrays2 : Error\n";
3263 //=======================================================================
3264 //function : SetAsciiString(DF, entry, String[, guid])
3265 //=======================================================================
3267 static Standard_Integer DDataStd_SetAsciiString (Draw_Interpretor& di,
3268 Standard_Integer nb,
3272 if (nb == 4 || nb == 5) {
3273 Handle(TDF_Data) DF;
3274 if (!DDF::GetDF(arg[1],DF)) return 1;
3276 DDF::AddLabel(DF, arg[2], aLabel);
3277 TCollection_AsciiString aString(arg[3]);
3278 Standard_GUID aGuid (TDataStd_AsciiString::GetID());
3280 if (!Standard_GUID::CheckGUIDFormat(arg[4])) {
3281 di<<"DDataStd_SetAsciiString: The format of GUID is invalid\n";
3284 aGuid = Standard_GUID (arg[4]);
3287 Handle(TDataStd_AsciiString) anAtt = TDataStd_AsciiString::Set(aLabel, aGuid, aString);
3288 if(anAtt.IsNull()) {
3289 di << "AsciiString attribute is not found or not set" << "\n";
3293 std::cout << "String = " << anAtt->Get().ToCString() << " is kept in DF" << std::endl;
3296 di << "DDataStd_SetAsciiString : Error\n";
3300 //=======================================================================
3301 //function : GetAsciiString(DF, entry[, guid] )
3302 //=======================================================================
3304 static Standard_Integer DDataStd_GetAsciiString (Draw_Interpretor& di,
3305 Standard_Integer nb,
3308 if (nb == 3 || nb == 4) {
3309 Handle(TDF_Data) DF;
3310 if (!DDF::GetDF(arg[1],DF)) return 1;
3312 DDF::FindLabel(DF, arg[2], aLabel);
3313 if(aLabel.IsNull()) di << "Label is not found" << "\n";
3314 Standard_GUID aGuid (TDataStd_AsciiString::GetID());
3316 if (!Standard_GUID::CheckGUIDFormat(arg[3])) {
3317 di<<"DDataStd_GetAsciiString: The format of GUID is invalid\n";
3320 aGuid = Standard_GUID(arg[3]);
3322 Handle(TDataStd_AsciiString) anAtt;
3323 if( !aLabel.FindAttribute(aGuid, anAtt) ) {
3324 Message::SendFail() << "AsciiString attribute is not found or not set";
3329 std::cout << "String = " << anAtt->Get().ToCString() << std::endl;
3331 di << anAtt->Get().ToCString();
3334 di << "DDataStd_GetAsciiString : Error\n";
3338 //=======================================================================
3339 //function : SetNDataIntegers (DF, entry , Num, key1, val1, ...
3340 //=======================================================================
3342 static Standard_Integer DDataStd_SetNDataIntegers (Draw_Interpretor& di,
3343 Standard_Integer nb,
3348 Handle(TDF_Data) DF;
3349 if (!DDF::GetDF(arg[1],DF)) return 1;
3351 DDF::AddLabel(DF, arg[2], aLabel);
3353 // TCollection_ExtendedString aString("123456789 0_abcde");
3354 // Standard_Integer aPos = aString.Search(" ");
3355 // std::cout << "From Start = " <<aPos<<std::endl;
3356 // aPos = aString.SearchFromEnd(" ");
3357 // std::cout << "From Start = " <<aPos<<std::endl;
3358 // TCollection_ExtendedString aValue = aString.Split(aPos);
3359 // std::cout << "Value = |"<<aValue<<std::endl;
3360 // std::cout << "aKey = " << aString << "|"<<std::endl;
3362 Standard_Integer aNumP = Draw::Atoi(arg[3]), j;
3363 Handle(TDataStd_NamedData) anAtt;
3364 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3365 anAtt = TDataStd_NamedData::Set(aLabel);
3366 if(anAtt.IsNull()) {
3367 di << "NamedData attribute is not found or not set" << "\n";
3371 anAtt->LoadDeferredData();
3372 for(Standard_Integer i = 1; i<=aNumP; i++) {
3373 TCollection_ExtendedString aKey(arg[j]);
3374 Standard_Integer aVal = Draw::Atoi(arg[j+1]);
3375 anAtt->SetInteger(aKey, aVal);
3380 di << "DDataStd_SetNDataIntegers : Error\n";
3385 //=======================================================================
3386 //function : GetNDIntegers(DF, entry )
3387 //=======================================================================
3388 static Standard_Integer DDataStd_GetNDIntegers (Draw_Interpretor& di,
3389 Standard_Integer nb,
3394 Handle(TDF_Data) DF;
3395 if (!DDF::GetDF(arg[1],DF)) return 1;
3397 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3400 Handle(TDataStd_NamedData) anAtt;
3401 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3403 Message::SendFail() << "NamedData attribute is not found or not set";
3407 std::cout <<std::endl;
3408 std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
3409 anAtt->LoadDeferredData();
3410 const TColStd_DataMapOfStringInteger& aMap = anAtt->GetIntegersContainer();
3411 TColStd_DataMapIteratorOfDataMapOfStringInteger itr(aMap);
3412 for (; itr.More(); itr.Next()){
3413 TCollection_ExtendedString aKey(itr.Key());
3414 Standard_Integer aValue = itr.Value();
3415 di << "Key = " << aKey << " Value = " << aValue << "\n";
3420 di << "DDataStd_GetNDIntegers : Error\n";
3424 //=======================================================================
3425 //function : GetNDInteger(DF, entry, key [drawname])
3426 //=======================================================================
3427 static Standard_Integer DDataStd_GetNDInteger (Draw_Interpretor& di,
3428 Standard_Integer nb,
3433 Handle(TDF_Data) DF;
3434 if (!DDF::GetDF(arg[1],DF)) return 1;
3436 if(!DDF::FindLabel(DF, arg[2], aLabel)) return 1;
3439 Handle(TDataStd_NamedData) anAtt;
3440 if(!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAtt))
3442 Message::SendFail() << "NamedData attribute is not found or not set";
3446 std::cout <<std::endl;
3447 std::cout <<"NamedData attribute at Label = " << arg[2] <<std::endl;
3448 anAtt->LoadDeferredData();
3449 TCollection_ExtendedString aKey(arg[3], Standard_True);
3450 if(!anAtt->HasInteger(aKey)) {
3451 std::cout << "There is no data specified by Key = "<< arg[3] << std::endl;
3454 std::cout << "Key = " << arg[3] << " Value = " <<anAtt->GetInteger(aKey)<<std::endl;
3456 Draw::Set(arg[4], anAtt->GetInteger(aKey));