NRI : Merge BRANCH_V1_2c

This commit is contained in:
nri 2003-11-04 10:36:56 +00:00
parent 256e34502e
commit 0e49ec355e
28 changed files with 1903 additions and 1136 deletions

View File

@ -0,0 +1,3 @@
This file is only here for CVS:
CVS does not always create empty directory, and adm_local/unix/config_file
is needed by build_configure.

View File

@ -47,9 +47,8 @@ PYTHONHOME = @PYTHONHOME@
PYTHON_INCLUDES = @PYTHON_INCLUDES@ PYTHON_INCLUDES = @PYTHON_INCLUDES@
PYTHON_LIBS = @PYTHON_LIBS@ PYTHON_LIBS = @PYTHON_LIBS@
PYTHON_VERSION = @PYTHON_VERSION@ PYTHON_VERSION = @PYTHON_VERSION@
PYTHON_SITE = @PYTHON_SITE@ PYTHON_SITE = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages
PYTHON_SITE_INSTALL = @PYTHON_SITE_INSTALL@ PYTHON_SITE_INSTALL = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome
# QT # QT
QT_ROOT = @QT_ROOT@ QT_ROOT = @QT_ROOT@
@ -101,13 +100,18 @@ MED2_MT_LIBS=@MED2_MT_LIBS@
OCC_INCLUDES=@CAS_CPPFLAGS@ OCC_INCLUDES=@CAS_CPPFLAGS@
OCC_CXXFLAGS=@CAS_CXXFLAGS@ OCC_CXXFLAGS=@CAS_CXXFLAGS@
OCC_KERNEL_LIBS=@CAS_KERNEL@ #OCC_KERNEL_LIBS=@CAS_KERNEL@
OCC_OCAF_LIBS=@CAS_OCAF@ #OCC_OCAF_LIBS=@CAS_OCAF@
OCC_VIEWER_LIBS=@CAS_VIEWER@ #OCC_VIEWER_LIBS=@CAS_VIEWER@
OCC_MODELER_LIBS=@CAS_MODELER@ #OCC_MODELER_LIBS=@CAS_MODELER@
OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@ #OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@
OCC_LIBS=@CAS_LDFLAGS@ #OCC_LIBS=@CAS_LDFLAGS@
CAS_KERNEL=@CAS_KERNEL@
CAS_OCAF=@CAS_OCAF@
CAS_VIEWER=@CAS_VIEWER@
CAS_MODELER=@CAS_MODELER@
CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@
CAS_LDPATH=@CAS_LDPATH@
# MPICH # MPICH
MPICH_INCLUDES=@MPICH_INCLUDES@ MPICH_INCLUDES=@MPICH_INCLUDES@
@ -164,6 +168,8 @@ CXXFLAGS+= $(CORBA_CXXFLAGS)
#LDFLAGS+= $(CORBA_LIBS) #LDFLAGS+= $(CORBA_LIBS)
LIBS+=$(CORBA_LIBS) LIBS+=$(CORBA_LIBS)
DOXYGEN = @DOXYGEN@
## Shared libraries ## Shared libraries
LT_STATIC_EXEC=@LT_STATIC_EXEC@ LT_STATIC_EXEC=@LT_STATIC_EXEC@
DYNAMIC_DIRS=@DYNAMIC_DIRS@ DYNAMIC_DIRS=@DYNAMIC_DIRS@
@ -192,8 +198,9 @@ libdir=@libdir@/salome
# warning : if user give this path in configure we could have salome/salome :-( # warning : if user give this path in configure we could have salome/salome :-(
includedir=@includedir@/salome includedir=@includedir@/salome
datadir=@datadir@/salome datadir=@datadir@/salome
idldir=$(prefix)/idl/salome idldir=${prefix}/idl/salome
sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
incmakedir=${prefix}/salome_adm/unix
docdir=$(datadir)/doc docdir=$(datadir)/doc
@ -201,7 +208,7 @@ docdir=$(datadir)/doc
# begin of package rules # begin of package rules
# #
.PHONY: all lib bin inc resources tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean .PHONY: all lib bin inc resources data doc tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean
.SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm .SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm

View File

@ -1 +1 @@
THIS IS SALOME PRO - GEOM VERSION: 1.2 THIS IS SALOME PRO - GEOM VERSION: 1.3.0

View File

@ -3,7 +3,7 @@
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# General configuration options # General configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
PROJECT_NAME = "SALOME PRO - GEOM - v.1.2" PROJECT_NAME = "SALOME PRO - GEOM - v.1.3.0"
PROJECT_NUMBER = id#1.1 PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../ OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English OUTPUT_LANGUAGE = English

View File

@ -6,6 +6,7 @@
# #
# source path # source path
top_srcdir=@top_srcdir@ top_srcdir=@top_srcdir@
root_srcdir=@ROOT_SRCDIR@
top_builddir=../.. top_builddir=../..
srcdir=@srcdir@ srcdir=@srcdir@
VPATH=.:@srcdir@ VPATH=.:@srcdir@
@ -16,7 +17,7 @@ doxygen=@DOXYGEN@
doc: doc:
cp -fr $(srcdir)/INPUT ./; \ cp -fr $(srcdir)/INPUT ./; \
cd INPUT; \ cd INPUT; \
sed 's|../../../share/salome|../$(top_srcdir)|' doxyfile > doxyfile1; \ sed 's|../../../share/salome|$(root_srcdir)|' doxyfile > doxyfile1; \
mv -f doxyfile1 doxyfile; \ mv -f doxyfile1 doxyfile; \
$(doxygen) ./doxyfile; \ $(doxygen) ./doxyfile; \
cd ..; \ cd ..; \

View File

