Back to index

salome-geom  6.5.0
Public Member Functions | Static Public Member Functions | Private Member Functions | Friends
GEOMImpl_HealingDriver Class Reference

#include <GEOMImpl_HealingDriver.hxx>

List of all members.

Public Member Functions

void * operator new (size_t, void *anAddress)
void * operator new (size_t size)
void operator delete (void *anAddress)
Standard_EXPORT GEOMImpl_HealingDriver ()
virtual Standard_EXPORT
Standard_Integer 
Execute (TFunction_Logbook &log) const
virtual Standard_EXPORT void Validate (TFunction_Logbook &) const
Standard_EXPORT Standard_Boolean MustExecute (const TFunction_Logbook &) const
Standard_EXPORT ~GEOMImpl_HealingDriver ()
Standard_EXPORT const Handle (Standard_Type)&DynamicType() const
Standard_EXPORT Standard_Boolean IsKind (const Handle(Standard_Type)&AType) const

Static Public Member Functions

static Standard_EXPORT const
Standard_GUID & 
GetID ()

Private Member Functions

Standard_Boolean ShapeProcess (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const
Standard_Boolean SuppressFaces (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const
Standard_Boolean CloseContour (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const
Standard_Boolean RemoveIntWires (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const
Standard_Boolean RemoveHoles (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const
Standard_Boolean Sew (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const
Standard_Boolean AddPointOnEdge (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const
Standard_Boolean ChangeOrientation (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const
void LimitTolerance (GEOMImpl_IHealing *, const TopoDS_Shape &, TopoDS_Shape &) const

Friends

Standard_EXPORT friend
Handle_Standard_Type & 
GEOMImpl_HealingDriver_Type_ ()

Detailed Description

Definition at line 127 of file GEOMImpl_HealingDriver.hxx.


Constructor & Destructor Documentation

Definition at line 87 of file GEOMImpl_HealingDriver.cxx.

{
}

Definition at line 151 of file GEOMImpl_HealingDriver.hxx.

{};

Member Function Documentation

Standard_Boolean GEOMImpl_HealingDriver::AddPointOnEdge ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 426 of file GEOMImpl_HealingDriver.cxx.

{
  Standard_Boolean isByParameter = theHI->GetIsByParameter();
  Standard_Integer anIndex = theHI->GetIndex();
  Standard_Real aValue = theHI->GetDevideEdgeValue();

  ShHealOper_EdgeDivide aHealer (theOriginalShape);

  Standard_Boolean aResult = Standard_False;
  if (anIndex == -1) { // apply algorythm for the whole shape which is EDGE
    if (theOriginalShape.ShapeType() == TopAbs_EDGE)
      aResult = aHealer.Perform(TopoDS::Edge(theOriginalShape), aValue, isByParameter);
  } else {
    TopTools_IndexedMapOfShape aShapes;
    TopExp::MapShapes(theOriginalShape, aShapes);
    TopoDS_Shape aEdgeShape = aShapes.FindKey(anIndex);
    if (aEdgeShape.ShapeType() == TopAbs_EDGE)
      aResult = aHealer.Perform(TopoDS::Edge(aEdgeShape), aValue, isByParameter);
  }

  if (aResult)
    theOutShape = aHealer.GetResultShape();
  else
    raiseNotDoneExeption( aHealer.GetErrorStatus() );

  return aResult;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMImpl_HealingDriver::ChangeOrientation ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 461 of file GEOMImpl_HealingDriver.cxx.

{
  ShHealOper_ChangeOrientation aHealer (theOriginalShape);

  Standard_Boolean aResult = aHealer.Perform();

  if (aResult)
    theOutShape = aHealer.GetResultShape();
  else
    raiseNotDoneExeption( aHealer.GetErrorStatus() );

  return aResult;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMImpl_HealingDriver::CloseContour ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 293 of file GEOMImpl_HealingDriver.cxx.

{
  Standard_Boolean isByVertex = theHI->GetIsCommonVertex();
  Handle(TColStd_HArray1OfInteger) aWires = theHI->GetWires();

  ShHealOper_CloseContour aHealer (theOriginalShape);

  Standard_Boolean aResult = Standard_False;
  if ( aWires.IsNull() ) {
    if ( theOriginalShape.ShapeType() == TopAbs_WIRE )
      aResult = aHealer.Perform(TopoDS::Wire(theOriginalShape), isByVertex, !isByVertex);
  }
  else {
    TopTools_SequenceOfShape aShapesWires;
    TopTools_IndexedMapOfShape aShapes;
    TopExp::MapShapes(theOriginalShape, aShapes);
    for (int i = 1; i <= aWires->Length(); i++) {
      int indexOfWire = aWires->Value(i);
      TopoDS_Shape aWire = aShapes.FindKey(indexOfWire);
      aShapesWires.Append(aWire);
    }

    aResult = aHealer.Perform( aShapesWires, isByVertex, !isByVertex );
  }

  if (aResult)
    theOutShape = aHealer.GetResultShape();
  else
    raiseNotDoneExeption( aHealer.GetErrorStatus() );

  return aResult;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Integer GEOMImpl_HealingDriver::Execute ( TFunction_Logbook &  log) const [virtual]

Definition at line 95 of file GEOMImpl_HealingDriver.cxx.

{
  if (Label().IsNull()) return 0;
  Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());

  if (aFunction.IsNull()) return 0;

  GEOMImpl_IHealing HI (aFunction);
  Standard_Integer aType = aFunction->GetType();
  Handle(GEOM_Function) anOriginalFunction = HI.GetOriginal();
  if (anOriginalFunction.IsNull()) return 0;
  TopoDS_Shape aShape, anOriginalShape = anOriginalFunction->GetValue();
  if (anOriginalShape.IsNull()) return 0;

  switch (aType)
  {
  case SHAPE_PROCESS:
    ShapeProcess(&HI, anOriginalShape, aShape);
    break;
  case SUPPRESS_FACES:
    SuppressFaces(&HI, anOriginalShape, aShape);
    break;
  case CLOSE_CONTOUR:
    CloseContour(&HI, anOriginalShape, aShape);
    break;
  case REMOVE_INT_WIRES:
    RemoveIntWires(&HI, anOriginalShape, aShape);
    break;
  case FILL_HOLES:
    RemoveHoles(&HI, anOriginalShape, aShape);
    break;
  case SEWING:
    Sew(&HI, anOriginalShape, aShape);
    break;
  case DIVIDE_EDGE:
    AddPointOnEdge(&HI, anOriginalShape, aShape);
    break;
  case CHANGE_ORIENTATION:
    ChangeOrientation(&HI, anOriginalShape, aShape);
    break;
  case LIMIT_TOLERANCE:
    LimitTolerance(&HI, anOriginalShape, aShape);
    break;
  default:
    return 0;
  }

  if (aShape.IsNull())
    raiseNotDoneExeption( ShHealOper_ErrorExecution );

  aFunction->SetValue(aShape);

  log.SetTouched(Label());
  return 1;
}

Here is the call graph for this function:

const Standard_GUID & GEOMImpl_HealingDriver::GetID ( ) [static]

Definition at line 77 of file GEOMImpl_HealingDriver.cxx.

{
  static Standard_GUID aHealingDriver("FF1BBB61-5D14-4df2-980B-3A668264EA16");
  return aHealingDriver;
}

Here is the caller graph for this function:

Standard_EXPORT const GEOMImpl_HealingDriver::Handle ( Standard_Type  ) const [inline]

Definition at line 157 of file GEOMImpl_HealingDriver.hxx.

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_EXPORT Standard_Boolean GEOMImpl_HealingDriver::IsKind ( const Handle(Standard_Type)&  AType) const [inline]

Definition at line 158 of file GEOMImpl_HealingDriver.hxx.

{ return (STANDARD_TYPE(GEOMImpl_HealingDriver) == AType || TFunction_Driver::IsKind(AType)); }

Here is the call graph for this function:

void GEOMImpl_HealingDriver::LimitTolerance ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 481 of file GEOMImpl_HealingDriver.cxx.

{
  Standard_Real aTol = theHI->GetTolerance();
  if (aTol < Precision::Confusion())
    aTol = Precision::Confusion();

  // 1. Make a copy to prevent the original shape changes.
  TopoDS_Shape aShapeCopy;
  TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
  TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy);

  // 2. Limit tolerance.
  ShapeFix_ShapeTolerance aSFT;
  aSFT.LimitTolerance(aShapeCopy, aTol, aTol, TopAbs_SHAPE);

  // 3. Fix obtained shape.
  Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy);
  aSfs->Perform();
  theOutShape = aSfs->Shape();

  BRepCheck_Analyzer ana (theOutShape, Standard_True);
  if (!ana.IsValid())
    StdFail_NotDone::Raise("Non valid shape result");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_EXPORT Standard_Boolean GEOMImpl_HealingDriver::MustExecute ( const TFunction_Logbook &  ) const [inline]

Definition at line 149 of file GEOMImpl_HealingDriver.hxx.

{ return Standard_True; }
void GEOMImpl_HealingDriver::operator delete ( void *  anAddress) [inline]

Definition at line 139 of file GEOMImpl_HealingDriver.hxx.

      {
        if (anAddress) Standard::Free((Standard_Address&)anAddress);
      }
void* GEOMImpl_HealingDriver::operator new ( size_t  ,
void *  anAddress 
) [inline]

Definition at line 131 of file GEOMImpl_HealingDriver.hxx.

      {
        return anAddress;
      }
void* GEOMImpl_HealingDriver::operator new ( size_t  size) [inline]

Definition at line 135 of file GEOMImpl_HealingDriver.hxx.

      {
        return Standard::Allocate(size);
      }
Standard_Boolean GEOMImpl_HealingDriver::RemoveHoles ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 368 of file GEOMImpl_HealingDriver.cxx.

{
  Handle(TColStd_HArray1OfInteger) aWires = theHI->GetWires();

  ShHealOper_FillHoles aHealer (theOriginalShape);

  Standard_Boolean aResult = Standard_False;
  if (aWires.IsNull()) { // remove all faces
    aResult = aHealer.Fill();
  } else {
    TopTools_SequenceOfShape aShapesWires;
    TopTools_IndexedMapOfShape aShapes;
    TopExp::MapShapes(theOriginalShape, aShapes);
    for (int i = 1; i <= aWires->Length(); i++) {
      int indexOfWire = aWires->Value(i);
      TopoDS_Shape aWire = aShapes.FindKey(indexOfWire);
      aShapesWires.Append(aWire);
    }

    aResult = aHealer.Fill(aShapesWires);
  }

  if (aResult)
    theOutShape = aHealer.GetResultShape();
  else
    raiseNotDoneExeption( aHealer.GetErrorStatus() );

  return aResult;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMImpl_HealingDriver::RemoveIntWires ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 332 of file GEOMImpl_HealingDriver.cxx.

{
  Handle(TColStd_HArray1OfInteger) aWires = theHI->GetWires();

  ShHealOper_RemoveInternalWires aHealer(theOriginalShape);

  Standard_Boolean aResult = Standard_False;
  if (aWires.IsNull()) { // remove all faces
    aResult = aHealer.Remove();
  } else {
    TopTools_SequenceOfShape aShapesWires;
    TopTools_IndexedMapOfShape aShapes;
    TopExp::MapShapes(theOriginalShape, aShapes);
    for (int i = 1; i <= aWires->Length(); i++) {
      int indexOfWire = aWires->Value(i);
      TopoDS_Shape aWire = aShapes.FindKey(indexOfWire);
      aShapesWires.Append(aWire);
    }

    aResult = aHealer.Remove(aShapesWires);
  }

  if (aResult)
    theOutShape = aHealer.GetResultShape();
  else
    raiseNotDoneExeption( aHealer.GetErrorStatus() );

  return aResult;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMImpl_HealingDriver::Sew ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 404 of file GEOMImpl_HealingDriver.cxx.

{
  Standard_Real aTol = theHI->GetTolerance();

  ShHealOper_Sewing aHealer (theOriginalShape, aTol);

  Standard_Boolean aResult = aHealer.Perform();

  if (aResult)
    theOutShape = aHealer.GetResultShape();
  else
    raiseNotDoneExeption( aHealer.GetErrorStatus() );

  return aResult;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMImpl_HealingDriver::ShapeProcess ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 155 of file GEOMImpl_HealingDriver.cxx.

{
  Handle(TColStd_HArray1OfExtendedString) anOperators = theHI->GetOperators();
  Handle(TColStd_HArray1OfExtendedString) aParams = theHI->GetParameters();
  Handle(TColStd_HArray1OfExtendedString) aValues = theHI->GetValues();

  if (anOperators.IsNull() || anOperators->Length() <= 0)
    return Standard_False;

  Standard_Integer nbParams = 0, nbValues = 0;
  if (!aParams.IsNull()) {
    nbParams = aParams->Length();
  }
  if (!aValues.IsNull()) {
    nbValues = aValues->Length();
  }
  if (nbParams != nbValues)
    return Standard_False;

  ShHealOper_ShapeProcess aHealer;
  TColStd_SequenceOfAsciiString anOperatorsAS, aParamsAS, aValuesAS;
  int i;
  for (i = 1; i <= anOperators->Length(); i++)
    anOperatorsAS.Append(TCollection_AsciiString(anOperators->Value(i)));

  aHealer.SetOperators(anOperatorsAS);

  for (i = 1; i <= nbParams; i++) {
    aHealer.SetParameter(TCollection_AsciiString(aParams->Value(i)),
                         TCollection_AsciiString(aValues->Value(i)));
  }

  aHealer.Perform(theOriginalShape, theOutShape);

  if (!aHealer.isDone())
    raiseNotDoneExeption( ShHealOper_NotError );

  return Standard_True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Boolean GEOMImpl_HealingDriver::SuppressFaces ( GEOMImpl_IHealing theHI,
const TopoDS_Shape &  theOriginalShape,
TopoDS_Shape &  theOutShape 
) const [private]

Definition at line 252 of file GEOMImpl_HealingDriver.cxx.

{
  Handle(TColStd_HArray1OfInteger) aFaces = theHI->GetFaces();

  Standard_Boolean aResult = Standard_False;

  if (aFaces.IsNull()) {
    ShHealOper_RemoveFace aHealer (theOriginalShape);
    aResult = aHealer.Perform();

    if (aResult)
      theOutShape = aHealer.GetResultShape();
    else
      raiseNotDoneExeption(aHealer.GetErrorStatus());
  }
  else {
    TopTools_SequenceOfShape aShapesFaces;
    TopTools_IndexedMapOfShape aShapes;
    TopExp::MapShapes(theOriginalShape, aShapes);
    for (int i = 1; i <= aFaces->Length(); i++) {
      int indexOfFace = aFaces->Value(i);
      TopoDS_Shape aFace = aShapes.FindKey(indexOfFace);
      aShapesFaces.Append(aFace);
    }
    SuppressFacesRec(aShapesFaces, theOriginalShape, theOutShape);
    if ((theOriginalShape.ShapeType() == TopAbs_COMPOUND ||
         theOriginalShape.ShapeType() == TopAbs_COMPSOLID)) {
      TopoDS_Shape aSh = theOutShape;
      theOutShape = GEOMImpl_GlueDriver::GlueFaces(aSh, Precision::Confusion(), Standard_True);
    }
  }

  return Standard_True;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Standard_EXPORT void GEOMImpl_HealingDriver::Validate ( TFunction_Logbook &  ) const [inline, virtual]

Definition at line 148 of file GEOMImpl_HealingDriver.hxx.

{}

Friends And Related Function Documentation

Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_HealingDriver_Type_ ( ) [friend]

Definition at line 512 of file GEOMImpl_HealingDriver.cxx.

{

  static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
  static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
  static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
  if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);


  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
  static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_HealingDriver",
                                                         sizeof(GEOMImpl_HealingDriver),
                                                         1,
                                                         (Standard_Address)_Ancestors,
                                                         (Standard_Address)NULL);

  return _aType;
}

The documentation for this class was generated from the following files: