1 // Created on: 1994-12-16
2 // Created by: Laurent BUCHARD
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 // Modified by skv - Fri Jul 14 17:03:47 2006 OCC12627
24 #include <TopAbs_Orientation.hxx>
26 #include <gp_Vec2d.hxx>
28 //HatchGen_ElementsGen::HatchGen_ElementsGen(const HatchGen_ElementsGen& Other) {
29 HatchGen_ElementsGen::HatchGen_ElementsGen(const HatchGen_ElementsGen& ) {
30 cout<<" Magic Constructor in HatchGen_ElementsGen:: "<<endl;
33 HatchGen_ElementsGen::HatchGen_ElementsGen() {
39 void HatchGen_ElementsGen::Clear() {
43 Standard_Boolean HatchGen_ElementsGen::IsBound(const TheKey& K) const {
44 return(myMap.IsBound(K));
47 Standard_Boolean HatchGen_ElementsGen::UnBind(const TheKey& K) {
48 return(myMap.UnBind(K));
51 Standard_Boolean HatchGen_ElementsGen::Bind(const TheKey& K,const TheItem& I) {
52 return(myMap.Bind(K,I));
55 const TheItem& HatchGen_ElementsGen::Find(const TheKey& K) const {
56 return(myMap.Find(K));
59 TheItem& HatchGen_ElementsGen::ChangeFind(const TheKey& K) {
60 return(myMap.ChangeFind(K));
63 //=======================================================================
66 //=======================================================================
68 Standard_Boolean HatchGen_ElementsGen::Reject(const gp_Pnt2d&) const {
69 return Standard_False;
72 //=======================================================================
75 //=======================================================================
77 Standard_Boolean HatchGen_ElementsGen::Segment(const gp_Pnt2d& P,
83 return OtherSegment(P, L, Par);
86 //=======================================================================
89 //=======================================================================
91 Standard_Boolean HatchGen_ElementsGen::OtherSegment(const gp_Pnt2d& P,
95 HatchGen_DataMapIteratorOfMapOfElements Itertemp;
98 for( Itertemp.Initialize(myMap), i = 1; Itertemp.More(); Itertemp.Next(), i++) {
102 void *ptrmyMap = (void *)(&myMap);
103 TheItem& Item=((HatchGen_MapOfElements*)ptrmyMap)->ChangeFind(Itertemp.Key());
104 TheCurve& E = Item.ChangeCurve();
105 TopAbs_Orientation Or= Item.Orientation();
106 gp_Pnt2d P2 = E.Value
107 ((E.FirstParameter() + E.LastParameter()) *0.5);
108 if ((Or == TopAbs_FORWARD) ||
109 (Or == TopAbs_REVERSED)) {
112 if (Par >= gp::Resolution()) {
115 return Standard_True;
120 if (i == myCurEdge + 1) {
122 L = gp_Lin2d(P,gp_Dir2d(1,0));
125 return Standard_True;
128 return Standard_False;
131 //=======================================================================
132 //function : InitWires
134 //=======================================================================
136 void HatchGen_ElementsGen::InitWires() {
140 //=======================================================================
141 //function : RejectWire NYI
143 //=======================================================================
145 Standard_Boolean HatchGen_ElementsGen::RejectWire(const gp_Lin2d& ,
146 const Standard_Real) const
148 return Standard_False;
151 //=======================================================================
152 //function : InitEdges
154 //=======================================================================
156 void HatchGen_ElementsGen::InitEdges() {
158 Iter.Initialize(myMap);
161 //=======================================================================
162 //function : RejectEdge NYI
164 //=======================================================================
166 Standard_Boolean HatchGen_ElementsGen::RejectEdge(const gp_Lin2d& ,
167 const Standard_Real ) const
169 return Standard_False;
173 //=======================================================================
174 //function : CurrentEdge
176 //=======================================================================
178 void HatchGen_ElementsGen::CurrentEdge(TheCurve& E,
179 TopAbs_Orientation& Or) const
181 void *ptrmyMap = (void *)(&myMap);
182 TheItem& Item=((HatchGen_MapOfElements*)ptrmyMap)->ChangeFind(Iter.Key());
184 E = Item.ChangeCurve();
185 Or= Item.Orientation();
187 E.Edge() = TopoDS::Edge(myEExplorer.Current());
189 Or = E.Edge().Orientation();
194 //=======================================================================
195 //function : MoreWires
197 //=======================================================================
199 Standard_Boolean HatchGen_ElementsGen::MoreWires() const
201 return (NumWire == 0);
204 //=======================================================================
205 //function : NextWire
207 //=======================================================================
209 void HatchGen_ElementsGen::NextWire() {
213 //=======================================================================
214 //function : MoreEdges
216 //=======================================================================
218 Standard_Boolean HatchGen_ElementsGen::MoreEdges() const {
222 //=======================================================================
223 //function : NextEdge
225 //=======================================================================
227 void HatchGen_ElementsGen::NextEdge() {