1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18 //pdn 20.04.99 CTS22655 avoid of exceptions on empty loops
20 #include <IGESBasic_HArray1OfHArray1OfIGESEntity.hxx>
21 #include <IGESBasic_HArray1OfHArray1OfInteger.hxx>
22 #include <IGESData_IGESEntity.hxx>
23 #include <IGESSolid_EdgeList.hxx>
24 #include <IGESSolid_Loop.hxx>
25 #include <IGESSolid_VertexList.hxx>
26 #include <Standard_DimensionMismatch.hxx>
27 #include <Standard_Type.hxx>
29 IMPLEMENT_STANDARD_RTTIEXT(IGESSolid_Loop,IGESData_IGESEntity)
31 IGESSolid_Loop::IGESSolid_Loop () { }
34 void IGESSolid_Loop::Init
35 (const Handle(TColStd_HArray1OfInteger)& Types,
36 const Handle(IGESData_HArray1OfIGESEntity)& Edges,
37 const Handle(TColStd_HArray1OfInteger)& Index,
38 const Handle(TColStd_HArray1OfInteger)& Orient,
39 const Handle(TColStd_HArray1OfInteger)& nbParameterCurves,
40 const Handle(IGESBasic_HArray1OfHArray1OfInteger)& IsoparametricFlags,
41 const Handle(IGESBasic_HArray1OfHArray1OfIGESEntity)& Curves)
43 Standard_Integer nb = Types->Length();
45 if (Types->Lower() != 1 ||
46 Edges->Lower() != 1 || nb != Edges->Length() ||
47 Index->Lower() != 1 || nb != Index->Length() ||
48 Orient->Lower() != 1 || nb != Orient->Length() ||
49 nbParameterCurves->Lower() != 1 || nb != nbParameterCurves->Length() ||
50 IsoparametricFlags->Lower() != 1 || nb != IsoparametricFlags->Length() ||
51 Curves->Lower() != 1 || nb != Curves->Length() )
52 throw Standard_DimensionError("IGESSolid_Loop : Init");
57 theOrientationFlags = Orient;
58 theNbParameterCurves = nbParameterCurves;
59 theIsoparametricFlags = IsoparametricFlags;
62 InitTypeAndForm(508,1);
65 Standard_Boolean IGESSolid_Loop::IsBound () const
66 { return (FormNumber() == 1); }
68 void IGESSolid_Loop::SetBound (const Standard_Boolean bound)
69 { InitTypeAndForm(508, (bound ? 1 : 0)); }
72 Standard_Integer IGESSolid_Loop::NbEdges () const
74 //pdn 20.04.99 CTS22655 to avoid exceptions on empty loops
75 if(theEdges.IsNull()) return 0;
76 return theEdges->Length();
79 Standard_Integer IGESSolid_Loop::EdgeType (const Standard_Integer Index) const
81 return theTypes->Value(Index);
84 Handle(IGESData_IGESEntity) IGESSolid_Loop::Edge
85 (const Standard_Integer Index) const
87 return theEdges->Value(Index);
90 Standard_Boolean IGESSolid_Loop::Orientation (const Standard_Integer Index) const
92 return (theOrientationFlags->Value(Index) != 0);
95 Standard_Integer IGESSolid_Loop::NbParameterCurves
96 (const Standard_Integer Index) const
98 return theNbParameterCurves->Value(Index);
101 Standard_Boolean IGESSolid_Loop::IsIsoparametric
102 (const Standard_Integer EdgeIndex, const Standard_Integer CurveIndex) const
104 if (!theIsoparametricFlags->Value(EdgeIndex).IsNull()) return
105 (theIsoparametricFlags->Value(EdgeIndex)->Value(CurveIndex) != 0);
106 else return Standard_False; // faut bien dire qq chose
109 Handle(IGESData_IGESEntity) IGESSolid_Loop::ParametricCurve
110 (const Standard_Integer EdgeIndex, const Standard_Integer CurveIndex) const
112 Handle(IGESData_IGESEntity) acurve; // par defaut sera nulle
113 if (!theCurves->Value(EdgeIndex).IsNull()) acurve =
114 theCurves->Value(EdgeIndex)->Value(CurveIndex);
118 Standard_Integer IGESSolid_Loop::ListIndex (const Standard_Integer num) const
120 return theIndex->Value(num);