geom/src/NMTTools/NMTTools_PaveFiller.cxx

296 lines
8.2 KiB
C++
Raw Normal View History

2005-12-05 21:23:52 +05:00
// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2005-12-05 21:23:52 +05:00
//
2004-12-01 15:39:14 +05:00
// File: NMTTools_PaveFiller.cxx
// Created: Fri Dec 5 14:58:54 2003
// Author: Peter KURNEV
// <pkv@irinox>
//
#include <NMTTools_PaveFiller.ixx>
//
#include <BOPTColStd_Failure.hxx>
#include <NMTDS_ShapesDataStructure.hxx>
#include <NMTTools_DEProcessor.hxx>
#include <NMTDS_Iterator.hxx>
#include <NMTDS_InterfPool.hxx>
2004-12-01 15:39:14 +05:00
//=======================================================================
// function: NMTTools_PaveFiller::NMTTools_PaveFiller
// purpose:
//=======================================================================
NMTTools_PaveFiller::NMTTools_PaveFiller()
{
myDS=NULL;
myDSIt=NULL;
2004-12-01 15:39:14 +05:00
myIsDone=Standard_False;
myNbSources=0;
myNbEdges=0;
myIP=NULL;
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: ~
2004-12-01 15:39:14 +05:00
// purpose:
//=======================================================================
NMTTools_PaveFiller::~NMTTools_PaveFiller()
2004-12-01 15:39:14 +05:00
{
Clear();
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: Clear
2004-12-01 15:39:14 +05:00
// purpose:
//=======================================================================
void NMTTools_PaveFiller::Clear()
2004-12-01 15:39:14 +05:00
{
if (myDSIt) {
delete myDSIt;
}
if (myDS) {
delete myDS;
}
myDSIt=NULL;
myDS=NULL;
if (myIP) {
delete myIP;
}
myIP=NULL;
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: SetCompositeShape
2004-12-01 15:39:14 +05:00
// purpose:
//=======================================================================
void NMTTools_PaveFiller::SetCompositeShape(const TopoDS_Shape& aS)
2004-12-01 15:39:14 +05:00
{
myCompositeShape=aS;
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: CompositeShape
2004-12-01 15:39:14 +05:00
// purpose:
//=======================================================================
const TopoDS_Shape& NMTTools_PaveFiller::CompositeShape()const
2004-12-01 15:39:14 +05:00
{
return myCompositeShape;
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: DS
2004-12-01 15:39:14 +05:00
// purpose:
//=======================================================================
NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS()
2004-12-01 15:39:14 +05:00
{
return myDS;
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: DSIt
2004-12-01 15:39:14 +05:00
// purpose:
//=======================================================================
NMTDS_PIterator NMTTools_PaveFiller::DSIt()
2004-12-01 15:39:14 +05:00
{
return myDSIt;
}
//=======================================================================
// function: IP
// purpose:
//=======================================================================
NMTDS_PInterfPool NMTTools_PaveFiller::IP()
{
return myIP;
}
//=======================================================================
// function:IsDone
// purpose:
//=======================================================================
Standard_Boolean NMTTools_PaveFiller::IsDone() const
{
return myIsDone;
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: Context
// purpose:
//=======================================================================
const IntTools_Context& NMTTools_PaveFiller::Context() const
{
return myContext;
}
//=======================================================================
// function: ChangeContext
// purpose:
//=======================================================================
IntTools_Context& NMTTools_PaveFiller::ChangeContext()
{
return myContext;
}
//=======================================================================
// function: PavePool
// purpose:
//=======================================================================
const BOPTools_PavePool& NMTTools_PaveFiller::PavePool() const
{
return myPavePool;
}
//=======================================================================
// function: ChangePavePool
// purpose:
//=======================================================================
BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePool()
{
return myPavePool;
}
//=======================================================================
// function: CommonBlockPool
// purpose:
//=======================================================================
const NMTTools_CommonBlockPool& NMTTools_PaveFiller::CommonBlockPool() const
{
return myCommonBlockPool;
}
//=======================================================================
// function: ChangeCommonBlockPool
// purpose:
//=======================================================================
NMTTools_CommonBlockPool& NMTTools_PaveFiller::ChangeCommonBlockPool()
{
return myCommonBlockPool;
}
//=======================================================================
// function: SplitShapesPool
// purpose:
//=======================================================================
const BOPTools_SplitShapesPool& NMTTools_PaveFiller::SplitShapesPool() const
{
return mySplitShapesPool;
}
//=======================================================================
// function: ChangeSplitShapesPool
// purpose:
//=======================================================================
BOPTools_SplitShapesPool& NMTTools_PaveFiller::ChangeSplitShapesPool()
{
return mySplitShapesPool;
}
//=======================================================================
// function: Init
// purpose:
//=======================================================================
void NMTTools_PaveFiller::Init()
{
myIsDone=Standard_False;
if (myCompositeShape.IsNull()) {
return;
}
//
Clear();
// 1.
myDS=new NMTDS_ShapesDataStructure;
myDS->SetCompositeShape(myCompositeShape);
myDS->Init();
//
// 2.
myDSIt=new NMTDS_Iterator;
myDSIt->SetDS(myDS);
myDSIt->Prepare();
//
// 3.
myNbSources=myDS->NumberOfShapesOfTheObject()+
myDS->NumberOfShapesOfTheTool();
myNbEdges=myDS->NbEdges();
//
// 4
myIP=new NMTDS_InterfPool;
2004-12-01 15:39:14 +05:00
}
2004-12-01 15:39:14 +05:00
//=======================================================================
// function: Perform
// purpose:
//=======================================================================
void NMTTools_PaveFiller::Perform()
{
myIsDone=Standard_False;
//
//----------------
2004-12-01 15:39:14 +05:00
try {
// 0.
// Modified Thu Sep 14 14:35:18 2006
// Contribution of Samtech www.samcef.com BEGIN
Init();
// Contribution of Samtech www.samcef.com END
2004-12-01 15:39:14 +05:00
//1.VV
//
2004-12-01 15:39:14 +05:00
PerformVV();
//
// 2.VE
myPavePool.Resize (myNbEdges);
PrepareEdges();
2004-12-01 15:39:14 +05:00
PerformVE();
//
// 3.VF
PerformVF();
//
// 4.EE
myCommonBlockPool.Resize (myNbEdges);
mySplitShapesPool.Resize (myNbEdges);
myPavePoolNew .Resize (myNbEdges);
2004-12-01 15:39:14 +05:00
PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
//
PerformEE();
//
RefinePavePool ();
//
myPavePoolNew.Destroy();
myPavePoolNew.Resize (myNbEdges);
//
// 5.EF
PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
PerformEF();
//
2004-12-01 15:39:14 +05:00
RefinePavePool();
//
myPavePoolNew.Destroy();
2004-12-01 15:39:14 +05:00
MakeSplitEdges();
2004-12-01 15:39:14 +05:00
UpdateCommonBlocks();
//
// 6. FF
PerformFF ();
//
2004-12-01 15:39:14 +05:00
MakeBlocks();
//
2004-12-01 15:39:14 +05:00
MakePCurves();
//
// 7.Postprocessing
UpdatePaveBlocks();
//
NMTTools_DEProcessor aDEP(*this);
aDEP.Do();
//
// Modified to treat Alone Vertices Thu Sep 14 14:35:18 2006
// Contribution of Samtech www.samcef.com BEGIN
MakeAloneVertices();
// Contribution of Samtech www.samcef.com END
//
myIsDone=Standard_True;
2004-12-01 15:39:14 +05:00
}
catch (BOPTColStd_Failure& ) {
2004-12-01 15:39:14 +05:00
}
}