mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-28 18:30:36 +05:00
Mantis issue 0020859: EDF 1403 GEOM: Partition operation fails on first try.
This commit is contained in:
parent
ac79803473
commit
4a3ad09bac
@ -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>
|
||||||
|
|
||||||
@ -29,12 +28,12 @@
|
|||||||
#include <GEOM_Object.hxx>
|
#include <GEOM_Object.hxx>
|
||||||
#include <GEOM_Function.hxx>
|
#include <GEOM_Function.hxx>
|
||||||
|
|
||||||
//#include <NMTAlgo_Splitter1.hxx>
|
|
||||||
#include <GEOMAlgo_Splitter.hxx>
|
#include <GEOMAlgo_Splitter.hxx>
|
||||||
#include <TopTools_IndexedMapOfShape.hxx>
|
|
||||||
|
|
||||||
#include <TDataStd_IntegerArray.hxx>
|
#include <TDataStd_IntegerArray.hxx>
|
||||||
|
#include <TNaming_CopyShape.hxx>
|
||||||
|
|
||||||
|
//#include <BRepBuilderAPI_Copy.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <BRepAlgo.hxx>
|
#include <BRepAlgo.hxx>
|
||||||
|
|
||||||
@ -46,11 +45,14 @@
|
|||||||
#include <TopoDS_Wire.hxx>
|
#include <TopoDS_Wire.hxx>
|
||||||
#include <TopoDS_Iterator.hxx>
|
#include <TopoDS_Iterator.hxx>
|
||||||
#include <TopTools_MapOfShape.hxx>
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||||
|
|
||||||
#include <ShapeFix_ShapeTolerance.hxx>
|
#include <ShapeFix_ShapeTolerance.hxx>
|
||||||
#include <ShapeFix_Shape.hxx>
|
#include <ShapeFix_Shape.hxx>
|
||||||
|
|
||||||
|
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
|
||||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||||
#include <TColStd_ListOfInteger.hxx>
|
#include <TColStd_ListOfInteger.hxx>
|
||||||
#include <Standard_NullObject.hxx>
|
#include <Standard_NullObject.hxx>
|
||||||
@ -117,6 +119,9 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
//sklNMTAlgo_Splitter1 PS;
|
//sklNMTAlgo_Splitter1 PS;
|
||||||
GEOMAlgo_Splitter PS;
|
GEOMAlgo_Splitter PS;
|
||||||
|
|
||||||
|
TopTools_DataMapOfShapeShape aCopyMap;
|
||||||
|
TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
|
||||||
|
|
||||||
if (aType == PARTITION_PARTITION || aType == PARTITION_NO_SELF_INTERSECTIONS)
|
if (aType == PARTITION_PARTITION || aType == PARTITION_NO_SELF_INTERSECTIONS)
|
||||||
{
|
{
|
||||||
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
||||||
@ -141,8 +146,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_NullObject::Raise("In Partition a shape is null");
|
Standard_NullObject::Raise("In Partition a shape is null");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
//BRepBuilderAPI_Copy aCopyTool (aShape_i);
|
||||||
|
TopoDS_Shape aShape_i_copy;
|
||||||
|
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
|
||||||
|
//if (aCopyTool.IsDone())
|
||||||
|
// aShape_i_copy = aCopyTool.Shape();
|
||||||
|
//else
|
||||||
|
// Standard_NullObject::Raise("Bad shape detected");
|
||||||
|
//
|
||||||
|
// fill aCopyMap for history
|
||||||
|
TopTools_IndexedMapOfShape aShape_i_inds;
|
||||||
|
TopTools_IndexedMapOfShape aShape_i_copy_inds;
|
||||||
|
TopExp::MapShapes(aShape_i, aShape_i_inds);
|
||||||
|
TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
|
||||||
|
Standard_Integer nbInds = aShape_i_inds.Extent();
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||||
|
aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
|
||||||
|
}
|
||||||
|
//
|
||||||
TopTools_ListOfShape aSimpleShapes;
|
TopTools_ListOfShape aSimpleShapes;
|
||||||
PrepareShapes(aShape_i, aType, aSimpleShapes);
|
//PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||||
|
PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
|
||||||
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
||||||
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
||||||
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
||||||
@ -164,8 +188,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_NullObject::Raise("In Partition a tool shape is null");
|
Standard_NullObject::Raise("In Partition a tool shape is null");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
//BRepBuilderAPI_Copy aCopyTool (aShape_i);
|
||||||
|
TopoDS_Shape aShape_i_copy;
|
||||||
|
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
|
||||||
|
//if (aCopyTool.IsDone())
|
||||||
|
// aShape_i_copy = aCopyTool.Shape();
|
||||||
|
//else
|
||||||
|
// Standard_NullObject::Raise("Bad shape detected");
|
||||||
|
//
|
||||||
|
// fill aCopyMap for history
|
||||||
|
TopTools_IndexedMapOfShape aShape_i_inds;
|
||||||
|
TopTools_IndexedMapOfShape aShape_i_copy_inds;
|
||||||
|
TopExp::MapShapes(aShape_i, aShape_i_inds);
|
||||||
|
TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
|
||||||
|
Standard_Integer nbInds = aShape_i_inds.Extent();
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||||
|
aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
|
||||||
|
}
|
||||||
|
//
|
||||||
TopTools_ListOfShape aSimpleShapes;
|
TopTools_ListOfShape aSimpleShapes;
|
||||||
PrepareShapes(aShape_i, aType, aSimpleShapes);
|
//PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||||
|
PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
|
||||||
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
||||||
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
||||||
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
||||||
@ -183,8 +226,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_NullObject::Raise("In Partition a Keep Inside shape is null");
|
Standard_NullObject::Raise("In Partition a Keep Inside shape is null");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
//BRepBuilderAPI_Copy aCopyTool (aShape_i);
|
||||||
|
TopoDS_Shape aShape_i_copy;
|
||||||
|
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
|
||||||
|
//if (aCopyTool.IsDone())
|
||||||
|
// aShape_i_copy = aCopyTool.Shape();
|
||||||
|
//else
|
||||||
|
// Standard_NullObject::Raise("Bad shape detected");
|
||||||
|
//
|
||||||
|
// fill aCopyMap for history
|
||||||
|
TopTools_IndexedMapOfShape aShape_i_inds;
|
||||||
|
TopTools_IndexedMapOfShape aShape_i_copy_inds;
|
||||||
|
TopExp::MapShapes(aShape_i, aShape_i_inds);
|
||||||
|
TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
|
||||||
|
Standard_Integer nbInds = aShape_i_inds.Extent();
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||||
|
aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
|
||||||
|
}
|
||||||
|
//
|
||||||
TopTools_ListOfShape aSimpleShapes;
|
TopTools_ListOfShape aSimpleShapes;
|
||||||
PrepareShapes(aShape_i, aType, aSimpleShapes);
|
//PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||||
|
PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
|
||||||
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
||||||
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
||||||
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
||||||
@ -201,8 +263,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_NullObject::Raise("In Partition a Remove Inside shape is null");
|
Standard_NullObject::Raise("In Partition a Remove Inside shape is null");
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
//BRepBuilderAPI_Copy aCopyTool (aShape_i);
|
||||||
|
TopoDS_Shape aShape_i_copy;
|
||||||
|
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
|
||||||
|
//if (aCopyTool.IsDone())
|
||||||
|
// aShape_i_copy = aCopyTool.Shape();
|
||||||
|
//else
|
||||||
|
// Standard_NullObject::Raise("Bad shape detected");
|
||||||
|
//
|
||||||
|
// fill aCopyMap for history
|
||||||
|
TopTools_IndexedMapOfShape aShape_i_inds;
|
||||||
|
TopTools_IndexedMapOfShape aShape_i_copy_inds;
|
||||||
|
TopExp::MapShapes(aShape_i, aShape_i_inds);
|
||||||
|
TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
|
||||||
|
Standard_Integer nbInds = aShape_i_inds.Extent();
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||||
|
aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
|
||||||
|
}
|
||||||
|
//
|
||||||
TopTools_ListOfShape aSimpleShapes;
|
TopTools_ListOfShape aSimpleShapes;
|
||||||
PrepareShapes(aShape_i, aType, aSimpleShapes);
|
//PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||||
|
PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
|
||||||
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
||||||
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
||||||
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
||||||
@ -212,7 +293,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
PS.SetLimitMode(aCI.GetKeepNonlimitShapes());
|
PS.SetLimitMode(aCI.GetKeepNonlimitShapes());
|
||||||
PS.SetLimit( (TopAbs_ShapeEnum)aCI.GetLimit() );
|
PS.SetLimit((TopAbs_ShapeEnum)aCI.GetLimit());
|
||||||
PS.Perform();
|
PS.Perform();
|
||||||
|
|
||||||
//skl PS.Compute();
|
//skl PS.Compute();
|
||||||
@ -245,11 +326,52 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_NullObject::Raise("In Half Partition a shape or a plane is null");
|
Standard_NullObject::Raise("In Half Partition a shape or a plane is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TopoDS_Shape aShapeArg_copy;
|
||||||
|
TopoDS_Shape aPlaneArg_copy;
|
||||||
|
{
|
||||||
|
TNaming_CopyShape::CopyTool(aShapeArg, aMapTShapes, aShapeArg_copy);
|
||||||
|
//BRepBuilderAPI_Copy aCopyTool (aShapeArg);
|
||||||
|
//if (aCopyTool.IsDone())
|
||||||
|
// aShapeArg_copy = aCopyTool.Shape();
|
||||||
|
//else
|
||||||
|
// Standard_NullObject::Raise("Bad shape detected");
|
||||||
|
//
|
||||||
|
// fill aCopyMap for history
|
||||||
|
TopTools_IndexedMapOfShape aShapeArg_inds;
|
||||||
|
TopTools_IndexedMapOfShape aShapeArg_copy_inds;
|
||||||
|
TopExp::MapShapes(aShapeArg, aShapeArg_inds);
|
||||||
|
TopExp::MapShapes(aShapeArg_copy, aShapeArg_copy_inds);
|
||||||
|
Standard_Integer nbInds = aShapeArg_inds.Extent();
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||||
|
aCopyMap.Bind(aShapeArg_inds.FindKey(ie), aShapeArg_copy_inds.FindKey(ie));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
TNaming_CopyShape::CopyTool(aPlaneArg, aMapTShapes, aPlaneArg_copy);
|
||||||
|
//BRepBuilderAPI_Copy aCopyTool (aPlaneArg);
|
||||||
|
//if (aCopyTool.IsDone())
|
||||||
|
// aPlaneArg_copy = aCopyTool.Shape();
|
||||||
|
//else
|
||||||
|
// Standard_NullObject::Raise("Bad shape detected");
|
||||||
|
//
|
||||||
|
// fill aCopyMap for history
|
||||||
|
TopTools_IndexedMapOfShape aPlaneArg_inds;
|
||||||
|
TopTools_IndexedMapOfShape aPlaneArg_copy_inds;
|
||||||
|
TopExp::MapShapes(aPlaneArg, aPlaneArg_inds);
|
||||||
|
TopExp::MapShapes(aPlaneArg_copy, aPlaneArg_copy_inds);
|
||||||
|
Standard_Integer nbInds = aPlaneArg_inds.Extent();
|
||||||
|
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||||
|
aCopyMap.Bind(aPlaneArg_inds.FindKey(ie), aPlaneArg_copy_inds.FindKey(ie));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// add object shapes that are in ListShapes;
|
// add object shapes that are in ListShapes;
|
||||||
PS.AddShape(aShapeArg);
|
PS.AddShape(aShapeArg_copy);
|
||||||
|
//PS.AddShape(aShapeArg);
|
||||||
|
|
||||||
// add tool shapes that are in ListTools and not in ListShapes;
|
// add tool shapes that are in ListTools and not in ListShapes;
|
||||||
PS.AddTool(aPlaneArg);
|
PS.AddTool(aPlaneArg_copy);
|
||||||
|
//PS.AddTool(aPlaneArg);
|
||||||
|
|
||||||
//skl PS.Compute();
|
//skl PS.Compute();
|
||||||
PS.Perform();
|
PS.Perform();
|
||||||
@ -293,6 +415,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
|
const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
|
||||||
|
|
||||||
// history for all argument shapes
|
// history for all argument shapes
|
||||||
|
// be sure to use aCopyMap
|
||||||
TDF_LabelSequence aLabelSeq;
|
TDF_LabelSequence aLabelSeq;
|
||||||
aFunction->GetDependency(aLabelSeq);
|
aFunction->GetDependency(aLabelSeq);
|
||||||
Standard_Integer nbArg = aLabelSeq.Length();
|
Standard_Integer nbArg = aLabelSeq.Length();
|
||||||
@ -314,6 +437,10 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
|
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
|
||||||
TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
|
TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
|
||||||
|
// be sure to use aCopyMap here
|
||||||
|
if (aCopyMap.IsBound(anEntity))
|
||||||
|
anEntity = aCopyMap.Find(anEntity);
|
||||||
|
//
|
||||||
if (!aMR.Contains(anEntity)) continue;
|
if (!aMR.Contains(anEntity)) continue;
|
||||||
|
|
||||||
const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
|
const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
|
||||||
@ -346,21 +473,17 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_EXPORT Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_()
|
Standard_EXPORT Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_()
|
||||||
{
|
{
|
||||||
|
|
||||||
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
|
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
|
||||||
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
|
if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
|
||||||
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
|
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||||
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
|
if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||||
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
|
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
|
||||||
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
|
if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
|
||||||
|
|
||||||
|
static Handle_Standard_Transient _Ancestors[] = {aType1,aType2,aType3,NULL};
|
||||||
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
|
static Handle_Standard_Type _aType =
|
||||||
static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PartitionDriver",
|
new Standard_Type ("GEOMImpl_PartitionDriver", sizeof(GEOMImpl_PartitionDriver),
|
||||||
sizeof(GEOMImpl_PartitionDriver),
|
1, (Standard_Address)_Ancestors, (Standard_Address)NULL);
|
||||||
1,
|
|
||||||
(Standard_Address)_Ancestors,
|
|
||||||
(Standard_Address)NULL);
|
|
||||||
|
|
||||||
return _aType;
|
return _aType;
|
||||||
}
|
}
|
||||||
@ -379,5 +502,5 @@ const Handle(GEOMImpl_PartitionDriver) Handle(GEOMImpl_PartitionDriver)::DownCas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _anOtherObject ;
|
return _anOtherObject;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user