@ -55,7 +55,11 @@ using namespace std;
#include <GC_Root.hxx> #include <GC_Root.hxx>
#include <BRepCheck_Analyzer.hxx> #include <BRepCheck_Analyzer.hxx>
#if OCC_VERSION_MAJOR >= 5
#include <BRepAlgo.hxx>
#else
#include <BRepAlgoAPI.hxx> #include <BRepAlgoAPI.hxx>
#endif
#include <BRepAdaptor_Surface.hxx> #include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_Copy.hxx> #include <BRepBuilderAPI_Copy.hxx>
#include <BRepAlgoAPI_Common.hxx> #include <BRepAlgoAPI_Common.hxx>
@ -150,6 +154,14 @@ using namespace std;
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
Standard_EXPORT static Standard_Boolean IsValid(const TopoDS_Shape& S) {
#if OCC_VERSION_MAJOR >= 5
return BRepAlgo::IsValid(S);
#else
return BRepAlgoAPI::IsValid(S);
#endif
}
//============================================================================ //============================================================================
// function : GEOM_Gen_i() // function : GEOM_Gen_i()
// purpose : constructor to be called for servant creation. // purpose : constructor to be called for servant creation.
@ -761,8 +773,13 @@ const char* GEOM_Gen_i::GetStringFromIOR(GEOM::GEOM_Shape_var shapeIOR) {
// purpose : returns a 'GEOM::GEOM_Shape_var' from a string representing it // purpose : returns a 'GEOM::GEOM_Shape_var' from a string representing it
//================================================================================= //=================================================================================
GEOM::GEOM_Shape_ptr GEOM_Gen_i::GetIORFromString(const char* stringIOR) { GEOM::GEOM_Shape_ptr GEOM_Gen_i::GetIORFromString(const char* stringIOR) {
GEOM::GEOM_Shape_var shapeIOR = GEOM::GEOM_Shape::_narrow(_orb->string_to_object(stringIOR)) ; GEOM::GEOM_Shape_var shapeIOR;
return shapeIOR._retn(); if(strcmp(stringIOR,"") != 0){
CORBA::Object_var anObject = _orb->string_to_object(stringIOR);
if(!CORBA::is_nil(anObject))
shapeIOR = GEOM::GEOM_Shape::_narrow(anObject.in()) ;
}
return shapeIOR._retn() ;
} }
@ -1446,7 +1463,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHolesInFaceOrShell( GEOM::GEOM_Shape_pt
THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHolesInFace : no holes selected", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHolesInFace : no holes selected", SALOME::BAD_PARAM);
const TopoDS_Shape tds = GetTopoShape(shapeFaceShell) ; const TopoDS_Shape tds = GetTopoShape(shapeFaceShell) ;
if( tds.IsNull() || !BRepAlgoAPI::IsValid(tds) ) if( tds.IsNull() || !IsValid(tds) )
THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHolesInFace() : non valid main argument", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHolesInFace() : non valid main argument", SALOME::BAD_PARAM);
/* Create a map of wires/holes to suppress */ /* Create a map of wires/holes to suppress */
@ -1552,7 +1569,7 @@ bool GEOM_Gen_i::RebuildFaceRemovingHoles( const TopoDS_Face& aFace,
{ {
/* Get the outer wire of the face 'aFace' */ /* Get the outer wire of the face 'aFace' */
TopoDS_Wire outW = BRepTools::OuterWire( aFace ) ; TopoDS_Wire outW = BRepTools::OuterWire( aFace ) ;
if( outW.IsNull() || !BRepAlgoAPI::IsValid(outW) ) if( outW.IsNull() || !IsValid(outW) )
THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHolesInFace : bad outer wire of 'aFace'", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHolesInFace : bad outer wire of 'aFace'", SALOME::BAD_PARAM);
/* Rebuild a face avoiding holes in the map 'mapHoles' */ /* Rebuild a face avoiding holes in the map 'mapHoles' */
@ -1612,7 +1629,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHole( GEOM::GEOM_Shape_ptr shape,
/* Retrieve 'aShape' the initial main shape selection */ /* Retrieve 'aShape' the initial main shape selection */
const TopoDS_Shape aShape = GetTopoShape(shape); const TopoDS_Shape aShape = GetTopoShape(shape);
if( !BRepAlgoAPI::IsValid(aShape) ) if( !IsValid(aShape) )
THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : non valid main shape", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : non valid main shape", SALOME::BAD_PARAM);
if( ListIdFace.length() != 1 || ListIdWire.length() != 1 ) if( ListIdFace.length() != 1 || ListIdWire.length() != 1 )
@ -1625,7 +1642,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHole( GEOM::GEOM_Shape_ptr shape,
else { else {
aFace = TopoDS::Face(tmp) ; aFace = TopoDS::Face(tmp) ;
} }
if( !BRepAlgoAPI::IsValid(aFace) ) if( !IsValid(aFace) )
THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : face shape not valid", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : face shape not valid", SALOME::BAD_PARAM);
/* Retrieve 'aWire' selection : Warning : index of wire refers to the face ! */ /* Retrieve 'aWire' selection : Warning : index of wire refers to the face ! */
@ -1636,12 +1653,12 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHole( GEOM::GEOM_Shape_ptr shape,
else { else {
aWire = TopoDS::Wire(aTmp) ; aWire = TopoDS::Wire(aTmp) ;
} }
if( !BRepAlgoAPI::IsValid(aWire) ) if( !IsValid(aWire) )
THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : bad wire" , SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : bad wire" , SALOME::BAD_PARAM);
/* Get the outer wire of aFace */ /* Get the outer wire of aFace */
TopoDS_Wire outerW = BRepTools::OuterWire( aFace ) ; TopoDS_Wire outerW = BRepTools::OuterWire( aFace ) ;
if( outerW.IsNull() || !BRepAlgoAPI::IsValid(outerW) ) if( outerW.IsNull() || !IsValid(outerW) )
THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : bad outer wire", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : bad outer wire", SALOME::BAD_PARAM);
/* Test bad user selection aWire */ /* Test bad user selection aWire */
@ -1655,7 +1672,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHole( GEOM::GEOM_Shape_ptr shape,
} }
else { else {
TopoDS_Shape aTemp ; TopoDS_Shape aTemp ;
if( !GetShapeFromIndex( aShape, TopAbs_FACE, ListIdEndFace[0], aTemp ) || tmp.IsNull() || !BRepAlgoAPI::IsValid(aTemp) ) if( !GetShapeFromIndex( aShape, TopAbs_FACE, ListIdEndFace[0], aTemp ) || tmp.IsNull() || !IsValid(aTemp) )
THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : non valid endFace", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("in GEOM_Gen_i::SuppressHole() : non valid endFace", SALOME::BAD_PARAM);
/* Test if 'endFace' as at least one hole */ /* Test if 'endFace' as at least one hole */
@ -1665,7 +1682,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::SuppressHole( GEOM::GEOM_Shape_ptr shape,
int nbWires = 0 ; int nbWires = 0 ;
for( fExp.Init(endFace, TopAbs_WIRE); fExp.More(); fExp.Next() ) { for( fExp.Init(endFace, TopAbs_WIRE); fExp.More(); fExp.Next() ) {
TopoDS_Wire W = TopoDS::Wire( fExp.Current() ) ; TopoDS_Wire W = TopoDS::Wire( fExp.Current() ) ;
if( !W.IsNull() && BRepAlgoAPI::IsValid(W) ) if( !W.IsNull() && IsValid(W) )
nbWires++ ; nbWires++ ;
} }
if(nbWires > 1) if(nbWires > 1)
@ -1816,7 +1833,7 @@ bool GEOM_Gen_i::BuildShellWithFaceCompound( const TopoDS_Compound Comp,
int i = 0 ; int i = 0 ;
for( ex.Init( Comp, TopAbs_FACE); ex.More(); ex.Next() ) { for( ex.Init( Comp, TopAbs_FACE); ex.More(); ex.Next() ) {
TopoDS_Face F = TopoDS::Face( ex.Current() ) ; TopoDS_Face F = TopoDS::Face( ex.Current() ) ;
if( !BRepAlgoAPI::IsValid(F) ) { if( !IsValid(F) ) {
return false ; return false ;
} }
B.AddShellFace( resultShell, F ) ; B.AddShellFace( resultShell, F ) ;
@ -1847,7 +1864,7 @@ bool GEOM_Gen_i::FindCompareWireHoleOnFace( const TopoDS_Face& F,
/* Get the outer wire of aFace */ /* Get the outer wire of aFace */
TopoDS_Wire outerW = BRepTools::OuterWire(F) ; TopoDS_Wire outerW = BRepTools::OuterWire(F) ;
if( outerW.IsNull() || !BRepAlgoAPI::IsValid(outerW) ) { if( outerW.IsNull() || !IsValid(outerW) ) {
return false ; return false ;
} }
@ -2354,7 +2371,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBoolean(GEOM::GEOM_Shape_ptr shape1,
} }
/* We test the validity of resulting shape */ /* We test the validity of resulting shape */
if( !BRepAlgoAPI::IsValid(shape) ) { if( !IsValid(shape) ) {
THROW_SALOME_CORBA_EXCEPTION("Boolean aborted : non valid shape result", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Boolean aborted : non valid shape result", SALOME::BAD_PARAM);
} }
@ -2408,7 +2425,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFuse(GEOM::GEOM_Shape_ptr shape1,
} }
/* We test the validity of resulting shape */ /* We test the validity of resulting shape */
if( !BRepAlgoAPI::IsValid(shape) ) { if( !IsValid(shape) ) {
THROW_SALOME_CORBA_EXCEPTION("Fuse aborted : non valid shape result", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Fuse aborted : non valid shape result", SALOME::BAD_PARAM);
} }
@ -2860,7 +2877,7 @@ throw (SALOME::SALOME_Exception)
tds = PS.Shape(); tds = PS.Shape();
if( !BRepAlgoAPI::IsValid(tds) ) { if( !IsValid(tds) ) {
//MESSAGE ( "In Partition: non valid shape result" ); //MESSAGE ( "In Partition: non valid shape result" );
THROW_SALOME_CORBA_EXCEPTION("Partition aborted : non valid shape result", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Partition aborted : non valid shape result", SALOME::BAD_PARAM);
} }
@ -3004,7 +3021,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilling(GEOM::GEOM_Shape_ptr myShape,
} }
/* We test the validity of resulting shape */ /* We test the validity of resulting shape */
if( !BRepAlgoAPI::IsValid(tds) ) { if( !IsValid(tds) ) {
THROW_SALOME_CORBA_EXCEPTION("Filling aborted : non valid shape result", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Filling aborted : non valid shape result", SALOME::BAD_PARAM);
} }
else { else {
@ -3296,7 +3313,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSewing( const GEOM::GEOM_Gen::ListOfIOR& Li
aMethod.Perform() ; aMethod.Perform() ;
tds = aMethod.SewedShape() ; tds = aMethod.SewedShape() ;
if( !BRepAlgoAPI::IsValid(tds) ) { if( !IsValid(tds) ) {
THROW_SALOME_CORBA_EXCEPTION("Make Sewing aborted : non valid shape", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Make Sewing aborted : non valid shape", SALOME::BAD_PARAM);
} }
if( tds.IsNull() ) { if( tds.IsNull() ) {
@ -3335,7 +3352,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSewingShape( GEOM::GEOM_Shape_ptr aShape,
aMethod.Perform() ; aMethod.Perform() ;
tds = aMethod.SewedShape() ; tds = aMethod.SewedShape() ;
if( !BRepAlgoAPI::IsValid(tds) ) { if( !IsValid(tds) ) {
THROW_SALOME_CORBA_EXCEPTION("Make Sewing aborted : non valid shape", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Make Sewing aborted : non valid shape", SALOME::BAD_PARAM);
} }
} }
@ -4389,7 +4406,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePipe( GEOM::GEOM_Shape_ptr pathShape,
THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakePipe", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakePipe", SALOME::BAD_PARAM);
} }
if ( !BRepAlgoAPI::IsValid(tds) ) { if ( !IsValid(tds) ) {
THROW_SALOME_CORBA_EXCEPTION("MakePipe aborted : non valid shape result", SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION("MakePipe aborted : non valid shape result", SALOME::BAD_PARAM);
} }
else { else {

View File

@ -51,7 +51,7 @@ EXPORT_HEADERS =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) $(OCC_DATAEXCHANGE_LIBS) -lGEOMDS -lSalomeDS -lSalomeNS -lSalomeContainer -lGEOMPartition -lGEOMArchimede -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS += -lGEOMDS -lTOOLSDS -lSalomeNS -lSalomeContainer -lGEOMPartition -lGEOMArchimede $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset -L${KERNEL_ROOT_DIR}/lib/salome
# additional file to be cleaned # additional file to be cleaned
MOSTLYCLEAN = MOSTLYCLEAN =

View File

@ -53,7 +53,7 @@ BIN_SERVER_IDL =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS += $(CAS_LDPATH) -lTKTopAlgo -L${KERNEL_ROOT_DIR}/lib/salome
@CONCLUDE@ @CONCLUDE@

View File

@ -63,7 +63,7 @@ EXPORT_HEADERS= GEOMDS_Application.hxx \
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(OCC_KERNEL_LIBS) $(OCC_OCAF_LIBS) LDFLAGS += $(CAS_LDPATH) -lTKCAF
# additional file to be cleaned # additional file to be cleaned
MOSTLYCLEAN = MOSTLYCLEAN =

View File

@ -54,7 +54,7 @@ EXPORT_HEADERS= GEOM_ShapeTypeFilter.hxx \
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS += -lSalomeGUI -L${KERNEL_ROOT_DIR}/lib/salome
# additional file to be cleaned # additional file to be cleaned
MOSTLYCLEAN = MOSTLYCLEAN =

View File

@ -717,9 +717,9 @@ GEOM_Actor* GeometryGUI::ConvertIORinGEOMActor( const char * IOR,
GEOM::GEOM_Shape_ptr GeometryGUI::ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO, GEOM::GEOM_Shape_ptr GeometryGUI::ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO,
Standard_Boolean& testResult ) Standard_Boolean& testResult )
{ {
GEOM::GEOM_Shape_ptr aShape ; GEOM::GEOM_Shape_var aShape ;
testResult = false ; testResult = false ;
/* case SObject */ /* case SObject */
if ( IO->hasEntry() ) { if ( IO->hasEntry() ) {
SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument(); SALOMEDS::Study_var aStudy = GeomGUI->myActiveStudy->getStudyDocument();
@ -727,23 +727,23 @@ GEOM::GEOM_Shape_ptr GeometryGUI::ConvertIOinGEOMShape( const Handle(SALOME_Inte
SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR; SALOMEDS::AttributeIOR_var anIOR;
if ( !obj->_is_nil() ) { if ( !obj->_is_nil() ) {
if (obj->FindAttribute(anAttr, "AttributeIOR")) { if (obj->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
aShape = myComponentGeom->GetIORFromString(anIOR->Value()) ; aShape = myComponentGeom->GetIORFromString(anIOR->Value()) ;
testResult = true ; if(!CORBA::is_nil(aShape)) testResult = true ;
return aShape; return aShape._retn();
} }
} }
} }
/* case Graphical Object */ /* case Graphical Object */
if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) {
Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO );
Standard_CString ior = GIObject->getIOR(); Standard_CString ior = GIObject->getIOR();
testResult = true ;
aShape = myComponentGeom->GetIORFromString(ior) ; aShape = myComponentGeom->GetIORFromString(ior) ;
return aShape; if(!CORBA::is_nil(aShape)) testResult = true ;
} return aShape._retn();
return aShape ; }
return aShape._retn();
} }

View File

@ -50,7 +50,11 @@ using namespace std;
#include <Standard_ErrorHandler.hxx> #include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx> #include <Standard_Failure.hxx>
#include <BRepOffsetAPI_MakePipe.hxx> #include <BRepOffsetAPI_MakePipe.hxx>
#if OCC_VERSION_MAJOR >= 5
#include <BRepAlgo.hxx>
#else
#include <BRepAlgoAPI.hxx> #include <BRepAlgoAPI.hxx>
#endif
//================================================================================= //=================================================================================
@ -386,7 +390,11 @@ void GeometryGUI_PipeDlg::SelectionIntoArgument()
try try
{ {
tds = BRepOffsetAPI_MakePipe(aWire,myShape1 ) ; tds = BRepOffsetAPI_MakePipe(aWire,myShape1 ) ;
#if OCC_VERSION_MAJOR >= 5
if ( BRepAlgo::IsValid(tds) )
#else
if ( BRepAlgoAPI::IsValid(tds) ) if ( BRepAlgoAPI::IsValid(tds) )
#endif
{ {
//Draw Pipe //Draw Pipe
mySimulationTopoDs = tds; mySimulationTopoDs = tds;

View File

@ -40,7 +40,11 @@ using namespace std;
#include <BRepBuilderAPI_MakeVertex.hxx> #include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#if OCC_VERSION_MAJOR >= 5
#include <BRepAlgo.hxx>
#else
#include <BRepAlgoAPI.hxx> #include <BRepAlgoAPI.hxx>
#endif
#include <Geom_Curve.hxx> #include <Geom_Curve.hxx>
#include <qbuttongroup.h> #include <qbuttongroup.h>
@ -763,7 +767,11 @@ void GeometryGUI_PointDlg::ActivateThisDialog( )
//================================================================================= //=================================================================================
bool GeometryGUI_PointDlg::CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const Standard_Real aParameter, TopoDS_Shape& resultVertex) bool GeometryGUI_PointDlg::CalculateVertexOnCurve(const TopoDS_Edge& anEdge, const Standard_Real aParameter, TopoDS_Shape& resultVertex)
{ {
#if OCC_VERSION_MAJOR >= 5
if( anEdge.IsNull() || !BRepAlgo::IsValid(anEdge) )
#else
if( anEdge.IsNull() || !BRepAlgoAPI::IsValid(anEdge) ) if( anEdge.IsNull() || !BRepAlgoAPI::IsValid(anEdge) )
#endif
return false ; return false ;
Standard_Real first, last ; Standard_Real first, last ;

View File

@ -171,6 +171,7 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMSketcher $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMSketcher $(CAS_LDPATH) -lTKFillet -lTKOffset -L${KERNEL_ROOT_DIR}/lib/salome
@CONCLUDE@ @CONCLUDE@

View File

@ -101,9 +101,17 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
case StdSelect_DM_Shading: case StdSelect_DM_Shading:
{ {
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn(); myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(Graphic3d_NOM_BRASS);
Graphic3d_MaterialAspect aMatAspect;
aMatAspect.SetAmbient( 1 );
aMatAspect.SetDiffuse( 0 );
aMatAspect.SetEmissive( 0 );
aMatAspect.SetShininess(1 );
aMatAspect.SetSpecular( 0 );
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE); myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE);
Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial(); Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
FMat.SetTransparency(myTransparency); BMat.SetTransparency(myTransparency); FMat.SetTransparency(myTransparency); BMat.SetTransparency(myTransparency);

View File

@ -274,7 +274,8 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper)
aMatrix->Delete(); aMatrix->Delete();
} else } else
this->Device->Render(ren, this->Mapper); this->Device->Render(ren, this->Mapper);
this->EstimatedRenderTime = WireframeMapper->GetTimeToDraw(); if(WireframeMapper!=NULL) this->EstimatedRenderTime = WireframeMapper->GetTimeToDraw();
else if(ShadingMapper!=NULL) this->EstimatedRenderTime = ShadingMapper->GetTimeToDraw();
} }
// SubShape // SubShape

View File

@ -57,8 +57,7 @@ BIN_SRC =
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS+=$(QT_MT_LIBS) $(OCC_KERNEL_LIBS) $(OCC_VIEWER_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS) -lSalomeObject -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS+=$(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS) -lSalomeObject -L${KERNEL_ROOT_DIR}/lib/salome
%_moc.cxx: %.h %_moc.cxx: %.h
$(MOC) $< -o $@ $(MOC) $< -o $@

View File

@ -55,7 +55,7 @@ EXPORT_IDLS=
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS += $(CAS_LDPATH) -lTKBool -L${KERNEL_ROOT_DIR}/lib/salome
%_moc.cxx: %.h %_moc.cxx: %.h
$(MOC) $< -o $@ $(MOC) $< -o $@

View File

@ -62,13 +62,30 @@ is
AddVonE(myclass; V : Vertex from TopoDS; AddVonE(myclass; V : Vertex from TopoDS;
E1,E2 : Edge from TopoDS; E1,E2 : Edge from TopoDS;
AsDes : mutable AsDes from BRepAlgo) AsDes : mutable AsDes from BRepAlgo;
F: Face from TopoDS)
returns Vertex from TopoDS; returns Vertex from TopoDS;
---Purpose: Put V in AsDes as intersection of E1 and E2. ---Purpose: Put V in AsDes as intersection of E1 and E2.
-- Check that vertex equal to V already exists on one -- Check that vertex equal to V already exists on one
-- of edges, in such a case, V is not added but -- of edges, in such a case, V is not added but
-- existing vertex is updated to be on E1 and E2 and -- existing vertex is updated to be on E1 and E2 and
-- is returned insead of V. -- is returned insead of V.
-- Optional F is a face E1 and E2 are on. If F is
-- provided, it is used to find new vertices on E1
-- and E2 resulting from intersection of new edges on
-- the two other faces the F interferes with and
-- through which E1 and E2 pass too. This helps to
-- avoid small edges.
GetTolerance(myclass; theV : Vertex from TopoDS;
theU : Real from Standard;
theE : Edge from TopoDS;
theAsDes : AsDes from BRepAlgo)
returns Real from Standard;
---Purpose: Returns tolerance theV must have atfer its
-- addition to theE with theU parameter. theAsDes is
-- used to find pcurves of theE
end Inter2d; end Inter2d;

View File

@ -1,23 +1,23 @@
// GEOM PARTITION : partition algorithm // GEOM PARTITION : partition algorithm
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 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
// modify it under the terms of the GNU Lesser General Public // modify it under the terms of the GNU Lesser General Public
// 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.
// //
// You should have received a copy of the GNU Lesser General Public // You should have received a copy of the GNU Lesser General Public
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
// //
// //
// //
@ -31,30 +31,26 @@ using namespace std;
#include "utilities.h" #include "utilities.h"
#include <TopExp.hxx> #include <BRepAdaptor_Curve.hxx>
#include <TopExp_Explorer.hxx>
#include <BRepAlgo_AsDes.hxx> #include <BRepAlgo_AsDes.hxx>
#include <BRepLib_MakeVertex.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRepLib_MakeVertex.hxx> #include <Geom_Surface.hxx>
#include <BRepAdaptor_Curve.hxx> #include <Precision.hxx>
#include <TopExp.hxx>
#include <gp_Pnt.hxx> #include <TopExp_Explorer.hxx>
#include <TopOpeBRepDS_Transition.hxx>
#include <TopOpeBRep_EdgesIntersector.hxx>
#include <TopOpeBRep_Point2d.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopOpeBRep_EdgesIntersector.hxx> #include <gp_Pnt.hxx>
#include <TopOpeBRep_Point2d.hxx>
#include <TopOpeBRepDS_Transition.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <stdio.h>
#include <Precision.hxx>
#ifdef DEB #ifdef DEB
static Standard_Boolean TestEdges = 0; static Standard_Boolean TestEdges = 0;
@ -63,21 +59,110 @@ static Standard_Integer NbE2d = 0;
#endif #endif
//======================================================================= //=======================================================================
//function : StorePart2d //function : getOtherShape
//purpose : //purpose :
//=======================================================================
static TopoDS_Shape getOtherShape(const TopoDS_Shape& theS,
const TopTools_ListOfShape& theSList)
{
TopTools_ListIteratorOfListOfShape anIt( theSList );
for ( ; anIt.More(); anIt.Next() )
if (!theS.IsSame( anIt.Value() ))
return anIt.Value();
return TopoDS_Shape();
}
//=======================================================================
//function : findVOnE
//purpose : on theE, find a vertex close to theV, such that an edge
// passing through it is an itersection of theF1 and theF2.
// theE intersects theE2 at theV
//=======================================================================
static Standard_Boolean findVOnE(const TopoDS_Vertex & theV,
const TopoDS_Edge& theE,
const TopoDS_Edge& theE2,
const TopoDS_Shape& theF1,
const TopoDS_Shape& theF2,
const Handle(BRepAlgo_AsDes)& theAsDes,
TopoDS_Vertex & theFoundV)
{
Standard_Real MinDist2 = ::RealLast();
gp_Pnt P;
// check all vertices on theE
const TopTools_ListOfShape& aVList = theAsDes->Descendant( theE );
TopTools_ListIteratorOfListOfShape anIt( aVList );
if (anIt.More())
P = BRep_Tool::Pnt( theV );
for ( ; anIt.More(); anIt.Next() )
{
// check by distance
TopoDS_Vertex & V = TopoDS::Vertex( anIt.Value() );
Standard_Real dist2 = P.SquareDistance( BRep_Tool::Pnt( V ));
if (dist2 < MinDist2)
MinDist2 = dist2;
else
continue;
// V is a candidate if among edges passing through V there is one
// which is an intersection of theF1 and theF2
TopTools_ListIteratorOfListOfShape anEIt( theAsDes->Ascendant( V ));
Standard_Boolean isOk = Standard_False;
for ( ; !isOk && anEIt.More(); anEIt.Next() )
{
const TopoDS_Shape & E2 = anEIt.Value();
if ( theE2.IsSame( E2 ))
continue;
const TopTools_ListOfShape & aFList = theAsDes->Ascendant( E2 );
if (aFList.IsEmpty())
continue;
if ( theF1.IsSame( aFList.First() ))
isOk = theF2.IsSame( aFList.Last() );
else
isOk = theF2.IsSame( aFList.First() ) && theF1.IsSame( aFList.Last() );
}
if (isOk)
theFoundV = V;
}
if (theFoundV.IsNull())
return Standard_False;
// check that MinDist2 is not too large
Standard_Real f, l;
TopLoc_Location L;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve( theE, L, f, l );
gp_Pnt P1 = aCurve->Value( f );
gp_Pnt P2 = aCurve->Value( 0.3 * f + 0.7 * l );
//gp_Pnt P2 = aCurve->Value( 0.5 * ( f + l ));
if (MinDist2 > P1.SquareDistance( P2 ))
return Standard_False;
#ifdef DEB
cout << "findVOnE: found MinDist = " << sqrt (MinDist2) << endl;
#endif
return Standard_True;
}
//=======================================================================
//function : AddVonE
//purpose : Put V in AsDes as intersection of E1 and E2.
// Check that vertex equal to V already exists on one
// of edges, in such a case, V is not added but
// existing vertex is updated to be on E1 and E2 and
// is returned insead of V.
//======================================================================= //=======================================================================
// static void StorePart2d (const TopoDS_Edge& E1,
// const TopoDS_Edge& E2,
// TopTools_ListOfShape& LV1,
// TopTools_ListOfShape& LV2,
// Handle(BRepAlgo_AsDes) AsDes,
// Standard_Real Tol)
TopoDS_Vertex Partition_Inter2d::AddVonE(const TopoDS_Vertex& theV, TopoDS_Vertex Partition_Inter2d::AddVonE(const TopoDS_Vertex& theV,
const TopoDS_Edge& E1, const TopoDS_Edge& E1,
const TopoDS_Edge& E2, const TopoDS_Edge& E2,
const Handle(BRepAlgo_AsDes)& AsDes) const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& theF)
{ {
//------------------------------------------------------------- //-------------------------------------------------------------
// test if the points of intersection already exist. If not, // test if the points of intersection already exist. If not,
@ -86,119 +171,128 @@ TopoDS_Vertex Partition_Inter2d::AddVonE(const TopoDS_Vertex& theV,
//------------------------------------------------------------- //-------------------------------------------------------------
const TopTools_ListOfShape& VOnE1 = AsDes->Descendant(E1); const TopTools_ListOfShape& VOnE1 = AsDes->Descendant(E1);
const TopTools_ListOfShape& VOnE2 = AsDes->Descendant(E2); const TopTools_ListOfShape& VOnE2 = AsDes->Descendant(E2);
TopTools_ListOfShape NewVOnE1;
TopTools_ListOfShape NewVOnE2;
gp_Pnt P1,P2; gp_Pnt P1,P2;
TopoDS_Vertex V1,V2; TopoDS_Vertex V1,V2;
TopTools_ListIteratorOfListOfShape it, itLV1, itLV2; TopTools_ListIteratorOfListOfShape it;
BRep_Builder B; BRep_Builder B;
TopAbs_Orientation O1,O2; TopAbs_Orientation O1,O2;
Standard_Real U1,U2; Standard_Real U1,U2;
Standard_Real Tol,Tol1,Tol2; Standard_Real Tol,Tol1,Tol2;
Standard_Boolean OnE1,OnE2; Standard_Boolean OnE1,OnE2;
// for (itLV1.Initialize(LV1),itLV2.Initialize(LV2); TopoDS_Vertex V = theV;
// itLV1.More();
// itLV1.Next() ,itLV2.Next()) {
TopoDS_Vertex V = theV; U1 = BRep_Tool::Parameter(V,E1);
// TopoDS_Vertex V = TopoDS::Vertex(itLV1.Value()); U2 = BRep_Tool::Parameter(V,E2);
O1 = V.Orientation();
O2 = O1;
P1 = BRep_Tool::Pnt(V);
Tol = BRep_Tool::Tolerance( V );
OnE1 = OnE2 = Standard_False;
U1 = BRep_Tool::Parameter(V,E1); //-----------------------------------------------------------------
U2 = BRep_Tool::Parameter(V,E2); // Search if the point of intersection is a vertex of E1.
O1 = V.Orientation(); //-----------------------------------------------------------------
O2 = O1;///itLV2.Value().Orientation(); for (it.Initialize(VOnE1); it.More(); it.Next()) {
P1 = BRep_Tool::Pnt(V); const TopoDS_Vertex& CV = TopoDS::Vertex( it.Value() );
Tol = BRep_Tool::Tolerance( V ); if (V.IsSame( CV )) {
OnE1 = OnE2 = Standard_False; V1 = V;
OnE1 = Standard_True;
break;
}
P2 = BRep_Tool::Pnt( CV );
Tol1 = 1.1*(Tol + BRep_Tool::Tolerance( CV ));
if (P1.SquareDistance(P2) <= Tol1*Tol1) {
V = CV;
V1 = V;
OnE1 = Standard_True;
break;
}
}
if (OnE1) {
//----------------------------------------------------------------- //-----------------------------------------------------------------
// Search if the point of intersection is a vertex of E1. // Search if the vertex found is still on E2.
//----------------------------------------------------------------- //-----------------------------------------------------------------
for (it.Initialize(VOnE1); it.More(); it.Next()) { for (it.Initialize(VOnE2); it.More(); it.Next()) {
if (V.IsSame( it.Value() )) {
OnE2 = Standard_True;
V2 = V;
break;
}
}
}
if (!OnE2) {
for (it.Initialize(VOnE2); it.More(); it.Next()) {
//-----------------------------------------------------------------
// Search if the point of intersection is a vertex of E2.
//-----------------------------------------------------------------
const TopoDS_Vertex& CV = TopoDS::Vertex( it.Value() ); const TopoDS_Vertex& CV = TopoDS::Vertex( it.Value() );
if (V.IsSame( CV )) {
V1 = V;
OnE1 = Standard_True;
break;
}
P2 = BRep_Tool::Pnt( CV ); P2 = BRep_Tool::Pnt( CV );
Tol1 = 1.1*(Tol + BRep_Tool::Tolerance( CV )); Tol2 = 1.1*(Tol + BRep_Tool::Tolerance( CV ));
if (P1.SquareDistance(P2) <= Tol1*Tol1) { if (P1.SquareDistance(P2) <= Tol2*Tol2) {
V = CV; V = CV;
V1 = V; V2 = V;
OnE1 = Standard_True; OnE2 = Standard_True;
break; break;
} }
} }
if (OnE1) { }
//-----------------------------------------------------------------
// Search if the vertex found is still on E2.
//-----------------------------------------------------------------
for (it.Initialize(VOnE2); it.More(); it.Next()) {
if (V.IsSame( it.Value() )) {
OnE2 = Standard_True;
V2 = V;
break;
}
}
}
if (!OnE2) {
for (it.Initialize(VOnE2); it.More(); it.Next()) {
//-----------------------------------------------------------------
// Search if the point of intersection is a vertex of E2.
//-----------------------------------------------------------------
const TopoDS_Vertex& CV = TopoDS::Vertex( it.Value() );
P2 = BRep_Tool::Pnt( CV );
Tol2 = 1.1*(Tol + BRep_Tool::Tolerance( CV ));
if (P1.SquareDistance(P2) <= Tol2*Tol2) {
V = CV;
V2 = V;
OnE2 = Standard_True;
break;
}
}
}
if (OnE1 && OnE2) {
if (!V1.IsSame(V2)) {
Standard_Real UV2;
TopoDS_Edge EWE2;
TopoDS_Vertex VI;
const TopTools_ListOfShape& EdgeWithV2 = AsDes->Ascendant(V2);
for (it.Initialize(EdgeWithV2); it.More(); it.Next()) {
EWE2 = TopoDS::Edge(it.Value()); if (!OnE1 && !OnE2 && !theF.IsNull())
VI = V2; {
VI.Orientation(TopAbs_INTERNAL); // analitically find vertices E1 and E2 must pass trough
UV2 = BRep_Tool::Parameter(VI,EWE2);
VI = V1; TopoDS_Shape F1 = getOtherShape( theF, AsDes->Ascendant( E1 ));
VI.Orientation(TopAbs_INTERNAL); TopoDS_Shape F2 = getOtherShape( theF, AsDes->Ascendant( E2 ));
B.UpdateVertex(VI,UV2,EWE2, Max(Tol1,Tol2)); if (!F1.IsNull() && !F2.IsNull())
} {
AsDes->Replace(V2,V1); OnE1 = findVOnE ( theV, E1, E2, F1, F2, AsDes, V1 );
} OnE2 = findVOnE ( theV, E2, E1, F1, F2, AsDes, V2 );
if (OnE2) V = V2;
if (OnE1) V = V1;
} }
// add existing vertices instead of new ones }
if (!OnE1) {
if (OnE2) { if (OnE1 && OnE2) {
V.Orientation(TopAbs_INTERNAL); if (!V1.IsSame(V2)) {
B.UpdateVertex(V,U1,E1, Tol2); // replace V1 with V2 on all edges V1 is on
Standard_Real UV1;
TopoDS_Edge EWE1;
TopoDS_Vertex VI;
const TopTools_ListOfShape& EdgeWithV1 = AsDes->Ascendant(V1);
for (it.Initialize(EdgeWithV1); it.More(); it.Next()) {
EWE1 = TopoDS::Edge(it.Value());
VI = V1;
VI.Orientation(TopAbs_INTERNAL);
UV1 = BRep_Tool::Parameter(VI,EWE1);
VI = V2;
VI.Orientation(TopAbs_INTERNAL);
B.UpdateVertex( VI, UV1, EWE1, GetTolerance( VI, UV1, EWE1, AsDes));
} }
V.Orientation(O1); AsDes->Replace(V1,V2);
NewVOnE1.Prepend(V); V = V2;
} }
if (!OnE2) { }
if (OnE1) {
V.Orientation(TopAbs_INTERNAL); // add existing vertices instead of new ones
B.UpdateVertex(V,U2,E2, Tol1); if (!OnE1) {
} if (OnE2) {
V.Orientation(O2); V.Orientation(TopAbs_INTERNAL);
NewVOnE2.Prepend(V); B.UpdateVertex (V, U1, E1, GetTolerance( V, U1, E1, AsDes));
} }
// } V.Orientation(O1);
AsDes->Add(E1,V);
if (!NewVOnE1.IsEmpty()) AsDes->Add(E1,NewVOnE1); }
if (!NewVOnE2.IsEmpty()) AsDes->Add(E2,NewVOnE2); if (!OnE2) {
if (OnE1) {
V.Orientation(TopAbs_INTERNAL);
B.UpdateVertex (V, U2, E2, GetTolerance( V, U2, E2, AsDes ));
}
V.Orientation(O2);
AsDes->Add(E2,V);
}
return V; return V;
} }
@ -212,11 +306,11 @@ TopoDS_Vertex Partition_Inter2d::AddVonE(const TopoDS_Vertex& theV,
//======================================================================= //=======================================================================
TopoDS_Vertex Partition_Inter2d::FindEndVertex(const TopTools_ListOfShape& LV, TopoDS_Vertex Partition_Inter2d::FindEndVertex(const TopTools_ListOfShape& LV,
const Standard_Real f, const Standard_Real f,
const Standard_Real l, const Standard_Real l,
const TopoDS_Edge& E, const TopoDS_Edge& E,
Standard_Boolean& isFirst, Standard_Boolean& isFirst,
Standard_Real& minDU) Standard_Real& minDU)
{ {
TopoDS_Vertex endV; TopoDS_Vertex endV;
Standard_Real U, endU, min; Standard_Real U, endU, min;
@ -238,7 +332,7 @@ TopoDS_Vertex Partition_Inter2d::FindEndVertex(const TopTools_ListOfShape& LV,
isFirst = Standard_True; isFirst = Standard_True;
else else
isFirst = Standard_False; isFirst = Standard_False;
return endV; return endV;
} }
@ -248,10 +342,10 @@ TopoDS_Vertex Partition_Inter2d::FindEndVertex(const TopTools_ListOfShape& LV,
//======================================================================= //=======================================================================
static void treatClosed (const TopoDS_Edge& E1, static void treatClosed (const TopoDS_Edge& E1,
const Standard_Real f, const Standard_Real f,
const Standard_Real l, const Standard_Real l,
TopTools_ListOfShape& LV1, TopTools_ListOfShape& LV1,
TopTools_ListOfShape& /*LV2*/) TopTools_ListOfShape& /*LV2*/)
{ {
Standard_Boolean isFirst=0; Standard_Boolean isFirst=0;
Standard_Real minDU = 1.e10; Standard_Real minDU = 1.e10;
@ -261,12 +355,12 @@ static void treatClosed (const TopoDS_Edge& E1,
if (minDU > Precision::PConfusion()) if (minDU > Precision::PConfusion())
return; // not end point return; // not end point
Standard_Real newU; Standard_Real newU;
if (isFirst) if (isFirst)
newU = f + (l - f); newU = f + (l - f);
else else
newU = l - (l - f); newU = l - (l - f);
// update end parameter // update end parameter
BRep_Builder B; BRep_Builder B;
endV.Orientation(TopAbs_INTERNAL); endV.Orientation(TopAbs_INTERNAL);
@ -275,21 +369,21 @@ static void treatClosed (const TopoDS_Edge& E1,
//======================================================================= //=======================================================================
//function : EdgesPartition //function : EdgesPartition
//purpose : //purpose :
//======================================================================= //=======================================================================
static void EdgesPartition(const TopoDS_Face& F, static void EdgesPartition(const TopoDS_Face& F,
const TopoDS_Edge& E1, const TopoDS_Edge& E1,
const TopoDS_Edge& E2, const TopoDS_Edge& E2,
const Handle(BRepAlgo_AsDes)& AsDes, const Handle(BRepAlgo_AsDes)& AsDes,
const TopTools_MapOfShape& NewEdges, const TopTools_MapOfShape& NewEdges,
const Standard_Boolean WithOri) const Standard_Boolean WithOri)
{ {
Standard_Real f[3],l[3]; Standard_Real f[3],l[3];
Standard_Real MilTol2; Standard_Real MilTol2;
Standard_Real Tol = Max (BRep_Tool::Tolerance(E1), Standard_Real Tol = Max (BRep_Tool::Tolerance(E1),
BRep_Tool::Tolerance(E2)); BRep_Tool::Tolerance(E2));
MilTol2 = Tol * Tol * 10; MilTol2 = Tol * Tol * 10;
BRep_Tool::Range(E1, f[1], l[1]); BRep_Tool::Range(E1, f[1], l[1]);
@ -319,10 +413,10 @@ static void EdgesPartition(const TopoDS_Face& F,
TopExp_Explorer exp(F2, TopAbs_EDGE); TopExp_Explorer exp(F2, TopAbs_EDGE);
TopExp::MapShapes(F1, TopAbs_EDGE, ME); TopExp::MapShapes(F1, TopAbs_EDGE, ME);
for (; exp.More(); exp.Next()) { for (; exp.More(); exp.Next()) {
if (ME.Contains( exp.Current())) { if (ME.Contains( exp.Current())) {
intersect = Standard_False; intersect = Standard_False;
break; break;
} }
} }
} }
} }
@ -341,7 +435,8 @@ static void EdgesPartition(const TopoDS_Face& F,
Standard_Boolean rejectreducedsegmentpoints = Standard_False; Standard_Boolean rejectreducedsegmentpoints = Standard_False;
EInter.InitPoint(rejectreducedsegmentpoints); EInter.InitPoint(rejectreducedsegmentpoints);
for (;EInter.MorePoint();EInter.NextPoint()) { for ( ; EInter.MorePoint(); EInter.NextPoint() )
{
const TopOpeBRep_Point2d& P2D = EInter.Point(); const TopOpeBRep_Point2d& P2D = EInter.Point();
const gp_Pnt& P = P2D.Value(); const gp_Pnt& P = P2D.Value();
TopoDS_Vertex V = BRepLib_MakeVertex(P); TopoDS_Vertex V = BRepLib_MakeVertex(P);
@ -353,36 +448,25 @@ static void EdgesPartition(const TopoDS_Face& F,
gp_Pnt P2 = CE2.Value(P2D.Parameter(2)); gp_Pnt P2 = CE2.Value(P2D.Parameter(2));
Standard_Real sqd1 = P1.SquareDistance(P); Standard_Real sqd1 = P1.SquareDistance(P);
Standard_Real sqd2 = P2.SquareDistance(P); Standard_Real sqd2 = P2.SquareDistance(P);
if (sqd1 > MilTol2 || sqd2 > MilTol2 ) { if (sqd1 > MilTol2 || sqd2 > MilTol2 )
//MESSAGE ( "Inter2d : Solution rejected, dist: " << sqrt(Max(sqd1,sqd2)) ) continue;
#ifdef DEB
if (TestEdges) {
MESSAGE ( " edges : E2d_"<<NbE2d-2<<" E2d_"<<NbE2d-1 ); }
#endif
continue;
}
// add a new vertex to the both edges // add a new vertex to the both edges
Standard_Real toler = 1.5 * Max (Tol, sqrt(Max(sqd1,sqd2)) ); Standard_Real toler = Max( Tol, sqrt( Max( sqd1, sqd2 )));
Standard_Integer i; Standard_Integer i;
for (i = 1; i <= 2; i++) { for (i = 1; i <= 2; i++) {
Standard_Real U = P2D.Parameter(i); Standard_Real U = P2D.Parameter(i);
#ifdef DEB V.Orientation(TopAbs_INTERNAL);
if (U < f[i]-Tol || U > l[i]+Tol) { B.UpdateVertex( V,U,EI[i], toler);
MESSAGE ( "out" ); TopAbs_Orientation OO = TopAbs_REVERSED;
} if (WithOri) {
#endif if (P2D.IsVertex(i))
V.Orientation(TopAbs_INTERNAL); OO = P2D.Vertex(i).Orientation();
B.UpdateVertex( V,U,EI[i], toler); else if (P2D.Transition(i).Before() == TopAbs_OUT) {
TopAbs_Orientation OO = TopAbs_REVERSED; OO = TopAbs_FORWARD;
if (WithOri) { }
if (P2D.IsVertex(i)) V.Orientation(OO);
OO = P2D.Vertex(i).Orientation(); if (i == 1) LV1.Append(V);
else if (P2D.Transition(i).Before() == TopAbs_OUT) {
OO = TopAbs_FORWARD;
}
V.Orientation(OO);
if (i == 1) LV1.Append(V);
else LV2.Append(V); else LV2.Append(V);
} }
} }
@ -410,7 +494,7 @@ static void EdgesPartition(const TopoDS_Face& F,
TolConf = Max (Tol, TolConf); TolConf = Max (Tol, TolConf);
TolConf2 = TolConf * TolConf; TolConf2 = TolConf * TolConf;
if (!intersect) if (!intersect)
TolConf2 *= 100; TolConf2 *= 100;
Standard_Real SqDist = P1.SquareDistance(P2); Standard_Real SqDist = P1.SquareDistance(P2);
if (SqDist <= TolConf2) { if (SqDist <= TolConf2) {
@ -442,27 +526,25 @@ static void EdgesPartition(const TopoDS_Face& F,
i = 1; i = 1;
Purge = Standard_False; Purge = Standard_False;
for (it1LV1.Initialize(LV1),it1LV2.Initialize(LV2); for (it1LV1.Initialize(LV1),it1LV2.Initialize(LV2);
it1LV1.More(); it1LV1.Next(),it1LV2.Next()) { it1LV1.More();
it1LV1.Next(),it1LV2.Next()) {
j = 1; j = 1;
it2LV1.Initialize(LV1); it2LV1.Initialize(LV1);
while (j < i) { while (j < i) {
const TopoDS_Vertex& VE1 = TopoDS::Vertex(it1LV1.Value()); const TopoDS_Vertex& VE1 = TopoDS::Vertex(it1LV1.Value());
const TopoDS_Vertex& VE2 = TopoDS::Vertex(it2LV1.Value()); const TopoDS_Vertex& VE2 = TopoDS::Vertex(it2LV1.Value());
Standard_Real Tol1 = BRep_Tool::Tolerance( VE1 ); Standard_Real Tol1 = BRep_Tool::Tolerance( VE1 );
Standard_Real Tol2 = BRep_Tool::Tolerance( VE2 ); Standard_Real Tol2 = BRep_Tool::Tolerance( VE2 );
P1 = BRep_Tool::Pnt( VE1 ); P1 = BRep_Tool::Pnt( VE1 );
P2 = BRep_Tool::Pnt( VE2 ); P2 = BRep_Tool::Pnt( VE2 );
if (P1.IsEqual(P2, Tol1 + Tol2)) { if (P1.IsEqual(P2, Tol1 + Tol2)) {
LV1.Remove(it1LV1); LV1.Remove(it1LV1);
LV2.Remove(it1LV2); LV2.Remove(it1LV2);
if (AffichPurge) { Purge = Standard_True;
MESSAGE ("Vertices confused purged in EdgeInter.") break;
} }
Purge = Standard_True; j++;
break; it2LV1.Next();
}
j++;
it2LV1.Next();
} }
if (Purge) break; if (Purge) break;
i++; i++;
@ -471,17 +553,17 @@ static void EdgesPartition(const TopoDS_Face& F,
// care of new closed edges, they always intersect with seam at end // care of new closed edges, they always intersect with seam at end
if (V1[0].IsSame( V1[1] ) && NewEdges.Contains(E1) ) if (V1[0].IsSame( V1[1] ) && NewEdges.Contains(E1) )
treatClosed (E1,f[1],l[1],LV1,LV2); treatClosed (E1, f[1], l[1], LV1, LV2);
if (V2[0].IsSame( V2[1] ) && NewEdges.Contains(E2) ) if (V2[0].IsSame( V2[1] ) && NewEdges.Contains(E2) )
treatClosed (E2,f[2],l[2],LV2,LV1); treatClosed (E2, f[2], l[2], LV2, LV1);
//--------------------------------- //----------------
// Stocking vertex . // Stocking vertex
//--------------------------------- //----------------
//StorePart2d (E1,E2,LV1,LV2,AsDes,Tol);
for ( it1LV1.Initialize( LV1 ); it1LV1.More(); it1LV1.Next()) for ( it1LV1.Initialize( LV1 ); it1LV1.More(); it1LV1.Next())
Partition_Inter2d::AddVonE ( TopoDS::Vertex( it1LV1.Value()), E1,E2,AsDes); Partition_Inter2d::AddVonE (TopoDS::Vertex( it1LV1.Value()),
E1, E2, AsDes, F);
} }
//======================================================================= //=======================================================================
@ -492,8 +574,8 @@ static void EdgesPartition(const TopoDS_Face& F,
//======================================================================= //=======================================================================
void Partition_Inter2d::CompletPart2d (const Handle(BRepAlgo_AsDes)& AsDes, void Partition_Inter2d::CompletPart2d (const Handle(BRepAlgo_AsDes)& AsDes,
const TopoDS_Face& F, const TopoDS_Face& F,
const TopTools_MapOfShape& NewEdges) const TopTools_MapOfShape& NewEdges)
{ {
#ifdef DEB #ifdef DEB
@ -517,7 +599,7 @@ void Partition_Inter2d::CompletPart2d (const Handle(BRepAlgo_AsDes)& AsDes,
const TopTools_ListOfShape& LE = AsDes->Descendant(F); const TopTools_ListOfShape& LE = AsDes->Descendant(F);
TopoDS_Vertex V1,V2; TopoDS_Vertex V1,V2;
Standard_Integer j, i = 1; Standard_Integer j, i = 1;
TopoDS_Face FF = F; TopoDS_Face FF = F;
FF.Orientation(TopAbs_FORWARD); FF.Orientation(TopAbs_FORWARD);
@ -533,8 +615,8 @@ void Partition_Inter2d::CompletPart2d (const Handle(BRepAlgo_AsDes)& AsDes,
// between them and with the restrictions edges // between them and with the restrictions edges
//---------------------------------------------------------- //----------------------------------------------------------
if ( (!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) && if ( (!EdgesOfFace.Contains(E1) || !EdgesOfFace.Contains(E2)) &&
(NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) { (NewEdges.Contains(E1) || NewEdges.Contains(E2)) ) {
EdgesPartition(FF,E1,E2,AsDes,NewEdges,Standard_True); EdgesPartition(FF,E1,E2,AsDes,NewEdges,Standard_True);
} }
it2LE.Next(); it2LE.Next();
j++; j++;
@ -543,3 +625,46 @@ void Partition_Inter2d::CompletPart2d (const Handle(BRepAlgo_AsDes)& AsDes,
} }
} }
//=======================================================================
//function : GetTolerance
//purpose : Returns tolerance theV must have atfer its
// addition to theE with theU parameter. theAsDes is
// used to find pcurves of theE
//=======================================================================
Standard_Real Partition_Inter2d::GetTolerance
(const TopoDS_Vertex & theV,
const Standard_Real theU,
const TopoDS_Edge & theE,
const Handle(BRepAlgo_AsDes)& theAsDes)
{
Standard_Real aTol = BRep_Tool::Tolerance( theV );
gp_Pnt aPnt = BRep_Tool::Pnt( theV );
// check point on 3D curve
Standard_Real f,l;
Handle(Geom_Curve) C = BRep_Tool::Curve( theE, f, l );
if (!C.IsNull())
aTol = Max ( aTol, aPnt.Distance( C->Value( theU )));
// check points on pcurves
const TopTools_ListOfShape& aFList = theAsDes->Ascendant( theE );
TopTools_ListIteratorOfListOfShape aFIt( aFList );
for ( ; aFIt.More(); aFIt.Next() )
{
const TopoDS_Face& F = TopoDS::Face( aFIt.Value() );
Handle(Geom2d_Curve) pcurve = BRep_Tool::CurveOnSurface( theE, F, f, l );
if (!pcurve.IsNull())
{
gp_Pnt2d aPnt2d = pcurve->Value( theU );
TopLoc_Location L;
Handle(Geom_Surface) S = BRep_Tool::Surface( F, L );
gp_Pnt aPntOnS = S->Value( aPnt2d.X(), aPnt2d.Y() );
if (!L.IsIdentity())
aPntOnS.Transform( L.Transformation() );
aTol = Max ( aTol, aPnt.Distance( aPntOnS ));
}
}
return aTol;
}

View File

@ -71,8 +71,8 @@ public:
// //
Standard_EXPORT static void CompletPart2d(const Handle(BRepAlgo_AsDes)& AsDes,const TopoDS_Face& F,const TopTools_MapOfShape& NewEdges) ; Standard_EXPORT static void CompletPart2d(const Handle(BRepAlgo_AsDes)& AsDes,const TopoDS_Face& F,const TopTools_MapOfShape& NewEdges) ;
Standard_EXPORT static TopoDS_Vertex FindEndVertex(const TopTools_ListOfShape& VertList,const Standard_Real f,const Standard_Real l,const TopoDS_Edge& E,Standard_Boolean& First,Standard_Real& DU) ; Standard_EXPORT static TopoDS_Vertex FindEndVertex(const TopTools_ListOfShape& VertList,const Standard_Real f,const Standard_Real l,const TopoDS_Edge& E,Standard_Boolean& First,Standard_Real& DU) ;
Standard_EXPORT static TopoDS_Vertex AddVonE(const TopoDS_Vertex& V,const TopoDS_Edge& E1,const TopoDS_Edge& E2,const Handle(BRepAlgo_AsDes)& AsDes) ; Standard_EXPORT static TopoDS_Vertex AddVonE(const TopoDS_Vertex& V,const TopoDS_Edge& E1,const TopoDS_Edge& E2,const Handle(BRepAlgo_AsDes)& AsDes,const TopoDS_Face& F) ;
Standard_EXPORT static Standard_Real GetTolerance(const TopoDS_Vertex& theV,const Standard_Real theU,const TopoDS_Edge& theE,const Handle(BRepAlgo_AsDes)& theAsDes) ;

View File

@ -68,14 +68,21 @@ is
TouchedFaces(me : in out) returns MapOfShape from TopTools TouchedFaces(me : in out) returns MapOfShape from TopTools
---C++: return & ---C++: return &
is static; is static;
---Purpose: return map of ---Purpose: return map of faces cut by new or section edges
AsDes(me) returns AsDes from BRepAlgo
is static;
NewEdges(me : in out) returns MapOfShape from TopTools NewEdges(me : in out) returns MapOfShape from TopTools
---C++: return & ---C++: return &
is static; is static;
---Purpose: return new and section edges
AsDes(me) returns AsDes from BRepAlgo
is static;
---Purpose: return an object containing info about
-- Ascendants | Descendants
-- ------------------+---------------------
-- 1. faces | edges cutting them
-- 2. sectoin edges | new vertices on them
------------------------------- -------------------------------
---Category: Same domain shapes ---Category: Same domain shapes

View File

@ -27,58 +27,63 @@
// $Header$ // $Header$
using namespace std; using namespace std;
#include "Partition_Inter3d.ixx"
#include "Partition_Inter2d.hxx" #include "Partition_Inter2d.hxx"
#include "Partition_Inter3d.ixx"
#include "utilities.h" #include "utilities.h"
#include <BRepOffset_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAlgo_AsDes.hxx> #include <BRepAlgo_AsDes.hxx>
#include <BRepAlgo_Image.hxx> #include <BRepAlgo_Image.hxx>
#include <BRepLib.hxx> #include <BRepLib.hxx>
#include <BRepOffset_Tool.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopOpeBRepTool_BoxSort.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS_Compound.hxx> #include <TopoDS_Vertex.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
#include <TopOpeBRepTool_BoxSort.hxx>
#ifdef DEB #ifdef DEB
#include <DBRep.hxx> #include <DBRep.hxx>
#endif #endif
#include <stdio.h>
#include <TopOpeBRepDS_HDataStructure.hxx>
#include <TopOpeBRep_DSFiller.hxx>
#include <TopOpeBRepTool_GeomTool.hxx>
#include <TopOpeBRepTool_OutCurveType.hxx>
#include <TopOpeBRepDS_BuildTool.hxx>
#include <TopOpeBRepBuild_Builder.hxx>
#include <TopOpeBRepDS_CurveExplorer.hxx>
#include <Geom2d_Curve.hxx>
#include <TopOpeBRepDS_PointIterator.hxx>
#include <TopOpeBRepDS_Transition.hxx>
#include <Geom_Curve.hxx>
#include <TopOpeBRepTool_CurveTool.hxx>
#include <TopOpeBRepDS_Interference.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <BRepLib_MakeVertex.hxx> #include <BRepLib_MakeVertex.hxx>
#include <BRepTools.hxx>
#include <Extrema_ExtPS.hxx>
#include <Extrema_POnSurf.hxx>
#include <Geom2dAPI_ProjectPointOnCurve.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <BRepTools.hxx> #include <TopOpeBRepBuild_Builder.hxx>
#include <Geom_RectangularTrimmedSurface.hxx> #include <TopOpeBRepDS_BuildTool.hxx>
#include <Geom_Surface.hxx> #include <TopOpeBRepDS_CurveExplorer.hxx>
#include <Geom_TrimmedCurve.hxx> #include <TopOpeBRepDS_HDataStructure.hxx>
#include <Geom2dAPI_ProjectPointOnCurve.hxx> #include <TopOpeBRepDS_Interference.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx> #include <TopOpeBRepDS_PointIterator.hxx>
#include <TopOpeBRepDS_Transition.hxx>
#include <TopOpeBRepTool_CurveTool.hxx>
#include <TopOpeBRepTool_GeomTool.hxx>
#include <TopOpeBRepTool_OutCurveType.hxx>
#include <TopOpeBRep_DSFiller.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <stdio.h>
//======================================================================= //=======================================================================
//function : Partition_Inter3d //function : Partition_Inter3d
@ -191,19 +196,62 @@ static void PutInBounds (const TopoDS_Face& F,
if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
S = (*(Handle_Geom_RectangularTrimmedSurface*)&S)->BasisSurface(); S = (*(Handle_Geom_RectangularTrimmedSurface*)&S)->BasisSurface();
} }
//--------------- if (!S->IsUPeriodic() && !S->IsVPeriodic())
// Recadre en U. return;
//---------------
if (!S->IsUPeriodic() && !S->IsVPeriodic()) return;
BRepTools::UVBounds(F,umin,umax,vmin,vmax); BRepTools::UVBounds(F,umin,umax,vmin,vmax);
gp_Pnt2d Pf = C2d->Value(f);
gp_Pnt2d Pl = C2d->Value(l);
const Standard_Real Um = 0.34*f + 0.66*l;
gp_Pnt2d Pm = C2d->Value( Um );
// sometimes on shpere, pcurve is out of domain by V though S is
// UPeriodic, sometimes it is in domain but nontheless it has
// wrong position.
// Check pcurve position by 3D point
if (S->IsKind(STANDARD_TYPE( Geom_SphericalSurface )) ||
S->IsKind(STANDARD_TYPE( Geom_ToroidalSurface )))
{
// get point on the surface
gp_Pnt Ps = S->Value( Pm.X(), Pm.Y() );
// get point on the edge
Handle(Geom_Curve) C = BRep_Tool::Curve( E, f, l );
gp_Pnt Pc = C->Value( Um );
// compare points
Standard_Real TolE = BRep_Tool::Tolerance( E );
if ( Pc.SquareDistance( Ps ) * 0.95 < TolE * TolE )
return; // OK
// find good UV for Pc: project Pc on S
GeomAdaptor_Surface SA (S);
Extrema_ExtPS anExtPS (Pc, SA,
SA.UResolution( TolE ), SA.VResolution( TolE ));
if (anExtPS.IsDone())
{
Standard_Integer i, nbExt = anExtPS.NbExt();
Extrema_POnSurf aPOnSurf;
for (i = 1; i <= nbExt; ++i )
if (anExtPS.Value( i ) <= TolE) {
aPOnSurf = anExtPS.Point( i );
break;
}
if (i <= nbExt) {
// a point found
Standard_Real u, v;
aPOnSurf.Parameter( u, v );
gp_Pnt2d aGoodPm ( u, v );
C2d->Translate( Pm , aGoodPm );
}
}
}
//---------------
// Recadre en U.
//---------------
if (S->IsUPeriodic()) { if (S->IsUPeriodic()) {
Standard_Real period = S->UPeriod(); Standard_Real period = S->UPeriod();
Standard_Real eps = period*1.e-6; Standard_Real eps = period*1.e-6;
gp_Pnt2d Pf = C2d->Value(f);
gp_Pnt2d Pl = C2d->Value(l);
gp_Pnt2d Pm = C2d->Value(0.34*f + 0.66*l);
Standard_Real minC = Min(Pf.X(),Pl.X()); minC = Min(minC,Pm.X()); Standard_Real minC = Min(Pf.X(),Pl.X()); minC = Min(minC,Pm.X());
Standard_Real maxC = Max(Pf.X(),Pl.X()); maxC = Max(maxC,Pm.X()); Standard_Real maxC = Max(Pf.X(),Pl.X()); maxC = Max(maxC,Pm.X());
Standard_Real du = 0.; Standard_Real du = 0.;
@ -235,9 +283,6 @@ static void PutInBounds (const TopoDS_Face& F,
if (S->IsVPeriodic()) { if (S->IsVPeriodic()) {
Standard_Real period = S->VPeriod(); Standard_Real period = S->VPeriod();
Standard_Real eps = period*1.e-6; Standard_Real eps = period*1.e-6;
gp_Pnt2d Pf = C2d->Value(f);
gp_Pnt2d Pl = C2d->Value(l);
gp_Pnt2d Pm = C2d->Value(0.34*f + 0.66*l);
Standard_Real minC = Min(Pf.Y(),Pl.Y()); minC = Min(minC,Pm.Y()); Standard_Real minC = Min(Pf.Y(),Pl.Y()); minC = Min(minC,Pm.Y());
Standard_Real maxC = Max(Pf.Y(),Pl.Y()); maxC = Max(maxC,Pm.Y()); Standard_Real maxC = Max(Pf.Y(),Pl.Y()); maxC = Max(maxC,Pm.Y());
Standard_Real dv = 0.; Standard_Real dv = 0.;
@ -309,8 +354,6 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
while (itLE.More()) { while (itLE.More()) {
TopoDS_Edge E = TopoDS::Edge(itLE.Value()); TopoDS_Edge E = TopoDS::Edge(itLE.Value());
// Standard_Real f,l;
// BRep_Tool::Range(E,f,l);
PutInBounds (F1,E,pc1); PutInBounds (F1,E,pc1);
PutInBounds (F2,E,pc2); PutInBounds (F2,E,pc2);
@ -327,48 +370,59 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
} }
} }
// =================================================== // ========================
// Store section edges, same domain faces and verives // store same domain faces
// =================================================== // ========================
TopTools_ListOfShape empty, LSP, LSE;
if ( DatStr->HasSameDomain( F1 )) { // same domain faces if ( DatStr->HasSameDomain( F1 ))
{
TopTools_ListOfShape emptyList;
if (!mySameDomainFM.IsBound(F1)) if (!mySameDomainFM.IsBound(F1))
mySameDomainFM.Bind(F1,empty); mySameDomainFM.Bind(F1,emptyList);
if (!mySameDomainFM.IsBound(F2)) if (!mySameDomainFM.IsBound(F2))
mySameDomainFM.Bind(F2,empty); mySameDomainFM.Bind(F2,emptyList);
mySameDomainFM(F1).Append(F2); mySameDomainFM(F1).Append(F2);
mySameDomainFM(F2).Append(F1); mySameDomainFM(F2).Append(F1);
} }
// ====================
// Store section edges
// ====================
const TopOpeBRepDS_DataStructure& DS = DatStr->DS(); const TopOpeBRepDS_DataStructure& DS = DatStr->DS();
Standard_Integer j,i,nes = DS.NbSectionEdges(); Standard_Integer j,i,nse = DS.NbSectionEdges();
if (!nes) return; if (nse == 0) return;
TopoDS_Vertex V, sdeV1, sdeV2; TopoDS_Vertex V, sdeV1, sdeV2;
TopTools_MapOfShape MV; TopTools_MapOfShape MV;
TopTools_ListOfShape LSE; // list of section edges
TopoDS_Face dummyF;
// put vertices on section edges for (i = 1; i <= nse; i++)
for (i=1;i<=nes;i++) { {
const TopoDS_Edge & se = DS.SectionEdge(i);
TopoDS_Edge se, sde, oe; // section, same domain, other edge
se = DS.SectionEdge(i);
if (! TopB.IsSplit(se,TopAbs_ON)) if (! TopB.IsSplit(se,TopAbs_ON))
continue; continue;
LSE.Append( se );
// add vertices where section edges interferes with other
// edges as its descendant in myAsDes
TopoDS_Edge sde, oe; // same domain, other edge
if (DatStr->HasSameDomain(se)) { if (DatStr->HasSameDomain(se)) {
sde = TopoDS::Edge( DatStr->SameDomain(se).Value() ); sde = TopoDS::Edge( DatStr->SameDomain(se).Value() );
TopExp::Vertices( sde, sdeV1, sdeV2); TopExp::Vertices( sde, sdeV1, sdeV2);
} }
TColStd_MapOfInteger MIV; // indices of added edges
TColStd_MapOfInteger MIV;
TopOpeBRepDS_PointIterator itP (DS.ShapeInterferences( se )); TopOpeBRepDS_PointIterator itP (DS.ShapeInterferences( se ));
itP.SupportKind( TopOpeBRepDS_EDGE ); itP.SupportKind( TopOpeBRepDS_EDGE );
// loop on intersections of se
for (; itP.More(); itP.Next()) { for (; itP.More(); itP.Next()) {
oe = TopoDS::Edge( DS.Shape( itP.Support())); oe = TopoDS::Edge( DS.Shape( itP.Support()));
if (itP.IsVertex()) { if (itP.IsVertex()) {
// there is a vertex at intersection
if ( !MIV.Add( itP.Current() )) if ( !MIV.Add( itP.Current() ))
continue; continue;
V = TopoDS::Vertex( DS.Shape( itP.Current())); V = TopoDS::Vertex( DS.Shape( itP.Current()));
@ -376,9 +430,10 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
oe = sde; oe = sde;
V = ReplaceSameDomainV( V , oe ); V = ReplaceSameDomainV( V , oe );
V.Orientation( TopAbs_INTERNAL); V.Orientation( TopAbs_INTERNAL);
B.UpdateVertex( V, itP.Parameter(), se, 0.); B.UpdateVertex( V, itP.Parameter(), se, 0.); // AddVonE() sets real U
} }
else { else {
// create a new vertex at the intersection point
const TopOpeBRepDS_Point& DSP = DS.Point( itP.Current()); const TopOpeBRepDS_Point& DSP = DS.Point( itP.Current());
V = BRepLib_MakeVertex( DSP.Point() ); V = BRepLib_MakeVertex( DSP.Point() );
V.Orientation( TopAbs_INTERNAL); V.Orientation( TopAbs_INTERNAL);
@ -393,50 +448,56 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
} }
} }
} }
TopoDS_Vertex addedV = Partition_Inter2d::AddVonE( V,se,oe,myAsDes); // add V on the both intersecting edges
TopoDS_Vertex addedV = Partition_Inter2d::AddVonE( V,se,oe,myAsDes,dummyF);
if (!addedV.IsSame( V )) if (!addedV.IsSame( V ))
mySameDomainVM.Bind (V, addedV); mySameDomainVM.Bind (V, addedV); // equal vertex is already there
MV.Add( addedV );
MV.Add( addedV ); // to ease storage of vertices of ON splits
} }
} }
TopB.SplitSectionEdges();
TopTools_DataMapOfShapeShape SEM; // map split - section edge
TopTools_IndexedMapOfShape ME[2];
TopExp::MapShapes( F1, TopAbs_EDGE, ME[1]);
TopExp::MapShapes( F2, TopAbs_EDGE, ME[0]);
// add section edge to the face it intersects and find // add section edge to the face it intersects and find
// splits ON that do not have same domain pair // splits ON that do not have same domain pair
for (i=1;i<=nes;i++) { TopB.SplitSectionEdges(); // let TopB find ON splits
const TopoDS_Edge& se = DS.SectionEdge(i); TopTools_MapOfShape SPM; // map of ON splits
if (! TopB.IsSplit(se,TopAbs_ON)) TopTools_IndexedMapOfShape ME[2];
continue; TopExp::MapShapes( F1, TopAbs_EDGE, ME[1]);
TopExp::MapShapes( F2, TopAbs_EDGE, ME[0]);
TopTools_ListIteratorOfListOfShape itSP, itLSE (LSE);
while ( itLSE.More() ) {
TopoDS_Edge se = TopoDS::Edge( itLSE.Value() );
Standard_Integer ancRank = DS.AncestorRank(se); Standard_Integer ancRank = DS.AncestorRank(se);
if (ME[ancRank-1].Contains( se )) if (ME[ancRank-1].Contains( se ))
continue; // se is an edge of face it intersects LSE.Remove( itLSE ); // se is an edge of face it intersects
else
itLSE.Next();
const TopoDS_Face& F = (ancRank == 1) ? F2 : F1; const TopoDS_Face& F = (ancRank == 1) ? F2 : F1;
// add se to face but dont add twice // add se to face but dont add twice
TopTools_ListIteratorOfListOfShape itE; TopTools_ListIteratorOfListOfShape itE( myAsDes->Descendant( F ));
if (myAsDes->HasDescendant( F )) { if (myAsDes->HasDescendant( F )) {
for (itE.Initialize( (myAsDes->Descendant( F )) ); itE.More(); itE.Next()) for ( ; itE.More(); itE.Next())
if (se.IsSame( itE.Value() )) if (se.IsSame( itE.Value() ))
break; break;
} }
if (!itE.More()) { if (!itE.More())
{
myAsDes->Add( F, se ); myAsDes->Add( F, se );
// check se pcurve on F
Standard_Real tol, f,l, umin=1e100, umax=-1e100; Standard_Real tol, f,l, umin=1e100, umax=-1e100;
Handle(Geom2d_Curve) pc = BRep_Tool::CurveOnSurface( se, F, f,l); Handle(Geom2d_Curve) pc = BRep_Tool::CurveOnSurface( se, F, f,l);
if (pc.IsNull()) { if (pc.IsNull()) {
TopTools_ListIteratorOfListOfShape it( TopB.Splits(se,TopAbs_ON) ); itSP.Initialize( TopB.Splits(se,TopAbs_ON) );
for ( ;it.More();it.Next()) { for ( ; itSP.More(); itSP.Next()) {
const TopoDS_Edge& E = TopoDS::Edge ( it.Value()); const TopoDS_Edge& E = TopoDS::Edge ( itSP.Value());
BRep_Tool::Range(E, f, l); BRep_Tool::Range(E, f, l);
umin = Min( umin, f); umin = Min( umin, f);
umax = Max( umax, l); umax = Max( umax, l);
@ -451,45 +512,43 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
B.UpdateEdge( se, pc, F, tol); B.UpdateEdge( se, pc, F, tol);
} }
} }
// to detect splits that do not have same domain pair // to detect splits that do not have same domain pair
TopTools_ListIteratorOfListOfShape it( TopB.Splits(se,TopAbs_ON) ); // ie which split a face into parts and not pass by its boundary
for ( ;it.More();it.Next()) { itSP.Initialize( TopB.Splits(se,TopAbs_ON) );
const TopoDS_Edge& S = TopoDS::Edge ( it.Value()); for ( ; itSP.More(); itSP.Next()) {
if (SEM.IsBound( S )) const TopoDS_Shape& SP = itSP.Value();
SEM.UnBind( S ); if (!SPM.Add( SP ))
else SPM.Remove( SP );
SEM.Bind( S, se);
} }
} }
// store vertices of ON splits and bind section edges to faces // store vertices of ON splits and bind section edges to faces
for (i=1;i<=nes;i++) {
for (itLSE.Initialize (LSE); itLSE.More(); itLSE.Next())
const TopoDS_Edge& se = DS.SectionEdge(i); {
if (! TopB.IsSplit(se,TopAbs_ON)) const TopoDS_Shape& se = itLSE.Value();
continue;
Standard_Integer ancRank = DS.AncestorRank(se); Standard_Integer ancRank = DS.AncestorRank(se);
if (ME[ancRank-1].Contains( se ))
continue; // se is an edge of face it intersects
TopoDS_Face F = (ancRank == 1) ? F2 : F1; TopoDS_Face F = (ancRank == 1) ? F2 : F1;
// add vertices of splits // add vertices of ON splits which have no same domain pair
Standard_Boolean added = Standard_False; Standard_Boolean added = Standard_False;
TopTools_ListIteratorOfListOfShape it( TopB.Splits(se,TopAbs_ON) ); itSP.Initialize( TopB.Splits(se,TopAbs_ON) );
for ( ;it.More();it.Next()) { for ( ; itSP.More(); itSP.Next())
const TopoDS_Edge& S = TopoDS::Edge ( it.Value()); {
if (!SEM.IsBound( S )) if (!SPM.Contains( itSP.Value() ))
continue; continue;
const TopoDS_Edge& S = TopoDS::Edge ( itSP.Value());
added = Standard_True; added = Standard_True;
mySectionEdgesAD->Add( F, se ); mySectionEdgesAD->Add( F, se );
TopoDS_Vertex VS[2]; TopoDS_Vertex VS[2];
TopExp::Vertices (S, VS[0], VS[1]); TopExp::Vertices (S, VS[0], VS[1]);
for (j=0; j<2; ++j) { for (j=0; j<2; ++j)
{
if (mySameDomainVM.IsBound( VS[j] )) if (mySameDomainVM.IsBound( VS[j] ))
VS[j] = TopoDS::Vertex( mySameDomainVM( VS[j] )); VS[j] = TopoDS::Vertex( mySameDomainVM( VS[j] ));
if ( !MV.Contains( VS[j] )) { if ( !MV.Contains( VS[j] )) {
@ -498,6 +557,8 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
TopTools_ListIteratorOfListOfShape itV( myAsDes->Descendant(se) ); TopTools_ListIteratorOfListOfShape itV( myAsDes->Descendant(se) );
for (; itV.More(); itV.Next()) { for (; itV.More(); itV.Next()) {
V = TopoDS::Vertex( itV.Value() ); V = TopoDS::Vertex( itV.Value() );
if ( V.IsSame( VS[j] ))
break;
gp_Pnt P2 = BRep_Tool::Pnt( V ); gp_Pnt P2 = BRep_Tool::Pnt( V );
if (P1.IsEqual( P2, Precision::Confusion())) { if (P1.IsEqual( P2, Precision::Confusion())) {
mySameDomainVM.Bind (VS[j], V); mySameDomainVM.Bind (VS[j], V);
@ -508,8 +569,13 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
if (!itV.More()) // no interferences with edges if (!itV.More()) // no interferences with edges
myAsDes->Add( se, VS[j]); myAsDes->Add( se, VS[j]);
} }
// add ends of ON splits to F in order to detect later
// if a split is on face in IsSplitOn()
mySectionEdgesAD->Add( F, VS[j]); mySectionEdgesAD->Add( F, VS[j]);
} }
// in the descendants of F, first go ends of an ON split and
// then a split itself
mySectionEdgesAD->Add( F, S ); mySectionEdgesAD->Add( F, S );
} }
if (!added) if (!added)
@ -544,13 +610,13 @@ void Partition_Inter3d::SetDone(const TopoDS_Face& F1,
const TopoDS_Face& F2) const TopoDS_Face& F2)
{ {
if (!myDone.IsBound(F1)) { if (!myDone.IsBound(F1)) {
TopTools_ListOfShape empty; TopTools_ListOfShape emptyList;
myDone.Bind(F1,empty); myDone.Bind(F1,emptyList);
} }
myDone(F1).Append(F2); myDone(F1).Append(F2);
if (!myDone.IsBound(F2)) { if (!myDone.IsBound(F2)) {
TopTools_ListOfShape empty; TopTools_ListOfShape emptyList;
myDone.Bind(F2,empty); myDone.Bind(F2,emptyList);
} }
myDone(F2).Append(F1); myDone(F2).Append(F1);
} }
@ -583,7 +649,6 @@ void Partition_Inter3d::StorePart3d(const TopoDS_Face& F1,
const TopoDS_Face& F2, const TopoDS_Face& F2,
const TopTools_ListOfShape& LInt) const TopTools_ListOfShape& LInt)
{ {
if (!LInt.IsEmpty()) { if (!LInt.IsEmpty()) {
myAsDes->Add( F1,LInt); myAsDes->Add( F1,LInt);
myAsDes->Add( F2,LInt); myAsDes->Add( F2,LInt);
@ -673,8 +738,8 @@ const TopTools_ListOfShape& Partition_Inter3d::SameDomain(const TopoDS_Face& F)
if (mySameDomainFM.IsBound( F )) if (mySameDomainFM.IsBound( F ))
return mySameDomainFM (F); return mySameDomainFM (F);
static TopTools_ListOfShape empty; static TopTools_ListOfShape emptyList;
return empty; return emptyList;
} }
//======================================================================= //=======================================================================

File diff suppressed because it is too large Load Diff

View File

@ -94,6 +94,11 @@ is
---Category: private methods ---Category: private methods
MakeSolids (me: in out; Solid : Shape from TopoDS;
Shells: in out ListOfShape from TopTools)
is private;
---Purpose: make solids out of Shells
MakeShells (me: in out; S : Shape from TopoDS; MakeShells (me: in out; S : Shape from TopoDS;
NS: in out ListOfShape from TopTools) is private; NS: in out ListOfShape from TopTools) is private;
---Purpose: split S into shells ---Purpose: split S into shells
@ -131,18 +136,39 @@ is
-- shared by -- shared by
-- <LE> contains edge splits -- <LE> contains edge splits
IsInside (myclass; S1,S2 : Shape from TopoDS)
returns Boolean from Standard is private;
---Purpose: Return True if the first vertex of S1 inside S2.
-- If S1.IsNull(), check infinite point against S2.
GetOriginalShape(me; aShape : Shape from TopoDS)
returns Shape from TopoDS is private;
---Purpose: Return the shape aShape originates from. aShape
-- should be a face or more complex result shape
FindToolsToReconstruct(me: in out) is private;
---Purpose: find and store as objects tools which interfere
-- with solids or are inside solids without
-- an interference
fields fields
myDoneStep : ShapeEnum from TopAbs; -- reconstructed topology myDoneStep : ShapeEnum from TopAbs; -- rebuilt level
myShape : Compound from TopoDS; -- result myShape : Compound from TopoDS; -- result
myBuilder : Builder from BRep; myBuilder : Builder from BRep;
myListShapes : ListOfShape from TopTools; -- object shapes myListShapes : ListOfShape from TopTools; -- object shapes
myMapFaces : MapOfShape from TopTools; -- object faces myMapFaces : MapOfShape from TopTools; -- object faces
myMapTools : MapOfShape from TopTools; -- tool faces myMapTools : MapOfShape from TopTools; -- tool faces
myEqualEdges : MapOfShape from TopTools; -- equal splits
myNewSection : MapOfShape from TopTools; -- new secton edges
myClosedShapes : MapOfShape from TopTools;
myWrappingSolid: MapOfShape from TopTools; -- solids having other shapes inside
myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face
myNewSection : MapOfShape from TopTools; -- new secton edges myInternalFaces: DataMapOfShapeShape from TopTools; -- shape and its internal faces
myIntNotClFaces: DataMapOfShapeShape from TopTools; -- internal but not closed
myAsDes : AsDes from BRepAlgo; myAsDes : AsDes from BRepAlgo;
myImagesFaces : Image from BRepAlgo; myImagesFaces : Image from BRepAlgo;
@ -155,11 +181,4 @@ fields
-- avoid rebuilding twice commont part of solids -- avoid rebuilding twice commont part of solids
myAddedFacesMap: MapOfOrientedShape from TopTools; myAddedFacesMap: MapOfOrientedShape from TopTools;
-- equal splits
myEqualEdges : MapOfShape from TopTools;
-- shape and its internal faces
myInternalFaces: DataMapOfShapeShape from TopTools;
myIntNotClFaces: DataMapOfShapeShape from TopTools;-- internal but not closed
end Spliter; end Spliter;

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,12 @@
// GEOM PARTITION : partition algorithm // GEOM PARTITION : partition algorithm
// //
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // Copyright (C) 2003 CEA/DEN, EDF R&D
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
// //
// //
// //
// File : Partition_Spliter.hxx // File : Partition_Spliter.hxx
// Module : GEOM // Module : GEOM
#ifndef _Partition_Spliter_HeaderFile #ifndef _Partition_Spliter_HeaderFile
#define _Partition_Spliter_HeaderFile #define _Partition_Spliter_HeaderFile
@ -119,12 +101,16 @@ private:
// Methods PRIVATE // Methods PRIVATE
// //
Standard_EXPORT void MakeSolids(const TopoDS_Shape& Solid,TopTools_ListOfShape& Shells) ;
Standard_EXPORT void MakeShells(const TopoDS_Shape& S,TopTools_ListOfShape& NS) ; Standard_EXPORT void MakeShells(const TopoDS_Shape& S,TopTools_ListOfShape& NS) ;
Standard_EXPORT TopoDS_Shape MakeFaces(const TopoDS_Shape& S) ; Standard_EXPORT TopoDS_Shape MakeFaces(const TopoDS_Shape& S) ;
Standard_EXPORT void MakeEdges(const TopoDS_Edge& E,const TopTools_ListOfShape& VOnE,TopTools_ListOfShape& NE) const; Standard_EXPORT void MakeEdges(const TopoDS_Edge& E,const TopTools_ListOfShape& VOnE,TopTools_ListOfShape& NE) const;
Standard_EXPORT TopoDS_Shape FindFacesInside(const TopoDS_Shape& S,const Standard_Boolean CheckClosed = Standard_False,const Standard_Boolean All = Standard_False) ; Standard_EXPORT TopoDS_Shape FindFacesInside(const TopoDS_Shape& S,const Standard_Boolean CheckClosed = Standard_False,const Standard_Boolean All = Standard_False) ;
Standard_EXPORT Standard_Boolean CheckTool(const TopoDS_Shape& S) ; Standard_EXPORT Standard_Boolean CheckTool(const TopoDS_Shape& S) ;
Standard_EXPORT void MergeEqualEdges(const TopTools_ListOfShape& LE) ; Standard_EXPORT void MergeEqualEdges(const TopTools_ListOfShape& LE) ;
Standard_EXPORT static Standard_Boolean IsInside(const TopoDS_Shape& S1,const TopoDS_Shape& S2) ;
Standard_EXPORT TopoDS_Shape GetOriginalShape(const TopoDS_Shape& aShape) const;
Standard_EXPORT void FindToolsToReconstruct() ;
// Fields PRIVATE // Fields PRIVATE
@ -135,17 +121,19 @@ BRep_Builder myBuilder;
TopTools_ListOfShape myListShapes; TopTools_ListOfShape myListShapes;
TopTools_MapOfShape myMapFaces; TopTools_MapOfShape myMapFaces;
TopTools_MapOfShape myMapTools; TopTools_MapOfShape myMapTools;
TopTools_DataMapOfShapeShape myFaceShapeMap; TopTools_MapOfShape myEqualEdges;
TopTools_MapOfShape myNewSection; TopTools_MapOfShape myNewSection;
TopTools_MapOfShape myClosedShapes;
TopTools_MapOfShape myWrappingSolid;
TopTools_DataMapOfShapeShape myFaceShapeMap;
TopTools_DataMapOfShapeShape myInternalFaces;
TopTools_DataMapOfShapeShape myIntNotClFaces;
Handle_BRepAlgo_AsDes myAsDes; Handle_BRepAlgo_AsDes myAsDes;
BRepAlgo_Image myImagesFaces; BRepAlgo_Image myImagesFaces;
BRepAlgo_Image myImagesEdges; BRepAlgo_Image myImagesEdges;
BRepAlgo_Image myImageShape; BRepAlgo_Image myImageShape;
Partition_Inter3d myInter3d; Partition_Inter3d myInter3d;
TopTools_MapOfOrientedShape myAddedFacesMap; TopTools_MapOfOrientedShape myAddedFacesMap;
TopTools_MapOfShape myEqualEdges;
TopTools_DataMapOfShapeShape myInternalFaces;
TopTools_DataMapOfShapeShape myIntNotClFaces;
}; };

View File

@ -46,7 +46,7 @@ EXPORT_HEADERS= GEOM_Sketcher.h \
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS += $(QT_LIBS) $(CAS_LDPATH) -lTKTopAlgo -L${KERNEL_ROOT_DIR}/lib/salome
# additional file to be cleaned # additional file to be cleaned
MOSTLYCLEAN = MOSTLYCLEAN =