[Git][debian-gis-team/ossim][upstream] New upstream version 2.4.0

Bas Couwenberg gitlab at salsa.debian.org
Wed May 30 06:32:08 BST 2018


Bas Couwenberg pushed to branch upstream at Debian GIS Project / ossim


Commits:
95b575bb by Bas Couwenberg at 2018-05-30T06:58:36+02:00
New upstream version 2.4.0
- - - - -


12 changed files:

- cmake/CMakeModules/FindMSP.cmake
- cmake/CMakeModules/FindOpenCV.cmake
- cmake/CMakeModules/FindOpenJPEG.cmake
- + include/ossim/base/ossimFileInfoInterface.h
- include/ossim/base/ossimRefPtr.h
- include/ossim/imaging/ossimBitMaskWriter.h
- include/ossim/imaging/ossimPixelFlipper.h
- src/base/ossimFilename.cpp
- src/base/ossimStreamFactoryRegistry.cpp
- src/imaging/ossimBitMaskWriter.cpp
- src/imaging/ossimPixelFlipper.cpp
- src/util/ossimChipperUtil.cpp


Changes:

=====================================
cmake/CMakeModules/FindMSP.cmake
=====================================
--- a/cmake/CMakeModules/FindMSP.cmake
+++ b/cmake/CMakeModules/FindMSP.cmake
@@ -86,6 +86,7 @@ if (MSP_INCLUDE_DIRS)
 # These are optional. Include only if present:
   FIND_MSP_LIBRARY(MSPsupportdata DUMMY_ARG) 
   FIND_MSP_LIBRARY(MSPHardCopyService DUMMY_ARG)
+  FIND_MSP_LIBRARY(MSPmiisd DUMMY_ARG)
 
   if( LIBS_OK )
     set(MSP_FOUND "YES")


=====================================
cmake/CMakeModules/FindOpenCV.cmake
=====================================
--- a/cmake/CMakeModules/FindOpenCV.cmake
+++ b/cmake/CMakeModules/FindOpenCV.cmake
@@ -32,9 +32,12 @@
 find_path(OPENCV_INCLUDE_DIR opencv/cv.hpp  PATHS ${OPENCV_HOME}/include)
 
 macro(FIND_OPENCV_LIBRARY MYLIBRARY MYLIBRARYNAME)
+    # Force first look in OPENCV_HOME, then use CMAKE paths if not found
    find_library( ${MYLIBRARY}
-        NAMES "${MYLIBRARYNAME}${OPENCV_RELEASE_POSTFIX}"
-   	  PATHS ${OPENCV_HOME}/lib ${OPENCV_HOME}/share/OpenCV/3rdparty/lib )
+         NAMES "${MYLIBRARYNAME}${OPENCV_RELEASE_POSTFIX}"
+         PATHS ${OPENCV_HOME}/lib ${OPENCV_HOME}/share/OpenCV/3rdparty/lib
+         NO_DEFAULT_PATHS)
+   find_library( ${MYLIBRARY} NAMES "${MYLIBRARYNAME}${OPENCV_RELEASE_POSTFIX}")
 endmacro(FIND_OPENCV_LIBRARY MYLIBRARY MYLIBRARYNAME)
 
 # Required


=====================================
cmake/CMakeModules/FindOpenJPEG.cmake
=====================================
--- a/cmake/CMakeModules/FindOpenJPEG.cmake
+++ b/cmake/CMakeModules/FindOpenJPEG.cmake
@@ -23,6 +23,7 @@ FIND_PATH(OPENJPEG_INCLUDE_DIR openjpeg.h
     openjpeg
     openjpeg-1.5
     openjpeg-2.1
+    openjpeg-2.3
   DOC "Location of OpenJPEG Headers"
 )
 FIND_LIBRARY(MINIZIP_LIBRARY NAMES ${MINIZIP_NAMES} )


=====================================
include/ossim/base/ossimFileInfoInterface.h
=====================================
--- /dev/null
+++ b/include/ossim/base/ossimFileInfoInterface.h
@@ -0,0 +1,34 @@
+//---
+// File: ossimFileInfoInterface.h
+// 
+// License: MIT
+//
+// Description: Class ossimFileInfoInterface.
+//
+// Interface class for file info things. Written for stream code from url,
+// e.g. AWS ossim::S3IStream.
+// 
+//---
+// $Id$
+
+#ifndef ossimFileInfoInterface_HEADER
+#define ossimFileInfoInterface_HEADER 1
+
+#include <ossim/base/ossimConstants.h>
+
+/** @class ossimFileInfoInterface */
+class ossimFileInfoInterface
+{
+public:
+
+   /** @brief virtual destructor. */
+   virtual ~ossimFileInfoInterface(){}
+
+   /**
+    * @brief Pure virtual file size method. Derived classed must implement.
+    * @return File size in bytes.
+    */
+   virtual ossim_int64 getFileSize() const = 0;
+};
+
+#endif /* #ifndef ossimFileInfoInterface_HEADER */


=====================================
include/ossim/base/ossimRefPtr.h
=====================================
--- a/include/ossim/base/ossimRefPtr.h
+++ b/include/ossim/base/ossimRefPtr.h
@@ -8,6 +8,7 @@
 #define ossimRefPtr_HEADER
 #include <ossim/base/ossimConstants.h>
 #include <stddef.h>
