Improvement of GlueFaces, implemented checking functionality. Done by PKV

This commit is contained in:
jfa 2004-12-24 14:28:57 +00:00
parent 7f6cfbbbcf
commit b2047e1b35
30 changed files with 2053 additions and 384 deletions

View File

@ -12,6 +12,7 @@ package GEOMAlgo
uses
TCollection,
TColStd,
Geom,
Bnd,
gp,
TopAbs,
@ -23,6 +24,8 @@ is
deferred class Algo;
deferred class ShapeAlgo;
class Gluer;
class GlueAnalyser;
class CoupleOfShapes;
class PassKey;
class PassKeyMapHasher;
class Tools;
@ -41,4 +44,7 @@ is
Shape from TopoDS,
MapIntegerHasher from TColStd);
class ListOfCoupleOfShapes
instantiates List from TCollection (CoupleOfShapes from GEOMAlgo);
end GEOMAlgo;

View File

@ -21,10 +21,10 @@ is
is deferred;
CheckData(me:out)
is deferred protected;
is virtual protected;
CheckResult(me:out)
is deferred protected;
is virtual protected;
ErrorStatus (me)
returns Integer from Standard;

View File

@ -23,6 +23,22 @@
{
}
//=======================================================================
// function: CheckData
// purpose:
//=======================================================================
void GEOMAlgo_Algo::CheckData()
{
myErrorStatus=0;
}
//=======================================================================
// function: CheckResult
// purpose:
//=======================================================================
void GEOMAlgo_Algo::CheckResult()
{
myErrorStatus=0;
}
//=======================================================================
// function: ErrorStatus
// purpose:
//=======================================================================

View File

@ -66,8 +66,8 @@ protected:
//
Standard_EXPORT GEOMAlgo_Algo();
Standard_EXPORT virtual ~GEOMAlgo_Algo();
Standard_EXPORT virtual void CheckData() = 0;
Standard_EXPORT virtual void CheckResult() = 0;
Standard_EXPORT virtual void CheckData() ;
Standard_EXPORT virtual void CheckResult() ;
// Fields PROTECTED

View File

@ -0,0 +1,48 @@
-- File: GEOMAlgo_CoupleOfShapes.cdl
-- Created: Wed Dec 15 13:00:10 2004
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2004
class CoupleOfShapes from GEOMAlgo
---Purpose:
uses
Shape from TopoDS
--raises
is
Create
returns CoupleOfShapes from GEOMAlgo;
SetShapes(me:out;
aS1: Shape from TopoDS;
aS2: Shape from TopoDS);
SetShape1(me:out;
aS1: Shape from TopoDS);
SetShape2(me:out;
aS2: Shape from TopoDS);
Shapes(me;
aS1:out Shape from TopoDS;
aS2:out Shape from TopoDS);
Shape1(me)
returns Shape from TopoDS;
---C++:return const &
Shape2(me)
returns Shape from TopoDS;
---C++:return const &
fields
myShape1: Shape from TopoDS is protected;
myShape2: Shape from TopoDS is protected;
end CoupleOfShapes;

View File

@ -0,0 +1,65 @@
// File: GEOMAlgo_CoupleOfShapes.cxx
// Created: Wed Dec 15 13:03:52 2004
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_CoupleOfShapes.ixx>
//=======================================================================
//function : GEOMAlgo_CoupleOfShapes
//purpose :
//=======================================================================
GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes()
{}
//=======================================================================
//function : SetShapes
//purpose :
//=======================================================================
void GEOMAlgo_CoupleOfShapes::SetShapes(const TopoDS_Shape& aS1,
const TopoDS_Shape& aS2)
{
myShape1=aS1;
myShape2=aS2;
}
//=======================================================================
//function : Shapes
//purpose :
//=======================================================================
void GEOMAlgo_CoupleOfShapes::Shapes(TopoDS_Shape& aS1,
TopoDS_Shape& aS2)const
{
aS1=myShape1;
aS2=myShape2;
}
//=======================================================================
//function : SetShape1
//purpose :
//=======================================================================
void GEOMAlgo_CoupleOfShapes::SetShape1(const TopoDS_Shape& aS1)
{
myShape1=aS1;
}
//=======================================================================
//function : SetShape2
//purpose :
//=======================================================================
void GEOMAlgo_CoupleOfShapes::SetShape2(const TopoDS_Shape& aS2)
{
myShape2=aS2;
}
//=======================================================================
//function : Shape1
//purpose :
//=======================================================================
const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape1()const
{
return myShape1;
}
//=======================================================================
//function : Shape2
//purpose :
//=======================================================================
const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape2()const
{
return myShape2;
}

View File

