0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / IGESGraph / IGESGraph_ToolIntercharacterSpacing.cxx
CommitLineData
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
42cf5bc1 19#include <IGESData_DirChecker.hxx>
20#include <IGESData_IGESDumper.hxx>
21#include <IGESData_IGESReaderData.hxx>
22#include <IGESData_IGESWriter.hxx>
7fd59977 23#include <IGESData_ParamCursor.hxx>
42cf5bc1 24#include <IGESData_ParamReader.hxx>
25#include <IGESGraph_IntercharacterSpacing.hxx>
26#include <IGESGraph_ToolIntercharacterSpacing.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 <Standard_DomainError.hxx>
7fd59977 33
34IGESGraph_ToolIntercharacterSpacing::IGESGraph_ToolIntercharacterSpacing ()
35 { }
36
37
38void IGESGraph_ToolIntercharacterSpacing::ReadOwnParams
39 (const Handle(IGESGraph_IntercharacterSpacing)& ent,
40 const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
41{
42 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
43
44 Standard_Integer nbPropertyValues;
45 Standard_Real iSpace;
46
47 // Reading nbPropertyValues(Integer)
48 PR.ReadInteger(PR.Current(), "No. of property values", nbPropertyValues); //szv#4:S4163:12Mar99 `st=` not needed
49 if (nbPropertyValues != 1)
50 PR.AddFail("No. of Property values : Value is not 1");
51
52 // Reading iSpace(Real)
53 PR.ReadReal(PR.Current(), "Intercharacter space in % of text height", iSpace); //szv#4:S4163:12Mar99 `st=` not needed
54
55 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
56 ent->Init(nbPropertyValues, iSpace);
57}
58
59void IGESGraph_ToolIntercharacterSpacing::WriteOwnParams
60 (const Handle(IGESGraph_IntercharacterSpacing)& ent, IGESData_IGESWriter& IW) const
61{
62 IW.Send( ent->NbPropertyValues() );
63 IW.Send( ent->ISpace() );
64}
65
66void IGESGraph_ToolIntercharacterSpacing::OwnShared
67 (const Handle(IGESGraph_IntercharacterSpacing)& /*ent*/, Interface_EntityIterator& /*iter*/) const
68{
69}
70
71void IGESGraph_ToolIntercharacterSpacing::OwnCopy
72 (const Handle(IGESGraph_IntercharacterSpacing)& another,
73 const Handle(IGESGraph_IntercharacterSpacing)& ent, Interface_CopyTool& /*TC*/) const
74{
75 ent->Init(1,another->ISpace());
76}
77
78Standard_Boolean IGESGraph_ToolIntercharacterSpacing::OwnCorrect
79 (const Handle(IGESGraph_IntercharacterSpacing)& ent) const
80{
81 Standard_Boolean res = (ent->NbPropertyValues() != 1);
82 if (res) ent->Init(1,ent->ISpace()); // nbpropertyvalues=1
83 return res;
84}
85
86IGESData_DirChecker IGESGraph_ToolIntercharacterSpacing::DirChecker
87 (const Handle(IGESGraph_IntercharacterSpacing)& /*ent*/) const
88{
89 IGESData_DirChecker DC (406, 18);
90 DC.Structure(IGESData_DefVoid);
91 DC.LineFont(IGESData_DefVoid);
92 DC.LineWeight(IGESData_DefVoid);
93 DC.Color(IGESData_DefVoid);
94 DC.BlankStatusIgnored();
95 DC.UseFlagIgnored();
96 DC.HierarchyStatusIgnored();
97 return DC;
98}
99
100void IGESGraph_ToolIntercharacterSpacing::OwnCheck
101 (const Handle(IGESGraph_IntercharacterSpacing)& ent,
102 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
103{
104 if ((ent->ISpace() < 0.0) || (ent->ISpace() > 100.0))
105 ach->AddFail("Intercharacter Space : Value not in the range [0-100]");
106 if (ent->NbPropertyValues() != 1)
107 ach->AddFail("No. of Property values : Value != 1");
108}
109
110void IGESGraph_ToolIntercharacterSpacing::OwnDump
111 (const Handle(IGESGraph_IntercharacterSpacing)& ent, const IGESData_IGESDumper& /*dumper*/,
0ebe5b0a 112 Standard_OStream& S, const Standard_Integer /*level*/) const
7fd59977 113{
0ebe5b0a 114 S << "IGESGraph_IntercharacterSpacing\n"
115 << "No. of property values : " << ent->NbPropertyValues() << "\n"
116 << "Intercharacter space in % of text height : " << ent->ISpace() << "\n"
117 << std::endl;
7fd59977 118}