0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / IGESAppli / IGESAppli_ToolNode.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
3// Copyright (c) 1999-2012 OPEN CASCADE SAS
4//
5// The content of this file is subject to the Open CASCADE Technology Public
6// License Version 6.5 (the "License"). You may not use the content of this file
7// except in compliance with the License. Please obtain a copy of the License
8// at http://www.opencascade.org and read it completely before using this file.
7fd59977 9//
b311480e 10// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
7fd59977 12//
b311480e 13// The Original Code and all software distributed under the License is
14// distributed on an "AS IS" basis, without warranty of any kind, and the
15// Initial Developer hereby disclaims all such warranties, including without
16// limitation, any warranties of merchantability, fitness for a particular
17// purpose or non-infringement. Please see the License for the specific terms
18// and conditions governing the rights and limitations under the License.
19
20//--------------------------------------------------------------------
7fd59977 21//--------------------------------------------------------------------
22
23#include <IGESAppli_ToolNode.ixx>
24#include <IGESData_ParamCursor.hxx>
25#include <IGESGeom_TransformationMatrix.hxx>
26#include <gp_XYZ.hxx>
27#include <gp_Pnt.hxx>
28#include <Interface_Macros.hxx>
29#include <Message_Messenger.hxx>
30
31IGESAppli_ToolNode::IGESAppli_ToolNode () { }
32
33
34void IGESAppli_ToolNode::ReadOwnParams
35 (const Handle(IGESAppli_Node)& ent,
36 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
37{
38 gp_XYZ tempCoordinates;
39 Handle(IGESGeom_TransformationMatrix) tempSystem;
40 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
41
42 //szv#4:S4163:12Mar99 `st=` not needed
43 PR.ReadXYZ(PR.CurrentList(1, 3),"Coordinates of Node (XYZ)",tempCoordinates);
44
45 if (PR.DefinedElseSkip())
46 PR.ReadEntity(IR,PR.Current(),"Transformation Matrix",
47 STANDARD_TYPE(IGESGeom_TransformationMatrix), tempSystem,Standard_True);
48
49 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
50 ent->Init(tempCoordinates,tempSystem);
51}
52
53void IGESAppli_ToolNode::WriteOwnParams
54 (const Handle(IGESAppli_Node)& ent, IGESData_IGESWriter& IW) const
55{
56 IW.Send(ent->Coord().X());
57 IW.Send(ent->Coord().Y());
58 IW.Send(ent->Coord().Z());
59 IW.Send(ent->System());
60}
61
62void IGESAppli_ToolNode::OwnShared
63 (const Handle(IGESAppli_Node)& ent, Interface_EntityIterator& iter) const
64{
65 iter.GetOneItem(ent->System());
66}
67
68void IGESAppli_ToolNode::OwnCopy
69 (const Handle(IGESAppli_Node)& another,
70 const Handle(IGESAppli_Node)& ent, Interface_CopyTool& TC) const
71{
72 gp_XYZ aCoord = (another->Coord()).XYZ();
73 DeclareAndCast(IGESGeom_TransformationMatrix,aSystem,
74 TC.Transferred(another->System()));
75
76 ent->Init(aCoord,aSystem);
77}
78
79IGESData_DirChecker IGESAppli_ToolNode::DirChecker
80 (const Handle(IGESAppli_Node)& /*ent*/ ) const
81{
82 IGESData_DirChecker DC(134,0); //Form no = 0 & Type = 134
83 DC.Structure(IGESData_DefVoid);
84 DC.LineFont(IGESData_DefVoid);
85 DC.LineWeight(IGESData_DefVoid);
86 DC.Color(IGESData_DefAny);
87 DC.UseFlagRequired(04);
88 return DC;
89}
90
91void IGESAppli_ToolNode::OwnCheck
92 (const Handle(IGESAppli_Node)& ent,
93 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
94{
95 if (!ent->HasSubScriptNumber())
96 ach->AddFail("SubScript Number expected (for Node Number) not present");
97 if (!ent->HasTransf())
98 ach->AddFail("Transformation Matrix expected, not present");
99 if (!ent->System().IsNull())
100 if (ent->System()->FormNumber() < 10)
101 ach->AddFail("System : Incorrect FormNumber (not 10-11-12)");
102}
103
104void IGESAppli_ToolNode::OwnDump
105 (const Handle(IGESAppli_Node)& ent, const IGESData_IGESDumper& dumper,
106 const Handle(Message_Messenger)& S, const Standard_Integer level) const
107{
108 S << "IGESAppli_Node" << endl;
109 S << " Nodal Coords : 1st " << ent->Coord().X()
110 << " 2nd : " << ent->Coord().Y() << " 3rd : " << ent->Coord().Z() <<endl;
111 S << "Nodal Displacement Coordinate System : ";
112 if (!ent->System().IsNull())
113 dumper.Dump(ent->System(),S, level);
114 else
115 S << "Global Cartesian Coordinate System (default)";
116 S << endl;
117}