cgma
|
#include <HiddenEntitySet.hpp>
Public Member Functions | |
HiddenEntitySet (TBOwner *owner) | |
virtual | ~HiddenEntitySet () |
CubitStatus | hide (TopologyBridge *bridge) |
CubitStatus | restore (TopologyBridge *bridge) |
void | hidden_surfaces (DLIList< Surface * > &) |
void | hidden_coedges (DLIList< CoEdgeSM * > &) |
void | hidden_curves (DLIList< Curve * > &) |
void | hidden_points (DLIList< TBPoint * > &) |
CubitStatus | remove_bridge (TopologyBridge *bridge) |
CubitStatus | swap_bridge (TopologyBridge *old_tb, TopologyBridge *new_tb, bool reversed) |
void | notify_reversed (TopologyBridge *) |
CubitStatus | merge (HiddenEntitySet *other) |
TBOwner * | owner () const |
void | print_debug_info (const char *prefix) const |
bool | is_empty () const |
Private Attributes | |
TBOwner * | myOwner |
std::vector< TopologyBridge * > | hiddenList |
Definition at line 26 of file HiddenEntitySet.hpp.
HiddenEntitySet::HiddenEntitySet | ( | TBOwner * | owner | ) | [inline] |
Definition at line 31 of file HiddenEntitySet.hpp.
: myOwner(owner) {}
HiddenEntitySet::~HiddenEntitySet | ( | ) | [virtual] |
Definition at line 34 of file HiddenEntitySet.cpp.
{ std::vector<TopologyBridge*>::iterator iter; for (iter=hiddenList.begin(); iter!=hiddenList.end(); iter++) (*iter)->owner(0); hiddenList.clear(); }
void HiddenEntitySet::hidden_coedges | ( | DLIList< CoEdgeSM * > & | result | ) |
Definition at line 134 of file HiddenEntitySet.cpp.
{ std::vector<TopologyBridge*>::iterator iter; for (iter=hiddenList.begin(); iter!=hiddenList.end(); iter++) { if (CoEdgeSM* ptr = dynamic_cast<CoEdgeSM*>( *iter )) result.append(ptr); } }
void HiddenEntitySet::hidden_curves | ( | DLIList< Curve * > & | result | ) |
Definition at line 144 of file HiddenEntitySet.cpp.
{ std::vector<TopologyBridge*>::iterator iter; for (iter=hiddenList.begin(); iter!=hiddenList.end(); iter++) { if (Curve* ptr = dynamic_cast<Curve*>( *iter )) result.append(ptr); } }
void HiddenEntitySet::hidden_points | ( | DLIList< TBPoint * > & | result | ) |
Definition at line 154 of file HiddenEntitySet.cpp.
{ std::vector<TopologyBridge*>::iterator iter; for (iter=hiddenList.begin(); iter!=hiddenList.end(); iter++) { if (TBPoint* ptr = dynamic_cast<TBPoint*>( *iter )) result.append(ptr); } }
void HiddenEntitySet::hidden_surfaces | ( | DLIList< Surface * > & | result | ) |
Definition at line 124 of file HiddenEntitySet.cpp.
{ std::vector<TopologyBridge*>::iterator iter; for (iter=hiddenList.begin(); iter!=hiddenList.end(); iter++) { if (Surface* ptr = dynamic_cast<Surface*>( *iter )) result.append(ptr); } }
CubitStatus HiddenEntitySet::hide | ( | TopologyBridge * | bridge | ) |
Definition at line 43 of file HiddenEntitySet.cpp.
{ if( bridge->owner() && !bridge->owner()->remove_bridge(bridge) ) return CUBIT_FAILURE; bridge->owner( this ); // It would be simpler to just add new hidden entities at the back of the list // but this code mimics the previous behavior of inserting new entities // after the first entity in the list. Changing this changes the ids of // geometry entities when a composite is removed. BWH - 11/09/05 // // TODO - BWH - do we want to change the order now to make things simpler or come up // with a way to keep ids after removing composites // // TODO - BWH - the list functions in HiddenEntitySet are almost identical to the list functions in BridgeManager // the main difference is the order that entities are inserted. If we want to make the behavior consistent, maybe a TBList class // could be implemented to use in both places. std::vector<TopologyBridge*>::iterator iter; iter = hiddenList.begin(); if (hiddenList.size() > 0) iter++; hiddenList.insert(iter, bridge); return CUBIT_SUCCESS; }
bool HiddenEntitySet::is_empty | ( | ) | const [inline] |
Definition at line 56 of file HiddenEntitySet.hpp.
{ return hiddenList.empty(); }
CubitStatus HiddenEntitySet::merge | ( | HiddenEntitySet * | other | ) |
Definition at line 106 of file HiddenEntitySet.cpp.
{ std::vector<TopologyBridge*>::iterator iter; std::vector<TopologyBridge*> other_list; // copy the list being merged so we can operate on the real list // without invalidating the iterator other_list = other->hiddenList; for (iter=other_list.begin(); iter!=other_list.end(); iter++ ) { other->restore( *iter ); hide( *iter ); } return CUBIT_SUCCESS; }
void HiddenEntitySet::notify_reversed | ( | TopologyBridge * | ) | [virtual] |
TBOwner* HiddenEntitySet::owner | ( | ) | const [inline] |
Definition at line 51 of file HiddenEntitySet.hpp.
{ return myOwner; }
void HiddenEntitySet::print_debug_info | ( | const char * | prefix | ) | const |
Definition at line 164 of file HiddenEntitySet.cpp.
{ if (!prefix) prefix = ""; PRINT_INFO("%sHiddenEntitySet %p owned by %s %p\n", prefix, (void*)this, myOwner ? fix_type_name(typeid(*myOwner).name()) : "(null)", (void*)myOwner ); char* new_prefix = new char[strlen(prefix)+3]; strcpy( new_prefix, prefix ); strcat( new_prefix, " "); std::vector<TopologyBridge*>::const_iterator iter; for (iter=hiddenList.begin(); iter!=hiddenList.end(); iter++) { if( CompositePoint* cp = dynamic_cast<CompositePoint*>(*iter) ) cp->print_debug_info(new_prefix, true); else if( CompositeCurve* cc = dynamic_cast<CompositeCurve*>(*iter) ) cc->print_debug_info(new_prefix, true); else if( CompositeCoEdge* ce = dynamic_cast<CompositeCoEdge*>(*iter) ) ce->print_debug_info(new_prefix, true); else if( CompositeSurface* cs = dynamic_cast<CompositeSurface*>(*iter) ) cs->print_debug_info(new_prefix, true); else #ifdef TOPOLOGY_BRIDGE_IDS PRINT_INFO("%s%s %d\n", new_prefix, fix_type_name(typeid(*(*iter)).name()), (*iter)->get_id() ); #else PRINT_INFO("%s%s %p\n", new_prefix, fix_type_name(typeid(*(*iter)).name()), (void*)(*iter) ); #endif } delete [] new_prefix; }
CubitStatus HiddenEntitySet::remove_bridge | ( | TopologyBridge * | bridge | ) | [virtual] |
CubitStatus HiddenEntitySet::restore | ( | TopologyBridge * | bridge | ) |
Definition at line 71 of file HiddenEntitySet.cpp.
{ if( bridge->owner() != this ) return CUBIT_FAILURE; std::vector<TopologyBridge*>::iterator iter; iter = std::find(hiddenList.begin(), hiddenList.end(), bridge); if (iter != hiddenList.end()) hiddenList.erase(iter); else return CUBIT_FAILURE; bridge->owner( 0 ); return CUBIT_SUCCESS; }
CubitStatus HiddenEntitySet::swap_bridge | ( | TopologyBridge * | old_tb, |
TopologyBridge * | new_tb, | ||
bool | reversed | ||
) | [virtual] |
Implements TBOwner.
Definition at line 93 of file HiddenEntitySet.cpp.
{ if ( new_tb->owner() || !restore(old_tb) ) { assert(0); return CUBIT_FAILURE; } return hide(new_tb); }
std::vector<TopologyBridge*> HiddenEntitySet::hiddenList [private] |
Definition at line 62 of file HiddenEntitySet.hpp.
TBOwner* HiddenEntitySet::myOwner [private] |
Definition at line 61 of file HiddenEntitySet.hpp.