0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / IGESSolid / IGESSolid_SolidAssembly.cxx
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 under
8 // the terms of the GNU Lesser General Public License 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 <IGESData_IGESEntity.hxx>
20 #include <IGESGeom_TransformationMatrix.hxx>
21 #include <IGESSolid_SolidAssembly.hxx>
22 #include <Standard_DimensionMismatch.hxx>
23 #include <Standard_OutOfRange.hxx>
24 #include <Standard_Type.hxx>
25
26 IMPLEMENT_STANDARD_RTTIEXT(IGESSolid_SolidAssembly,IGESData_IGESEntity)
27
28 IGESSolid_SolidAssembly::IGESSolid_SolidAssembly ()    {  }
29
30
31     void  IGESSolid_SolidAssembly::Init
32   (const Handle(IGESData_HArray1OfIGESEntity)& Items,
33    const Handle(IGESGeom_HArray1OfTransformationMatrix)& Matrices)
34 {
35   if (Items->Lower()  != 1 || Matrices->Lower() != 1 ||
36       Items->Length() != Matrices->Length())
37     throw Standard_DimensionError("IGESSolid_SolidAssembly : Init");
38
39   theItems    = Items;
40   theMatrices = Matrices;
41   InitTypeAndForm(184,0);
42 }
43
44     Standard_Boolean  IGESSolid_SolidAssembly::HasBrep () const
45       {  return (FormNumber() == 1);  }
46
47     void  IGESSolid_SolidAssembly::SetBrep (const Standard_Boolean hasbrep)
48       {  InitTypeAndForm(184, (hasbrep ? 1 : 0));  }
49
50
51     Standard_Integer  IGESSolid_SolidAssembly::NbItems () const
52 {
53   return theItems->Length();
54 }
55
56     Handle(IGESData_IGESEntity)  IGESSolid_SolidAssembly::Item
57   (const Standard_Integer Index) const
58 {
59   return theItems->Value(Index);
60 }
61
62     Handle(IGESGeom_TransformationMatrix) IGESSolid_SolidAssembly::TransfMatrix
63   (const Standard_Integer Index) const
64 {
65   return theMatrices->Value(Index);
66 }