1 // Created by: Peter KURNEV
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <Bnd_Box.hxx>
17 #include <BOPAlgo_PaveFiller.hxx>
18 #include <BOPAlgo_SectionAttribute.hxx>
19 #include <BOPCol_MapOfInteger.hxx>
20 #include <BOPCol_NCVector.hxx>
21 #include <BOPCol_Parallel.hxx>
22 #include <BOPDS_Curve.hxx>
23 #include <BOPDS_DS.hxx>
24 #include <BOPDS_Iterator.hxx>
25 #include <BOPDS_ListOfPaveBlock.hxx>
26 #include <BOPDS_PaveBlock.hxx>
27 #include <BOPDS_ShapeInfo.hxx>
29 #include <IntTools_Context.hxx>
30 #include <IntTools_ShrunkRange.hxx>
31 #include <TopoDS_Edge.hxx>
32 #include <TopoDS_Face.hxx>
33 #include <TopoDS_Vertex.hxx>
36 //=======================================================================
37 //class : BOPAlgo_ShrunkRange
39 //=======================================================================
40 class BOPAlgo_ShrunkRange : public IntTools_ShrunkRange {
43 : IntTools_ShrunkRange() {
46 virtual ~BOPAlgo_ShrunkRange() {
49 void SetPaveBlock(const Handle(BOPDS_PaveBlock)& aPB) {
53 Handle(BOPDS_PaveBlock)& PaveBlock() {
57 virtual void Perform() {
58 IntTools_ShrunkRange::Perform();
62 Handle(BOPDS_PaveBlock) myPB;
65 //=======================================================================
66 typedef BOPCol_NCVector
67 <BOPAlgo_ShrunkRange> BOPAlgo_VectorOfShrunkRange;
69 typedef BOPCol_ContextFunctor
71 BOPAlgo_VectorOfShrunkRange,
72 Handle(IntTools_Context),
73 IntTools_Context> BOPAlgo_ShrunkRangeFunctor;
75 typedef BOPCol_ContextCnt
76 <BOPAlgo_ShrunkRangeFunctor,
77 BOPAlgo_VectorOfShrunkRange,
78 Handle(IntTools_Context)> BOPAlgo_ShrunkRangeCnt;
80 //=======================================================================
81 // function: FillShrunkData
83 //=======================================================================
84 void BOPAlgo_PaveFiller::FillShrunkData(const TopAbs_ShapeEnum aType1,
85 const TopAbs_ShapeEnum aType2)
87 myIterator->Initialize(aType1, aType2);
88 Standard_Integer iSize = myIterator->ExpectedLength();
93 Standard_Integer i, nS[2], nE, nV1, nV2, aNbVSD, k;
94 Standard_Real aT1, aT2;
95 BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
96 BOPCol_MapOfInteger aMI;
97 BOPAlgo_VectorOfShrunkRange aVSD;
98 TopAbs_ShapeEnum aType[2] = { aType1, aType2 };
100 for (; myIterator->More(); myIterator->Next()) {
101 myIterator->Value(nS[0], nS[1]);
103 for (i=0; i < 2; ++i) {
105 if (aType[i] != TopAbs_EDGE || !aMI.Add(nE)) {
109 const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
114 BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
115 aItLPB.Initialize(aLPB);
116 for (; aItLPB.More(); aItLPB.Next()) {
117 const Handle(BOPDS_PaveBlock)& aPB=aItLPB.ChangeValue();
118 if (aPB->HasShrunkData() && myDS->IsValidShrunkData(aPB)) {
122 // FillShrunkData(aPB);
123 aPB->Indices(nV1, nV2);
124 aPB->Range(aT1, aT2);
126 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
128 const TopoDS_Vertex& aV1=
129 (*(TopoDS_Vertex *)(&myDS->Shape(nV1)));
131 const TopoDS_Vertex& aV2=
132 (*(TopoDS_Vertex *)(&myDS->Shape(nV2)));
134 BOPAlgo_ShrunkRange& aSD=aVSD.Append1();
136 aSD.SetPaveBlock(aPB);
137 aSD.SetData(aE, aT1, aT2, aV1, aV2);
142 aNbVSD=aVSD.Extent();
143 //=============================================================
144 BOPAlgo_ShrunkRangeCnt::Perform(myRunParallel, aVSD, myContext);
145 //=============================================================
147 for (k=0; k < aNbVSD; ++k) {
148 BOPAlgo_ShrunkRange& aSD = aVSD(k);
149 AnalyzeShrunkData(aSD.PaveBlock(), aSD);