42cf5bc1 |
1 | // Created by: Peter KURNEV |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
3 | // |
4 | // This file is part of Open CASCADE Technology software library. |
5 | // |
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. |
11 | // |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
14 | |
15 | #ifndef _BOPDS_CommonBlock_HeaderFile |
16 | #define _BOPDS_CommonBlock_HeaderFile |
17 | |
18 | #include <Standard.hxx> |
19 | #include <Standard_Type.hxx> |
20 | |
21 | #include <BOPDS_ListOfPaveBlock.hxx> |
1155d05a |
22 | #include <NCollection_BaseAllocator.hxx> |
1155d05a |
23 | #include <Standard_Integer.hxx> |
24 | #include <Standard_Transient.hxx> |
25 | #include <TColStd_ListOfInteger.hxx> |
42cf5bc1 |
26 | class BOPDS_PaveBlock; |
27 | |
28 | |
29 | class BOPDS_CommonBlock; |
25e59720 |
30 | DEFINE_STANDARD_HANDLE(BOPDS_CommonBlock, Standard_Transient) |
42cf5bc1 |
31 | |
32 | |
edfa30de |
33 | //! The class BOPDS_CommonBlock is to store the information |
34 | //! about pave blocks that have geometrical coincidence |
35 | //! (in terms of a tolerance) with:<br> |
36 | //! a) other pave block(s);<br> |
37 | //! b) face(s).<br> |
38 | //! First pave block in the common block (real pave block) |
39 | //! is always a pave block with the minimal index of the original edge. |
25e59720 |
40 | class BOPDS_CommonBlock : public Standard_Transient |
42cf5bc1 |
41 | { |
42 | |
43 | public: |
44 | |
45 | |
46 | |
b81b237f |
47 | //! Empty constructor |
42cf5bc1 |
48 | Standard_EXPORT BOPDS_CommonBlock(); |
49 | |
50 | |
b81b237f |
51 | //! Constructor |
52 | //! @param theAllocator the allocator to manage the memory |
1155d05a |
53 | Standard_EXPORT BOPDS_CommonBlock(const Handle(NCollection_BaseAllocator)& theAllocator); |
42cf5bc1 |
54 | |
55 | |
56 | //! Modifier |
57 | //! Adds the pave block <aPB> to the list of pave blocks |
58 | //! of the common block |
59 | Standard_EXPORT void AddPaveBlock (const Handle(BOPDS_PaveBlock)& aPB); |
60 | |
61 | |
62 | //! Modifier |
d3578357 |
63 | //! Sets the list of pave blocks for the common block |
edfa30de |
64 | Standard_EXPORT void SetPaveBlocks (const BOPDS_ListOfPaveBlock& aLPB); |
42cf5bc1 |
65 | |
66 | |
67 | //! Modifier |
68 | //! Adds the index of the face <aF> |
69 | //! to the list of indices of faces |
70 | //! of the common block |
71 | Standard_EXPORT void AddFace (const Standard_Integer aF); |
72 | |
73 | |
74 | //! Modifier |
3510db62 |
75 | //! Sets the list of indices of faces <aLF> |
42cf5bc1 |
76 | //! of the common block |
1155d05a |
77 | Standard_EXPORT void SetFaces (const TColStd_ListOfInteger& aLF); |
3510db62 |
78 | |
79 | //! Modifier |
80 | //! Appends the list of indices of faces <aLF> |
81 | //! to the list of indices of faces |
82 | //! of the common block (the input list is emptied) |
1155d05a |
83 | Standard_EXPORT void AppendFaces(TColStd_ListOfInteger& aLF); |
3510db62 |
84 | |
42cf5bc1 |
85 | |
86 | //! Selector |
87 | //! Returns the list of pave blocks |
88 | //! of the common block |
89 | Standard_EXPORT const BOPDS_ListOfPaveBlock& PaveBlocks() const; |
90 | |
91 | |
92 | //! Selector |
93 | //! Returns the list of indices of faces |
94 | //! of the common block |
1155d05a |
95 | Standard_EXPORT const TColStd_ListOfInteger& Faces() const; |
42cf5bc1 |
96 | |
97 | |
98 | //! Selector |
99 | //! Returns the first pave block |
100 | //! of the common block |
101 | Standard_EXPORT const Handle(BOPDS_PaveBlock)& PaveBlock1() const; |
102 | |
103 | |
104 | //! Selector |
105 | //! Returns the pave block that belongs |
106 | //! to the edge with index <theIx> |
107 | Standard_EXPORT Handle(BOPDS_PaveBlock)& PaveBlockOnEdge (const Standard_Integer theIndex); |
108 | |
109 | |
110 | //! Query |
111 | //! Returns true if the common block contains |
112 | //! a pave block that belongs |
113 | //! to the face with index <theIx> |
114 | Standard_EXPORT Standard_Boolean IsPaveBlockOnFace (const Standard_Integer theIndex) const; |
115 | |
116 | |
117 | //! Query |
118 | //! Returns true if the common block contains |
119 | //! a pave block that belongs |
120 | //! to the edge with index <theIx> |
121 | Standard_EXPORT Standard_Boolean IsPaveBlockOnEdge (const Standard_Integer theIndex) const; |
122 | |
123 | |
124 | //! Query |
125 | //! Returns true if the common block contains |
126 | //! a pave block that is equal to <thePB> |
127 | Standard_EXPORT Standard_Boolean Contains (const Handle(BOPDS_PaveBlock)& thePB) const; |
128 | |
129 | |
130 | //! Query |
131 | //! Returns true if the common block contains |
132 | //! the face with index equal to <theF> |
133 | Standard_EXPORT Standard_Boolean Contains (const Standard_Integer theF) const; |
134 | |
135 | |
136 | //! Modifier |
137 | //! Assign the index <theEdge> as the edge index |
138 | //! to all pave blocks of the common block |
139 | Standard_EXPORT void SetEdge (const Standard_Integer theEdge); |
140 | |
141 | |
142 | //! Selector |
143 | //! Returns the index of the edge |
144 | //! of all pave blocks of the common block |
145 | Standard_EXPORT Standard_Integer Edge() const; |
146 | |
147 | Standard_EXPORT void Dump() const; |
148 | |
81a55a69 |
149 | //! Moves the pave blocks in the list to make the given |
150 | //! pave block to be the first. |
151 | //! It will be representative for the whole group. |
152 | Standard_EXPORT void SetRealPaveBlock(const Handle(BOPDS_PaveBlock)& thePB); |
42cf5bc1 |
153 | |
d3578357 |
154 | //! Sets the tolerance for the common block |
155 | void SetTolerance(const Standard_Real theTol) |
156 | { |
157 | myTolerance = theTol; |
158 | } |
159 | |
160 | //! Return the tolerance of common block |
161 | Standard_Real Tolerance() const |
162 | { |
163 | return myTolerance; |
164 | } |
42cf5bc1 |
165 | |
25e59720 |
166 | DEFINE_STANDARD_RTTIEXT(BOPDS_CommonBlock,Standard_Transient) |
42cf5bc1 |
167 | |
168 | protected: |
169 | |
d3578357 |
170 | BOPDS_ListOfPaveBlock myPaveBlocks; //!< Pave blocks of the common block |
171 | TColStd_ListOfInteger myFaces; //!< Faces on which the pave blocks are lying |
172 | Standard_Real myTolerance; //!< Tolerance of the common block |
42cf5bc1 |
173 | |
42cf5bc1 |
174 | private: |
175 | |
42cf5bc1 |
176 | }; |
177 | |
42cf5bc1 |
178 | #endif // _BOPDS_CommonBlock_HeaderFile |