@ -0,0 +1,100 @@
// 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_CoupleOfShapes_HeaderFile
#define _GEOMAlgo_CoupleOfShapes_HeaderFile
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
class TopoDS_Shape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_CoupleOfShapes {
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_CoupleOfShapes();
Standard_EXPORT void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ;
Standard_EXPORT void SetShape1(const TopoDS_Shape& aS1) ;
Standard_EXPORT void SetShape2(const TopoDS_Shape& aS2) ;
Standard_EXPORT void Shapes(TopoDS_Shape& aS1,TopoDS_Shape& aS2) const;
Standard_EXPORT const TopoDS_Shape& Shape1() const;
Standard_EXPORT const TopoDS_Shape& Shape2() const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
TopoDS_Shape myShape1;
TopoDS_Shape myShape2;
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_CoupleOfShapes.jxx>

View File

@ -0,0 +1,6 @@
#ifndef _TopoDS_Shape_HeaderFile
#include <TopoDS_Shape.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif

View File

@ -0,0 +1,63 @@
-- File: GEOMAlgo_GlueAnalyser.cdl
-- Created: Wed Dec 15 11:03:03 2004
-- Author: Peter KURNEV
-- <pkv@irinox>
---Copyright: Matra Datavision 2004
class GlueAnalyser from GEOMAlgo
inherits Gluer from GEOMAlgo
---Purpose:
uses
ShapeEnum from TopAbs,
ListOfShape from TopTools,
ListOfCoupleOfShapes from GEOMAlgo
--raises
is
Create
returns GlueAnalyser from GEOMAlgo;
---C++: alias "Standard_EXPORT virtual ~GEOMAlgo_GlueAnalyser();"
Perform(me:out)
is redefined;
HasSolidsToGlue(me)
returns Boolean from Standard;
SolidsToGlue(me)
returns ListOfCoupleOfShapes from GEOMAlgo;
---C++:return const &
HasSolidsAlone(me)
returns Boolean from Standard;
SolidsAlone(me)
returns ListOfShape from TopTools;
---C++:return const &
DetectVertices(me:out)
is protected;
DetectEdges(me:out)
is protected;
DetectFaces(me:out)
is protected;
DetectShapes(me:out;
aType:ShapeEnum from TopAbs)
is protected;
DetectSolids (me:out)
is protected;
fields
mySolidsToGlue : ListOfCoupleOfShapes from GEOMAlgo is protected;
mySolidsAlone : ListOfShape from TopTools is protected;
end GlueAnalyser;

View File

@ -0,0 +1,439 @@
// File: GEOMAlgo_GlueDetector.cxx
// Created: Wed Dec 15 11:08:09 2004
// Author: Peter KURNEV
// <pkv@irinox>
#include <GEOMAlgo_GlueAnalyser.ixx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <GEOMAlgo_PassKey.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx>
#include <GEOMAlgo_Tools.hxx>
#include <GEOMAlgo_CoupleOfShapes.hxx>
#include <GEOMAlgo_Gluer.hxx>
#include <Bnd_HArray1OfBox.hxx>
#include <Bnd_BoundSortBox.hxx>
#include <TopoDS_Vertex.hxx>
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
#include <Bnd_Box.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <BRepBndLib.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
GEOMAlgo_GlueAnalyser::GEOMAlgo_GlueAnalyser()
:
GEOMAlgo_Gluer()
{}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
GEOMAlgo_GlueAnalyser::~GEOMAlgo_GlueAnalyser()
{}
//=======================================================================
//function : HasSolidsToGlue
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_GlueAnalyser::HasSolidsToGlue()const
{
return !mySolidsToGlue.IsEmpty();
}
//=======================================================================
//function : HasSolidsAlone
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_GlueAnalyser::HasSolidsAlone()const
{
return !mySolidsAlone.IsEmpty();
}
//=======================================================================
//function : SolidsToGlue
//purpose :
//=======================================================================
const GEOMAlgo_ListOfCoupleOfShapes& GEOMAlgo_GlueAnalyser::SolidsToGlue()const
{
return mySolidsToGlue;
}
//=======================================================================
//function : SolidsAlone
//purpose :
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_GlueAnalyser::SolidsAlone()const
{
return mySolidsAlone;
}
//=======================================================================
//function : Perform
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::Perform()
{
myErrorStatus=0;
myWarningStatus=0;
//
mySolidsToGlue.Clear();
mySolidsAlone.Clear();
//
CheckData();
if (myErrorStatus) {
return;
}
//
InnerTolerance();
if (myErrorStatus) {
return;
}
//
DetectVertices();
if (myErrorStatus) {
return;
}
//
DetectEdges();
if (myErrorStatus) {
return;
}
//
DetectFaces();
if (myErrorStatus) {
return;
}
//
DetectSolids();
if (myErrorStatus) {
return;
}
}
//=======================================================================
//function : DetectVertices
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectVertices()
{
myErrorStatus=0;
//
Standard_Integer j, i, aNbV, aIndex, aNbVSD;
TColStd_ListIteratorOfListOfInteger aIt;
Handle(Bnd_HArray1OfBox) aHAB;
Bnd_BoundSortBox aBSB;
TopoDS_Shape aSTmp, aVF;
TopoDS_Vertex aVnew;
TopTools_IndexedMapOfShape aMV, aMVProcessed;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
//
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
if (!aNbV) {
myErrorStatus=2; // no vertices in source shape
return;
}
//
aHAB=new Bnd_HArray1OfBox(1, aNbV);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
Bnd_Box aBox;
//
aBox.SetGap(myTol);
BRepBndLib::Add(aV, aBox);
aHAB->SetValue(i, aBox);
aMIS.Add(i, aV);
aMSB.Add(aV, aBox);
}
//
aBSB.Initialize(aHAB);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
//
if (aMVProcessed.Contains(aV)) {
continue;
}
//
const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV);
aNbVSD=aLI.Extent();
if (!aNbVSD) {
myErrorStatus=3; // it must not be
return;
}
//
// Images
TopTools_ListOfShape aLVSD;
//
aIt.Initialize(aLI);
for (j=0; aIt.More(); aIt.Next(), ++j) {
aIndex=aIt.Value();
const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
if(!j) {
aVF=aVx;
}
aLVSD.Append(aVx);
aMVProcessed.Add(aVx);
}
myImages.Bind(aVF, aLVSD);
}
// Origins
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
//
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
myOrigins.Bind(aVSD, aV);
}
}
}
}
//=======================================================================
//function : DetectFaces
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectFaces()
{
DetectShapes(TopAbs_FACE);
}
//=======================================================================
//function : DetectEdges
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectEdges()
{
DetectShapes(TopAbs_EDGE);
}
//=======================================================================
//function : DetectShapes
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectShapes(const TopAbs_ShapeEnum aType)
{
myErrorStatus=0;
//
Standard_Integer i, aNbF, aNbSDF, iErr;
TopoDS_Shape aNewShape;
TopTools_IndexedMapOfShape aMF;
TopTools_ListIteratorOfListOfShape aItS;
GEOMAlgo_PassKey aPKF;
GEOMAlgo_IndexedDataMapOfPassKeyListOfShape aMPKLF;
//
TopExp::MapShapes(myShape, aType, aMF);
//
aNbF=aMF.Extent();
for (i=1; i<=aNbF; ++i) {
const TopoDS_Shape& aS=aMF(i);
//
aPKF.Clear();
if (aType==TopAbs_FACE) {
const TopoDS_Face& aF=TopoDS::Face(aS);
FacePassKey(aF, aPKF);
}
else if (aType==TopAbs_EDGE) {
const TopoDS_Edge& aE=TopoDS::Edge(aS);
EdgePassKey(aE, aPKF);
}
//
if (myErrorStatus) {
return;
}
//
if (aMPKLF.Contains(aPKF)) {
TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF);
aLSDF.Append(aS);
}
else {
TopTools_ListOfShape aLSDF;
//
aLSDF.Append(aS);
aMPKLF.Add(aPKF, aLSDF);
}
}
// check geometric coincidence
if (myCheckGeometry) {
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); //XX
if (iErr) {
myErrorStatus=200;
return;
}
}
//
// Images/Origins
aNbF=aMPKLF.Extent();
for (i=1; i<=aNbF; ++i) {
const TopTools_ListOfShape& aLSDF=aMPKLF(i);
aNbSDF=aLSDF.Extent();
if (!aNbSDF) {
myErrorStatus=4; // it must not be
}
//
const TopoDS_Shape& aS1=aLSDF.First();
aNewShape=aS1;
//
myImages.Bind(aNewShape, aLSDF);
// origins
aItS.Initialize(aLSDF);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFSD=aItS.Value();
if (!myOrigins.IsBound(aFSD)) {
myOrigins.Bind(aFSD, aNewShape);
}
}
}
}
//=======================================================================
//function : DetectSolids
//purpose :
//=======================================================================
void GEOMAlgo_GlueAnalyser::DetectSolids()
{
myErrorStatus=0;
//
Standard_Integer i, aNbF, aNbS, aNbC, aNbX;
TopoDS_Compound aCmp;
BRep_Builder aBB;
TopTools_IndexedDataMapOfShapeListOfShape aMFS;
TopTools_IndexedMapOfShape aMx, aMS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
GEOMAlgo_IndexedDataMapOfPassKeyListOfShape aMPKLS;
GEOMAlgo_PassKey aPKSx;
GEOMAlgo_CoupleOfShapes aCS;
//
aBB.MakeCompound(aCmp);
//
TopExp::MapShapesAndAncestors(myShape, TopAbs_FACE, TopAbs_SOLID, aMFS);
//
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aIm=aItIm.Key();
if (aIm.ShapeType()!=TopAbs_FACE) {
continue;
}
//
const TopTools_ListOfShape& aLF=aItIm.Value();
aNbF=aLF.Extent();
if (aNbF!=2) {
continue;
}
//
TopoDS_Shape aSx[2], aFx[2];
//
aFx[0]=aLF.First();
aFx[1]=aLF.Last();
for (i=0; i<2; ++i) {
if (!aMFS.Contains(aFx[i])) {
continue;// it must not be so
}
//
const TopTools_ListOfShape& aLS=aMFS.FindFromKey(aFx[i]);
aNbS=aLS.Extent();
if (aNbS!=1) {
continue;
}
aSx[i]=aLS.First();
}
//
if (aSx[0].IsNull() || aSx[1].IsNull()) {
continue;
}
//
aPKSx.Clear();
aPKSx.SetIds(aSx[0], aSx[1]);
//
if (!aMPKLS.Contains(aPKSx)) {
TopTools_ListOfShape aLSx;
//
aLSx.Append(aSx[0]);
aLSx.Append(aSx[1]);
//
aMPKLS.Add(aPKSx, aLSx);
}
}
//
mySolidsToGlue.Clear();
mySolidsAlone.Clear();
//
aNbC=aMPKLS.Extent();
if (!aNbC) {
return;
}
//
for (i=1; i<=aNbC; ++i) {
const TopTools_ListOfShape& aLSx=aMPKLS(i);
const TopoDS_Shape& aSx1=aLSx.First();
const TopoDS_Shape& aSx2=aLSx.Last();
aCS.SetShape1(aSx1);
aCS.SetShape2(aSx2);
mySolidsToGlue.Append(aCS);
//
if (!aMx.Contains(aSx1)) {
aBB.Add(aCmp, aSx1);
aMx.Add(aSx1);
}
if (!aMx.Contains(aSx2)) {
aBB.Add(aCmp, aSx2);
aMx.Add(aSx2);
}
}
myResult=aCmp;
//
// check alone solids
TopExp::MapShapes(myShape, TopAbs_SOLID, aMS);
//
aNbX=aMx.Extent();
for (i=1; i<=aNbX; ++i) {
const TopoDS_Shape& aSx=aMx(i);
if (!aMS.Contains(aSx)) {
mySolidsAlone.Append(aSx);
}
}
}
/*
// A
// Make vertices
aMV.Clear();
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
aMV.Add(aV);
const TopTools_ListOfShape& aLVSD=aItIm.Value();
MakeVertex(aLVSD, aVnew);//ZZ
myImages.Bind(aVnew, aLVSD);
}
//
aNbV=aMV.Extent();
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
myImages.UnBind(aV);
}
//
*/

