b311480e |
1 | // Created by: CKY / Contract Toubro-Larsen |
2 | // Copyright (c) 1993-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
7fd59977 |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
7fd59977 |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
16 | //-------------------------------------------------------------------- |
7fd59977 |
17 | //-------------------------------------------------------------------- |
18 | |
19 | #include <IGESGraph_ToolColor.ixx> |
20 | #include <IGESData_ParamCursor.hxx> |
21 | #include <TCollection_HAsciiString.hxx> |
22 | #include <Interface_Macros.hxx> |
23 | #include <IGESData_Dump.hxx> |
24 | |
25 | |
26 | IGESGraph_ToolColor::IGESGraph_ToolColor () { } |
27 | |
28 | |
29 | void IGESGraph_ToolColor::ReadOwnParams |
30 | (const Handle(IGESGraph_Color)& ent, |
31 | const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const |
32 | { |
33 | Standard_Real tempRed, tempGreen, tempBlue; |
34 | Handle(TCollection_HAsciiString) tempColorName; |
35 | |
36 | PR.ReadReal(PR.Current(), "RED as % Of Full Intensity", tempRed); |
37 | |
38 | PR.ReadReal(PR.Current(), "GREEN as % Of Full Intensity", tempGreen); |
39 | |
40 | PR.ReadReal(PR.Current(), "BLUE as % Of Full Intensity", tempBlue); |
41 | |
42 | if ((PR.CurrentNumber() <= PR.NbParams()) && |
43 | (PR.ParamType(PR.CurrentNumber()) == Interface_ParamText)) |
44 | PR.ReadText(PR.Current(), "Color Name", tempColorName); |
45 | |
46 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
47 | ent->Init(tempRed, tempGreen, tempBlue, tempColorName); |
48 | } |
49 | |
50 | void IGESGraph_ToolColor::WriteOwnParams |
51 | (const Handle(IGESGraph_Color)& ent, IGESData_IGESWriter& IW) const |
52 | { |
53 | Standard_Real Red,Green,Blue; |
54 | ent->RGBIntensity(Red,Green,Blue); |
55 | IW.Send(Red); |
56 | IW.Send(Green); |
57 | IW.Send(Blue); |
58 | // ATTENTION place a reserver (Null) silya des pointeurs additionnels |
59 | if (ent->HasColorName()) |
60 | IW.Send(ent->ColorName()); |
61 | else IW.SendVoid(); // placekeeper to be reserved for additional pointers |
62 | } |
63 | |
64 | void IGESGraph_ToolColor::OwnShared |
65 | (const Handle(IGESGraph_Color)& /*ent*/, Interface_EntityIterator& /*iter*/) const |
66 | { |
67 | } |
68 | |
69 | void IGESGraph_ToolColor::OwnCopy |
70 | (const Handle(IGESGraph_Color)& another, |
71 | const Handle(IGESGraph_Color)& ent, Interface_CopyTool& /*TC*/) const |
72 | { |
73 | Standard_Real tempRed, tempGreen, tempBlue; |
74 | Handle(TCollection_HAsciiString) tempColorName; |
75 | another->RGBIntensity(tempRed, tempGreen, tempBlue); |
76 | if (another->HasColorName()) |
77 | tempColorName = new TCollection_HAsciiString(another->ColorName()); |
78 | |
79 | ent->Init(tempRed, tempGreen, tempBlue, tempColorName); |
80 | } |
81 | |
82 | IGESData_DirChecker IGESGraph_ToolColor::DirChecker |
83 | (const Handle(IGESGraph_Color)& /*ent*/ ) const |
84 | { |
85 | IGESData_DirChecker DC(314, 0); |
86 | DC.Structure(IGESData_DefVoid); |
87 | DC.LineFont(IGESData_DefVoid); |
88 | DC.LineWeight(IGESData_DefVoid); |
89 | DC.Color(IGESData_DefAny); |
90 | DC.BlankStatusIgnored(); |
91 | DC.SubordinateStatusRequired(0); |
92 | DC.UseFlagRequired(2); |
93 | DC.HierarchyStatusIgnored(); |
94 | |
95 | return DC; |
96 | } |
97 | |
98 | void IGESGraph_ToolColor::OwnCheck |
99 | (const Handle(IGESGraph_Color)& /*ent*/, |
100 | const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/) const |
101 | { |
102 | // if (ent->RankColor() == 0) |
103 | // ach.AddFail("Color Rank is zero"); |
104 | // else if (ent->RankColor() < 1 || ent->RankColor() > 8) |
105 | // ach.AddFail("Color Rank not between 1 to 8"); |
106 | } |
107 | |
108 | void IGESGraph_ToolColor::OwnDump |
109 | (const Handle(IGESGraph_Color)& ent, const IGESData_IGESDumper& /*dumper*/, |
110 | const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const |
111 | { |
112 | S << "IGESGraph_Color" << endl; |
113 | |
114 | Standard_Real Red,Green,Blue; |
115 | ent->RGBIntensity(Red,Green,Blue); |
116 | S << "Red (in % Of Full Intensity) : " << Red << endl; |
117 | S << "Green (in % Of Full Intensity) : " << Green << endl; |
118 | S << "Blue (in % Of Full Intensity) : " << Blue << endl; |
119 | S << "Color Name : "; |
120 | IGESData_DumpString(S,ent->ColorName()); |
121 | S << endl; |
122 | } |