PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet ) { ItemVector newItems; BOOST_FOREACH( PNS_ITEM * item, m_items ) if( item->GetNet() == aNet ) newItems.push_back( item ); m_items = newItems; return *this; }
PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask ) { ItemVector newItems; BOOST_FOREACH( PNS_ITEM * item, m_items ) if( item->GetKind() & aKindMask ) newItems.push_back( item ); m_items = newItems; return *this; }
TransferFunctionFactory::ItemVector TransferFunctionFactory::createItemVector(unsigned int _size, const float *_rgba, float *_sda) { ItemVector data; for (unsigned int i = 0; i < _size; ++i) { Item item; item.r = _rgba[4 * i]; item.g = _rgba[4 * i + 1]; item.b = _rgba[4 * i + 2]; item.a = _rgba[4 * i + 3]; item.s = _sda[3 * i]; item.d = _sda[3 * i + 1]; item.am = _sda[3 * i + 2]; data.push_back(item); } return data; }
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd ) { ItemVector newItems; PNS_LAYERSET l; if( aEnd < 0 ) l = PNS_LAYERSET( aStart ); else l = PNS_LAYERSET( aStart, aEnd ); BOOST_FOREACH( PNS_ITEM * item, m_items ) if( item->GetLayers().Overlaps( l ) ) newItems.push_back( item ); m_items = newItems; return *this; }
TransferFunctionPair * TransferFunctionFactory::createTransferFunction(tf::Format _format) { Item item; item.r = 1.0f; item.g = 1.0f; item.b = 1.0f; item.s = 0.3f; item.d = 0.5f; item.am = 0.8f; ItemVector data; for (int i = 0; i < 256; ++i) { item.a = static_cast<float>(i) / 256.0f; data.push_back(item); } return createTransferFunction(_format, data); }