cgma
OCCLoop Class Reference

#include <OCCLoop.hpp>

Inheritance diagram for OCCLoop:
LoopSM TopologyBridge

List of all members.

Public Member Functions

 OCCLoop (TopoDS_Wire *theLoop)
void coedges (DLIList< OCCCoEdge * > coedges)
DLIList< OCCCoEdge * > coedges ()
OCCCoEdgeremove_coedge (OCCCoEdge *coedge)
void disconnect_all_curves ()
TopoDS_Wire * get_TopoDS_Wire ()
void set_TopoDS_Wire (TopoDS_Wire loop)
virtual LoopType loop_type ()
virtual ~OCCLoop ()
virtual CubitBox bounding_box () const
virtual GeometryQueryEngineget_geometry_query_engine () const
virtual void append_simple_attribute_virt (const CubitSimpleAttrib &)
virtual void remove_simple_attribute_virt (const CubitSimpleAttrib &)
virtual void remove_all_simple_attribute_virt ()
virtual CubitStatus get_simple_attribute (DLIList< CubitSimpleAttrib > &)
virtual CubitStatus get_simple_attribute (const CubitString &name, DLIList< CubitSimpleAttrib > &)
virtual void get_parents_virt (DLIList< TopologyBridge * > &)
virtual void get_children_virt (DLIList< TopologyBridge * > &)
CubitStatus update_OCC_entity (BRepBuilderAPI_ModifyShape *aBRepTrsf, BRepAlgoAPI_BooleanOperation *op=NULL)

Static Public Member Functions

static CubitStatus update_OCC_entity (TopoDS_Wire &old_loop, LocOpe_SplitShape *sp)

Private Attributes

TopoDS_Wire * myTopoDSWire
DLIList< OCCCoEdge * > myCoEdgeList

Detailed Description

Definition at line 37 of file OCCLoop.hpp.


Constructor & Destructor Documentation

OCCLoop::OCCLoop ( TopoDS_Wire *  theLoop)

Definition at line 55 of file OCCLoop.cpp.

{
  myTopoDSWire = theWire;
}
OCCLoop::~OCCLoop ( ) [virtual]

Definition at line 66 of file OCCLoop.cpp.

{
  disconnect_all_curves();
  if (myTopoDSWire)
  {
    myTopoDSWire->Nullify(); 
    delete (TopoDS_Wire*)myTopoDSWire;
    myTopoDSWire = NULL;
  }
}

Member Function Documentation

Implements TopologyBridge.

Definition at line 139 of file OCCLoop.cpp.

{
}
CubitBox OCCLoop::bounding_box ( void  ) const [virtual]

Definition at line 225 of file OCCLoop.cpp.

{
   CubitBox box;
   for (int i = myCoEdgeList.size(); i > 0; i--)
   {
      DLIList<OCCCoEdge*> coedges = myCoEdgeList;
      OCCCoEdge* coedge = coedges.get_and_step();
      box |= coedge->curve()->bounding_box();
   }
   return box;
}
void OCCLoop::coedges ( DLIList< OCCCoEdge * >  coedges) [inline]

Definition at line 43 of file OCCLoop.hpp.

Definition at line 45 of file OCCLoop.hpp.

{return myCoEdgeList;}

Definition at line 118 of file OCCLoop.cpp.

void OCCLoop::get_children_virt ( DLIList< TopologyBridge * > &  children) [virtual]

Implements TopologyBridge.

Definition at line 214 of file OCCLoop.cpp.

Implements TopologyBridge.

Definition at line 243 of file OCCLoop.cpp.

void OCCLoop::get_parents_virt ( DLIList< TopologyBridge * > &  parents) [virtual]

Implements TopologyBridge.

Definition at line 185 of file OCCLoop.cpp.

{
  OCCQueryEngine* oqe = (OCCQueryEngine*) get_geometry_query_engine();
  OCCSurface * surf = NULL;
  DLIList <OCCSurface* > *surfs = oqe->SurfaceList;
  TopTools_IndexedDataMapOfShapeListOfShape M;
  for(int i = 0; i <  surfs->size(); i++)
  {
     surf = surfs->get_and_step();
     TopExp::MapShapesAndAncestors(*(surf->get_TopoDS_Face()),
                                   TopAbs_WIRE, TopAbs_FACE, M);
     if (!M.Contains(*(get_TopoDS_Wire())))
    continue;

     const TopTools_ListOfShape& ListOfShapes =
                                M.FindFromKey(*(get_TopoDS_Wire()));
     if (!ListOfShapes.IsEmpty())
     {
         TopTools_ListIteratorOfListOfShape it(ListOfShapes) ;
         for (;it.More(); it.Next())
         {
           TopoDS_Face Face = TopoDS::Face(it.Value());
           int k = oqe->OCCMap->Find(Face);
           parents.append_unique((OCCSurface*)(oqe->OccToCGM->find(k))->second);
         }
     }
  }
}

Implements TopologyBridge.

Definition at line 176 of file OCCLoop.cpp.

{
  return CUBIT_FAILURE;
}

Implements TopologyBridge.

Definition at line 181 of file OCCLoop.cpp.

  { return CUBIT_FAILURE; }
