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_HDataStructure.ixx>
19 #include <TopOpeBRepDS_EdgeInterferenceTool.hxx>
20 #include <BRep_Tool.hxx>
22 #include <TopoDS_Edge.hxx>
23 #include <TopExp_Explorer.hxx>
24 #include <TopTools_ListOfShape.hxx>
25 #include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
26 #include <TopOpeBRepDS_Transition.hxx>
27 #include <TopAbs_ShapeEnum.hxx>
28 #include <TopOpeBRepDS.hxx>
29 #include <TopOpeBRepDS_Interference.hxx>
30 #include <TopOpeBRepDS_ListOfInterference.hxx>
31 #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
32 #include <TopOpeBRepDS_Check.hxx>
33 #include <TopOpeBRepTool_ShapeExplorer.hxx>
34 #include <TopOpeBRepDS_Filter.hxx>
35 #include <TopOpeBRepDS_Reducer.hxx>
36 #include <TopOpeBRepDS_Dumper.hxx>
37 #include <Standard_ProgramError.hxx>
38 #include <TopOpeBRepDS_define.hxx>
41 extern Standard_Boolean TopOpeBRepDS_GettraceISTO();
42 extern Standard_Boolean TopOpeBRepDS_GettraceEDSF();
43 extern Standard_Boolean TopOpeBRepDS_GettraceDSF();
44 extern Standard_Boolean TopOpeBRepDS_GettraceDSFD();
45 extern Standard_Boolean TopOpeBRepDS_GettraceDEGEN();
46 extern Standard_Boolean TopOpeBRepDS_GettracePCI();
47 extern Standard_Boolean TopOpeBRepDS_GettracePI();
48 extern Standard_Boolean TopOpeBRepDS_GettracePEI();
49 extern Standard_Boolean TopOpeBRepDS_GettracePI();
50 extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer);
52 static Standard_Boolean traceSTORE()
54 Standard_Boolean trc = Standard_False;
55 trc = trc || TopOpeBRepDS_GettraceEDSF();
56 trc = trc || TopOpeBRepDS_GettraceDSF();
57 trc = trc || TopOpeBRepDS_GettraceDEGEN();
58 trc = trc || TopOpeBRepDS_GettraceISTO();
63 static void FUN_HDS_data(const Handle(TopOpeBRepDS_Interference)& I,
64 TopOpeBRepDS_Kind& GT1,Standard_Integer& G1,
65 TopOpeBRepDS_Kind& ST1,Standard_Integer& S1)
67 if (I.IsNull()) return;
68 GT1 = I->GeometryType(); G1 = I->Geometry();
69 ST1 = I->SupportType(); S1 = I->Support();
73 Standard_EXPORT Standard_Boolean FUN_HDS_FACESINTERFER
74 (const TopoDS_Shape& F1, const TopoDS_Shape& F2,
75 const Handle(TopOpeBRepDS_HDataStructure)& HDS)
77 Standard_Boolean yainterf = Standard_False;
78 const TopOpeBRepDS_DataStructure& DS = HDS->DS();
79 Standard_Boolean ya = DS.HasShape(F1);
80 if ( !ya ) return Standard_False;
83 Standard_Integer iF2 = DS.Shape(F2);
85 const TopOpeBRepDS_ListOfInterference& L1 = DS.ShapeInterferences(F1);
86 TopOpeBRepDS_ListIteratorOfListOfInterference itL1(L1);
87 for (;itL1.More(); itL1.Next()) {
88 const Handle(TopOpeBRepDS_Interference)& I = itL1.Value();
89 TopOpeBRepDS_Kind GT = TopOpeBRepDS_UNKNOWN, ST = TopOpeBRepDS_UNKNOWN; Standard_Integer G,S = 0;
90 FUN_HDS_data(I,GT,G,ST,S);
91 // interference face1/edge/face2
92 Standard_Boolean fef = Standard_True;
93 fef = fef && (GT==TopOpeBRepDS_EDGE);
94 fef = fef && (ST==TopOpeBRepDS_FACE);
95 fef = fef && (S==iF2);
97 yainterf = Standard_True;
105 //=======================================================================
106 //function : TopOpeBRepDS_HDataStructure
108 //=======================================================================
109 TopOpeBRepDS_HDataStructure::TopOpeBRepDS_HDataStructure()
113 //=======================================================================
114 //function : AddAncestors
116 //=======================================================================
117 void TopOpeBRepDS_HDataStructure::AddAncestors
118 (const TopoDS_Shape& S)
120 AddAncestors(S,TopAbs_WIRE,TopAbs_EDGE);
121 AddAncestors(S,TopAbs_FACE,TopAbs_WIRE);
122 AddAncestors(S,TopAbs_SHELL,TopAbs_FACE);
123 AddAncestors(S,TopAbs_SOLID,TopAbs_SHELL);
126 //=======================================================================
127 //function : AddAncestors
129 //=======================================================================
130 void TopOpeBRepDS_HDataStructure::AddAncestors
131 (const TopoDS_Shape& S,
132 const TopAbs_ShapeEnum T1,const TopAbs_ShapeEnum T2)
134 TopOpeBRepDS_DataStructure& BDS = ChangeDS();
135 Standard_Integer rankS = myDS.AncestorRank(S);
136 // find the shapes of type T1 containing HasShape() of type T2
137 for (TopOpeBRepTool_ShapeExplorer eT1(S,T1); eT1.More(); eT1.Next()) {
138 const TopoDS_Shape& ST1 = eT1.Current();
139 for (TopOpeBRepTool_ShapeExplorer eT2(ST1,T2); eT2.More(); eT2.Next()) {
140 const TopoDS_Shape& ST2 = eT2.Current();
141 if (BDS.HasShape(ST2)) {
142 BDS.AddShape(ST1,rankS);
149 //=======================================================================
151 //purpose : Check Integrity
152 //=======================================================================
153 void TopOpeBRepDS_HDataStructure::ChkIntg()
155 // Check the integrity of the DS
156 Handle(TopOpeBRepDS_Check) chk = new TopOpeBRepDS_Check(this);
158 // chk->PrintIntg(cout);
161 //=======================================================================
164 //=======================================================================
165 const TopOpeBRepDS_DataStructure& TopOpeBRepDS_HDataStructure::DS()const
170 //=======================================================================
171 //function : ChangeDS
173 //=======================================================================
174 TopOpeBRepDS_DataStructure& TopOpeBRepDS_HDataStructure::ChangeDS()
179 //=======================================================================
180 //function : NbSurfaces
182 //=======================================================================
183 Standard_Integer TopOpeBRepDS_HDataStructure::NbSurfaces()const
185 return myDS.NbSurfaces();
188 //=======================================================================
189 //function : NbCurves
191 //=======================================================================
192 Standard_Integer TopOpeBRepDS_HDataStructure::NbCurves()const
194 return myDS.NbCurves();
197 //=======================================================================
198 //function : NbPoints
200 //=======================================================================
201 Standard_Integer TopOpeBRepDS_HDataStructure::NbPoints()const
203 return myDS.NbPoints();
206 //=======================================================================
209 //=======================================================================
210 const TopOpeBRepDS_Surface& TopOpeBRepDS_HDataStructure::Surface
211 (const Standard_Integer I)const
213 return myDS.Surface(I);
216 //=======================================================================
217 //function : SurfaceCurves
219 //=======================================================================
220 TopOpeBRepDS_CurveIterator TopOpeBRepDS_HDataStructure::SurfaceCurves
221 (const Standard_Integer I)const
223 const TopOpeBRepDS_ListOfInterference& L = myDS.SurfaceInterferences(I);
224 return TopOpeBRepDS_CurveIterator(L);
227 //=======================================================================
230 //=======================================================================
231 const TopOpeBRepDS_Curve& TopOpeBRepDS_HDataStructure::Curve
232 (const Standard_Integer I)const
234 return myDS.Curve(I);
237 //=======================================================================
238 //function : ChangeCurve
240 //=======================================================================
241 TopOpeBRepDS_Curve& TopOpeBRepDS_HDataStructure::ChangeCurve
242 (const Standard_Integer I)
244 return myDS.ChangeCurve(I);
247 //=======================================================================
248 //function : CurvePoints
250 //=======================================================================
251 TopOpeBRepDS_PointIterator TopOpeBRepDS_HDataStructure::CurvePoints
252 (const Standard_Integer I)const
254 const TopOpeBRepDS_ListOfInterference& L = myDS.CurveInterferences(I);
255 return TopOpeBRepDS_PointIterator(L);
258 //=======================================================================
261 //=======================================================================
262 const TopOpeBRepDS_Point& TopOpeBRepDS_HDataStructure::Point
263 (const Standard_Integer I)const
265 return myDS.Point(I);
268 //=======================================================================
269 //function : HasGeometry
271 //=======================================================================
272 Standard_Boolean TopOpeBRepDS_HDataStructure::HasGeometry
273 (const TopoDS_Shape& S)const
275 Standard_Boolean b = myDS.HasGeometry(S);
279 //=======================================================================
280 //function : HasShape
282 //=======================================================================
283 Standard_Boolean TopOpeBRepDS_HDataStructure::HasShape
284 (const TopoDS_Shape& S,const Standard_Boolean FindKeep) const
286 Standard_Boolean b = myDS.HasShape(S, FindKeep);
290 //=======================================================================
291 //function : HasSameDomain
293 //=======================================================================
294 Standard_Boolean TopOpeBRepDS_HDataStructure::HasSameDomain
295 (const TopoDS_Shape& S,const Standard_Boolean FindKeep)const
297 if ( ! HasShape(S, FindKeep) ) return Standard_False;
298 const TopTools_ListOfShape& l = myDS.ShapeSameDomain(S);
299 Standard_Boolean res = ! l.IsEmpty();
303 //=======================================================================
304 //function : SameDomain
306 //=======================================================================
307 TopTools_ListIteratorOfListOfShape TopOpeBRepDS_HDataStructure::SameDomain
308 (const TopoDS_Shape& S)const
310 const TopTools_ListOfShape& L = myDS.ShapeSameDomain(S);
311 return TopTools_ListIteratorOfListOfShape(L);
314 //=======================================================================
315 //function : SameDomainOrientation
317 //=======================================================================
318 TopOpeBRepDS_Config TopOpeBRepDS_HDataStructure::SameDomainOrientation
319 (const TopoDS_Shape& S)const
321 if ( ! HasShape(S) ) return TopOpeBRepDS_UNSHGEOMETRY;
322 return myDS.SameDomainOri(S);
325 //=======================================================================
326 //function : SameDomainReference
328 //=======================================================================
329 Standard_Integer TopOpeBRepDS_HDataStructure::SameDomainReference
330 (const TopoDS_Shape& S)const
332 if ( ! HasShape(S) ) return 0;
333 return myDS.SameDomainRef(S);
336 //=======================================================================
337 //function : NbShapes
339 //=======================================================================
340 Standard_Integer TopOpeBRepDS_HDataStructure::NbShapes()const
342 return myDS.NbShapes();
345 //=======================================================================
348 //=======================================================================
349 const TopoDS_Shape& TopOpeBRepDS_HDataStructure::Shape
350 (const Standard_Integer I,const Standard_Boolean FindKeep) const
352 return myDS.Shape(I, FindKeep);
355 //=======================================================================
358 //=======================================================================
359 Standard_Integer TopOpeBRepDS_HDataStructure::Shape
360 (const TopoDS_Shape& S,const Standard_Boolean FindKeep)const
362 return myDS.Shape(S, FindKeep);
365 //=======================================================================
366 //function : SolidSurfaces
368 //=======================================================================
369 TopOpeBRepDS_SurfaceIterator TopOpeBRepDS_HDataStructure::SolidSurfaces
370 (const TopoDS_Shape& S) const
372 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(S);
373 return TopOpeBRepDS_SurfaceIterator(L);
376 //=======================================================================
377 //function : SolidSurfaces
379 //=======================================================================
380 TopOpeBRepDS_SurfaceIterator TopOpeBRepDS_HDataStructure::SolidSurfaces
381 (const Standard_Integer I)const
383 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(I);
384 return TopOpeBRepDS_SurfaceIterator(L);
387 //=======================================================================
388 //function : FaceCurves
390 //=======================================================================
391 TopOpeBRepDS_CurveIterator TopOpeBRepDS_HDataStructure::FaceCurves
392 (const TopoDS_Shape& F)const
394 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(F);
395 return TopOpeBRepDS_CurveIterator(L);
398 //=======================================================================
399 //function : FaceCurves
401 //=======================================================================
402 TopOpeBRepDS_CurveIterator TopOpeBRepDS_HDataStructure::FaceCurves
403 (const Standard_Integer I)const
405 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(I);
406 return TopOpeBRepDS_CurveIterator(L);
409 //=======================================================================
410 //function : EdgePoints
412 //=======================================================================
413 TopOpeBRepDS_PointIterator TopOpeBRepDS_HDataStructure::EdgePoints
414 (const TopoDS_Shape& E)const
416 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(E);
417 return TopOpeBRepDS_PointIterator(L);
420 //=======================================================================
421 //function : MakeCurve
423 //=======================================================================
424 Standard_Integer TopOpeBRepDS_HDataStructure::MakeCurve
425 (const TopOpeBRepDS_Curve& curC,TopOpeBRepDS_Curve& newC)
427 // SCI1, SCI2 = new surface/curve interf. build from
428 // the surface/curve interf. of the curve curC
429 const Handle(TopOpeBRepDS_Interference)& I1 = curC.GetSCI1();
430 const Handle(TopOpeBRepDS_Interference)& I2 = curC.GetSCI2();
431 Handle(TopOpeBRepDS_SurfaceCurveInterference) SCI1,SCI2;
432 if ( ! I1.IsNull() ) SCI1 = new TopOpeBRepDS_SurfaceCurveInterference(I1);
433 if ( ! I2.IsNull() ) SCI2 = new TopOpeBRepDS_SurfaceCurveInterference(I2);
435 const TopoDS_Shape& S1 = curC.Shape1();
436 const TopoDS_Shape& S2 = curC.Shape2();
438 // add the new SCIs in the lists of SCIs connected to the shapes
439 if ( ! SCI1.IsNull() ) myDS.AddShapeInterference(S1,SCI1);
440 if ( ! SCI2.IsNull() ) myDS.AddShapeInterference(S2,SCI2);
442 // the shapes of the new curve are the shapes of curve curC
443 newC.SetShapes(S1,S2);
445 // set surface/curve interferences of the new curve
446 newC.SetSCI(SCI1,SCI2);
448 // newC is a daughter of curC
449 newC.ChangeMother(curC.DSIndex());
451 // add the new curve in the DS
452 Standard_Integer inewC = myDS.AddCurve(newC);
454 // the geometry of the new surface/curve interf. is new curve inewC
455 if ( ! SCI1.IsNull() ) SCI1->Geometry(inewC);
456 if ( ! SCI2.IsNull() ) SCI2->Geometry(inewC);
461 //=======================================================================
462 //function : RemoveCurve
464 //=======================================================================
465 void TopOpeBRepDS_HDataStructure::RemoveCurve(const Standard_Integer icurC)
467 myDS.RemoveCurve(icurC);
470 //=======================================================================
471 //function : NbGeometry
473 //=======================================================================
474 Standard_Integer TopOpeBRepDS_HDataStructure::NbGeometry
475 (const TopOpeBRepDS_Kind K) const
477 if ( ! TopOpeBRepDS::IsGeometry(K)) return 0;
479 Standard_Integer n = 0;
481 case TopOpeBRepDS_POINT : n = NbPoints(); break;
482 case TopOpeBRepDS_CURVE : n = NbCurves(); break;
483 case TopOpeBRepDS_SURFACE : n = NbSurfaces(); break;
484 default : n = 0; break;
489 //=======================================================================
490 //function : NbTopology
492 //=======================================================================
493 Standard_Integer TopOpeBRepDS_HDataStructure::NbTopology() const
495 Standard_Integer n = myDS.NbShapes();
499 //=======================================================================
500 //function : NbTopology
502 //=======================================================================
503 Standard_Integer TopOpeBRepDS_HDataStructure::NbTopology
504 (const TopOpeBRepDS_Kind K) const
506 if ( ! TopOpeBRepDS::IsTopology(K) ) return 0;
507 Standard_Integer res = 0;
508 const Standard_Boolean FindKeep = Standard_False;
510 TopAbs_ShapeEnum S = TopOpeBRepDS::KindToShape(K);
511 for (Standard_Integer i = 1; i <= NbTopology(); i++ )
512 if(myDS.KeepShape(i, FindKeep))
513 if (myDS.Shape(i, FindKeep).ShapeType() == S) res++;
517 //=======================================================================
518 //function : EdgesSameParameter
520 //=======================================================================
522 Standard_Boolean TopOpeBRepDS_HDataStructure::EdgesSameParameter() const
524 Standard_Integer i,n = myDS.NbShapes();
525 for (i = 1 ; i <= n; i++) {
526 const TopoDS_Shape& s = myDS.Shape(i);
527 if ( s.ShapeType() == TopAbs_EDGE ) {
528 const TopoDS_Edge& e = TopoDS::Edge(s);
529 if ( ! BRep_Tool::SameParameter(e) ) {
530 return Standard_False;
534 return Standard_True;
537 #include <TColStd_HArray1OfBoolean.hxx>
538 #include <TColStd_Array1OfBoolean.hxx>
540 Standard_EXPORT void FUN_TopOpeBRepDS_SortOnParameter
541 (const TopOpeBRepDS_ListOfInterference& List,
542 TopOpeBRepDS_ListOfInterference& SList)
544 // NYI : sort a list of Items, giving a sorting FUNCTION is impossible
545 // NYI : --> foobar method complexity n2.
547 Standard_Integer iIntf=0,nIntf = List.Extent();
548 if (nIntf == 0) return;
550 Handle(TColStd_HArray1OfBoolean) HT;
551 HT = new TColStd_HArray1OfBoolean(1,nIntf,Standard_False);
552 TColStd_Array1OfBoolean& T = HT->ChangeArray1();
554 Handle(TopOpeBRepDS_Interference) Intf;
556 for (Standard_Integer i = 1; i <= nIntf; i++) {
557 Standard_Real parmin = RealLast();
558 TopOpeBRepDS_PointIterator it(List);
559 for (Standard_Integer itest = 1; it.More(); it.Next(),itest++) {
561 Standard_Real par = it.Parameter();
570 T(iIntf) = Standard_True;
574 //=======================================================================
575 //function : SortOnParameter
577 //=======================================================================
578 void TopOpeBRepDS_HDataStructure::SortOnParameter
579 (const TopOpeBRepDS_ListOfInterference& List,
580 TopOpeBRepDS_ListOfInterference& SList) const
582 // NYI : sort a list of Items, giving a sorting FUNCTION is impossible
583 // NYI : --> foobar method complexity n2.
585 ::FUN_TopOpeBRepDS_SortOnParameter(List,SList);
587 // tete = interf FORWARD :
588 // modifier TopOpeBRepBuild_ParametrizedVertexSet ::SortParametrizedVertex()
589 Standard_Boolean found = Standard_False;
590 TopOpeBRepDS_ListIteratorOfListOfInterference it(SList);
591 TopOpeBRepDS_ListOfInterference L1,L2;
593 for (; it.More(); it.Next() ) {
594 Handle(TopOpeBRepDS_Interference) I = it.Value();
596 TopAbs_Orientation o = I->Transition().Orientation(TopAbs_IN);
597 if (o == TopAbs_FORWARD) {
598 found = Standard_True;
611 //=======================================================================
612 //function : SortOnParameter
614 //=======================================================================
615 void TopOpeBRepDS_HDataStructure::SortOnParameter
616 (TopOpeBRepDS_ListOfInterference& List) const
618 TopOpeBRepDS_PointIterator it(List);
620 TopOpeBRepDS_ListOfInterference SList;
621 SortOnParameter(List,SList);
626 //=======================================================================
627 //function : MinMaxOnParameter
629 //=======================================================================
630 void TopOpeBRepDS_HDataStructure::MinMaxOnParameter
631 (const TopOpeBRepDS_ListOfInterference& List,
632 Standard_Real& parmin,Standard_Real& parmax) const
634 if ( ! List.IsEmpty() ) {
635 Standard_Real parline;
636 parmin = RealLast(); parmax = RealFirst();
637 TopOpeBRepDS_PointIterator it(List);
638 for ( ; it.More(); it.Next()) {
639 parline = it.Parameter();
640 parmin = Min(parmin,parline);
641 parmax = Max(parmax,parline);
646 //-----------------------------------------------------------------------
647 // Search, among a list of interferences accessed by the iterator <IT>,
648 // a geometry whose 3D point is identical yo the 3D point of a DS point <PDS>.
649 // return True if such an interference has been found, False else.
650 // if True, iterator <IT> points (by the Value() method) on the first
651 // interference accessing an identical 3D point.
652 //-----------------------------------------------------------------------
653 //=======================================================================
654 //function : ScanInterfList
656 //=======================================================================
657 Standard_Boolean TopOpeBRepDS_HDataStructure::ScanInterfList
658 (TopOpeBRepDS_ListIteratorOfListOfInterference& IT,
659 const TopOpeBRepDS_Point& PDS) const
661 for ( ; IT.More(); IT.Next() ) {
662 TopOpeBRepDS_Kind GT = IT.Value()->GeometryType();
663 Standard_Integer G = IT.Value()->Geometry();
664 if ( GT == TopOpeBRepDS_POINT ) {
665 const TopOpeBRepDS_Point& OOPDS = myDS.Point(G);
666 Standard_Boolean iseq = PDS.IsEqual(OOPDS);
667 if (iseq) return iseq;
669 else if ( GT == TopOpeBRepDS_VERTEX ) {
670 TopOpeBRepDS_Point OOPDS(myDS.Shape(G));
671 Standard_Boolean iseq = PDS.IsEqual(OOPDS);
672 if (iseq) return iseq;
675 return Standard_False;
678 //=======================================================================
679 //function : GetGeometry
681 //=======================================================================
683 Standard_Boolean TopOpeBRepDS_HDataStructure::GetGeometry
684 (TopOpeBRepDS_ListIteratorOfListOfInterference& IT,
685 const TopOpeBRepDS_Point& PDS,
687 TopOpeBRepDS_Kind& K) const
689 Standard_Boolean found = ScanInterfList(IT,PDS);
691 G = IT.Value()->Geometry();
692 K = IT.Value()->GeometryType();
698 extern Standard_Boolean TopOpeBRepDS_GettraceSTRANGE();
699 extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer);
700 static Standard_Boolean TRC(const Standard_Integer SIX) {
701 Standard_Boolean b1 = TopOpeBRepDS_GettraceSTRANGE();
702 Standard_Boolean b2 = TopOpeBRepDS_GettraceSPSX(SIX);
705 void debstore(const Standard_Integer /*i*/) {}
708 //=======================================================================
709 //function : StoreInterference
710 //purpose : Append an interference I to a list of interference LI
711 // Append I to the interf. list connected to I Geometry()
712 //=======================================================================
713 void TopOpeBRepDS_HDataStructure::StoreInterference
714 (const Handle(TopOpeBRepDS_Interference)& I,TopOpeBRepDS_ListOfInterference& LI,
716 const TCollection_AsciiString& str)
718 const TCollection_AsciiString& )
722 const TopOpeBRepDS_Transition& T = I->Transition();
724 TopAbs_ShapeEnum sb = T.ShapeBefore();
725 Standard_Integer ib = T.IndexBefore();
726 Standard_Boolean bok = Standard_True;
728 TopAbs_ShapeEnum sbds = myDS.Shape(ib).ShapeType();
732 TopAbs_ShapeEnum sa = T.ShapeAfter();
733 Standard_Integer ia = T.IndexAfter();
734 Standard_Boolean aok = Standard_True;
736 TopAbs_ShapeEnum sads = myDS.Shape(ia).ShapeType();
740 TopOpeBRepDS_Kind ks = I->SupportType();
741 TopAbs_ShapeEnum ss = TopOpeBRepDS::KindToShape(ks);
742 Standard_Integer is = I->Support();
743 Standard_Boolean sok = Standard_True;
744 if ((is != 0) && (ks >= TopOpeBRepDS_EDGE)) {
745 TopAbs_ShapeEnum ssds = myDS.Shape(is).ShapeType();
750 if (TRC(ia)) cout<<"HDSstore ia,ib is "<<ia<<","<<ib<<" "<<is<<endl;
754 if (TRC(ib)) cout<<"HDSstore ia,ib is "<<ia<<","<<ib<<" "<<is<<endl;
758 if (TRC(is)) cout<<"HDSstore ia,ib is "<<ia<<","<<ib<<" "<<is<<endl;
763 // append I to list LI
767 Standard_Boolean appendtoG = Standard_False;
769 Standard_Integer G = I->Geometry();
771 // append I to list of interference connected to G = I->Geometry()
772 switch (I->GeometryType()) {
774 case TopOpeBRepDS_SOLID : case TopOpeBRepDS_FACE :
775 case TopOpeBRepDS_EDGE : case TopOpeBRepDS_VERTEX :
776 // appendtoG = Standard_True;
777 // myDS.ChangeShapeInterferences(G).Append(I);
780 case TopOpeBRepDS_SURFACE :
782 appendtoG = Standard_True;
784 myDS.ChangeSurfaceInterferences(G).Append(I);
787 case TopOpeBRepDS_CURVE :
789 appendtoG = Standard_True;
791 myDS.ChangeCurveInterferences(G).Append(I);
794 case TopOpeBRepDS_POINT :
795 // appendtoG = Standard_True;
796 // myDS.ChangePointInterferences(G).Append(I);
803 Standard_Boolean trc = ::traceSTORE();
805 cout<<str<<"append "; I->Dump(cout);
806 if (appendtoG) cout<<" and to G"<<G<<" list";
812 //=======================================================================
813 //function : StoreInterference
815 //=======================================================================
816 void TopOpeBRepDS_HDataStructure::StoreInterference
817 (const Handle(TopOpeBRepDS_Interference)& I,const TopoDS_Shape& S,
819 const TCollection_AsciiString& str)
821 const TCollection_AsciiString& )
824 Standard_Boolean h = myDS.HasShape(S);
826 Standard_ProgramError::Raise("StoreInterference on shape out of DS");
831 Standard_Boolean trc = ::traceSTORE();
832 TopOpeBRepDS_Kind ks = TopOpeBRepDS::ShapeToKind(S.ShapeType());
833 Standard_Integer is = myDS.Shape(S);
834 if (trc) TopOpeBRepDS::Print(ks,is,cout,str," : ");
837 StoreInterference(I,myDS.ChangeShapeInterferences(S));
840 //=======================================================================
841 //function : StoreInterference
843 //=======================================================================
845 void TopOpeBRepDS_HDataStructure::StoreInterference
846 (const Handle(TopOpeBRepDS_Interference)& I,
847 const Standard_Integer IS,
849 const TCollection_AsciiString& str)
851 const TCollection_AsciiString& )
854 Standard_Integer n = myDS.NbShapes();
855 if ( IS < 1 || IS > n ) {
856 Standard_ProgramError::Raise("StoreInterference on index out of DS");
861 Standard_Boolean trc = ::traceSTORE();
862 const TopoDS_Shape& S = Shape(IS);
863 TopOpeBRepDS_Kind ks = TopOpeBRepDS::ShapeToKind(S.ShapeType());
864 if (trc) TopOpeBRepDS::Print(ks,IS,cout,str," : ");
867 StoreInterference(I,myDS.ChangeShapeInterferences(IS));
870 //=======================================================================
871 //function : StoreInterference
873 //=======================================================================
874 void TopOpeBRepDS_HDataStructure::StoreInterferences
875 (const TopOpeBRepDS_ListOfInterference& LI,const Standard_Integer IS
876 // ,const TCollection_AsciiString& str)
877 ,const TCollection_AsciiString& )
879 TopOpeBRepDS_ListOfInterference& lids = myDS.ChangeShapeInterferences(IS);
880 TopOpeBRepDS_ListIteratorOfListOfInterference it(LI);
881 for (; it.More(); it.Next()){
882 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
883 StoreInterference(I,lids);
887 //=======================================================================
888 //function : StoreInterferences
890 //=======================================================================
891 void TopOpeBRepDS_HDataStructure::StoreInterferences
892 (const TopOpeBRepDS_ListOfInterference& LI,const TopoDS_Shape& S
893 // ,const TCollection_AsciiString& str)
894 ,const TCollection_AsciiString& )
896 TopOpeBRepDS_ListOfInterference& lids = myDS.ChangeShapeInterferences(S);
897 TopOpeBRepDS_ListIteratorOfListOfInterference it(LI);
898 for (; it.More(); it.Next()){
899 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
900 StoreInterference(I,lids);
904 //=======================================================================
905 //function : ClearStoreInterferences
907 //=======================================================================
908 void TopOpeBRepDS_HDataStructure::ClearStoreInterferences
909 (const TopOpeBRepDS_ListOfInterference& LI,const Standard_Integer IS
910 // ,const TCollection_AsciiString& str)
911 ,const TCollection_AsciiString& )
913 TopOpeBRepDS_ListOfInterference& lids = myDS.ChangeShapeInterferences(IS);
915 TopOpeBRepDS_ListIteratorOfListOfInterference it(LI);
916 for (; it.More(); it.Next()){
917 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
918 StoreInterference(I,lids);
922 //=======================================================================
923 //function : ClearStoreInterferences
925 //=======================================================================
926 void TopOpeBRepDS_HDataStructure::ClearStoreInterferences
927 (const TopOpeBRepDS_ListOfInterference& LI,const TopoDS_Shape& S
928 // ,const TCollection_AsciiString& str)
929 ,const TCollection_AsciiString& )
931 TopOpeBRepDS_ListOfInterference& lids = myDS.ChangeShapeInterferences(S);
933 TopOpeBRepDS_ListIteratorOfListOfInterference it(LI);
934 for (; it.More(); it.Next()){
935 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
936 StoreInterference(I,lids);