Back to index

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

#include <GEOMImpl_PolylineDriver.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_PolylineDriver ()
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_PolylineDriver ()
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 ()

Friends

Standard_EXPORT friend
Handle_Standard_Type & 
GEOMImpl_PolylineDriver_Type_ ()

Detailed Description

Definition at line 125 of file GEOMImpl_PolylineDriver.hxx.


Constructor & Destructor Documentation

Definition at line 59 of file GEOMImpl_PolylineDriver.cxx.

{
}

Definition at line 149 of file GEOMImpl_PolylineDriver.hxx.

{};

Member Function Documentation

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

Definition at line 67 of file GEOMImpl_PolylineDriver.cxx.

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

  GEOMImpl_IPolyline aCI (aFunction);
  Standard_Integer aType = aFunction->GetType();
  
  TopoDS_Shape aShape;

  if (aType == POLYLINE_POINTS) {

    bool useCoords = aCI.GetConstructorType() == COORD_CONSTRUCTOR;
    TColgp_Array1OfPnt points(1, (useCoords ? aCI.GetLength() : 1) );
    if(useCoords) {
      Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates();
      int anArrayLength = aCoordsArray->Length();
      for (int i = 0, j = 1; i <= (anArrayLength-3); i += 3) {
       gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3));
       points.SetValue(j,aPnt);
       j++;
      } 
    }

    int aLen = aCI.GetLength();
    int ind = 1;
    BRepBuilderAPI_MakePolygon aMakePoly;
    for (; ind <= aLen; ind++)
    {
      if(useCoords) {
       aMakePoly.Add(BRepBuilderAPI_MakeVertex(points.Value(ind)));
      } else {
       Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind);
       TopoDS_Shape aShapePnt = aRefPoint->GetValue();
       if (aShapePnt.ShapeType() != TopAbs_VERTEX) {
         Standard_TypeMismatch::Raise
           ("Polyline creation aborted : arguments are not a vertexes");
         return 0;
       }
       if (aShapePnt.ShapeType() == TopAbs_VERTEX) {
         aMakePoly.Add(TopoDS::Vertex(aShapePnt));
         //if (!aMakePoly.Added()) return 0;
       }
      }
    }
    // Compare first and last point coordinates and close polyline if it's the same.
    if ( aLen > 2 ) {
      TopoDS_Vertex aV1;
      if( useCoords ) {
       aV1 = BRepBuilderAPI_MakeVertex(points.Value(1));
      } else {
       Handle(GEOM_Function) aFPoint = aCI.GetPoint(1);
       TopoDS_Shape aFirstPnt = aFPoint->GetValue();
       aV1 = TopoDS::Vertex(aFirstPnt);
      }
      
      TopoDS_Vertex aV2;
      if( useCoords ) {
       aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen));
      } else {
       Handle(GEOM_Function) aLPoint = aCI.GetPoint(aLen);
       TopoDS_Shape aLastPnt = aLPoint->GetValue();
       aV2 = TopoDS::Vertex(aLastPnt);
      }
      
      if ( (!aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2)) ||
           aCI.GetIsClosed())
        aMakePoly.Close();
    }
    
    if (aMakePoly.IsDone()) {
      aShape = aMakePoly.Wire();
    }
  }
  else {
  }

  if (aShape.IsNull()) return 0;
  
  aFunction->SetValue(aShape);
  
  log.SetTouched(Label()); 
  
  return 1;    
}

Here is the call graph for this function:

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

Definition at line 48 of file GEOMImpl_PolylineDriver.cxx.

{
  static Standard_GUID aPolylineDriver("FF1BBB31-5D14-4df2-980B-3A668264EA16");
  return aPolylineDriver; 
}
Standard_EXPORT const GEOMImpl_PolylineDriver::Handle ( Standard_Type  ) const [inline]

Definition at line 155 of file GEOMImpl_PolylineDriver.hxx.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 156 of file GEOMImpl_PolylineDriver.hxx.

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

Here is the call graph for this function:

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

Definition at line 147 of file GEOMImpl_PolylineDriver.hxx.

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

Definition at line 137 of file GEOMImpl_PolylineDriver.hxx.

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

Definition at line 129 of file GEOMImpl_PolylineDriver.hxx.

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

Definition at line 133 of file GEOMImpl_PolylineDriver.hxx.

      { 
        return Standard::Allocate(size); 
      }
virtual Standard_EXPORT void GEOMImpl_PolylineDriver::Validate ( TFunction_Logbook &  ) const [inline, virtual]

Definition at line 146 of file GEOMImpl_PolylineDriver.hxx.

{}

Friends And Related Function Documentation

Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PolylineDriver_Type_ ( ) [friend]

Definition at line 158 of file GEOMImpl_PolylineDriver.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_PolylineDriver",
                                                         sizeof(GEOMImpl_PolylineDriver),
                                                         1,
                                                         (Standard_Address)_Ancestors,
                                                         (Standard_Address)NULL);

  return _aType;
}

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