1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _BOPDS_PaveBlock_HeaderFile
16 #define _BOPDS_PaveBlock_HeaderFile
18 #include <Standard.hxx>
19 #include <Standard_Type.hxx>
21 #include <BOPCol_BaseAllocator.hxx>
22 #include <Standard_Integer.hxx>
23 #include <BOPDS_Pave.hxx>
24 #include <BOPDS_ListOfPave.hxx>
25 #include <Standard_Real.hxx>
26 #include <Bnd_Box.hxx>
27 #include <BOPCol_MapOfInteger.hxx>
28 #include <MMgt_TShared.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <BOPDS_ListOfPaveBlock.hxx>
35 class BOPDS_PaveBlock;
36 DEFINE_STANDARD_HANDLE(BOPDS_PaveBlock, MMgt_TShared)
39 //! The class BOPDS_PaveBlock is to store
40 //! the information about pave block on an edge.
41 //! Two adjacent paves on edge make up pave block.
42 class BOPDS_PaveBlock : public MMgt_TShared
50 Standard_EXPORT BOPDS_PaveBlock();
54 //! <theAllocator> - the allocator to manage the memory
55 Standard_EXPORT BOPDS_PaveBlock(const BOPCol_BaseAllocator& theAllocator);
59 //! Sets the first pave <thePave>
60 Standard_EXPORT void SetPave1 (const BOPDS_Pave& thePave);
64 //! Returns the first pave
65 Standard_EXPORT const BOPDS_Pave& Pave1() const;
69 //! Sets the second pave <thePave>
70 Standard_EXPORT void SetPave2 (const BOPDS_Pave& thePave);
74 //! Returns the second pave
75 Standard_EXPORT const BOPDS_Pave& Pave2() const;
79 //! Sets the index of edge of pave block <theEdge>
80 Standard_EXPORT void SetEdge (const Standard_Integer theEdge);
84 //! Returns the index of edge of pave block
85 Standard_EXPORT Standard_Integer Edge() const;
89 //! Returns true if the pave block has edge
90 Standard_EXPORT Standard_Boolean HasEdge() const;
94 //! Returns true if the pave block has edge
95 //! Returns the index of edge <theEdge>
96 Standard_EXPORT Standard_Boolean HasEdge (Standard_Integer& theEdge) const;
100 //! Sets the index of original edge
101 //! of the pave block <theEdge>
102 Standard_EXPORT void SetOriginalEdge (const Standard_Integer theEdge);
106 //! Returns the index of original edge of pave block
107 Standard_EXPORT Standard_Integer OriginalEdge() const;
111 //! Returns true if the edge is equal to the original edge
112 //! of the pave block
113 Standard_EXPORT Standard_Boolean IsSplitEdge() const;
117 //! Returns the parametric range <theT1,theT2>
118 //! of the pave block
119 Standard_EXPORT void Range (Standard_Real& theT1, Standard_Real& theT2) const;
123 //! Returns true if the pave block has pave indices
124 //! that equal to the pave indices of the pave block
126 Standard_EXPORT Standard_Boolean HasSameBounds (const Handle(BOPDS_PaveBlock)& theOther) const;
130 //! Returns the pave indices <theIndex1,theIndex2>
131 //! of the pave block
132 Standard_EXPORT void Indices (Standard_Integer& theIndex1,
133 Standard_Integer& theIndex2) const;
137 //! Returns true if the pave block contains extra paves
138 Standard_EXPORT Standard_Boolean IsToUpdate() const;
142 //! Appends extra paves <theLP>
143 Standard_EXPORT void AppendExtPave (const BOPDS_Pave& theLP);
147 //! Appends extra pave <thePave>
148 Standard_EXPORT void AppendExtPave1 (const BOPDS_Pave& thePave);
152 //! Returns the extra paves
153 Standard_EXPORT const BOPDS_ListOfPave& ExtPaves() const;
156 //! Selector / Modifier
157 //! Returns the extra paves
158 Standard_EXPORT BOPDS_ListOfPave& ChangeExtPaves();
162 //! Updates the pave block. The extra paves are used
163 //! to create new pave blocks <theLPB>.
164 //! <theFlag> - if true, the first pave and the second
165 //! pave are used to produce new pave blocks.
166 Standard_EXPORT void Update (BOPDS_ListOfPaveBlock& theLPB,
167 const Standard_Boolean theFlag = Standard_True);
171 //! Returns true if the extra paves contain the pave
172 //! with given value of the parameter <thePrm>
173 //! <theTol> - the value of the tolerance to compare
174 //! <theInd> - index of the found pave
175 Standard_EXPORT Standard_Boolean ContainsParameter (const Standard_Real thePrm,
176 const Standard_Real theTol,
177 Standard_Integer& theInd) const;
181 //! Sets the shrunk data for the pave block
182 //! <theTS1>, <theTS2> - shrunk range
183 //! <theBox> - the bounding box
184 //! <theIsSplittable> - defines whether the edge can be split
185 Standard_EXPORT void SetShrunkData (const Standard_Real theTS1,
186 const Standard_Real theTS2,
187 const Bnd_Box& theBox,
188 const Standard_Boolean theIsSplittable);
192 //! Returns the shrunk data for the pave block
193 //! <theTS1>, <theTS2> - shrunk range
194 //! <theBox> - the bounding box
195 //! <theIsSplittable> - defines whether the edge can be split
196 Standard_EXPORT void ShrunkData (Standard_Real& theTS1,
197 Standard_Real& theTS2,
199 Standard_Boolean& theIsSplittable) const;
203 //! Returns true if the pave block contains
205 Standard_EXPORT Standard_Boolean HasShrunkData() const;
207 Standard_EXPORT void Dump() const;
210 //! Returns FALSE if the pave block has a too short
211 //! shrunk range and cannot be split, otherwise returns TRUE
212 Standard_Boolean IsSplittable() const
214 return myIsSplittable;
219 DEFINE_STANDARD_RTTIEXT(BOPDS_PaveBlock,MMgt_TShared)
224 BOPCol_BaseAllocator myAllocator;
225 Standard_Integer myEdge;
226 Standard_Integer myOriginalEdge;
229 BOPDS_ListOfPave myExtPaves;
233 BOPCol_MapOfInteger myMFence;
234 Standard_Boolean myIsSplittable;
249 #endif // _BOPDS_PaveBlock_HeaderFile