Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/BOPAlgo_PaveFiller.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 2010-2014 OPEN CASCADE SAS
0003 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
0004 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
0005 //                         EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
0006 //
0007 // This file is part of Open CASCADE Technology software library.
0008 //
0009 // This library is free software; you can redistribute it and/or modify it under
0010 // the terms of the GNU Lesser General Public License version 2.1 as published
0011 // by the Free Software Foundation, with special exception defined in the file
0012 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0013 // distribution for complete text of the license and disclaimer of any warranty.
0014 //
0015 // Alternatively, this file may be used under the terms of Open CASCADE
0016 // commercial license or contractual agreement.
0017 
0018 #ifndef _BOPAlgo_PaveFiller_HeaderFile
0019 #define _BOPAlgo_PaveFiller_HeaderFile
0020 
0021 #include <Standard.hxx>
0022 #include <Standard_DefineAlloc.hxx>
0023 #include <Standard_Handle.hxx>
0024 
0025 #include <BOPAlgo_Algo.hxx>
0026 #include <BOPAlgo_GlueEnum.hxx>
0027 #include <BOPAlgo_SectionAttribute.hxx>
0028 #include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
0029 #include <BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx>
0030 #include <BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx>
0031 #include <BOPDS_IndexedMapOfPaveBlock.hxx>
0032 #include <BOPDS_ListOfPaveBlock.hxx>
0033 #include <BOPDS_MapOfPair.hxx>
0034 #include <BOPDS_MapOfPaveBlock.hxx>
0035 #include <BOPDS_PDS.hxx>
0036 #include <BOPDS_PIterator.hxx>
0037 #include <BOPDS_VectorOfCurve.hxx>
0038 #include <BOPTools_BoxTree.hxx>
0039 #include <IntSurf_ListOfPntOn2S.hxx>
0040 #include <IntTools_ShrunkRange.hxx>
0041 #include <NCollection_BaseAllocator.hxx>
0042 #include <Standard_Integer.hxx>
0043 #include <Standard_Real.hxx>
0044 #include <TColStd_DataMapOfIntegerInteger.hxx>
0045 #include <TColStd_DataMapOfIntegerListOfInteger.hxx>
0046 #include <TColStd_DataMapOfIntegerReal.hxx>
0047 #include <TColStd_ListOfInteger.hxx>
0048 #include <TColStd_MapOfInteger.hxx>
0049 #include <TopAbs_ShapeEnum.hxx>
0050 #include <TopTools_DataMapOfShapeInteger.hxx>
0051 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
0052 #include <TopTools_IndexedMapOfShape.hxx>
0053 #include <TopTools_ListOfShape.hxx>
0054 class IntTools_Context;
0055 class BOPDS_PaveBlock;
0056 class gp_Pnt;
0057 class BOPDS_Curve;
0058 class TopoDS_Vertex;
0059 class TopoDS_Edge;
0060 class TopoDS_Face;
0061 
0062 //!
0063 //! The class represents the Intersection phase of the
0064 //! Boolean Operations algorithm.<br>
0065 //! It performs the pairwise intersection of the sub-shapes of
0066 //! the arguments in the following order:<br>
0067 //! 1. Vertex/Vertex;<br>
0068 //! 2. Vertex/Edge;<br>
0069 //! 3. Edge/Edge;<br>
0070 //! 4. Vertex/Face;<br>
0071 //! 5. Edge/Face;<br>
0072 //! 6. Face/Face.<br>
0073 //!
0074 //! The results of intersection are stored into the Data Structure
0075 //! of the algorithm.<br>
0076 //!
0077 //! Additionally to the options provided by the parent class,
0078 //! the algorithm has the following options:<br>
0079 //! - *Section attributes* - allows to customize the intersection of the faces
0080 //!                          (avoid approximation or building 2d curves);<br>
0081 //! - *Safe processing mode* - allows to avoid modification of the input
0082 //!                            shapes during the operation (by default it is off);<br>
0083 //! - *Gluing options* - allows to speed up the calculation on the special
0084 //!                      cases, in which some sub-shapes are coincide.<br>
0085 //!
0086 //! The algorithm returns the following Warning statuses:
0087 //! - *BOPAlgo_AlertSelfInterferingShape* - in case some of the argument shapes are self-interfering
0088 //! shapes;
0089 //! - *BOPAlgo_AlertTooSmallEdge* - in case some edges of the input shapes have no valid range;
0090 //! - *BOPAlgo_AlertNotSplittableEdge* - in case some edges of the input shapes has such a small
0091 //!                                      valid range so it cannot be split;
0092 //! - *BOPAlgo_AlertBadPositioning* - in case the positioning of the input shapes leads to creation
0093 //!                                   of small edges;
0094 //! - *BOPAlgo_AlertIntersectionOfPairOfShapesFailed* - in case intersection of some of the
0095 //!                                                     sub-shapes has failed;
0096 //! - *BOPAlgo_AlertAcquiredSelfIntersection* - in case some sub-shapes of the argument become
0097 //! connected
0098 //!                                             through other shapes;
0099 //! - *BOPAlgo_AlertBuildingPCurveFailed* - in case building 2D curve for some of the edges
0100 //!                                         on the faces has failed.
0101 //!
0102 //! The algorithm returns the following Error alerts:
0103 //! - *BOPAlgo_AlertTooFewArguments* - in case there are no enough arguments to
0104 //!                      perform the operation;<br>
0105 //! - *BOPAlgo_AlertIntersectionFailed* - in case some unexpected error occurred;<br>
0106 //! - *BOPAlgo_AlertNullInputShapes* - in case some of the arguments are null shapes.<br>
0107 //!
0108 class BOPAlgo_PaveFiller : public BOPAlgo_Algo
0109 {
0110 public:
0111   DEFINE_STANDARD_ALLOC
0112 
0113   Standard_EXPORT BOPAlgo_PaveFiller();
0114 
0115   Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
0116 
0117   Standard_EXPORT BOPAlgo_PaveFiller(const Handle(NCollection_BaseAllocator)& theAllocator);
0118 
0119   Standard_EXPORT const BOPDS_DS& DS();
0120 
0121   Standard_EXPORT BOPDS_PDS PDS();
0122 
0123   Standard_EXPORT const BOPDS_PIterator& Iterator();
0124 
0125   //! Sets the arguments for operation
0126   void SetArguments(const TopTools_ListOfShape& theLS) { myArguments = theLS; }
0127 
0128   //! Adds the argument for operation
0129   void AddArgument(const TopoDS_Shape& theShape) { myArguments.Append(theShape); }
0130 
0131   //! Returns the list of arguments
0132   const TopTools_ListOfShape& Arguments() const { return myArguments; }
0133 
0134   Standard_EXPORT const Handle(IntTools_Context)& Context();
0135 
0136   Standard_EXPORT void SetSectionAttribute(const BOPAlgo_SectionAttribute& theSecAttr);
0137 
0138   //! Sets the flag that defines the mode of treatment.
0139   //! In non-destructive mode the argument shapes are not modified. Instead
0140   //! a copy of a sub-shape is created in the result if it is needed to be updated.
0141   Standard_EXPORT void SetNonDestructive(const Standard_Boolean theFlag);
0142 
0143   //! Returns the flag that defines the mode of treatment.
0144   //! In non-destructive mode the argument shapes are not modified. Instead
0145   //! a copy of a sub-shape is created in the result if it is needed to be updated.
0146   Standard_EXPORT Standard_Boolean NonDestructive() const;
0147 
0148   Standard_EXPORT virtual void Perform(
0149     const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0150 
0151   //! Sets the glue option for the algorithm
0152   Standard_EXPORT void SetGlue(const BOPAlgo_GlueEnum theGlue);
0153 
0154   //! Returns the glue option of the algorithm
0155   Standard_EXPORT BOPAlgo_GlueEnum Glue() const;
0156 
0157   //! Sets the flag to avoid building of p-curves of edges on faces
0158   void SetAvoidBuildPCurve(const Standard_Boolean theValue) { myAvoidBuildPCurve = theValue; }
0159 
0160   //! Returns the flag to avoid building of p-curves of edges on faces
0161   Standard_Boolean IsAvoidBuildPCurve() const { return myAvoidBuildPCurve; }
0162 
0163 protected:
0164   typedef NCollection_DataMap<Handle(BOPDS_PaveBlock), Bnd_Box> BOPAlgo_DataMapOfPaveBlockBndBox;
0165 
0166   typedef NCollection_DataMap<Handle(BOPDS_PaveBlock), TColStd_ListOfInteger>
0167     BOPAlgo_DataMapOfPaveBlockListOfInteger;
0168 
0169   typedef NCollection_DataMap<Standard_Integer, BOPDS_MapOfPaveBlock>
0170     BOPAlgo_DataMapOfIntegerMapOfPaveBlock;
0171 
0172   //! Sets non-destructive mode automatically if an argument
0173   //! contains a locked sub-shape (see TopoDS_Shape::Locked()).
0174   Standard_EXPORT void SetNonDestructive();
0175 
0176   Standard_EXPORT void SetIsPrimary(const Standard_Boolean theFlag);
0177 
0178   Standard_EXPORT Standard_Boolean IsPrimary() const;
0179 
0180   Standard_EXPORT virtual void PerformInternal(const Message_ProgressRange& theRange);
0181 
0182   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
0183 
0184   Standard_EXPORT virtual void Init(const Message_ProgressRange& theRange);
0185 
0186   Standard_EXPORT void Prepare(const Message_ProgressRange& theRange);
0187 
0188   Standard_EXPORT virtual void PerformVV(const Message_ProgressRange& theRange);
0189 
0190   Standard_EXPORT virtual void PerformVE(const Message_ProgressRange& theRange);
0191 
0192   //! Performs the intersection of the vertices with edges.
0193   Standard_EXPORT void IntersectVE(const BOPDS_IndexedDataMapOfPaveBlockListOfInteger& theVEPairs,
0194                                    const Message_ProgressRange&                        theRange,
0195                                    const Standard_Boolean bAddInterfs = Standard_True);
0196 
0197   //! Splits the Pave Blocks of the given edges with the extra paves.<br>
0198   //! The method also builds the shrunk data for the new pave blocks and
0199   //! in case there is no valid range on the pave block, the vertices of
0200   //! this pave block will be united making SD vertex.<br>
0201   //! Parameter <theAddInterfs> defines whether this interference will be added
0202   //! into common table of interferences or not.<br>
0203   //! If some of the Pave Blocks are forming the Common Blocks, the splits
0204   //! of the Pave Blocks will also form a Common Block.
0205   Standard_EXPORT void SplitPaveBlocks(const TColStd_MapOfInteger& theMEdges,
0206                                        const Standard_Boolean      theAddInterfs);
0207 
0208   Standard_EXPORT virtual void PerformVF(const Message_ProgressRange& theRange);
0209 
0210   Standard_EXPORT virtual void PerformEE(const Message_ProgressRange& theRange);
0211 
0212   Standard_EXPORT virtual void PerformEF(const Message_ProgressRange& theRange);
0213 
0214   Standard_EXPORT virtual void PerformFF(const Message_ProgressRange& theRange);
0215 
0216   Standard_EXPORT void TreatVerticesEE();
0217 
0218   Standard_EXPORT void MakeSDVerticesFF(const TColStd_DataMapOfIntegerListOfInteger& aDMVLV,
0219                                         TColStd_DataMapOfIntegerInteger&             theDMNewSD);
0220 
0221   Standard_EXPORT void MakeSplitEdges(const Message_ProgressRange& theRange);
0222 
0223   Standard_EXPORT void MakeBlocks(const Message_ProgressRange& theRange);
0224 
0225   Standard_EXPORT void MakePCurves(const Message_ProgressRange& theRange);
0226 
0227   Standard_EXPORT Standard_Integer MakeSDVertices(const TColStd_ListOfInteger& theVertIndices,
0228                                                   const Standard_Boolean       theAddInterfs = 1);
0229 
0230   Standard_EXPORT void ProcessDE(const Message_ProgressRange& theRange);
0231 
0232   Standard_EXPORT void FillShrunkData(Handle(BOPDS_PaveBlock)& thePB);
0233 
0234   Standard_EXPORT void FillShrunkData(const TopAbs_ShapeEnum theType1,
0235                                       const TopAbs_ShapeEnum theType2);
0236 
0237   //! Analyzes the results of computation of the valid range for the
0238   //! pave block and in case of error adds the warning status, otherwise
0239   //! saves the valid range in the pave block.
0240   Standard_EXPORT void AnalyzeShrunkData(const Handle(BOPDS_PaveBlock)& thePB,
0241                                          const IntTools_ShrunkRange&    theSR);
0242 
0243   //! Performs intersection of new vertices, obtained in E/E and E/F intersections
0244   Standard_EXPORT void PerformNewVertices(
0245     BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
0246     const Handle(NCollection_BaseAllocator)&       theAllocator,
0247     const Message_ProgressRange&                   theRange,
0248     const Standard_Boolean                         theIsEEIntersection = Standard_True);
0249 
0250   Standard_EXPORT Standard_Boolean CheckFacePaves(const TopoDS_Vertex&        theVnew,
0251                                                   const TColStd_MapOfInteger& theMIF);
0252 
0253   Standard_EXPORT static Standard_Boolean CheckFacePaves(const Standard_Integer      theN,
0254                                                          const TColStd_MapOfInteger& theMIFOn,
0255                                                          const TColStd_MapOfInteger& theMIFIn);
0256 
0257   Standard_EXPORT Standard_Boolean IsExistingVertex(const gp_Pnt&               theP,
0258                                                     const Standard_Real         theTol,
0259                                                     const TColStd_MapOfInteger& theMVOn) const;
0260 
0261   //! Checks and puts paves from <theMVOnIn> on the curve <theNC>.
0262   //! At that, common (from theMVCommon) and not common vertices
0263   //! are processed differently.
0264   Standard_EXPORT void PutPavesOnCurve(const TColStd_MapOfInteger&            theMVOnIn,
0265                                        const TColStd_MapOfInteger&            theMVCommon,
0266                                        BOPDS_Curve&                           theNC,
0267                                        const TColStd_MapOfInteger&            theMI,
0268                                        const TColStd_MapOfInteger&            theMVEF,
0269                                        TColStd_DataMapOfIntegerReal&          theMVTol,
0270                                        TColStd_DataMapOfIntegerListOfInteger& theDMVLV);
0271 
0272   Standard_EXPORT void FilterPavesOnCurves(const BOPDS_VectorOfCurve&    theVNC,
0273                                            TColStd_DataMapOfIntegerReal& theMVTol);
0274 
0275   //! Depending on the parameter aType it checks whether
0276   //! the vertex nV was created in EE or EF intersections.
0277   //! If so, it increases aTolVExt from tolerance value of vertex to
0278   //! the max distance from vertex nV to the ends of the range of common part.
0279   //! Possible values of aType:
0280   //! 1 - checks only EE;
0281   //! 2 - checks only EF;
0282   //! other - checks both types of intersections.
0283   Standard_EXPORT Standard_Boolean ExtendedTolerance(const Standard_Integer      nV,
0284                                                      const TColStd_MapOfInteger& aMI,
0285                                                      Standard_Real&              aTolVExt,
0286                                                      const Standard_Integer      aType = 0);
0287 
0288   Standard_EXPORT void PutBoundPaveOnCurve(const TopoDS_Face&     theF1,
0289                                            const TopoDS_Face&     theF2,
0290                                            BOPDS_Curve&           theNC,
0291                                            TColStd_ListOfInteger& theLBV);
0292 
0293   //! Checks if the given pave block (created on section curve)
0294   //! coincides with any of the pave blocks of the faces
0295   //! created the section curve.
0296   Standard_EXPORT Standard_Boolean IsExistingPaveBlock(const Handle(BOPDS_PaveBlock)&     thePB,
0297                                                        const BOPDS_Curve&                 theNC,
0298                                                        const Standard_Real                theTolR3D,
0299                                                        const BOPDS_IndexedMapOfPaveBlock& theMPB,
0300                                                        BOPTools_BoxTree&                  thePBTree,
0301                                                        const BOPDS_MapOfPaveBlock& theMPBCommon,
0302                                                        Handle(BOPDS_PaveBlock)&    thePBOut,
0303                                                        Standard_Real&              theTolNew);
0304 
0305   //! Checks if the given pave block (created on section curve)
0306   //! coincides with any of the edges shared between the faces
0307   //! created the section curve.
0308   Standard_EXPORT Standard_Boolean IsExistingPaveBlock(const Handle(BOPDS_PaveBlock)& thePB,
0309                                                        const BOPDS_Curve&             theNC,
0310                                                        const TColStd_ListOfInteger&   theLSE,
0311                                                        Standard_Integer&              theNEOut,
0312                                                        Standard_Real&                 theTolNew);
0313 
0314   //! Treatment of section edges.
0315   Standard_EXPORT void PostTreatFF(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
0316                                    BOPDS_DataMapOfPaveBlockListOfPaveBlock&       theDMExEdges,
0317                                    TColStd_DataMapOfIntegerInteger&               theDMNewSD,
0318                                    const BOPDS_IndexedMapOfPaveBlock&             theMicroPB,
0319                                    const TopTools_IndexedMapOfShape&        theVertsOnRejectedPB,
0320                                    const Handle(NCollection_BaseAllocator)& theAllocator,
0321                                    const Message_ProgressRange&             theRange);
0322 
0323   Standard_EXPORT void FindPaveBlocks(const Standard_Integer theV,
0324                                       const Standard_Integer theF,
0325                                       BOPDS_ListOfPaveBlock& theLPB);
0326 
0327   Standard_EXPORT void FillPaves(const Standard_Integer         theV,
0328                                  const Standard_Integer         theE,
0329                                  const Standard_Integer         theF,
0330                                  const BOPDS_ListOfPaveBlock&   theLPB,
0331                                  const Handle(BOPDS_PaveBlock)& thePB);
0332 
0333   Standard_EXPORT void MakeSplitEdge(const Standard_Integer theV, const Standard_Integer theF);
0334 
0335   Standard_EXPORT void GetEFPnts(const Standard_Integer nF1,
0336                                  const Standard_Integer nF2,
0337                                  IntSurf_ListOfPntOn2S& aListOfPnts);
0338 
0339   //! Checks and puts paves created in EF intersections on the curve <theNC>.
0340   Standard_EXPORT void PutEFPavesOnCurve(const BOPDS_VectorOfCurve&             theVC,
0341                                          const Standard_Integer                 theIndex,
0342                                          const TColStd_MapOfInteger&            theMI,
0343                                          const TColStd_MapOfInteger&            theMVEF,
0344                                          TColStd_DataMapOfIntegerReal&          theMVTol,
0345                                          TColStd_DataMapOfIntegerListOfInteger& aDMVLV);
0346 
0347   //! Puts stick paves on the curve <theNC>
0348   Standard_EXPORT void PutStickPavesOnCurve(const TopoDS_Face&                     aF1,
0349                                             const TopoDS_Face&                     aF2,
0350                                             const TColStd_MapOfInteger&            theMI,
0351                                             const BOPDS_VectorOfCurve&             theVC,
0352                                             const Standard_Integer                 theIndex,
0353                                             const TColStd_MapOfInteger&            theMVStick,
0354                                             TColStd_DataMapOfIntegerReal&          theMVTol,
0355                                             TColStd_DataMapOfIntegerListOfInteger& aDMVLV);
0356 
0357   //! Collects indices of vertices created in all intersections between
0358   //! two faces (<nF1> and <nF2>) to the map <theMVStick>.
0359   //! Also, it collects indices of EF vertices to the <theMVEF> map
0360   //! and indices of all subshapes of these two faces to the <theMI> map.
0361   Standard_EXPORT void GetStickVertices(const Standard_Integer nF1,
0362                                         const Standard_Integer nF2,
0363                                         TColStd_MapOfInteger&  theMVStick,
0364                                         TColStd_MapOfInteger&  theMVEF,
0365                                         TColStd_MapOfInteger&  theMI);
0366 
0367   //! Collects index nF and indices of all subshapes of the shape with index <nF>
0368   //! to the map <theMI>.
0369   Standard_EXPORT void GetFullShapeMap(const Standard_Integer nF, TColStd_MapOfInteger& theMI);
0370 
0371   //! Removes indices of vertices that are already on the
0372   //! curve <theNC> from the map <theMV>.
0373   //! It is used in PutEFPavesOnCurve and PutStickPavesOnCurve methods.
0374   Standard_EXPORT void RemoveUsedVertices(const BOPDS_VectorOfCurve& theVC,
0375                                           TColStd_MapOfInteger&      theMV);
0376 
0377   //! Puts the pave nV on the curve theNC.
0378   //! Parameter aType defines whether to check the pave with
0379   //! extended tolerance:
0380   //! 0 - do not perform the check;
0381   //! other - perform the check (aType goes to ExtendedTolerance).
0382   Standard_EXPORT void PutPaveOnCurve(const Standard_Integer                 nV,
0383                                       const Standard_Real                    theTolR3D,
0384                                       const BOPDS_Curve&                     theNC,
0385                                       const TColStd_MapOfInteger&            theMI,
0386                                       TColStd_DataMapOfIntegerReal&          theMVTol,
0387                                       TColStd_DataMapOfIntegerListOfInteger& aDMVLV,
0388                                       const Standard_Integer                 aType = 0);
0389 
0390   //! Adds the existing edges for intersection with section edges
0391   //! by checking the possible intersection with the faces comparing
0392   //! pre-saved E-F distances with new tolerances.
0393   Standard_EXPORT void ProcessExistingPaveBlocks(
0394     const Standard_Integer                         theInt,
0395     const Standard_Integer                         theCur,
0396     const Standard_Integer                         nF1,
0397     const Standard_Integer                         nF2,
0398     const TopoDS_Edge&                             theES,
0399     const BOPDS_IndexedMapOfPaveBlock&             theMPBOnIn,
0400     BOPTools_BoxTree&                              thePBTree,
0401     BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
0402     TopTools_DataMapOfShapeInteger&                theMVI,
0403     BOPDS_ListOfPaveBlock&                         theLPBC,
0404     BOPAlgo_DataMapOfPaveBlockListOfInteger&       thePBFacesMap,
0405     BOPDS_MapOfPaveBlock&                          theMPB);
0406 
0407   //! Adds the existing edges from the map <theMPBOnIn> which interfere
0408   //! with the vertices from <theMVB> map to the post treatment of section edges.
0409   Standard_EXPORT void ProcessExistingPaveBlocks(
0410     const Standard_Integer                         theInt,
0411     const Standard_Integer                         nF1,
0412     const Standard_Integer                         nF2,
0413     const BOPDS_IndexedMapOfPaveBlock&             theMPBOnIn,
0414     BOPTools_BoxTree&                              thePBTree,
0415     const TColStd_DataMapOfIntegerListOfInteger&   theDMBV,
0416     BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
0417     TopTools_DataMapOfShapeInteger&                theMVI,
0418     BOPAlgo_DataMapOfPaveBlockListOfInteger&       thePBFacesMap,
0419     BOPDS_MapOfPaveBlock&                          theMPB);
0420 
0421   //! Replaces existing pave block <thePB> with new pave blocks <theLPB>.
0422   //! The list <theLPB> contains images of <thePB> which were created in
0423   //! the post treatment of section edges.
0424   //! Tries to project the new edges on the faces contained in the <thePBFacesMap>.
0425   Standard_EXPORT void UpdateExistingPaveBlocks(
0426     const Handle(BOPDS_PaveBlock)&                 thePB,
0427     BOPDS_ListOfPaveBlock&                         theLPB,
0428     const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap);
0429 
0430   //! Treatment of vertices that were created in EE intersections.
0431   Standard_EXPORT void TreatNewVertices(
0432     const BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
0433     TopTools_IndexedDataMapOfShapeListOfShape&           theImages);
0434 
0435   //! Put paves on the curve <aBC> in case when <aBC>
0436   //! is closed 3D-curve
0437   Standard_EXPORT void PutClosingPaveOnCurve(BOPDS_Curve& aNC);
0438 
0439   //! Keeps data for post treatment
0440   Standard_EXPORT void PreparePostTreatFF(const Standard_Integer                         aInt,
0441                                           const Standard_Integer                         aCur,
0442                                           const Handle(BOPDS_PaveBlock)&                 aPB,
0443                                           BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
0444                                           TopTools_DataMapOfShapeInteger&                aMVI,
0445                                           BOPDS_ListOfPaveBlock&                         aLPB);
0446 
0447   //! Updates the information about faces
0448   Standard_EXPORT void UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock&       theDME,
0449                                       const TColStd_DataMapOfIntegerInteger&         theDMV,
0450                                       const BOPAlgo_DataMapOfPaveBlockListOfInteger& thePBFacesMap);
0451 
0452   //! Updates tolerance of vertex with index <nV>
0453   //! to make it interfere with edge.
0454   //! Returns TRUE if intersection happened.
0455   Standard_EXPORT Standard_Boolean ForceInterfVE(const Standard_Integer   nV,
0456                                                  Handle(BOPDS_PaveBlock)& aPB,
0457                                                  TColStd_MapOfInteger&    theMEdges);
0458 
0459   //! Updates tolerance of vertex with index <nV>
0460   //! to make it interfere with face with index <nF>
0461   Standard_EXPORT Standard_Boolean ForceInterfVF(const Standard_Integer nV,
0462                                                  const Standard_Integer nF);
0463 
0464   //! Checks if there are any common or intersecting sub shapes
0465   //! between two planar faces.
0466   Standard_EXPORT Standard_Boolean CheckPlanes(const Standard_Integer nF1,
0467                                                const Standard_Integer nF2) const;
0468 
0469   //! Creates new edge from the edge nE with vertices nV1 and nV2
0470   //! and returns the index of that new edge in the DS.
0471   Standard_EXPORT Standard_Integer SplitEdge(const Standard_Integer nE,
0472                                              const Standard_Integer nV1,
0473                                              const Standard_Real    aT1,
0474                                              const Standard_Integer nV2,
0475                                              const Standard_Real    aT2);
0476 
0477   //! Updates pave blocks which have the paves with indices contained
0478   //! in the map <aDMNewSD>.
0479   Standard_EXPORT void UpdatePaveBlocks(const TColStd_DataMapOfIntegerInteger& aDMNewSD);
0480 
0481   //! Updates tolerance vertex nV due to V/E interference.
0482   //! It always creates new vertex if nV is from arguments.
0483   //! @return  DS index of updated vertex.
0484   Standard_EXPORT Standard_Integer UpdateVertex(const Standard_Integer nV,
0485                                                 const Standard_Real    aTolNew);
0486 
0487   Standard_EXPORT void UpdatePaveBlocksWithSDVertices();
0488 
0489   Standard_EXPORT void UpdateCommonBlocksWithSDVertices();
0490 
0491   Standard_EXPORT void UpdateBlocksWithSharedVertices();
0492 
0493   Standard_EXPORT void UpdateInterfsWithSDVertices();
0494 
0495   Standard_EXPORT Standard_Boolean EstimatePaveOnCurve(const Standard_Integer nV,
0496                                                        const BOPDS_Curve&     theNC,
0497                                                        const Standard_Real    theTolR3D);
0498 
0499   Standard_EXPORT void UpdateEdgeTolerance(const Standard_Integer nE, const Standard_Real aTolNew);
0500 
0501   Standard_EXPORT void RemovePaveBlocks(const TColStd_MapOfInteger& theEdges);
0502 
0503   Standard_EXPORT void CorrectToleranceOfSE();
0504 
0505   //! Reduce the intersection range using the common ranges of
0506   //! Edge/Edge interferences to avoid creation of close
0507   //! intersection vertices
0508   Standard_EXPORT void ReduceIntersectionRange(const Standard_Integer theV1,
0509                                                const Standard_Integer theV2,
0510                                                const Standard_Integer theE,
0511                                                const Standard_Integer theF,
0512                                                Standard_Real&         theTS1,
0513                                                Standard_Real&         theTS2);
0514 
0515   //! Gets the bounding box for the given Pave Block.
0516   //! If Pave Block has shrunk data it will be used to get the box,
0517   //! and the Shrunk Range (<theSFirst>, <theSLast>).
0518   //! Otherwise the box will be computed using BndLib_Add3dCurve method,
0519   //! and the Shrunk Range will be equal to the PB's range.
0520   //! To avoid re-computation of the bounding box for the same Pave Block
0521   //! it will be saved in the map <thePBBox>.
0522   //! Returns FALSE in case the PB's range is less than the
0523   //! Precision::PConfusion(), otherwise returns TRUE.
0524   Standard_EXPORT Standard_Boolean GetPBBox(const TopoDS_Edge&                theE,
0525                                             const Handle(BOPDS_PaveBlock)&    thePB,
0526                                             BOPAlgo_DataMapOfPaveBlockBndBox& thePBBox,
0527                                             Standard_Real&                    theFirst,
0528                                             Standard_Real&                    theLast,
0529                                             Standard_Real&                    theSFirst,
0530                                             Standard_Real&                    theSLast,
0531                                             Bnd_Box&                          theBox);
0532 
0533   //! Treatment of the possible common zones, not detected by the
0534   //! Face/Face intersection algorithm, by intersection of each section edge
0535   //! with all faces not participated in creation of that section edge.
0536   //! If the intersection says that the section edge is lying on the face
0537   //! it will be added into FaceInfo structure of the face as IN edge
0538   //! and will be used for splitting.
0539   Standard_EXPORT void PutSEInOtherFaces(const Message_ProgressRange& theRange);
0540 
0541   //! Analyzes the results of interferences of sub-shapes of the shapes
0542   //! looking for self-interfering entities by the following rules:<br>
0543   //! 1. The Faces of the same shape considered interfering in case they:<br>
0544   //!    - Interfere with the other shapes in the same place (in the same vertex) or;<br>
0545   //!    - Included in the same common block.
0546   //! 2. The Faces of the same shape considered interfering in case they
0547   //!    share the IN or SECTION edges.<br>
0548   //! In case self-interference is found the warning is added.
0549   Standard_EXPORT void CheckSelfInterference();
0550 
0551   //! Adds the warning about failed intersection of pair of sub-shapes
0552   Standard_EXPORT void AddIntersectionFailedWarning(const TopoDS_Shape& theS1,
0553                                                     const TopoDS_Shape& theS2);
0554 
0555   //! Repeat intersection of sub-shapes with increased vertices.
0556   Standard_EXPORT void RepeatIntersection(const Message_ProgressRange& theRange);
0557 
0558   //! Updates vertices of CommonBlocks with real tolerance of CB.
0559   Standard_EXPORT void UpdateVerticesOfCB();
0560 
0561   //! The method looks for the additional common blocks among pairs of edges
0562   //! with the same bounding vertices.
0563   Standard_EXPORT void ForceInterfEE(const Message_ProgressRange& theRange);
0564 
0565   //! The method looks for the additional edge/face common blocks
0566   //! among pairs of edge/face having the same vertices.
0567   Standard_EXPORT void ForceInterfEF(const Message_ProgressRange& theRange);
0568 
0569   //! Performs intersection of given pave blocks
0570   //! with all faces from arguments.
0571   Standard_EXPORT void ForceInterfEF(const BOPDS_IndexedMapOfPaveBlock& theMPB,
0572                                      const Message_ProgressRange&       theRange,
0573                                      const Standard_Boolean             theAddInterf);
0574 
0575   //! When all section edges are created and no increase of the tolerance
0576   //! of vertices put on the section edges is expected, make sure that
0577   //! the created sections have valid range.
0578   //! If any of the section edges do not have valid range, remove them
0579   //! from Face/Face intersection info and from the input <theMSCPB> map.
0580   //! Put such edges into <MicroPB> map for further unification of their
0581   //! vertices in the PostTreatFF method.
0582   //!
0583   //! All these section edges have already been checked to have valid range.
0584   //! Current check is necessary for the edges whose vertices have also
0585   //! been put on other section edges with greater tolerance, which has caused
0586   //! increase of the tolerance value of the vertices.
0587   Standard_EXPORT void RemoveMicroSectionEdges(
0588     BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
0589     BOPDS_IndexedMapOfPaveBlock&                   theMicroPB);
0590 
0591   //! Check all edges on the micro status and remove the positive ones
0592   Standard_EXPORT void RemoveMicroEdges();
0593 
0594   //! Auxiliary structure to hold the edge distance to the face
0595   struct EdgeRangeDistance
0596   {
0597     Standard_Real First;
0598     Standard_Real Last;
0599     Standard_Real Distance;
0600 
0601     EdgeRangeDistance(const Standard_Real theFirst    = 0.0,
0602                       const Standard_Real theLast     = 0.0,
0603                       const Standard_Real theDistance = RealLast())
0604         : First(theFirst),
0605           Last(theLast),
0606           Distance(theDistance)
0607     {
0608     }
0609   };
0610 
0611 protected: //! Analyzing Progress steps
0612   //! Filling steps for constant operations
0613   Standard_EXPORT void fillPIConstants(const Standard_Real theWhole,
0614                                        BOPAlgo_PISteps&    theSteps) const Standard_OVERRIDE;
0615   //! Filling steps for all other operations
0616   Standard_EXPORT void fillPISteps(BOPAlgo_PISteps& theSteps) const Standard_OVERRIDE;
0617 
0618 protected: //! Fields
0619   TopTools_ListOfShape     myArguments;
0620   BOPDS_PDS                myDS;
0621   BOPDS_PIterator          myIterator;
0622   Handle(IntTools_Context) myContext;
0623   BOPAlgo_SectionAttribute mySectionAttribute;
0624   Standard_Boolean         myNonDestructive;
0625   Standard_Boolean         myIsPrimary;
0626   Standard_Boolean         myAvoidBuildPCurve;
0627   BOPAlgo_GlueEnum         myGlue;
0628 
0629   // clang-format off
0630   BOPAlgo_DataMapOfIntegerMapOfPaveBlock myFPBDone; //!< Fence map of intersected faces and pave blocks
0631   TColStd_MapOfInteger myIncreasedSS; //!< Sub-shapes with increased tolerance during the operation
0632   TColStd_MapOfInteger myVertsToAvoidExtension; //!< Vertices located close to E/E or E/F intersection points
0633                                                 //! which has already been extended to cover the real intersection
0634                                                 //! points, and should not be extended any longer to be put
0635                                                 //! on a section curve.
0636   
0637   NCollection_DataMap <BOPDS_Pair,
0638                        NCollection_List<EdgeRangeDistance>>
0639                                             myDistances; //!< Map to store minimal distances between shapes
0640                                                          //!  which have no real intersections
0641   // clang-format on
0642 };
0643 
0644 #endif // _BOPAlgo_PaveFiller_HeaderFile