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

Bas Couwenberg gitlab at salsa.debian.org
Tue Jul 24 07:41:38 BST 2018


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


Commits:
2145cfef by Bas Couwenberg at 2018-07-24T07:39:35+02:00
New upstream version 2.4.2
- - - - -


9 changed files:

- apps/ossim-envi-cg/ossim-envi-cg.cpp
- cmake/CMakeModules/OssimCommonVariables.cmake
- include/ossim/util/ossimChipProcTool.h
- src/imaging/ossimTiffOverviewBuilder.cpp
- src/imaging/ossimTiffWriter.cpp
- src/projection/ossimCoarseGridModel.cpp
- src/util/ossimChipProcTool.cpp
- src/util/ossimViewshedTool.cpp
- test/src/ossim-foo.cpp


Changes:

=====================================
apps/ossim-envi-cg/ossim-envi-cg.cpp
=====================================
--- a/apps/ossim-envi-cg/ossim-envi-cg.cpp
+++ b/apps/ossim-envi-cg/ossim-envi-cg.cpp
@@ -50,6 +50,8 @@ int main(int argc, char *argv[])
          ossimKeywordlist kwl;
          ossimImageGeometry geom;
          geom.setProjection(model.get());
+         ossimIpt size (model->imageSize());
+         geom.setImageSize(size);
          geom.saveState(kwl);
          kwl.write(geomFname);
       }


=====================================
cmake/CMakeModules/OssimCommonVariables.cmake
=====================================
--- a/cmake/CMakeModules/OssimCommonVariables.cmake
+++ b/cmake/CMakeModules/OssimCommonVariables.cmake
@@ -272,10 +272,6 @@ MACRO(OSSIM_ADD_COMMON_SETTINGS)
    OPTION(BUILD_OSSIM_VIDEO "Set to ON to build the video decoding library.  Use OFF to skip this module." OFF)
    OPTION(BUILD_OSSIM_PLANET "Set to ON to build the 3-D visualization module.  Use OFF to skip this module." OFF)
    OPTION(BUILD_OSSIM_GUI "Set to ON to build the new ossimGui library and geocell application." ON)
-   OPTION(BUILD_MRSID_PLUGIN "Set to ON to build the MrSID plugin library." ON)
-   OPTION(BUILD_KAKADU_PLUGIN "Set to ON to build the Kakadu plugin library." ON)
-   OPTION(BUILD_PDAL_PLUGIN "Set to ON to build the PDAL plugin library." ON)
-   OPTION(BUILD_GDAL_PLUGIN "Set to ON to build the GDAL plugin library." ON)
    OPTION(BUILD_OMS "Set to ON to build the oms api library." ON)
    OPTION(BUILD_OSSIM_WMS "Set to ON to build the wms api library." ON)
 


=====================================
include/ossim/util/ossimChipProcTool.h
=====================================
--- a/include/ossim/util/ossimChipProcTool.h
+++ b/include/ossim/util/ossimChipProcTool.h
@@ -98,6 +98,13 @@ public:
    virtual ossimRefPtr<ossimImageData> getChip(const ossimGrect& gnd_rect);
    ossimRefPtr<ossimImageData> getChip(const ossimDrect& map_bounding_rect, const ossimDpt& gsd);
 
+   /**
+    * @brief Get chip method that assumes pre-initialized state.
+    * @return ossimImageData object. This can be null/not-valid if not
+    * initialized.
+    */
+   ossimRefPtr<ossimImageData> getChip();
+
    const ossimFilename& getProductFilename() const { return m_productFilename; }
 
 protected:


=====================================
src/imaging/ossimTiffOverviewBuilder.cpp
=====================================
--- a/src/imaging/ossimTiffOverviewBuilder.cpp
+++ b/src/imaging/ossimTiffOverviewBuilder.cpp
@@ -521,7 +521,7 @@ bool ossimTiffOverviewBuilder::writeR0(TIFF* tif)
       //***
       // Tile loop in the sample (width) direction.
       //***
