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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
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>
23 //=======================================================================
24 //function : TopOpeBRepDS_PointIterator
26 //=======================================================================
28 TopOpeBRepDS_PointIterator::TopOpeBRepDS_PointIterator
29 (const TopOpeBRepDS_ListOfInterference& L) :
30 TopOpeBRepDS_InterferenceIterator(L)
35 //=======================================================================
36 //function : MatchInterference
38 //=======================================================================
40 Standard_Boolean TopOpeBRepDS_PointIterator::MatchInterference
41 (const Handle(TopOpeBRepDS_Interference)& I) const
43 TopOpeBRepDS_Kind GT = I->GeometryType();
44 Standard_Boolean r = ( GT == TopOpeBRepDS_POINT) || ( GT == TopOpeBRepDS_VERTEX);
48 //=======================================================================
51 //=======================================================================
53 Standard_Integer TopOpeBRepDS_PointIterator::Current()const
55 return Value()->Geometry();
59 //=======================================================================
60 //function : Orientation
62 //=======================================================================
64 TopAbs_Orientation TopOpeBRepDS_PointIterator::Orientation
65 (const TopAbs_State S)const
67 Handle(TopOpeBRepDS_Interference) I = Value();
68 const TopOpeBRepDS_Transition& T = I->Transition();
69 TopAbs_Orientation o = T.Orientation(S);
74 //=======================================================================
75 //function : Parameter
77 //=======================================================================
79 Standard_Real TopOpeBRepDS_PointIterator::Parameter()const
83 // cout<<"PointIterator : I = "; Value()->Dump(cout); cout<<endl;
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)::DownCast (I)->Parameter();
91 else if ( T == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) {
92 return Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast (I)->Parameter();
95 Standard_ProgramError::Raise("TopOpeBRepDS_PointIterator::Parameter()");
96 return 0.; // windowsNT
98 // return 0.; // windowsNT
101 //=======================================================================
102 //function : IsVertex
104 //=======================================================================
106 Standard_Boolean TopOpeBRepDS_PointIterator::IsVertex() const
108 return (Value()->GeometryType() == TopOpeBRepDS_VERTEX);
111 //=======================================================================
114 //=======================================================================
116 Standard_Boolean TopOpeBRepDS_PointIterator::IsPoint() const
118 return (Value()->GeometryType() == TopOpeBRepDS_POINT);
121 //=======================================================================
122 //function : DiffOriented
124 //=======================================================================
126 Standard_Boolean TopOpeBRepDS_PointIterator::DiffOriented() const
128 const Handle(TopOpeBRepDS_Interference)& I = Value();
129 if ( I->DynamicType() == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) {
130 return Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast (I)
131 ->Config() == TopOpeBRepDS_DIFFORIENTED;
134 Standard_ProgramError::Raise("TopOpeBRepDS_PointIterator::DiffOriented()");
135 return Standard_False; // windowsNT
137 // return Standard_False; // windowsNT
140 //=======================================================================
141 //function : SameOriented
143 //=======================================================================
145 Standard_Boolean TopOpeBRepDS_PointIterator::SameOriented() const
147 const Handle(TopOpeBRepDS_Interference)& I = Value();
148 if ( I->DynamicType() == STANDARD_TYPE(TopOpeBRepDS_EdgeVertexInterference) ) {
149 return Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast (I)
150 ->Config() == TopOpeBRepDS_SAMEORIENTED;
153 Standard_ProgramError::Raise("TopOpeBRepDS_PointIterator::SameOriented()");
154 return Standard_False; // windowsNT
158 //=======================================================================
161 //=======================================================================
163 Standard_Integer TopOpeBRepDS_PointIterator::Support() const
165 return (Value()->Support());