Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:54

0001 // Created on: 2005-02-14
0002 // Created by: Alexey MORENOV
0003 // Copyright (c) 2005-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef ShapeAnalysis_BoxBndTree_HeaderFile
0017 #define ShapeAnalysis_BoxBndTree_HeaderFile
0018 
0019 #include <NCollection_UBTree.hxx>
0020 #include <Bnd_Box.hxx>
0021 #include <gp_Pnt.hxx>
0022 #include <Standard_Transient.hxx>
0023 #include <TopTools_HArray1OfShape.hxx>
0024 
0025 #include <ShapeExtend.hxx>
0026 #include <ShapeExtend_Status.hxx>
0027 #include <TopoDS_Vertex.hxx>
0028 #include <TColStd_MapOfInteger.hxx>
0029 #include <TColStd_Array1OfInteger.hxx>
0030 
0031 typedef NCollection_UBTree <Standard_Integer , Bnd_Box> ShapeAnalysis_BoxBndTree;
0032 
0033 class ShapeAnalysis_BoxBndTreeSelector
0034   : public ShapeAnalysis_BoxBndTree::Selector
0035 {
0036  public:
0037   ShapeAnalysis_BoxBndTreeSelector
0038     (Handle (TopTools_HArray1OfShape) theSeq,
0039      Standard_Boolean theShared)
0040     :  mySeq(theSeq), myShared(theShared), myNb(0), myTol(1e-7), myMin3d(1e-7),myArrIndices(1,2),
0041       myStatus(ShapeExtend::EncodeStatus (ShapeExtend_OK))
0042       {
0043         myArrIndices.Init(0);
0044       }
0045   
0046   void DefineBoxes (const Bnd_Box& theFBox, const Bnd_Box& theLBox)
0047     { myFBox = theFBox;
0048       myLBox = theLBox; 
0049       myArrIndices.Init(0);
0050        
0051   }
0052   
0053   void DefineVertexes (TopoDS_Vertex theVf, TopoDS_Vertex theVl)
0054     { myFVertex = theVf;
0055       myLVertex = theVl; 
0056        myStatus=ShapeExtend::EncodeStatus (ShapeExtend_OK);
0057     }
0058     
0059   void DefinePnt (const gp_Pnt& theFPnt, const gp_Pnt& theLPnt)
0060     { myFPnt = theFPnt;
0061       myLPnt = theLPnt; 
0062        myStatus =ShapeExtend::EncodeStatus (ShapeExtend_OK);
0063     }
0064   
0065   Standard_Integer GetNb ()
0066     { return myNb; }
0067   
0068   void  SetNb (Standard_Integer theNb)
0069     { myNb = theNb; }
0070  
0071   void LoadList(Standard_Integer elem)
0072     { myList.Add(elem); }
0073   
0074   void SetStop ()
0075     { myStop = Standard_False; }
0076 
0077   void SetTolerance (Standard_Real theTol)
0078     { 
0079       myTol = theTol;
0080       myMin3d = theTol; 
0081       myStatus=ShapeExtend::EncodeStatus (ShapeExtend_OK);
0082     }
0083 
0084   Standard_Boolean ContWire(Standard_Integer nbWire)
0085     { return myList.Contains(nbWire); }
0086   
0087   inline Standard_Boolean LastCheckStatus (const ShapeExtend_Status theStatus) const
0088     { return ShapeExtend::DecodeStatus ( myStatus, theStatus ); }
0089     
0090   Standard_Boolean Reject (const Bnd_Box& theBnd) const;
0091   Standard_Boolean Accept (const Standard_Integer &);
0092   
0093  private:
0094   Bnd_Box                              myFBox;
0095   Bnd_Box                              myLBox;
0096   Handle (TopTools_HArray1OfShape)     mySeq;
0097   Standard_Boolean                     myShared;
0098   Standard_Integer                     myNb;
0099   TopoDS_Vertex                        myFVertex;
0100   TopoDS_Vertex                        myLVertex;
0101   gp_Pnt                               myFPnt;
0102   gp_Pnt                               myLPnt;
0103   TColStd_MapOfInteger                 myList;
0104   Standard_Real                        myTol;
0105   Standard_Real                        myMin3d;
0106   TColStd_Array1OfInteger              myArrIndices;
0107   Standard_Integer                     myStatus;
0108 
0109 };
0110 
0111 #endif