0032961: Coding - get rid of unused headers [IGESAppli to IGESToBRep]
[occt.git] / src / IGESGraph / IGESGraph_ToolColor.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_ParamReader.hxx>
25 #include <IGESGraph_Color.hxx>
26 #include <IGESGraph_ToolColor.hxx>
27 #include <Interface_Check.hxx>
28 #include <Interface_CopyTool.hxx>
29 #include <Interface_EntityIterator.hxx>
30 #include <Interface_ShareTool.hxx>
31 #include <Message_Messenger.hxx>
32 #include <TCollection_HAsciiString.hxx>
33
34 IGESGraph_ToolColor::IGESGraph_ToolColor ()    {  }
35
36
37 void IGESGraph_ToolColor::ReadOwnParams
38   (const Handle(IGESGraph_Color)& ent,
39    const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
40 {
41   Standard_Real tempRed, tempGreen, tempBlue;
42   Handle(TCollection_HAsciiString) tempColorName;
43
44   PR.ReadReal(PR.Current(), "RED as % Of Full Intensity", tempRed);
45
46   PR.ReadReal(PR.Current(), "GREEN as % Of Full Intensity", tempGreen);
47
48   PR.ReadReal(PR.Current(), "BLUE as % Of Full Intensity", tempBlue);
49
50   if ((PR.CurrentNumber() <= PR.NbParams()) &&
51       (PR.ParamType(PR.CurrentNumber()) == Interface_ParamText))
52     PR.ReadText(PR.Current(), "Color Name", tempColorName);
53
54   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
55   ent->Init(tempRed, tempGreen, tempBlue, tempColorName);
56 }
57
58 void IGESGraph_ToolColor::WriteOwnParams
59   (const Handle(IGESGraph_Color)& ent, IGESData_IGESWriter& IW)  const
60 {
61   Standard_Real Red,Green,Blue;
62   ent->RGBIntensity(Red,Green,Blue);
63   IW.Send(Red);
64   IW.Send(Green);
65   IW.Send(Blue);
66 //  ATTENTION  place a reserver (Null) silya des pointeurs additionnels
67   if (ent->HasColorName())
68     IW.Send(ent->ColorName());
69   else IW.SendVoid();    // placekeeper to be reserved for additional pointers
70 }
71
72 void  IGESGraph_ToolColor::OwnShared
73   (const Handle(IGESGraph_Color)& /*ent*/, Interface_EntityIterator& /*iter*/) const
74 {
75 }
76
77 void IGESGraph_ToolColor::OwnCopy
78   (const Handle(IGESGraph_Color)& another,
79    const Handle(IGESGraph_Color)& ent, Interface_CopyTool& /*TC*/) const
80 {
81   Standard_Real tempRed, tempGreen, tempBlue;
82   Handle(TCollection_HAsciiString) tempColorName;
83   another->RGBIntensity(tempRed, tempGreen, tempBlue);
84   if (another->HasColorName())
85     tempColorName = new TCollection_HAsciiString(another->ColorName());
86
87   ent->Init(tempRed, tempGreen, tempBlue, tempColorName);
88 }
89
90 IGESData_DirChecker  IGESGraph_ToolColor::DirChecker
91   (const Handle(IGESGraph_Color)& /*ent*/ )  const
92 {
93   IGESData_DirChecker DC(314, 0);
94   DC.Structure(IGESData_DefVoid);
95   DC.LineFont(IGESData_DefVoid);
96   DC.LineWeight(IGESData_DefVoid);
97   DC.Color(IGESData_DefAny);
98   DC.BlankStatusIgnored();
99   DC.SubordinateStatusRequired(0);
100   DC.UseFlagRequired(2);
101   DC.HierarchyStatusIgnored();
102
103   return DC;
104 }
105
106 void IGESGraph_ToolColor::OwnCheck
107   (const Handle(IGESGraph_Color)& /*ent*/,
108    const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/)  const
109 {
110 //  if (ent->RankColor() == 0)
111 //    ach.AddFail("Color Rank is zero");
112 //  else if (ent->RankColor() < 1 || ent->RankColor() > 8)
113 //    ach.AddFail("Color Rank not between 1 to 8");
114 }
115
116 void IGESGraph_ToolColor::OwnDump
117   (const Handle(IGESGraph_Color)& ent, const IGESData_IGESDumper& /*dumper*/,
118    Standard_OStream& S, const Standard_Integer /*level*/)  const
119 {
120   S << "IGESGraph_Color\n";
121
122   Standard_Real Red,Green,Blue;
123   ent->RGBIntensity(Red,Green,Blue);
124   S << "Red   (in % Of Full Intensity) : " << Red   << "\n"
125     << "Green (in % Of Full Intensity) : " << Green << "\n"
126     << "Blue  (in % Of Full Intensity) : " << Blue  << "\n"
127     << "Color Name : ";
128   IGESData_DumpString(S,ent->ColorName());
129   S << std::endl;
130 }