-      for(int j = 0; j < tilesWide; ++j)
+      for(int j = 0; (j < tilesWide)&&(!needsAborting()); ++j)
       {
          origin.x = j * m_tileWidth;
 
@@ -547,7 +547,7 @@ bool ossimTiffOverviewBuilder::writeR0(TIFF* tif)
          // Band loop.
          //***
          for (uint32 band=0;
-              band < m_imageHandler->getNumberOfOutputBands();
+              (band < m_imageHandler->getNumberOfOutputBands())&&!needsAborting();
               ++band)
          {
             tdata_t data;
@@ -775,7 +775,7 @@ bool ossimTiffOverviewBuilder::writeRn( ossimImageHandler* imageHandler,
    {
       // Tile loop in the sample (width) direction.
       ossim_uint32 x = 0;
-      for(ossim_uint32 j = 0; j < outputTilesWide; ++j)
+      for(ossim_uint32 j = 0; (j < outputTilesWide)&&!needsAborting(); ++j)
       {
          // Grab the resampled tile.
          ossimRefPtr<ossimImageData> t = sequencer->getNextTile();
@@ -792,7 +792,7 @@ bool ossimTiffOverviewBuilder::writeRn( ossimImageHandler* imageHandler,
          if ( t.valid() && ( t->getDataObjectStatus() != OSSIM_NULL ) )
          {
             // Write it to the tiff.
-            for (ossim_uint32 band = 0; band < t->getNumberOfBands(); ++band)
+            for (ossim_uint32 band = 0; (band < t->getNumberOfBands())&&!needsAborting(); ++band)
             {
                // Write the tile.
                int bytesWritten = 0;


=====================================
src/imaging/ossimTiffWriter.cpp
=====================================
--- a/src/imaging/ossimTiffWriter.cpp
+++ b/src/imaging/ossimTiffWriter.cpp
@@ -241,7 +241,16 @@ MODULE);
    }
    else
    {
-      TIFFSetField(tiffPtr, TIFFTAG_ROWSPERSTRIP, ossim_uint32(1));
+         // GP: Shouldn't this be theOutputTileSize.y ?
+         //TIFFSetField(tiffPtr, TIFFTAG_ROWSPERSTRIP, ossim_uint32(1));
+      if(theOutputTileSize.hasNans())
+      {
+            TIFFSetField(tiffPtr, TIFFTAG_ROWSPERSTRIP, ossim_uint32(1));
+      }
+      else
+      {
+            TIFFSetField(tiffPtr, TIFFTAG_ROWSPERSTRIP, ossim_uint32(theOutputTileSize.y));
+      }
    }
 
    ossim_uint32 numberOfBands = theInputConnection->getNumberOfOutputBands();


=====================================
src/projection/ossimCoarseGridModel.cpp
=====================================
--- a/src/projection/ossimCoarseGridModel.cpp
+++ b/src/projection/ossimCoarseGridModel.cpp
@@ -143,6 +143,7 @@ ossimCoarseGridModel::ossimCoarseGridModel(const ossimFilename& geom_file)
    if(geom_file.exists()&&kwl.addFile(geom_file))
    {
       loadState(kwl);
+      theGridFilename = geom_file.path();
    }
    else
    {
@@ -393,8 +394,6 @@ void ossimCoarseGridModel::buildGrid(const ossimDrect& imageBounds,
       }
    }
    getAdjustment(theInitialAdjustment);
-
-
 }
 
 void ossimCoarseGridModel::setInterpolationError(double error)


=====================================
src/util/ossimChipProcTool.cpp
=====================================
--- a/src/util/ossimChipProcTool.cpp
+++ b/src/util/ossimChipProcTool.cpp
@@ -258,7 +258,7 @@ bool ossimChipProcTool::initialize(ossimArgumentParser& ap)
 
 void ossimChipProcTool::processRemainingArgs(ossimArgumentParser& ap)
 {
-   ossim_uint32 inputIdx = 0;
+   // ossim_uint32 inputIdx = 0;
 
    bool dumpKwl = false;
    if ( ap.read("--dump-options") )
@@ -512,6 +512,16 @@ ossimRefPtr<ossimImageData> ossimChipProcTool::getChip(const ossimIrect& boundin
    return m_procChain->getTile( m_aoiViewRect, 0 );
 }
 
+ossimRefPtr<ossimImageData> ossimChipProcTool::getChip()
+{
+   ossimRefPtr<ossimImageData> chip = 0;
+   if(m_procChain.valid())
+   {
+      chip = m_procChain->getTile( m_aoiViewRect, 0 );
+   }
+   return chip;
+}
+
 ossimListenerManager* ossimChipProcTool::getManager()
 {
    return this;
@@ -925,6 +935,16 @@ void ossimChipProcTool::initializeAOI()
    m_aoiGroundRect.makeNan();
    ossimString lookup;
 
+   // Image size:
+   ossimIpt imageSize(0,0);
+   if (m_kwl.hasKey(AOI_SIZE_PIXELS_KW))
+   {
+      lookup = m_kwl.findKey( AOI_SIZE_PIXELS_KW );
+      lookup.trim();
+      imageSize.x = lookup.before(" ").toUInt32();
+      imageSize.y = lookup.after(" ").toUInt32();
+   }
+
    // The AOI rect can be specified in different ways:
    if ( m_kwl.hasKey( AOI_GEO_CENTER_KW.c_str() ) )
    {
@@ -944,9 +964,20 @@ void ossimChipProcTool::initializeAOI()
       }
       else if (m_kwl.hasKey(AOI_SIZE_PIXELS_KW))
       {
-         lookup = m_kwl.findKey( AOI_SIZE_PIXELS_KW );
-         lookup.trim();
-         ossimIpt imageSize (lookup.before(" ").toUInt32(), lookup.after(" ").toUInt32());
+         if ( (imageSize.x > 0)&& (imageSize.y > 0 ) )
+         {
+            sizeMeters.x = imageSize.x*m_gsd.x;
+            sizeMeters.y = imageSize.y*m_gsd.y;
+         }
+      }
+      if (!sizeMeters.hasNans())
+      {
+         ossimDpt metersPerDegree (centerGpt.metersPerDegree());
+         double dlat = sizeMeters.y/metersPerDegree.y/2.0;
+         double dlon = sizeMeters.x/metersPerDegree.x/2.0;
+         ossimGpt ulgpt (centerGpt.lat + dlat, centerGpt.lon - dlon);
+         ossimGpt lrgpt (centerGpt.lat - dlat, centerGpt.lon + dlon);
+         m_aoiGroundRect = ossimGrect(ulgpt, lrgpt);
          sizeMeters.x = imageSize.x*m_gsd.x;
          sizeMeters.y = imageSize.y*m_gsd.y;
       }
@@ -995,6 +1026,19 @@ void ossimChipProcTool::initializeAOI()
       ossimGpt lrgpt (minLatF , maxLonF);
       m_aoiGroundRect = ossimGrect(ulgpt, lrgpt);
       m_needCutRect = true;
+
+      if ( (imageSize.x > 0) && (imageSize.y > 0) )
+      {
+         ossimRefPtr<ossimMapProjection> mapProj =
+            dynamic_cast<ossimMapProjection*>(m_geom->getProjection());
+         if (mapProj.valid())
+         {
+            ossimDpt gsd;
+            gsd.x = std::fabs( maxLonF - minLonF ) / imageSize.x;
+            gsd.y = std::fabs( maxLatF - minLatF ) / imageSize.y;
+            mapProj->setDecimalDegreesPerPixel(gsd);
+         }
+      }
    }
 
    else if ( m_kwl.hasKey( AOI_MAP_RECT_KW ) )
@@ -1039,6 +1083,19 @@ void ossimChipProcTool::initializeAOI()
          ossimGpt lrGeo = mapProj->inverse(lrMap);
          m_aoiGroundRect = ossimGrect(ulGeo, lrGeo);
          m_needCutRect = true;
+
+         if ( (imageSize.x > 0) && (imageSize.y > 0) )
+         {
+            ossimRefPtr<ossimMapProjection> mapProj =
+               dynamic_cast<ossimMapProjection*>(m_geom->getProjection());
+            if (mapProj.valid())
+            {
+               ossimDpt gsd;
+               gsd.x = std::fabs( maxX - minX ) / imageSize.x;
+               gsd.y = std::fabs( maxY - minY ) / imageSize.y;
+               mapProj->setMetersPerPixel(gsd);
+            }
+         }
       }
    }
 


=====================================
src/util/ossimViewshedTool.cpp
=====================================
--- a/src/util/ossimViewshedTool.cpp
+++ b/src/util/ossimViewshedTool.cpp
@@ -41,6 +41,8 @@ static const string VISIBILITY_RADIUS_KW = "visibility_radius";
 static const string RETICLE_SIZE_KW      = "reticle_size";
 static const string VIEWSHED_CODING_KW   = "viewshed_coding";
 static const string AOI_SIZE_METERS_KW   = "aoi_size_meters";
+static const string THREADS_KW            = "threads";
+
 
 ossimViewshedTool::ossimViewshedTool()
 :   m_obsHgtAbvTer (1.5),
@@ -185,6 +187,11 @@ bool ossimViewshedTool::initialize(ossimArgumentParser& ap)
       m_kwl.addPair( VIEWSHED_CODING_KW, value.str() );
    }
 
+   if ( ap.read("--threads", sp1) )
+   {
+      m_kwl.addPair( THREADS_KW, ts1 );
+   }
+
    // The remaining options are available only via command line (i.e., no KWL entries defined)
    if ( ap.read("--tbs") )
       m_threadBySector = true;
@@ -192,8 +199,9 @@ bool ossimViewshedTool::initialize(ossimArgumentParser& ap)
    if ( ap.read("--simulation") )
       m_simulation = true;
 
-   if ( ap.read("--threads", sp1) )
-      m_numThreads = ossimString(ts1).toUInt32();
+   // Moved to: ossimViewshedTool::initialize(const ossimKeywordlist& kwl)
+   // if ( ap.read("--threads", sp1) )
+   //    m_numThreads = ossimString(ts1).toUInt32();
 
    if ( ap.argc() < numArgsExpected )
    {
@@ -218,6 +226,14 @@ void ossimViewshedTool::initialize(const ossimKeywordlist& kwl)
 {
    ossimString value;
 
+   value = kwl.findKey(THREADS_KW);
+   {
+      if ( value.size() )
+      {
+         m_numThreads = ossimString(value).toUInt32();
+      }
+   }
+   
    value = kwl.findKey(FOV_KW);
    if (!value.empty())
    {


=====================================
test/src/ossim-foo.cpp
=====================================
--- a/test/src/ossim-foo.cpp
+++ b/test/src/ossim-foo.cpp
@@ -109,28 +109,9 @@ int main(int argc, char *argv[])
    ossimInit::instance()->addOptions(ap);
    ossimInit::instance()->initialize(ap);
 
-   ossimFilename fname (argv[1]);
-
    try
    {
-      ossimRefPtr<ossimNitfFile> file = new ossimNitfFile();
-
-
-      if(file->parseFile(ossimFilename(argv[1])))
-      {
-         ossimRefPtr<ossimNitfImageHeader> imageHeader = file->getNewImageHeader(0);
-      
-         if(imageHeader.valid())
-         {
-            ossimRefPtr<ossimCodecBase> codec = ossimNitfCodecFactory::instance()->createCodec(imageHeader);
-            if(codec.valid())
-            {
-               std::cout << "WE WERE ABLE TO ALLOCATE A CODEC!!!!!!\n";
-            }
-         }
-      }
-
-
+      // Put your code here.
    }
    catch(const ossimException& e)
    {



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

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/commit/2145cfefb499f487e0482315dd6fe14fe635799c
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/20180724/8e1393a3/attachment-0001.html>


More information about the Pkg-grass-devel mailing list