geom/src/NMTTools/NMTTools_PaveFiller.cxx

304 lines
8.4 KiB
C++
Raw Normal View History

2013-04-01 18:25:01 +06:00
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
2009-02-13 17:16:39 +05:00
//
2012-08-09 13:58:02 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
2009-02-13 17:16:39 +05:00
//
2012-08-09 13:58:02 +06:00
// 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.
2009-02-13 17:16:39 +05:00
//
2012-08-09 13:58:02 +06:00
// 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.
2009-02-13 17:16:39 +05:00
//
2012-08-09 13:58:02 +06:00
// 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
2009-02-13 17:16:39 +05:00
//
2012-08-09 13:58:02 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2005-12-05 21:23:52 +05:00
//
2012-08-09 13:58:02 +06:00
// File: NMTTools_PaveFiller.cxx
// Created: Fri Dec 5 14:58:54 2003
// Author: Peter KURNEV
// <pkv@irinox>
2004-12-01 15:39:14 +05:00
//
2012-08-09 13:58:02 +06:00
#include <NMTTools_PaveFiller.hxx>
2004-12-01 15:39:14 +05:00
//
#include <BOPTColStd_Failure.hxx>
2012-08-09 13:58:02 +06:00
#include <IntTools_Context.hxx>
2004-12-01 15:39:14 +05:00
#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
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
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: ~
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
NMTTools_PaveFiller::~NMTTools_PaveFiller()
2004-12-01 15:39:14 +05:00
{
Clear();
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: Clear
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
void NMTTools_PaveFiller::Clear()
2004-12-01 15:39:14 +05:00
{
if (myDSIt) {
delete myDSIt;
2012-08-09 13:58:02 +06:00
}
if (myDS) {
delete myDS;
}
myDSIt=NULL;
myDS=NULL;
2012-08-09 13:58:02 +06:00
if (myIP) {
delete myIP;
}
myIP=NULL;
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: SetCompositeShape
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
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
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
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
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
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
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
NMTDS_PIterator NMTTools_PaveFiller::DSIt()
2004-12-01 15:39:14 +05:00
{
return myDSIt;
}
//=======================================================================
// function: IP
2012-08-09 13:58:02 +06:00
// purpose:
//=======================================================================
NMTDS_PInterfPool NMTTools_PaveFiller::IP()
{
return myIP;
}
//=======================================================================
// function:IsDone
2012-08-09 13:58:02 +06:00
// purpose:
//=======================================================================
Standard_Boolean NMTTools_PaveFiller::IsDone() const
{
return myIsDone;
2004-12-01 15:39:14 +05:00
}
//=======================================================================
// function: Context
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
2012-08-09 13:58:02 +06:00
const Handle(IntTools_Context)& NMTTools_PaveFiller::Context() const
2004-12-01 15:39:14 +05:00
{
return myContext;
}
//=======================================================================
// function: PavePool
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
const BOPTools_PavePool& NMTTools_PaveFiller::PavePool() const
{
return myPavePool;
}
//=======================================================================
// function: ChangePavePool
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePool()
{
return myPavePool;
}
//=======================================================================
2012-08-09 13:58:02 +06:00
// function: ChangePavePoolNew
// purpose:
//=======================================================================
BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePoolNew()
{
return myPavePoolNew;
}
//=======================================================================
2004-12-01 15:39:14 +05:00
// function: CommonBlockPool
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
const NMTTools_CommonBlockPool& NMTTools_PaveFiller::CommonBlockPool() const
{
return myCommonBlockPool;
}
//=======================================================================
// function: ChangeCommonBlockPool
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
NMTTools_CommonBlockPool& NMTTools_PaveFiller::ChangeCommonBlockPool()
{
return myCommonBlockPool;
}
//=======================================================================
// function: SplitShapesPool
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
const BOPTools_SplitShapesPool& NMTTools_PaveFiller::SplitShapesPool() const
{
return mySplitShapesPool;
}
//=======================================================================
// function: ChangeSplitShapesPool
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
BOPTools_SplitShapesPool& NMTTools_PaveFiller::ChangeSplitShapesPool()
{
return mySplitShapesPool;
}
//=======================================================================
// function: Init
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
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;
2012-08-09 13:58:02 +06:00
//
// 5
myContext=new IntTools_Context;
2004-12-01 15:39:14 +05:00
}
2004-12-01 15:39:14 +05:00
//=======================================================================
// function: Perform
2012-08-09 13:58:02 +06:00
// purpose:
2004-12-01 15:39:14 +05:00
//=======================================================================
void NMTTools_PaveFiller::Perform()
{
myIsDone=Standard_False;
//
//----------------
2004-12-01 15:39:14 +05:00
try {
// 0.
Init();
2004-12-01 15:39:14 +05:00
//1.VV
//
2004-12-01 15:39:14 +05:00
PerformVV();
//
// 2.VE
myPavePool.Resize (myNbEdges);
2012-08-09 13:58:02 +06:00
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);
//
2012-08-09 13:58:02 +06:00
//modified by NIZNHY-PKV Mon Dec 12 09:13:53 2011f
UpdateCommonBlocks(0);
//modified by NIZNHY-PKV Mon Dec 12 09:13:56 2011t
//
2004-12-01 15:39:14 +05:00
// 5.EF
PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
PerformEF();
//
2004-12-01 15:39:14 +05:00
RefinePavePool();
//
myPavePoolNew.Destroy();
2012-08-09 13:58:02 +06:00
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();
//
2012-08-09 13:58:02 +06:00
// 7.Postprocessing
2004-12-01 15:39:14 +05:00
UpdatePaveBlocks();
//
NMTTools_DEProcessor aDEP(*this);
aDEP.Do();
//
MakeAloneVertices();
//
2012-08-09 13:58:02 +06:00
//modified by NIZNHY-PKV Mon Dec 12 09:14:23 2011f
myIP->Purge();
//modified by NIZNHY-PKV Mon Dec 12 09:14:27 2011t
myIsDone=Standard_True;
2004-12-01 15:39:14 +05:00
}
catch (BOPTColStd_Failure& ) {
2004-12-01 15:39:14 +05:00
}
}