View File

@ -0,0 +1,118 @@
// 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_GlueAnalyser_HeaderFile
#define _GEOMAlgo_GlueAnalyser_HeaderFile
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _GEOMAlgo_Gluer_HeaderFile
#include <GEOMAlgo_Gluer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
class GEOMAlgo_ListOfCoupleOfShapes;
class TopTools_ListOfShape;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_GlueAnalyser : public GEOMAlgo_Gluer {
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_GlueAnalyser();
Standard_EXPORT virtual ~GEOMAlgo_GlueAnalyser();
Standard_EXPORT virtual void Perform() ;
Standard_EXPORT Standard_Boolean HasSolidsToGlue() const;
Standard_EXPORT const GEOMAlgo_ListOfCoupleOfShapes& SolidsToGlue() const;
Standard_EXPORT Standard_Boolean HasSolidsAlone() const;
Standard_EXPORT const TopTools_ListOfShape& SolidsAlone() const;
protected:
// Methods PROTECTED
//
Standard_EXPORT void DetectVertices() ;
Standard_EXPORT void DetectEdges() ;
Standard_EXPORT void DetectFaces() ;
Standard_EXPORT void DetectShapes(const TopAbs_ShapeEnum aType) ;
Standard_EXPORT void DetectSolids() ;
// Fields PROTECTED
//
GEOMAlgo_ListOfCoupleOfShapes mySolidsToGlue;
TopTools_ListOfShape mySolidsAlone;
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_GlueAnalyser.jxx>

View File

@ -0,0 +1,9 @@
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _GEOMAlgo_GlueAnalyser_HeaderFile
#include <GEOMAlgo_GlueAnalyser.hxx>
#endif

View File

@ -15,10 +15,13 @@ uses
Shape from TopoDS,
Edge from TopoDS,
Face from TopoDS,
Vertex from TopoDS,
ListOfShape from TopTools,
DataMapOfShapeShape from TopTools,
DataMapOfShapeListOfShape from TopTools,
Context from IntTools,
PassKey from GEOMAlgo
--raises
is
@ -35,15 +38,15 @@ is
Perform(me:out)
is redefined;
AloneShapes(me)
returns Integer from Standard;
CheckData(me:out)
is redefined protected;
CheckResult (me:out)
is redefined protected;
BuildResult (me:out)
is protected;
MakeVertices(me:out)
is protected;
@ -76,6 +79,10 @@ is
aPK:out PassKey from GEOMAlgo)
is protected;
MakeVertex(me:out;
aLV : ListOfShape from TopTools;
aNewV: out Vertex from TopoDS)
is protected;
MakeEdge(me:out;
aEdge : Edge from TopoDS;
aNewEdge: out Edge from TopoDS)
@ -101,13 +108,10 @@ is
---C++:return const &
fields
myCheckGeometry : Boolean from Standard is protected;
myImages : DataMapOfShapeListOfShape from TopTools is protected;
myOrigins : DataMapOfShapeShape from TopTools is protected;
myContext : Context from IntTools is protected;
myTypeResult: ShapeEnum from TopAbs is protected;
myTol : Real from Standard is protected;
myTol : Real from Standard is protected;
myImages : DataMapOfShapeListOfShape from TopTools is protected;
myOrigins : DataMapOfShapeShape from TopTools is protected;
myNbAlone : Integer from Standard is protected;
end Gluer;

View File

