22852: EDF 9937 GEOM: Kind of shape unrecognized when importing step files

This commit is contained in:
eap 2015-04-27 17:03:33 +03:00
parent 59b5446863
commit 7760eb2714
21 changed files with 789 additions and 733 deletions

View File

@ -59,7 +59,10 @@ SET(GEOMAlgo_HEADERS
GEOMAlgo_DataMapOfPassKeyInteger.hxx
GEOMAlgo_DataMapOfShapeMapOfShape.hxx
GEOMAlgo_DataMapOfShapePnt.hxx
GEOMAlgo_FinderShapeOn.hxx
GEOMAlgo_FinderShapeOn1.hxx
GEOMAlgo_FinderShapeOn2.hxx
GEOMAlgo_FinderShapeOnQuad.hxx
GEOMAlgo_GetInPlace.hxx
GEOMAlgo_GetInPlaceAPI.hxx
GEOMAlgo_GlueAnalyser.hxx
@ -77,6 +80,7 @@ SET(GEOMAlgo_HEADERS
GEOMAlgo_IndexedDataMapOfShapeState.hxx
GEOMAlgo_KindOfBounds.hxx
GEOMAlgo_KindOfClosed.hxx
GEOMAlgo_KindOfDef.hxx
GEOMAlgo_KindOfName.hxx
GEOMAlgo_KindOfShape.hxx
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx

View File

@ -11,25 +11,28 @@ GEOMAlgo_ShellSolid.cxx
GEOMAlgo_AlgoTools.hxx
GEOMAlgo_AlgoTools.cxx
GEOMAlgo_AlgoTools_1.cxx
GEOMAlgo_AlgoTools_2.cxx
GEOMAlgo_SolidSolid.hxx
GEOMAlgo_SolidSolid.cxx
GEOMAlgo_ShapeAlgo.hxx
GEOMAlgo_ShapeAlgo.cxx
GEOMAlgo_FinderShapeOn.hxx
GEOMAlgo_FinderShapeOn.cxx
GEOMAlgo_FinderShapeOn1.hxx
GEOMAlgo_FinderShapeOn1.cxx
GEOMAlgo_HAlgo.hxx
GEOMAlgo_HAlgo.cxx
GEOMAlgo_Clsf.hxx
GEOMAlgo_Clsf.cxx
GEOMAlgo_ClsfBox.hxx
GEOMAlgo_ClsfBox.cxx
GEOMAlgo_ClsfQuad.hxx
GEOMAlgo_ClsfQuad.cxx
GEOMAlgo_ClsfSolid.hxx
GEOMAlgo_ClsfSolid.cxx
GEOMAlgo_ClsfSurf.hxx
GEOMAlgo_ClsfSurf.cxx
GEOMAlgo_FinderShapeOn2.hxx
GEOMAlgo_FinderShapeOn2.cxx
GEOMAlgo_FinderShapeOnQuad.hxx
GEOMAlgo_FinderShapeOnQuad.cxx
GEOMAlgo_Gluer.hxx
GEOMAlgo_Gluer.cxx
GEOMAlgo_GlueAnalyser.hxx
@ -50,8 +53,6 @@ GEOMAlgo_GetInPlace.cxx
GEOMAlgo_GetInPlace_1.cxx
GEOMAlgo_GetInPlace_2.cxx
GEOMAlgo_GetInPlace_3.cxx
GEOMAlgo_GetInPlaceAPI.hxx
GEOMAlgo_GetInPlaceAPI.cxx
GEOMAlgo_Splitter.hxx
GEOMAlgo_Splitter.cxx
GEOMAlgo_ShapeInfoFiller.hxx
@ -106,3 +107,5 @@ GEOMAlgo_ShapeInfo.cxx
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
Basics_OCCTVersion.hxx
GEOMAlgo_KindOfDef.hxx

0
src/GEOMAlgo/GEOMAlgo.cdl Executable file → Normal file
View File

13
src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx Executable file → Normal file
View File

@ -700,7 +700,7 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
return 0; // Nothing to do
}
//
while(1) {
for(;;) {
aNbEProcessed=aMProcessed.Extent();
if (aNbEProcessed==aNbE) {
break;
@ -991,8 +991,14 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
}
//
// 4.
aVx=aVMin;
aNbDomains=aHatcher.NbDomains(aIx);
for (i=1; i<=aNbDomains; ++i) {
if (!aNbDomains) {
iErr=5;
return iErr;
}
//
i=1;
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
bHasFirstPoint=aDomain.HasFirstPoint();
if (!bHasFirstPoint) {
@ -1012,9 +1018,6 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
//
aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
//
break;
}
//
aS->D0(aUx, aVx, aPx);
//
theP2D.SetCoord(aUx, aVx);

View File

@ -62,7 +62,6 @@
#include <BRepLib_MakeFace.hxx>
#include <BRepLib_FaceError.hxx>
//#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_WireSolid.hxx>
#include <GEOMAlgo_ShellSolid.hxx>
@ -300,7 +299,6 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS)
{
myErrorStatus=0;
//
Standard_Boolean bIsDone;
Standard_Integer i, iErr;
TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON};
TopTools_ListIteratorOfListOfShape aIt;

View File

@ -309,6 +309,9 @@ void GEOMAlgo_FinderShapeOn1::ProcessEdges()
aType1=myGAS.GetType();
//
TopExp::MapShapes(myShape, TopAbs_EDGE, aM);
//
bIsConformState=Standard_False;
//
aNb=aM.Extent();
for (i=1; i<=aNb; ++i) {
GEOMAlgo_ListOfPnt aLP;
@ -427,6 +430,8 @@ void GEOMAlgo_FinderShapeOn1::ProcessFaces()
}
}
//
bIsConformState=Standard_False;
//
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current();
@ -500,6 +505,9 @@ void GEOMAlgo_FinderShapeOn1::ProcessSolids()
const TopoDS_Shape& aSd=aM(i);
aMF.Clear();
TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
//
bIsConformState=Standard_False;
//
aNbF=aMF.Extent();
for (j=1; j<=aNbF; ++j) {
const TopoDS_Shape& aF=aMF(j);
@ -660,7 +668,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
}// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
}// if (!aNb && myNbPntsMin) {
}
//modified by NIZNHY-PKV Thu Jan 26 09:56:20 2012f
//=======================================================================
//function : InnerPoints
//purpose :
@ -676,7 +683,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
aLP.Clear();
InnerPoints(aE, aNbPntsMin, aLP);
}
//modified by NIZNHY-PKV Thu Jan 26 09:56:32 2012t
//=======================================================================
//function : InnerPoints
//purpose :
@ -702,16 +708,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
return;
}
//
//modified by NIZNHY-PKV Thu Jan 26 09:51:20 2012f
/*
aNbT=myNbPntsMin+1;
dT=(aT2-aT1)/aNbT;
for (j=1; j<=aNbPntsMin; ++j) {
aT=aT1+j*dT;
aC3D->D0(aT, aP);
aLP.Append(aP);
}
*/
aNbT=aNbPntsMin+1;
dT=(aT2-aT1)/aNbT;
for (j=1; j<aNbT; ++j) {
@ -719,7 +715,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
aC3D->D0(aT, aP);
aLP.Append(aP);
}
//modified by NIZNHY-PKV Thu Jan 26 09:51:24 2012t
}
//=======================================================================

