0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / IGESGeom / IGESGeom_ToolRuledSurface.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>
42cf5bc1 21#include <IGESData_IGESReaderData.hxx>
22#include <IGESData_IGESWriter.hxx>
42cf5bc1 23#include <IGESData_ParamReader.hxx>
24#include <IGESData_Status.hxx>
25#include <IGESGeom_RuledSurface.hxx>
26#include <IGESGeom_ToolRuledSurface.hxx>
27#include <Interface_Check.hxx>
28#include <Interface_CopyTool.hxx>
29#include <Interface_EntityIterator.hxx>
7fd59977 30#include <Interface_Macros.hxx>
42cf5bc1 31#include <Interface_ShareTool.hxx>
7fd59977 32#include <Message_Msg.hxx>
7fd59977 33
42cf5bc1 34// MGE 31/07/98
7fd59977 35IGESGeom_ToolRuledSurface::IGESGeom_ToolRuledSurface () { }
36
37
38void IGESGeom_ToolRuledSurface::ReadOwnParams
39 (const Handle(IGESGeom_RuledSurface)& ent,
40 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
41{
42 // MGE 31/07/98
43
44 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
45 Standard_Integer aDirFlag, aDevFlag;
46 Handle(IGESData_IGESEntity) aCurve, anotherCurve;
47 IGESData_Status aStatus;
48
49 if (!PR.ReadEntity(IR, PR.Current(), aStatus, aCurve)){ //szv#4:S4163:12Mar99 `st=` not needed
50 Message_Msg Msg148("XSTEP_148");
51 switch(aStatus) {
52 case IGESData_ReferenceError: {
53 Message_Msg Msg216 ("IGES_216");
54 Msg148.Arg(Msg216.Value());
55 PR.SendFail(Msg148);
56 break; }
57 case IGESData_EntityError: {
58 Message_Msg Msg217 ("IGES_217");
59 Msg148.Arg(Msg217.Value());
60 PR.SendFail(Msg148);
61 break; }
62 default:{
63 }
64 }
65 }
66 if (!PR.ReadEntity(IR, PR.Current(), aStatus, anotherCurve)){ //szv#4:S4163:12Mar99 `st=` not needed
67 Message_Msg Msg149("XSTEP_149");
68 switch(aStatus) {
69 case IGESData_ReferenceError: {
70 Message_Msg Msg216 ("IGES_216");
71 Msg149.Arg(Msg216.Value());
72 PR.SendFail(Msg149);
73 break; }
74 case IGESData_EntityError: {
75 Message_Msg Msg217 ("IGES_217");
76 Msg149.Arg(Msg217.Value());
77 PR.SendFail(Msg149);
78 break; }
79 default:{
80 }
81 }
82 }
83 if (!PR.ReadInteger(PR.Current(), aDirFlag)){ //szv#4:S4163:12Mar99 `st=` not needed
84 Message_Msg Msg150("XSTEP_150");
85 PR.SendFail(Msg150);
86 }
87 if (!PR.ReadInteger(PR.Current(), aDevFlag)){ //szv#4:S4163:12Mar99 `st=` not needed
88 Message_Msg Msg151("XSTEP_151");
89 PR.SendFail(Msg151);
90 }
91/*
92 st = PR.ReadEntity(IR, PR.Current(), "First Curve", aCurve);
93 st = PR.ReadEntity(IR, PR.Current(), "Second Curve", anotherCurve);
94 st = PR.ReadInteger(PR.Current(), "DirFlag", aDirFlag);
95 st = PR.ReadInteger(PR.Current(), "DevFlag ", aDevFlag);
96*/
97 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
98 ent->Init(aCurve, anotherCurve, aDirFlag, aDevFlag);
99}
100
101void IGESGeom_ToolRuledSurface::WriteOwnParams
102 (const Handle(IGESGeom_RuledSurface)& ent, IGESData_IGESWriter& IW) const
103{
104 IW.Send(ent->FirstCurve());
105 IW.Send(ent->SecondCurve());
106 IW.Send(ent->DirectionFlag());
107 IW.SendBoolean(ent->IsDevelopable());
108}
109
110void IGESGeom_ToolRuledSurface::OwnShared
111 (const Handle(IGESGeom_RuledSurface)& ent, Interface_EntityIterator& iter) const
112{
113 iter.GetOneItem(ent->FirstCurve());
114 iter.GetOneItem(ent->SecondCurve());
115}
116
117void IGESGeom_ToolRuledSurface::OwnCopy
118 (const Handle(IGESGeom_RuledSurface)& another,
119 const Handle(IGESGeom_RuledSurface)& ent, Interface_CopyTool& TC) const
120{
121 DeclareAndCast(IGESData_IGESEntity, aCurve,
122 TC.Transferred(another->FirstCurve()));
123 DeclareAndCast(IGESData_IGESEntity, anotherCurve,
124 TC.Transferred(another->SecondCurve()));
125 Standard_Integer aDirFlag = another->DirectionFlag();
126 Standard_Integer aDevFlag = (another->IsDevelopable() ? 1 : 0);
127
128 ent->Init(aCurve, anotherCurve, aDirFlag, aDevFlag);
129}
130
131IGESData_DirChecker IGESGeom_ToolRuledSurface::DirChecker
132 (const Handle(IGESGeom_RuledSurface)& /*ent*/ ) const
133{
134 IGESData_DirChecker DC(118, 0, 1);
135 DC.Structure(IGESData_DefVoid);
136 DC.LineFont(IGESData_DefAny);
137// DC.LineWeight(IGESData_DefValue);
138 DC.Color(IGESData_DefAny);
139 DC.HierarchyStatusIgnored();
140
141 return DC;
142}
143
144void IGESGeom_ToolRuledSurface::OwnCheck
145 (const Handle(IGESGeom_RuledSurface)& /*ent*/,
146 const Interface_ShareTool& , Handle(Interface_Check)& /*ach*/) const
147{
148}
149
150void IGESGeom_ToolRuledSurface::OwnDump
151 (const Handle(IGESGeom_RuledSurface)& ent, const IGESData_IGESDumper& dumper,
0ebe5b0a 152 Standard_OStream& S, const Standard_Integer level) const
7fd59977 153{
154 Standard_Integer tempSubLevel = (level <= 4) ? 0 : 1;
155
0ebe5b0a 156 S << "IGESGeom_RuledSurface\n"
157 << "First Curve : ";
7fd59977 158 dumper.Dump(ent->FirstCurve(),S, tempSubLevel);
0ebe5b0a 159 S << "\n"
160 << "Second Curve : ";
7fd59977 161 dumper.Dump(ent->SecondCurve(),S, tempSubLevel);
0ebe5b0a 162 S << "\n"
163 << "Direction Flag : " << ent->DirectionFlag() << " i.e.";
164 if (ent->DirectionFlag() == 0) S << "Join First to First, Last to Last\n";
165 else S << "Join First to Last, Last to First\n";
166 if (ent->IsDevelopable()) S << " .. Is Developable\n";
167 else S << " .. Is possibly not developable ..\n";
7fd59977 168}