@ -11,6 +11,7 @@
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <gp_XYZ.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
@ -18,7 +19,6 @@
#include <Bnd_Box.hxx>
#include <Bnd_HArray1OfBox.hxx>
#include <Bnd_BoundSortBox.hxx>
#include <BRepBndLib.hxx>
#include <TopLoc_Location.hxx>
#include <TopAbs_ShapeEnum.hxx>
@ -45,11 +45,15 @@
#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRepLib.hxx>
#include <BRepTools.hxx>
#include <BRepBndLib.hxx>
#include <IntTools_Context.hxx>
#include <BOPTools_Tools.hxx>
#include <BOPTools_Tools3D.hxx>
#include <BOPTools_Tools2D.hxx>
#include <BOP_CorrectTolerances.hxx>
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
#include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
@ -68,7 +72,7 @@ GEOMAlgo_Gluer::GEOMAlgo_Gluer()
myTolerance=0.0001;
myTol=myTolerance;
myCheckGeometry=Standard_True;
myTypeResult=TopAbs_SOLID;
myNbAlone=0;
}
//=======================================================================
//function : ~GEOMAlgo_Gluer
@ -93,7 +97,14 @@ Standard_Boolean GEOMAlgo_Gluer::CheckGeometry() const
{
return myCheckGeometry;
}
//=======================================================================
//function : AloneShapes
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_Gluer::AloneShapes()const
{
return myNbAlone;
}
//=======================================================================
//function : Images
//purpose :
@ -120,118 +131,139 @@ void GEOMAlgo_Gluer::Perform()
myWarningStatus=0;
//
Standard_Integer i;
const Standard_Integer aNb=9;
const Standard_Integer aNb=8;
void (GEOMAlgo_Gluer::* pF[aNb])()={
&GEOMAlgo_Gluer::CheckData, &GEOMAlgo_Gluer::InnerTolerance,
&GEOMAlgo_Gluer::MakeVertices, &GEOMAlgo_Gluer::MakeEdges,
&GEOMAlgo_Gluer::MakeFaces, &GEOMAlgo_Gluer::MakeShells,
&GEOMAlgo_Gluer::MakeSolids, &GEOMAlgo_Gluer::BuildResult,
&GEOMAlgo_Gluer::CheckResult
&GEOMAlgo_Gluer::MakeSolids, &GEOMAlgo_Gluer::CheckResult
};
//
//TimeReset();
//StartChrono();
//
for (i=0; i<aNb; ++i) {
(this->*pF[i])();
if (myErrorStatus) {
return;
}
}
//
//StopChrono();
//TimeShow();
}
//=======================================================================
//function : CheckResult
//function : MakeVertices
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::CheckResult()
void GEOMAlgo_Gluer::MakeVertices()
{
myErrorStatus=0;
//
if (myResult.IsNull()) {
myErrorStatus=6;
Standard_Integer j, i, aNbV, aIndex, aNbVSD;
TColStd_ListIteratorOfListOfInteger aIt;
Handle(Bnd_HArray1OfBox) aHAB;
Bnd_BoundSortBox aBSB;
TopoDS_Shape aSTmp, aVF;
TopoDS_Vertex aVnew;
TopTools_IndexedMapOfShape aMV, aMVProcessed;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
//
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
if (!aNbV) {
myErrorStatus=2; // no vertices in source shape
return;
}
//
Standard_Boolean bFound;
Standard_Integer i, j, aNbS, aNbFS, aNbSx;
TopTools_IndexedMapOfShape aMS, aMFS;
TopTools_IndexedDataMapOfShapeListOfShape aMFR;
aHAB=new Bnd_HArray1OfBox(1, aNbV);
//
TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, myTypeResult, aMFR);
TopExp::MapShapes(myResult, myTypeResult, aMS);
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
Bnd_Box aBox;
//
aBox.SetGap(myTol);
BRepBndLib::Add(aV, aBox);
aHAB->SetValue(i, aBox);
aMIS.Add(i, aV);
aMSB.Add(aV, aBox);
}
//
aNbS=aMS.Extent();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Shape& aSolid=aMS(i);
aBSB.Initialize(aHAB);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
//
aMFS.Clear();
TopExp::MapShapes(aSolid, TopAbs_FACE, aMFS);
if (aMVProcessed.Contains(aV)) {
continue;
}
//
bFound=Standard_False;
aNbFS=aMFS.Extent();
for (j=1; j<=aNbFS; ++j) {
const TopoDS_Shape& aFS=aMFS(j);
if (aMFR.Contains(aFS)) {
const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
aNbSx=aLSx.Extent();
if (aNbSx==2) {
bFound=!bFound;
break;
}
const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV);
aNbVSD=aLI.Extent();
if (!aNbVSD) {
myErrorStatus=3; // it must not be
return;
}
//
// Images
//
TopTools_ListOfShape aLVSD;
//
aIt.Initialize(aLI);
for (j=0; aIt.More(); aIt.Next(), ++j) {
aIndex=aIt.Value();
const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
if(!j) {
aVF=aVx;
}
aLVSD.Append(aVx);
aMVProcessed.Add(aVx);
}
//
myImages.Bind(aVF, aLVSD);
}
//
// Make new vertices
aMV.Clear();
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
aNbVSD=aLVSD.Extent();
if (aNbVSD>1) {
aMV.Add(aV);
MakeVertex(aLVSD, aVnew);
aMVV.Bind(aVnew, aLVSD);
}
}
//
// UnBind old vertices
aNbV=aMV.Extent();
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
myImages.UnBind(aV);
}
//
// Bind new vertices
aItIm.Initialize(aMVV);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
myImages.Bind(aV, aLVSD);
}
//
// Origins
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
//
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
myOrigins.Bind(aVSD, aV);
}
}
//
if (!bFound) {
myWarningStatus=1;
break;
}
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::CheckData()
{
myErrorStatus=0;
//
if (myShape.IsNull()) {
myErrorStatus=5;
return;
}
}
//=======================================================================
//function : InnerTolerance
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::InnerTolerance()
{
myErrorStatus=0;
//
Standard_Integer i;
Standard_Real aX[3][2], dH, dHmin, aCoef, aTolTresh;
Bnd_Box aBox;
//
BRepBndLib::Add(myShape, aBox);
aBox.Get(aX[0][0], aX[1][0], aX[2][0], aX[0][1], aX[1][1], aX[2][1]);
//
dHmin=aX[0][1]-aX[0][0];
for (i=1; i<3; ++i) {
dH=aX[i][1]-aX[i][0];
if (dH<dHmin) {
dHmin=dH;
}
}
//
myTol=myTolerance;
aCoef=0.01;
aTolTresh=aCoef*dHmin;
if (myTol>aTolTresh) {
myTol=aTolTresh;
}
}
//=======================================================================
@ -242,17 +274,25 @@ void GEOMAlgo_Gluer::MakeSolids()
{
myErrorStatus=0;
//
Standard_Integer i, aNbS;
Standard_Integer aNbS;
TopAbs_Orientation anOr;
TopoDS_Compound aCmp;
TopoDS_Solid aNewSolid;
TopTools_IndexedMapOfShape aMS;
TopExp_Explorer aExp;
TopExp_Explorer aExpS, aExp;
BRep_Builder aBB;
//
TopExp::MapShapes(myShape, TopAbs_SOLID, aMS);
aBB.MakeCompound(aCmp);
//
aNbS=aMS.Extent();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Solid& aSolid=TopoDS::Solid(aMS(i));
aExpS.Init(myShape, TopAbs_SOLID);
for (; aExpS.More(); aExpS.Next()) {
const TopoDS_Solid& aSolid=TopoDS::Solid(aExpS.Current());
if (aMS.Contains(aSolid)) {
continue;
}
aMS.Add(aSolid);
//
anOr=aSolid.Orientation();
//
aBB.MakeSolid(aNewSolid);
@ -264,11 +304,22 @@ void GEOMAlgo_Gluer::MakeSolids()
const TopoDS_Shape& aShellR=myOrigins.Find(aShell);
aBB.Add(aNewSolid, aShellR);
}
//
TopTools_ListOfShape aLS;
//
aLS.Append(aSolid);
myImages.Bind(aNewSolid, aLS);
myOrigins.Bind(aSolid, aNewSolid);
//
aBB.Add(aCmp, aNewSolid);
}
//
myResult=aCmp;
//
aNbS=aMS.Extent();
if (aNbS) {
Standard_Real aTol=1.e-7;
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
}
}
//=======================================================================
@ -383,7 +434,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
}
// check geometric coincidence
if (myCheckGeometry) {
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext); //XX
iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext);
if (iErr) {
myErrorStatus=200;
return;
@ -427,116 +478,101 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
}
}
//=======================================================================
//function : MakeVertices
//function : CheckResult
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeVertices()
void GEOMAlgo_Gluer::CheckResult()
{
myErrorStatus=0;
//
Standard_Boolean bFound;
Standard_Integer i, aNbV, aIndex, aNbVSD;
TColStd_ListIteratorOfListOfInteger aIt;
Handle(Bnd_HArray1OfBox) aHAB;
Bnd_BoundSortBox aBSB;
TopoDS_Shape aSTmp;
TopTools_IndexedMapOfShape aMV;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
//
TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
if (!aNbV) {
myErrorStatus=2; // no vertices in source shape
if (myResult.IsNull()) {
myErrorStatus=6;
return;
}
//
aHAB=new Bnd_HArray1OfBox(1, aNbV);
Standard_Boolean bFound;
Standard_Integer i, j, aNbS, aNbFS, aNbSx;
TopTools_IndexedMapOfShape aMS, aMFS;
TopTools_IndexedDataMapOfShapeListOfShape aMFR;
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
Bnd_Box aBox;
TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, TopAbs_SOLID, aMFR);
TopExp::MapShapes(myResult, TopAbs_SOLID, aMS);
//
myNbAlone=0;
aNbS=aMS.Extent();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Shape& aSolid=aMS(i);
//
aBox.SetGap(myTol);//XX
BRepBndLib::Add(aV, aBox);
aHAB->SetValue(i, aBox);
aMIS.Add(i, aV);
aMSB.Add(aV, aBox);
}
//
aBSB.Initialize(aHAB);
//
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV);
aNbVSD=aLI.Extent();
if (!aNbVSD) {
myErrorStatus=3; // it must not be
return;
}
//
// Images
TopTools_ListOfShape aLVSD;
TopoDS_Shape aVF;
aMFS.Clear();
TopExp::MapShapes(aSolid, TopAbs_FACE, aMFS);
//
bFound=Standard_False;
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
aIndex=aIt.Value();
const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
if (myImages.IsBound(aVx)) {
bFound=Standard_True;
aVF=aVx;
aNbFS=aMFS.Extent();
for (j=1; j<=aNbFS; ++j) {
const TopoDS_Shape& aFS=aMFS(j);
if (aMFR.Contains(aFS)) {
const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
aNbSx=aLSx.Extent();
if (aNbSx==2) {
bFound=!bFound;
break;
}
}
aLVSD.Append(aVx);
}
if (bFound) {
TopTools_ListOfShape& aLVI=myImages.ChangeFind(aVF);
aLVI.Append(aLVSD);
}
else {
myImages.Bind(aV, aLVSD);
}
}
//
// Refine Images
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
TopTools_ListOfShape aLVSDNew;
TopTools_MapOfShape aM;
//
const TopoDS_Shape& aV=aItIm.Key();
const TopTools_ListOfShape& aLVSD=aItIm.Value();
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (aM.Add(aVSD)) {
aLVSDNew.Append(aVSD);
}
if (!bFound) {
myWarningStatus=1;
++myNbAlone;
//break;
}
TopTools_ListOfShape& aLVI=myImages.ChangeFind(aV);
aLVI.Clear();
aLVI.Append(aLVSDNew);
}
}
//=======================================================================
//function : CheckData
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::CheckData()
{
myErrorStatus=0;
//
// Origins
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aV=aItIm.Key();
//
const TopTools_ListOfShape& aLVSD=myImages.Find(aV);
aItS.Initialize(aLVSD);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
myOrigins.Bind(aVSD, aV);
}
if (myShape.IsNull()) {
myErrorStatus=5;
return;
}
}
//=======================================================================
//function : InnerTolerance
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::InnerTolerance()
{
myErrorStatus=0;
//
/*
Standard_Integer i;
Standard_Real aX[3][2], dH, dHmin, aCoef, aTolTresh;
Bnd_Box aBox;
//
BRepBndLib::Add(myShape, aBox);
aBox.Get(aX[0][0], aX[1][0], aX[2][0], aX[0][1], aX[1][1], aX[2][1]);
//
dHmin=aX[0][1]-aX[0][0];
for (i=1; i<3; ++i) {
dH=aX[i][1]-aX[i][0];
if (dH<dHmin) {
dHmin=dH;
}
}
//
myTol=myTolerance;
aCoef=0.01;
aTolTresh=aCoef*dHmin;
if (myTol>aTolTresh) {
myTol=aTolTresh;
}
*/
myTol=myTolerance;
}
//=======================================================================
//function : FacePassKey
@ -588,6 +624,52 @@ void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
aPK.SetIds(aVR1, aVR2);
}
//=======================================================================
//function : MakeVertex
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
TopoDS_Vertex& aNewVertex)
{
Standard_Integer aNbV;
Standard_Real aTolV, aD, aDmax;
gp_XYZ aGC;
gp_Pnt aP3D, aPGC;
TopoDS_Vertex aVx;
BRep_Builder aBB;
TopTools_ListIteratorOfListOfShape aIt;
//
aNbV=aLV.Extent();
if (!aNbV) {
return;
}
//
// center of gravity
aGC.SetCoord(0.,0.,0.);
aIt.Initialize(aLV);
for (; aIt.More(); aIt.Next()) {
aVx=TopoDS::Vertex(aIt.Value());
aP3D=BRep_Tool::Pnt(aVx);
aGC+=aP3D.XYZ();
}
aGC/=(Standard_Real)aNbV;
aPGC.SetXYZ(aGC);
//
// tolerance value
aDmax=-1.;
aIt.Initialize(aLV);
for (; aIt.More(); aIt.Next()) {
aVx=TopoDS::Vertex(aIt.Value());
aP3D=BRep_Tool::Pnt(aVx);
aTolV=BRep_Tool::Tolerance(aVx);
aD=aPGC.Distance(aP3D)+aTolV;
if (aD>aDmax) {
aDmax=aD;
}
}
//
aBB.MakeVertex (aNewVertex, aPGC, aDmax);
}
//=======================================================================
//function : MakeEdge
//purpose :
//=======================================================================
@ -625,13 +707,14 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
{
myErrorStatus=0;
//
Standard_Boolean bIsToReverse;
Standard_Real aTol;
Standard_Boolean bIsToReverse, bIsUPeriodic;
Standard_Real aTol, aUMin, aUMax, aVMin, aVMax;
TopoDS_Edge aER;
TopoDS_Wire newWire;
TopoDS_Face aFFWD, newFace;
TopLoc_Location aLoc;
Handle(Geom_Surface) aS;
Handle(Geom2d_Curve) aC2D;
TopExp_Explorer aExpW, aExpE;
BRep_Builder aBB;
//
@ -639,7 +722,9 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
aFFWD.Orientation(TopAbs_FORWARD);
//
aS=BRep_Tool::Surface(aFFWD, aLoc);
bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
aTol=BRep_Tool::Tolerance(aFFWD);
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
//
aBB.MakeFace (newFace, aS, aLoc, aTol);
//
@ -653,7 +738,11 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
aER=TopoDS::Edge(myOrigins.Find(aE));
aER.Orientation(TopAbs_FORWARD);
// build p-curve
if (bIsUPeriodic) {
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
}
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
// orient image
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
if (bIsToReverse) {
@ -708,29 +797,7 @@ Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
return (aScPr<0.);
}
//
//=======================================================================
//function : BuildResult
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::BuildResult()
{
TopoDS_Compound aCmp;
BRep_Builder aBB;
TopAbs_ShapeEnum aType;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
//
aBB.MakeCompound(aCmp);
//
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aIm=aItIm.Key();
aType=aIm.ShapeType();
if(aType==myTypeResult) {
aBB.Add(aCmp, aIm);
}
}
myResult=aCmp;
}
//
// ErrorStatus
//
@ -748,81 +815,37 @@ void GEOMAlgo_Gluer::BuildResult()
//
// 1 - some shapes can not be glued by faces
//
/*
//
// CHRONOMETER
//
#include <Standard_Static.hxx>
#include <OSD_Chronometer.hxx>
static Standard_Real S_ChronoTime;
Standard_STATIC(OSD_Chronometer, S_Chrono);
static void StartChrono();
static void StopChrono();
static void TimeShow();
static void TimeReset();
static int HasChrono();
//=======================================================================
//function : StartChrono
//function : BuildResult
//purpose :
//=======================================================================
void StartChrono()
void GEOMAlgo_Gluer::BuildResult()
{
if (HasChrono()){
S_Chrono().Reset();
S_Chrono().Start();
}
}
//=======================================================================
//function : StopChrono
//purpose :
//=======================================================================
void StopChrono()
{
if (HasChrono()) {
Standard_Real Chrono;
S_Chrono().Stop();
S_Chrono().Show(Chrono);
//
S_ChronoTime+=Chrono;
}
}
//=======================================================================
//function : TimeReset
//purpose :
//=======================================================================
void TimeReset()
{
if (HasChrono()){
S_ChronoTime=0;
}
}
//=======================================================================
//function : TimeShow
//purpose :
//=======================================================================
void TimeShow()
{
if (HasChrono()){
cout << "Tps: " << S_ChronoTime << endl;
}
}
//=======================================================================
//function : HasChrono
//purpose :
//=======================================================================
int HasChrono()
{
char *xr=getenv ("XCHRONO");
if (xr!=NULL){
if (!strcmp (xr, "yes")) {
return 1;
Standard_Boolean bAdded;
TopoDS_Compound aCmp;
BRep_Builder aBB;
TopAbs_ShapeEnum aType;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
//
aBB.MakeCompound(aCmp);
//
bAdded=Standard_False;
aItIm.Initialize(myImages);
for (; aItIm.More(); aItIm.Next()) {
const TopoDS_Shape& aIm=aItIm.Key();
aType=aIm.ShapeType();
if(aType==TopAbs_SOLID) {
bAdded=Standard_True;
aBB.Add(aCmp, aIm);
}
}
return 0;
myResult=aCmp;
//
if (bAdded) {
Standard_Real aTol=1.e-7;
BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
//BRepLib::SameParameter(myResult, aTol, bAdded);
}
}
*/

