Commit 8271f9e9 authored by hungdangquoc's avatar hungdangquoc
Browse files

[FIX #60] fix and refact pdg update-method

parent e33dd642
......@@ -71,6 +71,7 @@ void WMCsvConverter::setOutputFromCSV( )
continue;
}
addVertex( dataRow );
addColor( dataRow );
addEdepAndSize( dataRow, &maxEdep );
......@@ -157,8 +158,8 @@ bool WMCsvConverter::canShow( WDataSetCSV::Content::iterator dataRow )
if( m_protonData->isColumnAvailable( "PDGEncoding" ) )
{
if( !m_propertyStatus->getFilterPropertyHandler()->isPDGTypeSelected(
std::stoi( dataRow->at( m_protonData->getColumnIndex( "PDGEncoding" ) ) ) ) )
if( !m_propertyStatus->getFilterPropertyHandler()->isPDGTypeSelected(
std::stoi( dataRow->at( m_indexes->getPDGEncoding( ) ) ) ) )
{
return false;
}
......
......@@ -109,6 +109,7 @@ void WMFilterPropertyHandler::createMultiSelectionForPDG()
WPropertyBase::PropertyChangeNotifierType pdgEncodingnotifier = boost::bind(
&WMFilterPropertyHandler::updateSelectedPDGTypes, this );
boost::shared_ptr< WItemSelection > possibleSelection = WItemSelection::SPtr( new WItemSelection() );
m_pdgTypes.clear();
......@@ -132,31 +133,27 @@ void WMFilterPropertyHandler::createMultiSelectionForPDG()
possibleSelection->getSelectorNone(), pdgEncodingnotifier );
}
WItemSelector selectedItems = m_multiSelection->get( true );
for( size_t i = 0; i < selectedItems.size(); ++i )
{
m_selectedPDGTypes.push_back( getPdgFromName( selectedItems.at( i )->getName() ) );
}
WPropertyHelper::PC_NOTEMPTY::addTo( m_multiSelection );
}
void WMFilterPropertyHandler::updateSelectedPDGTypes()
{
m_selectedPDGTypes.clear();
if( m_multiSelection->changed() )
{
WItemSelector selectedItems = m_multiSelection->get( true );
for( size_t i = 0; i < selectedItems.size(); ++i )
{
m_selectedPDGTypes.push_back( getPdgFromName( selectedItems.at( i )->getName() ) );
}
}
m_dataUpdate( );
}
bool WMFilterPropertyHandler::isPDGTypeSelected( int pdgType )
{
for( size_t idx = 0; idx < m_selectedPDGTypes.size(); idx++ )
WItemSelector selectedItems = m_multiSelection->get( true );
for( size_t i = 0; i < selectedItems.size(); ++i )
{
if(pdgType == m_selectedPDGTypes[idx] )
if(getPdgFromName( selectedItems.at( i )->getName()) == pdgType)
{
return true;
}
......@@ -164,7 +161,6 @@ bool WMFilterPropertyHandler::isPDGTypeSelected( int pdgType )
return false;
}
void WMFilterPropertyHandler::updateCheckboxProperty( WPropertyBase::SPtr property )
{
if( m_showPrimaries->get() || m_showSecondaries->get() )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment