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.
19 #include <Bnd_Box.hxx>
20 #include <BOPAlgo_PaveFiller.hxx>
21 #include <BOPAlgo_SectionAttribute.hxx>
22 #include <BOPAlgo_Tools.hxx>
23 #include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
24 #include <BOPCol_ListOfShape.hxx>
25 #include <BOPCol_MapOfInteger.hxx>
26 #include <BOPDS_Curve.hxx>
27 #include <BOPDS_DS.hxx>
28 #include <BOPDS_Iterator.hxx>
29 #include <BOPDS_PaveBlock.hxx>
30 #include <BOPDS_ShapeInfo.hxx>
31 #include <BOPDS_VectorOfInterfVV.hxx>
32 #include <BOPTools_AlgoTools.hxx>
33 #include <BRepBndLib.hxx>
35 #include <IntTools_Context.hxx>
36 #include <NCollection_BaseAllocator.hxx>
37 #include <NCollection_IncAllocator.hxx>
38 #include <TopoDS_Face.hxx>
39 #include <TopoDS_Vertex.hxx>
41 //=======================================================================
42 // function: PerformVV
44 //=======================================================================
45 void BOPAlgo_PaveFiller::PerformVV()
47 Standard_Boolean bWithSubShape;
48 Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, k, aNbBlocks;
49 Handle(NCollection_IncAllocator) aAllocator;
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.SetIncrement(aSize);
67 //-----------------------------------------------------scope f
68 aAllocator=new NCollection_IncAllocator();
69 BOPCol_IndexedDataMapOfIntegerListOfInteger aMILI(100, aAllocator);
70 BOPCol_DataMapOfIntegerListOfInteger aMBlocks(100, aAllocator);
71 BOPCol_ListOfShape aLV(aAllocator);
74 for (; myIterator->More(); myIterator->Next()) {
75 myIterator->Value(n1, n2, bWithSubShape);
77 const TopoDS_Vertex& aV1=(*(TopoDS_Vertex *)(&myDS->Shape(n1)));
78 const TopoDS_Vertex& aV2=(*(TopoDS_Vertex *)(&myDS->Shape(n2)));
80 iFlag=BOPTools_AlgoTools::ComputeVV(aV1, aV2);
82 BOPAlgo_Tools::FillMap(n1, n2, aMILI, aAllocator);
87 BOPAlgo_Tools::MakeBlocksCnx(aMILI, aMBlocks, aAllocator);
90 aNbBlocks=aMBlocks.Extent();
91 for (k=0; k<aNbBlocks; ++k) {
92 const BOPCol_ListOfInteger& aLI=aMBlocks.Find(k);
95 aItLI.Initialize(aLI);
96 for (; aItLI.More(); aItLI.Next()) {
98 const TopoDS_Shape& aV=myDS->Shape(nX);
102 BOPTools_AlgoTools::MakeVertex(aLV, aVn);
104 // Appennd new vertex to the DS
106 n=myDS->Append(aSIn);
108 BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(n);
109 Bnd_Box& aBox=aSIDS.ChangeBox();
110 BRepBndLib::Add(aVn, aBox);
113 aItLI.Initialize(aLI);
114 for (i=0; aItLI.More(); aItLI.Next(), ++i) {
116 myDS->AddShapeSD(n1, n);
118 aItLI2.Initialize(aLI);
119 for (j=0; aItLI2.More(); aItLI2.Next(), ++j) {
123 myDS->AddInterf(n1, n2);
124 BOPDS_InterfVV& aVV=aVVs.Append1();
126 aVV.SetIndices(n1, n2);
133 //-----------------------------------------------------scope t
137 aAllocator.Nullify();