0031501: Foundation Classes, Message_Printer - remove theToPutEndl argument -- prepar...
[occt.git] / src / IGESSolid / IGESSolid_Loop.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//pdn 20.04.99 CTS22655 avoid of exceptions on empty loops
19
42cf5bc1 20#include <IGESBasic_HArray1OfHArray1OfIGESEntity.hxx>
21#include <IGESBasic_HArray1OfHArray1OfInteger.hxx>
22#include <IGESData_IGESEntity.hxx>
7fd59977 23#include <IGESSolid_EdgeList.hxx>
42cf5bc1 24#include <IGESSolid_Loop.hxx>
7fd59977 25#include <IGESSolid_VertexList.hxx>
42cf5bc1 26#include <Standard_DimensionMismatch.hxx>
27#include <Standard_OutOfRange.hxx>
28#include <Standard_Type.hxx>
7fd59977 29
92efcf78 30IMPLEMENT_STANDARD_RTTIEXT(IGESSolid_Loop,IGESData_IGESEntity)
31
b311480e 32IGESSolid_Loop::IGESSolid_Loop () { }
7fd59977 33
34
35 void IGESSolid_Loop::Init
36 (const Handle(TColStd_HArray1OfInteger)& Types,
37 const Handle(IGESData_HArray1OfIGESEntity)& Edges,
38 const Handle(TColStd_HArray1OfInteger)& Index,
39 const Handle(TColStd_HArray1OfInteger)& Orient,
40 const Handle(TColStd_HArray1OfInteger)& nbParameterCurves,
41 const Handle(IGESBasic_HArray1OfHArray1OfInteger)& IsoparametricFlags,
42 const Handle(IGESBasic_HArray1OfHArray1OfIGESEntity)& Curves)
43{
44 Standard_Integer nb = Types->Length();
45
46 if (Types->Lower() != 1 ||
47 Edges->Lower() != 1 || nb != Edges->Length() ||
48 Index->Lower() != 1 || nb != Index->Length() ||
49 Orient->Lower() != 1 || nb != Orient->Length() ||
50 nbParameterCurves->Lower() != 1 || nb != nbParameterCurves->Length() ||
51 IsoparametricFlags->Lower() != 1 || nb != IsoparametricFlags->Length() ||
52 Curves->Lower() != 1 || nb != Curves->Length() )
9775fa61 53 throw Standard_DimensionError("IGESSolid_Loop : Init");
7fd59977 54
55 theTypes = Types;
56 theEdges = Edges;
57 theIndex = Index;
58 theOrientationFlags = Orient;
59 theNbParameterCurves = nbParameterCurves;
60 theIsoparametricFlags = IsoparametricFlags;
61 theCurves = Curves;
62
63 InitTypeAndForm(508,1);
64}
65
66 Standard_Boolean IGESSolid_Loop::IsBound () const
67 { return (FormNumber() == 1); }
68
69 void IGESSolid_Loop::SetBound (const Standard_Boolean bound)
70 { InitTypeAndForm(508, (bound ? 1 : 0)); }
71
72
73 Standard_Integer IGESSolid_Loop::NbEdges () const
74{
75 //pdn 20.04.99 CTS22655 to avoid exceptions on empty loops
76 if(theEdges.IsNull()) return 0;
77 return theEdges->Length();
78}
79
80 Standard_Integer IGESSolid_Loop::EdgeType (const Standard_Integer Index) const
81{
82 return theTypes->Value(Index);
83}
84
85 Handle(IGESData_IGESEntity) IGESSolid_Loop::Edge
86 (const Standard_Integer Index) const
87{
88 return theEdges->Value(Index);
89}
90
91 Standard_Boolean IGESSolid_Loop::Orientation (const Standard_Integer Index) const
92{
93 return (theOrientationFlags->Value(Index) != 0);
94}
95
96 Standard_Integer IGESSolid_Loop::NbParameterCurves
97 (const Standard_Integer Index) const
98{
99 return theNbParameterCurves->Value(Index);
100}
101
102 Standard_Boolean IGESSolid_Loop::IsIsoparametric
103 (const Standard_Integer EdgeIndex, const Standard_Integer CurveIndex) const
104{
105 if (!theIsoparametricFlags->Value(EdgeIndex).IsNull()) return
106 (theIsoparametricFlags->Value(EdgeIndex)->Value(CurveIndex) != 0);
107 else return Standard_False; // faut bien dire qq chose
108}
109
110 Handle(IGESData_IGESEntity) IGESSolid_Loop::ParametricCurve
111 (const Standard_Integer EdgeIndex, const Standard_Integer CurveIndex) const
112{
113 Handle(IGESData_IGESEntity) acurve; // par defaut sera nulle
114 if (!theCurves->Value(EdgeIndex).IsNull()) acurve =
115 theCurves->Value(EdgeIndex)->Value(CurveIndex);
116 return acurve;
117}
118
119 Standard_Integer IGESSolid_Loop::ListIndex (const Standard_Integer num) const
120{
121 return theIndex->Value(num);
122}