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 #include <BOPAlgo_PaveFiller.ixx>
20 #include <NCollection_IncAllocator.hxx>
21 #include <NCollection_BaseAllocator.hxx>
23 #include <Bnd_Box.hxx>
25 #include <TopoDS_Vertex.hxx>
26 #include <BRepBndLib.hxx>
28 #include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
29 #include <BOPCol_MapOfInteger.hxx>
30 #include <BOPCol_ListOfShape.hxx>
32 #include <BOPDS_DS.hxx>
33 #include <BOPDS_Iterator.hxx>
34 #include <BOPTools_AlgoTools.hxx>
35 #include <BOPDS_VectorOfInterfVV.hxx>
36 #include <BOPDS_ShapeInfo.hxx>
37 #include <BOPAlgo_Tools.hxx>
40 //=======================================================================
41 // function: PerformVV
43 //=======================================================================
44 void BOPAlgo_PaveFiller::PerformVV()
46 Standard_Boolean bWithSubShape;
47 Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, iX, k, aNbBlocks;
48 Handle(NCollection_IncAllocator) aAllocator;
49 BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItMILI;
50 BOPCol_ListIteratorOfListOfInteger aItLI, aItLI2;
56 myIterator->Initialize(TopAbs_VERTEX, TopAbs_VERTEX);
57 aSize=myIterator->ExpectedLength();
62 aSIn.SetShapeType(TopAbs_VERTEX);
64 BOPDS_VectorOfInterfVV& aVVs=myDS->InterfVV();
65 aVVs.SetStartSize(aSize);
66 aVVs.SetIncrement(aSize);
69 //-----------------------------------------------------scope f
70 aAllocator=new NCollection_IncAllocator();
71 BOPCol_IndexedDataMapOfIntegerListOfInteger aMILI(100, aAllocator);
72 BOPCol_DataMapOfIntegerListOfInteger aMBlocks(100, aAllocator);
73 BOPCol_ListOfShape aLV(aAllocator);
76 for (; myIterator->More(); myIterator->Next()) {
77 myIterator->Value(n1, n2, bWithSubShape);
79 const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(n1)));
80 const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(n2)));
82 iFlag=BOPTools_AlgoTools::ComputeVV(aV1, aV2);
84 BOPAlgo_Tools::FillMap(n1, n2, aMILI, aAllocator);
89 BOPAlgo_Tools::MakeBlocksCnx(aMILI, aMBlocks, aAllocator);
92 aNbBlocks=aMBlocks.Extent();
93 for (k=0; k<aNbBlocks; ++k) {
94 const BOPCol_ListOfInteger& aLI=aMBlocks.Find(k);
97 aItLI.Initialize(aLI);
98 for (; aItLI.More(); aItLI.Next()) {
100 const TopoDS_Shape& aV=myDS->Shape(nX);
104 BOPTools_AlgoTools::MakeVertex(aLV, aVn);
106 // Appennd new vertex to the DS
108 n=myDS->Append(aSIn);
110 BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(n);
111 Bnd_Box& aBox=aSIDS.ChangeBox();
112 BRepBndLib::Add(aVn, aBox);
115 aItLI.Initialize(aLI);
116 for (i=0; aItLI.More(); aItLI.Next(), ++i) {
118 myDS->AddShapeSD(n1, n);
120 aItLI2.Initialize(aLI);
121 for (j=0; aItLI2.More(); aItLI2.Next(), ++j) {
125 myDS->AddInterf(n1, n2);
127 BOPDS_InterfVV& aVV=aVVs(iX);
128 aVV.SetIndices(n1, n2);
135 //-----------------------------------------------------scope t
139 aAllocator.Nullify();