| 1 | // Created by: CKY / Contract Toubro-Larsen |
| 2 | // Copyright (c) 1993-1999 Matra Datavision |
| 3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
| 4 | // |
| 5 | // This file is part of Open CASCADE Technology software library. |
| 6 | // |
| 7 | // This library is free software; you can redistribute it and / or modify it |
| 8 | // under the terms of the GNU Lesser General Public 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. |
| 12 | // |
| 13 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 14 | // commercial license or contractual agreement. |
| 15 | |
| 16 | //-------------------------------------------------------------------- |
| 17 | //-------------------------------------------------------------------- |
| 18 | |
| 19 | #include <IGESAppli_ToolNode.ixx> |
| 20 | #include <IGESData_ParamCursor.hxx> |
| 21 | #include <IGESGeom_TransformationMatrix.hxx> |
| 22 | #include <gp_XYZ.hxx> |
| 23 | #include <gp_Pnt.hxx> |
| 24 | #include <Interface_Macros.hxx> |
| 25 | #include <Message_Messenger.hxx> |
| 26 | |
| 27 | IGESAppli_ToolNode::IGESAppli_ToolNode () { } |
| 28 | |
| 29 | |
| 30 | void IGESAppli_ToolNode::ReadOwnParams |
| 31 | (const Handle(IGESAppli_Node)& ent, |
| 32 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
| 33 | { |
| 34 | gp_XYZ tempCoordinates; |
| 35 | Handle(IGESGeom_TransformationMatrix) tempSystem; |
| 36 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
| 37 | |
| 38 | //szv#4:S4163:12Mar99 `st=` not needed |
| 39 | PR.ReadXYZ(PR.CurrentList(1, 3),"Coordinates of Node (XYZ)",tempCoordinates); |
| 40 | |
| 41 | if (PR.DefinedElseSkip()) |
| 42 | PR.ReadEntity(IR,PR.Current(),"Transformation Matrix", |
| 43 | STANDARD_TYPE(IGESGeom_TransformationMatrix), tempSystem,Standard_True); |
| 44 | |
| 45 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
| 46 | ent->Init(tempCoordinates,tempSystem); |
| 47 | } |
| 48 | |
| 49 | void IGESAppli_ToolNode::WriteOwnParams |
| 50 | (const Handle(IGESAppli_Node)& ent, IGESData_IGESWriter& IW) const |
| 51 | { |
| 52 | IW.Send(ent->Coord().X()); |
| 53 | IW.Send(ent->Coord().Y()); |
| 54 | IW.Send(ent->Coord().Z()); |
| 55 | IW.Send(ent->System()); |
| 56 | } |
| 57 | |
| 58 | void IGESAppli_ToolNode::OwnShared |
| 59 | (const Handle(IGESAppli_Node)& ent, Interface_EntityIterator& iter) const |
| 60 | { |
| 61 | iter.GetOneItem(ent->System()); |
| 62 | } |
| 63 | |
| 64 | void IGESAppli_ToolNode::OwnCopy |
| 65 | (const Handle(IGESAppli_Node)& another, |
| 66 | const Handle(IGESAppli_Node)& ent, Interface_CopyTool& TC) const |
| 67 | { |
| 68 | gp_XYZ aCoord = (another->Coord()).XYZ(); |
| 69 | DeclareAndCast(IGESGeom_TransformationMatrix,aSystem, |
| 70 | TC.Transferred(another->System())); |
| 71 | |
| 72 | ent->Init(aCoord,aSystem); |
| 73 | } |
| 74 | |
| 75 | IGESData_DirChecker IGESAppli_ToolNode::DirChecker |
| 76 | (const Handle(IGESAppli_Node)& /*ent*/ ) const |
| 77 | { |
| 78 | IGESData_DirChecker DC(134,0); //Form no = 0 & Type = 134 |
| 79 | DC.Structure(IGESData_DefVoid); |
| 80 | DC.LineFont(IGESData_DefVoid); |
| 81 | DC.LineWeight(IGESData_DefVoid); |
| 82 | DC.Color(IGESData_DefAny); |
| 83 | DC.UseFlagRequired(04); |
| 84 | return DC; |
| 85 | } |
| 86 | |
| 87 | void IGESAppli_ToolNode::OwnCheck |
| 88 | (const Handle(IGESAppli_Node)& ent, |
| 89 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
| 90 | { |
| 91 | if (!ent->HasSubScriptNumber()) |
| 92 | ach->AddFail("SubScript Number expected (for Node Number) not present"); |
| 93 | if (!ent->HasTransf()) |
| 94 | ach->AddFail("Transformation Matrix expected, not present"); |
| 95 | if (!ent->System().IsNull()) |
| 96 | if (ent->System()->FormNumber() < 10) |
| 97 | ach->AddFail("System : Incorrect FormNumber (not 10-11-12)"); |
| 98 | } |
| 99 | |
| 100 | void IGESAppli_ToolNode::OwnDump |
| 101 | (const Handle(IGESAppli_Node)& ent, const IGESData_IGESDumper& dumper, |
| 102 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
| 103 | { |
| 104 | S << "IGESAppli_Node" << endl; |
| 105 | S << " Nodal Coords : 1st " << ent->Coord().X() |
| 106 | << " 2nd : " << ent->Coord().Y() << " 3rd : " << ent->Coord().Z() <<endl; |
| 107 | S << "Nodal Displacement Coordinate System : "; |
| 108 | if (!ent->System().IsNull()) |
| 109 | dumper.Dump(ent->System(),S, level); |
| 110 | else |
| 111 | S << "Global Cartesian Coordinate System (default)"; |
| 112 | S << endl; |
| 113 | } |