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_DrawingSize.hxx> |
26 | #include <IGESGraph_ToolDrawingSize.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 | |
34 | IGESGraph_ToolDrawingSize::IGESGraph_ToolDrawingSize () { } |
35 | |
36 | |
37 | void IGESGraph_ToolDrawingSize::ReadOwnParams |
38 | (const Handle(IGESGraph_DrawingSize)& ent, |
39 | const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const |
40 | { |
41 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
42 | |
43 | Standard_Integer nbPropertyValues; |
44 | Standard_Real xSize; |
45 | Standard_Real ySize; |
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 != 2) |
50 | PR.AddFail("No. of Property values : Value is not 2"); |
51 | |
52 | // Reading xSize(Real) |
53 | PR.ReadReal (PR.Current(), "Drawing extent along +ve XD axis", xSize); //szv#4:S4163:12Mar99 `st=` not needed |
54 | |
55 | // Reading ySize(Real) |
56 | PR.ReadReal (PR.Current(), "Drawing extent along +ve YD axis", ySize); //szv#4:S4163:12Mar99 `st=` not needed |
57 | |
58 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
59 | ent->Init(nbPropertyValues, xSize, ySize); |
60 | } |
61 | |
62 | void IGESGraph_ToolDrawingSize::WriteOwnParams |
63 | (const Handle(IGESGraph_DrawingSize)& ent, IGESData_IGESWriter& IW) const |
64 | { |
65 | IW.Send( ent->NbPropertyValues() ); |
66 | IW.Send( ent->XSize() ); |
67 | IW.Send( ent->YSize() ); |
68 | } |
69 | |
70 | void IGESGraph_ToolDrawingSize::OwnShared |
71 | (const Handle(IGESGraph_DrawingSize)& /*ent*/, Interface_EntityIterator& /*iter*/) const |
72 | { |
73 | } |
74 | |
75 | void IGESGraph_ToolDrawingSize::OwnCopy |
76 | (const Handle(IGESGraph_DrawingSize)& another, |
77 | const Handle(IGESGraph_DrawingSize)& ent, Interface_CopyTool& /*TC*/) const |
78 | { |
79 | ent->Init(2,another->XSize(),another->YSize()); |
80 | } |
81 | |
82 | Standard_Boolean IGESGraph_ToolDrawingSize::OwnCorrect |
83 | (const Handle(IGESGraph_DrawingSize)& ent) const |
84 | { |
85 | Standard_Boolean res = (ent->NbPropertyValues() != 2); |
86 | if (res) ent->Init(2,ent->XSize(),ent->YSize()); // nbpropertyvalues=2 |
87 | return res; |
88 | } |
89 | |
90 | IGESData_DirChecker IGESGraph_ToolDrawingSize::DirChecker |
91 | (const Handle(IGESGraph_DrawingSize)& /*ent*/) const |
92 | { |
93 | IGESData_DirChecker DC (406, 16); |
94 | DC.Structure(IGESData_DefVoid); |
95 | DC.LineFont(IGESData_DefVoid); |
96 | DC.LineWeight(IGESData_DefVoid); |
97 | DC.Color(IGESData_DefVoid); |
98 | DC.BlankStatusIgnored(); |
99 | DC.UseFlagIgnored(); |
100 | DC.HierarchyStatusIgnored(); |
101 | return DC; |
102 | } |
103 | |
104 | void IGESGraph_ToolDrawingSize::OwnCheck |
105 | (const Handle(IGESGraph_DrawingSize)& ent, |
106 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
107 | { |
108 | if (ent->NbPropertyValues() != 2) |
109 | ach->AddFail("No. of Property values : Value != 2"); |
110 | } |
111 | |
112 | void IGESGraph_ToolDrawingSize::OwnDump |
113 | (const Handle(IGESGraph_DrawingSize)& ent, const IGESData_IGESDumper& /*dumper*/, |
0ebe5b0a |
114 | Standard_OStream& S, const Standard_Integer /*level*/) const |
7fd59977 |
115 | { |
0ebe5b0a |
116 | S << "IGESGraph_DrawingSize\n" |
117 | << "No. of property values : " << ent->NbPropertyValues() << "\n" |
118 | << "Drawing extent along positive X-axis : " << ent->XSize() << "\n" |
119 | << "Drawing extent along positive Y-axis : " << ent->YSize() << "\n" |
120 | << std::endl; |
7fd59977 |
121 | } |