PAL7508: New functionality: GetShapesOn*(). Done by PKV.

This commit is contained in:
jfa 2005-01-17 14:30:20 +00:00
parent bdc0216cd8
commit c467db496c
28 changed files with 2294 additions and 6 deletions

View File

@ -18,18 +18,43 @@ uses
TopAbs,
TopoDS,
TopTools,
IntTools
IntTools,
BOPTools,
BOP
is
is
-- enumerations
--
enumeration State is
ST_UNKNOWN,
ST_IN,
ST_OUT,
ST_ON,
ST_ONIN,
ST_ONOUT,
ST_INOUT
end State;
--
-- classes
--
deferred class Algo;
deferred class ShapeAlgo;
deferred class ShapeAlgo;
--
-- gluer
class Gluer;
class GlueAnalyser;
class CoupleOfShapes;
class PassKey;
class PassKeyMapHasher;
class Tools;
--
-- finder on
deferred class ShapeSolid;
class WireSolid;
class ShellSolid;
class VertexSolid;
class FinderShapeOn;
--
class IndexedDataMapOfPassKeyListOfShape
instantiates IndexedDataMap from TCollection (PassKey from GEOMAlgo,
ListOfShape from TopTools,
@ -47,4 +72,5 @@ is
class ListOfCoupleOfShapes
instantiates List from TCollection (CoupleOfShapes from GEOMAlgo);
end GEOMAlgo;

View File

@ -0,0 +1,83 @@
-- File: GEOMAlgo_FinderShapeOn.cdl
-- Created: Tue Jan 11 14:35:52 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
class FinderShapeOn from GEOMAlgo
inherits ShapeAlgo from GEOMAlgo
---Purpose:
uses
Surface from Geom,
ShapeEnum from TopAbs,
ListOfShape from TopTools,
DataMapOfShapeShape from TopTools,
Shape from TopoDS,
State from GEOMAlgo
--raises
is
Create
returns FinderShapeOn from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn();"
Perform(me:out)
is redefined;
SetSurface(me:out;
aS:Surface from Geom);
SetShapeType(me:out;
aST:ShapeEnum from TopAbs);
SetState(me:out;
aSF:State from GEOMAlgo);
Surface(me)
returns Surface from Geom;
---C++: return const &
ShapeType(me)
returns ShapeEnum from TopAbs;
State(me)
returns State from GEOMAlgo;
Shapes(me)
returns ListOfShape from TopTools;
---C++: return const &
--
-- protected methods
--
CheckData(me:out)
is redefined protected;
MakeArguments(me:out)
is protected;
Find(me:out)
is protected;
CopySource(myclass;
aS :Shape from TopoDS;
aImages : out DataMapOfShapeShape from TopTools;
aOriginals: out DataMapOfShapeShape from TopTools;
aSC : out Shape from TopoDS);
fields
mySurface : Surface from Geom is protected;
myShapeType : ShapeEnum from TopAbs is protected;
myState : State from GEOMAlgo is protected;
myArg1 : Shape from TopoDS is protected;
myArg2 : Shape from TopoDS is protected;
myLS : ListOfShape from TopTools is protected;
myImages : DataMapOfShapeShape from TopTools is protected;
end FinderShapeOn;

View File

@ -0,0 +1,387 @@
// File: GEOMAlgo_FinderShapeOn.cxx
// Created: Tue Jan 11 14:44:31 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_FinderShapeOn.ixx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepLib_MakeFace.hxx>
#include <BRepLib_FaceError.hxx>
#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_WireSolid.hxx>
#include <GEOMAlgo_ShellSolid.hxx>
#include <GEOMAlgo_VertexSolid.hxx>
#include <GEOMAlgo_ShapeSolid.hxx>
//=======================================================================
//function : GEOMAlgo_FinderShapeOn
//purpose :
//=======================================================================
GEOMAlgo_FinderShapeOn::GEOMAlgo_FinderShapeOn()
:
GEOMAlgo_ShapeAlgo()
{
myTolerance=0.0001;
myShapeType=TopAbs_VERTEX;
myState=GEOMAlgo_ST_UNKNOWN;
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_FinderShapeOn::~GEOMAlgo_FinderShapeOn()
{
}
//=======================================================================
//function : SetSurface
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::SetSurface(const Handle(Geom_Surface)& aS)
{
mySurface=aS;
}
//=======================================================================
//function : Surface
//purpose :
//=======================================================================
const Handle(Geom_Surface)& GEOMAlgo_FinderShapeOn::Surface() const
{
return mySurface;
}
//=======================================================================
//function : SetShapeType
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::SetShapeType(const TopAbs_ShapeEnum aType)
{
myShapeType=aType;
}
//=======================================================================
//function : ShapeType
//purpose :
//=======================================================================
TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn::ShapeType()const
{
return myShapeType;
}
//=======================================================================
//function : SetState
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::SetState(const GEOMAlgo_State aState)
{
myState=aState;
}
//=======================================================================
//function : State
//purpose :
//=======================================================================
GEOMAlgo_State GEOMAlgo_FinderShapeOn::State() const
{
return myState;
}
//=======================================================================
// function: Shapes
// purpose:
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn::Shapes() const
{
return myLS;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::Perform()
{
myErrorStatus=0;
myWarningStatus=0;
myLS.Clear();
//
if (!myResult.IsNull()){
myResult.Nullify();
}
//
CheckData();
if(myErrorStatus) {
return;
}
//
MakeArguments();
if(myErrorStatus || myWarningStatus) {
return;
}
//
Find();
if(myErrorStatus) {
return;
}
//
}
//=======================================================================
//function : Find
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::Find()
{
myErrorStatus=0;
//
Standard_Boolean bIsDone;
Standard_Integer iErr;
TopTools_ListIteratorOfListOfShape aIt;
BRep_Builder aBB;
BOPTools_DSFiller aDF;
GEOMAlgo_ShapeSolid* pSS;
//
// 1. Prepare DSFiller
aDF.SetShapes (myArg1, myArg2);
bIsDone=aDF.IsDone();
if (!bIsDone) {
myErrorStatus=30; // wrong args are used for DSFiller
return;
}
aDF.Perform();
bIsDone=aDF.IsDone();
if (!bIsDone) {
myErrorStatus=31; // DSFiller failed
return;
}
//
// 2. Find shapes
myLS.Clear();
//
if (myShapeType==TopAbs_VERTEX) {
pSS=new GEOMAlgo_VertexSolid;
}
else if (myShapeType==TopAbs_EDGE) {
pSS=new GEOMAlgo_WireSolid;
}
else if (myShapeType==TopAbs_FACE) {
pSS=new GEOMAlgo_ShellSolid;
}
//
pSS->SetFiller(aDF);
pSS->Perform();
iErr=pSS->ErrorStatus();
if (iErr) {
myErrorStatus=32; // builder ShapeSolid failed
delete pSS;
return;
}
//
const TopTools_ListOfShape& aLS=pSS->Shapes(myState);
//
aIt.Initialize(aLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSImage=aIt.Value();
if (myImages.IsBound(aSImage)) {
const TopoDS_Shape& aS=myImages.Find(aSImage);
myLS.Append(aS);
}
else {
myErrorStatus=33;// can not find original shape
return;
}
}
//
delete pSS;
}
//=======================================================================
//function : MakeArguments
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::MakeArguments()
{
myErrorStatus=0;
//
Standard_Integer i, aNb;
BRepLib_FaceError aFErr;
BRepLib_MakeFace aMF;
TopTools_IndexedMapOfShape aM;
BRep_Builder aBB;
TopoDS_Compound aCmp;
TopoDS_Shell aSh;
TopoDS_Solid aSd;
TopoDS_Shape aSC;
TopTools_DataMapOfShapeShape aOriginals;
TopExp_Explorer aExp;
//
// Argument 1
aMF.Init(mySurface, Standard_True);
aFErr=aMF.Error();
if (aFErr!=BRepLib_FaceDone) {
myErrorStatus=20; // can not build the face
return;
}
//
const TopoDS_Shape& aF=aMF.Shape();
//
// update tolerance
aExp.Init(aF, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Vertex& aV=TopoDS::Vertex(aExp.Current());
aBB.UpdateVertex(aV, myTolerance);
}
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
aBB.UpdateEdge(aE, myTolerance);
}
const TopoDS_Face& aFace=TopoDS::Face(aF);
aBB.UpdateFace(aFace, myTolerance);
//
// make solid
aBB.MakeShell(aSh);
aBB.Add(aSh, aFace);
aBB.MakeSolid(aSd);
aBB.Add(aSd, aSh);
myArg1=aSd;
//
// Argument 2
//
myImages.Clear();
//
GEOMAlgo_FinderShapeOn::CopySource(myShape, myImages, aOriginals, aSC);
//
TopExp::MapShapes(aSC, myShapeType, aM);
aNb=aM.Extent();
if (!aNb) {
myWarningStatus=10; // No found subshapes of type myShapeType
return;
}
//
aBB.MakeCompound(aCmp);
for (i=1; i<=aNb; ++i) {
const TopoDS_Shape& aS=aM(i);
aBB.Add(aCmp, aS);
}
myArg2=aCmp;
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::CheckData()
{
myErrorStatus=0;
//
if(mySurface.IsNull()) {
myErrorStatus=10; // mySurface=NULL
return;
}
//
if (myShape.IsNull()) {
myErrorStatus=11; // myShape=NULL
return;
}
//
if (!(myShapeType==TopAbs_VERTEX ||
myShapeType==TopAbs_EDGE ||
myShapeType==TopAbs_FACE)) {
myErrorStatus=12; // unallowed subshape type
return;
}
//
if (myState==GEOMAlgo_ST_UNKNOWN ||
myState==GEOMAlgo_ST_INOUT) {
myErrorStatus=13; // unallowed state type
return;
}
}
//
//=======================================================================
//function : CopySource
//purpose :
//=======================================================================
void GEOMAlgo_FinderShapeOn::CopySource(const TopoDS_Shape& aE,
TopTools_DataMapOfShapeShape& aImages,
TopTools_DataMapOfShapeShape& aOriginals,
TopoDS_Shape& aEx)
{
Standard_Boolean bFree;
TopAbs_ShapeEnum aType;
Standard_Integer aR;
BRep_Builder BB;
TopoDS_Iterator aIt;
//
aType=aE.ShapeType();
//
if (aOriginals.IsBound(aE)) {
aEx=aOriginals.ChangeFind(aE);
if (aType==TopAbs_EDGE) {
return;
}
}
else {
aEx=aE.EmptyCopied();
aOriginals.Bind(aE, aEx);
aImages.Bind(aEx, aE);
}
//
aR=(Standard_Integer)aType+1;
if (aR>TopAbs_VERTEX) {
return;
}
//
bFree=aEx.Free();
aEx.Free(Standard_True);
//
aType=(TopAbs_ShapeEnum) aR;
//
aIt.Initialize(aE);//, Standard_False);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aV=aIt.Value();
TopoDS_Shape aVx;
//
CopySource (aV, aImages, aOriginals, aVx);
//
aVx.Orientation(aV.Orientation());
BB.Add(aEx, aVx);
}
//
aEx.Free(bFree);
}
//
// myErrorStatus :
//
// 10 -mySurface=NULL
// 11 -myShape=NULL
// 12 -unallowed type of subshapes
// 13 -unallowed state
// 20 -can not build the face
// 30 -wrong args are used for DSFiller
// 31 -DSFiller failed
// 32 -builder ShapeSolid failed
// 33 -can not find original shape
//
// myWarningStatus
//
// 10 -subshapes of type myShapeType can not be fond in myShape

View File

@ -0,0 +1,133 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile
#define _GEOMAlgo_FinderShapeOn_HeaderFile
#ifndef _Handle_Geom_Surface_HeaderFile
#include <Handle_Geom_Surface.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
#ifndef _GEOMAlgo_State_HeaderFile
#include <GEOMAlgo_State.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeShape_HeaderFile
#include <TopTools_DataMapOfShapeShape.hxx>
#endif
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
#include <GEOMAlgo_ShapeAlgo.hxx>
#endif
class Geom_Surface;
class TopTools_ListOfShape;
class TopoDS_Shape;
class TopTools_DataMapOfShapeShape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_FinderShapeOn : public GEOMAlgo_ShapeAlgo {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_FinderShapeOn();
Standard_EXPORT virtual ~GEOMAlgo_FinderShapeOn();
Standard_EXPORT virtual void Perform() ;
Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& aS) ;
Standard_EXPORT void SetShapeType(const TopAbs_ShapeEnum aST) ;
Standard_EXPORT void SetState(const GEOMAlgo_State aSF) ;
Standard_EXPORT const Handle_Geom_Surface& Surface() const;
Standard_EXPORT TopAbs_ShapeEnum ShapeType() const;
Standard_EXPORT GEOMAlgo_State State() const;
Standard_EXPORT const TopTools_ListOfShape& Shapes() const;
Standard_EXPORT static void CopySource(const TopoDS_Shape& aS,TopTools_DataMapOfShapeShape& aImages,TopTools_DataMapOfShapeShape& aOriginals,TopoDS_Shape& aSC) ;
protected:
// Methods PROTECTED
//
Standard_EXPORT virtual void CheckData() ;
Standard_EXPORT void MakeArguments() ;
Standard_EXPORT void Find() ;
// Fields PROTECTED
//
Handle_Geom_Surface mySurface;
TopAbs_ShapeEnum myShapeType;
GEOMAlgo_State myState;
TopoDS_Shape myArg1;
TopoDS_Shape myArg2;
TopTools_ListOfShape myLS;
TopTools_DataMapOfShapeShape myImages;
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_FinderShapeOn.jxx>

View File

@ -0,0 +1,15 @@
#ifndef _Geom_Surface_HeaderFile
#include <Geom_Surface.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeShape_HeaderFile
#include <TopTools_DataMapOfShapeShape.hxx>
#endif
#ifndef _GEOMAlgo_FinderShapeOn_HeaderFile
#include <GEOMAlgo_FinderShapeOn.hxx>
#endif

View File

@ -0,0 +1,49 @@
-- File: GEOMAlgo_ShapeSolid.cdl
-- Created: Thu Jan 13 12:44:07 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
deferred class ShapeSolid from GEOMAlgo
inherits Algo from GEOMAlgo
---Purpose:
uses
ListOfShape from TopTools,
State from GEOMAlgo,
PDSFiller from BOPTools,
DSFiller from BOPTools
--raises
is
Initialize
returns ShapeSolid from GEOMAlgo;
SetFiller(me:out;
aDSF:DSFiller from BOPTools);
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid();"
Shapes(me;
aState:State from GEOMAlgo)
returns ListOfShape from TopTools;
---C++: return const &
BuildResult (me:out)
is deferred protected;
Prepare(me:out)
is deferred protected;
fields
myLSIN : ListOfShape from TopTools is protected;
myLSOUT : ListOfShape from TopTools is protected;
myLSON : ListOfShape from TopTools is protected;
myLS : ListOfShape from TopTools is protected;
myRank : Integer from Standard is protected;
myDSFiller : PDSFiller from BOPTools is protected;
end ShapeSolid;

View File

@ -0,0 +1,114 @@
// File: GEOMAlgo_ShapeSolid.cxx
// Created: Thu Jan 13 12:54:48 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_ShapeSolid.ixx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
//=======================================================================
//function : GEOMAlgo_ShapeSolid
//purpose :
//=======================================================================
GEOMAlgo_ShapeSolid::GEOMAlgo_ShapeSolid()
:
GEOMAlgo_Algo(),
myRank(0),
myDSFiller(NULL)
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_ShapeSolid::~GEOMAlgo_ShapeSolid()
{
}
//=======================================================================
//function : SetFiller
//purpose :
//=======================================================================
void GEOMAlgo_ShapeSolid::SetFiller(const BOPTools_DSFiller& aDSFiller)
{
myDSFiller=(BOPTools_DSFiller*) &aDSFiller;
}
//=======================================================================
// function: Shapes
// purpose:
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_ShapeSolid::Shapes(const GEOMAlgo_State aState) const
{
TopTools_ListIteratorOfListOfShape aIt;
//
TopTools_ListOfShape* pLS=(TopTools_ListOfShape*)&myLS;
//
pLS->Clear();
//
switch (aState) {
case GEOMAlgo_ST_IN: {
aIt.Initialize(myLSIN);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_OUT: {
aIt.Initialize(myLSOUT);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_ON: {
aIt.Initialize(myLSON);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_ONIN: {
aIt.Initialize(myLSON);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
aIt.Initialize(myLSIN);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_ONOUT: {
aIt.Initialize(myLSON);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
aIt.Initialize(myLSOUT);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
pLS->Append(aS);
}
}
break;
//
case GEOMAlgo_ST_UNKNOWN:
case GEOMAlgo_ST_INOUT:
default:
break;
}
return myLS;
}

View File

@ -0,0 +1,116 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#define _GEOMAlgo_ShapeSolid_HeaderFile
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _BOPTools_PDSFiller_HeaderFile
#include <BOPTools_PDSFiller.hxx>
#endif
#ifndef _GEOMAlgo_Algo_HeaderFile
#include <GEOMAlgo_Algo.hxx>
#endif
#ifndef _GEOMAlgo_State_HeaderFile
#include <GEOMAlgo_State.hxx>
#endif
class BOPTools_DSFiller;
class TopTools_ListOfShape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_ShapeSolid : public GEOMAlgo_Algo {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT void SetFiller(const BOPTools_DSFiller& aDSF) ;
Standard_EXPORT virtual ~GEOMAlgo_ShapeSolid();
Standard_EXPORT const TopTools_ListOfShape& Shapes(const GEOMAlgo_State aState) const;
protected:
// Methods PROTECTED
//
Standard_EXPORT GEOMAlgo_ShapeSolid();
Standard_EXPORT virtual void BuildResult() = 0;
Standard_EXPORT virtual void Prepare() = 0;
// Fields PROTECTED
//
TopTools_ListOfShape myLSIN;
TopTools_ListOfShape myLSOUT;
TopTools_ListOfShape myLSON;
TopTools_ListOfShape myLS;
Standard_Integer myRank;
BOPTools_PDSFiller myDSFiller;
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_ShapeSolid.jxx>

View File

@ -0,0 +1,9 @@
#ifndef _BOPTools_DSFiller_HeaderFile
#include <BOPTools_DSFiller.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#include <GEOMAlgo_ShapeSolid.hxx>
#endif

View File

@ -0,0 +1,34 @@
-- File: GEOMAlgo_ShellSolid.cdl
-- Created: Wed Jan 12 12:45:20 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
class ShellSolid from GEOMAlgo
inherits ShapeSolid from GEOMAlgo
---Purpose:
--uses
--raises
is
Create
returns ShellSolid from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_ShellSolid();"
Perform (me:out)
is redefined;
Prepare(me:out)
is redefined protected;
BuildResult (me:out)
is redefined protected;
DetectSDFaces(me:out)
is protected;
--fields
end ShellSolid;

View File

@ -0,0 +1,416 @@
// File: GEOMAlgo_ShellSolid.cxx
// Created: Wed Jan 12 12:49:45 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_ShellSolid.ixx>
#include <Standard_Failure.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <BRep_Tool.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopExp_Explorer.hxx>
#include <BOPTColStd_Dump.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <IntTools_Context.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_SolidStateFiller.hxx>
#include <BOPTools_PCurveMaker.hxx>
#include <BOPTools_DEProcessor.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfSSInterference.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_SSInterference.hxx>
#include <BOPTools_SequenceOfCurves.hxx>
#include <BOPTools_Curve.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_SplitShapesPool.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOPTools_DSFiller.hxx>
//
#include <gp_Dir.hxx>
#include <BOPTools_SSInterference.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <TopoDS_Edge.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOP_WireEdgeSet.hxx>
#include <BOP_SDFWESFiller.hxx>
#include <BOP_FaceBuilder.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BRepTools.hxx>
#include <IntTools_Context.hxx>
#include <Geom_Surface.hxx>
#include <TopExp_Explorer.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
static
Standard_Boolean CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2);
//=======================================================================
//function : GEOMAlgo_ShellSolid
//purpose :
//=======================================================================
GEOMAlgo_ShellSolid::GEOMAlgo_ShellSolid()
:
GEOMAlgo_ShapeSolid()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_ShellSolid::~GEOMAlgo_ShellSolid()
{
}
//=======================================================================
// function:
// purpose:
//=======================================================================
void GEOMAlgo_ShellSolid::Perform()
{
myErrorStatus=0;
//
try {
if (myDSFiller==NULL) {
myErrorStatus=10;
return;
}
if(!myDSFiller->IsDone()) {
myErrorStatus=11;
return;
}
//
Standard_Boolean bIsNewFiller;
//
bIsNewFiller=myDSFiller->IsNewFiller();
if (bIsNewFiller) {
Prepare();
myDSFiller->SetNewFiller(!bIsNewFiller);
}
//
myRank=(myDSFiller->DS().Object().ShapeType()==TopAbs_SHELL) ? 1 : 2;
BuildResult();
}
catch (Standard_Failure) {
myErrorStatus=12;
}
}
//=======================================================================
// function: Prepare
// purpose:
//=======================================================================
void GEOMAlgo_ShellSolid::Prepare()
{
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
//
// 1 States
BOPTools_SolidStateFiller aStateFiller(aPaveFiller);
aStateFiller.Do();
//
// 2 Project section edges on corresp. faces -> P-Curves on edges.
BOPTools_PCurveMaker aPCurveMaker(aPaveFiller);
aPCurveMaker.Do();
//
// 3. Degenerated Edges Processing
BOPTools_DEProcessor aDEProcessor(aPaveFiller);
aDEProcessor.Do();
//
// 4. Detect Same Domain Faces
DetectSDFaces();
}
//=================================================================================
// function: BuildResult
// purpose:
//=================================================================================
void GEOMAlgo_ShellSolid::BuildResult()
{
Standard_Boolean bIsTouchCase;
Standard_Integer i, j, nF1, nF2, aNbFFs, aNbS, aNbCurves, nSp, iRank1;
Standard_Integer nE, nF, aNbPB, iBeg, iEnd;
BooleanOperations_StateOfShape aState;
TopExp_Explorer anExp;
TopAbs_ShapeEnum aType;
gp_Pnt2d aP2D;
gp_Pnt aP3D;
//
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
const BOPTools_InterferencePool& anInterfPool=myDSFiller->InterfPool();
BOPTools_InterferencePool* pInterfPool=(BOPTools_InterferencePool*) &anInterfPool;
BOPTools_CArray1OfSSInterference& aFFs=pInterfPool->SSInterferences();
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
//
// 1. process pf non-interferring faces
iBeg=1;
iEnd=aDS.NumberOfShapesOfTheObject();
if (myRank==2) {
iBeg=iEnd+1;
iEnd=aDS.NumberOfSourceShapes();
}
//
for (i=iBeg; i<=iEnd; ++i) {
aType=aDS.GetShapeType(i);
if (aType!=TopAbs_FACE) {
continue;
}
//
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(i));
aState=aDS.GetState(i);
if (aState==BooleanOperations_IN) {
myLSIN.Append(aF1);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aF1);
}
}
//
// 2. process pf interferred faces
aNbFFs=aFFs.Extent();
for (i=1; i<=aNbFFs; ++i) {
BOPTools_SSInterference& aFFi=aFFs(i);
//
nF1=aFFi.Index1();
nF2=aFFi.Index2();
iRank1=aDS.Rank(nF1);
nF=(iRank1==myRank) ? nF1 : nF2;
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF));
//
bIsTouchCase=aFFi.IsTangentFaces();
//
if (bIsTouchCase) {
myLSON.Append(aF1);
continue;
}
//
// Has section edges ?
aNbS=0;
BOPTools_SequenceOfCurves& aBCurves=aFFi.Curves();
aNbCurves=aBCurves.Length();
for (j=1; j<=aNbCurves; j++) {
BOPTools_Curve& aBC=aBCurves(j);
const BOPTools_ListOfPaveBlock& aSectEdges=aBC.NewPaveBlocks();
aNbS=aSectEdges.Extent();
if (aNbS) {
break;
}
}
//
if (aNbS) { // it has
continue;
}
//
anExp.Init(aF1, TopAbs_EDGE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(anExp.Current());
if (BRep_Tool::Degenerated(aE)) {
continue;
}
//
nE=aDS.ShapeIndex(aE, myRank);
const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(nE));
aNbPB=aLPB.Extent();
//
if (aNbPB<2) {
nSp=nE;
if (aNbPB) {
const BOPTools_PaveBlock& aPB=aLPB.First();
nSp=aPB.Edge();
}
const TopoDS_Shape& aSp=aDS.Shape(nSp);
//
aState=aDS.GetState(nSp);
if (aState==BooleanOperations_IN) {
myLSIN.Append(aF1);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aF1);
}
else if (aState==BooleanOperations_ON) {
Standard_Real aTol;
TopAbs_State aSt;
//
//const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape((iRank1==myRank)? nF2 : nF1));
//aTol=BRep_Tool::Tolerance(aF2);
aTol=1.e-7;
//
BOPTools_Tools3D::PointNearEdge(aE, aF1, aP2D, aP3D);
const TopoDS_Solid& aRefSolid=(myRank==1) ?
TopoDS::Solid(aDS.Tool()) : TopoDS::Solid(aDS.Object());
//
BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)& aPaveFiller;
IntTools_Context& aCtx=pPF->ChangeContext();
//
BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aRefSolid);
aSC.Perform(aP3D, aTol);
aSt=aSC.State();
if (aSt==TopAbs_IN) {
myLSIN.Append(aF1);
}
else if (aSt==TopAbs_OUT) {
myLSOUT.Append(aF1);
}
}
break;
} // if (aNbPB<2) {
} //for (; anExp.More(); anExp.Next())
}
}
//=======================================================================
// function: DetectSDFaces
// purpose:
//=======================================================================
void GEOMAlgo_ShellSolid::DetectSDFaces()
{
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
BOPTools_InterferencePool* pIntrPool=(BOPTools_InterferencePool*)&myDSFiller->InterfPool();
BOPTools_CArray1OfSSInterference& aFFs=pIntrPool->SSInterferences();
//
Standard_Boolean bFlag;
Standard_Integer i, aNb, nF1, nF2, iZone, aNbSps, iSenseFlag;
gp_Dir aDNF1, aDNF2;
aNb=aFFs.Extent();
for (i=1; i<=aNb; i++) {
bFlag=Standard_False;
BOPTools_SSInterference& aFF=aFFs(i);
nF1=aFF.Index1();
nF2=aFF.Index2();
const TopoDS_Face& aF1=TopoDS::Face(aDS.Shape(nF1));
const TopoDS_Face& aF2=TopoDS::Face(aDS.Shape(nF2));
//
// iSenseFlag;
const BOPTools_ListOfPaveBlock& aLPB=aFF.PaveBlocks();
aNbSps=aLPB.Extent();
if (!aNbSps) {
continue;
}
const BOPTools_PaveBlock& aPB=aLPB.First();
const TopoDS_Edge& aSpE=TopoDS::Edge(aDS.Shape(aPB.Edge()));
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF1, aDNF1);
BOPTools_Tools3D::GetNormalToFaceOnEdge (aSpE, aF2, aDNF2);
iSenseFlag=BOPTools_Tools3D::SenseFlag (aDNF1, aDNF2);
//
if (iSenseFlag==1 || iSenseFlag==-1) {
//
//
TopoDS_Face aF1FWD=aF1;
aF1FWD.Orientation (TopAbs_FORWARD);
BOP_WireEdgeSet aWES (aF1FWD);
BOP_SDFWESFiller aWESFiller(nF1, nF2, *myDSFiller);
aWESFiller.SetSenseFlag(iSenseFlag);
aWESFiller.SetOperation(BOP_COMMON);
aWESFiller.Do(aWES);
BOP_FaceBuilder aFB;
aFB.Do(aWES);
const TopTools_ListOfShape& aLF=aFB.NewFaces();
iZone=0;
TopTools_ListIteratorOfListOfShape anIt(aLF);
for (; anIt.More(); anIt.Next()) {
const TopoDS_Shape& aFR=anIt.Value();
if (aFR.ShapeType()==TopAbs_FACE) {
const TopoDS_Face& aFaceResult=TopoDS::Face(aFR);
//
Standard_Boolean bIsValidIn2D, bNegativeFlag;
bIsValidIn2D=BOPTools_Tools3D::IsValidArea (aFaceResult, bNegativeFlag);
if (bIsValidIn2D) {
if(CheckSameDomainFaceInside(aFaceResult, aF2)) {
iZone=1;
break;
}
}
//
}
}
if (iZone) {
bFlag=Standard_True;
aFF.SetStatesMap(aWESFiller.StatesMap());
}
}// if (iSenseFlag)
aFF.SetTangentFacesFlag(bFlag);
aFF.SetSenseFlag (iSenseFlag);
}// end of for (i=1; i<=aNb; i++)
}
//=======================================================================
//function : CheckSameDomainFaceInside
//purpose :
//=======================================================================
Standard_Boolean CheckSameDomainFaceInside(const TopoDS_Face& theFace1,
const TopoDS_Face& theFace2)
{
Standard_Real umin = 0., umax = 0., vmin = 0., vmax = 0.;
BRepTools::UVBounds(theFace1, umin, umax, vmin, vmax);
IntTools_Context aContext;
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(theFace1);
Standard_Real aTolerance = BRep_Tool::Tolerance(theFace1);
TopExp_Explorer anExpE(theFace1, TopAbs_EDGE);
for(; anExpE.More(); anExpE.Next()) {
const TopoDS_Edge& anEdge = TopoDS::Edge(anExpE.Current());
Standard_Real anEdgeTol = BRep_Tool::Tolerance(anEdge);
aTolerance = (aTolerance < anEdgeTol) ? anEdgeTol : aTolerance;
}
aTolerance += BRep_Tool::Tolerance(theFace2);
Standard_Integer nbpoints = 5;
Standard_Real adeltau = (umax - umin) / (nbpoints + 1);
Standard_Real adeltav = (vmax - vmin) / (nbpoints + 1);
Standard_Real U = umin + adeltau;
GeomAPI_ProjectPointOnSurf& aProjector = aContext.ProjPS(theFace2);
for(Standard_Integer i = 1; i <= nbpoints; i++, U+=adeltau) {
Standard_Real V = vmin + adeltav;
for(Standard_Integer j = 1; j <= nbpoints; j++, V+=adeltav) {
gp_Pnt2d aPoint(U,V);
if(aContext.IsPointInFace(theFace1, aPoint)) {
gp_Pnt aP3d = aSurface->Value(U, V);
aProjector.Perform(aP3d);
if(aProjector.IsDone()) {
if(aProjector.LowerDistance() > aTolerance)
return Standard_False;
}
}
}
}
return Standard_True;
}

