cgma
|
This is a singleton pattern class for the feature functions. More...
#include <GeometryFeatureTool.hpp>
Public Member Functions | |
~GeometryFeatureTool () | |
destructor | |
void | add_gfe (GeometryFeatureEngine *gfe_ptr) |
add a feature engine to the list | |
GeometryFeatureEngine::FeatureType | feature_type (BasicTopologyEntity *bte) |
Returns the feature type that created the entity. | |
CubitStatus | get_related_by_feature (BasicTopologyEntity *bte, DLIList< GeometryEntity * > &return_list) |
Get all of the entities related to 'entity_in' by the same source feature. | |
DLIList < GeometryFeatureEngine::FeatureType > | available_feature_types (BasicTopologyEntity *bte) |
Get the feature types available from this FeatureEngine. | |
Static Public Member Functions | |
static GeometryFeatureTool * | instance (GeometryFeatureEngine *GFEPtr=NULL) |
static void | delete_instance () |
Protected Member Functions | |
GeometryFeatureTool (GeometryFeatureEngine *GFEPtr) | |
constructor | |
Private Member Functions | |
GeometryFeatureEngine * | get_engine (TopologyBridge *tb_ptr) const |
returns the feature engine of an entity | |
GeometryFeatureEngine * | get_engine (TopologyEntity *te_ptr) const |
returns the feature engine of an entity | |
CubitBoolean | same_feature_engine (DLIList< RefEntity * > &ref_entity_list, CubitBoolean check_children) const |
determines if entities belong to the same engine | |
CubitBoolean | same_feature_engine (DLIList< TopologyEntity * > &topo_list) const |
determines if entities belong to the same engine | |
Private Attributes | |
DLIList< GeometryFeatureEngine * > | gfeList |
list of feature engines | |
Static Private Attributes | |
static GeometryFeatureTool * | instance_ = 0 |
singleton pattern class instance interface |
This is a singleton pattern class for the feature functions.
Definition at line 22 of file GeometryFeatureTool.hpp.
destructor
Definition at line 41 of file GeometryFeatureTool.cpp.
GeometryFeatureTool::GeometryFeatureTool | ( | GeometryFeatureEngine * | GFEPtr | ) | [protected] |
constructor
Definition at line 202 of file GeometryFeatureTool.cpp.
{ if (GFEPtr != NULL) add_gfe(GFEPtr); }
void GeometryFeatureTool::add_gfe | ( | GeometryFeatureEngine * | gfe_ptr | ) |
DLIList< GeometryFeatureEngine::FeatureType > GeometryFeatureTool::available_feature_types | ( | BasicTopologyEntity * | bte | ) |
Get the feature types available from this FeatureEngine.
Definition at line 183 of file GeometryFeatureTool.cpp.
{ TopologyEntity* topo_ptr = CAST_TO(bte, TopologyEntity); DLIList<GeometryFeatureEngine::FeatureType> null_list; if (!topo_ptr) return null_list; GeometryFeatureEngine* gfe = get_engine(topo_ptr); if(!gfe) return null_list; return gfe->available_feature_types(bte->get_geometry_entity_ptr()); }
static void GeometryFeatureTool::delete_instance | ( | ) | [inline, static] |
Definition at line 33 of file GeometryFeatureTool.hpp.
Returns the feature type that created the entity.
Definition at line 140 of file GeometryFeatureTool.cpp.
{ // first check to see if the feature information is in the tool data TDSourceFeature *tdss = 0; tdss = (TDSourceFeature *)bte-> get_TD(&TDSourceFeature::is_source_feature); if(tdss) return tdss->source_feature(); // if the feature information is not in the tool data // then call the engine specific FeatureEngine TopologyEntity* topo_ptr = CAST_TO(bte, TopologyEntity); if (!topo_ptr) return GeometryFeatureEngine::FEATURE_UNDEFINED; GeometryFeatureEngine* gfe = get_engine(topo_ptr); if(!gfe) return GeometryFeatureEngine::FEATURE_UNDEFINED; return gfe->feature_type(bte->get_geometry_entity_ptr()); }
GeometryFeatureEngine * GeometryFeatureTool::get_engine | ( | TopologyBridge * | tb_ptr | ) | const [private] |
returns the feature engine of an entity
Definition at line 59 of file GeometryFeatureTool.cpp.
{ GeometryFeatureEngine *gfe; for (int i = 0; i < gfeList.size(); i++) { gfe = gfeList.next(i); if (gfe->is_feature_engine(tb_ptr)) return gfe; } return NULL; }
GeometryFeatureEngine * GeometryFeatureTool::get_engine | ( | TopologyEntity * | te_ptr | ) | const [private] |
returns the feature engine of an entity
Definition at line 73 of file GeometryFeatureTool.cpp.
{ GeometryFeatureEngine *gfe; TopologyBridge *tb_ptr = te_ptr->bridge_manager()->topology_bridge(); for (int i = 0; i < gfeList.size(); i++) { gfe = gfeList.next(i); if (gfe->is_feature_engine(tb_ptr)) return gfe; } return NULL; }
CubitStatus GeometryFeatureTool::get_related_by_feature | ( | BasicTopologyEntity * | bte, |
DLIList< GeometryEntity * > & | return_list | ||
) |
Get all of the entities related to 'entity_in' by the same source feature.
Definition at line 165 of file GeometryFeatureTool.cpp.
{ TopologyEntity* topo_ptr = CAST_TO(bte, TopologyEntity); if (!topo_ptr) return CUBIT_FAILURE; GeometryFeatureEngine* gfe = get_engine(topo_ptr); if(!gfe) return CUBIT_FAILURE; return gfe->get_related_by_feature(bte->get_geometry_entity_ptr(),return_list); }
GeometryFeatureTool * GeometryFeatureTool::instance | ( | GeometryFeatureEngine * | GFEPtr = NULL | ) | [static] |
singleton pattern class instance interface
Definition at line 15 of file GeometryFeatureTool.cpp.
{ // Check to see if we have created an instance of the class; // if not, proceed to create one. if (instance_ == 0) { // When creating the instance, we should always have a valid // gfePtr. If not, complain. instance_ = new GeometryFeatureTool(GFEPtr); // Check to make sure there's a ref entity factory extant: // RefEntityFactory *factory = RefEntityFactory::instance(); } // If there is an existing instance of the class, check if there // is a request to set the default engine. If so, do so. else if ( GFEPtr != NULL && !instance_->gfeList.move_to(GFEPtr) ) { delete instance_->gfeList.remove(); instance_->gfeList.insert(GFEPtr); } // Return the a pointer to the instance of the class. return instance_; }
CubitBoolean GeometryFeatureTool::same_feature_engine | ( | DLIList< RefEntity * > & | ref_entity_list, |
CubitBoolean | check_children | ||
) | const [private] |
determines if entities belong to the same engine
Definition at line 89 of file GeometryFeatureTool.cpp.
{ DLIList<RefEntity*> complete_entity_list; //Check the check_children option and check all the children if necessary if (check_children) { //Make a complete list of all the RefEntities and their children DLIList<RefEntity*> temp = ref_entity_list; RefEntity* ref_entity_ptr; for (int i = 0; i < ref_entity_list.size(); i++) { ref_entity_ptr = ref_entity_list.get_and_step(); complete_entity_list.clean_out(); ref_entity_ptr->get_all_child_ref_entities(complete_entity_list); temp += complete_entity_list; } complete_entity_list.clean_out(); complete_entity_list.merge_unique(temp); } //Now make sure all the RefEntities are from the same geometry engine DLIList<TopologyEntity*> te_list; CAST_LIST(complete_entity_list, te_list, TopologyEntity); return same_feature_engine(te_list); }
CubitBoolean GeometryFeatureTool::same_feature_engine | ( | DLIList< TopologyEntity * > & | topo_list | ) | const [private] |
determines if entities belong to the same engine
Definition at line 119 of file GeometryFeatureTool.cpp.
{ GeometryFeatureEngine *gePtr1 = get_engine(topo_list.get_and_step()); GeometryFeatureEngine *gePtr2; for (int i = 1; i < topo_list.size(); i++) { gePtr2 = get_engine(topo_list.get_and_step()); if (gePtr1 != gePtr2) { return CUBIT_FALSE; } } return CUBIT_TRUE; }
DLIList<GeometryFeatureEngine*> GeometryFeatureTool::gfeList [private] |
list of feature engines
Definition at line 84 of file GeometryFeatureTool.hpp.
GeometryFeatureTool * GeometryFeatureTool::instance_ = 0 [static, private] |
singleton pattern class instance interface
Definition at line 81 of file GeometryFeatureTool.hpp.