View File

@ -362,6 +362,8 @@ void GEOMAlgo_FinderShapeOn2::ProcessEdges()
//
const TopoDS_Edge& aE=TopoDS::Edge(aM(i));
//
bIsConformState=Standard_False;
//
aExp.Init(aE, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aV=aExp.Current();
@ -475,6 +477,9 @@ void GEOMAlgo_FinderShapeOn2::ProcessFaces()
}
}
//
//
bIsConformState=Standard_False;
//
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current();
@ -558,6 +563,9 @@ void GEOMAlgo_FinderShapeOn2::ProcessSolids()
const TopoDS_Shape& aSd=aM(i);
aMF.Clear();
TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
//
bIsConformState=Standard_False;
//
aNbF=aMF.Extent();
for (j=1; j<=aNbF; ++j) {
const TopoDS_Shape& aF=aMF(j);

View File

@ -239,7 +239,6 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
gp_Pnt aPx;
gp_Pnt2d aP2Dx;
gp_Vec aDNx;
TopoDS_Face aF;
TopExp_Explorer aExp;
//
@ -247,9 +246,8 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
aCoef=10.;
//
aExp.Init (aZ, TopAbs_FACE);
for (; aExp.More() ; aExp.Next()) {
if (aExp.More()) {
aF=*((TopoDS_Face*)&aExp.Current());
break;
}
//
iErr=PntInFace(aF, aPx, aP2Dx);
@ -368,7 +366,12 @@ Standard_Integer PntInFace(const TopoDS_Face& aF,
//
// 4.
aNbDomains=aHatcher.NbDomains(aIx);
for (i=1; i<=aNbDomains; ++i) {
if (!aNbDomains) {
iErr=5;
return iErr;
}
//
i=1;
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
bHasFirstPoint=aDomain.HasFirstPoint();
if (!bHasFirstPoint) {
@ -388,9 +391,6 @@ Standard_Integer PntInFace(const TopoDS_Face& aF,
//
aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
//
break;
}
//
aS->D0(aUx, aVx, aPx);
//
theP2D.SetCoord(aUx, aVx);

View File

@ -90,7 +90,6 @@ GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector()
//=======================================================================
GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector()
{}
//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//=======================================================================
//function : StickedShapes
//purpose :
@ -100,7 +99,6 @@ const TopTools_IndexedDataMapOfShapeListOfShape&
{
return myStickedShapes;
}
//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//=======================================================================
//function : Perform
//purpose :
@ -124,12 +122,10 @@ void GEOMAlgo_GlueDetector::Perform()
return;
}
//
//modified by NIZNHY-PKV Wed Mar 14 08:00:09 2012f
CheckDetected();
if (myErrorStatus) {
return;
}
//modified by NIZNHY-PKV Wed Mar 14 08:00:12 2012t
//
DetectEdges();
if (myErrorStatus) {
@ -206,7 +202,7 @@ void GEOMAlgo_GlueDetector::DetectVertices()
TColStd_MapIteratorOfMapOfInteger aIt1;
//
aMIP.Add(i);
while(1) {
for(;;) {
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
@ -460,7 +456,6 @@ void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
//
aPK.SetShapes(aLV);
}
//modified by NIZNHY-PKV Tue Mar 13 09:54:18 2012f
//=======================================================================
//function : CheckDetected
//purpose :
@ -607,4 +602,3 @@ Standard_Integer CheckAncesstors
//
return iRet;
}
//modified by NIZNHY-PKV Tue Mar 13 09:54:59 2012t

17
src/GEOMAlgo/GEOMAlgo_Gluer.cxx Executable file → Normal file
View File

@ -228,10 +228,7 @@ void GEOMAlgo_Gluer::MakeVertices()
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
//modified by NIZNHY-PKV Thu Jan 21 10:03:07 2010f
//GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
//modified by NIZNHY-PKV Thu Jan 21 10:03:10 2010t
//
GEOMAlgo_BndSphereTreeSelector aSelector;
GEOMAlgo_BndSphereTree aBBTree;
@ -278,7 +275,7 @@ void GEOMAlgo_Gluer::MakeVertices()
TColStd_MapIteratorOfMapOfInteger aIt1;
//
aMIP.Add(i);
while(1) {
for(;;) {
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
@ -288,10 +285,7 @@ void GEOMAlgo_Gluer::MakeVertices()
}
//
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
//modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f
const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
//const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
//modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t
//
aSelector.Clear();
aSelector.SetBox(aBoxVP);
@ -468,7 +462,8 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape,
aER.Orientation(TopAbs_FORWARD);
if (!BRep_Tool::Degenerated(aER)) {
// orient image
Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
Standard_Boolean bIsToReverse=
GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
if (bIsToReverse) {
aER.Reverse();
}
@ -490,8 +485,7 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape,
aBB.Add(theResult, aShapeR);
}
}
else
{
else {
if (myKeepNonSolids) {
// just add image
const TopoDS_Shape& aShapeR = myOrigins.Find(theShape);
@ -1111,7 +1105,8 @@ void GetSubShapes(const TopoDS_Shape& aS,
//function : Modified
//purpose :
//=======================================================================
const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS)
const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified
(const TopoDS_Shape& aS)
{
TopAbs_ShapeEnum aType;
//

View File

@ -84,11 +84,8 @@ void GEOMAlgo_Gluer2::Clear()
myImagesToWork.Clear();
myOriginsToWork.Clear();
myKeepNonSolids=Standard_False;
//modified by NIZNHY-PKV Tue Mar 13 13:38:28 2012f
myDetector.Clear();
//modified by NIZNHY-PKV Tue Mar 13 13:38:30 2012t
}
//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//=======================================================================
//function : StickedShapes
//purpose :
@ -98,12 +95,12 @@ const TopTools_IndexedDataMapOfShapeListOfShape&
{
return myDetector.StickedShapes();
}
//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//=======================================================================
//function : SetShapesToGlue
//purpose :
//=======================================================================
void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM)
void GEOMAlgo_Gluer2::SetShapesToGlue
(const TopTools_DataMapOfShapeListOfShape& aM)
{
myShapesToGlue=aM;
}
@ -241,6 +238,7 @@ void GEOMAlgo_Gluer2::CheckData()
myWarningStatus=0;
//
aNbSG=myShapesToGlue.Extent();
aType=TopAbs_SHAPE;
if (aNbSG) {
// Check myShapesToGlue
aItDMSLS.Initialize(myShapesToGlue);
@ -587,6 +585,7 @@ void GEOMAlgo_Gluer2::BuildResult()
myErrorStatus=0;
myWarningStatus=0;
//
bHasImage=Standard_False;
aItC.Initialize(myArgument);
for (; aItC.More(); aItC.Next()) {
const TopoDS_Shape& aCx=aItC.Value();

View File

@ -0,0 +1,37 @@
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//GEOMAlgo_KindOfDef
#ifndef _GEOMAlgo_KindOfDef_HeaderFile
#define _GEOMAlgo_KindOfDef_HeaderFile
enum GEOMAlgo_KindOfDef {
GEOMAlgo_KD_UNKNOWN,
GEOMAlgo_KD_SPECIFIED,
GEOMAlgo_KD_ARBITRARY
};
#ifndef _Standard_PrimitiveTypes_HeaderFile
#include <Standard_PrimitiveTypes.hxx>
#endif
#endif

View File

@ -44,7 +44,8 @@ GEOMAlgo_KN_DISKELLIPSE,
GEOMAlgo_KN_RECTANGLE,
GEOMAlgo_KN_TRIANGLE,
GEOMAlgo_KN_QUADRANGLE,
GEOMAlgo_KN_ARCELLIPSE
GEOMAlgo_KN_ARCELLIPSE,
GEOMAlgo_KN_SOLID
};
#ifndef _Standard_PrimitiveTypes_HeaderFile

View File

@ -35,9 +35,7 @@ GEOMAlgo_KS_PLANE,
GEOMAlgo_KS_CIRCLE,
GEOMAlgo_KS_LINE,
GEOMAlgo_KS_DEGENERATED,
//modified by NIZNHY-PKV Tue Jul 03 10:28:09 2012f
GEOMAlgo_KS_BSPLINE
//modified by NIZNHY-PKV Tue Jul 03 10:28:11 2012t
};
#ifndef _Standard_PrimitiveTypes_HeaderFile

View File

@ -29,6 +29,8 @@ static
void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB);
static
void DumpKindOfName(const GEOMAlgo_KindOfName aKS);
static
void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD);
static
void DumpPosition(const gp_Ax3& aAx3);
static
@ -69,6 +71,7 @@ static
myKindOfBounds=GEOMAlgo_KB_UNKNOWN;
myKindOfClosed=GEOMAlgo_KC_UNKNOWN;
myKindOfName=GEOMAlgo_KN_UNKNOWN;
myKindOfDef=GEOMAlgo_KD_UNKNOWN;
//
myLocation.SetCoord(99., 99., 99.);
myDirection.SetCoord(1.,0.,0.);
@ -113,7 +116,8 @@ static
//function : NbSubShapes
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes(const TopAbs_ShapeEnum aType) const
Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes
(const TopAbs_ShapeEnum aType) const
{
Standard_Integer iN;
@ -188,6 +192,22 @@ static
return myKindOfClosed;
}
//=======================================================================
//function : SetKindOfDef
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfo::SetKindOfDef(const GEOMAlgo_KindOfDef aT)
{
myKindOfDef=aT;
}
//=======================================================================
//function : KindOfDef
//purpose :
//=======================================================================
GEOMAlgo_KindOfDef GEOMAlgo_ShapeInfo::KindOfDef() const
{
return myKindOfDef;
}
//=======================================================================
//function : SetLocation
//purpose :
//=======================================================================
@ -479,7 +499,6 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
DumpKindOfBounds(aKB);
DumpKindOfClosed(aKC);
}
//=======================================================================
//function : DumpSolid
//purpose :
@ -545,7 +564,6 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
printf(" Height : %.3lf\n", myHeight);
}
}
//=======================================================================
//function : DumpFace
//purpose :
@ -557,6 +575,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
GEOMAlgo_KindOfName aKN;
GEOMAlgo_KindOfBounds aKB;
GEOMAlgo_KindOfClosed aKC;
GEOMAlgo_KindOfDef aKD;
//
aNbV=NbSubShapes(TopAbs_VERTEX);
aNbE=NbSubShapes(TopAbs_EDGE);
@ -564,6 +583,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
aKN=KindOfName();
aKB=KindOfBounds();
aKC=KindOfClosed();
aKD=KindOfDef();
//
printf(" *FACE\n");
printf(" number of vertices: %d\n", aNbV);
@ -572,6 +592,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
DumpKindOfName (aKN);
DumpKindOfBounds(aKB);
DumpKindOfClosed(aKC);
DumpKindOfDef(aKD);
//
// PLANE
if (aKN==GEOMAlgo_KN_PLANE) {
@ -881,10 +902,27 @@ void DumpKindOfName(const GEOMAlgo_KindOfName aKS)
"KN_RECTANGLE",
"KN_TRIANGLE",
"KN_QUADRANGLE",
"KN_ARCELLIPSE"
"KN_ARCELLIPSE",
"KN_SOLID"
};
int i;
//
i=(Standard_Integer)aKS;
printf(" KindOfName : %s\n", pStr[i]);
}
//=======================================================================
//function : DumpKindOfDef
//purpose :
//=======================================================================
void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD)
{
const char *pStr[]={
"KD_UNKNOWN",
"KD_SPECIFIED",
"KB_ARBITRARY"
};
int i;
//
i=(Standard_Integer)aKD;
printf(" KindOfDef: %s\n", pStr[i]);
}

View File

@ -37,6 +37,7 @@
#include <GEOMAlgo_KindOfName.hxx>
#include <GEOMAlgo_KindOfBounds.hxx>
#include <GEOMAlgo_KindOfClosed.hxx>
#include <GEOMAlgo_KindOfDef.hxx>
//=======================================================================
@ -62,7 +63,8 @@ class GEOMAlgo_ShapeInfo
TopAbs_ShapeEnum Type() const;
Standard_EXPORT
void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ;
void SetNbSubShapes(const TopAbs_ShapeEnum aType,
const Standard_Integer aNb) ;
Standard_EXPORT
Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const;
@ -91,6 +93,12 @@ class GEOMAlgo_ShapeInfo
Standard_EXPORT
GEOMAlgo_KindOfClosed KindOfClosed() const;
Standard_EXPORT
void SetKindOfDef(const GEOMAlgo_KindOfDef aT) ;
Standard_EXPORT
GEOMAlgo_KindOfDef KindOfDef() const;
Standard_EXPORT
void SetLocation(const gp_Pnt& aP) ;
@ -189,6 +197,7 @@ class GEOMAlgo_ShapeInfo
GEOMAlgo_KindOfName myKindOfName;
GEOMAlgo_KindOfBounds myKindOfBounds;
GEOMAlgo_KindOfClosed myKindOfClosed;
GEOMAlgo_KindOfDef myKindOfDef;
gp_Pnt myLocation;
gp_Dir myDirection;
gp_Ax3 myPosition;

View File

@ -116,7 +116,8 @@
//function : Info
//purpose :
//=======================================================================
const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info(const TopoDS_Shape& aS) const
const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info
(const TopoDS_Shape& aS) const
{
if (!aS.IsNull()) {
if (myMapInfo.Contains(aS)) {
@ -260,7 +261,6 @@
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS)
{
Standard_Integer aNbShells;
TopoDS_Solid aSd;
//
myErrorStatus=0;
@ -280,11 +280,6 @@
//
aSd=TopoDS::Solid(aS);
//
aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd);
if (aNbShells>1) {
return;
}
//
FillDetails(aSd);
}
//=======================================================================
@ -294,26 +289,23 @@
void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS)
{
myErrorStatus=0;
if (myMapInfo.Contains(aS)) {
return;
}
//
Standard_Boolean bIsAllowedType;
Standard_Integer aNbWires;//, iRet
Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2;
Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2;
Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2, dV;
gp_Pnt aP0;
gp_Dir aDN;
gp_Ax3 aAx3;
GeomAbs_SurfaceType aST;
Handle(Geom_Surface) aSurf;
TopoDS_Face aF;
//GEOMAlgo_KindOfName aKindOfName;
//----------------------------------------------------
if (myMapInfo.Contains(aS)) {
return;
}
else {
GEOMAlgo_ShapeInfo aInfoX;
myMapInfo.Add(aS, aInfoX);
}
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS);
//----------------------------------------------------
aInfo.SetType(TopAbs_FACE);
@ -324,8 +316,6 @@
//
aF=TopoDS::Face(aS);
//
aNbWires=GEOMAlgo_ShapeInfoFiller::NbWires(aF);
//
aSurf=BRep_Tool::Surface(aF);
GeomAdaptor_Surface aGAS(aSurf);
aST=aGAS.GetType();
@ -334,6 +324,7 @@
return;
}
//
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 1. Plane
if (aST==GeomAbs_Plane) {
gp_Pln aPln;
@ -343,15 +334,11 @@
aAx3=aPln.Position();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE);
aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
//
if (aNbWires>1) {
return;
}
//
//aSurf->Bounds(aUMin, aUMax, aVMin, aVMax);
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin);
bInfU2=Precision::IsPositiveInfinite(aUMax);
@ -361,14 +348,15 @@
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
return;
}
else {
//
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
}
//
FillDetails(aF, aPln);
}// if (aCT==GeomAbs_Line) {
//
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 2. Sphere
else if (aST==GeomAbs_Sphere) {
gp_Sphere aSphere;
@ -379,20 +367,18 @@
aR1=aSphere.Radius();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_SPHERE);
aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1);
//
if (aNbWires>1) {
return;
}
//
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED);
//
FillDetails(aF, aSphere);
}// else if (aST==GeomAbs_Sphere) {
//
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 3. Cylinder
else if (aST==GeomAbs_Cylinder) {
gp_Cylinder aCyl;
@ -403,14 +389,11 @@
aR1=aCyl.Radius();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_CYLINDER);
aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1);
//
if (aNbWires>1) {
return;
}
//
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin);
bInfU2=Precision::IsPositiveInfinite(aUMax);
@ -420,30 +403,31 @@
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
return;
}
else {
//
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
}
//
dV=aVMax-aVMin;
aInfo.SetHeight(dV);
//
FillDetails(aF, aCyl);
}
//
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 4. Cone
else if (aST==GeomAbs_Cone) {
Standard_Real aSemiAngle;
gp_Cone aCone;
//
aCone=aGAS.Cone();
aP0=aCone.Location();
aAx3=aCone.Position();
//aR1=aCyl.Radius();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_CONE);
aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
//aInfo.SetRadius1(aR1);
//
if (aNbWires>1) {
return;
}
//
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin);
@ -454,13 +438,20 @@
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
return;
}
else {
//
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
}
//
aSemiAngle=fabs(aCone.SemiAngle());
dV=(aVMax-aVMin)*cos(aSemiAngle);
aInfo.SetHeight(dV);
//
FillDetails(aF, aCone);
}
//
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 5. Torus
else if (aST==GeomAbs_Torus) {
gp_Torus aTorus;
@ -472,15 +463,12 @@
aR2=aTorus.MinorRadius();
//
aInfo.SetKindOfShape(GEOMAlgo_KS_TORUS);
aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1);
aInfo.SetRadius2(aR2);
//
if (aNbWires>1) {
return;
}
//
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
//
FillDetails(aF, aTorus);
@ -535,7 +523,6 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
FillSubShapes(aS);
return;
}
//modified by NIZNHY-PKV Tue Jul 03 10:19:03 2012f
// BSplineCurve
if (aCT==GeomAbs_BSplineCurve) {
Standard_Integer aNbKnots, aNbPoles, aDegree;
@ -577,7 +564,6 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
aInfo.SetDirection(aDir);
}
}
//modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t
// Line
else if (aCT==GeomAbs_Line) {
Standard_Boolean bInf1, bInf2;
@ -776,7 +762,8 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
//function :NbShells
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells
(const TopoDS_Solid& aSd)
{
Standard_Integer iCnt;
TopoDS_Iterator aIt;
@ -785,7 +772,6 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
//
aIt.Initialize(aSd);
for (; aIt.More(); aIt.Next()) {
//const TopoDS_Shape& aSh=aIt.Value();
++iCnt;
}
return iCnt;
@ -794,7 +780,8 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
//function : NbWires
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires
(const TopoDS_Face& aF)
{
Standard_Integer iCnt;
TopoDS_Iterator aIt;
@ -803,7 +790,6 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
//
aIt.Initialize(aF);
for (; aIt.More(); aIt.Next()) {
//const TopoDS_Shape& aW=aIt.Value();
++iCnt;
}
return iCnt;
@ -812,7 +798,8 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
//function : IsAllowedType
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType aCT)
Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
(const GeomAbs_CurveType aCT)
{
Standard_Boolean bRet;
Standard_Integer i, aNb;
@ -820,7 +807,7 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType
GeomAbs_Line,
GeomAbs_Circle,
GeomAbs_Ellipse,
GeomAbs_BSplineCurve //modified by NIZNHY-PKV Tue Jul 03 10:18:01 2012ft
GeomAbs_BSplineCurve
};
//
bRet=Standard_False;
@ -834,7 +821,8 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType
//function : IsAllowedType
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_SurfaceType aST)
Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
(const GeomAbs_SurfaceType aST)
{
Standard_Boolean bRet;
Standard_Integer i, aNb;

View File

@ -68,10 +68,12 @@ static
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
{
Standard_Boolean bIsStepSphere;
Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX;
Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct;
Standard_Integer aNbShells, aNbCrc, aNbX;
TopoDS_Shape aFCyl, aFCon;
TopTools_IndexedMapOfShape aMF;
GEOMAlgo_KindOfName aKNF;
GEOMAlgo_KindOfDef aKD;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd);
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
@ -83,7 +85,26 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
return;
}
//
aKD=GEOMAlgo_KD_SPECIFIED;
for (i=1; i<=aNbF && aKD==GEOMAlgo_KD_SPECIFIED; ++i) {
const TopoDS_Shape& aF=aMF(i);
GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF);
aKD=aInfoF.KindOfDef();
}
if (aKD!=GEOMAlgo_KD_SPECIFIED) {
aInfo.SetKindOfName(GEOMAlgo_KN_SOLID);
return;
}
//
aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd);
if (aNbShells>1) {
aInfo.SetKindOfName(GEOMAlgo_KN_SOLID);
return;
}
//
//
if (aNbF==1) {
// mb: sphere, torus
const TopoDS_Shape& aF=aMF(1);
GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF);
aKNF=aInfoF.KindOfName(); // mb: sphere, torus
@ -99,7 +120,6 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
return;
}
}
//modified by NIZNHY-PKV Tue Jul 03 13:23:55 2012f
else if (aNbF==2) {
// specific solid that should be treated as a sphere
bIsStepSphere=TreatStepSphere(aSd);
@ -107,7 +127,6 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
return;
}
}
//modified by NIZNHY-PKV Tue Jul 03 13:23:57 2012t
//
aNbCyl=0;
aNbCon=0;
@ -229,11 +248,9 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
const gp_Dir& aDNj=aIFj.Position().Direction();
//
aDot=aDNi*aDNj;
//modified by NIZNHY-PKV Tue Jul 03 10:01:56 2012f
if (aDot<0.) {
aDot=-aDot;
}
//modified by NIZNHY-PKV Tue Jul 03 10:01:52 2012t
if (fabs(1.-aDot)<0.0001) {
aMp.Add(i);
aMp.Add(j);
@ -248,6 +265,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
return;
}
//
iMin=-1;
iMax=-1;
aDistMin=1.e15;
aDistMax=-aDistMin;
for (i=0; i<aNbFi; ++i) {
@ -308,21 +327,10 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
TopTools_IndexedMapOfShape aMV;
BRepTools_WireExplorer aWExp;
GEOMAlgo_KindOfName aKN, aKNE;
GEOMAlgo_KindOfShape aKS;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aKN=GEOMAlgo_KN_UNKNOWN;
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
//
aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_PLANE) {
return;
}
//
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
return;
}
aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
//
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
@ -330,9 +338,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
// 1. may be it is circle/ellipse
if (aNbV==1 && aNbE==1) {
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
if (aExp.More()) {
aE=aExp.Current();
break;
}
//
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
@ -343,6 +350,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
aInfo.SetRadius1(aInfoE.Radius1());
aInfo.SetLocation(aInfoE.Location());
aInfo.SetPosition(aInfoE.Position());
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
if (aKNE==GEOMAlgo_KN_ELLIPSE) {
aKN=GEOMAlgo_KN_DISKELLIPSE;
@ -351,21 +359,28 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
aInfo.SetRadius2(aInfoE.Radius2());
aInfo.SetLocation(aInfoE.Location());
aInfo.SetPosition(aInfoE.Position());
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
}
return;
}// if (aNbV==1 && aNbE==1) {
//
// 2. may be it is rectangle
else {
//
Standard_Boolean bSegment;
//
bSegment=Standard_True;
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
for (; aExp.More() && bSegment; aExp.Next()) {
aE=aExp.Current();
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
aKNE=aInfoE.KindOfName();
if (aKNE!=GEOMAlgo_KN_SEGMENT) {
return;
bSegment=!bSegment;
}
}
//
if (bSegment) {
// 2. may be it is TRIANGLE, POLYGON, QUADRANGLE, RECTANGLE
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
aInfo.SetKindOfName(GEOMAlgo_KN_POLYGON);
//
if (aNbV==3 && aNbE==3) {
@ -393,19 +408,12 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
//
aInfo.SetLocation(aPc);
aInfo.SetPosition(aAx3);
} // if (aNbV==3 && aNbE==3) {
//
return;
}
//
if (!(aNbV==4 && aNbE==4)) {
return;
}
//
// aNbV==4 && aNbE==4 and all edges are segments
if (aNbV==4 && aNbE==4) {
aIt.Initialize(aF);
for (; aIt.More(); aIt.Next()){
aW=TopoDS::Wire(aIt.Value());
break;
if (aIt.More()) {
aW=*((TopoDS_Wire*)&aIt.Value());
}
//
aWExp.Init(aW, aF);
@ -471,37 +479,33 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
gp_Ax2 aAx2(aPc, aDZ, aDX);
gp_Ax3 aAx3(aAx2);
aInfo.SetPosition(aAx3);
}
//
}// if (aNbV==4 && aNbE==4) {
return;
}// if (bSegment) {
//
//aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Sphere& )
const gp_Sphere& )//aSph)
{
Standard_Integer aNbV, aNbE, aNbSE, aNbDE;
TopoDS_Edge aE;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
GEOMAlgo_KindOfShape aKS, aKSE;
GEOMAlgo_KindOfShape aKSE;//, aKSE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
//
aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_SPHERE) {
return;
}
//
aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (!(aNbV==2 && aNbE==3)) {
return;
}
//
if (aNbV==2 && aNbE==3) {
aNbSE=0;
aNbDE=0;
aExp.Init(aF, TopAbs_EDGE);
@ -520,49 +524,110 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
}
}
//
if (!(aNbSE==1 && aNbDE==2)) {
return;
if (aNbSE==1 && aNbDE==2) {
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
}
aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Cone& )//aCone)
const gp_Cylinder& aCyl)
{
Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
Standard_Real aT0, aT1, aHeight;
gp_Pnt aPC[3], aPc;
TopoDS_Edge aE;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
GEOMAlgo_KindOfName aKNE;
GEOMAlgo_KindOfClosed aKCE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
//
aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (aNbV==2 && aNbE==3) {
const gp_Ax1& aAx1=aCyl.Axis();
const gp_Dir& aDir=aAx1.Direction();
const gp_Pnt& aPLoc=aAx1.Location();
//
i=0;
aNbCE=0;
aNbSE=0;
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
aE=TopoDS::Edge(aExp.Current());
if(aM.Add(aE)) {
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
aKNE=aInfoE.KindOfName();
aKCE=aInfoE.KindOfClosed();
if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
aPC[aNbCE]=aInfoE.Location();
++aNbCE;
}
else if (aKNE==GEOMAlgo_KN_SEGMENT) {
if (BRep_Tool::IsClosed(aE, aF)) {
++aNbSE;
}
}
}
}
//
if (aNbCE==2 && aNbSE==1) {
gp_Lin aLin(aPLoc, aDir);
//
aT0=ElCLib::Parameter(aLin, aPC[0]);
aT1=ElCLib::Parameter(aLin, aPC[1]);
//
aPc=aPC[0];
if (aT0>aT1) {
aPc=aPC[1];
}
aHeight=aPC[0].Distance(aPC[1]);
//
gp_Ax3 aAx3=aCyl.Position();
aAx3.SetLocation(aPc);
//
aInfo.SetPosition(aAx3);
aInfo.SetLocation(aPc);
aInfo.SetHeight(aHeight);
//
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
return; // conventional cylinder
}//if (aNbCE==2 && aNbSE==1) {
}//if (aNbV==2 && aNbE==3) {
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Cone& aCone)
{
Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i;
Standard_Real aR[3], aHeight;
Standard_Real aR[3], aHeight, aRmin, aRmax;
gp_Pnt aPC[3], aPD, aPc, aPX[3];
TopoDS_Vertex aVD;
TopoDS_Edge aE;
TopoDS_Iterator aIt;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
GEOMAlgo_KindOfShape aKS, aKSE;
GEOMAlgo_KindOfName aKN, aKNE;
GEOMAlgo_KindOfShape aKSE;
GEOMAlgo_KindOfName aKNE;
GEOMAlgo_KindOfClosed aKCE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aKN=GEOMAlgo_KN_UNKNOWN;
aInfo.SetKindOfName(aKN);
//
aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_CONE) {
return;
}
//
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
return;
}
aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
//
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (!(aNbV==2 && aNbE==3)) {
return;
}
//
if (aNbV==2 && aNbE==3) {
i=0;
aNbCE=0;
aNbSE=0;
@ -580,9 +645,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
aR[i]=aInfoE.Radius1();
//
aIt.Initialize(aE);
for (; aIt.More(); aIt.Next()) {
aVD=TopoDS::Vertex(aIt.Value());
break;
if (aIt.More()) {
aVD=*((TopoDS_Vertex*)&aIt.Value());
}
aPX[i]=BRep_Tool::Pnt(aVD);
//
@ -596,9 +660,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
}
else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
aIt.Initialize(aE);
for (; aIt.More(); aIt.Next()) {
aVD=TopoDS::Vertex(aIt.Value());
break;
if (aIt.More()) {
aVD=*((TopoDS_Vertex*)&aIt.Value());
}
//
aPD=BRep_Tool::Pnt(aVD);
@ -608,10 +671,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
}
}
//
if (!((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1)) {
return;
}
//
if ((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1) {
if (aNbDE==1) {
aPC[1]=aPD;
aR[1]=0.;
@ -619,7 +679,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
//
aHeight=aPC[0].Distance(aPC[1]);
//
Standard_Real aRmin, aRmax;
gp_Ax2 aAx2new;
//
if (aR[0]>aR[1]) {
@ -652,93 +712,16 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
aInfo.SetRadius2(aRmin);
aInfo.SetHeight(aHeight);
//
aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Cylinder& aCyl)
{
Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
Standard_Real aT0, aT1, aHeight;
gp_Pnt aPC[3], aPc;
TopoDS_Edge aE;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
GEOMAlgo_KindOfShape aKS;
GEOMAlgo_KindOfName aKN, aKNE;
GEOMAlgo_KindOfClosed aKCE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aKN=GEOMAlgo_KN_UNKNOWN;
aInfo.SetKindOfName(aKN);
//
aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_CYLINDER) {
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
return;
}
}//if ((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1) {
}//if (aNbV==2 && aNbE==3) {
//
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
return;
}
aInfo.SetRadius1 (aCone.RefRadius());
//
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (!(aNbV==2 && aNbE==3)) {
return;
aRmin=0.; // ZZ
aInfo.SetRadius2(aRmin);
}
//
i=0;
aNbCE=0;
aNbSE=0;
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
aE=TopoDS::Edge(aExp.Current());
if(aM.Add(aE)) {
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
aKNE=aInfoE.KindOfName();
aKCE=aInfoE.KindOfClosed();
if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
aPC[aNbCE]=aInfoE.Location();
++aNbCE;
}
else if (aKNE==GEOMAlgo_KN_SEGMENT) {
if (BRep_Tool::IsClosed(aE, aF)) {
++aNbSE;
}
}
}
}
//
if (!(aNbCE==2 && aNbSE==1)) {
return;
}
//
const gp_Ax1& aAx1=aCyl.Axis();
const gp_Dir& aDir=aAx1.Direction();
const gp_Pnt& aPLoc=aAx1.Location();
gp_Lin aLin(aPLoc, aDir);
//
aT0=ElCLib::Parameter(aLin, aPC[0]);
aT1=ElCLib::Parameter(aLin, aPC[1]);
//
aPc=aPC[0];;
if (aT0>aT1) {
aPc=aPC[1];
}
aHeight=aPC[0].Distance(aPC[1]);
//
gp_Ax3 aAx3=aCyl.Position();
aAx3.SetLocation(aPc);
//
aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
aInfo.SetPosition(aAx3);
aInfo.SetLocation(aPc);
aInfo.SetHeight(aHeight);
}
//=======================================================================
//function : FillDetails
//purpose :
@ -746,6 +729,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Torus& )
{
Standard_Integer aNbV, aNbE, aNbSE;
TopoDS_Edge aE;
TopExp_Explorer aExp;
@ -753,19 +737,17 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
GEOMAlgo_KindOfShape aKS;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
//
aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_TORUS) {
return;
}
//
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (!(aNbV==1 && aNbE==2)) {
return;
}
//
if (aNbV==1 && aNbE==2) {
aNbSE=0;
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
@ -777,18 +759,17 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
}
}
//
if (aNbSE!=2) {
return;
if (aNbSE==2) {
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
}
aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
}
//modified by NIZNHY-PKV Tue Jul 03 13:29:41 2012f
//=======================================================================
//function : TreatStepSphere
//purpose :
//=======================================================================
Standard_Boolean
GEOMAlgo_ShapeInfoFiller::TreatStepSphere(const TopoDS_Solid& aSd)
Standard_Boolean GEOMAlgo_ShapeInfoFiller::TreatStepSphere
(const TopoDS_Solid& aSd)
{
Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual;
Standard_Integer j;
@ -899,4 +880,3 @@ Standard_Boolean IsEqual(const gp_Sphere& aSp1,
//
return bRet;
}
//modified by NIZNHY-PKV Tue Jul 03 13:29:43 2012t

View File

@ -245,7 +245,7 @@ void GEOMAlgo_ShellSolid::Perform()
const BOPDS_IndexRange& aRange=pDS->Range(iRank);
aRange.Indices(iBeg, iEnd);
const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj);
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
//BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
//
//------------------------------ShellSolidBuilder
GEOMAlgo_ShellSolidBuilder aSSB;

2
src/GEOMAlgo/GEOMAlgo_Splitter.cxx Executable file → Normal file
View File

@ -301,7 +301,7 @@ void TreatCompound(const TopoDS_Shape& aC1,
TopoDS_Iterator aItC;
//
aLC.Append (aC1);
while(1) {
for(;;) {
aLC1.Clear();
aIt.Initialize(aLC);
for (; aIt.More(); aIt.Next()) {

View File

@ -48,7 +48,8 @@
//function : GetState
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP,
Standard_Integer GEOMAlgo_SurfaceTools::GetState
(const gp_Pnt& aP,
const GeomAdaptor_Surface& aGAS,
const Standard_Real aTol,
TopAbs_State& aState)
@ -95,7 +96,8 @@
//function : GetState
//purpose :
//=======================================================================
Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP,
Standard_Integer GEOMAlgo_SurfaceTools::GetState
(const gp_Pnt& aP,
const Handle(Geom_Surface)& aSurf,
const Standard_Real aTol,
TopAbs_State& aState)
@ -114,7 +116,8 @@
//function : ReverseState
//purpose :
//=======================================================================
TopAbs_State GEOMAlgo_SurfaceTools::ReverseState(const TopAbs_State aState)
TopAbs_State GEOMAlgo_SurfaceTools::ReverseState
(const TopAbs_State aState)
{
TopAbs_State aRSt=aState;
//
@ -135,7 +138,8 @@
//function : IsCoaxial
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial
(const gp_Pnt& aP1,
const gp_Pnt& aP2,
const gp_Cylinder& aCyl,
const Standard_Real aTol)
@ -147,7 +151,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
gp_XYZ aDP2 = aP2.XYZ().Subtracted(aLoc);
Standard_Real aDot1 = aDP1.Dot(aDAxis);
Standard_Real aDot2 = aDP1.Dot(aDAxis);
Standard_Real aTol2 = aTol*aTol;
//Standard_Real aTol2 = aTol*aTol;
// Project P1 and P2 onto a plane with location aLoc and Norm aDAxis.
aDP1.Subtract(aDAxis.Multiplied(aDot1));
@ -160,7 +164,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
if (fabs(aRadius1 - aRadius2) <= aTol) {
// Check the deflection of the middle point.
gp_XYZ aMidP = 0.5*(aDP1 + aDP2);
Standard_Real aMidRadius1 = aMidP.Modulus();
//Standard_Real aMidRadius1 = aMidP.Modulus();
if (fabs(aRadius1 - aRadius2) <= aTol) {
isOn = Standard_True;
@ -173,7 +177,8 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
//function : IsAnalytic
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& aSurf)
Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic
(const Handle(Geom_Surface)& aSurf)
{
Standard_Boolean bRet;
GeomAbs_SurfaceType aType;
@ -190,7 +195,8 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& a
//function : IsConformState
//purpose :
//=======================================================================
Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState(const TopAbs_State aST1,
Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState
(const TopAbs_State aST1,
const GEOMAlgo_State aST2)
{
Standard_Boolean bRet=Standard_False;