1 // Created on: 1993-06-17
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1993-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 #include <TopOpeBRepDS_HDataStructure.ixx>
24 #include <TopOpeBRepDS_EdgeInterferenceTool.hxx>
25 #include <BRep_Tool.hxx>
27 #include <TopoDS_Edge.hxx>
28 #include <TopExp_Explorer.hxx>
29 #include <TopTools_ListOfShape.hxx>
30 #include <TopOpeBRepDS_SurfaceCurveInterference.hxx>
31 #include <TopOpeBRepDS_Transition.hxx>
32 #include <TopAbs_ShapeEnum.hxx>
33 #include <TopOpeBRepDS.hxx>
34 #include <TopOpeBRepDS_Interference.hxx>
35 #include <TopOpeBRepDS_ListOfInterference.hxx>
36 #include <TopOpeBRepDS_ListIteratorOfListOfInterference.hxx>
37 #include <TopOpeBRepDS_Check.hxx>
38 #include <TopOpeBRepTool_ShapeExplorer.hxx>
39 #include <TopOpeBRepDS_Filter.hxx>
40 #include <TopOpeBRepDS_Reducer.hxx>
41 #include <TopOpeBRepDS_Dumper.hxx>
42 #include <Standard_ProgramError.hxx>
43 #include <TopOpeBRepDS_define.hxx>
46 extern Standard_Boolean TopOpeBRepDS_GettraceISTO();
47 extern Standard_Boolean TopOpeBRepDS_GettraceEDSF();
48 extern Standard_Boolean TopOpeBRepDS_GettraceDSF();
49 extern Standard_Boolean TopOpeBRepDS_GettraceDSFD();
50 extern Standard_Boolean TopOpeBRepDS_GettraceDEGEN();
51 extern Standard_Boolean TopOpeBRepDS_GettracePCI();
52 extern Standard_Boolean TopOpeBRepDS_GettracePI();
53 extern Standard_Boolean TopOpeBRepDS_GettracePEI();
54 extern Standard_Boolean TopOpeBRepDS_GettracePI();
55 extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer);
57 static Standard_Boolean traceSTORE()
59 Standard_Boolean trc = Standard_False;
60 trc = trc || TopOpeBRepDS_GettraceEDSF();
61 trc = trc || TopOpeBRepDS_GettraceDSF();
62 trc = trc || TopOpeBRepDS_GettraceDEGEN();
63 trc = trc || TopOpeBRepDS_GettraceISTO();
68 static void FUN_HDS_data(const Handle(TopOpeBRepDS_Interference)& I,
69 TopOpeBRepDS_Kind& GT1,Standard_Integer& G1,
70 TopOpeBRepDS_Kind& ST1,Standard_Integer& S1)
72 if (I.IsNull()) return;
73 GT1 = I->GeometryType(); G1 = I->Geometry();
74 ST1 = I->SupportType(); S1 = I->Support();
78 Standard_EXPORT Standard_Boolean FUN_HDS_FACESINTERFER
79 (const TopoDS_Shape& F1, const TopoDS_Shape& F2,
80 const Handle(TopOpeBRepDS_HDataStructure)& HDS)
82 Standard_Boolean yainterf = Standard_False;
83 const TopOpeBRepDS_DataStructure& DS = HDS->DS();
84 Standard_Boolean ya = DS.HasShape(F1);
85 if ( !ya ) return Standard_False;
88 Standard_Integer iF2 = DS.Shape(F2);
90 const TopOpeBRepDS_ListOfInterference& L1 = DS.ShapeInterferences(F1);
91 TopOpeBRepDS_ListIteratorOfListOfInterference itL1(L1);
92 for (;itL1.More(); itL1.Next()) {
93 const Handle(TopOpeBRepDS_Interference)& I = itL1.Value();
94 TopOpeBRepDS_Kind GT,ST;Standard_Integer G,S;
95 FUN_HDS_data(I,GT,G,ST,S);
96 // interference face1/edge/face2
97 Standard_Boolean fef = Standard_True;
98 fef = fef && (GT==TopOpeBRepDS_EDGE);
99 fef = fef && (ST==TopOpeBRepDS_FACE);
100 fef = fef && (S==iF2);
102 yainterf = Standard_True;
110 //=======================================================================
111 //function : TopOpeBRepDS_HDataStructure
113 //=======================================================================
114 TopOpeBRepDS_HDataStructure::TopOpeBRepDS_HDataStructure()
118 //=======================================================================
119 //function : AddAncestors
121 //=======================================================================
122 void TopOpeBRepDS_HDataStructure::AddAncestors
123 (const TopoDS_Shape& S)
125 AddAncestors(S,TopAbs_WIRE,TopAbs_EDGE);
126 AddAncestors(S,TopAbs_FACE,TopAbs_WIRE);
127 AddAncestors(S,TopAbs_SHELL,TopAbs_FACE);
128 AddAncestors(S,TopAbs_SOLID,TopAbs_SHELL);
131 //=======================================================================
132 //function : AddAncestors
134 //=======================================================================
135 void TopOpeBRepDS_HDataStructure::AddAncestors
136 (const TopoDS_Shape& S,
137 const TopAbs_ShapeEnum T1,const TopAbs_ShapeEnum T2)
139 TopOpeBRepDS_DataStructure& BDS = ChangeDS();
140 Standard_Integer rankS = myDS.AncestorRank(S);
141 // find the shapes of type T1 containing HasShape() of type T2
142 for (TopOpeBRepTool_ShapeExplorer eT1(S,T1); eT1.More(); eT1.Next()) {
143 const TopoDS_Shape& ST1 = eT1.Current();
144 for (TopOpeBRepTool_ShapeExplorer eT2(ST1,T2); eT2.More(); eT2.Next()) {
145 const TopoDS_Shape& ST2 = eT2.Current();
146 if (BDS.HasShape(ST2)) {
147 BDS.AddShape(ST1,rankS);
154 //=======================================================================
156 //purpose : Check Integrity
157 //=======================================================================
158 void TopOpeBRepDS_HDataStructure::ChkIntg()
160 // Check the integrity of the DS
161 Handle(TopOpeBRepDS_Check) chk = new TopOpeBRepDS_Check(this);
163 // chk->PrintIntg(cout);
166 //=======================================================================
169 //=======================================================================
170 const TopOpeBRepDS_DataStructure& TopOpeBRepDS_HDataStructure::DS()const
175 //=======================================================================
176 //function : ChangeDS
178 //=======================================================================
179 TopOpeBRepDS_DataStructure& TopOpeBRepDS_HDataStructure::ChangeDS()
184 //=======================================================================
185 //function : NbSurfaces
187 //=======================================================================
188 Standard_Integer TopOpeBRepDS_HDataStructure::NbSurfaces()const
190 return myDS.NbSurfaces();
193 //=======================================================================
194 //function : NbCurves
196 //=======================================================================
197 Standard_Integer TopOpeBRepDS_HDataStructure::NbCurves()const
199 return myDS.NbCurves();
202 //=======================================================================
203 //function : NbPoints
205 //=======================================================================
206 Standard_Integer TopOpeBRepDS_HDataStructure::NbPoints()const
208 return myDS.NbPoints();
211 //=======================================================================
214 //=======================================================================
215 const TopOpeBRepDS_Surface& TopOpeBRepDS_HDataStructure::Surface
216 (const Standard_Integer I)const
218 return myDS.Surface(I);
221 //=======================================================================
222 //function : SurfaceCurves
224 //=======================================================================
225 TopOpeBRepDS_CurveIterator TopOpeBRepDS_HDataStructure::SurfaceCurves
226 (const Standard_Integer I)const
228 const TopOpeBRepDS_ListOfInterference& L = myDS.SurfaceInterferences(I);
229 return TopOpeBRepDS_CurveIterator(L);
232 //=======================================================================
235 //=======================================================================
236 const TopOpeBRepDS_Curve& TopOpeBRepDS_HDataStructure::Curve
237 (const Standard_Integer I)const
239 return myDS.Curve(I);
242 //=======================================================================
243 //function : ChangeCurve
245 //=======================================================================
246 TopOpeBRepDS_Curve& TopOpeBRepDS_HDataStructure::ChangeCurve
247 (const Standard_Integer I)
249 return myDS.ChangeCurve(I);
252 //=======================================================================
253 //function : CurvePoints
255 //=======================================================================
256 TopOpeBRepDS_PointIterator TopOpeBRepDS_HDataStructure::CurvePoints
257 (const Standard_Integer I)const
259 const TopOpeBRepDS_ListOfInterference& L = myDS.CurveInterferences(I);
260 return TopOpeBRepDS_PointIterator(L);
263 //=======================================================================
266 //=======================================================================
267 const TopOpeBRepDS_Point& TopOpeBRepDS_HDataStructure::Point
268 (const Standard_Integer I)const
270 return myDS.Point(I);
273 //=======================================================================
274 //function : HasGeometry
276 //=======================================================================
277 Standard_Boolean TopOpeBRepDS_HDataStructure::HasGeometry
278 (const TopoDS_Shape& S)const
280 Standard_Boolean b = myDS.HasGeometry(S);
284 //=======================================================================
285 //function : HasShape
287 //=======================================================================
288 Standard_Boolean TopOpeBRepDS_HDataStructure::HasShape
289 (const TopoDS_Shape& S,const Standard_Boolean FindKeep) const
291 Standard_Boolean b = myDS.HasShape(S, FindKeep);
295 //=======================================================================
296 //function : HasSameDomain
298 //=======================================================================
299 Standard_Boolean TopOpeBRepDS_HDataStructure::HasSameDomain
300 (const TopoDS_Shape& S,const Standard_Boolean FindKeep)const
302 if ( ! HasShape(S, FindKeep) ) return Standard_False;
303 const TopTools_ListOfShape& l = myDS.ShapeSameDomain(S);
304 Standard_Boolean res = ! l.IsEmpty();
308 //=======================================================================
309 //function : SameDomain
311 //=======================================================================
312 TopTools_ListIteratorOfListOfShape TopOpeBRepDS_HDataStructure::SameDomain
313 (const TopoDS_Shape& S)const
315 const TopTools_ListOfShape& L = myDS.ShapeSameDomain(S);
316 return TopTools_ListIteratorOfListOfShape(L);
319 //=======================================================================
320 //function : SameDomainOrientation
322 //=======================================================================
323 TopOpeBRepDS_Config TopOpeBRepDS_HDataStructure::SameDomainOrientation
324 (const TopoDS_Shape& S)const
326 if ( ! HasShape(S) ) return TopOpeBRepDS_UNSHGEOMETRY;
327 return myDS.SameDomainOri(S);
330 //=======================================================================
331 //function : SameDomainReference
333 //=======================================================================
334 Standard_Integer TopOpeBRepDS_HDataStructure::SameDomainReference
335 (const TopoDS_Shape& S)const
337 if ( ! HasShape(S) ) return 0;
338 return myDS.SameDomainRef(S);
341 //=======================================================================
342 //function : NbShapes
344 //=======================================================================
345 Standard_Integer TopOpeBRepDS_HDataStructure::NbShapes()const
347 return myDS.NbShapes();
350 //=======================================================================
353 //=======================================================================
354 const TopoDS_Shape& TopOpeBRepDS_HDataStructure::Shape
355 (const Standard_Integer I,const Standard_Boolean FindKeep) const
357 return myDS.Shape(I, FindKeep);
360 //=======================================================================
363 //=======================================================================
364 Standard_Integer TopOpeBRepDS_HDataStructure::Shape
365 (const TopoDS_Shape& S,const Standard_Boolean FindKeep)const
367 return myDS.Shape(S, FindKeep);
370 //=======================================================================
371 //function : SolidSurfaces
373 //=======================================================================
374 TopOpeBRepDS_SurfaceIterator TopOpeBRepDS_HDataStructure::SolidSurfaces
375 (const TopoDS_Shape& S) const
377 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(S);
378 return TopOpeBRepDS_SurfaceIterator(L);
381 //=======================================================================
382 //function : SolidSurfaces
384 //=======================================================================
385 TopOpeBRepDS_SurfaceIterator TopOpeBRepDS_HDataStructure::SolidSurfaces
386 (const Standard_Integer I)const
388 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(I);
389 return TopOpeBRepDS_SurfaceIterator(L);
392 //=======================================================================
393 //function : FaceCurves
395 //=======================================================================
396 TopOpeBRepDS_CurveIterator TopOpeBRepDS_HDataStructure::FaceCurves
397 (const TopoDS_Shape& F)const
399 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(F);
400 return TopOpeBRepDS_CurveIterator(L);
403 //=======================================================================
404 //function : FaceCurves
406 //=======================================================================
407 TopOpeBRepDS_CurveIterator TopOpeBRepDS_HDataStructure::FaceCurves
408 (const Standard_Integer I)const
410 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(I);
411 return TopOpeBRepDS_CurveIterator(L);
414 //=======================================================================
415 //function : EdgePoints
417 //=======================================================================
418 TopOpeBRepDS_PointIterator TopOpeBRepDS_HDataStructure::EdgePoints
419 (const TopoDS_Shape& E)const
421 const TopOpeBRepDS_ListOfInterference& L = myDS.ShapeInterferences(E);
422 return TopOpeBRepDS_PointIterator(L);
425 //=======================================================================
426 //function : MakeCurve
428 //=======================================================================
429 Standard_Integer TopOpeBRepDS_HDataStructure::MakeCurve
430 (const TopOpeBRepDS_Curve& curC,TopOpeBRepDS_Curve& newC)
432 // SCI1, SCI2 = new surface/curve interf. build from
433 // the surface/curve interf. of the curve curC
434 const Handle(TopOpeBRepDS_Interference)& I1 = curC.GetSCI1();
435 const Handle(TopOpeBRepDS_Interference)& I2 = curC.GetSCI2();
436 Handle(TopOpeBRepDS_SurfaceCurveInterference) SCI1,SCI2;
437 if ( ! I1.IsNull() ) SCI1 = new TopOpeBRepDS_SurfaceCurveInterference(I1);
438 if ( ! I2.IsNull() ) SCI2 = new TopOpeBRepDS_SurfaceCurveInterference(I2);
440 const TopoDS_Shape& S1 = curC.Shape1();
441 const TopoDS_Shape& S2 = curC.Shape2();
443 // add the new SCIs in the lists of SCIs connected to the shapes
444 if ( ! SCI1.IsNull() ) myDS.AddShapeInterference(S1,SCI1);
445 if ( ! SCI2.IsNull() ) myDS.AddShapeInterference(S2,SCI2);
447 // the shapes of the new curve are the shapes of curve curC
448 newC.SetShapes(S1,S2);
450 // set surface/curve interferences of the new curve
451 newC.SetSCI(SCI1,SCI2);
453 // newC is a daughter of curC
454 newC.ChangeMother(curC.DSIndex());
456 // add the new curve in the DS
457 Standard_Integer inewC = myDS.AddCurve(newC);
459 // the geometry of the new surface/curve interf. is new curve inewC
460 if ( ! SCI1.IsNull() ) SCI1->Geometry(inewC);
461 if ( ! SCI2.IsNull() ) SCI2->Geometry(inewC);
466 //=======================================================================
467 //function : RemoveCurve
469 //=======================================================================
470 void TopOpeBRepDS_HDataStructure::RemoveCurve(const Standard_Integer icurC)
472 myDS.RemoveCurve(icurC);
475 //=======================================================================
476 //function : NbGeometry
478 //=======================================================================
479 Standard_Integer TopOpeBRepDS_HDataStructure::NbGeometry
480 (const TopOpeBRepDS_Kind K) const
482 if ( ! TopOpeBRepDS::IsGeometry(K)) return 0;
484 Standard_Integer n = 0;
486 case TopOpeBRepDS_POINT : n = NbPoints(); break;
487 case TopOpeBRepDS_CURVE : n = NbCurves(); break;
488 case TopOpeBRepDS_SURFACE : n = NbSurfaces(); break;
489 default : n = 0; break;
494 //=======================================================================
495 //function : NbTopology
497 //=======================================================================
498 Standard_Integer TopOpeBRepDS_HDataStructure::NbTopology() const
500 Standard_Integer n = myDS.NbShapes();
504 //=======================================================================
505 //function : NbTopology
507 //=======================================================================
508 Standard_Integer TopOpeBRepDS_HDataStructure::NbTopology
509 (const TopOpeBRepDS_Kind K) const
511 if ( ! TopOpeBRepDS::IsTopology(K) ) return 0;
512 Standard_Integer res = 0;
513 const Standard_Boolean FindKeep = Standard_False;
515 TopAbs_ShapeEnum S = TopOpeBRepDS::KindToShape(K);
516 for (Standard_Integer i = 1; i <= NbTopology(); i++ )
517 if(myDS.KeepShape(i, FindKeep))
518 if (myDS.Shape(i, FindKeep).ShapeType() == S) res++;
522 //=======================================================================
523 //function : EdgesSameParameter
525 //=======================================================================
527 Standard_Boolean TopOpeBRepDS_HDataStructure::EdgesSameParameter() const
529 Standard_Integer i,n = myDS.NbShapes();
530 for (i = 1 ; i <= n; i++) {
531 const TopoDS_Shape& s = myDS.Shape(i);
532 if ( s.ShapeType() == TopAbs_EDGE ) {
533 const TopoDS_Edge& e = TopoDS::Edge(s);
534 if ( ! BRep_Tool::SameParameter(e) ) {
535 return Standard_False;
539 return Standard_True;
542 #include <TColStd_HArray1OfBoolean.hxx>
543 #include <TColStd_Array1OfBoolean.hxx>
545 Standard_EXPORT void FUN_TopOpeBRepDS_SortOnParameter
546 (const TopOpeBRepDS_ListOfInterference& List,
547 TopOpeBRepDS_ListOfInterference& SList)
549 // NYI : sort a list of Items, giving a sorting FUNCTION is impossible
550 // NYI : --> foobar method complexity n2.
552 Standard_Integer iIntf=0,nIntf = List.Extent();
553 if (nIntf == 0) return;
555 Handle(TColStd_HArray1OfBoolean) HT;
556 HT = new TColStd_HArray1OfBoolean(1,nIntf,Standard_False);
557 TColStd_Array1OfBoolean& T = HT->ChangeArray1();
559 Handle(TopOpeBRepDS_Interference) Intf;
561 for (Standard_Integer i = 1; i <= nIntf; i++) {
562 Standard_Real parmin = RealLast();
563 TopOpeBRepDS_PointIterator it(List);
564 for (Standard_Integer itest = 1; it.More(); it.Next(),itest++) {
566 Standard_Real par = it.Parameter();
575 T(iIntf) = Standard_True;
579 //=======================================================================
580 //function : SortOnParameter
582 //=======================================================================
583 void TopOpeBRepDS_HDataStructure::SortOnParameter
584 (const TopOpeBRepDS_ListOfInterference& List,
585 TopOpeBRepDS_ListOfInterference& SList) const
587 // NYI : sort a list of Items, giving a sorting FUNCTION is impossible
588 // NYI : --> foobar method complexity n2.
590 ::FUN_TopOpeBRepDS_SortOnParameter(List,SList);
592 // tete = interf FORWARD :
593 // modifier TopOpeBRepBuild_ParametrizedVertexSet ::SortParametrizedVertex()
594 Standard_Boolean found = Standard_False;
595 TopOpeBRepDS_ListIteratorOfListOfInterference it(SList);
596 TopOpeBRepDS_ListOfInterference L1,L2;
598 for (; it.More(); it.Next() ) {
599 Handle(TopOpeBRepDS_Interference) I = it.Value();
601 TopAbs_Orientation o = I->Transition().Orientation(TopAbs_IN);
602 if (o == TopAbs_FORWARD) {
603 found = Standard_True;
616 //=======================================================================
617 //function : SortOnParameter
619 //=======================================================================
620 void TopOpeBRepDS_HDataStructure::SortOnParameter
621 (TopOpeBRepDS_ListOfInterference& List) const
623 TopOpeBRepDS_PointIterator it(List);
625 TopOpeBRepDS_ListOfInterference SList;
626 SortOnParameter(List,SList);
631 //=======================================================================
632 //function : MinMaxOnParameter
634 //=======================================================================
635 void TopOpeBRepDS_HDataStructure::MinMaxOnParameter
636 (const TopOpeBRepDS_ListOfInterference& List,
637 Standard_Real& parmin,Standard_Real& parmax) const
639 if ( ! List.IsEmpty() ) {
640 Standard_Real parline;
641 parmin = RealLast(); parmax = RealFirst();
642 TopOpeBRepDS_PointIterator it(List);
643 for ( ; it.More(); it.Next()) {
644 parline = it.Parameter();
645 parmin = Min(parmin,parline);
646 parmax = Max(parmax,parline);
651 //-----------------------------------------------------------------------
652 // Search, among a list of interferences accessed by the iterator <IT>,
653 // a geometry whose 3D point is identical yo the 3D point of a DS point <PDS>.
654 // return True if such an interference has been found, False else.
655 // if True, iterator <IT> points (by the Value() method) on the first
656 // interference accessing an identical 3D point.
657 //-----------------------------------------------------------------------
658 //=======================================================================
659 //function : ScanInterfList
661 //=======================================================================
662 Standard_Boolean TopOpeBRepDS_HDataStructure::ScanInterfList
663 (TopOpeBRepDS_ListIteratorOfListOfInterference& IT,
664 const TopOpeBRepDS_Point& PDS) const
666 for ( ; IT.More(); IT.Next() ) {
667 TopOpeBRepDS_Kind GT = IT.Value()->GeometryType();
668 Standard_Integer G = IT.Value()->Geometry();
669 if ( GT == TopOpeBRepDS_POINT ) {
670 const TopOpeBRepDS_Point& OOPDS = myDS.Point(G);
671 Standard_Boolean iseq = PDS.IsEqual(OOPDS);
672 if (iseq) return iseq;
674 else if ( GT == TopOpeBRepDS_VERTEX ) {
675 TopOpeBRepDS_Point OOPDS(myDS.Shape(G));
676 Standard_Boolean iseq = PDS.IsEqual(OOPDS);
677 if (iseq) return iseq;
680 return Standard_False;
683 //=======================================================================
684 //function : GetGeometry
686 //=======================================================================
688 Standard_Boolean TopOpeBRepDS_HDataStructure::GetGeometry
689 (TopOpeBRepDS_ListIteratorOfListOfInterference& IT,
690 const TopOpeBRepDS_Point& PDS,
692 TopOpeBRepDS_Kind& K) const
694 Standard_Boolean found = ScanInterfList(IT,PDS);
696 G = IT.Value()->Geometry();
697 K = IT.Value()->GeometryType();
703 extern Standard_Boolean TopOpeBRepDS_GettraceSTRANGE();
704 extern Standard_Boolean TopOpeBRepDS_GettraceSPSX(const Standard_Integer);
705 static Standard_Boolean TRC(const Standard_Integer SIX) {
706 Standard_Boolean b1 = TopOpeBRepDS_GettraceSTRANGE();
707 Standard_Boolean b2 = TopOpeBRepDS_GettraceSPSX(SIX);
710 void debstore(const Standard_Integer /*i*/) {}
713 //=======================================================================
714 //function : StoreInterference
715 //purpose : Append an interference I to a list of interference LI
716 // Append I to the interf. list connected to I Geometry()
717 //=======================================================================
718 void TopOpeBRepDS_HDataStructure::StoreInterference
719 (const Handle(TopOpeBRepDS_Interference)& I,TopOpeBRepDS_ListOfInterference& LI,
721 const TCollection_AsciiString& str)
723 const TCollection_AsciiString& )
727 const TopOpeBRepDS_Transition& T = I->Transition();
729 TopAbs_ShapeEnum sb = T.ShapeBefore();
730 Standard_Integer ib = T.IndexBefore();
731 Standard_Boolean bok = Standard_True;
733 TopAbs_ShapeEnum sbds = myDS.Shape(ib).ShapeType();
737 TopAbs_ShapeEnum sa = T.ShapeAfter();
738 Standard_Integer ia = T.IndexAfter();
739 Standard_Boolean aok = Standard_True;
741 TopAbs_ShapeEnum sads = myDS.Shape(ia).ShapeType();
745 TopOpeBRepDS_Kind ks = I->SupportType();
746 TopAbs_ShapeEnum ss = TopOpeBRepDS::KindToShape(ks);
747 Standard_Integer is = I->Support();
748 Standard_Boolean sok = Standard_True;
749 if ((is != 0) && (ks >= TopOpeBRepDS_EDGE)) {
750 TopAbs_ShapeEnum ssds = myDS.Shape(is).ShapeType();
755 if (TRC(ia)) cout<<"HDSstore ia,ib is "<<ia<<","<<ib<<" "<<is<<endl;
759 if (TRC(ib)) cout<<"HDSstore ia,ib is "<<ia<<","<<ib<<" "<<is<<endl;
763 if (TRC(is)) cout<<"HDSstore ia,ib is "<<ia<<","<<ib<<" "<<is<<endl;
768 // append I to list LI
771 Standard_Boolean appendtoG = Standard_False;
772 Standard_Integer G = I->Geometry();
774 // append I to list of interference connected to G = I->Geometry()
775 switch (I->GeometryType()) {
777 case TopOpeBRepDS_SOLID : case TopOpeBRepDS_FACE :
778 case TopOpeBRepDS_EDGE : case TopOpeBRepDS_VERTEX :
779 // appendtoG = Standard_True;
780 // myDS.ChangeShapeInterferences(G).Append(I);
783 case TopOpeBRepDS_SURFACE :
784 appendtoG = Standard_True;
785 myDS.ChangeSurfaceInterferences(G).Append(I);
788 case TopOpeBRepDS_CURVE :
789 appendtoG = Standard_True;
790 myDS.ChangeCurveInterferences(G).Append(I);
793 case TopOpeBRepDS_POINT :
794 // appendtoG = Standard_True;
795 // myDS.ChangePointInterferences(G).Append(I);
802 Standard_Boolean trc = ::traceSTORE();
804 cout<<str<<"append "; I->Dump(cout);
805 if (appendtoG) cout<<" and to G"<<G<<" list";
811 //=======================================================================
812 //function : StoreInterference
814 //=======================================================================
815 void TopOpeBRepDS_HDataStructure::StoreInterference
816 (const Handle(TopOpeBRepDS_Interference)& I,const TopoDS_Shape& S,
818 const TCollection_AsciiString& str)
820 const TCollection_AsciiString& )
823 Standard_Boolean h = myDS.HasShape(S);
825 Standard_ProgramError::Raise("StoreInterference on shape out of DS");
830 Standard_Boolean trc = ::traceSTORE();
831 TopOpeBRepDS_Kind ks = TopOpeBRepDS::ShapeToKind(S.ShapeType());
832 Standard_Integer is = myDS.Shape(S);
833 if (trc) TopOpeBRepDS::Print(ks,is,cout,str," : ");
836 StoreInterference(I,myDS.ChangeShapeInterferences(S));
839 //=======================================================================
840 //function : StoreInterference
842 //=======================================================================
844 void TopOpeBRepDS_HDataStructure::StoreInterference
845 (const Handle(TopOpeBRepDS_Interference)& I,
846 const Standard_Integer IS,
848 const TCollection_AsciiString& str)
850 const TCollection_AsciiString& )
853 Standard_Integer n = myDS.NbShapes();
854 if ( IS < 1 || IS > n ) {
855 Standard_ProgramError::Raise("StoreInterference on index out of DS");
860 Standard_Boolean trc = ::traceSTORE();
861 const TopoDS_Shape& S = Shape(IS);
862 TopOpeBRepDS_Kind ks = TopOpeBRepDS::ShapeToKind(S.ShapeType());
863 if (trc) TopOpeBRepDS::Print(ks,IS,cout,str," : ");
866 StoreInterference(I,myDS.ChangeShapeInterferences(IS));
869 //=======================================================================
870 //function : StoreInterference
872 //=======================================================================
873 void TopOpeBRepDS_HDataStructure::StoreInterferences
874 (const TopOpeBRepDS_ListOfInterference& LI,const Standard_Integer IS
875 // ,const TCollection_AsciiString& str)
876 ,const TCollection_AsciiString& )
878 TopOpeBRepDS_ListOfInterference& lids = myDS.ChangeShapeInterferences(IS);
879 TopOpeBRepDS_ListIteratorOfListOfInterference it(LI);
880 for (; it.More(); it.Next()){
881 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
882 StoreInterference(I,lids);
886 //=======================================================================
887 //function : StoreInterferences
889 //=======================================================================
890 void TopOpeBRepDS_HDataStructure::StoreInterferences
891 (const TopOpeBRepDS_ListOfInterference& LI,const TopoDS_Shape& S
892 // ,const TCollection_AsciiString& str)
893 ,const TCollection_AsciiString& )
895 TopOpeBRepDS_ListOfInterference& lids = myDS.ChangeShapeInterferences(S);
896 TopOpeBRepDS_ListIteratorOfListOfInterference it(LI);
897 for (; it.More(); it.Next()){
898 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
899 StoreInterference(I,lids);
903 //=======================================================================
904 //function : ClearStoreInterferences
906 //=======================================================================
907 void TopOpeBRepDS_HDataStructure::ClearStoreInterferences
908 (const TopOpeBRepDS_ListOfInterference& LI,const Standard_Integer IS
909 // ,const TCollection_AsciiString& str)
910 ,const TCollection_AsciiString& )
912 TopOpeBRepDS_ListOfInterference& lids = myDS.ChangeShapeInterferences(IS);
914 TopOpeBRepDS_ListIteratorOfListOfInterference it(LI);
915 for (; it.More(); it.Next()){
916 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
917 StoreInterference(I,lids);
921 //=======================================================================
922 //function : ClearStoreInterferences
924 //=======================================================================
925 void TopOpeBRepDS_HDataStructure::ClearStoreInterferences
926 (const TopOpeBRepDS_ListOfInterference& LI,const TopoDS_Shape& S
927 // ,const TCollection_AsciiString& str)
928 ,const TCollection_AsciiString& )
930 TopOpeBRepDS_ListOfInterference& lids = myDS.ChangeShapeInterferences(S);
932 TopOpeBRepDS_ListIteratorOfListOfInterference it(LI);
933 for (; it.More(); it.Next()){
934 const Handle(TopOpeBRepDS_Interference)& I = it.Value();
935 StoreInterference(I,lids);