03e63814b08228385040b73daa24cdb242aea3e4
[occt.git] / src / IGESGraph / IGESGraph_ToolDefinitionLevel.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <IGESData_DirChecker.hxx>
20 #include <IGESData_Dump.hxx>
21 #include <IGESData_IGESDumper.hxx>
22 #include <IGESData_IGESReaderData.hxx>
23 #include <IGESData_IGESWriter.hxx>
24 #include <IGESData_ParamCursor.hxx>
25 #include <IGESData_ParamReader.hxx>
26 #include <IGESGraph_DefinitionLevel.hxx>
27 #include <IGESGraph_ToolDefinitionLevel.hxx>
28 #include <Interface_Check.hxx>
29 #include <Interface_CopyTool.hxx>
30 #include <Interface_EntityIterator.hxx>
31 #include <Interface_Macros.hxx>
32 #include <Interface_ShareTool.hxx>
33 #include <Message_Messenger.hxx>
34 #include <Standard_DomainError.hxx>
35 #include <TColStd_HArray1OfInteger.hxx>
36
37 IGESGraph_ToolDefinitionLevel::IGESGraph_ToolDefinitionLevel ()    {  }
38
39
40 void IGESGraph_ToolDefinitionLevel::ReadOwnParams
41   (const Handle(IGESGraph_DefinitionLevel)& ent,
42    const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
43
44   //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down
45   Standard_Integer nbval;
46
47   Handle(TColStd_HArray1OfInteger) levelNumbers;
48
49   // Reading nbval(No. of Property Values)
50   Standard_Boolean st = PR.ReadInteger(PR.Current(), "No. of Property Values", nbval);
51   if (st && nbval > 0)
52     {
53       // Reading levelNumbers(HArray1OfInteger)
54 //      levelNumbers = new TColStd_HArray1OfInteger(1, nbval);   done by :
55       PR.ReadInts(PR.CurrentList(nbval), "array levelNumbers", levelNumbers, 1); //szv#4:S4163:12Mar99 `st=` not needed
56     }
57   else  PR.AddFail("No. of Property Values : Not Positive");
58
59   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
60   ent->Init(levelNumbers);
61 }
62
63 void IGESGraph_ToolDefinitionLevel::WriteOwnParams
64   (const Handle(IGESGraph_DefinitionLevel)& ent, IGESData_IGESWriter& IW)  const
65
66   Standard_Integer Up  = ent->NbPropertyValues();
67   IW.Send( Up );
68   for ( Standard_Integer i = 1; i <= Up; i++)
69     IW.Send( ent->LevelNumber(i) );
70 }
71
72 void  IGESGraph_ToolDefinitionLevel::OwnShared
73   (const Handle(IGESGraph_DefinitionLevel)& /*ent*/, Interface_EntityIterator& /*iter*/) const
74 {
75 }
76
77 void IGESGraph_ToolDefinitionLevel::OwnCopy
78   (const Handle(IGESGraph_DefinitionLevel)& another,
79    const Handle(IGESGraph_DefinitionLevel)& ent, Interface_CopyTool& /*TC*/) const
80
81   Standard_Integer nbval;
82   Handle(TColStd_HArray1OfInteger) levelNumbers; 
83  
84   nbval = another->NbPropertyValues();
85  
86   levelNumbers = new TColStd_HArray1OfInteger(1, nbval);
87   for (Standard_Integer i = 1; i <= nbval; i++)
88     levelNumbers->SetValue( i, another->LevelNumber(i) );
89
90   ent->Init(levelNumbers);
91 }
92
93 IGESData_DirChecker IGESGraph_ToolDefinitionLevel::DirChecker
94   (const Handle(IGESGraph_DefinitionLevel)& /*ent*/)  const
95
96   IGESData_DirChecker DC (406, 1);
97   DC.Structure(IGESData_DefVoid);
98   DC.LineFont(IGESData_DefVoid);
99   DC.LineWeight(IGESData_DefVoid);
100   DC.Color(IGESData_DefVoid);
101   DC.BlankStatusIgnored();
102   DC.UseFlagIgnored();
103   DC.HierarchyStatusIgnored();
104   return DC;
105 }
106
107 void IGESGraph_ToolDefinitionLevel::OwnCheck
108   (const Handle(IGESGraph_DefinitionLevel)& /*ent*/,
109    const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/)  const
110 {
111 }
112
113 void IGESGraph_ToolDefinitionLevel::OwnDump
114   (const Handle(IGESGraph_DefinitionLevel)& ent, const IGESData_IGESDumper& /*dumper*/,
115    const Handle(Message_Messenger)& S, const Standard_Integer level)  const
116 {
117   S << "IGESGraph_DefinitionLevel" << Message_EndLine;
118
119   S << "Level Numbers : ";
120   IGESData_DumpVals(S ,level,1, ent->NbPropertyValues(),ent->LevelNumber);
121   S << Message_EndLine;
122 }
123