0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / IGESAppli / IGESAppli_ToolReferenceDesignator.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 <IGESAppli_ReferenceDesignator.hxx>
20#include <IGESAppli_ToolReferenceDesignator.hxx>
21#include <IGESData_DirChecker.hxx>
22#include <IGESData_Dump.hxx>
23#include <IGESData_IGESDumper.hxx>
24#include <IGESData_IGESReaderData.hxx>
25#include <IGESData_IGESWriter.hxx>
7fd59977 26#include <IGESData_LevelListEntity.hxx>
42cf5bc1 27#include <IGESData_ParamReader.hxx>
28#include <Interface_Check.hxx>
29#include <Interface_CopyTool.hxx>
30#include <Interface_EntityIterator.hxx>
42cf5bc1 31#include <Interface_ShareTool.hxx>
42cf5bc1 32#include <TCollection_HAsciiString.hxx>
7fd59977 33
34IGESAppli_ToolReferenceDesignator::IGESAppli_ToolReferenceDesignator () { }
35
36
37void IGESAppli_ToolReferenceDesignator::ReadOwnParams
38 (const Handle(IGESAppli_ReferenceDesignator)& ent,
39 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
40{
41 Standard_Integer tempNbPropertyValues;
42 Handle(TCollection_HAsciiString) tempReferenceDesignator;
43 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
44
45 //szv#4:S4163:12Mar99 `st=` not needed
46 PR.ReadInteger(PR.Current(),"Number of property values",tempNbPropertyValues);
47 PR.ReadText(PR.Current(),"ReferenceDesignator",tempReferenceDesignator);
48
49 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
50 ent->Init(tempNbPropertyValues,tempReferenceDesignator);
51}
52
53void IGESAppli_ToolReferenceDesignator::WriteOwnParams
54 (const Handle(IGESAppli_ReferenceDesignator)& ent, IGESData_IGESWriter& IW) const
55{
56 IW.Send(ent->NbPropertyValues());
57 IW.Send(ent->RefDesignatorText());
58}
59
60void IGESAppli_ToolReferenceDesignator::OwnShared
61 (const Handle(IGESAppli_ReferenceDesignator)& /* ent */, Interface_EntityIterator& /* iter */) const
62{
63}
64
65void IGESAppli_ToolReferenceDesignator::OwnCopy
66 (const Handle(IGESAppli_ReferenceDesignator)& another,
67 const Handle(IGESAppli_ReferenceDesignator)& ent, Interface_CopyTool& /* TC */) const
68{
69 Standard_Integer aNbPropertyValues;
70 Handle(TCollection_HAsciiString) aReferenceDesignator =
71 new TCollection_HAsciiString(another->RefDesignatorText());
72 aNbPropertyValues = another->NbPropertyValues();
73 ent->Init(aNbPropertyValues,aReferenceDesignator);
74}
75
76Standard_Boolean IGESAppli_ToolReferenceDesignator::OwnCorrect
77 (const Handle(IGESAppli_ReferenceDesignator)& ent) const
78{
79 Standard_Boolean res = (ent->NbPropertyValues() != 1);
80 if (res) ent->Init(1,ent->RefDesignatorText());
81// nbpropertyvalues=1
82 if (ent->SubordinateStatus() != 0) {
83 Handle(IGESData_LevelListEntity) nulevel;
84 ent->InitLevel(nulevel,0);
85 res = Standard_True;
86 }
87 return res; // + RAZ level selon subordibate
88}
89
90IGESData_DirChecker IGESAppli_ToolReferenceDesignator::DirChecker
91 (const Handle(IGESAppli_ReferenceDesignator)& /* ent */ ) const
92{
93 //UNFINISHED
94 IGESData_DirChecker DC(406,7); //Form no = 7 & Type = 406
95 DC.Structure(IGESData_DefVoid);
96 DC.GraphicsIgnored();
97 DC.BlankStatusIgnored();
98 DC.UseFlagIgnored();
99 DC.HierarchyStatusIgnored();
100 return DC;
101}
102
103void IGESAppli_ToolReferenceDesignator::OwnCheck
104 (const Handle(IGESAppli_ReferenceDesignator)& ent,
105 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
106{
107 if (ent->SubordinateStatus() != 0)
108 //the level is ignored if this property is subordinate
109 if (ent->DefLevel() != IGESData_DefOne &&
110 ent->DefLevel() != IGESData_DefSeveral)
111 ach->AddFail("Level type: Not value/reference");
112 if (ent->NbPropertyValues() != 1)
113 ach->AddFail("Number of Property Values != 1");
114 //UNFINISHED
115 //the level is ignored if this property is subordinate -- queried
116}
117
118void IGESAppli_ToolReferenceDesignator::OwnDump
119 (const Handle(IGESAppli_ReferenceDesignator)& ent, const IGESData_IGESDumper& /* dumper */,
0ebe5b0a 120 Standard_OStream& S, const Standard_Integer /* level */) const
7fd59977 121{
0ebe5b0a 122 S << "IGESAppli_ReferenceDesignator\n";
123 S << "Number of Property Values : " << ent->NbPropertyValues() << "\n";
7fd59977 124 S << "ReferenceDesignator : ";
125 IGESData_DumpString(S,ent->RefDesignatorText());
0ebe5b0a 126 S << std::endl;
7fd59977 127}