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 | |
7fd59977 |
19 | #include <gp_Pnt2d.hxx> |
42cf5bc1 |
20 | #include <gp_XY.hxx> |
21 | #include <IGESData_DirChecker.hxx> |
7fd59977 |
22 | #include <IGESData_Dump.hxx> |
42cf5bc1 |
23 | #include <IGESData_IGESDumper.hxx> |
24 | #include <IGESData_IGESReaderData.hxx> |
25 | #include <IGESData_IGESWriter.hxx> |
26 | #include <IGESData_ParamCursor.hxx> |
27 | #include <IGESData_ParamReader.hxx> |
28 | #include <IGESDimen_BasicDimension.hxx> |
29 | #include <IGESDimen_ToolBasicDimension.hxx> |
30 | #include <Interface_Check.hxx> |
31 | #include <Interface_CopyTool.hxx> |
32 | #include <Interface_EntityIterator.hxx> |
33 | #include <Interface_ShareTool.hxx> |
34 | #include <Message_Messenger.hxx> |
35 | #include <Standard_DomainError.hxx> |
7fd59977 |
36 | |
37 | IGESDimen_ToolBasicDimension::IGESDimen_ToolBasicDimension () { } |
38 | |
39 | |
40 | void IGESDimen_ToolBasicDimension::ReadOwnParams |
41 | (const Handle(IGESDimen_BasicDimension)& ent, |
42 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
43 | { |
44 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
45 | Standard_Integer nbPropVal; |
46 | gp_XY templl; |
47 | gp_XY templr; |
48 | gp_XY tempur; |
49 | gp_XY tempul; |
50 | |
51 | PR.ReadInteger(PR.Current(),"Number of Property Values",nbPropVal); //szv#4:S4163:12Mar99 `st=` not needed |
52 | PR.ReadXY(PR.CurrentList(1, 2),"Lower Left Corner", templl); //szv#4:S4163:12Mar99 `st=` not needed |
53 | PR.ReadXY(PR.CurrentList(1, 2),"Lower Right Corner", templr); //szv#4:S4163:12Mar99 `st=` not needed |
54 | PR.ReadXY(PR.CurrentList(1, 2),"Upper Right Corner", tempur); //szv#4:S4163:12Mar99 `st=` not needed |
55 | PR.ReadXY(PR.CurrentList(1, 2),"Upper Left Corner", tempul); //szv#4:S4163:12Mar99 `st=` not needed |
56 | |
57 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
58 | ent->Init(nbPropVal, templl, templr, tempur, tempul); |
59 | } |
60 | |
61 | void IGESDimen_ToolBasicDimension::WriteOwnParams |
62 | (const Handle(IGESDimen_BasicDimension)& ent, IGESData_IGESWriter& IW) const |
63 | { |
64 | IW.Send(ent->NbPropertyValues()); |
65 | IW.Send(ent->LowerLeft().X()); |
66 | IW.Send(ent->LowerLeft().Y()); |
67 | IW.Send(ent->LowerRight().X()); |
68 | IW.Send(ent->LowerRight().Y()); |
69 | IW.Send(ent->UpperRight().X()); |
70 | IW.Send(ent->UpperRight().Y()); |
71 | IW.Send(ent->UpperLeft().X()); |
72 | IW.Send(ent->UpperLeft().Y()); |
73 | } |
74 | |
75 | void IGESDimen_ToolBasicDimension::OwnShared |
76 | (const Handle(IGESDimen_BasicDimension)& /* ent */, Interface_EntityIterator& /* iter */) const |
77 | { |
78 | } |
79 | |
80 | void IGESDimen_ToolBasicDimension::OwnCopy |
81 | (const Handle(IGESDimen_BasicDimension)& another, |
82 | const Handle(IGESDimen_BasicDimension)& ent, Interface_CopyTool& /* TC */) const |
83 | { |
84 | ent->Init |
85 | (8,another->LowerLeft().XY(),another->LowerRight().XY(), |
86 | another->UpperRight().XY(),another->UpperLeft().XY()); |
87 | } |
88 | |
89 | Standard_Boolean IGESDimen_ToolBasicDimension::OwnCorrect |
90 | (const Handle(IGESDimen_BasicDimension)& ent) const |
91 | { |
92 | Standard_Boolean res = (ent->NbPropertyValues() != 8); |
93 | if (res) ent->Init |
94 | (8,ent->LowerLeft().XY(),ent->LowerRight().XY(), |
95 | ent->UpperRight().XY(),ent->UpperLeft().XY()); // nbpropertyvalues = 8 |
96 | return res; |
97 | } |
98 | |
99 | IGESData_DirChecker IGESDimen_ToolBasicDimension::DirChecker |
100 | (const Handle(IGESDimen_BasicDimension)& /* ent */ ) const |
101 | { |
102 | IGESData_DirChecker DC(406,31); //Type = 406, Form = 31 |
103 | DC.Structure(IGESData_DefVoid); |
104 | DC.GraphicsIgnored(); |
105 | DC.BlankStatusIgnored(); |
106 | DC.SubordinateStatusRequired(01); |
107 | DC.UseFlagRequired(02); |
108 | DC.HierarchyStatusIgnored(); |
109 | return DC; |
110 | } |
111 | |
112 | void IGESDimen_ToolBasicDimension::OwnCheck |
113 | (const Handle(IGESDimen_BasicDimension)& ent, |
114 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
115 | { |
116 | if (ent->NbPropertyValues() != 8) |
117 | ach->AddFail("Num of Property Values != 8"); |
118 | } |
119 | |
120 | void IGESDimen_ToolBasicDimension::OwnDump |
121 | (const Handle(IGESDimen_BasicDimension)& ent, const IGESData_IGESDumper& /* dumper */, |
122 | const Handle(Message_Messenger)& S, const Standard_Integer /* level */) const |
123 | { |
124 | S << "IGESDimen_BasicDimension" << endl; |
125 | S << "Number of Property Values : " << ent->NbPropertyValues() << endl; |
126 | S << endl << " Lower left corner : " ; |
127 | IGESData_DumpXY(S, ent->LowerLeft()); |
128 | S << endl << " Lower right corner : " ; |
129 | IGESData_DumpXY(S, ent->LowerRight()); |
130 | S << endl << " Upper right corner : " ; |
131 | IGESData_DumpXY(S, ent->UpperRight()); |
132 | S << endl << " Upper left corner : "; |
133 | IGESData_DumpXY(S, ent->UpperLeft()); |
134 | S << endl; |
135 | } |
136 | |