View File

@ -0,0 +1,96 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_ShellSolid_HeaderFile
#define _GEOMAlgo_ShellSolid_HeaderFile
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#include <GEOMAlgo_ShapeSolid.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_ShellSolid : public GEOMAlgo_ShapeSolid {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_ShellSolid();
Standard_EXPORT virtual ~GEOMAlgo_ShellSolid();
Standard_EXPORT virtual void Perform() ;
protected:
// Methods PROTECTED
//
Standard_EXPORT virtual void Prepare() ;
Standard_EXPORT virtual void BuildResult() ;
Standard_EXPORT void DetectSDFaces() ;
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_ShellSolid.jxx>

View File

@ -0,0 +1,3 @@
#ifndef _GEOMAlgo_ShellSolid_HeaderFile
#include <GEOMAlgo_ShellSolid.hxx>
#endif

View File

@ -0,0 +1,40 @@
// File generated by CPPExt (Enum)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_State_HeaderFile
#define _GEOMAlgo_State_HeaderFile
enum GEOMAlgo_State {
GEOMAlgo_ST_UNKNOWN,
GEOMAlgo_ST_IN,
GEOMAlgo_ST_OUT,
GEOMAlgo_ST_ON,
GEOMAlgo_ST_ONIN,
GEOMAlgo_ST_ONOUT,
GEOMAlgo_ST_INOUT
};
#ifndef _Standard_PrimitiveTypes_HeaderFile
#include <Standard_PrimitiveTypes.hxx>
#endif
#endif

