LCOV - code coverage report
Current view: top level - geom/cgm - CGMHistory.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 2 0.0 %
Date: 2020-06-30 00:58:45 Functions: 0 4 0.0 %
Branches: 0 2 0.0 %

           Branch data     Line data    Source code
       1                 :            : 
       2                 :            : 
       3                 :            : #ifndef CGMHistory_hpp
       4                 :            : #define CGMHistory_hpp
       5                 :            : 
       6                 :            : #include <vector>
       7                 :            : #include "CubitTransformMatrix.hpp"
       8                 :            : #include "CGMGeomConfigure.h"
       9                 :            : class RefEntity;
      10                 :            : class TopologyBridge;
      11                 :            : 
      12                 :            : class CUBIT_GEOM_EXPORT CGMHistory
      13                 :            : {
      14                 :            :   public:
      15                 :            :     CGMHistory();
      16                 :            :     ~CGMHistory();
      17                 :            :             
      18                 :            :     enum EventType
      19                 :            :     {
      20                 :            :       // Top level creation means an entity with no parent is created
      21                 :            :       // this could be bodies, surfaces, curves or vertices
      22                 :            :       TOP_LEVEL_ENTITY_CREATED,
      23                 :            :       
      24                 :            :       // Top level deleted means an entity no longer has top level status
      25                 :            :       // it may have been deleted or it may have been consumed into a higher
      26                 :            :       // dimensional entity
      27                 :            :       TOP_LEVEL_ENTITY_DELETED,
      28                 :            :       
      29                 :            :       // An entity has been created
      30                 :            :       ENTITY_CREATED,
      31                 :            :       
      32                 :            :       // An entity has been deleted
      33                 :            :       ENTITY_DELETED,
      34                 :            :       
      35                 :            :       // An entity's topology changes, meaning it has gained new child entities
      36                 :            :       // or lost old child entities.  This can result from solid modeling
      37                 :            :       // operations or from operations within cgm such as merging.
      38                 :            :       TOPOLOGY_CHANGED, 
      39                 :            : 
      40                 :            :       // The geometry of an entity is changed such that it might have been
      41                 :            :       // stretched, warped or other such changes where the topology may be the
      42                 :            :       // same.  If child entities changed, they'll have their own event.
      43                 :            :       GEOMETRY_CHANGED,
      44                 :            : 
      45                 :            :       // A transformation happend to this entity, all child entities are
      46                 :            :       // transformed as well.  In this case, a GEOMETRY_CHANGED does not occur.
      47                 :            :       GEOMETRY_TRANSFORMED,
      48                 :            : 
      49                 :            :       // The id of an entity changes
      50                 :            :       ENTITY_ID_CHANGED,
      51                 :            :       
      52                 :            :       // The name of an entity changes
      53                 :            :       ENTITY_NAME_CHANGED,
      54                 :            :       
      55                 :            :       // The name of an entity changes
      56                 :            :       ENTITY_COLOR_CHANGED,
      57                 :            : 
      58                 :            :       // An entity is subdivided into multiple entities
      59                 :            :       // this is a supplemental event such that other events completely
      60                 :            :       // describe the topology changes, but this event specifies where the
      61                 :            :       // subdivision occurred
      62                 :            :       SUBDIVISION,
      63                 :            : 
      64                 :            :       // Multiple entities are absorbed into one entity
      65                 :            :       // this is a supplemental event such that other events completely
      66                 :            :       // describe the topology changes, but this event specifies where the
      67                 :            :       // absorption occurred
      68                 :            :       ABSORPTION,
      69                 :            : 
      70                 :            :       // Multiple entities modified by a combination of subdivision and
      71                 :            :       // absorption, and intermediate entities don't exist by the time
      72                 :            :       // this history object is given to someone
      73                 :            :       // this is a supplemental event such that other events completely
      74                 :            :       // describe the topology changes, but this event specifies where the
      75                 :            :       // subdivision/absorption occurred
      76                 :            :       SUBDIVISION_ABSORPTION,
      77                 :            : 
      78                 :            :       // An entity is merged into another
      79                 :            :       // this is a supplemental event such that other events completely
      80                 :            :       // describe the topology changes, but this event specifies where the
      81                 :            :       // merge occurred
      82                 :            :       MERGE,
      83                 :            : 
      84                 :            :       // An entity is copied from another
      85                 :            :       // you may also get this when an unmerge happens in cgm
      86                 :            :       // this is a supplemental event such that other events completely
      87                 :            :       // describe the topology changes, but this event specifies where the
      88                 :            :       // copy occurred
      89                 :            :       COPY,
      90                 :            :       
      91                 :            :       // Cousin to SUBDIVISION.  Think of it as a 1-to-n subdivision where
      92                 :            :       // only 1 of the n actually survives, so it's really and 1-to-1
      93                 :            :       // modification.
      94                 :            :       CUT
      95                 :            :     };
      96                 :            : 
      97                 :            :     //Event is a record of a change that occurred during an operation
      98                 :          0 :     class CUBIT_GEOM_EXPORT Event
      99                 :            :     {
     100                 :            :     public:
     101                 :            :       Event(EventType type, RefEntity* refentity);
     102                 :            :       Event(EventType type, const std::vector<RefEntity*>& refentity_list);
     103                 :            :       ~Event();
     104                 :            : 
     105                 :            :       EventType get_event_type() const;
     106                 :            :       const std::vector<RefEntity*>& get_entities() const;
     107                 :            : 
     108                 :            :     private:
     109                 :            : 
     110                 :            :       // the type of event this is
     111                 :            :       EventType eventType;
     112                 :            :       // the entities this event applies to
     113                 :            :       std::vector<RefEntity*> entities;
     114                 :            : 
     115                 :            :       // extra data associated with event
     116                 :            :       union 
     117                 :            :       {
     118                 :            :         std::vector<RefEntity*> *other_entities;
     119                 :            :         CubitTransformMatrix *matrix;
     120                 :            :         // TODO add data types for other events
     121                 :            :       };
     122                 :            :     };
     123                 :            : 
     124                 :            :     
     125         [ #  # ]:          0 :     class CUBIT_GEOM_EXPORT PortEvent
     126                 :            :     {
     127                 :            :       public:
     128                 :            :         PortEvent(EventType type, std::vector<RefEntity*> &source_entities,
     129                 :            :                               std::vector<TopologyBridge*> &result_entities );
     130                 :            :         PortEvent( EventType type );
     131                 :            :         ~PortEvent();
     132                 :            : 
     133                 :            :         EventType get_event_type() const;
     134                 :            :         const std::vector<RefEntity*>& get_entities() const;
     135                 :            : 
     136                 :            :         EventType eventType;
     137                 :            :         // the entities this event applies to
     138                 :            :         std::vector<RefEntity*> RefEnts; 
     139                 :            :         std::vector<TopologyBridge*> TopologyBridges;
     140                 :            : 
     141                 :            :         // extra data associated with event
     142                 :            :         //union 
     143                 :            :        // {
     144                 :            :         //  std::vector<TopologyBridge*> *TopologyBridges;
     145                 :            :         //  CubitTransformMatrix *matrix;
     146                 :            :           // TODO add data types for other events
     147                 :            :        // };
     148                 :            :     };
     149                 :            : 
     150                 :            : 
     151                 :            : 
     152                 :            :     // get the number of events in this history
     153                 :            :     int get_number_of_events() const;
     154                 :            :     // get an event by index
     155                 :            :     const Event* get_event( int index ) const;
     156                 :            : 
     157                 :            :     void print_port_events(); 
     158                 :            : 
     159                 :            :     // add an event to this history
     160                 :            :     void add_event( const Event &new_event );
     161                 :            :     // compress the events in this history
     162                 :            :     // for example, if an event for volume 1 created and an event for volume 1
     163                 :            :     // deleted exists, both are removed
     164                 :            : 
     165                 :            :     void add_port_event( const PortEvent &event );
     166                 :            : 
     167                 :            :     void compress();
     168                 :            :     
     169                 :            :     // cleans out the history
     170                 :            :     void clear();
     171                 :            : 
     172                 :            :     // start tracking events
     173                 :            :     void start_tracking();
     174                 :            :     // stop tracking events
     175                 :            :     void end_tracking();
     176                 :            :     // ask if tracking
     177                 :            :     bool is_tracking() const;
     178                 :            : 
     179                 :            :   private:
     180                 :            :     // the list of events
     181                 :            :     std::vector<Event> eventList;
     182                 :            :     std::vector<PortEvent> portEventList;
     183                 :            :     bool mTracking;
     184                 :            : };
     185                 :            : 
     186                 :            : #endif
     187                 :            : 

Generated by: LCOV version 1.11