Back to home page

EIC code displayed by LXR

 
 

    


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

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