void ossimBandSelector::checkPassThrough() { thePassThroughFlag = ((theInputConnection == 0)||!outputBandsWithinInputRange()); // check if marked with improper bands if(thePassThroughFlag) return; if(theInputConnection) { std::vector<ossim_uint32> inputList; theInputConnection->getOutputBandList(inputList); if ( inputList.size() == theOutputBandList.size() ) { const std::vector<ossim_uint32>::size_type SIZE = theOutputBandList.size(); std::vector<ossim_uint32>::size_type i = 0; while (i < SIZE) { if ( inputList[i] != theOutputBandList[i] ) { break; } ++i; } if (i == SIZE) { thePassThroughFlag = true; } } } else { if(traceDebug()) { ossimNotify(ossimNotifyLevel_WARN) << "ossimBandSelector::isOrderedCorrectly() ERROR:" << "Method called prior to initialization!\n"; } } }
ossimRefPtr<ossimImageData> ossimBandSelector::getTile( const ossimIrect& tileRect, ossim_uint32 resLevel) { if (!theInputConnection) { return ossimRefPtr<ossimImageData>(); } // Get the tile from the source. ossimRefPtr<ossimImageData> t = theInputConnection->getTile(tileRect, resLevel); if (!theEnableFlag) { return t; // This tile source bypassed, return the input tile source. } if (theOrderedCorrectlyFlag) { return t; // Input band order same as output band order. } if(!theTile.valid()) // First time through, might not be initialized... { allocate(); if (!theTile.valid()) { // Should never happen... return t; // initialize failed. } } theTile->setImageRectangle(tileRect); if(theWithinRangeFlag == ossimBandSelectorWithinRangeFlagState_NOT_SET) { theWithinRangeFlag = ((outputBandsWithinInputRange() == true)?ossimBandSelectorWithinRangeFlagState_IN_RANGE: ossimBandSelectorWithinRangeFlagState_OUT_OF_RANGE); } if(theWithinRangeFlag == ossimBandSelectorWithinRangeFlagState_OUT_OF_RANGE) { theTile->makeBlank(); return theTile; } if ( !t.valid() || (t->getDataObjectStatus() == OSSIM_EMPTY) || (t->getDataObjectStatus() == OSSIM_NULL)) { //--- // Since we're enabled, we must return our tile not "t" so the // correct number of bands goes through the chain. //--- theTile->makeBlank(); return theTile; } // Copy selected bands to our tile. for (ossim_uint32 i=0; i<theOutputBandList.size(); i++) { theTile->assignBand(t.get(), theOutputBandList[i], i); } theTile->validate(); return theTile; }