#include "appview.h" #include "appmodel.h" #include "appselectionset.h" #include "ha_bridge.h" #include "part_api.hxx" #include "HSharedKey.h" #include "body.hxx" #include "face.hxx" #include "edge.hxx" AppView:: AppView(HBaseModel *model, const char * alias , const char * driver_type , const char * instance_name , void * window_handle , void * colormap ):HBaseView(model, alias, driver_type, instance_name, window_handle, colormap){ } AppView::~AppView() { } void AppView::Init() { HBaseView::Init(); m_pSelection = new AppSelectionSet(this); m_pSelection->Init(); } void AppView::DeleteSelectionList( bool emit_message ) { int i, numSolidSelections, numHoopsSelections; char type[4096]; AppSelectionSet* selection = (AppSelectionSet *)GetSelection();; ENTITY* current = 0; numHoopsSelections = selection->GetSize(); numSolidSelections = selection->GetSolidListSize(); if (numHoopsSelections == 0) return; // loop through the list of selected HOOPS primitives, filtering // out the ones associated with solid model entities, and deleting // the non-solid model primitives directly using Delete_By_Key // The primitives associated with solid model entities need to be // deleted using the HOOPS/GM deletion functions so that the HOOPS<->GM // mapping tables will remain in sync for (i = numHoopsSelections; i > 0; i--) { HC_KEY key = selection->GetAt(i-1); // if it's a HOOPS primitive that is not associated with a solid model entity, // deselect and delete it current = HA_Compute_Entity_Pointer(key, BODY_TYPE); if (current == 0) { selection->DeSelect(key, false); HC_Delete_By_Key(key); } } int depth = 0; outcome result; api_part_start_state(depth); { API_BEGIN // loop through the list of selected solid model entities, // delete the HOOPS geometry associated with each // and then delete the entity for (i = numSolidSelections; i > 0; i--) { current = (ENTITY*)selection->GetAtSolidEntity(i-1); if (current) { selection->DeSelectEntity(current); ((AppModel*)GetModel())->DeleteAcisEntity(current); } } API_END } api_part_note_state(result, depth); ((AppModel*)GetModel())->Update(); if( emit_message ) EmitDeleteSelectionListMessage(); // Reset the selection set lists since we've deleted all the entities that // were in them (we can't DeSelect the entities because they no longer exist) selection->Reset(); SetGeometryChanged(); }