1 // Created on: 1996-01-05
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1996-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 <TopOpeBRepBuild_CompositeClassifier.ixx>
23 #include <BRepTools.hxx>
24 #include <TCollection_AsciiString.hxx>
26 #define MYBB ((TopOpeBRepBuild_BlockBuilder*)myBlockBuilder)
28 // sourvenir d'un raise sur FrozenShape lors du Add(myShell,aFace)
29 // avec un shell qui a ete deja ete place dans le solide interne du
30 // TopOpeBRepTool_SolidClassifier par LoadShell.
33 //static Standard_Integer dddjyl = 0;
34 //static Standard_Integer dddebi = 0;
35 //static Standard_Integer dddebi2 = 0;
36 //static void SAVSS(const TopoDS_Shape& S1,const TopoDS_Shape& S2)
38 // TCollection_AsciiString aname_1("cc_1"), aname_2("cc_2");
39 // Standard_CString name_1 = aname_1.ToCString(), name_2 = aname_2.ToCString();
40 // cout<<"compositeclassifier : "<<name_1<<","<<name_2<<endl;
41 // BRepTools::Write(S1,name_1); BRepTools::Write(S2,name_2);
45 //=======================================================================
46 //function : Initialize
48 //=======================================================================
50 TopOpeBRepBuild_CompositeClassifier::TopOpeBRepBuild_CompositeClassifier
51 (const TopOpeBRepBuild_BlockBuilder& BB) :
52 myBlockBuilder((void*)&BB)
57 //=======================================================================
60 //=======================================================================
62 TopAbs_State TopOpeBRepBuild_CompositeClassifier::Compare
63 (const Handle(TopOpeBRepBuild_Loop)& L1,
64 const Handle(TopOpeBRepBuild_Loop)& L2)
66 TopAbs_State state = TopAbs_UNKNOWN;
68 Standard_Boolean isshape1 = L1->IsShape();
69 Standard_Boolean isshape2 = L2->IsShape();
71 if ( isshape2 && isshape1 ) { // L1 is Shape , L2 is Shape
72 const TopoDS_Shape& s1 = L1->Shape();
73 const TopoDS_Shape& s2 = L2->Shape();
74 state = CompareShapes(s1,s2);
76 else if ( isshape2 && !isshape1 ) { // L1 is Block , L2 is Shape
77 TopOpeBRepBuild_BlockIterator Bit1 = L1->BlockIterator();
79 Standard_Boolean yena1 = Bit1.More();
81 const TopoDS_Shape& s1 = MYBB->Element(Bit1);
82 const TopoDS_Shape& s2 = L2->Shape();
83 state = CompareElementToShape(s1,s2);
84 yena1 = Standard_False;
85 if (state == TopAbs_UNKNOWN) {
86 if (Bit1.More()) Bit1.Next();
91 else if ( !isshape2 && isshape1 ) { // L1 is Shape , L2 is Block
92 const TopoDS_Shape& s1 = L1->Shape();
94 TopOpeBRepBuild_BlockIterator Bit2 = L2->BlockIterator();
95 for (Bit2.Initialize(); Bit2.More(); Bit2.Next()) {
96 const TopoDS_Shape& s2 = MYBB->Element(Bit2);
101 else if ( !isshape2 && !isshape1 ) { // L1 is Block , L2 is Block
102 TopOpeBRepBuild_BlockIterator Bit1 = L1->BlockIterator();
104 Standard_Boolean yena1 = Bit1.More();
106 const TopoDS_Shape& s1 = MYBB->Element(Bit1);
108 TopOpeBRepBuild_BlockIterator Bit2 = L2->BlockIterator();
109 for (Bit2.Initialize(); Bit2.More(); Bit2.Next()) {
110 const TopoDS_Shape& s2 = MYBB->Element(Bit2);
114 yena1 = Standard_False;
115 if (state == TopAbs_UNKNOWN) {
116 if (Bit1.More()) Bit1.Next();