PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/src/contrib/geom-5.1.2.7/src/GEOMAlgo/GEOMAlgo_StateCollector.cpp

http://pythonocc.googlecode.com/
C++ | 91 lines | 44 code | 1 blank | 46 comment | 13 complexity | 5e9aade5c4ca40a45ec31efd2ccc290a MD5 | raw file
 1//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 2//
 3//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 4//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 5//
 6//  This library is free software; you can redistribute it and/or
 7//  modify it under the terms of the GNU Lesser General Public
 8//  License as published by the Free Software Foundation; either
 9//  version 2.1 of the License.
10//
11//  This library is distributed in the hope that it will be useful,
12//  but WITHOUT ANY WARRANTY; without even the implied warranty of
13//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14//  Lesser General Public License for more details.
15//
16//  You should have received a copy of the GNU Lesser General Public
17//  License along with this library; if not, write to the Free Software
18//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19//
20//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22// File:	GEOMAlgo_StateCollector.cxx
23// Created:	Thu Mar 10 09:42:11 2005
24// Author:	Peter KURNEV
25//		<pkv@irinox>
26//
27#include <GEOMAlgo_StateCollector.ixx>
28
29//=======================================================================
30//function : GEOMAlgo_StateCollector
31//purpose  : 
32//=======================================================================
33GEOMAlgo_StateCollector::GEOMAlgo_StateCollector() 
34{
35  myCounter[0]=0;
36  myCounter[1]=0;
37  myCounter[2]=0;
38}
39//=======================================================================
40//function : AppendState
41//purpose  : 
42//=======================================================================
43Standard_Boolean GEOMAlgo_StateCollector::AppendState(const TopAbs_State aSt) 
44{
45  Standard_Boolean bIsToBreak;
46  //
47  switch(aSt) {
48    case TopAbs_IN:
49      ++myCounter[0];
50      break;
51    case TopAbs_OUT:
52      ++myCounter[1];
53      break; 
54    case TopAbs_ON:
55      ++myCounter[2];
56      break;
57    default:
58      break;
59  }
60  bIsToBreak=(myCounter[0] && myCounter[1]);
61  //
62  return bIsToBreak;
63}
64//=======================================================================
65//function : State
66//purpose  : 
67//=======================================================================
68TopAbs_State GEOMAlgo_StateCollector::State()const 
69{
70  TopAbs_State aSt;
71  //
72  aSt=TopAbs_UNKNOWN;
73  //
74  if (myCounter[0] && myCounter[1]) {
75    return aSt;
76  }
77  //
78  else if (myCounter[0] && myCounter[2]>=0) {
79    aSt=TopAbs_IN;
80  }
81  //
82  else if (myCounter[1] && myCounter[2]>=0) {
83    aSt=TopAbs_OUT;
84  }
85  //
86  else if (!myCounter[0] && !myCounter[1] && myCounter[2]) {
87    aSt=TopAbs_ON;
88  }
89  //
90  return aSt;
91}