Пример #1
0
//	volume callbacks
void ISelector::volume_created(Grid* grid, Volume* vol,
								GridObject* pParent,
								bool replacesParent)
{
	assert((m_pGrid == grid) && "grids do not match.");
	
//TODO: this if could be removed if the subset-handler was only registered for
//		the elements that it supports. Note that a dynamic register/unregister
//		would be required...
	if(elements_are_supported(SE_VOLUME)){
	//	init the element
		mark_deselected(vol);
		if(autoselection_enabled())
			select(vol);
		else if((pParent != NULL) && selection_inheritance_enabled()){
			if(m_bStrictInheritanceEnabled){
				if(pParent->base_object_id() == VOLUME){
					select(vol, get_selection_status(static_cast<Volume*>(pParent)));
				}
			}
			else
				select(vol, get_selection_status(pParent));
		}
		else if(replacesParent){
			UG_ASSERT(pParent, "A parent has to exist if it shall be replaced");
			UG_ASSERT(dynamic_cast<Volume*>(pParent), "Only parents of the same type may be replaced.");
			select(vol, get_selection_status(static_cast<Volume*>(pParent)));
		}
	}
}
Пример #2
0
inline void
MGSelector::clear(int level)
{
    if(m_pGrid) {
        //	mark all elements as deselected
        typename geometry_traits<TElem>::iterator iter;
        for(iter = begin<TElem>(level); iter != end<TElem>(level); ++iter)
            mark_deselected(*iter);

        //	clear the section
        const int sInd = get_section_index<TElem>();
        if(sInd < 0)
            section_container<TElem>(level).clear();
        else
            section_container<TElem>(level).clear_section(sInd);
    }
}