View File

@ -0,0 +1,32 @@
-- File: GEOMAlgo_VertexSolid.cdl
-- Created: Wed Jan 12 16:34:53 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
class VertexSolid from GEOMAlgo
inherits ShapeSolid from GEOMAlgo
---Purpose:
--uses
--raises
is
Create
returns VertexSolid from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_VertexSolid();"
Perform (me:out)
is redefined;
Prepare(me:out)
is redefined protected;
BuildResult (me:out)
is redefined protected;
--fields
end VertexSolid;

View File

@ -0,0 +1,219 @@
// File: GEOMAlgo_VertexSolid.cxx
// Created: Wed Jan 12 16:36:40 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_VertexSolid.ixx>
#include <gp_Pnt.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopAbs_State.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BOPTColStd_Dump.hxx>
#include <IntTools_Context.hxx>
#include <BooleanOperations_StateOfShape.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BOPTools_InterferencePool.hxx>
#include <BOPTools_CArray1OfVVInterference.hxx>
#include <BOPTools_VVInterference.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_DSFiller.hxx>
//=======================================================================
//function : GEOMAlgo_VertexSolid
//purpose :
//=======================================================================
GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid()
:
GEOMAlgo_ShapeSolid()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_VertexSolid::~GEOMAlgo_VertexSolid()
{
}
//=======================================================================
// function: Perform
// purpose:
//=======================================================================
void GEOMAlgo_VertexSolid::Perform()
{
myErrorStatus=0;
//
try {
if (myDSFiller==NULL) {
myErrorStatus=10;
return;
}
if(!myDSFiller->IsDone()) {
myErrorStatus=11;
return;
}
//
Standard_Boolean bIsNewFiller;
Standard_Integer aNbF;
TopTools_IndexedMapOfShape aM;
//
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
const TopoDS_Shape& aObj=aDS.Object();
//
TopExp::MapShapes(aObj, TopAbs_FACE, aM);
aNbF=aM.Extent();
myRank=(aNbF) ? 2 : 1;
//
bIsNewFiller=myDSFiller->IsNewFiller();
if (bIsNewFiller) {
Prepare();
myDSFiller->SetNewFiller(!bIsNewFiller);
}
BuildResult();
}
//
catch (Standard_Failure) {
myErrorStatus = 12;
}
}
//=======================================================================
// function: Prepare
// purpose:
//=======================================================================
void GEOMAlgo_VertexSolid::Prepare()
{
Standard_Integer i, iBeg, iEnd, aNbVV, j, n1, n2, iFound;
Standard_Real aTol;
TopAbs_State aSt;
TopAbs_ShapeEnum aType;
BooleanOperations_StateOfShape aState;
gp_Pnt aP3D;
//
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
BooleanOperations_ShapesDataStructure* pDS=(BooleanOperations_ShapesDataStructure*)&aDS;
const BOPTools_InterferencePool& aIP=myDSFiller->InterfPool();
BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*) &aIP;
BOPTools_CArray1OfVVInterference& aVVs=pIP->VVInterferences();
const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller();
BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)&aPF;
IntTools_Context& aCtx=pPF->ChangeContext();
//
const TopoDS_Shape& aObj=aDS.Object();
const TopoDS_Shape& aTool=aDS.Tool();
//
const TopoDS_Solid& aSolid=(myRank==1) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj);
const TopoDS_Shape& aSV =(myRank==1)? aObj : aTool;
//
BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aSolid);
//
iBeg=1;
iEnd=aDS.NumberOfShapesOfTheObject();
if (myRank==2) {
iBeg=iEnd+1;
iEnd=aDS.NumberOfSourceShapes();
}
//
for (i=iBeg; i<=iEnd; ++i) {
aType=aDS.GetShapeType(i);
if (aType!=TopAbs_VERTEX) {
continue;
}
//
const TopoDS_Vertex& aV=TopoDS::Vertex(aDS.Shape(i));
//
aState=aDS.GetState(i);
if (aState==BooleanOperations_ON ||
aState==BooleanOperations_IN ||
aState==BooleanOperations_OUT) {
continue;
}
//
iFound=0;
aNbVV=aVVs.Extent();
for (j=1; j<=aNbVV; ++j) {
BOPTools_VVInterference& aVV=aVVs(j);
aVV.Indices(n1, n2);
if (n1==i || n2==i) {
pDS->SetState (n1, BooleanOperations_ON);
pDS->SetState (n2, BooleanOperations_ON);
iFound=1;
break;
}
}
if (iFound) {
continue;
}
//
aP3D=BRep_Tool::Pnt(aV);
aTol=1.E-7;
aSC.Perform(aP3D, aTol);
aSt=aSC.State();
if (aSt==TopAbs_IN) {
pDS->SetState (i, BooleanOperations_IN);
}
else if (aSt==TopAbs_OUT) {
pDS->SetState (i, BooleanOperations_OUT);
}
}
}
//=======================================================================
// function: BuildResult
// purpose:
//=======================================================================
void GEOMAlgo_VertexSolid::BuildResult()
{
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
//
Standard_Integer i, iBeg, iEnd;
TopAbs_ShapeEnum aType;
BooleanOperations_StateOfShape aState;
//
myLSIN.Clear();
myLSOUT.Clear();
myLSON.Clear();
//
iBeg=1;
iEnd=aDS.NumberOfShapesOfTheObject();
if (myRank==2) {
iBeg=iEnd+1;
iEnd=aDS.NumberOfSourceShapes();
}
//
for (i=iBeg; i<=iEnd; ++i) {
aType=aDS.GetShapeType(i);
if (aType!=TopAbs_VERTEX) {
continue;
}
const TopoDS_Shape& aV=aDS.Shape(i);
aState=aDS.GetState(i);
//
if (aState==BooleanOperations_IN) {
myLSIN.Append(aV);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aV);
}
else if (aState==BooleanOperations_ON) {
myLSON.Append(aV);
}
}
}

View File

@ -0,0 +1,95 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_VertexSolid_HeaderFile
#define _GEOMAlgo_VertexSolid_HeaderFile
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#include <GEOMAlgo_ShapeSolid.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_VertexSolid : public GEOMAlgo_ShapeSolid {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_VertexSolid();
Standard_EXPORT virtual ~GEOMAlgo_VertexSolid();
Standard_EXPORT virtual void Perform() ;
protected:
// Methods PROTECTED
//
Standard_EXPORT virtual void Prepare() ;
Standard_EXPORT virtual void BuildResult() ;
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_VertexSolid.jxx>

View File

@ -0,0 +1,3 @@
#ifndef _GEOMAlgo_VertexSolid_HeaderFile
#include <GEOMAlgo_VertexSolid.hxx>
#endif

View File

@ -0,0 +1,31 @@
-- File: GEOMAlgo_WireSolid.cdl
-- Created: Wed Jan 12 10:17:00 2005
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2005
class WireSolid from GEOMAlgo
inherits ShapeSolid from GEOMAlgo
---Purpose:
--uses
--raises
is
Create
returns WireSolid from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_WireSolid();"
Perform (me:out)
is redefined;
Prepare(me:out)
is redefined protected;
BuildResult (me:out)
is redefined protected;
--fields
end WireSolid;

