cgma
|
00001 //- Class: RefGroup 00002 //- Description: The RefGroup class contains the reference entity structure 00003 //- for bodies. It contains the standard information such as 00004 //- meshed status, etc. 00005 //- Owner: Ted Blacker 00006 //- Checked by: Greg Sjaardema, 2/28/94 00007 //- Version: $Id: 00008 00009 #ifndef REFGROUP_HPP 00010 #define REFGROUP_HPP 00011 00012 #include "RefCollection.hpp" 00013 #include "CubitObserver.hpp" 00014 00015 class CubitBox; 00016 template <class X> class DLIList; 00017 class RefGroup; 00018 class RefVolume; 00019 class RefFace; 00020 class RefEdge; 00021 class RefVertex; 00022 class RefEntity; 00023 00024 class CUBIT_GEOM_EXPORT RefGroup : public RefCollection, 00025 public CubitObserver 00026 { 00027 00028 public: 00029 00030 friend class RefEntityFactory; 00031 //- the factory is allowed to call the (private) constructors 00032 00033 friend class TDCAGE; 00034 00035 protected: /* Delete using RefGroup::delete_group(..) */ 00036 virtual ~RefGroup(); 00037 //- Class destructor 00038 00039 public: 00040 00041 static const char* get_class_name() 00042 { 00043 return "Group"; 00044 } 00045 00046 virtual const char* class_name() const 00047 { 00048 return get_class_name(); 00049 } 00050 00051 int maximum_dimension(); 00052 //- This routine returns the maximum dimension of its owned subentities. 00053 //- The 'only' kludge is that if one of its subentities is a RefGroup, it 00054 //- must call 'maximum_dimension' on that entity instead of dimension(). 00055 00056 virtual const std::type_info& entity_type_info() const 00057 { return typeid(RefGroup); } 00058 //- return the type for this geometryEntity 00059 00060 DagType dag_type() const 00061 { return DagType::invalid_type(); } 00062 00063 virtual CubitStatus add_ref_entity(RefEntity *ref_entity, bool emit_event = false); 00064 virtual CubitStatus add_ref_entity(DLIList<RefEntity*>& entity_list, bool emit_event = false); 00065 virtual CubitStatus remove_ref_entity(RefEntity *ref_entity, 00066 bool emit_event = false); 00067 virtual CubitStatus remove_ref_entity(DLIList<RefEntity*>& entity_list, 00068 bool emit_event = false); 00069 00070 //- add or remove one or more ref entities to/from this group 00071 00072 virtual void get_sub_entities(DLIList<RefEntity*> &entity_list); 00073 //- appends all ref entities owned by this entity and recurses 00074 //- down to dimension 0 00075 00076 virtual void is_mergeable(AutoMergeStatus val); 00077 bool is_mergeable() { return RefEntity::is_mergeable(); } 00078 00079 int remove_all_ref_entities(); 00080 //- remove all geometry entities in the group. 00081 //- Returns number of items removed. 00082 00083 virtual void get_parent_ref_entities(DLIList<RefEntity*>&); 00084 //- appends all ref entities that own this to entity_list. 00085 //- Goes up just one dimension. 00086 00087 virtual void get_child_ref_entities(DLIList<RefEntity*>& entity_list); 00088 //- appends all immediate ref entities owned by this entity on entity_list 00089 //- Goes down just one dimension. 00090 00091 RefEntity* get_child_ref_entity_by_index(const std::type_info& entity_type, int index); 00092 //- Gets the ref entity of type entity_type at specified index in the list. 00093 00094 int get_num_child_ref_entities_by_type(const std::type_info &entity_type); 00095 //- Gets the number of ref entities of type entity_type in the list. 00096 00097 virtual void get_child_entities(DLIList<CubitEntity*>& cub_entity_list); 00098 //- appends all immediate ref entities owned by this entity on entity_list 00099 //- Goes down just one dimension. 00100 00101 void expand_group( DLIList<RefEntity*>& entity_list ); 00102 //- appends all the ref entities owned by this group. It will go down 00103 //- until there are no ref-groups in the entity_list. 00104 00105 virtual CubitBox bounding_box(); 00106 virtual CubitVector center_point(); 00107 00108 int subtract(RefGroup *group_to_subtract, RefGroup *target_group); 00109 //- subtract group_to_subtract from this group 00110 00111 int intersect(RefGroup *other_group, RefGroup *target_group); 00112 //- intersect other_group with this one 00113 00114 int unite(RefGroup *other_group, RefGroup *target_group); 00115 //- unite other_group with this one 00116 00117 virtual int validate(); 00118 //- Return number of problems detected, 0 if none. 00119 00120 //virtual void draw (int color); 00121 //- draw the group's contained entities 00122 00123 static CubitStatus delete_group (RefGroup *group_ptr, 00124 CubitBoolean propagate = CUBIT_FALSE); 00125 //- deletes a specified group from the global group list 00126 //- if the boolean "propagate" is true, the groups sub_groups are 00127 //- deleted also; as well as the sub_group's groups, etc.. 00128 00129 static void delete_all_groups (); 00130 //- deletes all the groups from the model (except for 'picked_group' and 'drawn_group') 00131 00132 static void get_contained_groups (RefGroup *group_ptr, 00133 DLIList<RefGroup*> &contained_groups); 00134 //- gets the groups owned by group_ptr, as well as any other groups 00135 //- owned by these groups, etc.. Current group (group_ptr) is also 00136 //- added to the list. 00137 00138 static void get_groups_within( CubitEntity* cubit_entity_ptr, 00139 DLIList<RefGroup*> &groups_within, 00140 const CubitBoolean recursive = CUBIT_TRUE); 00141 static void get_groups_within( RefEntity* ref_entity_ptr, 00142 DLIList<RefGroup*> &groups_within, 00143 const CubitBoolean recursive = CUBIT_TRUE); 00144 static void get_groups_within( RefGroup* ref_group_ptr, 00145 DLIList<RefGroup*> &groups_within, 00146 const CubitBoolean recursive = CUBIT_TRUE); 00147 //- Finds those groups which contain the input entity, at any level 00148 //- (i.e., if group 2 contains group 3 which contains the entity, then 00149 //- group 2 and group 3 will be returned in the output list). 00150 00151 void notify_observer(const CubitEvent *observer_event); 00152 //- handle notify observer function 00153 00154 protected: 00155 00156 DLIList<RefEntity*> entityList; 00157 00158 int recursionMark; 00159 00160 RefGroup(int proe_type); 00161 // For Pro/E parts and assemblies (avoids notify). 1=assembly, 2=part 00162 //- Class contructors 00163 00164 RefGroup(const char* name = NULL, int id = 0); 00165 RefGroup (DLIList<RefEntity*>& entity_list); 00166 //- need constructors accessable from derived classes 00167 00168 private: 00169 00170 }; 00171 00172 #endif // REFGROUP_HPP 00173