summaryrefslogtreecommitdiff
path: root/src/Sweep/Sweep_NumShapeIterator.cxx
blob: 5cb339bd2f527b78ef3358265908b93268f83889 (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
// File:	Sweep_NumShapeIterator.cxx
// Created:	Thu Jun  3 10:46:16 1993
// Author:	Laurent BOURESCHE
//		<lbo@phylox>

#include <Sweep_NumShapeIterator.ixx>

//=======================================================================
//function : Sweep_NumShapeIterator
//purpose  : 
//=======================================================================

Sweep_NumShapeIterator::Sweep_NumShapeIterator():
       myNumShape(0,TopAbs_SHAPE),
       myCurrentNumShape(0,TopAbs_SHAPE)
{
}


//=======================================================================
//function : Init
//purpose  : 
//=======================================================================

void  Sweep_NumShapeIterator::Init(const Sweep_NumShape& aShape)
{
  myNumShape = aShape;
  if (myNumShape.Type()==TopAbs_EDGE){
    Standard_Integer nbvert = myNumShape.Index();
    myMore = (nbvert >= 1);
    if (myMore){
      myCurrentRange = 1;
      myCurrentNumShape = Sweep_NumShape(1,TopAbs_VERTEX,
					 myNumShape.Closed(),
					 Standard_False,
					 Standard_False);
      if (nbvert==1){
	if (myNumShape.BegInfinite()){
	  myCurrentOrientation = TopAbs_REVERSED;
	}
	else {
	  myCurrentOrientation = TopAbs_FORWARD;
	}
      }
      else {
	myCurrentOrientation = TopAbs_FORWARD;
      }
    }
  }
}


//=======================================================================
//function : Next
//purpose  : 
//=======================================================================

void  Sweep_NumShapeIterator::Next()
{
  myCurrentRange++;
  myMore = myCurrentRange <= myNumShape.Index();
  if (myMore){
    if (myNumShape.Type()==TopAbs_EDGE){
      myCurrentNumShape = Sweep_NumShape(myCurrentRange,TopAbs_VERTEX,
					 myNumShape.Closed(),
					 Standard_False,
					 Standard_False);
      myCurrentOrientation = TopAbs_REVERSED;
    }
  }
}