View File

@ -0,0 +1,152 @@
// File: GEOMAlgo_WireSolid.cxx
// Created: Wed Jan 12 10:19:31 2005
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_WireSolid.ixx>
#include <Standard_Failure.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <BOPTColStd_Dump.hxx>
#include <BooleanOperations_ShapesDataStructure.hxx>
#include <BooleanOperations_StateOfShape.hxx>
#include <BOPTools_PaveFiller.hxx>
#include <BOPTools_SplitShapesPool.hxx>
#include <BOPTools_PaveBlock.hxx>
#include <BOPTools_ListOfPaveBlock.hxx>
#include <BOPTools_DSFiller.hxx>
#include <BOPTools_WireStateFiller.hxx>
//=======================================================================
//function : GEOMAlgo_WireSolid
//purpose :
//=======================================================================
GEOMAlgo_WireSolid::GEOMAlgo_WireSolid()
:
GEOMAlgo_ShapeSolid()
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_WireSolid::~GEOMAlgo_WireSolid()
{
}
//=======================================================================
// function: Perform
// purpose:
//=======================================================================
void GEOMAlgo_WireSolid::Perform()
{
myErrorStatus=0;
//
try {
if (myDSFiller==NULL) {
myErrorStatus=10;
return;
}
if(!myDSFiller->IsDone()) {
myErrorStatus=11;
return;
}
//
Standard_Boolean bIsNewFiller;
//
bIsNewFiller=myDSFiller->IsNewFiller();
if (bIsNewFiller) {
Prepare();
myDSFiller->SetNewFiller(!bIsNewFiller);
}
BuildResult();
}
//
catch (Standard_Failure) {
myErrorStatus= 12;
}
}
//=======================================================================
// function: Prepare
// purpose:
//=======================================================================
void GEOMAlgo_WireSolid::Prepare()
{
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
//
BOPTools_WireStateFiller aStateFiller(aPaveFiller);
aStateFiller.Do();
//
}
//=======================================================================
// function: BuildResult
// purpose:
//=======================================================================
void GEOMAlgo_WireSolid::BuildResult()
{
const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
//
Standard_Integer i, aNbPB, nSp, iBeg, iEnd;
TopAbs_ShapeEnum aType;
BooleanOperations_StateOfShape aState;
//
myLSIN.Clear();
myLSOUT.Clear();
myLSON.Clear();
//
iBeg=1;
iEnd=aDS.NumberOfShapesOfTheObject();
if (aDS.Tool().ShapeType()==TopAbs_WIRE) {
iBeg=iEnd+1;
iEnd=aDS.NumberOfSourceShapes();
}
//
for (i=iBeg; i<=iEnd; ++i) {
aType=aDS.GetShapeType(i);
if (aType==TopAbs_EDGE) {
const TopoDS_Shape& aE=aDS.Shape(i);
const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i));
aNbPB=aLPB.Extent();
//
if (!aNbPB) {
aState=aDS.GetState(i);
//
if (aState==BooleanOperations_IN) {
myLSIN.Append(aE);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aE);
}
else if (aState==BooleanOperations_ON) {
myLSON.Append(aE);
}
}
//
else if (aNbPB==1) {
const BOPTools_PaveBlock& aPB=aLPB.First();
nSp=aPB.Edge();
const TopoDS_Shape& aSp=aDS.Shape(nSp);
aState=aDS.GetState(nSp);
//
if (aState==BooleanOperations_IN) {
myLSIN.Append(aE);
}
else if (aState==BooleanOperations_OUT) {
myLSOUT.Append(aE);
}
else if (aState==BooleanOperations_ON) {
myLSON.Append(aE);
}
}
}
}
}

View File

@ -0,0 +1,95 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#ifndef _GEOMAlgo_WireSolid_HeaderFile
#define _GEOMAlgo_WireSolid_HeaderFile
#ifndef _GEOMAlgo_ShapeSolid_HeaderFile
#include <GEOMAlgo_ShapeSolid.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_WireSolid : public GEOMAlgo_ShapeSolid {
public:
void* operator new(size_t,void* anAddress)
{
return anAddress;
}
void* operator new(size_t size)
{
return Standard::Allocate(size);
}
void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMAlgo_WireSolid();
Standard_EXPORT virtual ~GEOMAlgo_WireSolid();
Standard_EXPORT virtual void Perform() ;
protected:
// Methods PROTECTED
//
Standard_EXPORT virtual void Prepare() ;
Standard_EXPORT virtual void BuildResult() ;
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
};
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,26 @@
// File generated by CPPExt (Value)
//
// Copyright (C) 1991 - 2000 by
// Matra Datavision SA. All rights reserved.
//
// Copyright (C) 2001 - 2004 by
// Open CASCADE SA. All rights reserved.
//
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.
#include <GEOMAlgo_WireSolid.jxx>

View File

@ -0,0 +1,3 @@
#ifndef _GEOMAlgo_WireSolid_HeaderFile
#include <GEOMAlgo_WireSolid.hxx>
#endif

View File

@ -59,7 +59,12 @@ LIB_SRC = \
BlockFix_PeriodicSurfaceModifier.cxx \
BlockFix_SphereSpaceModifier.cxx \
BlockFix_UnionEdges.cxx \
BlockFix_UnionFaces.cxx
BlockFix_UnionFaces.cxx \
GEOMAlgo_FinderShapeOn.cxx \
GEOMAlgo_ShapeSolid.cxx \
GEOMAlgo_ShellSolid.cxx \
GEOMAlgo_VertexSolid.cxx \
GEOMAlgo_WireSolid.cxx
LIB_CLIENT_IDL =
LIB_SERVER_IDL =
@ -75,9 +80,11 @@ EXPORT_HEADERS = \
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx \
Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx \
BlockFix_BlockFixAPI.hxx \
BlockFix_BlockFixAPI.lxx \
BlockFix_CheckTool.hxx \
Handle_BlockFix_BlockFixAPI.hxx \
BlockFix_BlockFixAPI.lxx
GEOMAlgo_State.hxx \
GEOMAlgo_FinderShapeOn.hxx
# idl files
EXPORT_IDLS=