cgma
CGMHistory Class Reference

#include <CGMHistory.hpp>

List of all members.

Classes

class  Event
class  PortEvent

Public Types

enum  EventType {
  TOP_LEVEL_ENTITY_CREATED, TOP_LEVEL_ENTITY_DELETED, ENTITY_CREATED, ENTITY_DELETED,
  TOPOLOGY_CHANGED, GEOMETRY_CHANGED, GEOMETRY_TRANSFORMED, ENTITY_ID_CHANGED,
  ENTITY_NAME_CHANGED, ENTITY_COLOR_CHANGED, SUBDIVISION, ABSORPTION,
  SUBDIVISION_ABSORPTION, MERGE, COPY, CUT
}

Public Member Functions

 CGMHistory ()
 ~CGMHistory ()
int get_number_of_events () const
const Eventget_event (int index) const
void print_port_events ()
void add_event (const Event &new_event)
void add_port_event (const PortEvent &event)
void compress ()
void clear ()
void start_tracking ()
void end_tracking ()
bool is_tracking () const

Private Attributes

std::vector< EventeventList
std::vector< PortEventportEventList
bool mTracking

Detailed Description

Definition at line 12 of file CGMHistory.hpp.


Member Enumeration Documentation

Enumerator:
TOP_LEVEL_ENTITY_CREATED 
TOP_LEVEL_ENTITY_DELETED 
ENTITY_CREATED 
ENTITY_DELETED 
TOPOLOGY_CHANGED 
GEOMETRY_CHANGED 
GEOMETRY_TRANSFORMED 
ENTITY_ID_CHANGED 
ENTITY_NAME_CHANGED 
ENTITY_COLOR_CHANGED 
SUBDIVISION 
ABSORPTION 
SUBDIVISION_ABSORPTION 
MERGE 
COPY 
CUT 

Definition at line 18 of file CGMHistory.hpp.

    {
      // Top level creation means an entity with no parent is created
      // this could be bodies, surfaces, curves or vertices
      TOP_LEVEL_ENTITY_CREATED,
      
      // Top level deleted means an entity no longer has top level status
      // it may have been deleted or it may have been consumed into a higher
      // dimensional entity
      TOP_LEVEL_ENTITY_DELETED,
      
      // An entity has been created
      ENTITY_CREATED,
      
      // An entity has been deleted
      ENTITY_DELETED,
      
      // An entity's topology changes, meaning it has gained new child entities
      // or lost old child entities.  This can result from solid modeling
      // operations or from operations within cgm such as merging.
      TOPOLOGY_CHANGED, 

      // The geometry of an entity is changed such that it might have been
      // stretched, warped or other such changes where the topology may be the
      // same.  If child entities changed, they'll have their own event.
      GEOMETRY_CHANGED,

      // A transformation happend to this entity, all child entities are
      // transformed as well.  In this case, a GEOMETRY_CHANGED does not occur.
      GEOMETRY_TRANSFORMED,

      // The id of an entity changes
      ENTITY_ID_CHANGED,
      
      // The name of an entity changes
      ENTITY_NAME_CHANGED,
      
      // The name of an entity changes
      ENTITY_COLOR_CHANGED,

      // An entity is subdivided into multiple entities
      // this is a supplemental event such that other events completely
      // describe the topology changes, but this event specifies where the
      // subdivision occurred
      SUBDIVISION,

      // Multiple entities are absorbed into one entity
      // this is a supplemental event such that other events completely
      // describe the topology changes, but this event specifies where the
      // absorption occurred
      ABSORPTION,

      // Multiple entities modified by a combination of subdivision and
      // absorption, and intermediate entities don't exist by the time
      // this history object is given to someone
      // this is a supplemental event such that other events completely
      // describe the topology changes, but this event specifies where the
      // subdivision/absorption occurred
      SUBDIVISION_ABSORPTION,

      // An entity is merged into another
      // this is a supplemental event such that other events completely
      // describe the topology changes, but this event specifies where the
      // merge occurred
      MERGE,

      // An entity is copied from another
      // you may also get this when an unmerge happens in cgm
      // this is a supplemental event such that other events completely
      // describe the topology changes, but this event specifies where the
      // copy occurred
      COPY,
      
      // Cousin to SUBDIVISION.  Think of it as a 1-to-n subdivision where
      // only 1 of the n actually survives, so it's really and 1-to-1
      // modification.
      CUT
    };

Constructor & Destructor Documentation

Definition at line 27 of file CGMHistory.cpp.

{
  mTracking = false;
  //mTracking = true;
}

Definition at line 33 of file CGMHistory.cpp.

{
}

Member Function Documentation

void CGMHistory::add_event ( const Event new_event)

Definition at line 90 of file CGMHistory.cpp.

{
  if(mTracking)
    eventList.push_back(event);
}
void CGMHistory::add_port_event ( const PortEvent event)

Definition at line 96 of file CGMHistory.cpp.

{
  if(mTracking)
    portEventList.push_back(event);
}

Definition at line 107 of file CGMHistory.cpp.

{
  eventList.clear();
  portEventList.clear();
}

Definition at line 102 of file CGMHistory.cpp.

{
  // TODO
}

Definition at line 68 of file CGMHistory.cpp.

{
  mTracking = false;
}
const CGMHistory::Event * CGMHistory::get_event ( int  index) const

Definition at line 83 of file CGMHistory.cpp.

{
  if (index >= 0 && (size_t)index < eventList.size())
    return &eventList[index];
  return NULL;
}

Definition at line 78 of file CGMHistory.cpp.

{
  return eventList.size();
}
bool CGMHistory::is_tracking ( ) const

Definition at line 73 of file CGMHistory.cpp.

{
  return mTracking;
}

Definition at line 113 of file CGMHistory.cpp.

{
  
  std::vector<PortEvent>::iterator iter = portEventList.begin();
  for(; iter != portEventList.end(); iter++ )
  {
    PortEvent port_event = *iter;
    PRINT_INFO("Event type = %s RefEntities ", event_names[ port_event.eventType ]);

    size_t i;
    for ( i = 0; i < port_event.RefEnts.size(); i++ )
    {
      RefEntity *ref_ent = port_event.RefEnts[i];
      PRINT_INFO(" %s %d ", ref_ent->class_name(), ref_ent->id() );
    }
    PRINT_INFO(" ---> ");
    for ( i = 0; i < port_event.TopologyBridges.size(); i++ )
    {
      TopologyBridge *tb = port_event.TopologyBridges[i];
      PRINT_INFO(" %p", (void*)tb );
    }
    PRINT_INFO("\n"); 
  }
}

Definition at line 63 of file CGMHistory.cpp.

{
  mTracking = true;
}

Member Data Documentation

std::vector<Event> CGMHistory::eventList [private]

Definition at line 181 of file CGMHistory.hpp.

bool CGMHistory::mTracking [private]

Definition at line 183 of file CGMHistory.hpp.

std::vector<PortEvent> CGMHistory::portEventList [private]

Definition at line 182 of file CGMHistory.hpp.


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