ossimRefPtr<ossimImageData> ossimShiftFilter::getTile( const ossimIrect& tileRect, ossim_uint32 resLevel) { ossimRefPtr<ossimImageData> result = 0; if ( theInputConnection ) { ossimRefPtr<ossimImageData> inputTile = theInputConnection->getTile( tileRect, resLevel ); if ( inputTile.get() && isSourceEnabled() && !ossim::isnan(m_null) && !ossim::isnan(m_min) && !ossim::isnan(m_max) ) { // Get its status of the input tile. ossimDataObjectStatus tile_status = inputTile->getDataObjectStatus(); if ( tile_status != OSSIM_NULL ) { if ( !m_tile ) { allocate(); // First time through. } if ( tile_status != OSSIM_EMPTY ) { // Set the origin,bands of the output tile. m_tile->setImageRectangle(tileRect); switch(inputTile->getScalarType()) { case OSSIM_UINT8: { fillTile( ossim_uint8(0), inputTile.get(), m_tile.get() ); break; } case OSSIM_SINT8: { fillTile( ossim_sint8(0), inputTile.get(), m_tile.get() ); break; } case OSSIM_UINT16: case OSSIM_USHORT11: { fillTile( ossim_uint16(0), inputTile.get(), m_tile.get() ); break; } case OSSIM_SINT16: { fillTile( ossim_sint16(0), inputTile.get(), m_tile.get() ); break; } case OSSIM_SINT32: { fillTile( ossim_sint32(0), inputTile.get(), m_tile.get() ); break; } case OSSIM_UINT32: { fillTile( ossim_uint32(0), inputTile.get(), m_tile.get() ); break; } case OSSIM_FLOAT32: case OSSIM_NORMALIZED_FLOAT: { fillTile( ossim_float32(0), inputTile.get(), m_tile.get() ); break; } case OSSIM_FLOAT64: case OSSIM_NORMALIZED_DOUBLE: { fillTile( ossim_float64(0), inputTile.get(), m_tile.get() ); break; } case OSSIM_SCALAR_UNKNOWN: default: { ossimNotify(ossimNotifyLevel_WARN) << "ossimShiftFilter::getTile ERROR Unhandled scalar!" << endl; break; } } // Matches: switch(inputTile->getScalarType()) m_tile->validate(); } else { m_tile->makeBlank(); } result = m_tile; } // Matches: if ( tile_status != OSSIM_NULL ) } // Matches: if ( inputTile.get() ... ) if ( !result && inputTile.get() ) { result = inputTile; } } // Matches: if ( theInputConnection ) return result; }
ossimRefPtr<ossimImageData> ossimWatermarkFilter::getTile( const ossimIrect& tile_rect, ossim_uint32 resLevel) { // Lock for the length of this method. // Check for input. if (!theInputConnection) { if (theTile.valid()) { theTile->setImageRectangle(tile_rect); theTile->makeBlank(); } return theTile; } // Fetch a tile from from the input source. ossimRefPtr<ossimImageData> inputTile = theInputConnection->getTile(tile_rect, resLevel); // Check for bypass. if (theEnableFlag == false) return inputTile; // Check for weight being 0.0. if (theWatermarkWeight == 0.0) return inputTile; //--- // Check for dirty state. // Note: This is set in initialize if something changes. //--- if (theDirtyFlag == true) { if (allocate() == false) // Something not right if false. { return inputTile; } } // We will only watermark (process) within the input bounding rectangle. if (tile_rect.intersects(theInputBoundingRect) == false) { return inputTile; } // Capture the rectangle and blank out theTile. theTile->setImageRectangle(tile_rect); if (inputTile.valid() && (inputTile->getDataObjectStatus() != OSSIM_NULL)) { // Copy the inputTile to theTile. theTile->loadTile(inputTile.get()); } else { theTile->makeBlank(); } // Write the watermarks... switch(theTile->getScalarType()) { case OSSIM_UINT8: { fill(ossim_uint8(0)); break; } case OSSIM_SINT8: { fill(ossim_sint8(0)); break; } case OSSIM_USHORT11: case OSSIM_UINT16: { fill(ossim_uint16(0)); break; } case OSSIM_SINT16: { fill(ossim_sint16(0)); break; } case OSSIM_UINT32: { fill(ossim_uint32(0)); break; } case OSSIM_SINT32: { fill(ossim_sint32(0)); break; } case OSSIM_FLOAT32: case OSSIM_NORMALIZED_FLOAT: { fill(ossim_float32(0)); break; } case OSSIM_FLOAT64: case OSSIM_NORMALIZED_DOUBLE: { fill(ossim_float32(0)); break; } case OSSIM_SCALAR_UNKNOWN: default: { ossimNotify(ossimNotifyLevel_WARN) << "Scalar type = " << theTile->getScalarType() << " Not supported by ossimWatermarkFilter" << std::endl; return inputTile; } } return theTile; }