Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2006-08-10
0002 // Created by: Galina KULIKOVA
0003 // Copyright (c) 2006-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 _ShapeUpgrade_RemoveInternalWires_HeaderFile
0017 #define _ShapeUpgrade_RemoveInternalWires_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_Type.hxx>
0021 
0022 #include <TopoDS_Shape.hxx>
0023 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
0024 #include <TopTools_DataMapOfShapeListOfShape.hxx>
0025 #include <TopTools_SequenceOfShape.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <ShapeUpgrade_Tool.hxx>
0028 #include <ShapeExtend_Status.hxx>
0029 
0030 // resolve name collisions with X11 headers
0031 #ifdef Status
0032   #undef Status
0033 #endif
0034 
0035 class ShapeUpgrade_RemoveInternalWires;
0036 DEFINE_STANDARD_HANDLE(ShapeUpgrade_RemoveInternalWires, ShapeUpgrade_Tool)
0037 
0038 //! Removes all internal wires having area less than specified min area
0039 class ShapeUpgrade_RemoveInternalWires : public ShapeUpgrade_Tool
0040 {
0041 
0042 public:
0043 
0044   
0045   //! Creates empty  constructor.
0046   Standard_EXPORT ShapeUpgrade_RemoveInternalWires();
0047   
0048   Standard_EXPORT ShapeUpgrade_RemoveInternalWires(const TopoDS_Shape& theShape);
0049   
0050   //! Initialize by a Shape.
0051   Standard_EXPORT void Init (const TopoDS_Shape& theShape);
0052   
0053   //! Removes all internal wires having area less than area specified as minimal allowed area
0054   Standard_EXPORT Standard_Boolean Perform();
0055   
0056   //! If specified sequence of shape contains -
0057   //! 1.wires then these wires will be removed if they have area less than allowed min area.
0058   //! 2.faces than internal wires from these faces will be removed if they have area less than allowed min area.
0059   Standard_EXPORT Standard_Boolean Perform (const TopTools_SequenceOfShape& theSeqShapes);
0060   
0061   //! Get result shape
0062     TopoDS_Shape GetResult() const;
0063   
0064   //! Set min area allowed for holes( all holes having area less than mi area will be removed)
0065     Standard_Real& MinArea();
0066   
0067   //! Set mode which manage removing faces which have outer wires consisting only from edges
0068   //! belonginig to removed internal wires.
0069   //! By default it is equal to true.
0070     Standard_Boolean& RemoveFaceMode();
0071   
0072   //! Returns sequence of removed faces.
0073     const TopTools_SequenceOfShape& RemovedFaces() const;
0074   
0075   //! Returns sequence of removed faces.
0076     const TopTools_SequenceOfShape& RemovedWires() const;
0077   
0078   //! Queries status of last call to Perform()
0079   //! : OK - nothing was done
0080   //! :DONE1 - internal wires were removed
0081   //! :DONE2 - small faces were removed.
0082   //! :FAIL1 - initial shape is not specified
0083   //! :FAIL2 - specified sub-shape is not belonged to inotial shape.
0084     Standard_Boolean Status (const ShapeExtend_Status theStatus) const;
0085 
0086 
0087 
0088 
0089   DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_RemoveInternalWires,ShapeUpgrade_Tool)
0090 
0091 protected:
0092 
0093   
0094   //! Clear all sequences and temporary map;
0095   Standard_EXPORT void Clear();
0096 
0097   Standard_Integer myStatus;
0098 
0099 
0100 private:
0101 
0102   
0103   //! Removes internal wires having area of contour less than specified MinArea
0104   Standard_EXPORT void removeSmallWire (const TopoDS_Shape& theFace, const TopoDS_Shape& theWire);
0105   
0106   //! Removes faces having outer wire consisting
0107   //! from removed edges(belonging small internal wires)
0108   Standard_EXPORT void removeSmallFaces();
0109 
0110   TopoDS_Shape myShape;
0111   TopoDS_Shape myResult;
0112   Standard_Real myMinArea;
0113   Standard_Boolean myRemoveFacesMode;
0114   TopTools_IndexedDataMapOfShapeListOfShape myEdgeFaces;
0115   TopTools_DataMapOfShapeListOfShape myRemoveEdges;
0116   TopTools_SequenceOfShape myRemovedFaces;
0117   TopTools_SequenceOfShape myRemoveWires;
0118 
0119 
0120 };
0121 
0122 
0123 #include <ShapeUpgrade_RemoveInternalWires.lxx>
0124 
0125 
0126 
0127 
0128 
0129 #endif // _ShapeUpgrade_RemoveInternalWires_HeaderFile