TopoDS_Wire* OCCLoop::get_TopoDS_Wire ( ) [inline]

Definition at line 51 of file OCCLoop.hpp.

{return myTopoDSWire;}
virtual LoopType OCCLoop::loop_type ( ) [inline, virtual]

Implements LoopSM.

Definition at line 54 of file OCCLoop.hpp.

{return LOOP_TYPE_UNKNOWN;};

Implements TopologyBridge.

Definition at line 164 of file OCCLoop.cpp.

{
}

Definition at line 123 of file OCCLoop.cpp.

{ 
  if(myCoEdgeList.remove(coedge))
    return coedge;
  return NULL;
}

Implements TopologyBridge.

Definition at line 151 of file OCCLoop.cpp.

{
}
void OCCLoop::set_TopoDS_Wire ( TopoDS_Wire  loop)

Definition at line 77 of file OCCLoop.cpp.

{
   if(myTopoDSWire && loop.IsEqual(*myTopoDSWire))
     return;
   if(myTopoDSWire && !loop.IsSame(*myTopoDSWire))
   {
     DLIList<OCCCoEdge*> coedges = this->coedges();
     for(int i = 0; i < coedges.size(); i++)
     {
       OCCCoEdge* coedge = coedges.get_and_step();
       OCCCurve* curve = CAST_TO(coedge->curve(), OCCCurve);
       TopoDS_Edge *edge = curve->get_TopoDS_Edge( );
       BRepTools_WireExplorer Ex;
       CubitBoolean found = false;
       for (Ex.Init(loop); Ex.More(); Ex.Next())
       {
         TopoDS_Shape crv = Ex.Current();
         if(edge->IsPartner(crv))
         {
           found = true;
           break;
         }
       }
       if (!found)
         curve->remove_loop(this); 
     }
   }
   TopoDS_Wire* the_wire = new TopoDS_Wire(loop);
   if(myTopoDSWire)
     delete (TopoDS_Wire*)myTopoDSWire;
   myTopoDSWire = the_wire;
}
CubitStatus OCCLoop::update_OCC_entity ( BRepBuilderAPI_ModifyShape *  aBRepTrsf,
BRepAlgoAPI_BooleanOperation *  op = NULL 
)

Definition at line 254 of file OCCLoop.cpp.

{
  assert(aBRepTrsf != NULL || op != NULL);

  TopoDS_Shape shape;
  CubitBoolean need_update = CUBIT_TRUE;
  BRepBuilderAPI_Transform* pTrsf = NULL;
  BRepBuilderAPI_GTransform* gTrsf = NULL;
  if(aBRepTrsf)
  {
    pTrsf = (BRepBuilderAPI_Transform*)aBRepTrsf;
    shape = pTrsf->ModifiedShape(*get_TopoDS_Wire());
    if(shape.IsNull())
    {
      gTrsf = (BRepBuilderAPI_GTransform*)aBRepTrsf;
      shape = gTrsf->ModifiedShape(*get_TopoDS_Wire());
    }
  }
  else
  {
    TopTools_ListOfShape shapes; 
    shapes.Assign(op->Modified(*get_TopoDS_Wire()));
    if(shapes.Extent() == 0)
         shapes.Assign(op->Generated(*get_TopoDS_Wire()));
    if(shapes.Extent())
      shape = shapes.First();
    else if (op->IsDeleted(*get_TopoDS_Wire()))
      ;
    else
      need_update = CUBIT_FALSE;
  }

  //set the curves
  for (int i = 1; i <= myCoEdgeList.size(); i++)
  {
     OCCCurve *curve = CAST_TO(myCoEdgeList.get_and_step()->curve(), OCCCurve);
     curve->update_OCC_entity(aBRepTrsf, op);
  }
  TopoDS_Wire loop;
  if (need_update)
  {
    loop = TopoDS::Wire(shape);
    OCCQueryEngine::instance()->update_OCC_map(*myTopoDSWire, loop);
  }
  return CUBIT_SUCCESS;
}
CubitStatus OCCLoop::update_OCC_entity ( TopoDS_Wire &  old_loop,
LocOpe_SplitShape *  sp 
) [static]

Definition at line 307 of file OCCLoop.cpp.

{
  TopTools_ListOfShape shapes;
  shapes.Assign(sp->DescendantShapes(old_loop));
  assert(shapes.Extent() == 1);
  TopoDS_Shape new_loop = shapes.First();
  TopoDS_Shape shape_edge;

  //set curves
  BRepTools_WireExplorer Ex;
  for(Ex.Init(old_loop); Ex.More();Ex.Next())   
  {
    TopoDS_Edge edge = Ex.Current();
    shapes.Assign(sp->DescendantShapes(edge));
    if(shapes.Extent() > 1)
    {
      shape_edge = shapes.First();
     
      OCCQueryEngine::instance()->update_OCC_map(edge, shape_edge);
    } 
  }
  
  OCCQueryEngine::instance()->update_OCC_map(old_loop , new_loop );
  return CUBIT_SUCCESS; 
}

Member Data Documentation

Definition at line 122 of file OCCLoop.hpp.

TopoDS_Wire* OCCLoop::myTopoDSWire [private]

Definition at line 121 of file OCCLoop.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines