void onHit(ObjectID id) { FeatureIndex* index = Registry::objectIndex()->get<FeatureIndex>( id ); Feature* feature = index ? index->getFeature( id ) : 0L; if ( feature && feature->getFID() != _lastFID ) { _grid->clearControls(); unsigned r=0; _grid->setControl( 0, r, new LabelControl("FID", Color::Red) ); _grid->setControl( 1, r, new LabelControl(Stringify()<<feature->getFID(), Color::White) ); ++r; const AttributeTable& attrs = feature->getAttrs(); for( AttributeTable::const_iterator i = attrs.begin(); i != attrs.end(); ++i, ++r ) { _grid->setControl( 0, r, new LabelControl(i->first, 14.0f, Color::Yellow) ); _grid->setControl( 1, r, new LabelControl(i->second.getString(), 14.0f, Color::White) ); } if ( !_grid->visible() ) _grid->setVisible( true ); _lastFID = feature->getFID(); } }
void FeatureReadoutCallback::onHit( FeatureSourceIndexNode* index, FeatureID fid, const EventArgs& args ) { clear(); if ( index && index->getFeatureSource() ) { Feature* f = index->getFeatureSource()->getFeature( fid ); if ( f ) { unsigned r=0; const AttributeTable& attrs = f->getAttrs(); for( AttributeTable::const_iterator i = attrs.begin(); i != attrs.end(); ++i, ++r ) { _grid->setControl( 0, r, new LabelControl(i->first, 14.0f, Color::Yellow) ); _grid->setControl( 1, r, new LabelControl(i->second.getString(), 14.0f, Color::White) ); } _grid->setVisible( true ); } } args._aa->requestRedraw(); }