mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-15 20:51:27 +05:00
IMPs 19998 and 21191: new gluing by PKV
This commit is contained in:
parent
7de39bacb2
commit
e750d254aa
@ -1491,6 +1491,34 @@ module GEOM
|
|||||||
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
|
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
|
||||||
in ListOfGO theFaces, in boolean doKeepNonSolids);
|
in ListOfGO theFaces, in boolean doKeepNonSolids);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Replace coincident edges in theShape by one edge.
|
||||||
|
* \param theShape Initial shape.
|
||||||
|
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
|
||||||
|
* \return New GEOM_Object, containing a copy of theShape without coincident edges.
|
||||||
|
*/
|
||||||
|
GEOM_Object MakeGlueEdges (in GEOM_Object theShape, in double theTolerance);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Find coincident edges in theShape for possible gluing.
|
||||||
|
* \param theShape Initial shape.
|
||||||
|
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
|
||||||
|
* \return ListOfGO
|
||||||
|
*/
|
||||||
|
ListOfGO GetGlueEdges (in GEOM_Object theShape, in double theTolerance);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Replace coincident edges in theShape by one edge
|
||||||
|
* in compliance with given list of edges
|
||||||
|
* \param theShape Initial shape.
|
||||||
|
* \param theTolerance Maximum distance between edges, which can be considered as coincident.
|
||||||
|
* \param theFaces List of edges for gluing.
|
||||||
|
* \return New GEOM_Object, containing a copy of theShape without some edges.
|
||||||
|
*/
|
||||||
|
GEOM_Object MakeGlueEdgesByList (in GEOM_Object theShape,
|
||||||
|
in double theTolerance,
|
||||||
|
in ListOfGO theEdges);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get all sub-shapes and groups of \a theShape,
|
* Get all sub-shapes and groups of \a theShape,
|
||||||
* that were created already by any other methods.
|
* that were created already by any other methods.
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
-- Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
-- Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
--
|
|
||||||
-- Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
||||||
-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
--
|
--
|
||||||
-- This library is free software; you can redistribute it and/or
|
-- This library is free software; you can redistribute it and/or
|
||||||
@ -8,7 +6,7 @@
|
|||||||
-- License as published by the Free Software Foundation; either
|
-- License as published by the Free Software Foundation; either
|
||||||
-- version 2.1 of the License.
|
-- version 2.1 of the License.
|
||||||
--
|
--
|
||||||
-- This library is distributed in the hope that it will be useful,
|
-- This library is distributed in the hope that it will be useful
|
||||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
-- Lesser General Public License for more details.
|
-- Lesser General Public License for more details.
|
||||||
@ -17,7 +15,7 @@
|
|||||||
-- License along with this library; if not, write to the Free Software
|
-- License along with this library; if not, write to the Free Software
|
||||||
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
--
|
--
|
||||||
-- See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
-- See http:--www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
--
|
--
|
||||||
-- File: GEOMAlgo.cdl
|
-- File: GEOMAlgo.cdl
|
||||||
-- Created: Sat Dec 04 12:36:22 2004
|
-- Created: Sat Dec 04 12:36:22 2004
|
||||||
@ -130,6 +128,13 @@ is
|
|||||||
-- gluer
|
-- gluer
|
||||||
class Gluer;
|
class Gluer;
|
||||||
class Gluer1;
|
class Gluer1;
|
||||||
|
|
||||||
|
--modified by NIZNHY-PKV Mon Feb 21 10:07:22 2011f
|
||||||
|
imported Gluer2 from GEOMAlgo;
|
||||||
|
imported GlueDetector from GEOMAlgo;
|
||||||
|
imported GluerAlgo from GEOMAlgo;
|
||||||
|
--modified by NIZNHY-PKV Mon Feb 21 10:07:27 2011t
|
||||||
|
|
||||||
class GlueAnalyser;
|
class GlueAnalyser;
|
||||||
|
|
||||||
class CoupleOfShapes;
|
class CoupleOfShapes;
|
||||||
|
428
src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx
Normal file
428
src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx
Normal file
@ -0,0 +1,428 @@
|
|||||||
|
// Copyright (C) 2007-2010 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// File: GEOMAlgo_GlueDetector.cxx
|
||||||
|
// Created:
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
// <pkv@irinox>
|
||||||
|
//
|
||||||
|
#include <GEOMAlgo_GlueDetector.hxx>
|
||||||
|
|
||||||
|
#include <Bnd_Box.hxx>
|
||||||
|
#include <NCollection_UBTreeFiller.hxx>
|
||||||
|
|
||||||
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
|
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||||
|
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
|
||||||
|
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <TopoDS_Compound.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
#include <TopoDS_Compound.hxx>
|
||||||
|
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||||
|
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <BRepBndLib.hxx>
|
||||||
|
|
||||||
|
#include <NMTDS_BndSphereTree.hxx>
|
||||||
|
#include <NMTDS_BndSphere.hxx>
|
||||||
|
#include <NMTDS_IndexedDataMapOfShapeBndSphere.hxx>
|
||||||
|
|
||||||
|
#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
|
||||||
|
#include <GEOMAlgo_Gluer.hxx>
|
||||||
|
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||||
|
#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
|
||||||
|
#include <GEOMAlgo_Tools.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function :
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector()
|
||||||
|
:
|
||||||
|
GEOMAlgo_GluerAlgo(),
|
||||||
|
GEOMAlgo_Algo()
|
||||||
|
{}
|
||||||
|
//=======================================================================
|
||||||
|
//function : ~
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector()
|
||||||
|
{}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GlueDetector::Perform()
|
||||||
|
{
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
CheckData();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
DetectVertices();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
DetectEdges();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
DetectFaces();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : DetectVertices
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GlueDetector::DetectVertices()
|
||||||
|
{
|
||||||
|
Standard_Integer j, i, aNbV, aNbVSD;
|
||||||
|
Standard_Real aTolV;
|
||||||
|
gp_Pnt aPV;
|
||||||
|
TColStd_ListIteratorOfListOfInteger aIt;
|
||||||
|
TopoDS_Shape aVF;
|
||||||
|
TopTools_IndexedMapOfShape aMV;
|
||||||
|
TopTools_MapOfShape aMVProcessed;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItS;
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
|
||||||
|
TopTools_DataMapOfShapeListOfShape aMVV;
|
||||||
|
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
|
||||||
|
NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
|
||||||
|
//
|
||||||
|
NMTDS_BndSphereTreeSelector aSelector;
|
||||||
|
NMTDS_BndSphereTree aBBTree;
|
||||||
|
NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
//
|
||||||
|
TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMV);
|
||||||
|
aNbV=aMV.Extent();
|
||||||
|
if (!aNbV) {
|
||||||
|
myErrorStatus=2; // no vertices in source shape
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
for (i=1; i<=aNbV; ++i) {
|
||||||
|
NMTDS_BndSphere aBox;
|
||||||
|
//
|
||||||
|
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
|
||||||
|
aPV=BRep_Tool::Pnt(aV);
|
||||||
|
aTolV=BRep_Tool::Tolerance(aV);
|
||||||
|
//
|
||||||
|
aBox.SetGap(myTolerance);
|
||||||
|
aBox.SetCenter(aPV);
|
||||||
|
aBox.SetRadius(aTolV);
|
||||||
|
//
|
||||||
|
aTreeFiller.Add(i, aBox);
|
||||||
|
//
|
||||||
|
aMIS.Add(i, aV);
|
||||||
|
aMSB.Add(aV, aBox);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aTreeFiller.Fill();
|
||||||
|
//
|
||||||
|
//---------------------------------------------------
|
||||||
|
// Chains
|
||||||
|
for (i=1; i<=aNbV; ++i) {
|
||||||
|
const TopoDS_Shape& aV=aMV(i);
|
||||||
|
//
|
||||||
|
if (aMVProcessed.Contains(aV)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
|
||||||
|
TopTools_ListOfShape aLVSD;
|
||||||
|
TColStd_MapOfInteger aMIP, aMIP1, aMIPC;
|
||||||
|
TColStd_MapIteratorOfMapOfInteger aIt1;
|
||||||
|
//
|
||||||
|
aMIP.Add(i);
|
||||||
|
while(1) {
|
||||||
|
aNbIP=aMIP.Extent();
|
||||||
|
aIt1.Initialize(aMIP);
|
||||||
|
for(; aIt1.More(); aIt1.Next()) {
|
||||||
|
aIP=aIt1.Key();
|
||||||
|
if (aMIPC.Contains(aIP)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
|
||||||
|
const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
|
||||||
|
//
|
||||||
|
aSelector.Clear();
|
||||||
|
aSelector.SetBox(aBoxVP);
|
||||||
|
//
|
||||||
|
aNbVSD=aBBTree.Select(aSelector);
|
||||||
|
if (!aNbVSD) {
|
||||||
|
continue; // it shoild not be so [at least IP itself]
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TColStd_ListOfInteger& aLI=aSelector.Indices();
|
||||||
|
aIt.Initialize(aLI);
|
||||||
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
aIP1=aIt.Value();
|
||||||
|
if (aMIP.Contains(aIP1)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
aMIP1.Add(aIP1);
|
||||||
|
} //for (; aIt.More(); aIt.Next()) {
|
||||||
|
}//for(; aIt1.More(); aIt1.Next()) {
|
||||||
|
//
|
||||||
|
aNbIP1=aMIP1.Extent();
|
||||||
|
if (!aNbIP1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aIt1.Initialize(aMIP);
|
||||||
|
for(; aIt1.More(); aIt1.Next()) {
|
||||||
|
aIP=aIt1.Key();
|
||||||
|
aMIPC.Add(aIP);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aMIP.Clear();
|
||||||
|
aIt1.Initialize(aMIP1);
|
||||||
|
for(; aIt1.More(); aIt1.Next()) {
|
||||||
|
aIP=aIt1.Key();
|
||||||
|
aMIP.Add(aIP);
|
||||||
|
}
|
||||||
|
aMIP1.Clear();
|
||||||
|
}// while(1)
|
||||||
|
//
|
||||||
|
// Fill myImages
|
||||||
|
aNbIP=aMIPC.Extent();
|
||||||
|
//
|
||||||
|
if (!aNbIP) {// no SD vertices is found
|
||||||
|
aMVProcessed.Add(aV);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//else { // SD vertices founded [ aMIPC ]
|
||||||
|
aIt1.Initialize(aMIPC);
|
||||||
|
for(j=0; aIt1.More(); aIt1.Next(), ++j) {
|
||||||
|
aIP=aIt1.Key();
|
||||||
|
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
|
||||||
|
if (!j) {
|
||||||
|
aVF=aVP;
|
||||||
|
}
|
||||||
|
aLVSD.Append(aVP);
|
||||||
|
aMVProcessed.Add(aVP);
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
myImages.Bind(aVF, aLVSD);
|
||||||
|
}// for (i=1; i<=aNbV; ++i) {
|
||||||
|
//------------------------------
|
||||||
|
// 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_GlueDetector::DetectFaces()
|
||||||
|
{
|
||||||
|
DetectShapes(TopAbs_FACE);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : DetectEdges
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GlueDetector::DetectEdges()
|
||||||
|
{
|
||||||
|
DetectShapes(TopAbs_EDGE);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : DetectShapes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType)
|
||||||
|
{
|
||||||
|
Standard_Boolean bDegenerated;
|
||||||
|
Standard_Integer i, aNbF, aNbSDF, iErr;
|
||||||
|
TopTools_IndexedMapOfShape aMF;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItLS;
|
||||||
|
GEOMAlgo_PassKeyShape aPKF;
|
||||||
|
GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
//
|
||||||
|
TopExp::MapShapes(myArgument, aType, aMF);
|
||||||
|
//
|
||||||
|
aNbF=aMF.Extent();
|
||||||
|
for (i=1; i<=aNbF; ++i) {
|
||||||
|
const TopoDS_Shape& aS=aMF(i);
|
||||||
|
//
|
||||||
|
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, myTolerance, myContext);
|
||||||
|
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
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (aNbSDF==1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopoDS_Shape& aS1=aLSDF.First();
|
||||||
|
//
|
||||||
|
if (aType==TopAbs_EDGE) {
|
||||||
|
const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aS1);
|
||||||
|
bDegenerated=BRep_Tool::Degenerated(aE1);
|
||||||
|
if (bDegenerated) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
myImages.Bind(aS1, aLSDF);
|
||||||
|
// origins
|
||||||
|
aItLS.Initialize(aLSDF);
|
||||||
|
for (; aItLS.More(); aItLS.Next()) {
|
||||||
|
const TopoDS_Shape& aFSD=aItLS.Value();
|
||||||
|
if (!myOrigins.IsBound(aFSD)) {
|
||||||
|
myOrigins.Bind(aFSD, aS1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}// for (i=1; i<=aNbF; ++i)
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FacePassKey
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GlueDetector::FacePassKey(const TopoDS_Face& aF,
|
||||||
|
GEOMAlgo_PassKeyShape& aPK)
|
||||||
|
{
|
||||||
|
Standard_Integer i, aNbE;
|
||||||
|
TopoDS_Shape aER;
|
||||||
|
TopTools_ListOfShape aLE;
|
||||||
|
TopTools_IndexedMapOfShape aME;
|
||||||
|
//
|
||||||
|
TopExp::MapShapes(aF, TopAbs_EDGE, aME);
|
||||||
|
//
|
||||||
|
aNbE=aME.Extent();
|
||||||
|
for (i=1; i<=aNbE; ++i) {
|
||||||
|
const TopoDS_Shape& aE=aME(i);
|
||||||
|
//
|
||||||
|
const TopoDS_Edge& aEE=*((TopoDS_Edge*)&aE);
|
||||||
|
if (BRep_Tool::Degenerated(aEE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (myOrigins.IsBound(aE)) {
|
||||||
|
aER=myOrigins.Find(aE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aER=aE;
|
||||||
|
}
|
||||||
|
aLE.Append(aER);
|
||||||
|
}
|
||||||
|
aPK.SetShapes(aLE);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : EdgePassKey
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
|
||||||
|
GEOMAlgo_PassKeyShape& aPK)
|
||||||
|
{
|
||||||
|
TopAbs_Orientation aOr;
|
||||||
|
TopoDS_Shape aVR;
|
||||||
|
TopoDS_Iterator aIt;
|
||||||
|
TopTools_ListOfShape aLV;
|
||||||
|
//
|
||||||
|
aIt.Initialize(aE);
|
||||||
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
const TopoDS_Shape& aV=aIt.Value();
|
||||||
|
aOr=aV.Orientation();
|
||||||
|
if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
|
||||||
|
if (myOrigins.IsBound(aV)) {
|
||||||
|
aVR=myOrigins.Find(aV);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aVR=aV;
|
||||||
|
}
|
||||||
|
aLV.Append(aVR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aPK.SetShapes(aLV);
|
||||||
|
}
|
67
src/GEOMAlgo/GEOMAlgo_GlueDetector.hxx
Normal file
67
src/GEOMAlgo/GEOMAlgo_GlueDetector.hxx
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
// Copyright (C) 2007-2010 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// File: GEOMAlgo_GlueDetector.hxx
|
||||||
|
// Created:
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
// <pkv@irinox>
|
||||||
|
//
|
||||||
|
#ifndef _GEOMAlgo_GlueDetector_HeaderFile
|
||||||
|
#define _GEOMAlgo_GlueDetector_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#include <GEOMAlgo_GluerAlgo.hxx>
|
||||||
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
|
#include <GEOMAlgo_PassKeyShape.hxx>
|
||||||
|
#include <GEOMAlgo_Algo.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GEOMAlgo_GlueDetector
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
class GEOMAlgo_GlueDetector : public GEOMAlgo_GluerAlgo,
|
||||||
|
public GEOMAlgo_Algo {
|
||||||
|
public:
|
||||||
|
Standard_EXPORT GEOMAlgo_GlueDetector();
|
||||||
|
|
||||||
|
Standard_EXPORT virtual ~GEOMAlgo_GlueDetector();
|
||||||
|
|
||||||
|
Standard_EXPORT virtual void Perform() ;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Standard_EXPORT void DetectVertices() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void DetectEdges() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void DetectFaces() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void DetectShapes(const TopAbs_ShapeEnum aType) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,
|
||||||
|
GEOMAlgo_PassKeyShape& aPK) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,
|
||||||
|
GEOMAlgo_PassKeyShape& aPK) ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
#endif
|
@ -1,28 +1,34 @@
|
|||||||
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
// File generated by CPPExt (Value)
|
||||||
//
|
//
|
||||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
// Copyright (C) 1991 - 2000 by
|
||||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
// Matra Datavision SA. All rights reserved.
|
||||||
//
|
//
|
||||||
// This library is free software; you can redistribute it and/or
|
// Copyright (C) 2001 - 2004 by
|
||||||
// modify it under the terms of the GNU Lesser General Public
|
// Open CASCADE SA. All rights reserved.
|
||||||
// License as published by the Free Software Foundation; either
|
|
||||||
// version 2.1 of the License.
|
|
||||||
//
|
//
|
||||||
// This library is distributed in the hope that it will be useful,
|
// This file is part of the Open CASCADE Technology software.
|
||||||
// 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
|
// This software may be distributed and/or modified under the terms and
|
||||||
// License along with this library; if not, write to the Free Software
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
//
|
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
|
||||||
//
|
//
|
||||||
|
// 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_Gluer_HeaderFile
|
#ifndef _GEOMAlgo_Gluer_HeaderFile
|
||||||
#define _GEOMAlgo_Gluer_HeaderFile
|
#define _GEOMAlgo_Gluer_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Macro_HeaderFile
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _Standard_Boolean_HeaderFile
|
#ifndef _Standard_Boolean_HeaderFile
|
||||||
#include <Standard_Boolean.hxx>
|
#include <Standard_Boolean.hxx>
|
||||||
#endif
|
#endif
|
||||||
@ -41,18 +47,12 @@
|
|||||||
#ifndef _TopTools_ListOfShape_HeaderFile
|
#ifndef _TopTools_ListOfShape_HeaderFile
|
||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_ListOfShape.hxx>
|
||||||
#endif
|
#endif
|
||||||
#ifndef _TopTools_MapOfShape_HeaderFile
|
|
||||||
#include <TopTools_MapOfShape.hxx>
|
|
||||||
#endif
|
|
||||||
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
|
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
|
||||||
#include <GEOMAlgo_ShapeAlgo.hxx>
|
#include <GEOMAlgo_ShapeAlgo.hxx>
|
||||||
#endif
|
#endif
|
||||||
#ifndef _TopAbs_ShapeEnum_HeaderFile
|
#ifndef _TopAbs_ShapeEnum_HeaderFile
|
||||||
#include <TopAbs_ShapeEnum.hxx>
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
#endif
|
#endif
|
||||||
#ifndef _TopoDS_Compound_HeaderFile
|
|
||||||
#include <TopoDS_Compound.hxx>
|
|
||||||
#endif
|
|
||||||
class TopTools_ListOfShape;
|
class TopTools_ListOfShape;
|
||||||
class TopoDS_Shape;
|
class TopoDS_Shape;
|
||||||
class TopoDS_Edge;
|
class TopoDS_Edge;
|
||||||
@ -61,18 +61,12 @@ class TopoDS_Face;
|
|||||||
class TopoDS_Vertex;
|
class TopoDS_Vertex;
|
||||||
class TopTools_DataMapOfShapeListOfShape;
|
class TopTools_DataMapOfShapeListOfShape;
|
||||||
class TopTools_DataMapOfShapeShape;
|
class TopTools_DataMapOfShapeShape;
|
||||||
|
class TopTools_MapOfShape;
|
||||||
|
class TopoDS_Compound;
|
||||||
|
|
||||||
|
|
||||||
#ifndef _Standard_HeaderFile
|
|
||||||
#include <Standard.hxx>
|
|
||||||
#endif
|
|
||||||
#ifndef _Standard_Macro_HeaderFile
|
|
||||||
#include <Standard_Macro.hxx>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
class GEOMAlgo_Gluer : public GEOMAlgo_ShapeAlgo {
|
class GEOMAlgo_Gluer : public GEOMAlgo_ShapeAlgo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void* operator new(size_t,void* anAddress)
|
void* operator new(size_t,void* anAddress)
|
||||||
@ -87,125 +81,88 @@ public:
|
|||||||
{
|
{
|
||||||
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
}
|
}
|
||||||
// Methods PUBLIC
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT GEOMAlgo_Gluer();
|
Standard_EXPORT GEOMAlgo_Gluer();
|
||||||
Standard_EXPORT virtual ~GEOMAlgo_Gluer();
|
Standard_EXPORT virtual ~GEOMAlgo_Gluer();
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;
|
Standard_EXPORT void SetCheckGeometry(const Standard_Boolean aFlag) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean CheckGeometry() const;
|
Standard_EXPORT Standard_Boolean CheckGeometry() const;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean aFlag) ;
|
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT virtual void Perform() ;
|
Standard_EXPORT virtual void Perform() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT Standard_Integer AloneShapes() const;
|
Standard_EXPORT Standard_Integer AloneShapes() const;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ;
|
Standard_EXPORT const TopTools_ListOfShape& Modified(const TopoDS_Shape& S) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) ;
|
Standard_EXPORT const TopTools_ListOfShape& Generated(const TopoDS_Shape& S) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& S) ;
|
Standard_EXPORT Standard_Boolean IsDeleted(const TopoDS_Shape& S) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const;
|
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const;
|
Standard_EXPORT const TopTools_DataMapOfShapeShape& Origins() const;
|
||||||
|
|
||||||
|
Standard_EXPORT void MakeSubShapes(const TopoDS_Shape& aS,TopTools_MapOfShape& aM,TopoDS_Compound& aC) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean bFlag) ;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Boolean KeepNonSolids() const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Methods PROTECTED
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT virtual void CheckData() ;
|
Standard_EXPORT virtual void CheckData() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT virtual void CheckResult() ;
|
Standard_EXPORT virtual void CheckResult() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeVertices() ;
|
Standard_EXPORT void MakeVertices() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeEdges() ;
|
Standard_EXPORT void MakeEdges() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeFaces() ;
|
Standard_EXPORT void MakeFaces() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeShapes(const TopAbs_ShapeEnum aType) ;
|
Standard_EXPORT void MakeShapes(const TopAbs_ShapeEnum aType) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeShells() ;
|
Standard_EXPORT void MakeShells() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeSubShapes(const TopoDS_Shape& theShape,
|
|
||||||
TopTools_MapOfShape& theMS,
|
|
||||||
TopoDS_Compound& theResult);
|
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeSolids() ;
|
Standard_EXPORT void MakeSolids() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void InnerTolerance() ;
|
Standard_EXPORT void InnerTolerance() ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,GEOMAlgo_PassKeyShape& aPK) ;
|
Standard_EXPORT void EdgePassKey(const TopoDS_Edge& aE,GEOMAlgo_PassKeyShape& aPK) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,GEOMAlgo_PassKeyShape& aPK) ;
|
Standard_EXPORT void FacePassKey(const TopoDS_Face& aF,GEOMAlgo_PassKeyShape& aPK) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeVertex(const TopTools_ListOfShape& aLV,TopoDS_Vertex& aNewV) ;
|
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 MakeEdge(const TopoDS_Edge& aEdge,TopoDS_Edge& aNewEdge) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT void MakeFace(const TopoDS_Face& aFace,TopoDS_Face& 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) ;
|
Standard_EXPORT Standard_Boolean IsToReverse(const TopoDS_Face& aFR,const TopoDS_Face& aF) ;
|
||||||
|
|
||||||
|
|
||||||
Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const;
|
Standard_EXPORT Standard_Boolean HasNewSubShape(const TopoDS_Shape& aS) const;
|
||||||
|
|
||||||
|
|
||||||
// Fields PROTECTED
|
|
||||||
//
|
|
||||||
Standard_Boolean myCheckGeometry;
|
Standard_Boolean myCheckGeometry;
|
||||||
Standard_Boolean myKeepNonSolids;
|
|
||||||
Standard_Real myTol;
|
Standard_Real myTol;
|
||||||
TopTools_DataMapOfShapeListOfShape myImages;
|
TopTools_DataMapOfShapeListOfShape myImages;
|
||||||
TopTools_DataMapOfShapeShape myOrigins;
|
TopTools_DataMapOfShapeShape myOrigins;
|
||||||
Standard_Integer myNbAlone;
|
Standard_Integer myNbAlone;
|
||||||
TopTools_ListOfShape myGenerated;
|
TopTools_ListOfShape myGenerated;
|
||||||
|
Standard_Boolean myKeepNonSolids;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Methods PRIVATE
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
// Fields PRIVATE
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -215,7 +172,6 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
// other Inline functions and methods (like "C++: function call" methods)
|
// other Inline functions and methods (like "C++: function call" methods)
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
626
src/GEOMAlgo/GEOMAlgo_Gluer2.cxx
Normal file
626
src/GEOMAlgo/GEOMAlgo_Gluer2.cxx
Normal file
@ -0,0 +1,626 @@
|
|||||||
|
// Copyright (C) 2007-2008 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
// File: GEOMAlgo_Gluer2.cxx
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
|
||||||
|
#include <GEOMAlgo_Gluer2.hxx>
|
||||||
|
|
||||||
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
|
|
||||||
|
#include <TopoDS_Compound.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <BRepLib.hxx>
|
||||||
|
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||||
|
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
|
||||||
|
#include <GEOMAlgo_GlueDetector.hxx>
|
||||||
|
#include <GEOMAlgo_Tools3D.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GEOMAlgo_Gluer2
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
GEOMAlgo_Gluer2::GEOMAlgo_Gluer2()
|
||||||
|
:
|
||||||
|
GEOMAlgo_GluerAlgo(),
|
||||||
|
GEOMAlgo_BuilderShape()
|
||||||
|
{
|
||||||
|
myTolerance=0.0001;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : ~GEOMAlgo_Gluer2
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
GEOMAlgo_Gluer2::~GEOMAlgo_Gluer2()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Clear
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::Clear()
|
||||||
|
{
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
GEOMAlgo_GluerAlgo::Clear();
|
||||||
|
//
|
||||||
|
myImagesDetected.Clear();
|
||||||
|
myOriginsDetected.Clear();
|
||||||
|
myShapesToGlue.Clear();
|
||||||
|
myImagesToWork.Clear();
|
||||||
|
myOriginsToWork.Clear();
|
||||||
|
myKeepNonSolids=Standard_False;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetShapesToGlue
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM)
|
||||||
|
{
|
||||||
|
myShapesToGlue=aM;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : ShapesToGlue
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesToGlue()const
|
||||||
|
{
|
||||||
|
return myShapesToGlue;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetKeepNonSolids
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::SetKeepNonSolids(const Standard_Boolean aFlag)
|
||||||
|
{
|
||||||
|
myKeepNonSolids=aFlag;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : KeepNonSolids
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean GEOMAlgo_Gluer2::KeepNonSolids()const
|
||||||
|
{
|
||||||
|
return myKeepNonSolids;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : ShapesDetected
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ShapesDetected()const
|
||||||
|
{
|
||||||
|
return myImagesDetected;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : ImagesToWork
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer2::ImagesToWork()const
|
||||||
|
{
|
||||||
|
return myImagesToWork;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::Perform()
|
||||||
|
{
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
CheckData();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
PerformShapesToWork();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (myWarningStatus==1) {// no shapes to glue
|
||||||
|
myShape=myArgument;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
FillVertices();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
FillEdges();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
FillWires();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
FillFaces();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
FillShells();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
FillSolids();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
FillCompSolids();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
FillCompounds();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
BuildResult();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
PrepareHistory();
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
BRepLib::SameParameter(myShape, myTolerance, Standard_True);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : CheckData
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::CheckData()
|
||||||
|
{
|
||||||
|
Standard_Integer aNbSG, i;
|
||||||
|
TopAbs_ShapeEnum aType, aTypeX;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItLS;
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
aNbSG=myShapesToGlue.Extent();
|
||||||
|
if (aNbSG) {
|
||||||
|
// Check myShapesToGlue
|
||||||
|
aItDMSLS.Initialize(myShapesToGlue);
|
||||||
|
for (; aItDMSLS.More(); aItDMSLS.Next()) {
|
||||||
|
//const TopoDS_Shape& aSkey=aItDMSLS.Key();
|
||||||
|
const TopTools_ListOfShape& aLSG=aItDMSLS.Value();
|
||||||
|
aItLS.Initialize(aLSG);
|
||||||
|
for (i=0; aItLS.More(); aItLS.Next(), ++i) {
|
||||||
|
const TopoDS_Shape& aSG=aItLS.Value();
|
||||||
|
aTypeX=aSG.ShapeType();
|
||||||
|
if (!i) {
|
||||||
|
aType=aTypeX;
|
||||||
|
if (!(aType==TopAbs_VERTEX ||
|
||||||
|
aType==TopAbs_EDGE ||
|
||||||
|
aType==TopAbs_FACE)) {
|
||||||
|
myErrorStatus=21;// non-brep shapes
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (aTypeX!=aType) {
|
||||||
|
myErrorStatus=20;// non-homogeneous shapes
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}// if (aNbSG) {
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillEdges
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillEdges()
|
||||||
|
{
|
||||||
|
FillBRepShapes(TopAbs_EDGE);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillFaces
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillFaces()
|
||||||
|
{
|
||||||
|
FillBRepShapes(TopAbs_FACE);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillWires
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillWires()
|
||||||
|
{
|
||||||
|
FillContainers(TopAbs_WIRE);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillShells
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillShells()
|
||||||
|
{
|
||||||
|
FillContainers(TopAbs_SHELL);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillSolids
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillSolids()
|
||||||
|
{
|
||||||
|
FillContainers(TopAbs_SOLID);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillCompSolids
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillCompSolids()
|
||||||
|
{
|
||||||
|
FillContainers(TopAbs_COMPSOLID);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillVertices
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillVertices()
|
||||||
|
{
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
TopoDS_Vertex aVnew;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItLS;
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
aItDMSLS.Initialize(myImagesToWork);
|
||||||
|
for (; aItDMSLS.More(); aItDMSLS.Next()) {
|
||||||
|
const TopoDS_Shape& aSkey=aItDMSLS.Key();
|
||||||
|
aType=aSkey.ShapeType();
|
||||||
|
if (aType!=TopAbs_VERTEX) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
|
||||||
|
//
|
||||||
|
GEOMAlgo_Gluer2::MakeVertex(aLSD, aVnew);
|
||||||
|
//
|
||||||
|
myImages.Bind(aVnew, aLSD);
|
||||||
|
//
|
||||||
|
aItLS.Initialize(aLSD);
|
||||||
|
for (; aItLS.More(); aItLS.Next()) {
|
||||||
|
const TopoDS_Shape& aV=aItLS.Value();
|
||||||
|
myOrigins.Bind(aV, aVnew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillBRepShapes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillBRepShapes(const TopAbs_ShapeEnum theType)
|
||||||
|
{
|
||||||
|
Standard_Boolean bHasImage, bIsToWork;
|
||||||
|
Standard_Integer i, aNbE;
|
||||||
|
TopoDS_Iterator aItS;
|
||||||
|
TopoDS_Shape aEnew;
|
||||||
|
TopTools_IndexedMapOfShape aME;
|
||||||
|
TopTools_MapOfShape aMFence;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItLS;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
TopExp::MapShapes(myArgument, theType, aME);
|
||||||
|
//
|
||||||
|
aNbE=aME.Extent();
|
||||||
|
for (i=1; i<=aNbE; ++i) {
|
||||||
|
const TopoDS_Shape& aE=aME(i);
|
||||||
|
//
|
||||||
|
if (!aMFence.Add(aE)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bIsToWork=myOriginsToWork.IsBound(aE);
|
||||||
|
bHasImage=HasImage(aE);
|
||||||
|
if (!bHasImage && !bIsToWork) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
MakeBRepShapes(aE, aEnew);
|
||||||
|
//
|
||||||
|
//myImages / myOrigins
|
||||||
|
if (bIsToWork) {
|
||||||
|
const TopoDS_Shape& aSkey=myOriginsToWork.Find(aE);
|
||||||
|
const TopTools_ListOfShape& aLSD=myImagesToWork.Find(aSkey);
|
||||||
|
//
|
||||||
|
myImages.Bind(aEnew, aLSD);
|
||||||
|
//
|
||||||
|
aItLS.Initialize(aLSD);
|
||||||
|
for (; aItLS.More(); aItLS.Next()) {
|
||||||
|
const TopoDS_Shape& aEx=aItLS.Value();
|
||||||
|
myOrigins.Bind(aEx, aEnew);
|
||||||
|
//
|
||||||
|
aMFence.Add(aEx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TopTools_ListOfShape aLSD;
|
||||||
|
//
|
||||||
|
aLSD.Append(aE);
|
||||||
|
myImages.Bind(aEnew, aLSD);
|
||||||
|
myOrigins.Bind(aE, aEnew);
|
||||||
|
}
|
||||||
|
}//for (i=1; i<=aNbF; ++i) {
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillContainers
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillContainers(const TopAbs_ShapeEnum aType)
|
||||||
|
{
|
||||||
|
Standard_Boolean bHasImage, bToReverse;
|
||||||
|
Standard_Integer i, aNbW;
|
||||||
|
TopoDS_Shape aWnew, aEnew;
|
||||||
|
TopoDS_Iterator aItS;
|
||||||
|
BRep_Builder aBB;
|
||||||
|
TopTools_IndexedMapOfShape aMW;
|
||||||
|
TopTools_MapOfShape aMFence;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
TopExp::MapShapes(myArgument, aType, aMW);
|
||||||
|
//
|
||||||
|
aNbW=aMW.Extent();
|
||||||
|
for (i=1; i<=aNbW; ++i) {
|
||||||
|
const TopoDS_Shape& aW=aMW(i);
|
||||||
|
//
|
||||||
|
if (!aMFence.Add(aW)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bHasImage=HasImage(aW);
|
||||||
|
if (!bHasImage) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
GEOMAlgo_Tools3D::MakeContainer(aType, aWnew);
|
||||||
|
//
|
||||||
|
aItS.Initialize(aW);
|
||||||
|
for (; aItS.More(); aItS.Next()) {
|
||||||
|
const TopoDS_Shape& aE=aItS.Value();
|
||||||
|
if (myOrigins.IsBound(aE)) {
|
||||||
|
aEnew=myOrigins.Find(aE);
|
||||||
|
//
|
||||||
|
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aEnew, aE, myContext);
|
||||||
|
if (bToReverse) {
|
||||||
|
aEnew.Reverse();
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aBB.Add(aWnew, aEnew);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aBB.Add(aWnew, aE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aWnew.Orientation(aW.Orientation());
|
||||||
|
//
|
||||||
|
//myImages / myOrigins
|
||||||
|
TopTools_ListOfShape aLSD;
|
||||||
|
//
|
||||||
|
aLSD.Append(aW);
|
||||||
|
myImages.Bind(aWnew, aLSD);
|
||||||
|
myOrigins.Bind(aW, aWnew);
|
||||||
|
//
|
||||||
|
}//for (i=1; i<=aNbE; ++i) {
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillCompounds
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillCompounds()
|
||||||
|
{
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
TopoDS_Iterator aItC;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
aItC.Initialize(myArgument);
|
||||||
|
for (; aItC.More(); aItC.Next()) {
|
||||||
|
const TopoDS_Shape& aCx=aItC.Value();
|
||||||
|
aType=aCx.ShapeType();
|
||||||
|
if (aType==TopAbs_COMPOUND) {
|
||||||
|
FillCompound(aCx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : FillCompound
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::FillCompound(const TopoDS_Shape& aC)
|
||||||
|
{
|
||||||
|
Standard_Boolean bHasImage;
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
TopoDS_Shape aCnew, aCXnew;
|
||||||
|
TopoDS_Iterator aItC;
|
||||||
|
BRep_Builder aBB;
|
||||||
|
//
|
||||||
|
bHasImage=HasImage(aC);
|
||||||
|
if (!bHasImage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
|
||||||
|
//
|
||||||
|
aItC.Initialize(aC);
|
||||||
|
for (; aItC.More(); aItC.Next()) {
|
||||||
|
const TopoDS_Shape& aCX=aItC.Value();
|
||||||
|
aType=aCX.ShapeType();
|
||||||
|
//
|
||||||
|
if (aType==TopAbs_COMPOUND) {
|
||||||
|
FillCompound(aCX);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (myOrigins.IsBound(aCX)) {
|
||||||
|
aCXnew=myOrigins.Find(aCX);
|
||||||
|
aCXnew.Orientation(aCX.Orientation());
|
||||||
|
aBB.Add(aCnew, aCXnew);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aBB.Add(aCnew, aCX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
//myImages / myOrigins
|
||||||
|
TopTools_ListOfShape aLSD;
|
||||||
|
//
|
||||||
|
aLSD.Append(aC);
|
||||||
|
myImages.Bind(aCnew, aLSD);
|
||||||
|
myOrigins.Bind(aC, aCnew);
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : HasImage
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean GEOMAlgo_Gluer2::HasImage(const TopoDS_Shape& aC)
|
||||||
|
{
|
||||||
|
Standard_Boolean bRet;
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
TopoDS_Iterator aItC;
|
||||||
|
//
|
||||||
|
bRet=Standard_False;
|
||||||
|
aItC.Initialize(aC);
|
||||||
|
for (; aItC.More(); aItC.Next()) {
|
||||||
|
const TopoDS_Shape& aCx=aItC.Value();
|
||||||
|
aType=aCx.ShapeType();
|
||||||
|
//
|
||||||
|
if (aType==TopAbs_COMPOUND) {
|
||||||
|
bRet=HasImage(aCx);
|
||||||
|
if (bRet) {
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bRet=myOrigins.IsBound(aCx);
|
||||||
|
if (bRet) {
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bRet=myOrigins.IsBound(aC);
|
||||||
|
//
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : BuildResult
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::BuildResult()
|
||||||
|
{
|
||||||
|
Standard_Boolean bHasImage;
|
||||||
|
TopoDS_Shape aCnew, aCXnew;
|
||||||
|
TopoDS_Iterator aItC;
|
||||||
|
BRep_Builder aBB;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
aItC.Initialize(myArgument);
|
||||||
|
for (; aItC.More(); aItC.Next()) {
|
||||||
|
const TopoDS_Shape& aCx=aItC.Value();
|
||||||
|
bHasImage=HasImage(aCx);
|
||||||
|
if (bHasImage) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!bHasImage) {
|
||||||
|
myShape=myArgument;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew);
|
||||||
|
//
|
||||||
|
aItC.Initialize(myArgument);
|
||||||
|
for (; aItC.More(); aItC.Next()) {
|
||||||
|
const TopoDS_Shape& aCX=aItC.Value();
|
||||||
|
if (myOrigins.IsBound(aCX)) {
|
||||||
|
aCXnew=myOrigins.Find(aCX);
|
||||||
|
aCXnew.Orientation(aCX.Orientation());
|
||||||
|
aBB.Add(aCnew, aCXnew);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aBB.Add(aCnew, aCX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!myKeepNonSolids) {
|
||||||
|
Standard_Integer i, aNb;
|
||||||
|
TopoDS_Shape aCnew1;
|
||||||
|
TopTools_IndexedMapOfShape aM;
|
||||||
|
//
|
||||||
|
GEOMAlgo_Tools3D::MakeContainer(TopAbs_COMPOUND, aCnew1);
|
||||||
|
//
|
||||||
|
TopExp::MapShapes(aCnew, TopAbs_SOLID, aM);
|
||||||
|
|
||||||
|
aNb=aM.Extent();
|
||||||
|
for (i=1; i<=aNb; ++i) {
|
||||||
|
const TopoDS_Shape& aS=aM(i);
|
||||||
|
aBB.Add(aCnew1, aS);
|
||||||
|
}
|
||||||
|
aCnew=aCnew1;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
myShape=aCnew;
|
||||||
|
}
|
||||||
|
//--------------------------------------------------------
|
||||||
|
//
|
||||||
|
// ErrorStatus
|
||||||
|
// 11 - GEOMAlgo_GlueDetector failed
|
||||||
|
// 13 - PerformImagesToWork failed
|
||||||
|
// 14 - PerformImagesToWork failed
|
||||||
|
//
|
||||||
|
// WarningStatus
|
||||||
|
// 1 - no shapes to glue
|
144
src/GEOMAlgo/GEOMAlgo_Gluer2.hxx
Normal file
144
src/GEOMAlgo/GEOMAlgo_Gluer2.hxx
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
// Copyright (C) 2007-2010 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// File: GEOMAlgo_Gluer2.hxx
|
||||||
|
// Created:
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
// <pkv@irinox>
|
||||||
|
|
||||||
|
#ifndef _GEOMAlgo_Gluer2_HeaderFile
|
||||||
|
#define _GEOMAlgo_Gluer2_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
|
||||||
|
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||||
|
#include <Standard_Boolean.hxx>
|
||||||
|
#include <GEOMAlgo_GluerAlgo.hxx>
|
||||||
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
|
#include <NMTTools_CoupleOfShape.hxx>
|
||||||
|
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||||
|
#include <GEOMAlgo_BuilderShape.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//class : GEOMAlgo_Gluer2
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
class GEOMAlgo_Gluer2 : public GEOMAlgo_GluerAlgo,
|
||||||
|
public GEOMAlgo_BuilderShape {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Standard_EXPORT GEOMAlgo_Gluer2();
|
||||||
|
|
||||||
|
Standard_EXPORT virtual ~GEOMAlgo_Gluer2();
|
||||||
|
|
||||||
|
Standard_EXPORT void SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) ;
|
||||||
|
|
||||||
|
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& ShapesToGlue() const;
|
||||||
|
|
||||||
|
Standard_EXPORT void SetKeepNonSolids(const Standard_Boolean theFlag) ;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Boolean KeepNonSolids() const;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual void Clear() ;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual void Perform() ;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual void CheckData() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void Detect() ;
|
||||||
|
|
||||||
|
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& ShapesDetected() const;
|
||||||
|
|
||||||
|
Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& ImagesToWork() const;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) ;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS) ;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& theS) ;
|
||||||
|
|
||||||
|
Standard_EXPORT static void MakeVertex(const TopTools_ListOfShape& theLV,
|
||||||
|
TopoDS_Vertex& theV) ;
|
||||||
|
|
||||||
|
Standard_EXPORT static void MapBRepShapes(const TopoDS_Shape& theS,
|
||||||
|
TopTools_MapOfShape& theM) ;
|
||||||
|
|
||||||
|
Standard_EXPORT static void MapShapes(const TopoDS_Shape& theS,
|
||||||
|
TopTools_MapOfShape& theM) ;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
Standard_EXPORT void PerformShapesToWork() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillVertices() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillEdges() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillWires() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillFaces() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillShells() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillSolids() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillCompSolids() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillCompounds() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void BuildResult() ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillBRepShapes(const TopAbs_ShapeEnum theType) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillContainers(const TopAbs_ShapeEnum theType) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void FillCompound(const TopoDS_Shape& theC) ;
|
||||||
|
|
||||||
|
Standard_EXPORT virtual void PrepareHistory() ;
|
||||||
|
|
||||||
|
Standard_EXPORT Standard_Boolean HasImage(const TopoDS_Shape& theC) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void MakeBRepShapes(const TopoDS_Shape& theS,
|
||||||
|
TopoDS_Shape& theSnew) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void MakeEdge(const TopoDS_Edge& theE,
|
||||||
|
TopoDS_Edge& theEnew) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void MakeFace(const TopoDS_Face& theF,
|
||||||
|
TopoDS_Face& theFnew) ;
|
||||||
|
|
||||||
|
Standard_EXPORT void TreatPair(const NMTTools_CoupleOfShape& theCS,
|
||||||
|
NMTTools_ListOfCoupleOfShape& theLCS) ;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TopTools_DataMapOfShapeListOfShape myShapesToGlue;
|
||||||
|
TopTools_DataMapOfShapeListOfShape myImagesDetected;
|
||||||
|
TopTools_DataMapOfShapeShape myOriginsDetected;
|
||||||
|
TopTools_DataMapOfShapeListOfShape myImagesToWork;
|
||||||
|
TopTools_DataMapOfShapeShape myOriginsToWork;
|
||||||
|
Standard_Boolean myKeepNonSolids;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
#endif
|
319
src/GEOMAlgo/GEOMAlgo_Gluer2_1.cxx
Normal file
319
src/GEOMAlgo/GEOMAlgo_Gluer2_1.cxx
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
// Copyright (C) 2007-2008 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// File: GEOMAlgo_Gluer2_1.cxx
|
||||||
|
// Created:
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
// <peter@PREFEX>
|
||||||
|
//
|
||||||
|
#include <GEOMAlgo_Gluer2.hxx>
|
||||||
|
|
||||||
|
#include <gp_XYZ.hxx>
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
|
||||||
|
#include <TopLoc_Location.hxx>
|
||||||
|
|
||||||
|
#include <Geom_Surface.hxx>
|
||||||
|
|
||||||
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
|
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <TopoDS_Wire.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
|
||||||
|
#include <BOPTools_Tools.hxx>
|
||||||
|
#include <BOPTools_Tools2D.hxx>
|
||||||
|
#include <BOPTools_Tools3D.hxx>
|
||||||
|
|
||||||
|
#include <GEOMAlgo_Tools.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : MakeBRepShapes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::MakeBRepShapes(const TopoDS_Shape& theS,
|
||||||
|
TopoDS_Shape& theSnew)
|
||||||
|
{
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
//
|
||||||
|
aType=theS.ShapeType();
|
||||||
|
if (aType==TopAbs_EDGE) {
|
||||||
|
TopoDS_Edge aEE, aEEnew;
|
||||||
|
//
|
||||||
|
aEE=*((TopoDS_Edge*)&theS);
|
||||||
|
MakeEdge(aEE, aEEnew);
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
theSnew=aEEnew;
|
||||||
|
}
|
||||||
|
else if (aType==TopAbs_FACE) {
|
||||||
|
TopoDS_Face aFF, aFFnew;
|
||||||
|
//
|
||||||
|
aFF=*((TopoDS_Face*)&theS);
|
||||||
|
MakeFace(aFF, aFFnew);
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
theSnew=aFFnew;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : MakeFace
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::MakeFace(const TopoDS_Face& theF,
|
||||||
|
TopoDS_Face& theFnew)
|
||||||
|
{
|
||||||
|
Standard_Boolean bIsToReverse, bIsUPeriodic;
|
||||||
|
Standard_Real aTol, aUMin, aUMax, aVMin, aVMax;
|
||||||
|
TopAbs_Orientation aOrE;
|
||||||
|
Handle(Geom_Surface) aS;
|
||||||
|
TopLoc_Location aLoc;
|
||||||
|
TopoDS_Shape aW, aWr;
|
||||||
|
TopoDS_Edge aEx;
|
||||||
|
TopoDS_Face aFF, aFnew;
|
||||||
|
TopoDS_Iterator aItW, aItE;
|
||||||
|
BRep_Builder aBB;
|
||||||
|
TopTools_ListOfShape aLEr;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItLE;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
//
|
||||||
|
aFF=theF;
|
||||||
|
aFF.Orientation(TopAbs_FORWARD);
|
||||||
|
//
|
||||||
|
aTol=BRep_Tool::Tolerance(aFF);
|
||||||
|
aS=BRep_Tool::Surface(aFF, aLoc);
|
||||||
|
bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
|
||||||
|
BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
|
||||||
|
//
|
||||||
|
aBB.MakeFace (aFnew, aS, aLoc, aTol);
|
||||||
|
//
|
||||||
|
aItW.Initialize(aFF);
|
||||||
|
for (; aItW.More(); aItW.Next()) {
|
||||||
|
const TopoDS_Shape& aW=aItW.Value();
|
||||||
|
//
|
||||||
|
if (!myOrigins.IsBound(aW)) {
|
||||||
|
aBB.Add(aFnew, aW);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aWr=myOrigins.Find(aW);
|
||||||
|
//
|
||||||
|
// clear contents of Wr
|
||||||
|
aLEr.Clear();
|
||||||
|
aItE.Initialize(aWr);
|
||||||
|
for (; aItE.More(); aItE.Next()) {
|
||||||
|
const TopoDS_Shape& aEr=aItE.Value();
|
||||||
|
aLEr.Append(aEr);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aItLE.Initialize(aLEr);
|
||||||
|
for (; aItLE.More(); aItLE.Next()) {
|
||||||
|
const TopoDS_Shape& aEr=aItLE.Value();
|
||||||
|
aBB.Remove(aWr, aEr);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// refill contents of Wr
|
||||||
|
aItE.Initialize(aW);
|
||||||
|
for (; aItE.More(); aItE.Next()) {
|
||||||
|
const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aItE.Value()));
|
||||||
|
//
|
||||||
|
aEx=aE;
|
||||||
|
if (myOrigins.IsBound(aE)) {
|
||||||
|
aEx=*((TopoDS_Edge*)(&myOrigins.Find(aE)));
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!BRep_Tool::Degenerated(aEx)) {
|
||||||
|
aEx.Orientation(TopAbs_FORWARD);
|
||||||
|
if (bIsUPeriodic) {
|
||||||
|
GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aEx, aFF, aUMin, aUMax);
|
||||||
|
}
|
||||||
|
BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aEx, aFF);
|
||||||
|
//
|
||||||
|
bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aEx, aE, myContext);
|
||||||
|
if (bIsToReverse) {
|
||||||
|
aEx.Reverse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aEx.Orientation(aE.Orientation());
|
||||||
|
}
|
||||||
|
aBB.Add(aWr, aEx);
|
||||||
|
}// for (; aItE.More(); aItE.Next()) {
|
||||||
|
//
|
||||||
|
aBB.Add(aFnew, aWr);
|
||||||
|
}// for (; aItW.More(); aItW.Next()) {
|
||||||
|
theFnew=aFnew;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : MakeEdge
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::MakeEdge(const TopoDS_Edge& aE,
|
||||||
|
TopoDS_Edge& aNewEdge)
|
||||||
|
{
|
||||||
|
myErrorStatus=0;
|
||||||
|
//
|
||||||
|
Standard_Boolean bIsDE;
|
||||||
|
Standard_Real aT1, aT2;
|
||||||
|
TopoDS_Vertex aV1, aV2, aVR1, aVR2;
|
||||||
|
TopoDS_Edge aEx;
|
||||||
|
//
|
||||||
|
bIsDE=BRep_Tool::Degenerated(aE);
|
||||||
|
//
|
||||||
|
aEx=aE;
|
||||||
|
aEx.Orientation(TopAbs_FORWARD);
|
||||||
|
//
|
||||||
|
TopExp::Vertices(aEx, aV1, aV2);
|
||||||
|
//
|
||||||
|
aT1=BRep_Tool::Parameter(aV1, aEx);
|
||||||
|
aT2=BRep_Tool::Parameter(aV2, aEx);
|
||||||
|
//
|
||||||
|
aVR1=aV1;
|
||||||
|
if (myOrigins.IsBound(aV1)) {
|
||||||
|
aVR1=*((TopoDS_Vertex*)&myOrigins.Find(aV1));
|
||||||
|
}
|
||||||
|
aVR1.Orientation(TopAbs_FORWARD);
|
||||||
|
//
|
||||||
|
aVR2=aV2;
|
||||||
|
if (myOrigins.IsBound(aV2)) {
|
||||||
|
aVR2=*((TopoDS_Vertex*)&myOrigins.Find(aV2));
|
||||||
|
}
|
||||||
|
aVR2.Orientation(TopAbs_REVERSED);
|
||||||
|
//
|
||||||
|
if (!bIsDE) {
|
||||||
|
BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Standard_Real aTol;
|
||||||
|
BRep_Builder aBB;
|
||||||
|
TopoDS_Edge E;
|
||||||
|
TopAbs_Orientation anOrE;
|
||||||
|
//
|
||||||
|
anOrE=aE.Orientation();
|
||||||
|
aTol=BRep_Tool::Tolerance(aE);
|
||||||
|
//
|
||||||
|
E=aEx;
|
||||||
|
E.EmptyCopy();
|
||||||
|
//
|
||||||
|
aBB.Add (E, aVR1);
|
||||||
|
aBB.Add (E, aVR2);
|
||||||
|
aBB.Range(E, aT1, aT2);
|
||||||
|
aBB.Degenerated(E, Standard_True);
|
||||||
|
aBB.UpdateEdge(E, aTol);
|
||||||
|
//
|
||||||
|
aNewEdge=E;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : MakeVertex
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::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 : MapBRepShapes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::MapBRepShapes(const TopoDS_Shape& aS,
|
||||||
|
TopTools_MapOfShape& aM)
|
||||||
|
{
|
||||||
|
Standard_Boolean bHasBRep;
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
TopoDS_Iterator aIt;
|
||||||
|
//
|
||||||
|
aType=aS.ShapeType();
|
||||||
|
if (aType==TopAbs_VERTEX ||
|
||||||
|
aType==TopAbs_EDGE ||
|
||||||
|
aType==TopAbs_FACE) {
|
||||||
|
aM.Add(aS);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aIt.Initialize(aS);
|
||||||
|
for(; aIt.More(); aIt.Next()) {
|
||||||
|
const TopoDS_Shape& aSx=aIt.Value();
|
||||||
|
aType=aSx.ShapeType();
|
||||||
|
GEOMAlgo_Gluer2::MapBRepShapes(aSx, aM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// ErrorStatus
|
||||||
|
//
|
||||||
|
// 40 - GEOMAlgo_GlueDetector is failed
|
156
src/GEOMAlgo/GEOMAlgo_Gluer2_2.cxx
Normal file
156
src/GEOMAlgo/GEOMAlgo_Gluer2_2.cxx
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
// Copyright (C) 2007-2008 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// File: GEOMAlgo_Gluer2_2.cxx
|
||||||
|
// Created:
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
// <peter@PREFEX>
|
||||||
|
//
|
||||||
|
#include <GEOMAlgo_Gluer2.hxx>
|
||||||
|
|
||||||
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
|
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
|
#include <GEOMAlgo_BuilderShape.hxx>
|
||||||
|
#include <GEOMAlgo_Tools3D.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : PrepareHistory
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::PrepareHistory()
|
||||||
|
{
|
||||||
|
Standard_Boolean bHasImage, bContainsSD;
|
||||||
|
//
|
||||||
|
// 1. Clearing
|
||||||
|
GEOMAlgo_BuilderShape::PrepareHistory();
|
||||||
|
//
|
||||||
|
if(myShape.IsNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
GEOMAlgo_Gluer2::MapShapes(myShape, myMapShape);
|
||||||
|
//
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Generated
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_ListOfShape& GEOMAlgo_Gluer2::Generated(const TopoDS_Shape& )
|
||||||
|
{
|
||||||
|
myHistShapes.Clear();
|
||||||
|
return myHistShapes;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Modified
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_ListOfShape& GEOMAlgo_Gluer2::Modified(const TopoDS_Shape& theS)
|
||||||
|
{
|
||||||
|
Standard_Boolean bIsDeleted, bHasImage, bToReverse;
|
||||||
|
TopAbs_ShapeEnum aType;
|
||||||
|
TopoDS_Shape aSim;
|
||||||
|
//
|
||||||
|
myHistShapes.Clear();
|
||||||
|
//
|
||||||
|
aType=theS.ShapeType();
|
||||||
|
if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
|
||||||
|
aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
|
||||||
|
return myHistShapes;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bIsDeleted=IsDeleted(theS);
|
||||||
|
if (bIsDeleted) {
|
||||||
|
return myHistShapes;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bHasImage=myOrigins.IsBound(theS);
|
||||||
|
if (!bHasImage) {
|
||||||
|
return myHistShapes;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aSim=myOrigins.Find(theS);
|
||||||
|
if (aSim.IsSame(theS)){
|
||||||
|
return myHistShapes;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (aType==TopAbs_VERTEX || aType==TopAbs_SOLID) {
|
||||||
|
aSim.Orientation(theS.Orientation());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bToReverse=GEOMAlgo_Tools3D::IsSplitToReverse(aSim, theS, myContext);
|
||||||
|
if (bToReverse) {
|
||||||
|
aSim.Reverse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
myHistShapes.Append(aSim);
|
||||||
|
//
|
||||||
|
return myHistShapes;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsDeleted
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean GEOMAlgo_Gluer2::IsDeleted(const TopoDS_Shape& theS)
|
||||||
|
{
|
||||||
|
Standard_Boolean bRet, bContains, bHasImage;
|
||||||
|
//
|
||||||
|
bRet=Standard_False;
|
||||||
|
//
|
||||||
|
if (theS.IsNull()) {
|
||||||
|
return !bRet; //true
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bContains=myMapShape.Contains(theS);
|
||||||
|
if (bContains) {
|
||||||
|
return bRet; //false
|
||||||
|
}
|
||||||
|
//
|
||||||
|
bHasImage=myOrigins.IsBound(theS);
|
||||||
|
if (bHasImage) {
|
||||||
|
const TopoDS_Shape& aSim=myOrigins.Find(theS);
|
||||||
|
bContains=myMapShape.Contains(aSim);
|
||||||
|
if (bContains) {
|
||||||
|
return bRet; //false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
return !bRet; //true
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : MapShapes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::MapShapes(const TopoDS_Shape& theS,
|
||||||
|
TopTools_MapOfShape& theM)
|
||||||
|
{
|
||||||
|
TopoDS_Iterator aIt;
|
||||||
|
//
|
||||||
|
theM.Add(theS);
|
||||||
|
aIt.Initialize(theS);
|
||||||
|
for (; aIt.More(); aIt.Next()) {
|
||||||
|
const TopoDS_Shape& aSx=aIt.Value();
|
||||||
|
GEOMAlgo_Gluer2::MapShapes(aSx, theM);
|
||||||
|
}
|
||||||
|
}
|
347
src/GEOMAlgo/GEOMAlgo_Gluer2_3.cxx
Normal file
347
src/GEOMAlgo/GEOMAlgo_Gluer2_3.cxx
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
// Copyright (C) 2007-2008 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// File: GEOMAlgo_Gluer2_3.cxx
|
||||||
|
// Created:
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
// <peter@PREFEX>
|
||||||
|
//
|
||||||
|
#include <GEOMAlgo_Gluer2.hxx>
|
||||||
|
|
||||||
|
#include <TopAbs_ShapeEnum.hxx>
|
||||||
|
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
|
||||||
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||||
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
|
||||||
|
#include <NMTTools_CoupleOfShape.hxx>
|
||||||
|
#include <NMTTools_ListOfCoupleOfShape.hxx>
|
||||||
|
#include <NMTTools_ListIteratorOfListOfCoupleOfShape.hxx>
|
||||||
|
#include <NMTTools_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
|
||||||
|
#include <NMTTools_Tools.hxx>
|
||||||
|
|
||||||
|
#include <GEOMAlgo_GlueDetector.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
void MapShapes1(const TopoDS_Shape& aS,
|
||||||
|
const TopAbs_ShapeEnum aType,
|
||||||
|
TopTools_IndexedMapOfShape& aM);
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Detect
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::Detect()
|
||||||
|
{
|
||||||
|
Standard_Boolean bCheckGeometry;
|
||||||
|
Standard_Integer iErr, aNbSD;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItLS;
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
|
||||||
|
GEOMAlgo_GlueDetector aDetector;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
myImagesDetected.Clear();
|
||||||
|
myOriginsDetected.Clear();
|
||||||
|
//
|
||||||
|
bCheckGeometry=Standard_True;
|
||||||
|
aDetector.SetArgument(myArgument);
|
||||||
|
aDetector.SetTolerance(myTolerance);
|
||||||
|
aDetector.SetCheckGeometry(bCheckGeometry);
|
||||||
|
//
|
||||||
|
aDetector.Perform();
|
||||||
|
iErr=aDetector.ErrorStatus();
|
||||||
|
if (iErr) {
|
||||||
|
myErrorStatus=11;// Detector failed
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& aImages=aDetector.Images();
|
||||||
|
aItDMSLS.Initialize(aImages);
|
||||||
|
for (; aItDMSLS.More(); aItDMSLS.Next()) {
|
||||||
|
const TopoDS_Shape& aSkey=aItDMSLS.Key();
|
||||||
|
const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
|
||||||
|
aNbSD=aLSD.Extent();
|
||||||
|
myImagesDetected.Bind(aSkey, aLSD);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aItDMSLS.Initialize(myImagesDetected);
|
||||||
|
for (; aItDMSLS.More(); aItDMSLS.Next()) {
|
||||||
|
const TopoDS_Shape& aSkey=aItDMSLS.Key();
|
||||||
|
const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
|
||||||
|
aItLS.Initialize(aLSD);
|
||||||
|
for (; aItLS.More(); aItLS.Next()) {
|
||||||
|
const TopoDS_Shape& aSx=aItLS.Value();
|
||||||
|
myOriginsDetected.Bind(aSx, aSkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : PerformShapesToWork
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::PerformShapesToWork()
|
||||||
|
{
|
||||||
|
Standard_Integer aNbSG, i, j, aNbC, aNb, aNbSD;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItLS1, aItLS2;
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
|
||||||
|
NMTTools_CoupleOfShape aCS;
|
||||||
|
NMTTools_ListOfCoupleOfShape aLCS;
|
||||||
|
NMTTools_ListIteratorOfListOfCoupleOfShape aItCS;
|
||||||
|
//
|
||||||
|
myErrorStatus=0;
|
||||||
|
myWarningStatus=0;
|
||||||
|
//
|
||||||
|
myImagesToWork.Clear();
|
||||||
|
myOriginsToWork.Clear();
|
||||||
|
//
|
||||||
|
aNbSD=myImagesDetected.Extent();
|
||||||
|
if (!aNbSD) {// no shapes to glue detected
|
||||||
|
myWarningStatus=1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
aNbSG=myShapesToGlue.Extent();
|
||||||
|
if (!aNbSG) {
|
||||||
|
// glue all possible
|
||||||
|
myImagesToWork=myImagesDetected;
|
||||||
|
//
|
||||||
|
aItDMSLS.Initialize(myImagesToWork);
|
||||||
|
for (; aItDMSLS.More(); aItDMSLS.Next()) {
|
||||||
|
const TopoDS_Shape& aSkey=aItDMSLS.Key();
|
||||||
|
const TopTools_ListOfShape& aLSD=aItDMSLS.Value();
|
||||||
|
aItLS1.Initialize(aLSD);
|
||||||
|
for (; aItLS1.More(); aItLS1.Next()) {
|
||||||
|
const TopoDS_Shape& aSx=aItLS1.Value();
|
||||||
|
myOriginsToWork.Bind(aSx, aSkey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}// if (!aNbSG) {
|
||||||
|
//
|
||||||
|
// 1. Make pairs
|
||||||
|
aItDMSLS.Initialize(myShapesToGlue);
|
||||||
|
for (; aItDMSLS.More(); aItDMSLS.Next()) {
|
||||||
|
const TopoDS_Shape& aSkey=aItDMSLS.Key();
|
||||||
|
const TopTools_ListOfShape& aLSG=aItDMSLS.Value();
|
||||||
|
aItLS1.Initialize(aLSG);
|
||||||
|
for (i=0; aItLS1.More(); aItLS1.Next(), ++i) {
|
||||||
|
aItLS2.Initialize(aLSG);
|
||||||
|
for (j=0; aItLS2.More(); aItLS2.Next(), ++j) {
|
||||||
|
if (j>i) {
|
||||||
|
const TopoDS_Shape& aSG1=aItLS1.Value();
|
||||||
|
const TopoDS_Shape& aSG2=aItLS2.Value();
|
||||||
|
aCS.SetShape1(aSG1);
|
||||||
|
aCS.SetShape2(aSG2);
|
||||||
|
TreatPair(aCS, aLCS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// 2. Find Chains
|
||||||
|
TopTools_ListOfShape aLSX;
|
||||||
|
NMTTools_IndexedDataMapOfShapeIndexedMapOfShape aMC;
|
||||||
|
//
|
||||||
|
NMTTools_Tools::FindChains(aLCS, aMC);
|
||||||
|
//
|
||||||
|
// 3. myImagesToWork, myOriginsToWork
|
||||||
|
aNbC=aMC.Extent();
|
||||||
|
for (i=1; i<=aNbC; ++i) {
|
||||||
|
const TopoDS_Shape& aSkey=aMC.FindKey(i);
|
||||||
|
const TopTools_IndexedMapOfShape& aM=aMC(i);
|
||||||
|
aLSX.Clear();
|
||||||
|
aNb=aM.Extent();
|
||||||
|
for (j=1; j<=aNb; ++j) {
|
||||||
|
const TopoDS_Shape& aS=aM(j);
|
||||||
|
aLSX.Append(aS);
|
||||||
|
myOriginsToWork.Bind(aS, aSkey);
|
||||||
|
}
|
||||||
|
myImagesToWork.Bind(aSkey, aLSX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : TreatPair
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_Gluer2::TreatPair(const NMTTools_CoupleOfShape& aCS,
|
||||||
|
NMTTools_ListOfCoupleOfShape& aLCS)
|
||||||
|
{
|
||||||
|
if (myErrorStatus) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
Standard_Integer i, aNbS1, aNbS2, aNbS;
|
||||||
|
TopAbs_ShapeEnum aType, aTypeS;
|
||||||
|
TopTools_ListIteratorOfListOfShape aItLS;
|
||||||
|
TopTools_IndexedMapOfShape aMS1, aMS2;
|
||||||
|
TopTools_DataMapOfShapeListOfShape aDMSLS;
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS;
|
||||||
|
NMTTools_CoupleOfShape aCSS;
|
||||||
|
//
|
||||||
|
// 1. Checking the pair on whether it can be glued at all
|
||||||
|
// 1.1
|
||||||
|
const TopoDS_Shape& aS1=aCS.Shape1();
|
||||||
|
if (!myOriginsDetected.IsBound(aS1)) {
|
||||||
|
myErrorStatus=30;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const TopoDS_Shape& aSkey1=myOriginsDetected.Find(aS1);
|
||||||
|
// 1.2
|
||||||
|
const TopoDS_Shape& aS2=aCS.Shape2();
|
||||||
|
if (!myOriginsDetected.IsBound(aS2)) {
|
||||||
|
myErrorStatus=30;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const TopoDS_Shape& aSkey2=myOriginsDetected.Find(aS2);
|
||||||
|
// 1.3
|
||||||
|
if (!aSkey1.IsSame(aSkey2)) {
|
||||||
|
myErrorStatus=33;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// 2. Append the pair to the aLCS
|
||||||
|
aLCS.Append(aCS);
|
||||||
|
//
|
||||||
|
// 3. Treatment the subshapes of the pair
|
||||||
|
aType=aS1.ShapeType();
|
||||||
|
if (aType==TopAbs_VERTEX) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
aTypeS=TopAbs_EDGE;
|
||||||
|
if (aType==aTypeS) {
|
||||||
|
aTypeS=TopAbs_VERTEX;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
MapShapes1(aS1, aTypeS, aMS1);
|
||||||
|
MapShapes1(aS2, aTypeS, aMS2);
|
||||||
|
//
|
||||||
|
aNbS1=aMS1.Extent();
|
||||||
|
aNbS2=aMS2.Extent();
|
||||||
|
if (aNbS1!=aNbS2) {
|
||||||
|
myErrorStatus=31;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// 1.
|
||||||
|
for (i=1; i<=aNbS1; ++i) {
|
||||||
|
const TopoDS_Shape& aSS1=aMS1(i);
|
||||||
|
if (aMS2.Contains(aSS1)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!myOriginsDetected.IsBound(aSS1)) {
|
||||||
|
myErrorStatus=30;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopoDS_Shape& aSkey=myOriginsDetected.Find(aSS1);
|
||||||
|
if (aDMSLS.IsBound(aSkey)) {
|
||||||
|
TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aSkey);
|
||||||
|
aLS.Append(aSS1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TopTools_ListOfShape aLS;
|
||||||
|
//
|
||||||
|
aLS.Append(aSS1);
|
||||||
|
aDMSLS.Bind(aSkey, aLS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// 2.
|
||||||
|
for (i=1; i<=aNbS2; ++i) {
|
||||||
|
const TopoDS_Shape& aSS2=aMS2(i);
|
||||||
|
if (aMS1.Contains(aSS2)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!myOriginsDetected.IsBound(aSS2)) {
|
||||||
|
myErrorStatus=30;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopoDS_Shape& aSkey=myOriginsDetected.Find(aSS2);
|
||||||
|
if (aDMSLS.IsBound(aSkey)) {
|
||||||
|
TopTools_ListOfShape& aLS=aDMSLS.ChangeFind(aSkey);
|
||||||
|
aLS.Append(aSS2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TopTools_ListOfShape aLS;
|
||||||
|
//
|
||||||
|
aLS.Append(aSS2);
|
||||||
|
aDMSLS.Bind(aSkey, aLS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// 3.
|
||||||
|
aItDMSLS.Initialize(aDMSLS);
|
||||||
|
for (; aItDMSLS.More(); aItDMSLS.Next()) {
|
||||||
|
const TopoDS_Shape& aSkey=aItDMSLS.Key();
|
||||||
|
const TopTools_ListOfShape& aLS=aItDMSLS.Value();
|
||||||
|
aNbS=aLS.Extent();
|
||||||
|
if (aNbS!=2) {
|
||||||
|
myErrorStatus=32;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
const TopoDS_Shape& aSS1=aLS.First();
|
||||||
|
const TopoDS_Shape& aSS2=aLS.Last();
|
||||||
|
aCSS.SetShape1(aSS1);
|
||||||
|
aCSS.SetShape2(aSS2);
|
||||||
|
TreatPair(aCSS, aLCS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : MapShapes1
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void MapShapes1(const TopoDS_Shape& aS,
|
||||||
|
const TopAbs_ShapeEnum aType,
|
||||||
|
TopTools_IndexedMapOfShape& aM)
|
||||||
|
{
|
||||||
|
TopExp_Explorer aEx (aS, aType);
|
||||||
|
while (aEx.More()) {
|
||||||
|
const TopoDS_Shape aSx=aEx.Current();
|
||||||
|
if (aType==TopAbs_EDGE) {
|
||||||
|
const TopoDS_Edge& aEx=*((TopoDS_Edge*)&aSx);
|
||||||
|
if (BRep_Tool::Degenerated(aEx)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aM.Add(aSx);
|
||||||
|
aEx.Next();
|
||||||
|
}
|
||||||
|
}
|
134
src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx
Normal file
134
src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
// Copyright (C) 2007-2008 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// File: GEOMAlgo_GluerAlgo.cxx
|
||||||
|
// Created:
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
// <peter@PREFEX>
|
||||||
|
//
|
||||||
|
#include <GEOMAlgo_GluerAlgo.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GEOMAlgo_GluerAlgo
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
GEOMAlgo_GluerAlgo::GEOMAlgo_GluerAlgo()
|
||||||
|
{
|
||||||
|
myTolerance=0.0001;
|
||||||
|
myCheckGeometry=Standard_True;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : ~GEOMAlgo_GluerAlgo
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
GEOMAlgo_GluerAlgo::~GEOMAlgo_GluerAlgo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetArgument
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GluerAlgo::SetArgument(const TopoDS_Shape& theShape)
|
||||||
|
{
|
||||||
|
myArgument=theShape;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Argument
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopoDS_Shape& GEOMAlgo_GluerAlgo::Argument()const
|
||||||
|
{
|
||||||
|
return myArgument;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetTolerance
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GluerAlgo::SetTolerance(const Standard_Real aT)
|
||||||
|
{
|
||||||
|
myTolerance=aT;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Tolerance
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Real GEOMAlgo_GluerAlgo::Tolerance()const
|
||||||
|
{
|
||||||
|
return myTolerance;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetCheckGeometry
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GluerAlgo::SetCheckGeometry(const Standard_Boolean aFlag)
|
||||||
|
{
|
||||||
|
myCheckGeometry=aFlag;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : CheckGeometry
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry() const
|
||||||
|
{
|
||||||
|
return myCheckGeometry;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Context
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
IntTools_Context& GEOMAlgo_GluerAlgo::Context()
|
||||||
|
{
|
||||||
|
return myContext;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Images
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_GluerAlgo::Images()const
|
||||||
|
{
|
||||||
|
return myImages;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Origins
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
const TopTools_DataMapOfShapeShape& GEOMAlgo_GluerAlgo::Origins()const
|
||||||
|
{
|
||||||
|
return myOrigins;
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Clear
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GluerAlgo::Clear()
|
||||||
|
{
|
||||||
|
myImages.Clear();
|
||||||
|
myOrigins.Clear();
|
||||||
|
}
|
||||||
|
//=======================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void GEOMAlgo_GluerAlgo::Perform()
|
||||||
|
{
|
||||||
|
}
|
95
src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx
Normal file
95
src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
// Copyright (C) 2007-2010 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.
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// File: GEOMAlgo_GluerAlgo.hxx
|
||||||
|
// Created:
|
||||||
|
// Author: Peter KURNEV
|
||||||
|
// <pkv@irinox>
|
||||||
|
//
|
||||||
|
#ifndef _GEOMAlgo_GluerAlgo_HeaderFile
|
||||||
|
#define _GEOMAlgo_GluerAlgo_HeaderFile
|
||||||
|
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <Standard_Real.hxx>
|
||||||
|
#include <Standard_Boolean.hxx>
|
||||||
|
#include <IntTools_Context.hxx>
|
||||||
|
#include <TopTools_DataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||||
|
#include <GEOMAlgo_BuilderShape.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//class : GEOMAlgo_GluerAlgo
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
class GEOMAlgo_GluerAlgo {
|
||||||
|
public:
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
GEOMAlgo_GluerAlgo();
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
virtual ~GEOMAlgo_GluerAlgo();
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
virtual void SetArgument(const TopoDS_Shape& theShape) ;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
const TopoDS_Shape& Argument() const;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
void SetTolerance(const Standard_Real aT) ;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
Standard_Real Tolerance() const;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
void SetCheckGeometry(const Standard_Boolean aFlag) ;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
Standard_Boolean CheckGeometry() const;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
virtual void Perform() ;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
virtual void Clear() ;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
IntTools_Context& Context() ;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& Images() const;
|
||||||
|
|
||||||
|
Standard_EXPORT
|
||||||
|
const TopTools_DataMapOfShapeShape& Origins() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TopoDS_Shape myArgument;
|
||||||
|
Standard_Real myTolerance;
|
||||||
|
Standard_Boolean myCheckGeometry;
|
||||||
|
IntTools_Context myContext;
|
||||||
|
TopTools_DataMapOfShapeListOfShape myImages;
|
||||||
|
TopTools_DataMapOfShapeShape myOrigins;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
#endif
|
@ -15,14 +15,11 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
#
|
|
||||||
#
|
|
||||||
# GEOM GEOMAlgo : tools for Glue Faces algorithm
|
# GEOM GEOMAlgo : tools for Glue Faces algorithm
|
||||||
# File : Makefile.in
|
# File : Makefile.in
|
||||||
# Author : Julia DOROVSKIKH
|
# Author : Julia DOROVSKIKH
|
||||||
# Modified by : Alexander BORODIN (OCN) - autotools usage
|
|
||||||
# Module : GEOM
|
# Module : GEOM
|
||||||
# $Header$
|
|
||||||
|
|
||||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||||
|
|
||||||
@ -78,6 +75,12 @@ dist_libGEOMAlgo_la_SOURCES = \
|
|||||||
GEOMAlgo_FinderShapeOnQuad.cxx \
|
GEOMAlgo_FinderShapeOnQuad.cxx \
|
||||||
GEOMAlgo_GlueAnalyser.cxx \
|
GEOMAlgo_GlueAnalyser.cxx \
|
||||||
GEOMAlgo_Gluer.cxx \
|
GEOMAlgo_Gluer.cxx \
|
||||||
|
GEOMAlgo_GlueDetector.cxx \
|
||||||
|
GEOMAlgo_Gluer2.cxx \
|
||||||
|
GEOMAlgo_Gluer2_1.cxx \
|
||||||
|
GEOMAlgo_Gluer2_2.cxx \
|
||||||
|
GEOMAlgo_Gluer2_3.cxx \
|
||||||
|
GEOMAlgo_GluerAlgo.cxx \
|
||||||
GEOMAlgo_Gluer1.cxx \
|
GEOMAlgo_Gluer1.cxx \
|
||||||
GEOMAlgo_HAlgo.cxx \
|
GEOMAlgo_HAlgo.cxx \
|
||||||
GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \
|
GEOMAlgo_IndexedDataMapNodeOfIndexedDataMapOfIntegerShape_0.cxx \
|
||||||
@ -223,6 +226,9 @@ salomeinclude_HEADERS = \
|
|||||||
GEOMAlgo_Gluer1.hxx \
|
GEOMAlgo_Gluer1.hxx \
|
||||||
GEOMAlgo_Gluer1.ixx \
|
GEOMAlgo_Gluer1.ixx \
|
||||||
GEOMAlgo_Gluer1.jxx \
|
GEOMAlgo_Gluer1.jxx \
|
||||||
|
GEOMAlgo_GlueDetector.hxx \
|
||||||
|
GEOMAlgo_Gluer2.hxx \
|
||||||
|
GEOMAlgo_GluerAlgo.hxx \
|
||||||
GEOMAlgo_HAlgo.hxx \
|
GEOMAlgo_HAlgo.hxx \
|
||||||
GEOMAlgo_HAlgo.ixx \
|
GEOMAlgo_HAlgo.ixx \
|
||||||
GEOMAlgo_HAlgo.jxx \
|
GEOMAlgo_HAlgo.jxx \
|
||||||
|
@ -277,6 +277,14 @@
|
|||||||
<source>ICON_DLG_GLUE_FACES2</source>
|
<source>ICON_DLG_GLUE_FACES2</source>
|
||||||
<translation>glue2.png</translation>
|
<translation>glue2.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICON_DLG_GLUE_EDGES</source>
|
||||||
|
<translation>glue.png</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICON_DLG_GLUE_EDGES2</source>
|
||||||
|
<translation>glue2.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICON_DLG_LIMIT_TOLERANCE</source>
|
<source>ICON_DLG_LIMIT_TOLERANCE</source>
|
||||||
<translation>limit_tolerance.png</translation>
|
<translation>limit_tolerance.png</translation>
|
||||||
@ -861,6 +869,10 @@
|
|||||||
<source>ICO_GLUE_FACES</source>
|
<source>ICO_GLUE_FACES</source>
|
||||||
<translation>glue.png</translation>
|
<translation>glue.png</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>ICO_GLUE_EDGES</source>
|
||||||
|
<translation>glue.png</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>ICO_LIMIT_TOLERANCE</source>
|
<source>ICO_LIMIT_TOLERANCE</source>
|
||||||
<translation>limit_tolerance.png</translation>
|
<translation>limit_tolerance.png</translation>
|
||||||
|
@ -754,9 +754,13 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<translation>Glue</translation>
|
<translation>Glue</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>GEOM_GLUE_TITLE</source>
|
<source>GEOM_GLUE_FACES_TITLE</source>
|
||||||
<translation>Glue faces</translation>
|
<translation>Glue faces</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GEOM_GLUE_EDGES_TITLE</source>
|
||||||
|
<translation>Glue edges</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>GEOM_LIMIT_TOLERANCE_TITLE</source>
|
<source>GEOM_LIMIT_TOLERANCE_TITLE</source>
|
||||||
<translation>Limit tolerance</translation>
|
<translation>Limit tolerance</translation>
|
||||||
@ -2341,6 +2345,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>MEN_GLUE_FACES</source>
|
<source>MEN_GLUE_FACES</source>
|
||||||
<translation>Glue Faces</translation>
|
<translation>Glue Faces</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>MEN_GLUE_EDGES</source>
|
||||||
|
<translation>Glue Edges</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>MEN_GROUP</source>
|
<source>MEN_GROUP</source>
|
||||||
<translation>Group</translation>
|
<translation>Group</translation>
|
||||||
@ -3005,6 +3013,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>STB_GLUE_FACES</source>
|
<source>STB_GLUE_FACES</source>
|
||||||
<translation>Perform glue faces</translation>
|
<translation>Perform glue faces</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>STB_GLUE_EDGES</source>
|
||||||
|
<translation>Perform glue edges</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>STB_GROUP_CREATE</source>
|
<source>STB_GROUP_CREATE</source>
|
||||||
<translation>Create a group</translation>
|
<translation>Create a group</translation>
|
||||||
@ -3545,6 +3557,10 @@ Please, select face, shell or solid and try again</translation>
|
|||||||
<source>TOP_GLUE_FACES</source>
|
<source>TOP_GLUE_FACES</source>
|
||||||
<translation>Perform glue faces</translation>
|
<translation>Perform glue faces</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>TOP_GLUE_EDGES</source>
|
||||||
|
<translation>Perform glue edges</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TOP_GROUP_CREATE</source>
|
<source>TOP_GROUP_CREATE</source>
|
||||||
<translation>Create a group</translation>
|
<translation>Create a group</translation>
|
||||||
@ -4642,20 +4658,37 @@ Number of sketch points too small</translation>
|
|||||||
<message>
|
<message>
|
||||||
<source>FACES_FOR_GLUING_ARE_DETECTED</source>
|
<source>FACES_FOR_GLUING_ARE_DETECTED</source>
|
||||||
<translation>There are %1 face(s) that can be glued. They are coloured on the screen with red colour.
|
<translation>There are %1 face(s) that can be glued. They are coloured on the screen with red colour.
|
||||||
Please close this message box and select faces for glueing</translation>
|
Please close this message box and select faces for gluing</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>EDGES_FOR_GLUING_ARE_DETECTED</source>
|
||||||
|
<translation>There are %1 edge(s) that can be glued. They are coloured on the screen with red colour.
|
||||||
|
Please close this message box and select edges for gluing</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>GLUE_FACES</source>
|
<source>GLUE_FACES</source>
|
||||||
<translation>Glue faces</translation>
|
<translation>Glue faces</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>GLUE_EDGES</source>
|
||||||
|
<translation>Glue edges</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>SELECT_FACES</source>
|
<source>SELECT_FACES</source>
|
||||||
<translation>Select Faces</translation>
|
<translation>Select Faces</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>SELECT_EDGES</source>
|
||||||
|
<translation>Select Edges</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>THERE_ARE_NO_FACES_FOR_GLUING</source>
|
<source>THERE_ARE_NO_FACES_FOR_GLUING</source>
|
||||||
<translation>There are no faces for gluing</translation>
|
<translation>There are no faces for gluing</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>THERE_ARE_NO_EDGES_FOR_GLUING</source>
|
||||||
|
<translation>There are no edges for gluing</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>RepairGUI_ShapeProcessDlg</name>
|
<name>RepairGUI_ShapeProcessDlg</name>
|
||||||
|
@ -495,6 +495,7 @@ void GeometryGUI::OnGUIEvent( int id )
|
|||||||
case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES
|
case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES
|
||||||
case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION
|
case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION
|
||||||
case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
|
case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
|
||||||
|
case GEOMOp::OpGlueEdges: // MENU REPAIR - GLUE EDGES
|
||||||
case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE
|
case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE
|
||||||
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
|
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
|
||||||
libName = "RepairGUI";
|
libName = "RepairGUI";
|
||||||
@ -729,6 +730,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
|
|
||||||
createGeomAction( GEOMOp::OpSewing, "SEWING" );
|
createGeomAction( GEOMOp::OpSewing, "SEWING" );
|
||||||
createGeomAction( GEOMOp::OpGlueFaces, "GLUE_FACES" );
|
createGeomAction( GEOMOp::OpGlueFaces, "GLUE_FACES" );
|
||||||
|
createGeomAction( GEOMOp::OpGlueEdges, "GLUE_EDGES" );
|
||||||
createGeomAction( GEOMOp::OpLimitTolerance, "LIMIT_TOLERANCE" );
|
createGeomAction( GEOMOp::OpLimitTolerance, "LIMIT_TOLERANCE" );
|
||||||
createGeomAction( GEOMOp::OpSuppressFaces, "SUPPRESS_FACES" );
|
createGeomAction( GEOMOp::OpSuppressFaces, "SUPPRESS_FACES" );
|
||||||
createGeomAction( GEOMOp::OpSuppressHoles, "SUPPERSS_HOLES" );
|
createGeomAction( GEOMOp::OpSuppressHoles, "SUPPERSS_HOLES" );
|
||||||
@ -930,6 +932,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
|||||||
createMenu( GEOMOp::OpSuppressHoles, repairId, -1 );
|
createMenu( GEOMOp::OpSuppressHoles, repairId, -1 );
|
||||||
createMenu( GEOMOp::OpSewing, repairId, -1 );
|
createMenu( GEOMOp::OpSewing, repairId, -1 );
|
||||||
createMenu( GEOMOp::OpGlueFaces, repairId, -1 );
|
createMenu( GEOMOp::OpGlueFaces, repairId, -1 );
|
||||||
|
createMenu( GEOMOp::OpGlueEdges, repairId, -1 );
|
||||||
createMenu( GEOMOp::OpLimitTolerance, repairId, -1 );
|
createMenu( GEOMOp::OpLimitTolerance, repairId, -1 );
|
||||||
createMenu( GEOMOp::OpAddPointOnEdge, repairId, -1 );
|
createMenu( GEOMOp::OpAddPointOnEdge, repairId, -1 );
|
||||||
//createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 );
|
//createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 );
|
||||||
|
@ -138,6 +138,7 @@ namespace GEOMOp {
|
|||||||
OpGlueFaces = 4010, // MENU REPAIR - GLUE FACES
|
OpGlueFaces = 4010, // MENU REPAIR - GLUE FACES
|
||||||
OpRemoveExtraEdges = 4011, // MENU REPAIR - REMOVE EXTRA EDGES
|
OpRemoveExtraEdges = 4011, // MENU REPAIR - REMOVE EXTRA EDGES
|
||||||
OpLimitTolerance = 4012, // MENU REPAIR - LIMIT TOLERANCE
|
OpLimitTolerance = 4012, // MENU REPAIR - LIMIT TOLERANCE
|
||||||
|
OpGlueEdges = 4013, // MENU REPAIR - GLUE EDGES
|
||||||
// MeasureGUI ----------------//--------------------------------
|
// MeasureGUI ----------------//--------------------------------
|
||||||
OpProperties = 5000, // MENU MEASURES - PROPERTIES
|
OpProperties = 5000, // MENU MEASURES - PROPERTIES
|
||||||
OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS
|
OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
#include <Standard_Stream.hxx>
|
#include <Standard_Stream.hxx>
|
||||||
|
|
||||||
@ -31,6 +30,7 @@
|
|||||||
|
|
||||||
#include <GEOMAlgo_Gluer.hxx>
|
#include <GEOMAlgo_Gluer.hxx>
|
||||||
#include "GEOMAlgo_Gluer1.hxx"
|
#include "GEOMAlgo_Gluer1.hxx"
|
||||||
|
#include "GEOMAlgo_Gluer2.hxx"
|
||||||
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
|
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
|
||||||
#include "GEOMAlgo_CoupleOfShapes.hxx"
|
#include "GEOMAlgo_CoupleOfShapes.hxx"
|
||||||
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
|
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
|
||||||
@ -41,8 +41,9 @@
|
|||||||
|
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopTools_ListOfShape.hxx>
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
|
||||||
#include <ShapeFix_Shape.hxx>
|
#include <ShapeFix_Shape.hxx>
|
||||||
@ -75,6 +76,7 @@ const Standard_GUID& GEOMImpl_GlueDriver::GetID()
|
|||||||
//function : GlueFacesWithWarnings
|
//function : GlueFacesWithWarnings
|
||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
/*
|
||||||
TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape,
|
TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& theShape,
|
||||||
const Standard_Real theTolerance,
|
const Standard_Real theTolerance,
|
||||||
const Standard_Boolean doKeepNonSolids,
|
const Standard_Boolean doKeepNonSolids,
|
||||||
@ -155,7 +157,6 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
|
|||||||
aSfs->Perform();
|
aSfs->Perform();
|
||||||
aRes = aSfs->Shape();
|
aRes = aSfs->Shape();
|
||||||
|
|
||||||
|
|
||||||
// Fill history to be used by GetInPlace functionality
|
// Fill history to be used by GetInPlace functionality
|
||||||
TopTools_IndexedMapOfShape aResIndices;
|
TopTools_IndexedMapOfShape aResIndices;
|
||||||
TopExp::MapShapes(aRes, aResIndices);
|
TopExp::MapShapes(aRes, aResIndices);
|
||||||
@ -204,7 +205,6 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesWithWarnings (const TopoDS_Shape& the
|
|||||||
return aRes;
|
return aRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GlueFaces
|
//function : GlueFaces
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -213,7 +213,6 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
|
|||||||
const Standard_Real theTolerance,
|
const Standard_Real theTolerance,
|
||||||
const Standard_Boolean doKeepNonSolids)
|
const Standard_Boolean doKeepNonSolids)
|
||||||
{
|
{
|
||||||
Standard_Integer iErr, iWrn;
|
|
||||||
TopoDS_Shape aRes;
|
TopoDS_Shape aRes;
|
||||||
GEOMAlgo_Gluer aGluer;
|
GEOMAlgo_Gluer aGluer;
|
||||||
|
|
||||||
@ -224,7 +223,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
|
|||||||
|
|
||||||
aGluer.Perform();
|
aGluer.Perform();
|
||||||
|
|
||||||
iErr = aGluer.ErrorStatus();
|
Standard_Integer iErr = aGluer.ErrorStatus();
|
||||||
if (iErr) {
|
if (iErr) {
|
||||||
switch (iErr) {
|
switch (iErr) {
|
||||||
case 2:
|
case 2:
|
||||||
@ -251,7 +250,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
|
|||||||
return aRes;
|
return aRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
iWrn = aGluer.WarningStatus();
|
Standard_Integer iWrn = aGluer.WarningStatus();
|
||||||
if (iWrn) {
|
if (iWrn) {
|
||||||
switch (iWrn) {
|
switch (iWrn) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -269,7 +268,6 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
|
|||||||
return aRes;
|
return aRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GlueFacesByList
|
//function : GlueFacesByList
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -319,7 +317,348 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueFacesByList (const TopoDS_Shape& theShape,
|
|||||||
|
|
||||||
return aRes;
|
return aRes;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GlueFaces
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
TopoDS_Shape GEOMImpl_GlueDriver::GlueFaces (const TopoDS_Shape& theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
const Standard_Boolean doKeepNonSolids)
|
||||||
|
{
|
||||||
|
TopoDS_Shape aRes;
|
||||||
|
|
||||||
|
GEOMAlgo_Gluer2 aGA;
|
||||||
|
|
||||||
|
// 1. Initialization
|
||||||
|
aGA.SetArgument(theShape);
|
||||||
|
aGA.SetTolerance(theTolerance);
|
||||||
|
aGA.SetKeepNonSolids(doKeepNonSolids);
|
||||||
|
|
||||||
|
// 2. Detect interferred shapes
|
||||||
|
aGA.Detect();
|
||||||
|
Standard_Integer iErr = aGA.ErrorStatus();
|
||||||
|
if (iErr) {
|
||||||
|
switch (iErr) {
|
||||||
|
case 11:
|
||||||
|
Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
Standard_Failure::Raise("PerformImagesToWork failed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// description of all errors see in GEOMAlgo_Gluer2.cxx
|
||||||
|
TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
|
||||||
|
aMsg += TCollection_AsciiString(iErr);
|
||||||
|
Standard_Failure::Raise(aMsg.ToCString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Set shapes to glue. If the operator is absent, the whole gluing will be done
|
||||||
|
//aGA.SetShapesToGlue(aMSG);
|
||||||
|
|
||||||
|
// 4. Gluing
|
||||||
|
aGA.Perform();
|
||||||
|
iErr = aGA.ErrorStatus();
|
||||||
|
if (iErr) {
|
||||||
|
switch (iErr) {
|
||||||
|
case 11:
|
||||||
|
Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
Standard_Failure::Raise("PerformImagesToWork failed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// description of all errors see in GEOMAlgo_Gluer2.cxx
|
||||||
|
TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
|
||||||
|
aMsg += TCollection_AsciiString(iErr);
|
||||||
|
Standard_Failure::Raise(aMsg.ToCString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer iWrn = aGA.WarningStatus();
|
||||||
|
if (iWrn) {
|
||||||
|
switch (iWrn) {
|
||||||
|
case 1:
|
||||||
|
MESSAGE("No shapes to glue");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// description of all warnings see in GEOMAlgo_Gluer2.cxx
|
||||||
|
MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Result
|
||||||
|
aRes = aGA.Shape();
|
||||||
|
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GlueWithWarnings
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
const TopAbs_ShapeEnum theShapeType,
|
||||||
|
const Standard_Boolean doKeepNonSolids,
|
||||||
|
TCollection_AsciiString& theWarning) const
|
||||||
|
{
|
||||||
|
TopoDS_Shape aRes;
|
||||||
|
|
||||||
|
GEOMAlgo_Gluer2 aGA;
|
||||||
|
|
||||||
|
// 1. Initialization
|
||||||
|
aGA.SetArgument(theShape);
|
||||||
|
aGA.SetTolerance(theTolerance);
|
||||||
|
aGA.SetKeepNonSolids(doKeepNonSolids);
|
||||||
|
|
||||||
|
// 2. Detect interferred shapes
|
||||||
|
aGA.Detect();
|
||||||
|
Standard_Integer iErr = aGA.ErrorStatus();
|
||||||
|
if (iErr) {
|
||||||
|
switch (iErr) {
|
||||||
|
case 11:
|
||||||
|
Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
Standard_Failure::Raise("PerformImagesToWork failed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// description of all errors see in GEOMAlgo_Gluer2.cxx
|
||||||
|
TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
|
||||||
|
aMsg += TCollection_AsciiString(iErr);
|
||||||
|
Standard_Failure::Raise(aMsg.ToCString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Fill shapes to glue aMSG
|
||||||
|
TopTools_DataMapOfShapeListOfShape aMSG;
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
|
||||||
|
aItMSD.Initialize(aMSD);
|
||||||
|
for (; aItMSD.More(); aItMSD.Next()) {
|
||||||
|
const TopoDS_Shape& aSx = aItMSD.Key();
|
||||||
|
const TopTools_ListOfShape& aLSD = aItMSD.Value();
|
||||||
|
if (aSx.ShapeType() == theShapeType) {
|
||||||
|
aMSG.Bind(aSx, aLSD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
|
||||||
|
aGA.SetShapesToGlue(aMSG);
|
||||||
|
|
||||||
|
// 5. Gluing
|
||||||
|
aGA.Perform();
|
||||||
|
iErr = aGA.ErrorStatus();
|
||||||
|
if (iErr) {
|
||||||
|
switch (iErr) {
|
||||||
|
case 11:
|
||||||
|
Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
Standard_Failure::Raise("PerformImagesToWork failed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// description of all errors see in GEOMAlgo_Gluer2.cxx
|
||||||
|
TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
|
||||||
|
aMsg += TCollection_AsciiString(iErr);
|
||||||
|
Standard_Failure::Raise(aMsg.ToCString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer iWrn = aGA.WarningStatus();
|
||||||
|
if (iWrn) {
|
||||||
|
switch (iWrn) {
|
||||||
|
case 1:
|
||||||
|
theWarning = "No shapes to glue";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// description of all warnings see in GEOMAlgo_Gluer2.cxx
|
||||||
|
theWarning = "Warning in GEOMAlgo_Gluer2 with code ";
|
||||||
|
theWarning += TCollection_AsciiString(iWrn);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Result
|
||||||
|
aRes = aGA.Shape();
|
||||||
|
|
||||||
|
// 7. Fill history to be used by GetInPlace functionality
|
||||||
|
TopTools_IndexedMapOfShape aResIndices;
|
||||||
|
TopExp::MapShapes(aRes, aResIndices);
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
|
||||||
|
|
||||||
|
// history for all argument shapes
|
||||||
|
TDF_LabelSequence aLabelSeq;
|
||||||
|
aFunction->GetDependency(aLabelSeq);
|
||||||
|
Standard_Integer nbArg = aLabelSeq.Length();
|
||||||
|
|
||||||
|
for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
|
||||||
|
|
||||||
|
TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
|
||||||
|
|
||||||
|
Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
|
||||||
|
TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape anArgumentIndices;
|
||||||
|
TopExp::MapShapes(anArgumentShape, anArgumentIndices);
|
||||||
|
Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
|
||||||
|
|
||||||
|
// Find corresponding label in history
|
||||||
|
TDF_Label anArgumentHistoryLabel =
|
||||||
|
aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
|
||||||
|
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
|
||||||
|
TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
|
||||||
|
const TopTools_ListOfShape& aModified = aGA.Modified(anEntity);
|
||||||
|
Standard_Integer nbModified = aModified.Extent();
|
||||||
|
|
||||||
|
if (nbModified > 0) {
|
||||||
|
TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
|
||||||
|
Handle(TDataStd_IntegerArray) anAttr =
|
||||||
|
TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
|
||||||
|
|
||||||
|
TopTools_ListIteratorOfListOfShape itM (aModified);
|
||||||
|
for (int im = 1; itM.More(); itM.Next(), ++im) {
|
||||||
|
int id = aResIndices.FindIndex(itM.Value());
|
||||||
|
anAttr->SetValue(im, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GlueByList
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
TopoDS_Shape GEOMImpl_GlueDriver::GlueByList (const TopoDS_Shape& theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
const Standard_Boolean doKeepNonSolids,
|
||||||
|
const TopTools_MapOfShape& theShapesList)
|
||||||
|
{
|
||||||
|
TopoDS_Shape aRes;
|
||||||
|
|
||||||
|
GEOMAlgo_Gluer2 aGA;
|
||||||
|
|
||||||
|
// 1. Initialization
|
||||||
|
aGA.SetArgument(theShape);
|
||||||
|
aGA.SetTolerance(theTolerance);
|
||||||
|
aGA.SetKeepNonSolids(doKeepNonSolids);
|
||||||
|
|
||||||
|
// 2. Detect interferred shapes
|
||||||
|
aGA.Detect();
|
||||||
|
Standard_Integer iErr = aGA.ErrorStatus();
|
||||||
|
if (iErr) {
|
||||||
|
switch (iErr) {
|
||||||
|
case 11:
|
||||||
|
Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
Standard_Failure::Raise("PerformImagesToWork failed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// description of all errors see in GEOMAlgo_Gluer2.cxx
|
||||||
|
TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
|
||||||
|
aMsg += TCollection_AsciiString(iErr);
|
||||||
|
Standard_Failure::Raise(aMsg.ToCString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Fill shapes to glue aMSG
|
||||||
|
TopTools_DataMapOfShapeListOfShape aMSG;
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& aMSD = aGA.ShapesDetected();
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItMSD;
|
||||||
|
aItMSD.Initialize(aMSD);
|
||||||
|
for (; aItMSD.More(); aItMSD.Next()) {
|
||||||
|
const TopoDS_Shape& aSx = aItMSD.Key();
|
||||||
|
const TopTools_ListOfShape& aLSD = aItMSD.Value();
|
||||||
|
TopTools_ListIteratorOfListOfShape anItLSD (aLSD);
|
||||||
|
bool isToGlue = false;
|
||||||
|
for (; anItLSD.More() && !isToGlue; anItLSD.Next()) {
|
||||||
|
if (theShapesList.Contains(anItLSD.Value())) {
|
||||||
|
isToGlue = true;
|
||||||
|
aMSG.Bind(aSx, aLSD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Set shapes to glue. If the operator is absent, the whole gluing will be done
|
||||||
|
aGA.SetShapesToGlue(aMSG);
|
||||||
|
|
||||||
|
// 5. Gluing
|
||||||
|
aGA.Perform();
|
||||||
|
iErr = aGA.ErrorStatus();
|
||||||
|
if (iErr) {
|
||||||
|
switch (iErr) {
|
||||||
|
case 11:
|
||||||
|
Standard_Failure::Raise("GEOMAlgo_GlueDetector failed");
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
Standard_Failure::Raise("PerformImagesToWork failed");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// description of all errors see in GEOMAlgo_Gluer2.cxx
|
||||||
|
TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer2 with code ");
|
||||||
|
aMsg += TCollection_AsciiString(iErr);
|
||||||
|
Standard_Failure::Raise(aMsg.ToCString());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer iWrn = aGA.WarningStatus();
|
||||||
|
if (iWrn) {
|
||||||
|
switch (iWrn) {
|
||||||
|
case 1:
|
||||||
|
MESSAGE("No shapes to glue");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// description of all warnings see in GEOMAlgo_Gluer2.cxx
|
||||||
|
MESSAGE("Warning in GEOMAlgo_Gluer2 with code " << iWrn);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Result
|
||||||
|
aRes = aGA.Shape();
|
||||||
|
|
||||||
|
return aRes;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Execute
|
//function : Execute
|
||||||
@ -347,9 +686,13 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids();
|
Standard_Boolean aKeepNonSolids = aCI.GetKeepNonSolids();
|
||||||
|
|
||||||
if (aType == GLUE_FACES) {
|
if (aType == GLUE_FACES) {
|
||||||
aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn);
|
//aShape = GlueFacesWithWarnings(aShapeBase, tol3d, aKeepNonSolids, aWrn);
|
||||||
|
aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_FACE, aKeepNonSolids, aWrn);
|
||||||
}
|
}
|
||||||
else { // aType == GLUE_FACES_BY_LIST
|
else if (aType == GLUE_EDGES) {
|
||||||
|
aShape = GlueWithWarnings(aShapeBase, tol3d, TopAbs_EDGE, aKeepNonSolids, aWrn);
|
||||||
|
}
|
||||||
|
else if (aType == GLUE_FACES_BY_LIST || aType == GLUE_EDGES_BY_LIST) {
|
||||||
Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces();
|
Handle(TColStd_HSequenceOfTransient) SF = aCI.GetFaces();
|
||||||
TopTools_MapOfShape aFaces;
|
TopTools_MapOfShape aFaces;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
@ -366,7 +709,8 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const
|
|||||||
if (!aFaces.Contains(aFace))
|
if (!aFaces.Contains(aFace))
|
||||||
aFaces.Add(aFace);
|
aFaces.Add(aFace);
|
||||||
}
|
}
|
||||||
aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
|
//aShape = GlueFacesByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
|
||||||
|
aShape = GlueByList(aShapeBase, tol3d, aKeepNonSolids, aFaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aShape.IsNull()) return 0;
|
if (aShape.IsNull()) return 0;
|
||||||
|
@ -18,11 +18,10 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// File : GEOMImpl_GlueDriver.ixx
|
// File : GEOMImpl_GlueDriver.ixx
|
||||||
// Module : GEOMImpl
|
// Module : GEOMImpl
|
||||||
//
|
|
||||||
#ifndef _GEOMImpl_GlueDriver_HeaderFile
|
#ifndef _GEOMImpl_GlueDriver_HeaderFile
|
||||||
#define _GEOMImpl_GlueDriver_HeaderFile
|
#define _GEOMImpl_GlueDriver_HeaderFile
|
||||||
|
|
||||||
@ -155,7 +154,7 @@ Standard_EXPORT ~GEOMImpl_GlueDriver() {};
|
|||||||
Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape,
|
Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape,
|
||||||
const Standard_Real theTolerance,
|
const Standard_Real theTolerance,
|
||||||
const Standard_Boolean doKeepNonSolids = Standard_True);
|
const Standard_Boolean doKeepNonSolids = Standard_True);
|
||||||
|
/*
|
||||||
Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape,
|
Standard_EXPORT TopoDS_Shape GlueFacesWithWarnings (const TopoDS_Shape& theShape,
|
||||||
const Standard_Real theTolerance,
|
const Standard_Real theTolerance,
|
||||||
const Standard_Boolean doKeepNonSolids,
|
const Standard_Boolean doKeepNonSolids,
|
||||||
@ -165,6 +164,17 @@ Standard_EXPORT static TopoDS_Shape GlueFacesByList (const TopoDS_Shape& theShap
|
|||||||
const Standard_Real theTolerance,
|
const Standard_Real theTolerance,
|
||||||
const Standard_Boolean doKeepNonSolids,
|
const Standard_Boolean doKeepNonSolids,
|
||||||
const TopTools_MapOfShape& aFaces);
|
const TopTools_MapOfShape& aFaces);
|
||||||
|
*/
|
||||||
|
Standard_EXPORT TopoDS_Shape GlueWithWarnings (const TopoDS_Shape& theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
const TopAbs_ShapeEnum theShapeType,
|
||||||
|
const Standard_Boolean doKeepNonSolids,
|
||||||
|
TCollection_AsciiString& theWarning) const;
|
||||||
|
|
||||||
|
Standard_EXPORT static TopoDS_Shape GlueByList (const TopoDS_Shape& theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
const Standard_Boolean doKeepNonSolids,
|
||||||
|
const TopTools_MapOfShape& theShapesList);
|
||||||
|
|
||||||
|
|
||||||
// Type management
|
// Type management
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#include "GEOMAlgo_ClsfBox.hxx"
|
#include "GEOMAlgo_ClsfBox.hxx"
|
||||||
#include "GEOMAlgo_ClsfSolid.hxx"
|
#include "GEOMAlgo_ClsfSolid.hxx"
|
||||||
#include "GEOMAlgo_Gluer1.hxx"
|
#include "GEOMAlgo_Gluer1.hxx"
|
||||||
|
#include "GEOMAlgo_GlueDetector.hxx"
|
||||||
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
|
#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
|
||||||
#include "GEOMAlgo_CoupleOfShapes.hxx"
|
#include "GEOMAlgo_CoupleOfShapes.hxx"
|
||||||
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
|
#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
|
||||||
@ -82,6 +83,8 @@
|
|||||||
|
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopLoc_Location.hxx>
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Solid.hxx>
|
#include <TopoDS_Solid.hxx>
|
||||||
@ -90,13 +93,12 @@
|
|||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
#include <TopoDS_Iterator.hxx>
|
#include <TopoDS_Iterator.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopTools_Array1OfShape.hxx>
|
||||||
#include <TopLoc_Location.hxx>
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
#include <TopTools_MapOfShape.hxx>
|
#include <TopTools_MapOfShape.hxx>
|
||||||
#include <TopTools_MapOfOrientedShape.hxx>
|
#include <TopTools_MapOfOrientedShape.hxx>
|
||||||
#include <TopTools_Array1OfShape.hxx>
|
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <Geom_Surface.hxx>
|
#include <Geom_Surface.hxx>
|
||||||
#include <Geom_Plane.hxx>
|
#include <Geom_Plane.hxx>
|
||||||
@ -725,6 +727,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFaces
|
|||||||
* GetGlueFaces
|
* GetGlueFaces
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
/*
|
||||||
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces
|
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces
|
||||||
(Handle(GEOM_Object) theShape,
|
(Handle(GEOM_Object) theShape,
|
||||||
const Standard_Real theTolerance)
|
const Standard_Real theTolerance)
|
||||||
@ -785,7 +788,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces
|
|||||||
if( anAsciiList.Length() > 0 ) {
|
if( anAsciiList.Length() > 0 ) {
|
||||||
anAsciiList.Trunc(anAsciiList.Length() - 1);
|
anAsciiList.Trunc(anAsciiList.Length() - 1);
|
||||||
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
|
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
|
||||||
GEOM::TPythonDump pd (aFunction, /*append=*/true);
|
GEOM::TPythonDump pd (aFunction, true);
|
||||||
pd << "[" << anAsciiList.ToCString();
|
pd << "[" << anAsciiList.ToCString();
|
||||||
pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")";
|
pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")";
|
||||||
}
|
}
|
||||||
@ -794,6 +797,7 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueFaces
|
|||||||
|
|
||||||
return aSeq;
|
return aSeq;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
@ -884,6 +888,233 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
|
|||||||
return aGlued;
|
return aGlued;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* MakeGlueEdges
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdges
|
||||||
|
(Handle(GEOM_Object) theShape,
|
||||||
|
const Standard_Real theTolerance)
|
||||||
|
{
|
||||||
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
if (theShape.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Add a new Glued object
|
||||||
|
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
|
||||||
|
|
||||||
|
//Add a new Glue function
|
||||||
|
Handle(GEOM_Function) aFunction;
|
||||||
|
aFunction = aGlued->AddFunction(GEOMImpl_GlueDriver::GetID(), GLUE_EDGES);
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_GlueDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
GEOMImpl_IGlue aCI (aFunction);
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
|
||||||
|
if (aRefShape.IsNull()) return NULL;
|
||||||
|
|
||||||
|
aCI.SetBase(aRefShape);
|
||||||
|
aCI.SetTolerance(theTolerance);
|
||||||
|
aCI.SetKeepNonSolids(true);
|
||||||
|
|
||||||
|
//Compute the sub-shape value
|
||||||
|
Standard_Boolean isWarning = Standard_False;
|
||||||
|
try {
|
||||||
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
|
SetErrorCode("Shape driver failed to glue edges");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
// to provide warning
|
||||||
|
if (!aFunction->GetValue().IsNull()) {
|
||||||
|
isWarning = Standard_True;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
GEOM::TPythonDump(aFunction) << aGlued << " = geompy.MakeGlueEdges("
|
||||||
|
<< theShape << ", " << theTolerance << ")";
|
||||||
|
|
||||||
|
// to provide warning
|
||||||
|
if (!isWarning) SetErrorCode(OK);
|
||||||
|
return aGlued;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* GetGlueShapes
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetGlueShapes
|
||||||
|
(Handle(GEOM_Object) theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
const TopAbs_ShapeEnum theType)
|
||||||
|
{
|
||||||
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
if (theShape.IsNull()) return NULL;
|
||||||
|
TopoDS_Shape aShape = theShape->GetValue();
|
||||||
|
if (aShape.IsNull()) return NULL;
|
||||||
|
|
||||||
|
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
|
||||||
|
|
||||||
|
GEOMAlgo_GlueDetector aGluer;
|
||||||
|
aGluer.SetArgument(aShape);
|
||||||
|
aGluer.SetTolerance(theTolerance);
|
||||||
|
aGluer.Perform();
|
||||||
|
Standard_Integer iErr = aGluer.ErrorStatus();
|
||||||
|
if (iErr) return NULL;
|
||||||
|
|
||||||
|
TCollection_AsciiString anAsciiList, anEntry;
|
||||||
|
TopTools_IndexedMapOfShape anIndices;
|
||||||
|
TopExp::MapShapes(aShape, anIndices);
|
||||||
|
Handle(TColStd_HArray1OfInteger) anArray;
|
||||||
|
Handle(GEOM_Object) anObj;
|
||||||
|
|
||||||
|
const TopTools_DataMapOfShapeListOfShape& aImages = aGluer.Images();
|
||||||
|
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS (aImages);
|
||||||
|
for (int index = 1; aItDMSLS.More(); aItDMSLS.Next(), ++index) {
|
||||||
|
// some key shape
|
||||||
|
//const TopoDS_Shape& aSkey = aItDMSLS.Key();
|
||||||
|
|
||||||
|
// list of shapes of the argument that can be glued
|
||||||
|
const TopTools_ListOfShape& aLSD = aItDMSLS.Value();
|
||||||
|
|
||||||
|
//listShape.Append(aLSD.First());
|
||||||
|
TopoDS_Shape aValue = aLSD.First();
|
||||||
|
|
||||||
|
if (aValue.ShapeType() == theType) {
|
||||||
|
anArray = new TColStd_HArray1OfInteger(1,1);
|
||||||
|
anArray->SetValue(1, anIndices.FindIndex(aValue));
|
||||||
|
anObj = GetEngine()->AddSubShape(theShape, anArray);
|
||||||
|
if (!anObj.IsNull()) {
|
||||||
|
aSeq->Append(anObj);
|
||||||
|
|
||||||
|
// for python command
|
||||||
|
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
|
||||||
|
anAsciiList += anEntry;
|
||||||
|
anAsciiList += ",";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make a Python command
|
||||||
|
if (anAsciiList.Length() > 0) {
|
||||||
|
anAsciiList.Trunc(anAsciiList.Length() - 1);
|
||||||
|
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
|
||||||
|
GEOM::TPythonDump pd (aFunction, /*append=*/true);
|
||||||
|
pd << "[" << anAsciiList.ToCString();
|
||||||
|
if (theType == TopAbs_FACE)
|
||||||
|
pd << "] = geompy.GetGlueFaces(" << theShape << ", " << theTolerance << ")";
|
||||||
|
else if (theType == TopAbs_EDGE)
|
||||||
|
pd << "] = geompy.GetGlueEdges(" << theShape << ", " << theTolerance << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
SetErrorCode(OK);
|
||||||
|
|
||||||
|
return aSeq;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* MakeGlueEdgesByList
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueEdgesByList
|
||||||
|
(Handle(GEOM_Object) theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
std::list<Handle(GEOM_Object)> theEdges)
|
||||||
|
{
|
||||||
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
if (theShape.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Add a new Glued object
|
||||||
|
Handle(GEOM_Object) aGlued = GetEngine()->AddObject(GetDocID(), GEOM_GLUED);
|
||||||
|
|
||||||
|
//Add a new Glue function
|
||||||
|
Handle(GEOM_Function) aFunction;
|
||||||
|
aFunction = aGlued->AddFunction(GEOMImpl_GlueDriver::GetID(), GLUE_EDGES_BY_LIST);
|
||||||
|
if (aFunction.IsNull()) return NULL;
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_GlueDriver::GetID()) return NULL;
|
||||||
|
|
||||||
|
GEOMImpl_IGlue aCI (aFunction);
|
||||||
|
|
||||||
|
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
|
||||||
|
if (aRefShape.IsNull()) return NULL;
|
||||||
|
|
||||||
|
aCI.SetBase(aRefShape);
|
||||||
|
aCI.SetTolerance(theTolerance);
|
||||||
|
aCI.SetKeepNonSolids(true);
|
||||||
|
|
||||||
|
Handle(TColStd_HSequenceOfTransient) anEdges = new TColStd_HSequenceOfTransient;
|
||||||
|
std::list<Handle(GEOM_Object)>::iterator it = theEdges.begin();
|
||||||
|
for (; it != theEdges.end(); it++) {
|
||||||
|
Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
|
||||||
|
if (aRefSh.IsNull()) {
|
||||||
|
SetErrorCode("NULL argument shape for the shape construction");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
anEdges->Append(aRefSh);
|
||||||
|
}
|
||||||
|
aCI.SetFaces(anEdges);
|
||||||
|
|
||||||
|
//Compute the sub-shape value
|
||||||
|
Standard_Boolean isWarning = Standard_False;
|
||||||
|
try {
|
||||||
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
|
SetErrorCode("Shape driver failed to glue edges");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
// to provide warning
|
||||||
|
if (!aFunction->GetValue().IsNull()) {
|
||||||
|
isWarning = Standard_True;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
|
||||||
|
GEOM::TPythonDump pd (aFunction);
|
||||||
|
pd << aGlued << " = geompy.MakeGlueEdgesByList("
|
||||||
|
<< theShape << ", " << theTolerance << ", [";
|
||||||
|
// Edges
|
||||||
|
it = theEdges.begin();
|
||||||
|
if (it != theEdges.end()) {
|
||||||
|
pd << (*it++);
|
||||||
|
while (it != theEdges.end()) {
|
||||||
|
pd << ", " << (*it++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pd << "])";
|
||||||
|
|
||||||
|
// to provide warning
|
||||||
|
if (!isWarning) SetErrorCode(OK);
|
||||||
|
return aGlued;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* GetExistingSubObjects
|
* GetExistingSubObjects
|
||||||
|
@ -90,14 +90,25 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
|
|||||||
const Standard_Real theTolerance,
|
const Standard_Real theTolerance,
|
||||||
const Standard_Boolean doKeepNonSolids);
|
const Standard_Boolean doKeepNonSolids);
|
||||||
|
|
||||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
|
//Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
|
||||||
const Standard_Real theTolerance);
|
// const Standard_Real theTolerance);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
|
Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
|
||||||
const Standard_Real theTolerance,
|
const Standard_Real theTolerance,
|
||||||
std::list<Handle(GEOM_Object)> theFaces,
|
std::list<Handle(GEOM_Object)> theFaces,
|
||||||
const Standard_Boolean doKeepNonSolids);
|
const Standard_Boolean doKeepNonSolids);
|
||||||
|
|
||||||
|
Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (Handle(GEOM_Object) theShape,
|
||||||
|
const Standard_Real theTolerance);
|
||||||
|
|
||||||
|
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueShapes (Handle(GEOM_Object) theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
const TopAbs_ShapeEnum theType);
|
||||||
|
|
||||||
|
Standard_EXPORT Handle(GEOM_Object) MakeGlueEdgesByList (Handle(GEOM_Object) theShape,
|
||||||
|
const Standard_Real theTolerance,
|
||||||
|
std::list<Handle(GEOM_Object)> theEdges);
|
||||||
|
|
||||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects
|
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects
|
||||||
(Handle(GEOM_Object) theShape,
|
(Handle(GEOM_Object) theShape,
|
||||||
const Standard_Boolean theGroupsOnly);
|
const Standard_Boolean theGroupsOnly);
|
||||||
|
@ -277,6 +277,8 @@
|
|||||||
|
|
||||||
#define GLUE_FACES 1
|
#define GLUE_FACES 1
|
||||||
#define GLUE_FACES_BY_LIST 2
|
#define GLUE_FACES_BY_LIST 2
|
||||||
|
#define GLUE_EDGES 3
|
||||||
|
#define GLUE_EDGES_BY_LIST 4
|
||||||
|
|
||||||
#define SKETCHER_NINE_DOUBLS 1
|
#define SKETCHER_NINE_DOUBLS 1
|
||||||
#define SKETCHER_PLANE 2
|
#define SKETCHER_PLANE 2
|
||||||
|
@ -398,7 +398,6 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFaces
|
|||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* GetGlueFaces
|
* GetGlueFaces
|
||||||
@ -418,7 +417,8 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
|
|||||||
if (aShape.IsNull()) return aSeq._retn();
|
if (aShape.IsNull()) return aSeq._retn();
|
||||||
|
|
||||||
Handle(TColStd_HSequenceOfTransient) aHSeq =
|
Handle(TColStd_HSequenceOfTransient) aHSeq =
|
||||||
GetOperations()->GetGlueFaces(aShape, theTolerance);
|
//GetOperations()->GetGlueFaces(aShape, theTolerance);
|
||||||
|
GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_FACE);
|
||||||
|
|
||||||
//if (!GetOperations()->IsDone() || aHSeq.IsNull())
|
//if (!GetOperations()->IsDone() || aHSeq.IsNull())
|
||||||
// to allow warning
|
// to allow warning
|
||||||
@ -433,7 +433,6 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueFaces
|
|||||||
return aSeq._retn();
|
return aSeq._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* MakeGlueFacesByList
|
* MakeGlueFacesByList
|
||||||
@ -475,6 +474,109 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
|
|||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* MakeGlueEdges
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdges
|
||||||
|
(GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Double theTolerance)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
|
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
//Get the reference objects
|
||||||
|
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||||
|
if (aShape.IsNull()) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
//Perform the gluing
|
||||||
|
Handle(GEOM_Object) anObject =
|
||||||
|
GetOperations()->MakeGlueEdges(aShape, theTolerance);
|
||||||
|
//if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
|
// to allow warning
|
||||||
|
if (anObject.IsNull())
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
|
return GetObject(anObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* GetGlueEdges
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetGlueEdges
|
||||||
|
(GEOM::GEOM_Object_ptr theShape,
|
||||||
|
const CORBA::Double theTolerance)
|
||||||
|
{
|
||||||
|
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
|
||||||
|
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
//Get the reference objects
|
||||||
|
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||||
|
if (aShape.IsNull()) return aSeq._retn();
|
||||||
|
|
||||||
|
Handle(TColStd_HSequenceOfTransient) aHSeq =
|
||||||
|
GetOperations()->GetGlueShapes(aShape, theTolerance, TopAbs_EDGE);
|
||||||
|
|
||||||
|
//if (!GetOperations()->IsDone() || aHSeq.IsNull())
|
||||||
|
// to allow warning
|
||||||
|
if (aHSeq.IsNull())
|
||||||
|
return aSeq._retn();
|
||||||
|
|
||||||
|
Standard_Integer aLength = aHSeq->Length();
|
||||||
|
aSeq->length(aLength);
|
||||||
|
for (Standard_Integer i = 1; i <= aLength; i++)
|
||||||
|
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
|
||||||
|
|
||||||
|
return aSeq._retn();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* MakeGlueEdgesByList
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueEdgesByList
|
||||||
|
(GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Double theTolerance,
|
||||||
|
const GEOM::ListOfGO& theEdges)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
|
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
|
//Get the reference objects
|
||||||
|
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||||
|
if (aShape.IsNull()) return aGEOMObject._retn();
|
||||||
|
|
||||||
|
int ind, aLen;
|
||||||
|
std::list<Handle(GEOM_Object)> anEdges;
|
||||||
|
//Get the shapes
|
||||||
|
aLen = theEdges.length();
|
||||||
|
for (ind = 0; ind < aLen; ind++) {
|
||||||
|
Handle(GEOM_Object) aSh = GetObjectImpl(theEdges[ind]);
|
||||||
|
if (aSh.IsNull()) return aGEOMObject._retn();
|
||||||
|
anEdges.push_back(aSh);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Perform the gluing
|
||||||
|
Handle(GEOM_Object) anObject =
|
||||||
|
GetOperations()->MakeGlueEdgesByList(aShape, theTolerance, anEdges);
|
||||||
|
//if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
|
// to allow warning
|
||||||
|
if (anObject.IsNull())
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
|
return GetObject(anObject);
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* GetExistingSubObjects
|
* GetExistingSubObjects
|
||||||
|
@ -82,6 +82,16 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
|
|||||||
const GEOM::ListOfGO& theFaces,
|
const GEOM::ListOfGO& theFaces,
|
||||||
CORBA::Boolean doKeepNonSolids);
|
CORBA::Boolean doKeepNonSolids);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr MakeGlueEdges (GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Double theTolerance);
|
||||||
|
|
||||||
|
GEOM::ListOfGO* GetGlueEdges (GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Double theTolerance);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr MakeGlueEdgesByList (GEOM::GEOM_Object_ptr theShape,
|
||||||
|
CORBA::Double theTolerance,
|
||||||
|
const GEOM::ListOfGO& theEdges);
|
||||||
|
|
||||||
GEOM::ListOfGO* GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
|
GEOM::ListOfGO* GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
|
||||||
CORBA::Boolean theGroupsOnly);
|
CORBA::Boolean theGroupsOnly);
|
||||||
|
|
||||||
|
@ -2570,6 +2570,51 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
|
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
|
## Replace coincident edges in theShape by one edge.
|
||||||
|
# @param theShape Initial shape.
|
||||||
|
# @param theTolerance Maximum distance between edges, which can be considered as coincident.
|
||||||
|
# @return New GEOM_Object, containing a copy of theShape without coincident edges.
|
||||||
|
#
|
||||||
|
# @ref tui_glue_faces "Example"
|
||||||
|
def MakeGlueEdges(self, theShape, theTolerance):
|
||||||
|
# Example: see GEOM_Spanner.py
|
||||||
|
theTolerance,Parameters = ParseParameters(theTolerance)
|
||||||
|
anObj = self.ShapesOp.MakeGlueEdges(theShape, theTolerance)
|
||||||
|
if anObj is None:
|
||||||
|
raise RuntimeError, "MakeGlueEdges : " + self.ShapesOp.GetErrorCode()
|
||||||
|
anObj.SetParameters(Parameters)
|
||||||
|
return anObj
|
||||||
|
|
||||||
|
## Find coincident edges in theShape for possible gluing.
|
||||||
|
# @param theShape Initial shape.
|
||||||
|
# @param theTolerance Maximum distance between edges,
|
||||||
|
# which can be considered as coincident.
|
||||||
|
# @return ListOfGO.
|
||||||
|
#
|
||||||
|
# @ref tui_glue_faces "Example"
|
||||||
|
def GetGlueEdges(self, theShape, theTolerance):
|
||||||
|
# Example: see GEOM_Spanner.py
|
||||||
|
anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
|
||||||
|
RaiseIfFailed("GetGlueEdges", self.ShapesOp)
|
||||||
|
return anObj
|
||||||
|
|
||||||
|
## Replace coincident edges in theShape by one edge
|
||||||
|
# in compliance with given list of edges
|
||||||
|
# @param theShape Initial shape.
|
||||||
|
# @param theTolerance Maximum distance between edges,
|
||||||
|
# which can be considered as coincident.
|
||||||
|
# @param theFaces List of edges for gluing.
|
||||||
|
# @return New GEOM_Object, containing a copy of theShape
|
||||||
|
# without some edges.
|
||||||
|
#
|
||||||
|
# @ref tui_glue_faces "Example"
|
||||||
|
def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges):
|
||||||
|
# Example: see GEOM_Spanner.py
|
||||||
|
anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
|
||||||
|
if anObj is None:
|
||||||
|
raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()
|
||||||
|
return anObj
|
||||||
|
|
||||||
# end of l3_healing
|
# end of l3_healing
|
||||||
## @}
|
## @}
|
||||||
|
|
||||||
|
@ -78,7 +78,8 @@ bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
|||||||
QDialog* aDlg = NULL;
|
QDialog* aDlg = NULL;
|
||||||
switch (theCommandID) {
|
switch (theCommandID) {
|
||||||
case GEOMOp::OpSewing: aDlg = new RepairGUI_SewingDlg (getGeometryGUI(), parent); break;
|
case GEOMOp::OpSewing: aDlg = new RepairGUI_SewingDlg (getGeometryGUI(), parent); break;
|
||||||
case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent); break;
|
case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, false, TopAbs_FACE); break;
|
||||||
|
case GEOMOp::OpGlueEdges: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent, false, TopAbs_EDGE); break;
|
||||||
case GEOMOp::OpLimitTolerance: aDlg = new RepairGUI_LimitToleranceDlg (getGeometryGUI(), parent); break;
|
case GEOMOp::OpLimitTolerance: aDlg = new RepairGUI_LimitToleranceDlg (getGeometryGUI(), parent); break;
|
||||||
case GEOMOp::OpSuppressFaces: aDlg = new RepairGUI_SuppressFacesDlg (getGeometryGUI(), parent); break;
|
case GEOMOp::OpSuppressFaces: aDlg = new RepairGUI_SuppressFacesDlg (getGeometryGUI(), parent); break;
|
||||||
case GEOMOp::OpSuppressHoles: aDlg = new RepairGUI_RemoveHolesDlg (getGeometryGUI(), parent); break;
|
case GEOMOp::OpSuppressHoles: aDlg = new RepairGUI_RemoveHolesDlg (getGeometryGUI(), parent); break;
|
||||||
|
@ -18,12 +18,11 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// GEOM RepairGUI : GUI for Geometry component
|
// GEOM RepairGUI : GUI for Geometry component
|
||||||
// File : RepairGUI_GlueDlg.cxx
|
// File : RepairGUI_GlueDlg.cxx
|
||||||
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
||||||
//
|
|
||||||
#include "RepairGUI_GlueDlg.h"
|
#include "RepairGUI_GlueDlg.h"
|
||||||
|
|
||||||
#include <DlgRef.h>
|
#include <DlgRef.h>
|
||||||
@ -32,9 +31,9 @@
|
|||||||
#include <SalomeApp_DoubleSpinBox.h>
|
#include <SalomeApp_DoubleSpinBox.h>
|
||||||
|
|
||||||
#include <SalomeApp_Application.h>
|
#include <SalomeApp_Application.h>
|
||||||
#include <LightApp_SelectionMgr.h>
|
|
||||||
#include <SalomeApp_Study.h>
|
#include <SalomeApp_Study.h>
|
||||||
#include <SalomeApp_Tools.h>
|
#include <SalomeApp_Tools.h>
|
||||||
|
#include <LightApp_SelectionMgr.h>
|
||||||
#include <SUIT_Session.h>
|
#include <SUIT_Session.h>
|
||||||
#include <SUIT_Desktop.h>
|
#include <SUIT_Desktop.h>
|
||||||
#include <SUIT_MessageBox.h>
|
#include <SUIT_MessageBox.h>
|
||||||
@ -59,27 +58,40 @@
|
|||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
|
RepairGUI_GlueDlg::RepairGUI_GlueDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
|
||||||
bool modal )
|
bool modal, TopAbs_ShapeEnum theGlueMode)
|
||||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal),
|
: GEOMBase_Skeleton(theGeometryGUI, parent, modal),
|
||||||
myCurrConstrId( -1 )
|
myCurrConstrId(-1), myGlueMode(theGlueMode)
|
||||||
{
|
{
|
||||||
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_GLUE_FACES" ) ) );
|
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||||
|
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_FACES")));
|
||||||
QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_FACES2")));
|
QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_FACES2")));
|
||||||
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
|
QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_EDGES")));
|
||||||
|
QPixmap image4 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_GLUE_EDGES2")));
|
||||||
|
|
||||||
setWindowTitle( tr( "GEOM_GLUE_TITLE" ) );
|
QString aTitle;
|
||||||
|
if (theGlueMode == TopAbs_FACE)
|
||||||
|
aTitle = tr("GEOM_GLUE_FACES_TITLE");
|
||||||
|
else if (theGlueMode == TopAbs_EDGE)
|
||||||
|
aTitle = tr("GEOM_GLUE_EDGES_TITLE");
|
||||||
|
setWindowTitle(aTitle);
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_GLUE_TITLE" ) );
|
mainFrame()->GroupConstructors->setTitle(aTitle);
|
||||||
mainFrame()->RadioButton1->setIcon( image0 );
|
if (theGlueMode == TopAbs_FACE) {
|
||||||
|
mainFrame()->RadioButton1->setIcon(image1);
|
||||||
mainFrame()->RadioButton2->setIcon(image2);
|
mainFrame()->RadioButton2->setIcon(image2);
|
||||||
|
}
|
||||||
|
else if (theGlueMode == TopAbs_EDGE) {
|
||||||
|
mainFrame()->RadioButton1->setIcon(image3);
|
||||||
|
mainFrame()->RadioButton2->setIcon(image4);
|
||||||
|
}
|
||||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
mainFrame()->RadioButton3->close();
|
mainFrame()->RadioButton3->close();
|
||||||
|
|
||||||
GroupPoints = new DlgRef_1SelExt(centralWidget());
|
GroupPoints = new DlgRef_1SelExt(centralWidget());
|
||||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE"));
|
GroupPoints->GroupBox1->setTitle(tr("GEOM_GLUE"));
|
||||||
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
||||||
GroupPoints->PushButton1->setIcon( image1 );
|
GroupPoints->PushButton1->setIcon(image0);
|
||||||
GroupPoints->LineEdit1->setReadOnly(true);
|
GroupPoints->LineEdit1->setReadOnly(true);
|
||||||
|
|
||||||
QLabel* aTolLab = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints->Box);
|
QLabel* aTolLab = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints->Box);
|
||||||
@ -96,7 +108,7 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* pare
|
|||||||
GroupPoints2 = new DlgRef_1SelExt(centralWidget());
|
GroupPoints2 = new DlgRef_1SelExt(centralWidget());
|
||||||
GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE"));
|
GroupPoints2->GroupBox1->setTitle(tr("GEOM_GLUE"));
|
||||||
GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
GroupPoints2->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
||||||
GroupPoints2->PushButton1->setIcon( image1 );
|
GroupPoints2->PushButton1->setIcon(image0);
|
||||||
GroupPoints2->LineEdit1->setReadOnly(true);
|
GroupPoints2->LineEdit1->setReadOnly(true);
|
||||||
|
|
||||||
QLabel* aTolLab2 = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints2->Box);
|
QLabel* aTolLab2 = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints2->Box);
|
||||||
@ -104,9 +116,18 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* pare
|
|||||||
initSpinBox(myTolEdt2, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision");
|
initSpinBox(myTolEdt2, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision");
|
||||||
myTolEdt2->setValue(DEFAULT_TOLERANCE_VALUE);
|
myTolEdt2->setValue(DEFAULT_TOLERANCE_VALUE);
|
||||||
|
|
||||||
myDetectBtn = new QPushButton( tr( "GEOM_DETECT" ) + QString( " [%1]" ).arg( tr( "GLUE_FACES" ) ),
|
QString aGlueString (" [%1]");
|
||||||
GroupPoints2->Box );
|
QString aSelString;
|
||||||
mySubShapesChk = new QCheckBox( tr( "SELECT_FACES" ), GroupPoints2->Box );
|
if (theGlueMode == TopAbs_FACE) {
|
||||||
|
aGlueString = aGlueString.arg(tr("GLUE_FACES"));
|
||||||
|
aSelString = tr("SELECT_FACES");
|
||||||
|
}
|
||||||
|
else if (theGlueMode == TopAbs_EDGE) {
|
||||||
|
aGlueString = aGlueString.arg(tr("GLUE_EDGES"));
|
||||||
|
aSelString = tr("SELECT_EDGES");
|
||||||
|
}
|
||||||
|
myDetectBtn = new QPushButton (tr("GEOM_DETECT") + aGlueString, GroupPoints2->Box);
|
||||||
|
mySubShapesChk = new QCheckBox (aSelString, GroupPoints2->Box);
|
||||||
|
|
||||||
boxLayout = new QGridLayout(GroupPoints2->Box);
|
boxLayout = new QGridLayout(GroupPoints2->Box);
|
||||||
boxLayout->setMargin(0); boxLayout->setSpacing(6);
|
boxLayout->setMargin(0); boxLayout->setSpacing(6);
|
||||||
@ -132,7 +153,6 @@ RepairGUI_GlueDlg::RepairGUI_GlueDlg( GeometryGUI* theGeometryGUI, QWidget* pare
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~RepairGUI_GlueDlg()
|
// function : ~RepairGUI_GlueDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -141,7 +161,6 @@ RepairGUI_GlueDlg::~RepairGUI_GlueDlg()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -187,7 +206,6 @@ void RepairGUI_GlueDlg::Init()
|
|||||||
updateButtonState();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ConstructorsClicked()
|
// function : ConstructorsClicked()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
@ -245,7 +263,6 @@ void RepairGUI_GlueDlg::ConstructorsClicked( int constructorId )
|
|||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
// purpose : Same than click on apply but close this dialog.
|
// purpose : Same than click on apply but close this dialog.
|
||||||
@ -257,7 +274,6 @@ void RepairGUI_GlueDlg::ClickOnOk()
|
|||||||
ClickOnCancel();
|
ClickOnCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -321,7 +337,6 @@ void RepairGUI_GlueDlg::SetEditCurrentArgument()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -339,7 +354,6 @@ void RepairGUI_GlueDlg::LineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -359,7 +373,6 @@ void RepairGUI_GlueDlg::ActivateThisDialog()
|
|||||||
activateSelection();
|
activateSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose : Mouse enter onto the dialog to activate it
|
// purpose : Mouse enter onto the dialog to activate it
|
||||||
@ -370,7 +383,6 @@ void RepairGUI_GlueDlg::enterEvent( QEvent* )
|
|||||||
ActivateThisDialog();
|
ActivateThisDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : createOperation
|
// function : createOperation
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -415,7 +427,12 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
|||||||
switch (getConstructorId()) {
|
switch (getConstructorId()) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var anObj = anOper->MakeGlueFaces( myObject, myTolEdt->value(), true );
|
GEOM::GEOM_Object_var anObj;
|
||||||
|
if (myGlueMode == TopAbs_FACE)
|
||||||
|
anObj = anOper->MakeGlueFaces(myObject, myTolEdt->value(), true);
|
||||||
|
else if (myGlueMode == TopAbs_EDGE)
|
||||||
|
anObj = anOper->MakeGlueEdges(myObject, myTolEdt->value());
|
||||||
|
|
||||||
aResult = !anObj->_is_nil();
|
aResult = !anObj->_is_nil();
|
||||||
if (aResult && !IsPreview())
|
if (aResult && !IsPreview())
|
||||||
{
|
{
|
||||||
@ -430,7 +447,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (IsPreview()) {
|
if (IsPreview()) {
|
||||||
// if this method is used for displaying preview then we must detect glue faces only
|
// if this method is used for displaying preview then we must detect glue faces/edges only
|
||||||
for (int i = 0; i < myTmpObjs.count(); i++) {
|
for (int i = 0; i < myTmpObjs.count(); i++) {
|
||||||
myTmpObjs[i].get()->Register(); // increment counter, since calling function will call UnRegister()
|
myTmpObjs[i].get()->Register(); // increment counter, since calling function will call UnRegister()
|
||||||
objects.push_back(myTmpObjs[i].copy());
|
objects.push_back(myTmpObjs[i].copy());
|
||||||
@ -438,7 +455,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
|||||||
return !myTmpObjs.isEmpty();
|
return !myTmpObjs.isEmpty();
|
||||||
} // IsPreview
|
} // IsPreview
|
||||||
|
|
||||||
// Make glue face by list.
|
// Make glue faces/edges by list.
|
||||||
// Iterate through myTmpObjs and verifies where each object is currently selected or not.
|
// Iterate through myTmpObjs and verifies where each object is currently selected or not.
|
||||||
QSet<QString> selected;
|
QSet<QString> selected;
|
||||||
|
|
||||||
@ -454,7 +471,7 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
|||||||
// Iterate through result and select objects with names from selection
|
// Iterate through result and select objects with names from selection
|
||||||
// ObjectList toRemoveFromEnggine;
|
// ObjectList toRemoveFromEnggine;
|
||||||
|
|
||||||
// make glue faces
|
// make glue faces/edges
|
||||||
GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
|
GEOM::ListOfGO_var aListForGlue = new GEOM::ListOfGO();
|
||||||
aListForGlue->length(myTmpObjs.count());
|
aListForGlue->length(myTmpObjs.count());
|
||||||
int added = 0;
|
int added = 0;
|
||||||
@ -465,14 +482,16 @@ bool RepairGUI_GlueDlg::execute( ObjectList& objects )
|
|||||||
}
|
}
|
||||||
aListForGlue->length(added);
|
aListForGlue->length(added);
|
||||||
|
|
||||||
GEOM::GEOM_Object_var anObj = anOper->MakeGlueFacesByList( myObject, myTolEdt2->value(), aListForGlue.in(), true );
|
GEOM::GEOM_Object_var anObj;
|
||||||
|
if (myGlueMode == TopAbs_FACE)
|
||||||
|
anObj = anOper->MakeGlueFacesByList(myObject, myTolEdt2->value(), aListForGlue.in(), true);
|
||||||
|
else if (myGlueMode == TopAbs_EDGE)
|
||||||
|
anObj = anOper->MakeGlueEdgesByList(myObject, myTolEdt2->value(), aListForGlue.in());
|
||||||
|
|
||||||
aResult = !anObj->_is_nil();
|
aResult = !anObj->_is_nil();
|
||||||
|
|
||||||
if ( aResult )
|
if (aResult) {
|
||||||
{
|
if (!IsPreview()) {
|
||||||
if ( !IsPreview() )
|
|
||||||
{
|
|
||||||
QStringList aParameters;
|
QStringList aParameters;
|
||||||
aParameters << myTolEdt2->text();
|
aParameters << myTolEdt2->text();
|
||||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||||
@ -501,7 +520,7 @@ void RepairGUI_GlueDlg::restoreSubShapes( SALOMEDS::Study_ptr theStudy,
|
|||||||
{
|
{
|
||||||
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
|
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
|
||||||
GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
|
GEOM::find_shape_method aFindMethod = GEOM::FSM_GetInPlace;
|
||||||
if ( getConstructorId() == 0 ) // MakeGlueFaces
|
if (getConstructorId() == 0) // MakeGlueFaces or MakeGlueEdges
|
||||||
aFindMethod = GEOM::FSM_GetInPlaceByHistory;
|
aFindMethod = GEOM::FSM_GetInPlaceByHistory;
|
||||||
|
|
||||||
// empty list of arguments means that all arguments should be restored
|
// empty list of arguments means that all arguments should be restored
|
||||||
@ -633,7 +652,6 @@ bool RepairGUI_GlueDlg::onAcceptLocal()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : onDetect
|
// function : onDetect
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -652,17 +670,27 @@ void RepairGUI_GlueDlg::onDetect()
|
|||||||
globalSelection(GEOM_ALLSHAPES);
|
globalSelection(GEOM_ALLSHAPES);
|
||||||
|
|
||||||
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
|
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
|
||||||
GEOM::ListOfGO_var aList = anOper->GetGlueFaces( myObject.in(), myTolEdt2->value() );
|
GEOM::ListOfGO_var aList;
|
||||||
|
if (myGlueMode == TopAbs_FACE)
|
||||||
|
aList = anOper->GetGlueFaces(myObject.in(), myTolEdt2->value());
|
||||||
|
else if (myGlueMode == TopAbs_EDGE)
|
||||||
|
aList = anOper->GetGlueEdges(myObject.in(), myTolEdt2->value());
|
||||||
|
|
||||||
for (int i = 0, n = aList->length(); i < n; i++)
|
for (int i = 0, n = aList->length(); i < n; i++)
|
||||||
myTmpObjs << GEOM::GeomObjPtr(aList[i].in());
|
myTmpObjs << GEOM::GeomObjPtr(aList[i].in());
|
||||||
|
|
||||||
if (!myTmpObjs.isEmpty()) {
|
if (!myTmpObjs.isEmpty()) {
|
||||||
|
if (myGlueMode == TopAbs_FACE)
|
||||||
msg = tr("FACES_FOR_GLUING_ARE_DETECTED").arg(myTmpObjs.count());
|
msg = tr("FACES_FOR_GLUING_ARE_DETECTED").arg(myTmpObjs.count());
|
||||||
|
else if (myGlueMode == TopAbs_EDGE)
|
||||||
|
msg = tr("EDGES_FOR_GLUING_ARE_DETECTED").arg(myTmpObjs.count());
|
||||||
mySubShapesChk->setChecked(true);
|
mySubShapesChk->setChecked(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (myGlueMode == TopAbs_FACE)
|
||||||
msg = tr("THERE_ARE_NO_FACES_FOR_GLUING");
|
msg = tr("THERE_ARE_NO_FACES_FOR_GLUING");
|
||||||
|
else if (myGlueMode == TopAbs_EDGE)
|
||||||
|
msg = tr("THERE_ARE_NO_EDGES_FOR_GLUING");
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||||
|
@ -18,17 +18,18 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// GEOM GEOMGUI : GUI for Geometry component
|
// GEOM GEOMGUI : GUI for Geometry component
|
||||||
// File : RepairGUI_GlueDlg.h
|
// File : RepairGUI_GlueDlg.h
|
||||||
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
|
||||||
//
|
|
||||||
#ifndef REPAIRGUI_GLUEDLG_H
|
#ifndef REPAIRGUI_GLUEDLG_H
|
||||||
#define REPAIRGUI_GLUEDLG_H
|
#define REPAIRGUI_GLUEDLG_H
|
||||||
|
|
||||||
#include <GEOMBase_Skeleton.h>
|
#include <GEOMBase_Skeleton.h>
|
||||||
|
|
||||||
|
#include <TopAbs.hxx>
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
class DlgRef_1SelExt;
|
class DlgRef_1SelExt;
|
||||||
@ -45,7 +46,7 @@ class RepairGUI_GlueDlg : public GEOMBase_Skeleton
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RepairGUI_GlueDlg( GeometryGUI*, QWidget* = 0, bool = false );
|
RepairGUI_GlueDlg (GeometryGUI*, QWidget* = 0, bool = false, TopAbs_ShapeEnum theGlueMode = TopAbs_FACE);
|
||||||
~RepairGUI_GlueDlg();
|
~RepairGUI_GlueDlg();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -62,9 +63,9 @@ private:
|
|||||||
|
|
||||||
void clearTemporary();
|
void clearTemporary();
|
||||||
|
|
||||||
|
// Reimplementation of onAccept for local case of this class.
|
||||||
bool onAcceptLocal();
|
bool onAcceptLocal();
|
||||||
void clearShapeBufferLocal (GEOM::GEOM_Object_ptr);
|
void clearShapeBufferLocal (GEOM::GEOM_Object_ptr);
|
||||||
// Reimplementation of onAccept for local case of this class.
|
|
||||||
|
|
||||||
void activateSelection();
|
void activateSelection();
|
||||||
void updateButtonState();
|
void updateButtonState();
|
||||||
@ -83,6 +84,8 @@ private:
|
|||||||
|
|
||||||
int myCurrConstrId;
|
int myCurrConstrId;
|
||||||
|
|
||||||
|
TopAbs_ShapeEnum myGlueMode;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void ClickOnCancel();
|
virtual void ClickOnCancel();
|
||||||
|
|
||||||
@ -97,7 +100,6 @@ private slots:
|
|||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
|
|
||||||
void ConstructorsClicked (int);
|
void ConstructorsClicked (int);
|
||||||
//void ValueChangedInSpinBox();
|
|
||||||
|
|
||||||
void onDetect();
|
void onDetect();
|
||||||
void onTolerChanged (double);
|
void onTolerChanged (double);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user