1 // Created on: 2001-03-14
2 // Created by: Peter KURNEV
3 // Copyright (c) 2001-2012 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
22 #include <BOPTools_CommonBlockAPI.ixx>
24 #include <BOPTools_CommonBlock.hxx>
25 #include <BOPTools_PaveBlock.hxx>
26 #include <BOPTools_ListOfPaveBlock.hxx>
27 #include <BOPTools_ListOfCommonBlock.hxx>
28 #include <BOPTools_ListIteratorOfListOfCommonBlock.hxx>
29 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
32 //=======================================================================
33 // function: BOPTools_CommonBlockAPI::BOPTools_CommonBlockAPI
35 //=======================================================================
36 BOPTools_CommonBlockAPI::BOPTools_CommonBlockAPI
37 (const BOPTools_ListOfCommonBlock& aLCB)
39 myListOfCommonBlock=(void *)&aLCB;
41 //=======================================================================
44 //=======================================================================
45 const BOPTools_ListOfCommonBlock& BOPTools_CommonBlockAPI::List () const
47 BOPTools_ListOfCommonBlock* pListOfCommonBlock=
48 (BOPTools_ListOfCommonBlock*)myListOfCommonBlock;
49 return *pListOfCommonBlock;
51 //=======================================================================
52 // function: CommonPaveBlocks
53 // purpose: get all CommonPaveBlocks
54 //=======================================================================
55 const BOPTools_ListOfPaveBlock&
56 BOPTools_CommonBlockAPI::CommonPaveBlocks
57 (const Standard_Integer anE) const
59 Standard_Integer anECurrent, i;
61 BOPTools_ListOfPaveBlock* pmyListOfPaveBlock=
62 (BOPTools_ListOfPaveBlock*) &myListOfPaveBlock;
63 pmyListOfPaveBlock->Clear();
65 BOPTools_ListOfCommonBlock* pListOfCommonBlock=
66 (BOPTools_ListOfCommonBlock*)myListOfCommonBlock;
68 BOPTools_ListIteratorOfListOfCommonBlock anIt(*pListOfCommonBlock);
69 for (; anIt.More(); anIt.Next()) {
70 const BOPTools_CommonBlock& aCB=anIt.Value();
73 const BOPTools_PaveBlock& aPB=(!i) ? aCB.PaveBlock1() : aCB.PaveBlock2();
74 anECurrent=aPB.OriginalEdge();
75 if (anECurrent==anE) {
76 pmyListOfPaveBlock->Append(aPB);
82 return myListOfPaveBlock;
84 //=======================================================================
85 // function: IsCommonBlock
87 //=======================================================================
88 Standard_Boolean BOPTools_CommonBlockAPI::IsCommonBlock
89 (const BOPTools_PaveBlock& aPB) const
93 anE=aPB.OriginalEdge();
95 CommonPaveBlocks(anE);
97 BOPTools_ListIteratorOfListOfPaveBlock anIt(myListOfPaveBlock);
98 for (; anIt.More(); anIt.Next()) {
99 const BOPTools_PaveBlock& aPB1=anIt.Value();
100 if (aPB1.IsEqual(aPB)) {
101 return Standard_True;
104 return Standard_False;