View File

@ -25,27 +25,29 @@
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeShape_HeaderFile
#include <TopTools_DataMapOfShapeShape.hxx>
#endif
#ifndef _IntTools_Context_HeaderFile
#include <IntTools_Context.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
#ifndef _Standard_Real_HeaderFile
#include <Standard_Real.hxx>
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
#include <GEOMAlgo_ShapeAlgo.hxx>
#endif
#ifndef _TopAbs_ShapeEnum_HeaderFile
#include <TopAbs_ShapeEnum.hxx>
#endif
class TopoDS_Edge;
class GEOMAlgo_PassKey;
class TopoDS_Face;
class TopTools_ListOfShape;
class TopoDS_Vertex;
class TopTools_DataMapOfShapeListOfShape;
class TopTools_DataMapOfShapeShape;
@ -80,6 +82,7 @@ Standard_EXPORT virtual ~GEOMAlgo_Gluer();
Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;
Standard_EXPORT Standard_Boolean CheckGeometry() const;
Standard_EXPORT virtual void Perform() ;
Standard_EXPORT Standard_Integer AloneShapes() const;
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const;
Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const;
@ -93,7 +96,6 @@ protected:
//
Standard_EXPORT virtual void CheckData() ;
Standard_EXPORT virtual void CheckResult() ;
Standard_EXPORT void BuildResult() ;
Standard_EXPORT void MakeVertices() ;
Standard_EXPORT void MakeEdges() ;
Standard_EXPORT void MakeFaces() ;
@ -103,6 +105,7 @@ Standard_EXPORT void MakeSolids() ;
Standard_EXPORT void InnerTolerance() ;
Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,GEOMAlgo_PassKey& aPK) ;
Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,GEOMAlgo_PassKey& aPK) ;
Standard_EXPORT void MakeVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex& aNewV) ;
Standard_EXPORT void MakeEdge(const TopoDS_Edge& aEdge,TopoDS_Edge& aNewEdge) ;
Standard_EXPORT void MakeFace(const TopoDS_Face& aFace,TopoDS_Face& aNewEdge) ;
Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const TopoDS_Face& aF) ;
@ -111,11 +114,10 @@ Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const Topo
// Fields PROTECTED
//
Standard_Boolean myCheckGeometry;
Standard_Real myTol;
TopTools_DataMapOfShapeListOfShape myImages;
TopTools_DataMapOfShapeShape myOrigins;
IntTools_Context myContext;
TopAbs_ShapeEnum myTypeResult;
Standard_Real myTol;
Standard_Integer myNbAlone;
private:

