Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

virtual void Impala::Core::ImageSet::Thumbnails::HandleNewFile ( ImageSet is,
int  fileId,
Array::Array2dVec3UInt8 im 
) [inline, virtual]

Arrived at given DB_FILE in a "normal" walk.

Reimplemented from Impala::Core::ImageSet::Listener.

Definition at line 83 of file Thumbnails.h.

References Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CH(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), Impala::FileNameConcat(), Impala::FileNameExt(), Impala::Core::Database::RawDataSet::GetFile(), Impala::Core::ImageSet::ImageSet::GetImageLocator(), ILOG_ERROR, ILOG_INFO, mArchive, mBuf, mBufSize, mFirstImHeight, mFirstImWidth, mImList, Impala::Min(), mRkfMask, mScale, mSplitArchive, mThumbPrefix, mThumbSet, Impala::Core::Geometry::NEAREST, Impala::Core::Array::Scale(), Impala::Core::Array::WriteJpgToMemory(), and Impala::Core::Array::WritePngToMemory().

00084     {
00085         ImType* blackIm = 0;
00086         if (!im)
00087         {
00088             ILOG_ERROR("No image");
00089             if (mFirstImWidth == -1)
00090             {
00091                 ILOG_ERROR("No image size yet, so can't generate black image");
00092                 return;
00093             }
00094             blackIm = Array::MakeFromValue<ImType>
00095                 (Array::Element::Vec3Int32(0, 0, 0), mFirstImWidth,
00096                  mFirstImHeight);
00097             im = blackIm;
00098         }
00099         if (mFirstImWidth == -1)
00100         {
00101             mFirstImWidth = im->CW();
00102             mFirstImHeight = im->CH();
00103             ILOG_INFO("First image has sizes : " << mFirstImWidth << " x "
00104                       << mFirstImHeight);
00105         }
00106         if (mRkfMask)
00107         {
00108             String imFile = is->GetFile(fileId);
00109             if (imFile.find("_NRKF_") != String::npos)
00110                 return;
00111         }
00112 
00113         double scale = mScale;
00114         if (mScale > 1) // assume mScale indicates fixed maximum size
00115         {
00116             double scaleW = mScale / im->CW();
00117             double scaleH = mScale / im->CH();
00118             scale = Impala::Min(scaleW, scaleH);
00119         }
00120 
00121         ImType* sc = 0;
00122         Array::Scale(sc, im, scale, scale, Geometry::NEAREST, true);
00123         if (mArchive || mSplitArchive)
00124         {
00125             String fName = (mThumbSet) ? mThumbSet->GetFile(fileId)
00126                                        : is->GetFile(fileId);
00127             size_t nrBytes = 0;
00128             if (FileNameExt(fName) == "jpg")
00129                 Array::WriteJpgToMemory(sc, mBuf, mBufSize, &nrBytes);
00130             else
00131                 Array::WritePngToMemory(sc, mBuf, mBufSize, &nrBytes);
00132             Array::Array2dScalarUInt8* bufIm =
00133                 Array::MakeFromData<Array::Array2dScalarUInt8>((UInt8*) mBuf,
00134                                                                nrBytes, 1);
00135             mImList.push_back(bufIm);
00136         }
00137         else
00138         {
00139             typedef Persistency::ImageLocator ImageLocator;
00140             if (mThumbSet)
00141             {
00142                 ImageLocator loc = mThumbSet->GetImageLocator(fileId);
00143                 Persistency::ImageRepository().Add(loc, sc);
00144             }
00145             else
00146             {
00147                 String container = is->GetContainerDirOfFile(fileId);
00148                 container = FileNameConcat(mThumbPrefix, container);
00149                 ImageLocator loc = ImageLocator(is->GetLocator(), container,
00150                                                 is->GetFile(fileId));
00151                 Persistency::ImageRepository().Add(loc, sc);
00152             }
00153         }
00154         delete sc;
00155         if (blackIm)
00156             delete blackIm;
00157     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:20:08 2011 for ImpalaSrc by  doxygen 1.5.1