1 // Created on: 1994-12-16
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1994-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 // Modified by skv - Fri Jul 14 17:03:47 2006 OCC12627
19 #include <Geom2dHatch_Elements.ixx>
21 #include <Standard_Integer.hxx>
22 #include <Geom2dHatch_Element.hxx>
23 #include <TColStd_MapIntegerHasher.hxx>
24 #include <Geom2dAdaptor_Curve.hxx>
26 #include <TopAbs_Orientation.hxx>
28 #include <gp_Vec2d.hxx>
30 Geom2dHatch_Elements::Geom2dHatch_Elements(const Geom2dHatch_Elements& )
32 cout<<" Magic Constructor in Geom2dHatch_Elements:: "<<endl;
35 Geom2dHatch_Elements::Geom2dHatch_Elements()
42 void Geom2dHatch_Elements::Clear()
47 Standard_Boolean Geom2dHatch_Elements::IsBound(const Standard_Integer K) const
49 return(myMap.IsBound(K));
52 Standard_Boolean Geom2dHatch_Elements::UnBind(const Standard_Integer K)
54 return(myMap.UnBind(K));
57 Standard_Boolean Geom2dHatch_Elements::Bind(const Standard_Integer K,const Geom2dHatch_Element& I)
59 return(myMap.Bind(K,I));
62 const Geom2dHatch_Element& Geom2dHatch_Elements::Find(const Standard_Integer K) const
64 return(myMap.Find(K));
67 Geom2dHatch_Element& Geom2dHatch_Elements::ChangeFind(const Standard_Integer K)
69 return(myMap.ChangeFind(K));
72 //=======================================================================
75 //=======================================================================
77 Standard_Boolean Geom2dHatch_Elements::Reject(const gp_Pnt2d&) const {
78 return Standard_False;
81 //=======================================================================
84 //=======================================================================
86 Standard_Boolean Geom2dHatch_Elements::Segment(const gp_Pnt2d& P,
92 return OtherSegment(P, L, Par);
95 //=======================================================================
98 //=======================================================================
100 Standard_Boolean Geom2dHatch_Elements::OtherSegment(const gp_Pnt2d& P,
104 Geom2dHatch_DataMapIteratorOfMapOfElements Itertemp;
107 for( Itertemp.Initialize(myMap), i = 1; Itertemp.More(); Itertemp.Next(), i++) {
111 void *ptrmyMap = (void *)(&myMap);
112 Geom2dHatch_Element& Item=((Geom2dHatch_MapOfElements*)ptrmyMap)->ChangeFind(Itertemp.Key());
113 Geom2dAdaptor_Curve& E = Item.ChangeCurve();
114 TopAbs_Orientation Or= Item.Orientation();
115 gp_Pnt2d P2 = E.Value
116 ((E.FirstParameter() + E.LastParameter()) *0.5);
117 if ((Or == TopAbs_FORWARD) ||
118 (Or == TopAbs_REVERSED)) {
121 if (Par >= gp::Resolution()) {
124 return Standard_True;
129 if (i == myCurEdge + 1) {
131 L = gp_Lin2d(P,gp_Dir2d(1,0));
134 return Standard_True;
137 return Standard_False;
140 //=======================================================================
141 //function : InitWires
143 //=======================================================================
145 void Geom2dHatch_Elements::InitWires() {
149 //=======================================================================
150 //function : RejectWire NYI
152 //=======================================================================
154 Standard_Boolean Geom2dHatch_Elements::RejectWire(const gp_Lin2d& ,
155 const Standard_Real) const
157 return Standard_False;
160 //=======================================================================
161 //function : InitEdges
163 //=======================================================================
165 void Geom2dHatch_Elements::InitEdges() {
167 Iter.Initialize(myMap);
170 //=======================================================================
171 //function : RejectEdge NYI
173 //=======================================================================
175 Standard_Boolean Geom2dHatch_Elements::RejectEdge(const gp_Lin2d& ,
176 const Standard_Real ) const
178 return Standard_False;
182 //=======================================================================
183 //function : CurrentEdge
185 //=======================================================================
187 void Geom2dHatch_Elements::CurrentEdge(Geom2dAdaptor_Curve& E,
188 TopAbs_Orientation& Or) const
190 void *ptrmyMap = (void *)(&myMap);
191 Geom2dHatch_Element& Item=((Geom2dHatch_MapOfElements*)ptrmyMap)->ChangeFind(Iter.Key());
193 E = Item.ChangeCurve();
194 Or= Item.Orientation();
196 E.Edge() = TopoDS::Edge(myEExplorer.Current());
198 Or = E.Edge().Orientation();
203 //=======================================================================
204 //function : MoreWires
206 //=======================================================================
208 Standard_Boolean Geom2dHatch_Elements::MoreWires() const
210 return (NumWire == 0);
213 //=======================================================================
214 //function : NextWire
216 //=======================================================================
218 void Geom2dHatch_Elements::NextWire() {
222 //=======================================================================
223 //function : MoreEdges
225 //=======================================================================
227 Standard_Boolean Geom2dHatch_Elements::MoreEdges() const {
231 //=======================================================================
232 //function : NextEdge
234 //=======================================================================
236 void Geom2dHatch_Elements::NextEdge() {