View File

@ -7,6 +7,12 @@
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
#ifndef _TopTools_ListOfShape_HeaderFile
#include <TopTools_ListOfShape.hxx>
#endif
#ifndef _TopoDS_Vertex_HeaderFile
#include <TopoDS_Vertex.hxx>
#endif
#ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#endif

View File

@ -0,0 +1,131 @@
// 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_ListIteratorOfListOfCoupleOfShapes_HeaderFile
#define _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile
#ifndef _Standard_Address_HeaderFile
#include <Standard_Address.hxx>
#endif
#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class Standard_NoMoreObject;
class Standard_NoSuchObject;
class GEOMAlgo_ListOfCoupleOfShapes;
class GEOMAlgo_CoupleOfShapes;
class GEOMAlgo_ListNodeOfListOfCoupleOfShapes;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes {
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_ListIteratorOfListOfCoupleOfShapes();
Standard_EXPORT GEOMAlgo_ListIteratorOfListOfCoupleOfShapes(const GEOMAlgo_ListOfCoupleOfShapes& L);
Standard_EXPORT void Initialize(const GEOMAlgo_ListOfCoupleOfShapes& L) ;
Standard_Boolean More() const;
Standard_EXPORT void Next() ;
Standard_EXPORT GEOMAlgo_CoupleOfShapes& Value() const;
friend class GEOMAlgo_ListOfCoupleOfShapes;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
Standard_Address current;
Standard_Address previous;
};
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_ListIterator.lxx>
#undef Item
#undef Item_hxx
#undef TCollection_ListNode
#undef TCollection_ListNode_hxx
#undef TCollection_ListIterator
#undef TCollection_ListIterator_hxx
#undef Handle_TCollection_ListNode
#undef TCollection_ListNode_Type_
#undef TCollection_List
#undef TCollection_List_hxx
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,52 @@
// 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_ListIteratorOfListOfCoupleOfShapes.hxx>
#ifndef _Standard_NoMoreObject_HeaderFile
#include <Standard_NoMoreObject.hxx>
#endif
#ifndef _Standard_NoSuchObject_HeaderFile
#include <Standard_NoSuchObject.hxx>
#endif
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_ListIterator.gxx>

View File

@ -0,0 +1,130 @@
// File generated by CPPExt (Transient)
//
//
// 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_ListNodeOfListOfCoupleOfShapes_HeaderFile
#define _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif
#ifndef _TCollection_MapNode_HeaderFile
#include <TCollection_MapNode.hxx>
#endif
#ifndef _TCollection_MapNodePtr_HeaderFile
#include <TCollection_MapNodePtr.hxx>
#endif
class GEOMAlgo_CoupleOfShapes;
class GEOMAlgo_ListOfCoupleOfShapes;
class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes;
class GEOMAlgo_ListNodeOfListOfCoupleOfShapes : public TCollection_MapNode {
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
//
GEOMAlgo_ListNodeOfListOfCoupleOfShapes(const GEOMAlgo_CoupleOfShapes& I,const TCollection_MapNodePtr& n);
GEOMAlgo_CoupleOfShapes& Value() const;
Standard_EXPORT ~GEOMAlgo_ListNodeOfListOfCoupleOfShapes();
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
// Fields PRIVATE
//
GEOMAlgo_CoupleOfShapes myValue;
};
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_ListNode.lxx>
#undef Item
#undef Item_hxx
#undef TCollection_ListNode
#undef TCollection_ListNode_hxx
#undef TCollection_ListIterator
#undef TCollection_ListIterator_hxx
#undef Handle_TCollection_ListNode
#undef TCollection_ListNode_Type_
#undef TCollection_List
#undef TCollection_List_hxx
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,98 @@
// File generated by CPPExt (Transient)
//
// 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_ListNodeOfListOfCoupleOfShapes.hxx>
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#endif
GEOMAlgo_ListNodeOfListOfCoupleOfShapes::~GEOMAlgo_ListNodeOfListOfCoupleOfShapes() {}
Standard_EXPORT Handle_Standard_Type& GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TCollection_MapNode);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TCollection_MapNode);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOMAlgo_ListNodeOfListOfCoupleOfShapes",
sizeof(GEOMAlgo_ListNodeOfListOfCoupleOfShapes),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
// DownCast method
// allow safe downcasting
//
const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes))) {
_anOtherObject = Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)((Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)&)AnObject);
}
}
return _anOtherObject ;
}
const Handle(Standard_Type)& GEOMAlgo_ListNodeOfListOfCoupleOfShapes::DynamicType() const
{
return STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) ;
}
Standard_Boolean GEOMAlgo_ListNodeOfListOfCoupleOfShapes::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) == AType || TCollection_MapNode::IsKind(AType));
}
Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes::~Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes() {}
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_ListNode.gxx>

