0025418: Debug output to be limited to OCC development environment
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_PointIterator.cxx
1 // Created on: 1993-06-17
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <TopOpeBRepDS_PointIterator.ixx>
18 #include <TopOpeBRepDS_Interference.hxx>
19 #include <TopOpeBRepDS_CurvePointInterference.hxx>
20 #include <TopOpeBRepDS_EdgeVertexInterference.hxx>
21 #include <Standard_ProgramError.hxx>
22
23 //=======================================================================
24 //function : TopOpeBRepDS_PointIterator
25 //purpose  : 
26 //=======================================================================
27
28 TopOpeBRepDS_PointIterator::TopOpeBRepDS_PointIterator
29   (const TopOpeBRepDS_ListOfInterference& L) :
30   TopOpeBRepDS_InterferenceIterator(L)
31 {
32   Match();
33 }
34
35 //=======================================================================
36 //function : MatchInterference
37 //purpose  : 
38 //=======================================================================
39
40 Standard_Boolean TopOpeBRepDS_PointIterator::MatchInterference
41    (const Handle(TopOpeBRepDS_Interference)& I) const
42 {
43   TopOpeBRepDS_Kind GT = I->GeometryType();
44   Standard_Boolean r = ( GT == TopOpeBRepDS_POINT) || ( GT == TopOpeBRepDS_VERTEX);
45   return r;
46 }
47
48 //=======================================================================
49 //function : Current
50 //purpose  : 
51 //=======================================================================
52
53 Standard_Integer  TopOpeBRepDS_PointIterator::Current()const 
54 {
55   return Value()->Geometry();
56 }
57
58
59 //=======================================================================
60 //function : Orientation
61 //purpose  : 
62 //=======================================================================
63
64 TopAbs_Orientation  TopOpeBRepDS_PointIterator::Orientation
65   (const TopAbs_State S)const 
66 {
67   Handle(TopOpeBRepDS_Interference) I = Value();
68   const TopOpeBRepDS_Transition& T = I->Transition();
69   TopAbs_Orientation o = T.Orientation(S);
70   return o;
71 }
72
73
74 //=======================================================================
75 //function : Parameter
76 //purpose  : 
77 //=======================================================================
78
79 Standard_Real  TopOpeBRepDS_PointIterator::Parameter()const 
80 {
81
82 #ifdef OCCT_DEBUG
83 //  cout<<"PointIterator : I = "; Value()->Dump(cout); cout<<endl;
84 #endif
85
86   const Handle(TopOpeBRepDS_Interference)& I = Value();
87   Handle(Standard_Type) T = I->DynamicType(); 
88   if      ( T == STANDARD_TYPE(TopOpeBRepDS_CurvePointInterference) ) { 
89     return (*((Handle(TopOpeBRepDS_CurvePointInterference)*)&I))->Parameter();
90   }
91   else if ( T == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) {
92     return (*((Handle(TopOpeBRepDS_EdgeVertexInterference)*)&I))->Parameter();
93   }
94   else {
95     Standard_ProgramError::Raise("TopOpeBRepDS_PointIterator::Parameter()");
96     return 0.;  // windowsNT
97   }
98 //  return 0.;  // windowsNT
99 }
100
101 //=======================================================================
102 //function : IsVertex
103 //purpose  : 
104 //=======================================================================
105
106 Standard_Boolean TopOpeBRepDS_PointIterator::IsVertex() const 
107 {
108   return (Value()->GeometryType() == TopOpeBRepDS_VERTEX);
109 }
110
111 //=======================================================================
112 //function : IsPoint
113 //purpose  : 
114 //=======================================================================
115
116 Standard_Boolean TopOpeBRepDS_PointIterator::IsPoint() const 
117 {
118   return (Value()->GeometryType() == TopOpeBRepDS_POINT);
119 }
120
121 //=======================================================================
122 //function : DiffOriented
123 //purpose  : 
124 //=======================================================================
125
126 Standard_Boolean TopOpeBRepDS_PointIterator::DiffOriented() const 
127 {
128   const Handle(TopOpeBRepDS_Interference)& I = Value();
129   if ( I->DynamicType() == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) {
130     return (*((Handle(TopOpeBRepDS_EdgeVertexInterference)*)&I))
131       ->Config() == TopOpeBRepDS_DIFFORIENTED;
132   }
133   else {
134     Standard_ProgramError::Raise("TopOpeBRepDS_PointIterator::DiffOriented()");
135     return Standard_False; // windowsNT
136   }
137 //  return Standard_False; // windowsNT
138 }
139
140 //=======================================================================
141 //function : SameOriented
142 //purpose  : 
143 //=======================================================================
144
145 Standard_Boolean TopOpeBRepDS_PointIterator::SameOriented() const 
146 {
147   const Handle(TopOpeBRepDS_Interference)& I = Value();
148   if ( I->DynamicType() == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) {
149     return (*((Handle(TopOpeBRepDS_EdgeVertexInterference)*)&I))
150       ->Config() == TopOpeBRepDS_SAMEORIENTED;
151   }
152   else {
153     Standard_ProgramError::Raise("TopOpeBRepDS_PointIterator::SameOriented()");
154     return Standard_False; // windowsNT
155   }
156 }
157
158 //=======================================================================
159 //function : Support
160 //purpose  : 
161 //=======================================================================
162
163 Standard_Integer TopOpeBRepDS_PointIterator::Support() const 
164 {
165   return (Value()->Support());
166 }