summaryrefslogtreecommitdiff
path: root/src/IGESSolid/IGESSolid_Loop.cxx
blob: 264f222ea3061a5d224d7383c1cea7b2ae3c60ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//--------------------------------------------------------------------
//
//  File Name : IGESSolid_Loop.cxx
//  Date      :
//  Author    : CKY / Contract Toubro-Larsen
//  Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------
//pdn 20.04.99 CTS22655 avoid of exceptions on empty loops

#include <IGESSolid_Loop.ixx>
#include <IGESSolid_EdgeList.hxx>
#include <IGESSolid_VertexList.hxx>


    IGESSolid_Loop::IGESSolid_Loop ()    {  }


    void  IGESSolid_Loop::Init
  (const Handle(TColStd_HArray1OfInteger)& Types,
   const Handle(IGESData_HArray1OfIGESEntity)& Edges,
   const Handle(TColStd_HArray1OfInteger)& Index,
   const Handle(TColStd_HArray1OfInteger)& Orient,
   const Handle(TColStd_HArray1OfInteger)& nbParameterCurves,
   const Handle(IGESBasic_HArray1OfHArray1OfInteger)& IsoparametricFlags,
   const Handle(IGESBasic_HArray1OfHArray1OfIGESEntity)& Curves)
{
  Standard_Integer nb = Types->Length();

  if (Types->Lower()  != 1 ||
      Edges->Lower()  != 1 || nb != Edges->Length()  ||
      Index->Lower()  != 1 || nb != Index->Length()  ||
      Orient->Lower() != 1 || nb != Orient->Length() ||
      nbParameterCurves->Lower() != 1 || nb != nbParameterCurves->Length() ||
      IsoparametricFlags->Lower() != 1 || nb != IsoparametricFlags->Length() ||
      Curves->Lower() != 1 || nb != Curves->Length() )
    Standard_DimensionError::Raise("IGESSolid_Loop : Init");

  theTypes  = Types;
  theEdges  = Edges;
  theIndex  = Index;
  theOrientationFlags   = Orient;
  theNbParameterCurves  = nbParameterCurves;
  theIsoparametricFlags = IsoparametricFlags;
  theCurves = Curves;

  InitTypeAndForm(508,1);
}

    Standard_Boolean  IGESSolid_Loop::IsBound () const
      {  return (FormNumber() == 1);  }

    void  IGESSolid_Loop::SetBound (const Standard_Boolean bound)
      {  InitTypeAndForm(508, (bound ? 1 : 0));  }


    Standard_Integer  IGESSolid_Loop::NbEdges () const
{
  //pdn 20.04.99 CTS22655 to avoid exceptions on empty loops
  if(theEdges.IsNull()) return 0;
  return theEdges->Length();
}

    Standard_Integer  IGESSolid_Loop::EdgeType (const Standard_Integer Index) const
{
  return theTypes->Value(Index);
}

    Handle(IGESData_IGESEntity)  IGESSolid_Loop::Edge
  (const Standard_Integer Index) const
{
  return theEdges->Value(Index);
}

    Standard_Boolean IGESSolid_Loop::Orientation (const Standard_Integer Index) const
{
  return (theOrientationFlags->Value(Index) != 0);
}

    Standard_Integer  IGESSolid_Loop::NbParameterCurves
  (const Standard_Integer Index) const
{
  return theNbParameterCurves->Value(Index);
}

    Standard_Boolean  IGESSolid_Loop::IsIsoparametric
  (const Standard_Integer EdgeIndex, const Standard_Integer CurveIndex) const
{
  if (!theIsoparametricFlags->Value(EdgeIndex).IsNull()) return
    (theIsoparametricFlags->Value(EdgeIndex)->Value(CurveIndex) != 0);
  else return Standard_False;  // faut bien dire qq chose
}

    Handle(IGESData_IGESEntity)  IGESSolid_Loop::ParametricCurve
  (const Standard_Integer EdgeIndex, const Standard_Integer CurveIndex) const
{
  Handle(IGESData_IGESEntity) acurve;    // par defaut sera nulle
  if (!theCurves->Value(EdgeIndex).IsNull()) acurve =
    theCurves->Value(EdgeIndex)->Value(CurveIndex);
  return acurve;
}

    Standard_Integer  IGESSolid_Loop::ListIndex (const Standard_Integer num) const
{
  return theIndex->Value(num);
}