0024023: Revamp the OCCT Handle -- downcast (automatic)
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_Check.cxx
old mode 100755 (executable)
new mode 100644 (file)
index b917489..22b9af1
@@ -1,23 +1,18 @@
 // Created on: 1997-04-10
 // Created by: Prestataire Mary FABIEN
 // Copyright (c) 1997-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 <TCollection_AsciiString.hxx>
 #include <TopOpeBRepDS_Check.ixx>
 //=======================================================================
 
 TopOpeBRepDS_Check::TopOpeBRepDS_Check(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
-: mySurfaceDone(Standard_False),
-  myCurveDone(Standard_False),
-  myPointDone(Standard_False),
-  myShapeDone (Standard_False),
-  myDone(Standard_False)
 {
   myHDS = HDS;
   myMapSurfaceStatus.Clear();
@@ -69,11 +59,6 @@ TopOpeBRepDS_Check::TopOpeBRepDS_Check(const Handle(TopOpeBRepDS_HDataStructure)
 //=======================================================================
 
 TopOpeBRepDS_Check::TopOpeBRepDS_Check()
-: mySurfaceDone(Standard_False),
-  myCurveDone(Standard_False),
-  myPointDone(Standard_False),
-  myShapeDone (Standard_False),
-  myDone(Standard_False)
 {
     myMapSurfaceStatus.Clear();
     myMapCurveStatus.Clear();
@@ -118,7 +103,7 @@ Standard_Boolean TopOpeBRepDS_Check::ChkIntg()
     bI = bI && ChkIntgInterf(LI);
   }
   
-#ifdef DEB
+#ifdef OCCT_DEBUG
   PrintIntg(cout);
 #endif
 //  CheckEdgeParameter();
@@ -160,7 +145,7 @@ Standard_Boolean TopOpeBRepDS_Check::CheckDS(const Standard_Integer I,
   case TopOpeBRepDS_SURFACE :
     {
       if(myHDS->NbSurfaces() < I) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        cout<<"Surpassed index of TopOpeBRepDS_SURFACE. actual index : "<<I;
        cout<<". Index max : "<<myHDS->NbSurfaces();
 #endif
@@ -176,7 +161,7 @@ Standard_Boolean TopOpeBRepDS_Check::CheckDS(const Standard_Integer I,
   case TopOpeBRepDS_CURVE :
     {
       if(myHDS->NbCurves() < I) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        cout<<"Surpassed index of TopOpeBRepDS_CURVE. actual index : "<<I;
        cout<<". Index max : "<<myHDS->NbCurves();
 #endif
@@ -193,7 +178,7 @@ Standard_Boolean TopOpeBRepDS_Check::CheckDS(const Standard_Integer I,
   case TopOpeBRepDS_POINT :
     {
       if(myHDS->NbPoints() < I) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        cout<<"Surpassed index of TopOpeBRepDS_POINT : actual index : "<<I;
        cout<<". Index max : "<<myHDS->NbPoints()<<endl;
 #endif
@@ -213,7 +198,7 @@ Standard_Boolean TopOpeBRepDS_Check::CheckDS(const Standard_Integer I,
 
   // topology
   if(myHDS->NbShapes() < I) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     cout<<"Surpassed index of TopOpeBRepDS_Shape_. actual index : "<<I;
     cout<<". Index max : "<<myHDS->NbShapes();
 #endif
@@ -223,11 +208,9 @@ Standard_Boolean TopOpeBRepDS_Check::CheckDS(const Standard_Integer I,
     return Standard_False;
   }
   const TopoDS_Shape& S =myHDS->Shape(I);
-#ifdef DEB
-  TopAbs_ShapeEnum se;
-#else
+
   TopAbs_ShapeEnum se=TopAbs_COMPOUND;
-#endif
+
   switch (K) {
   case TopOpeBRepDS_SOLID  : se = TopAbs_SOLID; break;
   case TopOpeBRepDS_SHELL  : se = TopAbs_SHELL; break;
@@ -239,7 +222,7 @@ Standard_Boolean TopOpeBRepDS_Check::CheckDS(const Standard_Integer I,
     break ;
   }
   if(S.ShapeType() != se) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     cout<<"Error :  Shape "<<I<<" is a ";
     TopOpeBRepDS::Print(TopOpeBRepDS::ShapeToKind(S.ShapeType()), cout);
     cout<<" and not a ";
@@ -271,7 +254,7 @@ Standard_Boolean TopOpeBRepDS_Check::ChkIntgSamDom()
     const TopoDS_Shape& Sind = myHDS->Shape(i);
     const TopTools_ListOfShape& losi = BDS.ShapeSameDomain(Sind);
     if(!CheckShapes(losi)) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
       cout<<"Shape of ShapeSameDomain (n*n "<<i;
       cout<<") is not defined in the DS"<<endl;
 #endif
@@ -282,7 +265,7 @@ Standard_Boolean TopOpeBRepDS_Check::ChkIntgSamDom()
     Curr = BDS.SameDomainRef(i);
     Loc = BDS.SameDomainRef(Curr);
     if(Curr && (Curr != Loc)) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
       cout<<"SameDomaineRef of Shape "<<i<<" = "<<Curr;
       cout<<". SameDomaineRef of Shape "<<Curr<<" = "<<Loc<<endl;
 #endif
@@ -293,7 +276,7 @@ Standard_Boolean TopOpeBRepDS_Check::ChkIntgSamDom()
       // Verification du type des differents Shapes SameDomain
       const TopoDS_Shape& Sref = myHDS->Shape(Curr);
       if(Sind.ShapeType() != Sref.ShapeType()) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        cout<<"Shapes n*n "<<i<<" and "<<Curr<<" are SameDomain."<<endl;
        cout<<"Type of Shape n*n "<<i<<" = ";
        PrintShape(Sind.ShapeType(),cout);
@@ -319,7 +302,7 @@ Standard_Boolean TopOpeBRepDS_Check::ChkIntgSamDom()
          liolos.Next();
        }
        if(!bb) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
          cout<<"Shapes n*n "<<i<<" and  "<<Curr<<" are SameDomain. ";
          cout<<"The reference of "<<i<<", is "<<Curr<<"."<<endl;
          cout<<"However, Shape n*n "<<i;
@@ -389,7 +372,7 @@ Standard_Boolean TopOpeBRepDS_Check::OneVertexOnPnt(){
       Dist = P1.Distance(P2);
       if(Dist <= tol1 + tol2) {
        if(sdr1 != sdr2) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
          cout<<"Pb Vertex n+n"<<Curr1<<" and n*n"<<Curr2;
          cout<<" : same place, not SameDomain"<<endl;
          cout<<"  Tol of Vertex n*n"<<Curr1<<" = "<<tol1<<endl;
@@ -400,7 +383,7 @@ Standard_Boolean TopOpeBRepDS_Check::OneVertexOnPnt(){
        }
       }
       else if(sdr1 == sdr2) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        cout<<"Pb Vertex "<<Curr1<<" and "<<Curr2;
        cout<<" : SameDomain, not same place"<<endl;
        cout<<"  Tol of Vertex n*n"<<Curr1<<" = "<<tol1<<endl;
@@ -419,7 +402,7 @@ Standard_Boolean TopOpeBRepDS_Check::OneVertexOnPnt(){
       const gp_Pnt& Pnt2 = TopOpeBRepTool_ShapeTool::Pnt(S1);
       Dist = Pnt1.Distance(Pnt2);
       if(Dist <= tol1 + tol2) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
        cout<<"Attention : Vertex "<<Curr1<<" and Point "<<PE.Index();
        cout<<" are confused"<<endl;
        cout<<"  Tol of Vertex n*n"<<Curr1<<" = "<<tol1<<endl;
@@ -437,7 +420,7 @@ Standard_Boolean TopOpeBRepDS_Check::OneVertexOnPnt(){
       for(j = i+1;j < NbPo;j++) {
        const TopOpeBRepDS_Point& dsPnt2 = myHDS->Point(j);
        if(dsPnt1.IsEqual(dsPnt2)) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
          cout<<"Attention : points "<<i<<" and "<<j<<" are confused"<<endl;
          cout<<"  Tol of Point n*n"<<i<<" = "<<dsPnt1.Tolerance()<<endl;
          cout<<"  Tol of Point n*n"<<j<<" = "<<dsPnt1.Tolerance()<<endl;
@@ -473,7 +456,7 @@ Standard_Boolean CheckEdgeParameter(const Handle(TopOpeBRepDS_HDataStructure)& m
       Handle(TopOpeBRepDS_EdgeVertexInterference) EVI =
        Handle(TopOpeBRepDS_EdgeVertexInterference)::DownCast(I1);
       if(!EVI.IsNull()) {
-//#ifdef DEB
+//#ifdef OCCT_DEBUG
 //     Standard_Integer Param = EVI->Parameter();
 //#else
        Standard_Integer Param = (Standard_Integer ) EVI->Parameter();
@@ -495,11 +478,10 @@ Standard_Boolean CheckEdgeParameter(const Handle(TopOpeBRepDS_HDataStructure)& m
     it1.Initialize(LI);
     while (it1.More() ) {
       const Handle(TopOpeBRepDS_Interference)& I1 = it1.Value();
-      const Handle(TopOpeBRepDS_CurvePointInterference)& CPI =
-       Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I1);
+      Handle(TopOpeBRepDS_CurvePointInterference) CPI (Handle(TopOpeBRepDS_CurvePointInterference)::DownCast(I1));
       if(!CPI.IsNull()) {
        Standard_Integer Param = 
-//#ifdef DEB
+//#ifdef OCCT_DEBUG
 //       TopOpeBRepDS_InterferenceTool::Parameter(CPI);
 //#else
          (Standard_Integer ) TopOpeBRepDS_InterferenceTool::Parameter(CPI);
@@ -663,12 +645,12 @@ Standard_OStream& TopOpeBRepDS_Check::PrintShape
     return OS;
   }
   OS<<" ";
-#ifdef DEB
+#ifdef OCCT_DEBUG
   const TopoDS_Shape& S =
 #endif
                           myHDS->Shape(index);
   
-#ifdef DEB
+#ifdef OCCT_DEBUG
   PrintShape(S.ShapeType(),cout);
   OS<<" "<<index<<" = ";
   Print(myMapShapeStatus.Find(index), cout);