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