00001 #include "LayerTriplets.h" 00002 00003 using namespace ctfseeding; 00004 std::vector<LayerTriplets::LayerPairAndLayers> LayerTriplets::layers() const 00005 { 00006 std::vector<LayerPairAndLayers> result; 00007 typedef std::vector<LayerPairAndLayers>::iterator IR; 00008 00009 typedef SeedingLayerSets::const_iterator IL; 00010 for (IL il=theSets.begin(), ilEnd= theSets.end(); il != ilEnd; ++il) { 00011 const SeedingLayers & set = *il; 00012 if (set.size() != 3) continue; 00013 SeedingLayerPair layerPair = std::make_pair(set[0], set[1]); 00014 bool added = false; 00015 for (IR ir = result.begin(); ir < result.end(); ++ir) { 00016 const SeedingLayerPair & resPair = ir->first; 00017 if (resPair.first ==layerPair.first && resPair.second == layerPair.second) { 00018 std::vector<SeedingLayer> & thirds = ir->second; 00019 thirds.push_back( set[2] ); 00020 added = true; 00021 break; 00022 } 00023 } 00024 if (!added) { 00025 LayerPairAndLayers lpl = std::make_pair(layerPair, std::vector<SeedingLayer>(1, set[2]) ); 00026 result.push_back(lpl); 00027 } 00028 } 00029 return result; 00030 }