示例#1
0
int LuaPeakList::createBackcalc(lua_State *L)
{
	PeakList* obj = RefBinding<PeakList>::check( L, 1);
	Spectrum* spec = RefBinding<Spectrum>::check( L, 2 );
	if( spec->getDimCount() != obj->getDimCount() )
		luaL_error( L, "the provided spectrum must have the same number of dimensions like the peaklist" );

	bool diff = false;
	if( lua_gettop(L)>2 )
		diff =lua_toboolean( L, 3 );
	bool exact = false;
	if( lua_gettop(L)>3 )
		exact =lua_toboolean( L, 4 );

	Root::Ref<BackCalculation> back = new BackCalculation( spec, 
		new PeakListPeer( obj, spec ) );
	back->setDiff( diff );
	back->setExact( exact );
	LuaSpectrum::push( L, back.deref() );
	return 1;
}
示例#2
0
void SliceScopeAgent::updateSpecPop()
{
	if( d_pro.isNull() )
		return;
	ColorMap a, b;
	( *d_specs.begin() )->getColors( a );
	Spectrum* spec = 0;
	const Project::SpectrumMap& sm = d_pro->getSpectra();
	Project::SpectrumMap::const_iterator p;
	AtomType atom = ( *d_specs.begin() )->getColor( DimX );
	for( p = sm.begin(); p != sm.end(); ++p )
	{
		spec = (*p).second;

		if( spec->getDimCount() == 1 && spec->getColor( DimX ) == atom )
		{
			Gui::Menu::item( d_popSpec, this, spec->getName(), 
				SliceScopeAgent::AddSpec, true )->addParam( Root::Any( spec ) );
		}
	}
}