0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / IGESSolid / IGESSolid_ToolSelectedComponent.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
7fd59977 19#include <gp_Pnt.hxx>
42cf5bc1 20#include <gp_XYZ.hxx>
21#include <IGESData_DirChecker.hxx>
7fd59977 22#include <IGESData_Dump.hxx>
42cf5bc1 23#include <IGESData_IGESDumper.hxx>
24#include <IGESData_IGESReaderData.hxx>
25#include <IGESData_IGESWriter.hxx>
26#include <IGESData_ParamCursor.hxx>
27#include <IGESData_ParamReader.hxx>
28#include <IGESSolid_BooleanTree.hxx>
29#include <IGESSolid_SelectedComponent.hxx>
30#include <IGESSolid_ToolSelectedComponent.hxx>
31#include <Interface_Check.hxx>
32#include <Interface_CopyTool.hxx>
33#include <Interface_EntityIterator.hxx>
7fd59977 34#include <Interface_Macros.hxx>
42cf5bc1 35#include <Interface_ShareTool.hxx>
36#include <Message_Messenger.hxx>
37#include <Standard_DomainError.hxx>
7fd59977 38
39IGESSolid_ToolSelectedComponent::IGESSolid_ToolSelectedComponent () { }
40
41
42void IGESSolid_ToolSelectedComponent::ReadOwnParams
43 (const Handle(IGESSolid_SelectedComponent)& ent,
44 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
45{
46 Handle(IGESSolid_BooleanTree) tempEntity;
47 gp_XYZ tempSelectPoint;
48 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
49
50 PR.ReadEntity(IR, PR.Current(), "Boolean Tree Entity",
51 STANDARD_TYPE(IGESSolid_BooleanTree), tempEntity); //szv#4:S4163:12Mar99 `st=` not needed
52
53 PR.ReadXYZ(PR.CurrentList(1, 3), "Select Point", tempSelectPoint); //szv#4:S4163:12Mar99 `st=` not needed
54
55 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
56 ent->Init(tempEntity, tempSelectPoint);
57}
58
59void IGESSolid_ToolSelectedComponent::WriteOwnParams
60 (const Handle(IGESSolid_SelectedComponent)& ent, IGESData_IGESWriter& IW) const
61{
62 IW.Send(ent->Component());
63 IW.Send(ent->SelectPoint().X());
64 IW.Send(ent->SelectPoint().Y());
65 IW.Send(ent->SelectPoint().Z());
66}
67
68void IGESSolid_ToolSelectedComponent::OwnShared
69 (const Handle(IGESSolid_SelectedComponent)& ent, Interface_EntityIterator& iter) const
70{
71 iter.GetOneItem(ent->Component());
72}
73
74void IGESSolid_ToolSelectedComponent::OwnCopy
75 (const Handle(IGESSolid_SelectedComponent)& another,
76 const Handle(IGESSolid_SelectedComponent)& ent, Interface_CopyTool& TC) const
77{
78 DeclareAndCast(IGESSolid_BooleanTree, tempEntity,
79 TC.Transferred(another->Component()));
80 gp_XYZ tempSelectPoint = another->SelectPoint().XYZ();
81 ent->Init (tempEntity, tempSelectPoint);
82}
83
84IGESData_DirChecker IGESSolid_ToolSelectedComponent::DirChecker
85 (const Handle(IGESSolid_SelectedComponent)& /* ent */ ) const
86{
87 IGESData_DirChecker DC(182, 0);
88
89 DC.Structure (IGESData_DefVoid);
90 DC.LineFont (IGESData_DefVoid);
91 DC.LineWeight (IGESData_DefVoid);
92 DC.Color (IGESData_DefAny);
93
94 DC.BlankStatusIgnored ();
95 DC.UseFlagRequired (3);
96 DC.HierarchyStatusIgnored ();
97 return DC;
98}
99
100void IGESSolid_ToolSelectedComponent::OwnCheck
101 (const Handle(IGESSolid_SelectedComponent)& /* ent */,
102 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
103{
104}
105
106void IGESSolid_ToolSelectedComponent::OwnDump
107 (const Handle(IGESSolid_SelectedComponent)& ent, const IGESData_IGESDumper& dumper,
0ebe5b0a 108 Standard_OStream& S, const Standard_Integer level) const
7fd59977 109{
0ebe5b0a 110 S << "IGESSolid_SelectedComponent\n";
7fd59977 111
112 // the heading for boolean tree is in BooleanTree OwnDump
0ebe5b0a 113 S << "Boolean Tree Entity :\n";
7fd59977 114 dumper.Dump(ent->Component(),S, (level <= 4) ? 0 : 1);
115 S << "Seleted Point : ";
116 IGESData_DumpXYZL(S,level, ent->SelectPoint(), ent->Location());
0ebe5b0a 117 S << std::endl;
7fd59977 118}