model_server/gra/src/graTools.cxx
//------------------------------------------
// gra_find_selection
//
// Convert a location in a window into a selection.
//------------------------------------------
gra_find_selection
Convert a location in a window into a selection.
gra_find_selection Convert a location in a window into a selection .
graParametricSymbol*
gra_find_selection(graWindow* window, int x, int y, viewSelection& view_sel)
{
    Initialize(gra_find_selection);
    view_sel.view_node = view_sel.connector = NULL;
    view_sel.sub_type = 0;
    Picture *picture = (Picture*)window->GetGraphic();
    BoxObj pt(x-TOOLPickAperture, y-TOOLPickAperture,
              x+TOOLPickAperture, y+TOOLPickAperture);
    graParametricSymbol* symbol =
	(graParametricSymbol*)(picture->LastGraphicIntersecting(pt));
    if(symbol) {
	Graphic **sub_symbols = NULL;
	int num_sub_symbols = symbol->GraphicsIntersecting(pt, sub_symbols);
	symbol->find_insertion(
	    window, sub_symbols, num_sub_symbols, &view_sel);
	if (num_sub_symbols > 0)
	    delete [] sub_symbols;	
    }
    if(view_sel.view_node)
	ReturnValue(checked_cast(viewSymbolNode,view_sel.view_node)->get_picture());
    ReturnValue(NULL);
}
graParametricSymbol * gra_find_selection ( graWindow * window , int x , int y , viewSelection & view_sel ) { Initialize ( gra_find_selection ) ; view_sel . view_node = view_sel . connector = NULL ; view_sel . sub_type = 0 ; Picture * picture = ( Picture * ) window -> GetGraphic ( ) ; BoxObj pt ( x - TOOLPickAperture , y - TOOLPickAperture , x + TOOLPickAperture , y + TOOLPickAperture ) ; graParametricSymbol * symbol = ( graParametricSymbol * ) ( picture -> LastGraphicIntersecting ( pt ) ) ; if ( symbol ) { Graphic * * sub_symbols = NULL ; int num_sub_symbols = symbol -> GraphicsIntersecting ( pt , sub_symbols ) ; symbol -> find_insertion ( window , sub_symbols , num_sub_symbols , & view_sel ) ; if ( num_sub_symbols > 0 ) delete [ ] sub_symbols ; } if ( view_sel . view_node ) ReturnValue ( checked_cast ( viewSymbolNode , view_sel . view_node ) -> get_picture ( ) ) ; ReturnValue ( NULL ) ; }
gra_find_selection
Convert a location in a window into a selection.
gra_find_selection Convert a location in a window into a selection .
// Clean up after GraphicsIntersecting.