1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
19 #include <IGESData_DirChecker.hxx>
20 #include <IGESData_IGESDumper.hxx>
21 #include <IGESData_IGESEntity.hxx>
22 #include <IGESData_IGESReaderData.hxx>
23 #include <IGESData_IGESWriter.hxx>
24 #include <IGESData_ParamCursor.hxx>
25 #include <IGESData_ParamReader.hxx>
26 #include <IGESData_Status.hxx>
27 #include <IGESGeom_RuledSurface.hxx>
28 #include <IGESGeom_ToolRuledSurface.hxx>
29 #include <Interface_Check.hxx>
30 #include <Interface_CopyTool.hxx>
31 #include <Interface_EntityIterator.hxx>
32 #include <Interface_Macros.hxx>
33 #include <Interface_ShareTool.hxx>
34 #include <Message_Messenger.hxx>
35 #include <Message_Msg.hxx>
36 #include <Standard_DomainError.hxx>
39 IGESGeom_ToolRuledSurface::IGESGeom_ToolRuledSurface () { }
42 void IGESGeom_ToolRuledSurface::ReadOwnParams
43 (const Handle(IGESGeom_RuledSurface)& ent,
44 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
48 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
49 Standard_Integer aDirFlag, aDevFlag;
50 Handle(IGESData_IGESEntity) aCurve, anotherCurve;
51 IGESData_Status aStatus;
53 if (!PR.ReadEntity(IR, PR.Current(), aStatus, aCurve)){ //szv#4:S4163:12Mar99 `st=` not needed
54 Message_Msg Msg148("XSTEP_148");
56 case IGESData_ReferenceError: {
57 Message_Msg Msg216 ("IGES_216");
58 Msg148.Arg(Msg216.Value());
61 case IGESData_EntityError: {
62 Message_Msg Msg217 ("IGES_217");
63 Msg148.Arg(Msg217.Value());
70 if (!PR.ReadEntity(IR, PR.Current(), aStatus, anotherCurve)){ //szv#4:S4163:12Mar99 `st=` not needed
71 Message_Msg Msg149("XSTEP_149");
73 case IGESData_ReferenceError: {
74 Message_Msg Msg216 ("IGES_216");
75 Msg149.Arg(Msg216.Value());
78 case IGESData_EntityError: {
79 Message_Msg Msg217 ("IGES_217");
80 Msg149.Arg(Msg217.Value());
87 if (!PR.ReadInteger(PR.Current(), aDirFlag)){ //szv#4:S4163:12Mar99 `st=` not needed
88 Message_Msg Msg150("XSTEP_150");
91 if (!PR.ReadInteger(PR.Current(), aDevFlag)){ //szv#4:S4163:12Mar99 `st=` not needed
92 Message_Msg Msg151("XSTEP_151");
96 st = PR.ReadEntity(IR, PR.Current(), "First Curve", aCurve);
97 st = PR.ReadEntity(IR, PR.Current(), "Second Curve", anotherCurve);
98 st = PR.ReadInteger(PR.Current(), "DirFlag", aDirFlag);
99 st = PR.ReadInteger(PR.Current(), "DevFlag ", aDevFlag);
101 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
102 ent->Init(aCurve, anotherCurve, aDirFlag, aDevFlag);
105 void IGESGeom_ToolRuledSurface::WriteOwnParams
106 (const Handle(IGESGeom_RuledSurface)& ent, IGESData_IGESWriter& IW) const
108 IW.Send(ent->FirstCurve());
109 IW.Send(ent->SecondCurve());
110 IW.Send(ent->DirectionFlag());
111 IW.SendBoolean(ent->IsDevelopable());
114 void IGESGeom_ToolRuledSurface::OwnShared
115 (const Handle(IGESGeom_RuledSurface)& ent, Interface_EntityIterator& iter) const
117 iter.GetOneItem(ent->FirstCurve());
118 iter.GetOneItem(ent->SecondCurve());
121 void IGESGeom_ToolRuledSurface::OwnCopy
122 (const Handle(IGESGeom_RuledSurface)& another,
123 const Handle(IGESGeom_RuledSurface)& ent, Interface_CopyTool& TC) const
125 DeclareAndCast(IGESData_IGESEntity, aCurve,
126 TC.Transferred(another->FirstCurve()));
127 DeclareAndCast(IGESData_IGESEntity, anotherCurve,
128 TC.Transferred(another->SecondCurve()));
129 Standard_Integer aDirFlag = another->DirectionFlag();
130 Standard_Integer aDevFlag = (another->IsDevelopable() ? 1 : 0);
132 ent->Init(aCurve, anotherCurve, aDirFlag, aDevFlag);
135 IGESData_DirChecker IGESGeom_ToolRuledSurface::DirChecker
136 (const Handle(IGESGeom_RuledSurface)& /*ent*/ ) const
138 IGESData_DirChecker DC(118, 0, 1);
139 DC.Structure(IGESData_DefVoid);
140 DC.LineFont(IGESData_DefAny);
141 // DC.LineWeight(IGESData_DefValue);
142 DC.Color(IGESData_DefAny);
143 DC.HierarchyStatusIgnored();
148 void IGESGeom_ToolRuledSurface::OwnCheck
149 (const Handle(IGESGeom_RuledSurface)& /*ent*/,
150 const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/) const
154 void IGESGeom_ToolRuledSurface::OwnDump
155 (const Handle(IGESGeom_RuledSurface)& ent, const IGESData_IGESDumper& dumper,
156 const Handle(Message_Messenger)& S, const Standard_Integer level) const
158 Standard_Integer tempSubLevel = (level <= 4) ? 0 : 1;
160 S << "IGESGeom_RuledSurface" << endl;
162 S << "First Curve : ";
163 dumper.Dump(ent->FirstCurve(),S, tempSubLevel);
165 S << "Second Curve : ";
166 dumper.Dump(ent->SecondCurve(),S, tempSubLevel);
168 S << "Direction Flag : " << ent->DirectionFlag() << " i.e.";
169 if (ent->DirectionFlag() == 0) S<< "Join First to First, Last to Last"<<endl;
170 else S<< "Join First to Last, Last to First"<<endl;
171 if (ent->IsDevelopable()) S << " .. Is Developable" << endl;
172 else S << " .. Is possibly not developable .." << endl;