0024624: Lost word in license statement in source files
[occt.git] / src / BOPAlgo / BOPAlgo_PaveFiller_2.cxx
CommitLineData
4e57c75e 1// Created by: Peter KURNEV
973c2be1 2// Copyright (c) 2010-2014 OPEN CASCADE SAS
4e57c75e 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
6//
973c2be1 7// This file is part of Open CASCADE Technology software library.
4e57c75e 8//
d5f74e42 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
973c2be1 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.
4e57c75e 14//
973c2be1 15// Alternatively, this file may be used under the terms of Open CASCADE
16// commercial license or contractual agreement.
4e57c75e 17
18#include <BOPAlgo_PaveFiller.ixx>
19
20#include <TopoDS_Vertex.hxx>
21#include <TopoDS_Edge.hxx>
22#include <BRep_Tool.hxx>
23
24#include <BOPInt_Context.hxx>
25
26#include <BOPDS_Iterator.hxx>
27#include <BOPDS_VectorOfInterfVE.hxx>
28#include <BOPDS_Interf.hxx>
29#include <BOPDS_PassKey.hxx>
30#include <BOPDS_MapOfPassKey.hxx>
31#include <BRepBndLib.hxx>
32#include <BRep_Builder.hxx>
33
34
35//=======================================================================
36// function: PerformVE
37// purpose:
38//=======================================================================
39 void BOPAlgo_PaveFiller::PerformVE()
40{
41 Standard_Boolean bJustAdd;
42 Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, i;
43 Standard_Real aT, aTolE, aTolV;
44 BOPDS_Pave aPave;
45 BOPDS_PassKey aPK;
46 BOPDS_MapOfPassKey aMPK;
47 BRep_Builder aBB;
48 //
49 myErrorStatus=0;
50 //
51 myIterator->Initialize(TopAbs_VERTEX, TopAbs_EDGE);
52 iSize=myIterator->ExpectedLength();
53 if (!iSize) {
54 return;
55 }
56 //
57 BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
58 aVEs.SetStartSize(iSize);
59 aVEs.SetIncrement(iSize);
60 aVEs.Init();
61 //
62 for (; myIterator->More(); myIterator->Next()) {
63 myIterator->Value(nV, nE, bJustAdd);
64 if(bJustAdd) {
65 continue;
66 }
67 //
68 const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
69 if (aSIE.HasSubShape(nV)) {
70 continue;
71 }
72 //
73 if (aSIE.HasFlag()){
74 continue;
75 }
76 //
77 if (myDS->HasInterfShapeSubShapes(nV, nE)) {
c1746a0a 78 myDS->ChangePaveBlocks(nE);
4e57c75e 79 continue;
80 }
81 //
82 nVx=nV;
83 if (myDS->HasShapeSD(nV, nVSD)) {
84 nVx=nVSD;
85 }
86 //
87 aPK.SetIds(nVx, nE);
88 if (!aMPK.Add(aPK)) {
89 continue;
90 }
91 //
92 const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
93 const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
94 //
95 iFlag=myContext->ComputeVE (aV, aE, aT);
96 if (!iFlag) {
97 // 1
98 i=aVEs.Append()-1;
99 BOPDS_InterfVE& aVE=aVEs(i);
100 aVE.SetIndices(nV, nE);
101 aVE.SetParameter(aT);
102 // 2
103 myDS->AddInterf(nV, nE);
104 // 3
105 BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
106 Handle(BOPDS_PaveBlock)& aPB=*((Handle_BOPDS_PaveBlock*)&aLPB.First());
107 //
108 aPave.SetIndex(nVx);
109 aPave.SetParameter(aT);
110 aPB->AppendExtPave(aPave);
111 aTolV = BRep_Tool::Tolerance(aV);
112 aTolE = BRep_Tool::Tolerance(aE);
113 if ( aTolV < aTolE) {
114 aBB.UpdateVertex(aV, aTolE);
115 BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVx);
116 Bnd_Box& aBoxDS=aSIDS.ChangeBox();
117 BRepBndLib::Add(aV, aBoxDS);
118 }
119 }
120 }//for (; myIterator->More(); myIterator->Next()) {
121}