1 // Created by: Peter KURNEV
2 // Copyright (c) 2010-2014 OPEN CASCADE SAS
3 // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
4 // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT,
5 // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 // This file is part of Open CASCADE Technology software library.
9 // This library is free software; you can redistribute it and/or modify it under
10 // the terms of the GNU Lesser General Public License version 2.1 as published
11 // by the Free Software Foundation, with special exception defined in the file
12 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
13 // distribution for complete text of the license and disclaimer of any warranty.
15 // Alternatively, this file may be used under the terms of Open CASCADE
16 // commercial license or contractual agreement.
18 #ifndef _BOPAlgo_PaveFiller_HeaderFile
19 #define _BOPAlgo_PaveFiller_HeaderFile
21 #include <Standard.hxx>
22 #include <Standard_DefineAlloc.hxx>
23 #include <Standard_Handle.hxx>
25 #include <BOPCol_ListOfShape.hxx>
26 #include <BOPDS_PDS.hxx>
27 #include <BOPDS_PIterator.hxx>
28 #include <BOPAlgo_SectionAttribute.hxx>
29 #include <Standard_Real.hxx>
30 #include <BOPAlgo_Algo.hxx>
31 #include <BOPCol_BaseAllocator.hxx>
32 #include <TopAbs_ShapeEnum.hxx>
33 #include <Standard_Integer.hxx>
34 #include <BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx>
35 #include <Standard_Boolean.hxx>
36 #include <BOPCol_MapOfInteger.hxx>
37 #include <BOPCol_DataMapOfIntegerReal.hxx>
38 #include <BOPCol_ListOfInteger.hxx>
39 #include <BOPDS_IndexedMapOfPaveBlock.hxx>
40 #include <BOPCol_DataMapOfShapeInteger.hxx>
41 #include <BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx>
42 #include <BOPCol_DataMapOfIntegerInteger.hxx>
43 #include <BOPDS_ListOfPaveBlock.hxx>
44 #include <IntSurf_ListOfPntOn2S.hxx>
45 #include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
46 #include <BOPDS_MapOfPaveBlock.hxx>
47 #include <BOPCol_IndexedDataMapOfShapeInteger.hxx>
48 #include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
49 class IntTools_Context;
51 class BOPAlgo_SectionAttribute;
52 class BOPDS_PaveBlock;
60 class BOPAlgo_PaveFiller : public BOPAlgo_Algo
67 Standard_EXPORT BOPAlgo_PaveFiller();
68 Standard_EXPORT virtual ~BOPAlgo_PaveFiller();
70 Standard_EXPORT BOPAlgo_PaveFiller(const BOPCol_BaseAllocator& theAllocator);
72 Standard_EXPORT const BOPDS_DS& DS();
74 Standard_EXPORT BOPDS_PDS PDS();
76 Standard_EXPORT const BOPDS_PIterator& Iterator();
78 Standard_EXPORT void SetArguments (const BOPCol_ListOfShape& theLS);
80 Standard_EXPORT const BOPCol_ListOfShape& Arguments() const;
82 Standard_EXPORT Handle(IntTools_Context) Context();
84 Standard_EXPORT void SetSectionAttribute (const BOPAlgo_SectionAttribute& theSecAttr);
86 Standard_EXPORT virtual void Perform() Standard_OVERRIDE;
88 //! Sets the additional tolerance
89 Standard_EXPORT void SetFuzzyValue (const Standard_Real theFuzz);
91 //! Returns the additional tolerance
92 Standard_EXPORT Standard_Real FuzzyValue() const;
100 Standard_EXPORT virtual void PerformInternal();
102 Standard_EXPORT virtual void Clear();
104 Standard_EXPORT virtual void Init();
106 Standard_EXPORT void Prepare();
108 Standard_EXPORT virtual void PerformVV();
110 Standard_EXPORT virtual void PerformVE();
112 Standard_EXPORT virtual void PerformVF();
114 Standard_EXPORT virtual void PerformEE();
116 Standard_EXPORT virtual void PerformEF();
118 Standard_EXPORT virtual void PerformFF();
120 Standard_EXPORT virtual void PerformVZ();
122 Standard_EXPORT virtual void PerformEZ();
124 Standard_EXPORT virtual void PerformFZ();
126 Standard_EXPORT virtual void PerformZZ();
128 Standard_EXPORT virtual void PerformSZ(const TopAbs_ShapeEnum aTS);
130 Standard_EXPORT void TreatVerticesEE();
132 Standard_EXPORT void MakeSplitEdges();
134 Standard_EXPORT void MakeBlocks();
136 Standard_EXPORT void MakePCurves();
138 Standard_EXPORT void ProcessDE();
140 Standard_EXPORT void FillShrunkData (Handle(BOPDS_PaveBlock)& thePB);
142 Standard_EXPORT void FillShrunkData (const TopAbs_ShapeEnum theType1, const TopAbs_ShapeEnum theType2);
144 Standard_EXPORT Standard_Integer PerformVerticesEE (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, const BOPCol_BaseAllocator& theAllocator);
146 Standard_EXPORT Standard_Integer PerformVerticesEF (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, const BOPCol_BaseAllocator& theAllocator);
148 Standard_EXPORT Standard_Boolean CheckFacePaves (const TopoDS_Vertex& theVnew, const BOPCol_MapOfInteger& theMIF);
150 Standard_EXPORT static Standard_Boolean CheckFacePaves (const Standard_Integer theN, const BOPCol_MapOfInteger& theMIFOn, const BOPCol_MapOfInteger& theMIFIn);
152 Standard_EXPORT Standard_Boolean IsExistingVertex (const gp_Pnt& theP, const Standard_Real theTol, const BOPCol_MapOfInteger& theMVOn) const;
155 //! Checks and puts paves from <theMVOn> on the curve <theNC>.
156 Standard_EXPORT void PutPavesOnCurve (const BOPCol_MapOfInteger& theMVOn, const Standard_Real theTolR3D, BOPDS_Curve& theNC, const Standard_Integer nF1, const Standard_Integer nF2, const BOPCol_MapOfInteger& theMI, const BOPCol_MapOfInteger& theMVEF, BOPCol_DataMapOfIntegerReal& theMVTol);
159 //! Depending on the parameter aType it checks whether
160 //! the vertex nV was created in EE or EF intersections.
161 //! If so, it increases aTolVExt from tolerance value of vertex to
162 //! the max distance from vertex nV to the ends of the range of common part.
163 //! Possible values of aType:
164 //! 1 - checks only EE;
165 //! 2 - checks only EF;
166 //! other - checks both types of intersections.
167 Standard_EXPORT Standard_Boolean ExtendedTolerance (const Standard_Integer nV, const BOPCol_MapOfInteger& aMI, Standard_Real& aTolVExt, const Standard_Integer aType = 0);
169 Standard_EXPORT void PutBoundPaveOnCurve (const TopoDS_Face& theF1, const TopoDS_Face& theF2, const Standard_Real theTolR3D, BOPDS_Curve& theNC, BOPCol_ListOfInteger& theLBV);
171 Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const Standard_Real theTolR3D, const BOPDS_IndexedMapOfPaveBlock& theMPB, Handle(BOPDS_PaveBlock)& thePBOut);
173 Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const Standard_Real theTolR3D, const BOPCol_ListOfInteger& theLSE);
176 //! Treatment of section edges.
177 Standard_EXPORT Standard_Integer PostTreatFF (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, BOPCol_DataMapOfShapeInteger& theMVI, BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDMExEdges, BOPCol_DataMapOfIntegerInteger& theDMI, const BOPCol_BaseAllocator& theAllocator);
179 Standard_EXPORT void FindPaveBlocks (const Standard_Integer theV, const Standard_Integer theF, BOPDS_ListOfPaveBlock& theLPB);
181 Standard_EXPORT void FillPaves (const Standard_Integer theV, const Standard_Integer theE, const Standard_Integer theF, const BOPDS_ListOfPaveBlock& theLPB, const Handle(BOPDS_PaveBlock)& thePB);
183 Standard_EXPORT void MakeSplitEdge (const Standard_Integer theV, const Standard_Integer theF);
185 Standard_EXPORT void GetEFPnts (const Standard_Integer nF1, const Standard_Integer nF2, IntSurf_ListOfPntOn2S& aListOfPnts);
188 //! Checks and puts paves created in EF intersections on the curve <theNC>.
189 Standard_EXPORT void PutEFPavesOnCurve (BOPDS_Curve& theNC, const BOPCol_MapOfInteger& theMI, const BOPCol_MapOfInteger& theMVEF, BOPCol_DataMapOfIntegerReal& theMVTol);
192 //! Puts stick paves on the curve <theNC>
193 Standard_EXPORT void PutStickPavesOnCurve (const TopoDS_Face& aF1, const TopoDS_Face& aF2, const BOPCol_MapOfInteger& theMI, BOPDS_Curve& theNC, const BOPCol_MapOfInteger& theMVStick, BOPCol_DataMapOfIntegerReal& theMVTol);
196 //! Collects indices of vertices created in all intersections between
197 //! two faces (<nF1> and <nF2>) to the map <theMVStick>.
198 //! Also, it collects indices of EF vertices to the <theMVEF> map
199 //! and indices of all subshapes of these two faces to the <theMI> map.
200 Standard_EXPORT void GetStickVertices (const Standard_Integer nF1, const Standard_Integer nF2, BOPCol_MapOfInteger& theMVStick, BOPCol_MapOfInteger& theMVEF, BOPCol_MapOfInteger& theMI);
203 //! Collects index nF and indices of all subshapes of the shape with index <nF>
204 //! to the map <theMI>.
205 Standard_EXPORT void GetFullShapeMap (const Standard_Integer nF, BOPCol_MapOfInteger& theMI);
208 //! Removes indices of vertices that are already on the
209 //! curve <theNC> from the map <theMV>.
210 //! It is used in PutEFPavesOnCurve and PutStickPavesOnCurve methods.
211 Standard_EXPORT void RemoveUsedVertices (BOPDS_Curve& theNC, BOPCol_MapOfInteger& theMV);
214 //! Puts the pave nV on the curve theNC.
215 //! Parameter aType defines whether to check the pave with
216 //! extended tolerance:
217 //! 0 - do not perform the check;
218 //! other - perform the check (aType goes to ExtendedTolerance).
219 Standard_EXPORT void PutPaveOnCurve (const Standard_Integer nV, const Standard_Real theTolR3D, BOPDS_Curve& theNC, const BOPCol_MapOfInteger& theMI, BOPCol_DataMapOfIntegerReal& theMVTol, const Standard_Integer aType = 0);
222 //! Adds the existing edges from the map <theMPBOnIn> which interfere
223 //! with the vertices from <theMVB> map to the post treatment of section edges.
224 Standard_EXPORT void ProcessExistingPaveBlocks (const Standard_Integer theInt, const BOPDS_IndexedMapOfPaveBlock& theMPBOnIn, const BOPCol_DataMapOfIntegerListOfInteger& theDMBV, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, BOPCol_DataMapOfShapeInteger& theMVI, BOPDS_MapOfPaveBlock& theMPB);
227 //! Replaces existing pave block <thePB> with new pave blocks <theLPB>.
228 //! The list <theLPB> contains images of <thePB> which were created in
229 //! the post treatment of section edges.
230 Standard_EXPORT void UpdateExistingPaveBlocks (const Handle(BOPDS_PaveBlock)& thePB, BOPDS_ListOfPaveBlock& theLPB, const Standard_Integer nF1, const Standard_Integer nF2);
233 //! Treatment of vertices that were created in EE intersections.
234 Standard_EXPORT void TreatNewVertices (const BOPCol_IndexedDataMapOfShapeInteger& theMVI, BOPCol_IndexedDataMapOfShapeListOfShape& theImages);
237 //! Put paves on the curve <aBC> in case when <aBC>
238 //! is closed 3D-curve
239 Standard_EXPORT void PutClosingPaveOnCurve (BOPDS_Curve& aNC);
242 //! Keeps data for post treatment
243 Standard_EXPORT void PreparePostTreatFF (const Standard_Integer aInt, const Standard_Integer aCur, const Handle(BOPDS_PaveBlock)& aPB, BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB, BOPCol_DataMapOfShapeInteger& aMVI, BOPDS_ListOfPaveBlock& aLPB);
246 //! Refines the state On for the all faces having
247 //! state information
248 Standard_EXPORT void RefineFaceInfoOn();
251 //! Updates the information about faces
252 Standard_EXPORT void UpdateFaceInfo (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME, const BOPCol_DataMapOfIntegerInteger& theDMV);
255 //! Updates tolerance of vertex with index <nV>
256 //! to make it interfere with edge
257 Standard_EXPORT void ForceInterfVE (const Standard_Integer nV, Handle(BOPDS_PaveBlock)& aPB, BOPDS_MapOfPaveBlock& aMPB);
260 //! Updates tolerance of vertex with index <nV>
261 //! to make it interfere with face with index <nF>
262 Standard_EXPORT Standard_Boolean ForceInterfVF (const Standard_Integer nV, const Standard_Integer nF);
265 //! Checks if there are any common or intersecting sub shapes
266 //! between two planar faces.
267 Standard_EXPORT Standard_Boolean CheckPlanes (const Standard_Integer nF1, const Standard_Integer nF2) const;
270 //! Creates new edge from the edge nE with vertices nV1 and nV2
271 //! and returns the index of that new edge in the DS.
272 Standard_EXPORT Standard_Integer SplitEdge (const Standard_Integer nE, const Standard_Integer nV1, const Standard_Real aT1, const Standard_Integer nV2, const Standard_Real aT2);
275 //! Updates pave blocks which have the paves with indices contained
276 //! in the map <theDMI>.
277 Standard_EXPORT void UpdatePaveBlocks (const BOPCol_DataMapOfIntegerInteger& theDMI);
280 BOPCol_ListOfShape myArguments;
282 BOPDS_PIterator myIterator;
283 Handle(IntTools_Context) myContext;
284 BOPAlgo_SectionAttribute mySectionAttribute;
285 Standard_Real myFuzzyValue;
302 #endif // _BOPAlgo_PaveFiller_HeaderFile