View File

@ -0,0 +1,157 @@
// 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_ListOfCoupleOfShapes_HeaderFile
#define _GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
#ifndef _Standard_Address_HeaderFile
#include <Standard_Address.hxx>
#endif
#ifndef _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class Standard_NoSuchObject;
class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes;
class GEOMAlgo_CoupleOfShapes;
class GEOMAlgo_ListNodeOfListOfCoupleOfShapes;
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
class GEOMAlgo_ListOfCoupleOfShapes {
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_ListOfCoupleOfShapes();
Standard_EXPORT void Assign(const GEOMAlgo_ListOfCoupleOfShapes& Other) ;
void operator=(const GEOMAlgo_ListOfCoupleOfShapes& Other)
{
Assign(Other);
}
Standard_EXPORT Standard_Integer Extent() const;
Standard_EXPORT void Clear() ;
~GEOMAlgo_ListOfCoupleOfShapes()
{
Clear();
}
Standard_Boolean IsEmpty() const;
Standard_EXPORT void Prepend(const GEOMAlgo_CoupleOfShapes& I) ;
Standard_EXPORT void Prepend(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& theIt) ;
Standard_EXPORT void Prepend(GEOMAlgo_ListOfCoupleOfShapes& Other) ;
Standard_EXPORT void Append(const GEOMAlgo_CoupleOfShapes& I) ;
Standard_EXPORT void Append(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& theIt) ;
Standard_EXPORT void Append(GEOMAlgo_ListOfCoupleOfShapes& Other) ;
Standard_EXPORT GEOMAlgo_CoupleOfShapes& First() const;
Standard_EXPORT GEOMAlgo_CoupleOfShapes& Last() const;
Standard_EXPORT void RemoveFirst() ;
Standard_EXPORT void Remove(GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
Standard_EXPORT void InsertBefore(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
Standard_EXPORT void InsertBefore(GEOMAlgo_ListOfCoupleOfShapes& Other,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
Standard_EXPORT void InsertAfter(const GEOMAlgo_CoupleOfShapes& I,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
Standard_EXPORT void InsertAfter(GEOMAlgo_ListOfCoupleOfShapes& Other,GEOMAlgo_ListIteratorOfListOfCoupleOfShapes& It) ;
friend class GEOMAlgo_ListIteratorOfListOfCoupleOfShapes;
protected:
// Methods PROTECTED
//
// Fields PROTECTED
//
private:
// Methods PRIVATE
//
Standard_EXPORT GEOMAlgo_ListOfCoupleOfShapes(const GEOMAlgo_ListOfCoupleOfShapes& Other);
// Fields PRIVATE
//
Standard_Address myFirst;
Standard_Address myLast;
};
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_List.lxx>
#undef Item
#undef Item_hxx
#undef TCollection_ListNode
#undef TCollection_ListNode_hxx
#undef TCollection_ListIterator
#undef TCollection_ListIterator_hxx
#undef Handle_TCollection_ListNode
#undef TCollection_ListNode_Type_
#undef TCollection_List
#undef TCollection_List_hxx
// other Inline functions and methods (like "C++: function call" methods)
//
#endif

View File

@ -0,0 +1,49 @@
// 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_ListOfCoupleOfShapes.hxx>
#ifndef _Standard_NoSuchObject_HeaderFile
#include <Standard_NoSuchObject.hxx>
#endif
#ifndef _GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
#include <GEOMAlgo_CoupleOfShapes.hxx>
#endif
#ifndef _GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#include <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#endif
#define Item GEOMAlgo_CoupleOfShapes
#define Item_hxx <GEOMAlgo_CoupleOfShapes.hxx>
#define TCollection_ListNode GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_hxx <GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx>
#define TCollection_ListIterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes
#define TCollection_ListIterator_hxx <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
#define Handle_TCollection_ListNode Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes
#define TCollection_ListNode_Type_() GEOMAlgo_ListNodeOfListOfCoupleOfShapes_Type_()
#define TCollection_List GEOMAlgo_ListOfCoupleOfShapes
#define TCollection_List_hxx <GEOMAlgo_ListOfCoupleOfShapes.hxx>
#include <TCollection_List.gxx>

View File

@ -11,6 +11,7 @@ class Tools from GEOMAlgo
uses
Pnt from gp,
Surface from Geom,
Edge from TopoDS,
Face from TopoDS,
Shape from TopoDS,
@ -72,6 +73,16 @@ is
aU :Real from Standard;
aV :Real from Standard;
aP3D:out Pnt from gp);
RefinePCurveForEdgeOnFace (myclass;
aE : Edge from TopoDS;
aF : Face from TopoDS;
aU1 : Real from Standard;
aU2 : Real from Standard);
IsUPeriodic(myclass;
aS:Surface from Geom)
returns Boolean from Standard;
--fields
end Tools;

View File

@ -6,9 +6,12 @@
#include <GEOMAlgo_Tools.ixx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <Geom_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
@ -23,7 +26,7 @@
#include <TopTools_IndexedMapOfShape.hxx>
#include <BRep_Tool.hxx>
#include <BOPTools_Tools2D.hxx>
#include <BRep_Builder.hxx>
#include <BRepTools.hxx>
#include <BOPTools_Tools2D.hxx>
@ -31,7 +34,7 @@
#include <GEOMAlgo_PassKey.hxx>
#include <GEOMAlgo_IndexedDataMapOfPassKeyListOfShape.hxx>
//
//=======================================================================
//function : RefineSDShapes
//purpose :
@ -314,84 +317,55 @@ void GEOMAlgo_Tools::PointOnEdge(const TopoDS_Edge& aE,
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
aC3D->D0(aT, aP3D);
}
/*
//=======================================================================
//function : FindSDEdges
//function : RefinePCurveForEdgeOnFace
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_Tools::FindSDEdges(const TopoDS_Edge& aE1,
const TopTools_ListOfShape& aLE,
const Standard_Real aTol,
TopTools_ListOfShape& aLESD,
IntTools_Context& aCtx)
void GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
const TopoDS_Face& aF,
const Standard_Real aUMin,
const Standard_Real aUMax)
{
Standard_Boolean bIsDone;
Standard_Real aT2, aTol2, aD2;
gp_Pnt aP1, aP2;
TopTools_ListIteratorOfListOfShape aIt;
Standard_Real aT1, aT2, aTx, aUx, aTol, aTwoPI;
gp_Pnt2d aP2D;
Handle(Geom_Surface) aS;
Handle(Geom2d_Curve) aC2D;
BRep_Builder aBB;
//
aTol2=aTol*aTol;
aTwoPI=PI+PI;
//
GEOMAlgo_Tools::PointOnEdge(aE1, aP1);
aIt.Initialize(aLE);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE2=TopoDS::Edge(aIt.Value());
if (aE2.IsSame(aE1)) {
aLESD.Append(aE2);
aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
if (!aC2D.IsNull()) {
if (BRep_Tool::IsClosed(aE, aF)) {
return;
}
else {
bIsDone=aCtx.ProjectPointOnEdge(aP1, aE2, aT2);
if (!bIsDone) {
return 1;
}
GEOMAlgo_Tools::PointOnEdge(aE2, aT2, aP2);
aD2=aP1.SquareDistance(aP2);
if(aD2<aTol2) {
aLESD.Append(aE2);
}
}
}
return 0;
}
//=======================================================================
//function : FindSDFaces
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_Tools::FindSDFaces(const TopoDS_Face& aF1,
const TopTools_ListOfShape& aLF,
const Standard_Real aTol,
TopTools_ListOfShape& aLFSD,
IntTools_Context& aCtx)
{
Standard_Boolean bIsDone;
Standard_Real aTol2, aD2;
gp_Pnt aP1, aP2;
TopTools_ListIteratorOfListOfShape aIt;
//
aTol2=aTol*aTol;
//
GEOMAlgo_Tools::PointOnFace(aF1, aP1);
aIt.Initialize(aLF);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Face& aF2=TopoDS::Face(aIt.Value());
if (aF2.IsSame(aF1)) {
aLFSD.Append(aF2);
}
else {
GeomAPI_ProjectPointOnSurf& aProj=aCtx.ProjPS(aF2);
aProj.Perform(aP1);
bIsDone=aProj.IsDone();
if (!bIsDone) {
return 1; //??
}
aTx=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
aC2D->D0(aTx, aP2D);
aUx=aP2D.X();
if (aUx < aUMin || aUx > aUMax) {
// need to rebuild
Handle(Geom2d_Curve) aC2Dx;
//
aP2=aProj.NearestPoint();
aD2=aP1.SquareDistance(aP2);
if(aD2<aTol2) {
aLFSD.Append(aF2);
}
aTol=BRep_Tool::Tolerance(aE);
aBB.UpdateEdge(aE, aC2Dx, aF, aTol);
}
}
return 0;
}
*/
//=======================================================================
//function : IsUPeriodic
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_Tools::IsUPeriodic(const Handle(Geom_Surface) &aS)
{
Standard_Boolean bRet;
GeomAbs_SurfaceType aType;
GeomAdaptor_Surface aGAS;
//
aGAS.Load(aS);
aType=aGAS.GetType();
bRet=(aType==GeomAbs_Cylinder||
aType==GeomAbs_Cone ||
aType==GeomAbs_Sphere);
//
return bRet;
}

View File

@ -31,6 +31,9 @@
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Handle_Geom_Surface_HeaderFile
#include <Handle_Geom_Surface.hxx>
#endif
class GEOMAlgo_IndexedDataMapOfPassKeyListOfShape;
class IntTools_Context;
class TopTools_ListOfShape;
@ -39,6 +42,7 @@ class TopoDS_Shape;
class gp_Pnt;
class TopoDS_Edge;
class TopoDS_Face;
class Geom_Surface;
#ifndef _Standard_HeaderFile
@ -75,6 +79,8 @@ Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,gp_Pnt& aP3D) ;
Standard_EXPORT static void PointOnEdge(const TopoDS_Edge& aE,const Standard_Real aT,gp_Pnt& aP3D) ;
Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,gp_Pnt& aP3D) ;
Standard_EXPORT static void PointOnFace(const TopoDS_Face& aF,const Standard_Real aU,const Standard_Real aV,gp_Pnt& aP3D) ;
Standard_EXPORT static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,const TopoDS_Face& aF,const Standard_Real aU1,const Standard_Real aU2) ;
Standard_EXPORT static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface)& aS) ;

