0024023: Revamp the OCCT Handle -- downcast (automatic)
[occt.git] / src / TopOpeBRepBuild / TopOpeBRepBuild_BuilderON2d.cxx
old mode 100755 (executable)
new mode 100644 (file)
index bd8de14..2987afd
@@ -1,23 +1,18 @@
 // Created on: 1998-05-07
 // Created by: Xuan PHAM PHU
 // Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 #include <TopOpeBRepBuild_BuilderON.jxx>
 
@@ -32,6 +27,7 @@
 #include <TopoDS.hxx>
 #include <TopExp.hxx>
 #include <Precision.hxx>
+#include <TopOpeBRepDS_ShapeShapeInterference.hxx>
 
 
 #define M_OUT(st) (st == TopAbs_OUT)
@@ -39,7 +35,7 @@
 #define M_FORWARD(st) (st == TopAbs_FORWARD)
 #define M_REVERSED(st) (st == TopAbs_REVERSED)
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
 Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextEINTERNAL();
 Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextEEXTERNAL();
 Standard_EXPORT void debfillonf(const Standard_Integer iF);
@@ -75,7 +71,7 @@ void TopOpeBRepBuild_BuilderON::Perform2d
   if (GLOBAL_DS2d == NULL) GLOBAL_DS2d = (TopOpeBRepDS_PDataStructure)new TopOpeBRepDS_DataStructure();
   const TopOpeBRepDS_ListOfInterference& lFEI = GLOBAL_DS2d->ShapeInterferences(FOR);
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Integer iFOR;Standard_Boolean tFOR=myPB->GtraceSPS(FOR,iFOR);
   if (tFOR) debfillonf(iFOR);
   if (tFOR) {cout<<endl<<"LI on F"<<iFOR<<":"<<endl;
@@ -88,11 +84,11 @@ void TopOpeBRepBuild_BuilderON::Perform2d
     TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(I,GT,GI,ST,SI);
 
     const TopoDS_Edge& EG=TopoDS::Edge(BDS.Shape(GI));
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //    Standard_Integer iEG=BDS.Shape(EG);
 #endif
     const TopTools_ListOfShape& lEspON=myPB->Splits(EG,TopAbs_ON);
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //    Standard_Integer nEspON=lEspON.Extent();
 #endif
     for(TopTools_ListIteratorOfListOfShape it(lEspON);it.More();it.Next()) {
@@ -110,18 +106,18 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
 {
   const Handle(TopOpeBRepDS_HDataStructure)& HDS=myPB->DataStructure();
   const TopOpeBRepDS_DataStructure& BDS= HDS->DS();
-  const Handle(TopOpeBRepDS_ShapeShapeInterference)& SSI=Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I);
+  Handle(TopOpeBRepDS_ShapeShapeInterference) SSI (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I));
   TopAbs_State TB1,TB2;myPG->StatesON(TB1,TB2);
   TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI);
 //  const TopOpeBRepDS_Transition& TFE=SSI->Transition(); 
   Standard_Boolean EGBoundFOR=SSI->GBound();
   const TopoDS_Face& FOR=TopoDS::Face(myFace); Standard_Integer iFOR=BDS.Shape(FOR);
   const TopoDS_Edge& EG=TopoDS::Edge(BDS.Shape(GI));
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //  Standard_Integer iEG=BDS.Shape(EG);
 #endif
   const TopoDS_Face& FS=TopoDS::Face(BDS.Shape(SI)); 
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //  Standard_Integer iFS=BDS.Shape(FS);
 //  Standard_Boolean isclosedFF=BRep_Tool::IsClosed(EG,FOR);
 //  Standard_Boolean isclosedFS=BRep_Tool::IsClosed(EG,FS);
@@ -131,13 +127,13 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
 //  Standard_Integer rankFS=myPB->GShapeRank(FS);
 #endif  
   Standard_Integer rankEG=myPB->GShapeRank(EG);
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //  Standard_Integer rankFOR=myPB->GShapeRank(FOR);
 #endif
               
 //  TopAbs_State TBEG = (rankEG == 1) ? TB1 : TB2;
   TopAbs_State TBEG = FUN_build_TB(myPB,rankEG);
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //  TopAbs_State TFEbef = TFE.Before();
 //  TopAbs_State TFEaft = TFE.After();
 //  Standard_Boolean EGboundFOR =
@@ -145,7 +141,7 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
 #endif
   Standard_Boolean eghassd   = HDS->HasSameDomain(EG);
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean tFOR=myPB->GtraceSPS(iFOR);
 //  Standard_Boolean tE=myPB->GtraceSPS(GI);
 //  Standard_Boolean tEFOR = (tE && tFOR);
@@ -155,13 +151,13 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
   
   Standard_Integer iFCX=SI;
   Standard_Boolean FFinSDSO = Standard_True;
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //  Standard_Boolean FFinSDDO = Standard_False;
 #endif
   Standard_Boolean FFinSD= Standard_True;
   TopoDS_Face FCX = FS;
   
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //  TopAbs_Orientation oFOR = BDS.Shape(iFOR).Orientation();
 //  TopAbs_Orientation oFS  = BDS.Shape(iFS).Orientation();
 //  TopAbs_Orientation oFCX = BDS.Shape(iFCX).Orientation();
@@ -173,7 +169,7 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
   
   TopAbs_Orientation oegFCXF;Standard_Boolean EGBoundFCX = FUN_tool_orientEinFFORWARD(EG,FCX,oegFCXF);
   TopAbs_Orientation oegFCX ;
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //  Standard_Boolean ok2 =
 #endif
             FUN_tool_orientEinF(EG,FCX,oegFCX);
@@ -192,7 +188,7 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
    
   //=========================================
   if ( yap6) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (tFOR) cout<<"* yap6 = 1"<<endl;
 #endif
     TopAbs_Orientation neworiE = TopAbs_FORWARD;
@@ -204,7 +200,7 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
     Standard_Boolean b = Standard_False;
 
     Standard_Boolean SO = FFinSDSO;//(FFinSDSO && (oFOR == oFCX)) || (FFinSDDO && (oFOR != oFCX));
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //    Standard_Integer rkToFill = BDS.AncestorRank(myFace); //DEB
 #endif
     Standard_Boolean rk1 = (rankEG == 1);
@@ -218,7 +214,7 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
     else if (EGBoundFOR)
       ok = FUN_ds_shareG(myPB->DataStructure(),iFCX,iFOR,GI,TopoDS::Edge(EspON),shareG);
     if (!ok) return; // nyiFUNRAISE
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (tFOR) cout<<" shareG="<<shareG<<endl;
 #endif
 
@@ -252,7 +248,7 @@ void TopOpeBRepBuild_BuilderON::GFillONParts2dWES2(const Handle(TopOpeBRepDS_Int
     TopoDS_Shape newE = EspON;
     newE.Orientation(neworiE);  
     myPWES->AddStartElement(newE);
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (tFOR) cout<<"  add spON e"<<GI<<endl;
 #endif
     return;