Ejemplo n.º 1
0
void ossimImageWriterFactory::getImageFileWritersBySuffix(
   ossimImageWriterFactoryBase::ImageFileWriterList& result, const ossimString& ext)const
{
   ossimString testExt = ext.downcase();
   if(testExt == "tiff" || testExt == "tif")
   {
      result.push_back(new ossimTiffWriter);
   }
   else if(testExt == "ntf" || testExt == "nitf")
   {
      result.push_back(new ossimNitfWriter);
   }
   else if(testExt == "jpg" || testExt == "jpeg")
   {
      result.push_back(new ossimJpegWriter);
   }
   else if(testExt == "ras" || testExt == "bsq" || testExt == "bil" || testExt == "bip")
   {
      result.push_back(new ossimGeneralRasterWriter);
   }
   else if( testExt == "pdf" )
   {
      result.push_back( new ossimPdfWriter );
   }
}
void ossimGdalImageWriterFactory::getImageFileWritersByMimeType(ossimImageWriterFactoryBase::ImageFileWriterList& result,
                                                                const ossimString& mimeType)const
{
   int c = GDALGetDriverCount();
   int idx = 0;
   for(idx = 0; idx < c; ++idx)
   {
      
      GDALDriverH h = GDALGetDriver(idx);
      if(canWrite(h))
      {
         ossimString  driverName = GDALGetDriverShortName(h);
         driverName = "gdal_" + driverName.upcase();
         ossimString metaData(GDALGetMetadataItem(h, GDAL_DMD_MIMETYPE, 0));
         if(!metaData.empty())
         {
            if(metaData == mimeType)
            {
               ossimGdalWriter* writer = new ossimGdalWriter;
               writer->setOutputImageType(driverName);
               result.push_back(writer);
               if ( driverName == "gdal_JP2KAK" )
               {
                  // Make it lossless for starters.  User can still override.
                  ossimKeywordlist kwl;
                  kwl.add("property0.name", "QUALITY");
                  kwl.add("property0.value", "100");
                  writer->loadState(kwl, NULL);
               }
               return;
            }
         }
      }
   }
}
Ejemplo n.º 3
0
void ossimOpjWriterFactory::getImageFileWritersByMimeType(
   ossimImageWriterFactoryBase::ImageFileWriterList& result,
   const ossimString& mimeType)const
{
   if ( (mimeType == "image/jp2") || (mimeType == "image/j2k") )
   {
      result.push_back( new ossimOpjJp2Writer() );
   }
}
Ejemplo n.º 4
0
void ossimOpjWriterFactory::getImageFileWritersBySuffix(
   ossimImageWriterFactoryBase::ImageFileWriterList& result,
   const ossimString& ext) const
{
   ossimString testExt = ext.downcase();
   if ( (testExt == "jp2") || (testExt == "j2k") )
   {
      result.push_back(new ossimOpjJp2Writer);
   }
}
void ossimGdalImageWriterFactory::getImageFileWritersBySuffix(ossimImageWriterFactoryBase::ImageFileWriterList& result,
                                                              const ossimString& ext)const
{
   int c = GDALGetDriverCount();
   int idx = 0;
   for(idx = 0; idx < c; ++idx)
   {
      
      GDALDriverH h = GDALGetDriver(idx);
      if(canWrite(h))
      {
         ossimString  driverName = GDALGetDriverShortName(h);
         driverName = "gdal_" + driverName.upcase();
         ossimString metaData(GDALGetMetadataItem(h, GDAL_DMD_EXTENSION, 0));
         if(!metaData.empty())
         {
            std::vector<ossimString> splitArray;
            metaData.split(splitArray, " /");
            
            ossim_uint32 idxExtension = 0;
            
            for(idxExtension = 0; idxExtension < splitArray.size(); ++idxExtension)
            {
               if(ext == splitArray[idxExtension])
               {
                  ossimGdalWriter* writer = new ossimGdalWriter;
                  writer->setOutputImageType(driverName);
                  result.push_back(writer);
                  if ( driverName == "gdal_JP2KAK" )
                  {
                     // Make it lossless for starters.  User can still override.
                     ossimKeywordlist kwl;
                     kwl.add("property0.name", "QUALITY");
                     kwl.add("property0.value", "100");
                     writer->loadState(kwl, NULL);
                  }
                  return;
               }
            }
         }
      }
   }
}