View File

@ -22,6 +22,9 @@
#ifndef _TopoDS_Face_HeaderFile
#include <TopoDS_Face.hxx>
#endif
#ifndef _Geom_Surface_HeaderFile
#include <Geom_Surface.hxx>
#endif
#ifndef _GEOMAlgo_Tools_HeaderFile
#include <GEOMAlgo_Tools.hxx>
#endif

View File

@ -0,0 +1,91 @@
// File generated by CPPExt (Transient)
//
// 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 _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#define _Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes_HeaderFile
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Handle_TCollection_MapNode_HeaderFile
#include <Handle_TCollection_MapNode.hxx>
#endif
class Standard_Transient;
class Handle_Standard_Type;
class Handle(TCollection_MapNode);
class GEOMAlgo_ListNodeOfListOfCoupleOfShapes;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMAlgo_ListNodeOfListOfCoupleOfShapes);
class Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) : public Handle(TCollection_MapNode) {
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);
}
Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)():Handle(TCollection_MapNode)() {}
Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)(const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)& aHandle) : Handle(TCollection_MapNode)(aHandle)
{
}
Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)(const GEOMAlgo_ListNodeOfListOfCoupleOfShapes* anItem) : Handle(TCollection_MapNode)((TCollection_MapNode *)anItem)
{
}
Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)& operator=(const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)& aHandle)
{
Assign(aHandle.Access());
return *this;
}
Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)& operator=(const GEOMAlgo_ListNodeOfListOfCoupleOfShapes* anItem)
{
Assign((Standard_Transient *)anItem);
return *this;
}
GEOMAlgo_ListNodeOfListOfCoupleOfShapes* operator->()
{
return (GEOMAlgo_ListNodeOfListOfCoupleOfShapes *)ControlAccess();
}
GEOMAlgo_ListNodeOfListOfCoupleOfShapes* operator->() const
{
return (GEOMAlgo_ListNodeOfListOfCoupleOfShapes *)ControlAccess();
}
Standard_EXPORT ~Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes)();
Standard_EXPORT static const Handle(GEOMAlgo_ListNodeOfListOfCoupleOfShapes) DownCast(const Handle(Standard_Transient)& AnObject);
};
#endif

View File

@ -37,6 +37,8 @@ VPATH=.:@srcdir@
LIB = libGEOMAlgo.la
LIB_SRC = \
GEOMAlgo_Algo.cxx \
GEOMAlgo_CoupleOfShapes.cxx \
GEOMAlgo_GlueAnalyser.cxx \
GEOMAlgo_Gluer.cxx \
GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \
GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfPassKeyListOfShape_0.cxx \
@ -44,6 +46,9 @@ LIB_SRC = \
GEOMAlgo_IndexedDataMapOfIntegerShape_0.cxx \
GEOMAlgo_IndexedDataMapOfPassKeyListOfShape_0.cxx \
GEOMAlgo_IndexedDataMapOfShapeBox_0.cxx \
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes_0.cxx \
GEOMAlgo_ListNodeOfListOfCoupleOfShapes_0.cxx \
GEOMAlgo_ListOfCoupleOfShapes_0.cxx \
GEOMAlgo_PassKey.cxx \
GEOMAlgo_PassKeyMapHasher.cxx \
GEOMAlgo_ShapeAlgo.cxx \
@ -56,7 +61,12 @@ LIB_SERVER_IDL =
EXPORT_HEADERS = \
GEOMAlgo_Gluer.hxx \
GEOMAlgo_ShapeAlgo.hxx \
GEOMAlgo_Algo.hxx
GEOMAlgo_Algo.hxx \
GEOMAlgo_GlueAnalyser.hxx \
GEOMAlgo_CoupleOfShapes.hxx \
GEOMAlgo_ListOfCoupleOfShapes.hxx \
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx \
Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx
# idl files
EXPORT_IDLS=