+#include <cstddef>
 
 template<class T> class ossimRefPtr
 {
@@ -100,20 +101,20 @@ template<typename _Tp1, typename _Tp2> inline bool
   operator==(const ossimRefPtr<_Tp1>& __a, const ossimRefPtr<_Tp2>& __b) noexcept
   { return __a.get() == __b.get(); }
 
-template<typename _Tp> inline bool operator==(const ossimRefPtr<_Tp>& __a, nullptr_t) noexcept
+template<typename _Tp> inline bool operator==(const ossimRefPtr<_Tp>& __a, std::nullptr_t) noexcept
   { return !__a; }
 
-template<typename _Tp> inline bool operator==(nullptr_t, const ossimRefPtr<_Tp>& __a) noexcept
+template<typename _Tp> inline bool operator==(std::nullptr_t, const ossimRefPtr<_Tp>& __a) noexcept
   { return !__a; }
 
 template<typename _Tp1, typename _Tp2>  inline bool
   operator!=(const ossimRefPtr<_Tp1>& __a, const ossimRefPtr<_Tp2>& __b) noexcept
   { return __a.get() != __b.get(); }
 
-template<typename _Tp> inline bool operator!=(const ossimRefPtr<_Tp>& __a, nullptr_t) noexcept
+template<typename _Tp> inline bool operator!=(const ossimRefPtr<_Tp>& __a, std::nullptr_t) noexcept
   { return (bool)__a; }
 
-template<typename _Tp> inline bool operator!=(nullptr_t, const ossimRefPtr<_Tp>& __a) noexcept
+template<typename _Tp> inline bool operator!=(std::nullptr_t, const ossimRefPtr<_Tp>& __a) noexcept
   { return (bool)__a; }
 
 


=====================================
include/ossim/imaging/ossimBitMaskWriter.h
=====================================
--- a/include/ossim/imaging/ossimBitMaskWriter.h
+++ b/include/ossim/imaging/ossimBitMaskWriter.h
@@ -16,6 +16,7 @@
 #include <ossim/base/ossimIpt.h>
 #include <ossim/base/ossimOutputSource.h>
 #include <ossim/imaging/ossimPixelFlipper.h>
+#include <ossim/imaging/ossimMemoryImageSource.h>
 #include <vector>
 
 class ossimFilename;
@@ -123,7 +124,8 @@ protected:
    ossimIpt computeImageSize(ossim_uint32 rlevel, ossimImageData* tile) const;
 
    ossimRefPtr<ossimPixelFlipper>  m_flipper;
-   vector<ossim_uint8*>            m_buffers;
+   ossimRefPtr<ossimMemoryImageSource> m_memoryImage;
+   vector<ossim_uint8 *> m_buffers;
    vector<ossimIpt>                m_bufferSizes;
    ossim_uint32                    m_startingResLevel;
    ossimIpt                        m_imageSize; //!< Size of full res source image


=====================================
include/ossim/imaging/ossimPixelFlipper.h
=====================================
--- a/include/ossim/imaging/ossimPixelFlipper.h
+++ b/include/ossim/imaging/ossimPixelFlipper.h
@@ -206,15 +206,18 @@ public:
    virtual void setProperty(ossimRefPtr<ossimProperty> property);
    virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
    
-   //! This object can be used outside of an image chain for offline processing of existing tile.
-   template <class T> void flipPixels(T dummy, ossimImageData* inpuTile, ossim_uint32 resLevel);
 
 protected:
    /** destructor */
    virtual ~ossimPixelFlipper();
-   template <class T> void clipTile(T dummy,
-                                    ossimImageData* inpuTile,
-                                    ossim_uint32 resLevel);
+   //! This object can be used outside of an image chain for offline processing of existing tile.
+   template <class T>
+   void flipPixels(T dummy, ossimImageData *inpuTile, ossim_uint32 resLevel);
+
+   template <class T>
+   void clipTile(T dummy,
+                 ossimImageData *inpuTile,
+                 ossim_uint32 resLevel);
 
    /**
     * Verifies pixel is in range.


=====================================
src/base/ossimFilename.cpp
=====================================
--- a/src/base/ossimFilename.cpp
+++ b/src/base/ossimFilename.cpp
@@ -10,6 +10,7 @@
 #include <ossim/ossimConfig.h>  /* to pick up platform defines */
 
 #include <ossim/base/ossimFilename.h>
+#include <ossim/base/ossimFileInfoInterface.h>
 #include <ossim/base/ossimCommon.h>
 #include <ossim/base/ossimConstants.h>
 #include <ossim/base/ossimDirectory.h>
@@ -1041,31 +1042,45 @@ ossimFilename ossimFilename::dirCat(const ossimFilename& file) const
 
 ossim_int64 ossimFilename::fileSize() const
 {
-   struct stat sbuf;
+   ossim_int64 size = 0;
 
-#ifndef __BORLANDC__
-   if (stat(c_str(), &sbuf) == 0)
+   if ( isUrl() == false )
    {
-      return (ossim_int64)sbuf.st_size;
+      struct stat sbuf;
+      if ( stat( this->c_str(), &sbuf ) == 0 )
+      {
+         size = (ossim_int64)sbuf.st_size;
+      }
+      else
+      {
+         ifstream in(c_str());
+         if(in)
+         {
+            in.seekg(0, std::ios_base::end);
+            size = (ossim_int64)in.tellg();
+         }
+      }
    }
    else
    {
-      ifstream in(c_str());
-      if(in)
+      std::shared_ptr<ossim::istream> in = ossim::StreamFactoryRegistry::instance()->
+         createIstream( this->string() );
+      if ( in )
       {
-         in.seekg(SEEK_END);
-         return (ossim_int64)in.tellg();
+         ossimFileInfoInterface* intf = dynamic_cast<ossimFileInfoInterface*>( in.get() );
+         if ( intf )
+         {
+            size = intf->getFileSize();
+         }
+         else
+         {
+            in->seekg(0, std::ios_base::end);
+            size = (ossim_int64)in->tellg();
+         }
       }
    }
-#else
-   ifstream in(c_str());
-   if(in)
-   {
-      in.seekg(SEEK_END);
-      return (ossim_int64)in.tellg();
-   }
-#endif
-   return 0;
+
+   return size;
 }
 
 bool ossimFilename::createDirectory( bool recurseFlag,


=====================================
src/base/ossimStreamFactoryRegistry.cpp
=====================================
--- a/src/base/ossimStreamFactoryRegistry.cpp
+++ b/src/base/ossimStreamFactoryRegistry.cpp
@@ -20,7 +20,7 @@
 
 
 ossim::StreamFactoryRegistry* ossim::StreamFactoryRegistry::m_instance = 0;
-static const ossimString ISTREAM_BUFFER_KW = "ossim.stream.factory.registry.istream.buffer";
+static const char* ISTREAM_BUFFER_KW = "ossim.stream.factory.registry.istream.buffer";
 static ossimTrace traceDebug("ossimStreamFactoryRegistry:debug");
 static std::mutex m_instanceMutex;
 ossim::StreamFactoryRegistry::StreamFactoryRegistry()


=====================================
src/imaging/ossimBitMaskWriter.cpp
=====================================
--- a/src/imaging/ossimBitMaskWriter.cpp
+++ b/src/imaging/ossimBitMaskWriter.cpp
@@ -8,7 +8,7 @@
 //
 // Description: Contains implementation of class for computing a mask from an input image.
 //   The mask is stored in a compressed format where one byte represents 8 bit-masks for masking
-//   8 image pixels. 
+//   8 image pixels.
 //*************************************************************************************************
 //  $Id: ossimBitMaskWriter.cpp 3081 2011-12-22 16:34:12Z oscar.kramer $
 
@@ -20,16 +20,16 @@
 #include <ossim/imaging/ossimImageData.h>
 #include <ossim/imaging/ossimImageHandler.h>
 
-const char* ossimBitMaskWriter::MASK_FILE_MAGIC_NUMBER = "OSSIM_BIT_MASK";
-const char* ossimBitMaskWriter::BM_STARTING_RLEVEL_KW = "starting_rlevel";
+const char *ossimBitMaskWriter::MASK_FILE_MAGIC_NUMBER = "OSSIM_BIT_MASK";
+const char *ossimBitMaskWriter::BM_STARTING_RLEVEL_KW = "starting_rlevel";
 
 //*************************************************************************************************
 // Constructor accepts handler to the source imagery being used to compute the mask.
 //*************************************************************************************************
 ossimBitMaskWriter::ossimBitMaskWriter()
-   :
-   m_flipper(0),
-   m_startingResLevel(0)
+    : m_flipper(0),
+    m_memoryImage(0),
+      m_startingResLevel(0)
 {
 }
 
@@ -58,7 +58,7 @@ bool ossimBitMaskWriter::open()
 {
    // Nothing to do yet. Eventually want to open the output stream here and write the buffer after
    // each R-level is completed, so we don't need to keep vector of buffers in memory.
-   return true; 
+   return true;
 }
 
 //*************************************************************************************************
@@ -67,10 +67,10 @@ bool ossimBitMaskWriter::open()
 void ossimBitMaskWriter::reset()
 {
    // Wipe the mask buffers:
-   vector<ossim_uint8*>::iterator iter = m_buffers.begin();
+   vector<ossim_uint8 *>::iterator iter = m_buffers.begin();
    while (iter != m_buffers.end())
    {
-      delete [] (*iter);
+      delete[](*iter);
       iter++;
    }
    m_buffers.clear();
@@ -116,49 +116,14 @@ void ossimBitMaskWriter::generateMask(ossimRefPtr<ossimImageData> tile, ossim_ui
    if (!m_flipper.valid())
       initializeFlipper();
 
-   // The flipper is used to identify null pixels since it has more sophisticated filtering 
-   // than available from the tile object:
-   switch (tile->getScalarType())
-   {
-   case OSSIM_UCHAR:
-      m_flipper->flipPixels(ossim_uint8(0), tile.get(), rLevel);
-      break;
-   case OSSIM_UINT16:
-   case OSSIM_USHORT11:
-   case OSSIM_USHORT12:
-   case OSSIM_USHORT13:
-   case OSSIM_USHORT14:
-   case OSSIM_USHORT15:
-      m_flipper->flipPixels(ossim_uint16(0), tile.get(), rLevel);
-      break;
-   case OSSIM_SSHORT16:
-      m_flipper->flipPixels(ossim_sint16(0), tile.get(), rLevel);
-      break;
-   case OSSIM_UINT32:
-      m_flipper->flipPixels(ossim_uint32(0), tile.get(), rLevel);
-      break;
-   case OSSIM_SINT32:
-      m_flipper->flipPixels(ossim_sint32(0), tile.get(), rLevel);
-      break;
-   case OSSIM_FLOAT32:
-   case OSSIM_NORMALIZED_FLOAT:
-      m_flipper->flipPixels(float(0), tile.get(), rLevel);
-      break;
-   case OSSIM_NORMALIZED_DOUBLE:
-   case OSSIM_FLOAT64:
-      m_flipper->flipPixels(ossim_float64(0), tile.get(), rLevel);
-      break;
-   case OSSIM_SCALAR_UNKNOWN:
-   default:
-      ossimNotify(ossimNotifyLevel_WARN) << "ossimBitMaskWriter::generateMask()-- "
-         "Unsupported scalar type!" << endl;
-      break;
-   }
-
-   ossimIpt image_size = computeImageSize(rLevel, tile.get());
-   ossim_uint32 num_mask_cols = (image_size.x+7)/8; // size of mask buffer after compression
+   ossimRefPtr<ossimImageData> flipTile;
+   m_memoryImage->setImage(tile);
+   m_flipper->initialize();
+   flipTile = m_flipper->getTile(tile->getImageRectangle());
+   ossimIpt image_size = computeImageSize(rLevel, flipTile.get());
+   ossim_uint32 num_mask_cols = (image_size.x + 7) / 8; // size of mask buffer after compression
    ossim_uint32 num_mask_rows = image_size.y;
-   ossim_uint8* maskbuf = 0;
+   ossim_uint8 *maskbuf = 0;
 
    // Check if mask buffer for this R-level has already been allocated:
    if (m_buffers.size() <= mask_rlevel)
@@ -172,32 +137,31 @@ void ossimBitMaskWriter::generateMask(ossimRefPtr<ossimImageData> tile, ossim_ui
    else
       maskbuf = m_buffers[mask_rlevel];
 
-   ossim_uint32 mask_index=0, tile_index=0, start_bit=0;
-   ossimIrect tile_rect (tile->getImageRectangle());
-   ossimIpt ul (tile_rect.ul());
-   ossimIpt lr (tile_rect.lr());
+   ossim_uint32 mask_index = 0, tile_index = 0, start_bit = 0;
+   ossimIrect tile_rect(flipTile->getImageRectangle());
+   ossimIpt ul(tile_rect.ul());
+   ossimIpt lr(tile_rect.lr());
 
    // Scan each pixel in the source tile and decide on mask value:
-   for (int y=ul.y; (y<=lr.y)&&(y<image_size.y); y++)
+   for (int y = ul.y; (y <= lr.y) && (y < image_size.y); y++)
    {
-      mask_index = y*num_mask_cols + ul.x/8;
+      mask_index = y * num_mask_cols + ul.x / 8;
       start_bit = ul.x % 8; // may not start on even mask byte boundary
 
-      for (int x=ul.x; (x<=lr.x); /* incremented in bit loop below */ )         
+      for (int x = ul.x; (x <= lr.x); /* incremented in bit loop below */)
       {
-         if ( x < image_size.x )
+         if (x < image_size.x)
          {
             // Process 8 samples and pack resultant mask into one byte:
             maskbuf[mask_index] = 0;
-            for (ossim_uint32 mask_bit=start_bit; mask_bit<8; ++mask_bit)
+            for (ossim_uint32 mask_bit = start_bit; mask_bit < 8; ++mask_bit)
             {
-               // Decide whether to mask depending on pixel flipper outputting a NULL pixel. 
-               // if (tile->isNull(tile_index++))
-               if (tile->isNull(tile_index++))                  
-                  maskbuf[mask_index] &=  MASK_BITS_0[mask_bit];
+               // Decide whether to mask depending on pixel flipper outputting a NULL pixel.
+               if (flipTile->isNull(tile_index++))
+                  maskbuf[mask_index] &= MASK_BITS_0[mask_bit];
                else
                   maskbuf[mask_index] |= MASK_BITS_1[mask_bit];
-               
+
                // Advance the pixel column and check for end of image rect:
                ++x;
                if ((x >= image_size.x) || (x > lr.x))
@@ -209,7 +173,7 @@ void ossimBitMaskWriter::generateMask(ossimRefPtr<ossimImageData> tile, ossim_ui
          else
          {
             ++x;
-            
+
             ++tile_index;
          }
       }
@@ -223,37 +187,38 @@ void ossimBitMaskWriter::generateMask(ossimRefPtr<ossimImageData> tile, ossim_ui
 //*************************************************************************************************
 void ossimBitMaskWriter::close()
 {
-   static const char* MODULE = "ossimBitMaskWriter::writeMask()";
-   static const ossimString MASK_EXTENSION ("mask");
+   static const char *MODULE = "ossimBitMaskWriter::writeMask()";
+   static const ossimString MASK_EXTENSION("mask");
 
    // Open the output file. Use default name if none provided.
    if (theOutputName.empty()) // Couldn't figure out the name
    {
-      ossimNotify(ossimNotifyLevel_WARN)<<MODULE<<" -- Error encountered trying to create mask file" 
-         " for writing because output file name was never initialized.";
+      ossimNotify(ossimNotifyLevel_WARN) << MODULE << " -- Error encountered trying to create mask file"
+                                                      " for writing because output file name was never initialized.";
       return;
    }
 
-   ofstream maskFileStream (theOutputName.chars(), ios::out|ios::binary);
+   ofstream maskFileStream(theOutputName.chars(), ios::out | ios::binary);
    if (!maskFileStream.is_open())
    {
-      ossimNotify(ossimNotifyLevel_WARN)<<MODULE<<" -- Error encountered trying to create mask file" 
-         "<"<<theOutputName<<"> for writing. Cannot write mask.";
+      ossimNotify(ossimNotifyLevel_WARN) << MODULE << " -- Error encountered trying to create mask file"
+                                                      "<"
+                                         << theOutputName << "> for writing. Cannot write mask.";
       return;
    }
 
    // Write the header info:
-   ossim_uint32 num_rlevels = (ossim_uint32) m_buffers.size();
-   maskFileStream << MASK_FILE_MAGIC_NUMBER <<" "<< m_startingResLevel <<" "<< num_rlevels<<" ";
-   for (ossim_uint32 r=0; r<num_rlevels; r++)
-      maskFileStream << m_bufferSizes[r].x <<" "<< m_bufferSizes[r].y <<" "; 
+   ossim_uint32 num_rlevels = (ossim_uint32)m_buffers.size();
+   maskFileStream << MASK_FILE_MAGIC_NUMBER << " " << m_startingResLevel << " " << num_rlevels << " ";
+   for (ossim_uint32 r = 0; r < num_rlevels; r++)
+      maskFileStream << m_bufferSizes[r].x << " " << m_bufferSizes[r].y << " ";
    maskFileStream << ends;
 
    // Loop over each res level and write buffers to disk:
-   for (ossim_uint32 rlevel = 0; rlevel<num_rlevels; ++rlevel)
+   for (ossim_uint32 rlevel = 0; rlevel < num_rlevels; ++rlevel)
    {
       ossim_uint32 bufsize = m_bufferSizes[rlevel].x * m_bufferSizes[rlevel].y;
-      maskFileStream.write((char*)(m_buffers[rlevel]), bufsize);
+      maskFileStream.write((char *)(m_buffers[rlevel]), bufsize);
    }
 
    maskFileStream.close();
@@ -266,7 +231,7 @@ void ossimBitMaskWriter::close()
 //! Constructor accepts keywordlist with all info necessary to compute a mask. The caller will
 //! still need to call writeMask().
 //*************************************************************************************************
-bool ossimBitMaskWriter::loadState(const ossimKeywordlist& kwl, const char* prefix)
+bool ossimBitMaskWriter::loadState(const ossimKeywordlist &kwl, const char *prefix)
 {
    // static const char* MODULE = "ossimBitMaskWriter::writeMask(kwl)";
 
@@ -289,7 +254,7 @@ bool ossimBitMaskWriter::loadState(const ossimKeywordlist& kwl, const char* pref
 }
 
 //*************************************************************************************************
-// 
+//
 //*************************************************************************************************
 void ossimBitMaskWriter::initializeFlipper()
 {
@@ -300,6 +265,11 @@ void ossimBitMaskWriter::initializeFlipper()
       m_flipper->setTargetValue(0);
       m_flipper->setReplacementValue(0);
    }
+   if (!m_memoryImage)
+   {
+      m_memoryImage = new ossimMemoryImageSource();
+      m_flipper->connectMyInputTo(m_memoryImage.get());
+   }
 
    // This method gets called when an input connection is made as well as other times, so keep an
    // eye out for valid input connection:
@@ -310,23 +280,23 @@ void ossimBitMaskWriter::initializeFlipper()
 }
 
 //*************************************************************************************************
-// 
+//
 //*************************************************************************************************
-bool ossimBitMaskWriter::canConnectMyInputTo(ossim_int32 /*myInputIndex*/, 
-                                             const ossimConnectableObject* object) const
+bool ossimBitMaskWriter::canConnectMyInputTo(ossim_int32 /*myInputIndex*/,
+                                             const ossimConnectableObject *object) const
 {
-   const ossimImageSource* ois = dynamic_cast<const ossimImageSource*>(object);
+   const ossimImageSource *ois = dynamic_cast<const ossimImageSource *>(object);
    return (ois != NULL);
 }
 
 //*************************************************************************************************
-// 
+//
 //*************************************************************************************************
-ossim_int32 ossimBitMaskWriter::connectMyInputTo (ossimConnectableObject *inputObject, 
-                                                  bool makeOutputConnection, 
-                                                  bool createEventFlag)
+ossim_int32 ossimBitMaskWriter::connectMyInputTo(ossimConnectableObject *inputObject,
+                                                 bool makeOutputConnection,
+                                                 bool createEventFlag)
 {
-   ossimImageSource* input_source = dynamic_cast<ossimImageSource*>(inputObject);
+   ossimImageSource *input_source = dynamic_cast<ossimImageSource *>(inputObject);
    if (input_source == NULL)
       return -1;
 
@@ -335,42 +305,42 @@ ossim_int32 ossimBitMaskWriter::connectMyInputTo (ossimConnectableObject *inputO
 
    // This input should be an image handler, but may need to search the objects inputs in case
    // it is chained:
-   ossimImageHandler* handler = dynamic_cast<ossimImageHandler*>(input_source);
+   ossimImageHandler *handler = dynamic_cast<ossimImageHandler *>(input_source);
    if (handler == NULL)
    {
       // Need to search:
       ossimTypeNameVisitor visitor(ossimString("ossimImageHandler"),
                                    true,
-                                   ossimVisitor::VISIT_CHILDREN|ossimVisitor::VISIT_INPUTS);
-      
+                                   ossimVisitor::VISIT_CHILDREN | ossimVisitor::VISIT_INPUTS);
+
       input_source->accept(visitor);
       ossimRefPtr<ossimObject> obj = visitor.getObject();
-      if ( obj.valid() )
+      if (obj.valid())
       {
-         handler = dynamic_cast<ossimImageHandler*>( obj.get() );
+         handler = dynamic_cast<ossimImageHandler *>(obj.get());
       }
    }
 
    // Should have a handler:
    if (!handler)
-   { 
+   {
       disconnectAllInputs();
       return -1;
    }
 
    // A handler has been identified. Need the filename:
-   ossimFilename imageFile =  handler->getFilename();
+   ossimFilename imageFile = handler->getFilename();
    if (imageFile.contains("ovr.tmp"))
    {
       // The handler is actually an overview, need some massaging to work since the overview may
       // not have an R0 entry and R1 rect must be requested instead:
-      m_imageSize = handler->getBoundingRect(1).size() * 2; 
+      m_imageSize = handler->getBoundingRect(1).size() * 2;
       imageFile = imageFile.noExtension();
    }
    else
    {
       // This is normal image handler so it is OK to request R0 rect:
-      m_imageSize = handler->getBoundingRect(0).size(); 
+      m_imageSize = handler->getBoundingRect(0).size();
    }
    if (theOutputName.empty())
       theOutputName = imageFile.setExtension("mask");
@@ -388,21 +358,21 @@ ossim_int32 ossimBitMaskWriter::connectMyInputTo (ossimConnectableObject *inputO
 //! Since overviews may not yet exist when the mask is being written, we must compute the
 //! size of the mask buffer based on the original R0 image size.
 //*************************************************************************************************
-ossimIpt ossimBitMaskWriter::computeImageSize(ossim_uint32 rlevel, ossimImageData* tile) const
+ossimIpt ossimBitMaskWriter::computeImageSize(ossim_uint32 rlevel, ossimImageData *tile) const
 {
    if (rlevel == 0)
       return m_imageSize;
 
-   ossimIpt isize (m_imageSize);
-   for (ossim_uint32 r=1; r<=rlevel; r++)
+   ossimIpt isize(m_imageSize);
+   for (ossim_uint32 r = 1; r <= rlevel; r++)
    {
       isize.x = (isize.x + 1) / 2;
       isize.y = (isize.y + 1) / 2;
    }
 
    // Adjust size n X direction to even mask boundary:
-   ossimIpt tile_size (tile->getWidth(), tile->getHeight());
-   isize.x = ((int)(isize.x+7)/8) * 8;
+   ossimIpt tile_size(tile->getWidth(), tile->getHeight());
+   isize.x = ((int)(isize.x + 7) / 8) * 8;
 
    return isize;
 }
@@ -422,11 +392,11 @@ bool ossimBitMaskWriter::buildOverviews(ossim_uint32 total_num_rlevels)
       return false;
    if (m_buffers.size() == total_num_rlevels)
       return true; // nothing to do
-   ossim_uint32 ref_rlevel = m_startingResLevel + (ossim_uint32) m_buffers.size() - 1;
+   ossim_uint32 ref_rlevel = m_startingResLevel + (ossim_uint32)m_buffers.size() - 1;
    ossim_uint32 ovr_rlevel = ref_rlevel + 1;
 
-   ossimIpt ref_size (m_bufferSizes[ref_rlevel-m_startingResLevel]);
-   ossim_uint8 *ref_buf = m_buffers[ref_rlevel-m_startingResLevel];
+   ossimIpt ref_size(m_bufferSizes[ref_rlevel - m_startingResLevel]);
+   ossim_uint8 *ref_buf = m_buffers[ref_rlevel - m_startingResLevel];
    ossim_uint32 ref_index = 0, ovr_index = 0;
    ossim_uint8 *ovr_buf = 0;
    ossim_uint32 size_of_refbuf = ref_size.x * ref_size.y;
@@ -435,7 +405,7 @@ bool ossimBitMaskWriter::buildOverviews(ossim_uint32 total_num_rlevels)
    while (ovr_rlevel != total_num_rlevels)
    {
       // Allocate the buffer at this R-level:
-      ossimIpt ovr_size ((ref_size.x+1)/2, (ref_size.y+1)/2);
+      ossimIpt ovr_size((ref_size.x + 1) / 2, (ref_size.y + 1) / 2);
       ossim_uint32 size_of_ovrbuf = ovr_size.x * ovr_size.y;
       if (size_of_ovrbuf == 0)
          return false;
@@ -446,22 +416,22 @@ bool ossimBitMaskWriter::buildOverviews(ossim_uint32 total_num_rlevels)
 
       // Loop over each output overview pixel, considering the underlying rlevel (equivalent to
       // nearest-neighbor resampling for overview at 2X decimation):
-      for (int y=0; y<ovr_size.y; y++)
+      for (int y = 0; y < ovr_size.y; y++)
       {
-         ref_index = 2*y*ref_size.x;
-         ovr_index = y*ovr_size.x;
+         ref_index = 2 * y * ref_size.x;
+         ovr_index = y * ovr_size.x;
 
-         for (int x=0; x<ovr_size.x; x++)
+         for (int x = 0; x < ovr_size.x; x++)
          {
             ossim_uint8 a = 0;
             ossim_uint8 b = 0;
             if (ref_index < size_of_refbuf)
             {
                a = ref_buf[ref_index++];
-               if ((x < (ovr_size.x-1)) || !(ref_size.x & 1))
+               if ((x < (ovr_size.x - 1)) || !(ref_size.x & 1))
                   b = ref_buf[ref_index++];
             }
-            ovr_buf[ovr_index++] = ( (a & 0x80)       |
+            ovr_buf[ovr_index++] = ((a & 0x80) |
                                     ((a & 0x20) << 1) |
                                     ((a & 0x08) << 2) |
                                     ((a & 0x02) << 3) |
@@ -469,7 +439,6 @@ bool ossimBitMaskWriter::buildOverviews(ossim_uint32 total_num_rlevels)
                                     ((b & 0x20) >> 3) |
                                     ((b & 0x08) >> 2) |
                                     ((b & 0x02) >> 1));
-
          }
       }
 
@@ -482,4 +451,3 @@ bool ossimBitMaskWriter::buildOverviews(ossim_uint32 total_num_rlevels)
 
    return true;
 }
-


=====================================
src/imaging/ossimPixelFlipper.cpp
=====================================
--- a/src/imaging/ossimPixelFlipper.cpp
+++ b/src/imaging/ossimPixelFlipper.cpp
@@ -11,7 +11,6 @@
 //*************************************************************************
 // $Id: ossimPixelFlipper.cpp 21631 2012-09-06 18:10:55Z dburken $
 
-
 #include <ossim/imaging/ossimPixelFlipper.h>
 #include <ossim/base/ossimTrace.h>
 #include <ossim/base/ossimNotifyContext.h>
@@ -25,14 +24,14 @@ RTTI_DEF1(ossimPixelFlipper, "ossimPixelFlipper", ossimImageSourceFilter)
 
 static ossimTrace traceDebug("ossimPixelFlipper:debug");
 
-const char ossimPixelFlipper::PF_TARGET_VALUE_KW[]      = "target_value";
-const char ossimPixelFlipper::PF_TARGET_RANGE_KW[]      = "target_range";
+const char ossimPixelFlipper::PF_TARGET_VALUE_KW[] = "target_value";
+const char ossimPixelFlipper::PF_TARGET_RANGE_KW[] = "target_range";
 const char ossimPixelFlipper::PF_REPLACEMENT_VALUE_KW[] = "replacement_value";
-const char ossimPixelFlipper::PF_REPLACEMENT_MODE_KW[]  = "replacement_mode";
-const char ossimPixelFlipper::PF_CLAMP_VALUE_KW[]       = "clamp_value"; // deprecated by clamp_value_hi
-const char ossimPixelFlipper::PF_CLAMP_VALUE_LO_KW[]    = "clamp_value_lo";
-const char ossimPixelFlipper::PF_CLAMP_VALUE_HI_KW[]    = "clamp_value_hi";
-const char ossimPixelFlipper::PF_CLIP_MODE_KW[]         = "border_clip_mode";
+const char ossimPixelFlipper::PF_REPLACEMENT_MODE_KW[] = "replacement_mode";
+const char ossimPixelFlipper::PF_CLAMP_VALUE_KW[] = "clamp_value"; // deprecated by clamp_value_hi
+const char ossimPixelFlipper::PF_CLAMP_VALUE_LO_KW[] = "clamp_value_lo";
+const char ossimPixelFlipper::PF_CLAMP_VALUE_HI_KW[] = "clamp_value_hi";
+const char ossimPixelFlipper::PF_CLIP_MODE_KW[] = "border_clip_mode";
 
 static const char TARGET_LOWER_LIMIT_PROP_NAME[] = "target_range_lower_limit";
 static const char TARGET_UPPER_LIMIT_PROP_NAME[] = "target_range_upper_limit";
@@ -41,9 +40,8 @@ static const char TARGET_UPPER_LIMIT_PROP_NAME[] = "target_range_upper_limit";
 static const char OSSIM_ID[] = "$Id: ossimPixelFlipper.cpp 21631 2012-09-06 18:10:55Z dburken $";
 #endif
 
-ossimPixelFlipper::ossimPixelFlipper(ossimObject* owner)
-   :
-      ossimImageSourceFilter(owner),
+ossimPixelFlipper::ossimPixelFlipper(ossimObject *owner)
+    : ossimImageSourceFilter(owner),
       theTargetValueLo(0.0),
       theTargetValueHi(0.0),
       theReplacementValue(1.0),
@@ -56,122 +54,126 @@ ossimPixelFlipper::ossimPixelFlipper(ossimObject* owner)
    if (traceDebug())
    {
       ossimNotify(ossimNotifyLevel_DEBUG)
-         << "ossimPixelFlipper::ossimPixelFlipper entered...\n";
+          << "ossimPixelFlipper::ossimPixelFlipper entered...\n";
 #ifdef OSSIM_ID_ENABLED
       ossimNotify(ossimNotifyLevel_DEBUG)
-         << "OSSIM_ID:  " << OSSIM_ID << "\n";
-#endif      
+          << "OSSIM_ID:  " << OSSIM_ID << "\n";
+#endif
    }
-   
+
    setDescription(ossimString("Pixel Flipper"));
    enableSource();
 }
 
 ossimPixelFlipper::~ossimPixelFlipper()
-{}
+{
+}
 
 ossimRefPtr<ossimImageData> ossimPixelFlipper::getTile(
-   const ossimIrect& tile_rect, ossim_uint32 resLevel)
+    const ossimIrect &tile_rect, ossim_uint32 resLevel)
 {
 
-   if(!theInputConnection)
+   if (!theInputConnection)
    {
       return 0;
    }
 
    // Fetch tile from pointer from the input source.
    ossimRefPtr<ossimImageData> inputTile =
-      theInputConnection->getTile(tile_rect, resLevel);
-   
-   if (!inputTile.valid() || !isSourceEnabled()) return inputTile;
-   
-   if (!inputTile->getBuf()) return inputTile;
-   
+       theInputConnection->getTile(tile_rect, resLevel);
+
+   if (!inputTile.valid() || !isSourceEnabled())
+      return inputTile;
+
+   if (!inputTile->getBuf())
+      return inputTile;
+
    // Lock for the length of this method.
-	std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
-   
+   std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
+
    // Call the appropriate load method.
    switch (inputTile->getScalarType())
    {
-      
-      case OSSIM_UCHAR:
-      {
-         flipPixels(ossim_uint8(0), inputTile.get(), resLevel);
-         break;
-      }
-      
-      case OSSIM_UINT16:
-      case OSSIM_USHORT11:
-      case OSSIM_USHORT12:
-      case OSSIM_USHORT13:
-      case OSSIM_USHORT14:
-      case OSSIM_USHORT15:
-      {
-         flipPixels(ossim_uint16(0), inputTile.get(), resLevel);
-         break;
-      }
-      
-      case OSSIM_SSHORT16:
-      {
-         flipPixels(ossim_sint16(0), inputTile.get(), resLevel);
-         break;
-      }
-      case OSSIM_UINT32:
-      {
-         flipPixels(ossim_uint32(0), inputTile.get(), resLevel);
-         break;
-      }
-      case OSSIM_SINT32:
-      {
-         flipPixels(ossim_sint32(0), inputTile.get(), resLevel);
-         break;
-      }
-      case OSSIM_FLOAT32:
-      case OSSIM_NORMALIZED_FLOAT:
-      {
-         flipPixels(float(0), inputTile.get(), resLevel);
-         break;
-      }
-      
-      case OSSIM_NORMALIZED_DOUBLE:
-      case OSSIM_FLOAT64:
-      {
-         flipPixels(ossim_float64(0), inputTile.get(), resLevel);
-         break;
-      }
-      
-      case OSSIM_SCALAR_UNKNOWN:
-      default:
-      {
-         ossimNotify(ossimNotifyLevel_WARN)
-            << "ossimPixelFlipper::getTile Unsupported scalar type!" << endl;
-         break;
-      }
+
+   case OSSIM_UCHAR:
+   {
+      flipPixels(ossim_uint8(0), inputTile.get(), resLevel);
+      break;
+   }
+
+   case OSSIM_UINT16:
+   case OSSIM_USHORT11:
+   case OSSIM_USHORT12:
+   case OSSIM_USHORT13:
+   case OSSIM_USHORT14:
+   case OSSIM_USHORT15:
+   {
+      flipPixels(ossim_uint16(0), inputTile.get(), resLevel);
+      break;
    }
-   
+
+   case OSSIM_SSHORT16:
+   {
+      flipPixels(ossim_sint16(0), inputTile.get(), resLevel);
+      break;
+   }
+   case OSSIM_UINT32:
+   {
+      flipPixels(ossim_uint32(0), inputTile.get(), resLevel);
+      break;
+   }
+   case OSSIM_SINT32:
+   {
+      flipPixels(ossim_sint32(0), inputTile.get(), resLevel);
+      break;
+   }
+   case OSSIM_FLOAT32:
+   case OSSIM_NORMALIZED_FLOAT:
+   {
+      flipPixels(ossim_float32(0), inputTile.get(), resLevel);
+      break;
+   }
+
+   case OSSIM_NORMALIZED_DOUBLE:
+   case OSSIM_FLOAT64:
+   {
+      flipPixels(ossim_float64(0), inputTile.get(), resLevel);
+      break;
+   }
+
+   case OSSIM_SCALAR_UNKNOWN:
+   default:
+   {
+      ossimNotify(ossimNotifyLevel_WARN)
+          << "ossimPixelFlipper::getTile Unsupported scalar type!" << endl;
+      break;
+   }
+   }
+
    inputTile->validate();
    return inputTile;
 }
 
 template <class T>
 void ossimPixelFlipper::flipPixels(T /* dummy */,
-                                   ossimImageData* inputTile,
+                                   ossimImageData *inputTile,
                                    ossim_uint32 resLevel)
 {
-   if (!inputTile) return;
+   if (!inputTile)
+      return;
 
-   T targetLo    = static_cast<T>(theTargetValueLo);
-   T targetHi    = static_cast<T>(theTargetValueHi);
+   T targetLo = static_cast<T>(theTargetValueLo);
+   T targetHi = static_cast<T>(theTargetValueHi);
    T replacement = static_cast<T>(theReplacementValue);
-   T clampLo       = static_cast<T>(theClampValueLo);
-   T clampHi       = static_cast<T>(theClampValueHi);
+   T clampLo = static_cast<T>(theClampValueLo);
+   T clampHi = static_cast<T>(theClampValueHi);
 
    // Get pointers to data for each band.
    ossim_uint32 bands = inputTile->getNumberOfBands();
    ossim_uint32 band;
-   T** buf = new T*[bands];
-   for(band=0; band<bands; ++band)
-      buf[band] = static_cast<T*>(inputTile->getBuf(band));
+   T **buf = new T *[bands];
+   for (band = 0; band < bands; ++band)
+      buf[band] = static_cast<T *>(inputTile->getBuf(band));
 
    ossimIrect rect = inputTile->getImageRectangle();
    ossimIpt ul = rect.ul();
@@ -184,7 +186,7 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
    bool needsTesting = false;
    if ((theClipMode == BOUNDING_RECT) && (resLevel < theBoundingRects.size()))
    {
-      if(!rect.intersects(theBoundingRects[resLevel]))
+      if (!rect.intersects(theBoundingRects[resLevel]))
          is_outside_aoi = true;
       else
          needsTesting = !rect.completely_within(theBoundingRects[resLevel]);
@@ -195,7 +197,7 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
       bool urFlag = theValidVertices[resLevel].isPointWithin(rect.ur());
       bool lrFlag = theValidVertices[resLevel].isPointWithin(rect.lr());
       bool llFlag = theValidVertices[resLevel].isPointWithin(rect.ll());
-      if((!ulFlag) && (!urFlag) && (!lrFlag) && (!llFlag))
+      if ((!ulFlag) && (!urFlag) && (!lrFlag) && (!llFlag))
          is_outside_aoi = true;
       else
          needsTesting = !(ulFlag && urFlag && lrFlag && llFlag);
@@ -203,18 +205,18 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
    if (is_outside_aoi)
    {
       // none of the tile is inside so just return with empty tile:
-      delete [] buf;
-      return; 
+      delete[] buf;
+      return;
    }
 
-   ossim_uint32 i = 0;  // index into band buffers;
-   ossimIpt pixel_loc; 
+   ossim_uint32 i = 0; // index into band buffers;
+   ossimIpt pixel_loc;
    bool can_replace, found_candidate;
 
    // Begin loop over each pixel in the tile. The individual bands are handled inside this loop:
-   for(pixel_loc.y = ul.y; pixel_loc.y <= lr.y; ++pixel_loc.y)
+   for (pixel_loc.y = ul.y; pixel_loc.y <= lr.y; ++pixel_loc.y)
    {
-      for(pixel_loc.x = ul.x; pixel_loc.x <= lr.x; ++pixel_loc.x)
+      for (pixel_loc.x = ul.x; pixel_loc.x <= lr.x; ++pixel_loc.x)
       {
          // First consider if we need to test the pixel for border clipping:
          if (needsTesting)
@@ -228,12 +230,12 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
             if (!is_inside)
             {
                // Remap this pixel to the replacement value (all bands)
-               for (band=0; band<bands; ++band)
+               for (band = 0; band < bands; ++band)
                   buf[band][i] = replacement;
 
                // Proceed to next pixel location:
                ++i;
-               continue; 
+               continue;
             }
          }
 
@@ -244,7 +246,7 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
             {
             case REPLACE_BAND_IF_TARGET:
             case REPLACE_ALL_BANDS_IF_ANY_TARGET:
-               for (band=0; band<bands; ++band)
+               for (band = 0; band < bands; ++band)
                {
                   if (!ossim::isnan(theClampValueLo) && (buf[band][i] < clampLo))
                      buf[band][i] = clampLo;
@@ -253,16 +255,16 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
                }
                break;
 
-            case REPLACE_BAND_IF_PARTIAL_TARGET: 
+            case REPLACE_BAND_IF_PARTIAL_TARGET:
             case REPLACE_ALL_BANDS_IF_PARTIAL_TARGET:
-               // First band loop to establish if pixel qualifies for replacement (at least one 
+               // First band loop to establish if pixel qualifies for replacement (at least one
                // band must be valid):
                can_replace = false;
                found_candidate = false;
-               for (band=0; (band < bands) && !(can_replace && found_candidate); ++band)
+               for (band = 0; (band < bands) && !(can_replace && found_candidate); ++band)
                {
                   if ((!ossim::isnan(theClampValueLo) && (buf[band][i] < clampLo)) ||
-                     (!ossim::isnan(theClampValueHi) && (buf[band][i] > clampHi)))
+                      (!ossim::isnan(theClampValueHi) && (buf[band][i] > clampHi)))
                      found_candidate = true;
                   else
                      can_replace = true;
@@ -271,7 +273,7 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
                {
                   // This pixel has at least one band with normal value, so need to rescan bands
                   // to find pixels that need replacing (are within the target range):
-                  for (band=0; band<bands; ++band)
+                  for (band = 0; band < bands; ++band)
                   {
                      if (!ossim::isnan(theClampValueLo) && (buf[band][i] < clampLo))
                         buf[band][i] = clampLo;
@@ -282,10 +284,10 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
                break;
 
             case REPLACE_ONLY_FULL_TARGETS:
-               // First band loop to establish if pixel qualifies for replacement (all 
+               // First band loop to establish if pixel qualifies for replacement (all
                // bands must be in target range):
                can_replace = true;
-               for (band=0; (band < bands) && can_replace; ++band)
+               for (band = 0; (band < bands) && can_replace; ++band)
                {
                   if ((ossim::isnan(theClampValueLo) || (buf[band][i] >= clampLo)) &&
                       (ossim::isnan(theClampValueHi) || (buf[band][i] <= clampHi)))
@@ -293,8 +295,8 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
                }
                if (can_replace)
                {
-                  // Map all pixels to replacement value: 
-                  for (band=0; band<bands; ++band)
+                  // Map all pixels to replacement value:
+                  for (band = 0; band < bands; ++band)
                   {
                      if (!ossim::isnan(theClampValueLo) && (buf[band][i] < clampLo))
                         buf[band][i] = clampLo;
@@ -307,7 +309,7 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
 
             // Proceed to next pixel location:
             ++i;
-            continue; 
+            continue;
          }
 
          // If we got here (the continue statement was not reached) then
@@ -315,20 +317,20 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
          switch (theReplacementMode)
          {
          case REPLACE_BAND_IF_TARGET:
-            for (band=0; band<bands; ++band)
+            for (band = 0; band < bands; ++band)
             {
-               if ((buf[band][i] >= targetLo) && (buf[band][i] <=targetHi)) 
+               if ((buf[band][i] >= targetLo) && (buf[band][i] <= targetHi))
                   buf[band][i] = theReplacementValue;
             }
             break;
 
-         case REPLACE_BAND_IF_PARTIAL_TARGET: 
+         case REPLACE_BAND_IF_PARTIAL_TARGET:
 
-            // First band loop to establish if pixel qualifies for replacement (at least one 
+            // First band loop to establish if pixel qualifies for replacement (at least one
             // band must be valid):
             can_replace = false;
             found_candidate = false;
-            for (band=0; (band < bands) && !(can_replace && found_candidate); ++band)
+            for (band = 0; (band < bands) && !(can_replace && found_candidate); ++band)
             {
                //  check for target range replacement qualification:
                if ((buf[band][i] < targetLo) || (buf[band][i] > targetHi))
@@ -340,9 +342,9 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
             {
                // This pixel has at least one band with normal value, so need to rescan bands
                // to find pixels that need replacing (are within the target range):
-               for (band=0; band<bands; ++band)
+               for (band = 0; band < bands; ++band)
                {
-                  if ((buf[band][i] >= targetLo) && (buf[band][i] <= targetHi)) 
+                  if ((buf[band][i] >= targetLo) && (buf[band][i] <= targetHi))
                      buf[band][i] = theReplacementValue;
                }
             }
@@ -350,11 +352,11 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
 
          case REPLACE_ALL_BANDS_IF_PARTIAL_TARGET:
 
-            // First band loop to establish if pixel qualifies for replacement (at least one 
+            // First band loop to establish if pixel qualifies for replacement (at least one
             // band must be valid):
             can_replace = false;
             found_candidate = false;
-            for (band=0; (band < bands) && !(can_replace && found_candidate); ++band)
+            for (band = 0; (band < bands) && !(can_replace && found_candidate); ++band)
             {
                // check for target range replacement qualification:
                if ((buf[band][i] < targetLo) || (buf[band][i] > targetHi))
@@ -364,19 +366,19 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
             }
             if (can_replace && found_candidate)
             {
-               // This pixel has at least one band with normal value and one with target, so 
+               // This pixel has at least one band with normal value and one with target, so
                // map all bands to target:
-               for (band=0; band<bands; ++band)
+               for (band = 0; band < bands; ++band)
                   buf[band][i] = theReplacementValue;
             }
             break;
 
          case REPLACE_ONLY_FULL_TARGETS:
 
-            // First band loop to establish if pixel qualifies for replacement (all 
+            // First band loop to establish if pixel qualifies for replacement (all
             // bands must be in target range):
             can_replace = true;
-            for (band=0; (band < bands) && can_replace; ++band)
+            for (band = 0; (band < bands) && can_replace; ++band)
             {
                // check for target range replacement qualification:
                if ((buf[band][i] < targetLo) || (buf[band][i] > targetHi))
@@ -384,18 +386,18 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
             }
             if (can_replace)
             {
-               // Map all pixels to replacement value: 
-               for (band=0; band<bands; ++band)
+               // Map all pixels to replacement value:
+               for (band = 0; band < bands; ++band)
                   buf[band][i] = theReplacementValue;
             }
             break;
 
          case REPLACE_ALL_BANDS_IF_ANY_TARGET:
 
-            // First band loop to establish if pixel qualifies for replacement (all 
+            // First band loop to establish if pixel qualifies for replacement (all
             // bands must be in target range):
             can_replace = false;
-            for (band=0; (band < bands) && !can_replace; ++band)
+            for (band = 0; (band < bands) && !can_replace; ++band)
             {
                // check for target range replacement qualification:
                if ((buf[band][i] >= targetLo) && (buf[band][i] <= targetHi))
@@ -403,8 +405,8 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
             }
             if (can_replace)
             {
-               // Map all pixels to replacement value: 
-               for (band=0; band<bands; ++band)
+               // Map all pixels to replacement value:
+               for (band = 0; band < bands; ++band)
                   buf[band][i] = theReplacementValue;
             }
             break;
@@ -413,140 +415,140 @@ void ossimPixelFlipper::flipPixels(T /* dummy */,
          // Reached end of processing for one pixel location. Increment the band buffers index:
          ++i;
       } // end of loop over pixel_loc.x
-   } // end of loop over pixel_loc.y
-   
-   delete [] buf;
+   }    // end of loop over pixel_loc.y
+
+   delete[] buf;
    inputTile->validate();
 }
 
-template <class T> void ossimPixelFlipper::clipTile(T /* dummy */,
-                                                    ossimImageData* inputTile,
-                                                    ossim_uint32 resLevel)
+template <class T>
+void ossimPixelFlipper::clipTile(T /* dummy */,
+                                 ossimImageData *inputTile,
+                                 ossim_uint32 resLevel)
 {
-   if(theClipMode == NONE)
+   if (theClipMode == NONE)
    {
       theClipTileBuffer = 0;
       return;
    }
-   if(!inputTile) return;
-   if(!inputTile->getBuf()||
-      (inputTile->getDataObjectStatus() == OSSIM_EMPTY))
+   if (!inputTile)
+      return;
+   if (!inputTile->getBuf() ||
+       (inputTile->getDataObjectStatus() == OSSIM_EMPTY))
    {
       return;
    }
    allocateClipTileBuffer(inputTile);
 
-
-   if(theClipTileBuffer.valid())
+   if (theClipTileBuffer.valid())
    {
       ossimIrect tileRect = inputTile->getImageRectangle();
       // force to all nulls
       theClipTileBuffer->setDataObjectStatus(OSSIM_FULL);
       theClipTileBuffer->makeBlank();
-      
-      switch(theClipMode)
+
+      switch (theClipMode)
       {
-         case NONE:
-         {
-            break;
-         }
-         case BOUNDING_RECT:
+      case NONE:
+      {
+         break;
+      }
+      case BOUNDING_RECT:
+      {
+         if (resLevel < theBoundingRects.size())
          {
-            if(resLevel < theBoundingRects.size())
+            if (tileRect.completely_within(theBoundingRects[resLevel]) ||
+                theBoundingRects[resLevel].hasNans())
+            {
+               return;
+            }
+            else
             {
-               if(tileRect.completely_within(theBoundingRects[resLevel])||
-                  theBoundingRects[resLevel].hasNans())
+               if (tileRect.intersects(theBoundingRects[resLevel]))
                {
-                  return;
+                  ossimIrect clipRect = tileRect.clipToRect(theBoundingRects[resLevel]);
+
+                  theClipTileBuffer->setImageRectangle(clipRect);
+
+                  theClipTileBuffer->loadTile(inputTile);
+                  inputTile->makeBlank();
+                  inputTile->loadTile(theClipTileBuffer.get());
+                  inputTile->validate();
                }
                else
                {
-                  if(tileRect.intersects(theBoundingRects[resLevel]))
-                  {
-                     ossimIrect clipRect = tileRect.clipToRect(theBoundingRects[resLevel]);
-
-                     theClipTileBuffer->setImageRectangle(clipRect);
-                     
-                     theClipTileBuffer->loadTile(inputTile);
-                     inputTile->makeBlank();
-                     inputTile->loadTile(theClipTileBuffer.get());
-                     inputTile->validate();
-                  }
-                  else
-                  {
-                     inputTile->makeBlank();
-                  }
+                  inputTile->makeBlank();
                }
             }
-            break;
          }
-         case VALID_VERTICES:
+         break;
+      }
+      case VALID_VERTICES:
+      {
+         if (resLevel < theValidVertices.size())
          {
-            if(resLevel < theValidVertices.size())
+            const ossimPolygon &p = theValidVertices[resLevel];
+            bool ulWithin = p.isPointWithin(tileRect.ul());
+            bool urWithin = p.isPointWithin(tileRect.ur());
+            bool lrWithin = p.isPointWithin(tileRect.lr());
+            bool llWithin = p.isPointWithin(tileRect.ll());
+
+            if (ulWithin &&
+                urWithin &&
+                lrWithin &&
+                llWithin)
             {
-               const ossimPolygon& p = theValidVertices[resLevel];
-               bool ulWithin = p.isPointWithin(tileRect.ul());
-               bool urWithin = p.isPointWithin(tileRect.ur());
-               bool lrWithin = p.isPointWithin(tileRect.lr());
-               bool llWithin = p.isPointWithin(tileRect.ll());
-               
-               if(ulWithin&&
-                  urWithin&&
-                  lrWithin&&
-                  llWithin)
-               {
-                  return;
-               }
-               else if(!(ulWithin|| // if none are in
-                         urWithin||
-                         lrWithin||
-                         llWithin))
-               {
-                  inputTile->makeBlank();
-                  return;
-               }
-               else
+               return;
+            }
+            else if (!(ulWithin || // if none are in
+                       urWithin ||
+                       lrWithin ||
+                       llWithin))
+            {
+               inputTile->makeBlank();
+               return;
+            }
+            else
+            {
+               ossimIpt ul = tileRect.ul();
+               ossimIpt origin;
+               ossim_uint32 x = 0;
+               ossim_uint32 y = 0;
+               ossim_uint32 w = inputTile->getWidth();
+               ossim_uint32 h = inputTile->getHeight();
+               ossim_uint32 offset = 0;
+               origin.y = ul.y;
+               for (y = 0; y < h; ++y)
                {
-                  ossimIpt ul = tileRect.ul();
-                  ossimIpt origin;
-                  ossim_uint32 x = 0;
-                  ossim_uint32 y = 0;
-                  ossim_uint32 w = inputTile->getWidth();
-                  ossim_uint32 h = inputTile->getHeight();
-                  ossim_uint32 offset = 0;
-                  origin.y = ul.y;
-                  for(y = 0; y < h; ++y)
+                  origin.x = ul.x;
+                  for (x = 0; x < w; ++x)
                   {
-                     origin.x = ul.x;
-                     for(x = 0; x < w; ++x)
+                     if (!p.isPointWithin(origin))
                      {
-                        if(!p.isPointWithin(origin))
-                        {
-                           inputTile->setNull(offset);
-                        }
-                        ++offset;
-                        ++origin.x;
+                        inputTile->setNull(offset);
                      }
-                     ++origin.y;
+                     ++offset;
+                     ++origin.x;
                   }
+                  ++origin.y;
                }
             }
-            break;
          }
+         break;
+      }
       }
    }
 }
 
-
 void ossimPixelFlipper::allocateClipTileBuffer(ossimRefPtr<ossimImageData> inputImage)
 {
-   if(inputImage.valid())
+   if (inputImage.valid())
    {
       bool needDupFlag = false;
-      if(theClipTileBuffer.valid())
+      if (theClipTileBuffer.valid())
       {
-         if((theClipTileBuffer->getScalarType() != inputImage->getScalarType())||
-            theClipTileBuffer->getNumberOfBands() != theClipTileBuffer->getNumberOfBands())
+         if ((theClipTileBuffer->getScalarType() != inputImage->getScalarType()) ||
+             theClipTileBuffer->getNumberOfBands() != theClipTileBuffer->getNumberOfBands())
          {
             needDupFlag = true;
          }
@@ -559,16 +561,16 @@ void ossimPixelFlipper::allocateClipTileBuffer(ossimRefPtr<ossimImageData> input
       {
          needDupFlag = true;
       }
-      if(needDupFlag)
+      if (needDupFlag)
       {
-         theClipTileBuffer = (ossimImageData*)inputImage->dup();
+         theClipTileBuffer = (ossimImageData *)inputImage->dup();
       }
    }
 }
 
 void ossimPixelFlipper::initialize()
 {
-	std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
+   std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
    ossimImageSourceFilter::initialize();
    theValidVertices.clear();
    theBoundingRects.clear();
@@ -576,17 +578,17 @@ void ossimPixelFlipper::initialize()
    ossim_uint32 rlevels = getNumberOfDecimationLevels();
    ossim_uint32 idx = 0;
 
-   if(rlevels)
+   if (rlevels)
    {
-      if(theValidVertices.size() != rlevels)
+      if (theValidVertices.size() != rlevels)
       {
          theValidVertices.resize(rlevels);
       }
-      if(theBoundingRects.size() != rlevels)
+      if (theBoundingRects.size() != rlevels)
       {
          theBoundingRects.resize(rlevels);
       }
-      for(idx = 0; idx < rlevels; ++idx)
+      for (idx = 0; idx < rlevels; ++idx)
       {
          std::vector<ossimIpt> validVertices;
          getValidImageVertices(validVertices,
@@ -600,7 +602,7 @@ void ossimPixelFlipper::initialize()
 
 ossimScalarType ossimPixelFlipper::getOutputScalarType() const
 {
-   if(theInputConnection)
+   if (theInputConnection)
    {
       ossimScalarType scalar = theInputConnection->getOutputScalarType();
       {
@@ -655,7 +657,7 @@ ossimScalarType ossimPixelFlipper::getOutputScalarType() const
    return OSSIM_SCALAR_UNKNOWN;
 }
 
-ossim_float64 ossimPixelFlipper::getMaxPixelValue (ossim_uint32 band) const
+ossim_float64 ossimPixelFlipper::getMaxPixelValue(ossim_uint32 band) const
 {
    const ossim_float64 MIN = ossimImageSourceFilter::getMinPixelValue(band);
    const ossim_float64 MAX = ossimImageSourceFilter::getMaxPixelValue(band);
@@ -666,7 +668,7 @@ ossim_float64 ossimPixelFlipper::getMaxPixelValue (ossim_uint32 band) const
    return MAX;
 }
 
-ossim_float64 ossimPixelFlipper::getMinPixelValue (ossim_uint32 band) const
+ossim_float64 ossimPixelFlipper::getMinPixelValue(ossim_uint32 band) const
 {
    const ossim_float64 MIN = ossimImageSourceFilter::getMinPixelValue(band);
    const ossim_float64 MAX = ossimImageSourceFilter::getMaxPixelValue(band);
@@ -677,60 +679,60 @@ ossim_float64 ossimPixelFlipper::getMinPixelValue (ossim_uint32 band) const
    return MIN;
 }
 
-bool ossimPixelFlipper::loadState(const ossimKeywordlist& kwl,
-                                  const char* prefix)
+bool ossimPixelFlipper::loadState(const ossimKeywordlist &kwl,
+                                  const char *prefix)
 {
-   const char* lookupReturn;
-   
+   const char *lookupReturn;
+
    lookupReturn = kwl.find(prefix, PF_TARGET_VALUE_KW);
-   if(lookupReturn)
+   if (lookupReturn)
    {
       setTargetValue(atof(lookupReturn));
    }
 
    lookupReturn = kwl.find(prefix, PF_TARGET_RANGE_KW);
-   if(lookupReturn)
+   if (lookupReturn)
    {
-      ossimString min_max_string (lookupReturn);
-      ossimString separator (" ");
+      ossimString min_max_string(lookupReturn);
+      ossimString separator(" ");
       ossim_float64 min_target = min_max_string.before(separator).toFloat64();
       ossim_float64 max_target = min_max_string.after(separator).toFloat64();
       setTargetRange(min_target, max_target);
    }
 
    lookupReturn = kwl.find(prefix, PF_REPLACEMENT_VALUE_KW);
-   if(lookupReturn)
+   if (lookupReturn)
    {
       setReplacementValue(atof(lookupReturn));
    }
 
    lookupReturn = kwl.find(prefix, PF_REPLACEMENT_MODE_KW);
-   if(lookupReturn)
+   if (lookupReturn)
    {
       ossimString modeString = lookupReturn;
       setReplacementMode(modeString);
    }
 
    lookupReturn = kwl.find(prefix, PF_CLAMP_VALUE_KW);
-   if(lookupReturn)
+   if (lookupReturn)
    {
       setClampValue(atof(lookupReturn), true);
    }
 
    lookupReturn = kwl.find(prefix, PF_CLAMP_VALUE_LO_KW);
-   if(lookupReturn)
+   if (lookupReturn)
    {
       setClampValue(atof(lookupReturn), false);
    }
 
    lookupReturn = kwl.find(prefix, PF_CLAMP_VALUE_HI_KW);
-   if(lookupReturn)
+   if (lookupReturn)
    {
       setClampValue(atof(lookupReturn), true);
    }
 
    lookupReturn = kwl.find(prefix, PF_CLIP_MODE_KW);
-   if(lookupReturn)
+   if (lookupReturn)
    {
       ossimString modeString = lookupReturn;
       setClipMode(modeString);
@@ -746,16 +748,16 @@ bool ossimPixelFlipper::loadState(const ossimKeywordlist& kwl,
    return status;
 }
 
-bool ossimPixelFlipper::saveState(ossimKeywordlist& kwl,
-                                 const char* prefix) const
+bool ossimPixelFlipper::saveState(ossimKeywordlist &kwl,
+                                  const char *prefix) const
 {
    // Call the base class saveState.
    ossimImageSourceFilter::saveState(kwl, prefix);
 
    if (theTargetValueHi != theTargetValueLo)
    {
-      ossimString s (ossimString::toString(theTargetValueLo) + " " + 
-         ossimString::toString(theTargetValueHi));
+      ossimString s(ossimString::toString(theTargetValueLo) + " " +
+                    ossimString::toString(theTargetValueHi));
       kwl.add(prefix, PF_TARGET_RANGE_KW, s);
    }
    else
@@ -763,14 +765,14 @@ bool ossimPixelFlipper::saveState(ossimKeywordlist& kwl,
       kwl.add(prefix, PF_TARGET_VALUE_KW, theTargetValueLo);
    }
    kwl.add(prefix, PF_REPLACEMENT_VALUE_KW, theReplacementValue);
-   kwl.add(prefix, PF_REPLACEMENT_MODE_KW,  getReplacementModeString().c_str());
+   kwl.add(prefix, PF_REPLACEMENT_MODE_KW, getReplacementModeString().c_str());
 
    if (theClampingMode)
    {
-      kwl.add(prefix, PF_CLAMP_VALUE_LO_KW,    theClampValueLo);
-      kwl.add(prefix, PF_CLAMP_VALUE_HI_KW,    theClampValueHi);
+      kwl.add(prefix, PF_CLAMP_VALUE_LO_KW, theClampValueLo);
+      kwl.add(prefix, PF_CLAMP_VALUE_HI_KW, theClampValueHi);
    }
-   kwl.add(prefix, PF_CLIP_MODE_KW,  getClipModeString().c_str());
+   kwl.add(prefix, PF_CLIP_MODE_KW, getClipModeString().c_str());
 
    return true;
 }
@@ -785,7 +787,7 @@ void ossimPixelFlipper::setTargetValue(ossim_float64 target_value)
    std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
 
    theTargetValueLo = target_value;
-   theTargetValueHi = target_value; 
+   theTargetValueHi = target_value;
 }
 
 void ossimPixelFlipper::setTargetRange(ossim_float64 target_min, ossim_float64 target_max)
@@ -798,12 +800,12 @@ void ossimPixelFlipper::setTargetRange(ossim_float64 target_min, ossim_float64 t
    std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
 
    theTargetValueLo = target_min;
-   theTargetValueHi = target_max; 
+   theTargetValueHi = target_max;
 }
 
 void ossimPixelFlipper::setReplacementValue(ossim_float64 replacement_value)
 {
-	std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
+   std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
 
    // Range check to ensure within null, min and max of output radiometry.
    if (inRange(replacement_value))
@@ -819,18 +821,18 @@ void ossimPixelFlipper::setClampValue(ossim_float64 clamp_value, bool clamp_max_
    if (inRange(clamp_value))
    {
       // Stupid MS compiler complains if we do an |= on enum type. (OLK 1/11)
-      int temp_int = (int) theClampingMode;
+      int temp_int = (int)theClampingMode;
       if (clamp_max_value)
       {
          theClampValueHi = clamp_value;
-         temp_int |= (int) CLAMPING_HI;
+         temp_int |= (int)CLAMPING_HI;
       }
       else
       {
          theClampValueLo = clamp_value;
-         temp_int |= (int) CLAMPING_LO;
+         temp_int |= (int)CLAMPING_LO;
       }
-      theClampingMode = (ClampingMode) temp_int;
+      theClampingMode = (ClampingMode)temp_int;
    }
 }
 
@@ -843,13 +845,13 @@ void ossimPixelFlipper::setClampValues(ossim_float64 clamp_value_lo, ossim_float
 
 void ossimPixelFlipper::setReplacementMode(ossimPixelFlipper::ReplacementMode mode)
 {
-	std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
+   std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
    theReplacementMode = mode;
 }
 
-bool ossimPixelFlipper::setReplacementMode(const ossimString& modeString)
+bool ossimPixelFlipper::setReplacementMode(const ossimString &modeString)
 {
-	std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
+   std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
 
    ossimString mode = modeString;
    mode.upcase();
@@ -876,9 +878,9 @@ bool ossimPixelFlipper::setReplacementMode(const ossimString& modeString)
    else
    {
       ossimNotify(ossimNotifyLevel_WARN)
-         << "ossimPixelFlipper::setReplacementMode warning:\n"
-         << "Invalid mode:  " << modeString
-         << endl;
+          << "ossimPixelFlipper::setReplacementMode warning:\n"
+          << "Invalid mode:  " << modeString
+          << endl;
       return false;
    }
    return true;
@@ -886,11 +888,11 @@ bool ossimPixelFlipper::setReplacementMode(const ossimString& modeString)
 
 void ossimPixelFlipper::setClipMode(ossimPixelFlipper::ClipMode mode)
 {
-	std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
+   std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
    theClipMode = mode;
 }
 
-void ossimPixelFlipper::setClipMode(const ossimString& modeString)
+void ossimPixelFlipper::setClipMode(const ossimString &modeString)
 {
    ossimString mode = modeString;
    mode.downcase();
@@ -909,9 +911,9 @@ void ossimPixelFlipper::setClipMode(const ossimString& modeString)
    else
    {
       ossimNotify(ossimNotifyLevel_WARN)
-         << "ossimPixelFlipper::setClipMode warning:\n"
-         << "Invalid mode:  " << modeString
-         << endl;
+          << "ossimPixelFlipper::setClipMode warning:\n"
+          << "Invalid mode:  " << modeString
+          << endl;
    }
 }
 
@@ -925,33 +927,33 @@ ossim_float64 ossimPixelFlipper::getReplacementValue() const
    return theReplacementValue;
 }
 
-ossimPixelFlipper::ReplacementMode ossimPixelFlipper::getReplacementMode()  const
+ossimPixelFlipper::ReplacementMode ossimPixelFlipper::getReplacementMode() const
 {
    return theReplacementMode;
 }
-   
-ossimString ossimPixelFlipper::getReplacementModeString()  const
+
+ossimString ossimPixelFlipper::getReplacementModeString() const
 {
-   switch(theReplacementMode)
-   {
-      case REPLACE_BAND_IF_TARGET:
-         return ossimString("REPLACE_BAND_IF_TARGET");
-      case REPLACE_BAND_IF_PARTIAL_TARGET:
-         return ossimString("REPLACE_BAND_IF_PARTIAL_TARGET");
-      case REPLACE_ALL_BANDS_IF_PARTIAL_TARGET:
-         return ossimString("REPLACE_ALL_BANDS_IF_PARTIAL_TARGET");
-      case REPLACE_ONLY_FULL_TARGETS:
-         return ossimString("REPLACE_ONLY_FULL_TARGETS");
-      case REPLACE_ALL_BANDS_IF_ANY_TARGET:
-         return ossimString("REPLACE_ALL_BANDS_IF_ANY_TARGET");
-      default:
-         break;
+   switch (theReplacementMode)
+   {
+   case REPLACE_BAND_IF_TARGET:
+      return ossimString("REPLACE_BAND_IF_TARGET");
+   case REPLACE_BAND_IF_PARTIAL_TARGET:
+      return ossimString("REPLACE_BAND_IF_PARTIAL_TARGET");
+   case REPLACE_ALL_BANDS_IF_PARTIAL_TARGET:
+      return ossimString("REPLACE_ALL_BANDS_IF_PARTIAL_TARGET");
+   case REPLACE_ONLY_FULL_TARGETS:
+      return ossimString("REPLACE_ONLY_FULL_TARGETS");
+   case REPLACE_ALL_BANDS_IF_ANY_TARGET:
+      return ossimString("REPLACE_ALL_BANDS_IF_ANY_TARGET");
+   default:
+      break;
    }
 
    return ossimString("UNKNOWN_MODE");
 }
 
-ossimString ossimPixelFlipper::getClipModeString()  const
+ossimString ossimPixelFlipper::getClipModeString() const
 {
    if (theClipMode == BOUNDING_RECT)
       return ossimString("bounding_rect");
@@ -967,7 +969,7 @@ ossimPixelFlipper::ClipMode ossimPixelFlipper::getClipMode() const
    return theClipMode;
 }
 
-std::ostream& ossimPixelFlipper::print(std::ostream& out) const
+std::ostream &ossimPixelFlipper::print(std::ostream &out) const
 {
    out << "ossimPixelFlipper::print:"
        << "\ntarget value Lo:    " << theTargetValueLo
@@ -977,59 +979,59 @@ std::ostream& ossimPixelFlipper::print(std::ostream& out) const
        << "\nclamp value Hi:     " << theClampValueHi
        << "\nreplacement mode:   " << getReplacementModeString().c_str()
        << "\nclip_mode:          " << getClipModeString().c_str()
-      << endl;
+       << endl;
    return out;
 }
 
 ossimRefPtr<ossimProperty> ossimPixelFlipper::getProperty(
-   const ossimString& name)const
+    const ossimString &name) const
 {
    // Lock for the length of this method.
-	std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
+   std::lock_guard<std::recursive_mutex> scopeLock(theMutex);
 
    if (name == PF_TARGET_VALUE_KW)
    {
-      ossimProperty* p =
-         new ossimNumericProperty(name,
-         ossimString::toString(theTargetValueLo));
+      ossimProperty *p =
+          new ossimNumericProperty(name,
+                                   ossimString::toString(theTargetValueLo));
       p->setCacheRefreshBit();
       return ossimRefPtr<ossimProperty>(p);
    }
    if (name == PF_TARGET_RANGE_KW)
    {
-      ossimProperty* p =
-         new ossimNumericProperty(name,
-         ossimString::toString(theTargetValueLo));
+      ossimProperty *p =
+          new ossimNumericProperty(name,
+                                   ossimString::toString(theTargetValueLo));
       p->setCacheRefreshBit();
       return ossimRefPtr<ossimProperty>(p);
    }
    if (name == TARGET_UPPER_LIMIT_PROP_NAME)
    {
-      ossimProperty* p =
-         new ossimNumericProperty(name,
-         ossimString::toString(theTargetValueHi));
+      ossimProperty *p =
+          new ossimNumericProperty(name,
+                                   ossimString::toString(theTargetValueHi));
       p->setCacheRefreshBit();
       return ossimRefPtr<ossimProperty>(p);
    }
    else if (name == PF_REPLACEMENT_VALUE_KW)
    {
-      ossimProperty* p =
-         new ossimNumericProperty(name,
-                                  ossimString::toString(theReplacementValue));
-       p->setCacheRefreshBit();
+      ossimProperty *p =
+          new ossimNumericProperty(name,
+                                   ossimString::toString(theReplacementValue));
+      p->setCacheRefreshBit();
       return ossimRefPtr<ossimProperty>(p);
    }
    else if (name == PF_CLAMP_VALUE_LO_KW)
    {
-      ossimProperty* p =
-         new ossimNumericProperty(name, ossimString::toString(theClampValueLo));
+      ossimProperty *p =
+          new ossimNumericProperty(name, ossimString::toString(theClampValueLo));
       p->setCacheRefreshBit();
       return ossimRefPtr<ossimProperty>(p);
    }
    else if (name == PF_CLAMP_VALUE_HI_KW)
    {
-      ossimProperty* p =
-         new ossimNumericProperty(name, ossimString::toString(theClampValueHi));
+      ossimProperty *p =
+          new ossimNumericProperty(name, ossimString::toString(theClampValueHi));
       p->setCacheRefreshBit();
       return ossimRefPtr<ossimProperty>(p);
    }
@@ -1041,12 +1043,12 @@ ossimRefPtr<ossimProperty> ossimPixelFlipper::getProperty(
       constraintList[2] = "REPLACE_ALL_BANDS_IF_PARTIAL_TARGET";
       constraintList[3] = "REPLACE_ONLY_FULL_TARGETS";
       constraintList[4] = "REPLACE_ALL_BANDS_IF_ANY_TARGET";
-      
-      ossimStringProperty* p =
-         new ossimStringProperty(name,
-                                 getReplacementModeString(),
-                                 false,
-                                 constraintList);
+
+      ossimStringProperty *p =
+          new ossimStringProperty(name,
+                                  getReplacementModeString(),
+                                  false,
+                                  constraintList);
       p->setCacheRefreshBit();
       return ossimRefPtr<ossimProperty>(p);
    }
@@ -1056,23 +1058,23 @@ ossimRefPtr<ossimProperty> ossimPixelFlipper::getProperty(
       constraintList[0] = "none";
       constraintList[1] = "bounding_rect";
       constraintList[2] = "valid_vertices";
-      
-      ossimStringProperty* p =
-         new ossimStringProperty(name,
-                                 getClipModeString(),
-                                 false,
-                                 constraintList);
+
+      ossimStringProperty *p =
+          new ossimStringProperty(name,
+                                  getClipModeString(),
+                                  false,
+                                  constraintList);
       p->setCacheRefreshBit();
       return ossimRefPtr<ossimProperty>(p);
    }
    ossimRefPtr<ossimProperty> result = ossimSource::getProperty(name);
 
-   if(result.valid())
+   if (result.valid())
    {
-      if(result->getName() == ossimKeywordNames::ENABLED_KW)
+      if (result->getName() == ossimKeywordNames::ENABLED_KW)
       {
          result->clearChangeType();
-         
+
          // we will at least say its a radiometric change
          //
          result->setCacheRefreshBit();
@@ -1084,10 +1086,11 @@ ossimRefPtr<ossimProperty> ossimPixelFlipper::getProperty(
 
 void ossimPixelFlipper::setProperty(ossimRefPtr<ossimProperty> property)
 {
-   if (!property) return;
+   if (!property)
+      return;
 
    ossimString os = property->valueToString();
-   
+
    ossimString name = property->getName();
    if (name == PF_TARGET_VALUE_KW)
    {
@@ -1101,23 +1104,23 @@ void ossimPixelFlipper::setProperty(ossimRefPtr<ossimProperty> property)
    {
       setTargetRange(theTargetValueLo, os.toDouble());
    }
-   else if  (name == PF_REPLACEMENT_VALUE_KW)
+   else if (name == PF_REPLACEMENT_VALUE_KW)
    {
       setReplacementValue(os.toDouble());
    }
-   else if  (name == PF_REPLACEMENT_MODE_KW)
+   else if (name == PF_REPLACEMENT_MODE_KW)
    {
       setReplacementMode(os);
    }
-   else if  (name == PF_CLAMP_VALUE_LO_KW)
+   else if (name == PF_CLAMP_VALUE_LO_KW)
    {
       setClampValue(os.toDouble(), false);
    }
-   else if  (name == PF_CLAMP_VALUE_HI_KW)
+   else if (name == PF_CLAMP_VALUE_HI_KW)
    {
       setClampValue(os.toDouble(), true);
    }
-   else if  (name == PF_CLIP_MODE_KW)
+   else if (name == PF_CLIP_MODE_KW)
    {
       setClipMode(os);
    }
@@ -1128,7 +1131,7 @@ void ossimPixelFlipper::setProperty(ossimRefPtr<ossimProperty> property)
 }
 
 void ossimPixelFlipper::getPropertyNames(
-   std::vector<ossimString>& propertyNames)const
+    std::vector<ossimString> &propertyNames) const
 {
    propertyNames.push_back(PF_TARGET_VALUE_KW);
    propertyNames.push_back(TARGET_LOWER_LIMIT_PROP_NAME);
@@ -1138,11 +1141,11 @@ void ossimPixelFlipper::getPropertyNames(
    propertyNames.push_back(PF_CLAMP_VALUE_LO_KW);
    propertyNames.push_back(PF_CLAMP_VALUE_HI_KW);
    propertyNames.push_back(PF_CLIP_MODE_KW);
-   
+
    ossimImageSourceFilter::getPropertyNames(propertyNames);
 }
 
-ossimString ossimPixelFlipper::getShortName()const
+ossimString ossimPixelFlipper::getShortName() const
 {
    return ossimString("Pixel flipper");
 }
@@ -1159,24 +1162,24 @@ bool ossimPixelFlipper::inRange(ossim_float64 value) const
       //---
       return true;
    }
-   
+
    const ossim_float64 NULL_PIX = ossimImageSourceFilter::getNullPixelValue();
-   const ossim_float64 MIN_PIX  = ossimImageSourceFilter::getMinPixelValue();
-   const ossim_float64 MAX_PIX  = ossimImageSourceFilter::getMaxPixelValue();
+   const ossim_float64 MIN_PIX = ossimImageSourceFilter::getMinPixelValue();
+   const ossim_float64 MAX_PIX = ossimImageSourceFilter::getMaxPixelValue();
 
-   if ( (value == NULL_PIX) || ((value >= MIN_PIX) && (value <= MAX_PIX)) )
+   if ((value == NULL_PIX) || ((value >= MIN_PIX) && (value <= MAX_PIX)))
    {
       return true;
    }
 
    ossimNotify(ossimNotifyLevel_WARN)
-      << "\nossimPixelFlipper::inRange WARNING:"
-      << "\nvalue \"" << value
-      << "\" is out of range!"
-      << "\nInput source null = " << NULL_PIX
-      << "\nInput source min  = " << MIN_PIX
-      << "\nInput source max  = " << MAX_PIX
-      << endl;
+       << "\nossimPixelFlipper::inRange WARNING:"
+       << "\nvalue \"" << value
+       << "\" is out of range!"
+       << "\nInput source null = " << NULL_PIX
+       << "\nInput source min  = " << MIN_PIX
+       << "\nInput source max  = " << MAX_PIX
+       << endl;
 
    return false;
 }


=====================================
src/util/ossimChipperUtil.cpp
=====================================
--- a/src/util/ossimChipperUtil.cpp
+++ b/src/util/ossimChipperUtil.cpp
@@ -4838,7 +4838,9 @@ void ossimChipperUtil::initializeThumbnailProjection(const ossimIrect& originalR
          ossim_float64 thumbSize = thumbRes.toFloat64();
          ossim_float64 maxRectDimension =
             ossim::max( originalRect.width(), originalRect.height() );
-
+         ossim_uint32 tw = originalRect.width();
+         ossim_uint32 th = originalRect.height();
+         ossim_float64 scale = 1.0;      
          if ( maxRectDimension > thumbSize )
          {
             // Need to adjust scale:
@@ -4852,7 +4854,7 @@ void ossimChipperUtil::initializeThumbnailProjection(const ossimIrect& originalR
 
             if ( isChipMode()  && m_ivt.valid() ) // Chipping in image space.)
             {
-               ossim_float64 scale = thumbSize / maxRectDimension;
+               scale = thumbSize / maxRectDimension;
                if ( m_ivt->getScale().hasNans() )
                {
                   m_ivt->scale( scale, scale );
@@ -4864,7 +4866,7 @@ void ossimChipperUtil::initializeThumbnailProjection(const ossimIrect& originalR
             }
             else
             {
-               ossim_float64 scale = maxRectDimension / thumbSize;
+               scale = maxRectDimension / thumbSize;
 
                //---
                // Adjust the projection scale.  Note the "true" is to recenter
@@ -4874,7 +4876,10 @@ void ossimChipperUtil::initializeThumbnailProjection(const ossimIrect& originalR
                //---
                m_geom->applyScale(ossimDpt(scale, scale), true);
             }
-
+            tw *= scale;
+            th *= scale;
+            if(tw < 1) tw = 1;
+            if(th < 1) th = 1;
             // Must call to reset the ossimImageRenderer's bounding rect for each input.
             propagateOutputProjectionToChains();
 
@@ -4893,14 +4898,15 @@ void ossimChipperUtil::initializeThumbnailProjection(const ossimIrect& originalR
             //---
             ossim_int32 ts = thumbSize;
             bool pad = padThumbnail();
-
-            if ( ( (lr.x - ul.x + 1) > ts ) || pad )
+            if(pad)
             {
                lr.x = ul.x + ts - 1;
+               lr.y = ul.y + ts - 1;
             }
-            if ( ( (lr.y - ul.y + 1) > ts ) || pad )
+            else // let it vary
             {
-               lr.y = ul.y + ts - 1;
+               lr.x = ul.x + tw - 1;
+               lr.y = ul.y + th - 1;
             }
 
             adjustedRect = ossimIrect(ul, lr);



View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/commit/95b575bbc06ea532341d54cfa8ab49559619c082

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/commit/95b575bbc06ea532341d54cfa8ab49559619c082
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20180530/abdf3cdb/attachment-0001.html>


More information about the Pkg-grass-devel mailing list