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

Bas Couwenberg gitlab at salsa.debian.org
Thu Jan 17 06:27:14 GMT 2019


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


Commits:
bf8434b8 by Bas Couwenberg at 2019-01-17T06:00:28Z
New upstream version 2.6.2
- - - - -


12 changed files:

- apps/ossim-image-synth/ossim-image-synth.cpp
- apps/ossim-rpcgen/ossim-rpcgen.cpp
- include/ossim/base/ossimMatrix4x4.h
- include/ossim/projection/ossimMapProjection.h
- src/elevation/ossimDtedElevationDatabase.cpp
- src/elevation/ossimGeneralRasterElevationDatabase.cpp
- src/elevation/ossimSrtmElevationDatabase.cpp
- src/elevation/ossimTiledElevationDatabase.cpp
- src/projection/ossimEquDistCylProjection.cpp
- src/projection/ossimMapProjection.cpp
- src/projection/ossimRpcSolver.cpp
- src/support_data/ossimNitfFileHeader.cpp


Changes:

=====================================
apps/ossim-image-synth/ossim-image-synth.cpp
=====================================
@@ -21,10 +21,11 @@
 #include <cmath>
 #include <sstream>
 #include <iostream>
+#include <ossim/imaging/ossimImageWriterFactoryRegistry.h>
 
 using namespace std;
 
-#define USE_UINT8 false
+#define USE_UINT8 true
 
 int main(int argc, char *argv[])
 {
@@ -34,19 +35,16 @@ int main(int argc, char *argv[])
    ossimInit::instance()->addOptions(ap);
    ossimInit::instance()->initialize(ap);
    
-   if ( (ap.argc() < 4) || ap.read("-h") || ap.read("--help") )
+   if ( (ap.argc() < 2) || ap.read("-h") || ap.read("--help") )
    {
-      cout << "\nUsage: "<<ap[0]<<" <dx> <dy> <filename>\n"<<endl;
+      cout << "\nUsage: "<<ap[0]<<" <filename>\n"<<endl;
       return 0;
    }
 
-   int dx = atoi(ap[1]);
-   int dy = atoi(ap[2]);
-   ossimFilename filename = ap[3];
-   filename.setExtension(".tif");
+   ossimFilename filename = ap[1];
 
    // Establish the image geometry's map projection:
-   ossimIpt image_size (256, 256);
+   ossimIpt image_size (32, 32);
    ossimGpt observerGpt (0, 0, 0);
    ossimDpt gsd (1.0, 1.0); // must be same value in both directions
    ossimRefPtr<ossimEquDistCylProjection> mapProj = new ossimEquDistCylProjection();
@@ -80,46 +78,47 @@ int main(int argc, char *argv[])
       outImage->initialize();
    else
       return -1;
-   double A = (max - min)/2.0;
+
    outImage->fill(min);
+
+   PIXEL_TYPE step = 8;
+   PIXEL_TYPE value = 0;
    PIXEL_TYPE* buffer = ( PIXEL_TYPE*) outImage->getBuf(0);
 
-   if ((dx != 0) || (dy != 0))
+   ossim_uint32 i = 0;
+   for (int y=0; y<image_size.y; y++)
    {
-      // Allocate image buffer:
-      ossim_uint32 i = 0;
-      double phase = 0;
-
-      double dpx = 0;
-      if (dx != 0)
-         dpx = 2*M_PI/dx; // phase rate (radians per pixel)
-      double dpy = 0;
-      if (dy != 0)
-         dpy = 2*M_PI/dy; // phase rate (radians per pixel)
-
-      for (int y=0; y<image_size.y; y++)
+      for (int x=0; x<image_size.x; x++)
       {
-         phase = y*dpy;
-         for (int x=0; x<image_size.x; x++)
-         {
-            // Loops to fill one n x n chip with a single freq (1/lambda) component:
-            buffer[i++] = (PIXEL_TYPE) (A * (cos(phase) + 1.0));
-            phase += dpx;
-         }
+         buffer[i++] = value;
+         if (value == 248)
+            value = 0;
+         else
+            value += step;
       }
    }
 
+   outImage->write("tile.tif");
+   
    // Create output image chain:
    ossimRefPtr<ossimMemoryImageSource> memSource = new ossimMemoryImageSource;
    memSource->setImage(outImage);
    memSource->setImageGeometry(geometry.get());
 
-   ossimRefPtr<ossimTiffWriter> writer = new ossimTiffWriter();
+   // Create TIFF writer:
+   ossimRefPtr<ossimImageFileWriter> writer =
+      ossimImageWriterFactoryRegistry::instance()->createWriterFromExtension(filename.ext());
+   if (!writer)
+      throw runtime_error( "Unable to create writer given filename extension." );
    writer->connectMyInputTo(0, memSource.get());
    writer->setFilename(filename);
-   writer->setGeotiffFlag(true);
    bool success = writer->execute();
    //writer->writeExternalGeometryFile();
 
-   return 0;
+   if (success)
+      cout<<"Wrote "<<filename<<"\n"<<endl;
+   else
+      cout<<"Error encountered writing "<<filename<<"\n"<<endl;
+
+   return (int)success;
 }


=====================================
apps/ossim-rpcgen/ossim-rpcgen.cpp
=====================================
@@ -23,8 +23,11 @@ int main(int argc, char* argv[])
    ossimArgumentParser::ossimParameter tempParam3(tempString3);
    ossimArgumentParser::ossimParameter tempParam4(tempString4);
    ossimArgumentParser argumentParser(&argc, argv);
-   ossimInit::instance()->addOptions(argumentParser);
-   ossimInit::instance()->initialize(argumentParser);
+   ossimInit* init = ossimInit::instance();
+   init->addOptions(argumentParser);
+   init->initialize(argumentParser);
+   bool useElevation = init->getElevEnabledFlag();
+
    bool rpcFlag       = false;
    bool cgFlag       = false;
    ossimDrect imageRect;
@@ -176,7 +179,7 @@ int main(int argc, char* argv[])
    {
       // Solve for replacement RPC:
       ossimNotify(ossimNotifyLevel_INFO) << "\nSolving for RPC coefficients..." << std::endl;
-      ossimRefPtr<ossimRpcSolver> solver = new ossimRpcSolver(true, false);
+      ossimRefPtr<ossimRpcSolver> solver = new ossimRpcSolver(useElevation, false);
       bool converged = solver->solve(imageRect, geom.get(), error);
       rpc = solver->getRpcModel();
    }


=====================================
include/ossim/base/ossimMatrix4x4.h
=====================================
@@ -57,14 +57,22 @@ class OSSIM_DLL ossimMatrix4x4
      void setRotate( const ossim::Quaternion& quat);
      ossim::Quaternion getRotate()const;
      void getRotate(ossim::Quaternion& quat)const;
-     
-  ossimMatrix4x4 operator+ (const ossimMatrix4x4& rhs)const
-    {
+
+   ossimMatrix4x4 operator=(const ossimMatrix4x4& rhs)
+   {
+      theData[0][0]=rhs.theData[0][0]; theData[0][1]=rhs.theData[0][1]; theData[0][2]=rhs.theData[0][2]; theData[0][3]=rhs.theData[0][3];
+      theData[1][0]=rhs.theData[1][0]; theData[1][1]=rhs.theData[1][1]; theData[1][2]=rhs.theData[1][2]; theData[1][3]=rhs.theData[1][3];
+      theData[2][0]=rhs.theData[2][0]; theData[2][1]=rhs.theData[2][1]; theData[2][2]=rhs.theData[2][2]; theData[2][3]=rhs.theData[2][3];
+      theData[3][0]=rhs.theData[3][0]; theData[3][1]=rhs.theData[3][1]; theData[3][2]=rhs.theData[3][2]; theData[3][3]=rhs.theData[3][3];
+      return *this;
+   }
+   ossimMatrix4x4 operator+ (const ossimMatrix4x4& rhs)const
+   {
       return ossimMatrix4x4(theData[0][0] + rhs.theData[0][0], theData[0][1] + rhs.theData[0][1], theData[0][2] + rhs.theData[0][2], theData[0][3] + rhs.theData[0][3],
                             theData[1][0] + rhs.theData[1][0], theData[1][1] + rhs.theData[1][1], theData[1][2] + rhs.theData[1][2], theData[1][3] + rhs.theData[1][3],
                             theData[2][0] + rhs.theData[2][0], theData[2][1] + rhs.theData[2][1], theData[2][2] + rhs.theData[2][2], theData[2][3] + rhs.theData[2][3],
                             theData[3][0] + rhs.theData[3][0], theData[3][1] + rhs.theData[3][1], theData[3][2] + rhs.theData[3][2], theData[3][3] + rhs.theData[3][3]);
-    }
+   }
   ossimMatrix4x4 operator- (const ossimMatrix4x4& rhs)const
     {
       return ossimMatrix4x4(theData[0][0] - rhs.theData[0][0], theData[0][1] - rhs.theData[0][1], theData[0][2] - rhs.theData[0][2], theData[0][3] - rhs.theData[0][3],


=====================================
include/ossim/projection/ossimMapProjection.h
=====================================
@@ -249,6 +249,7 @@ public:
    bool getElevationLookupFlag()const;
 
    const ossimMatrix4x4& getModelTransform() const { return theModelTransform; }
+   void setModelTransform(const ossimMatrix4x4& transform);
 
    /**
     * @brief Implementation of pure virtual


=====================================
src/elevation/ossimDtedElevationDatabase.cpp
=====================================
@@ -62,7 +62,7 @@ double ossimDtedElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt)
 double ossimDtedElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
 {
    double h = getHeightAboveMSL(gpt);
-   if(h != ossim::nan())
+   if(!ossim::isnan(h))
    {
       double offset = getOffsetFromEllipsoid(gpt);
       


=====================================
src/elevation/ossimGeneralRasterElevationDatabase.cpp
=====================================
@@ -21,7 +21,7 @@ double ossimGeneralRasterElevationDatabase::getHeightAboveMSL(const ossimGpt& gp
 double ossimGeneralRasterElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
 {
    double h = getHeightAboveMSL(gpt);
-   if(h != ossim::nan())
+   if(!ossim::isnan(h))
    {
       h += getOffsetFromEllipsoid(gpt);
    }


=====================================
src/elevation/ossimSrtmElevationDatabase.cpp
=====================================
@@ -57,7 +57,7 @@ double ossimSrtmElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt)
 double ossimSrtmElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
 {
    double h = getHeightAboveMSL(gpt);
-   if(h != ossim::nan())
+   if(!ossim::isnan(h))
    {
       h += getOffsetFromEllipsoid(gpt);
    }


=====================================
src/elevation/ossimTiledElevationDatabase.cpp
=====================================
@@ -342,7 +342,7 @@ double ossimTiledElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt)
 double ossimTiledElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
 {
    double h = getHeightAboveMSL(gpt);
-   if(h != ossim::nan())
+   if(!ossim::isnan(h))
    {
       h += getOffsetFromEllipsoid(gpt);
    }


=====================================
src/projection/ossimEquDistCylProjection.cpp
=====================================
@@ -655,12 +655,16 @@ long ossimEquDistCylProjection::Convert_Equidistant_Cyl_To_Geodetic(double Easti
   {
     dy = Northing - Eqcy_False_Northing;
     dx = Easting - Eqcy_False_Easting;
-    *Latitude = dy / Ra;
+    double RaInv = 1.0/Ra;
+    *Latitude = dy *RaInv;
 
     if (Ra_Cos_Eqcy_Std_Parallel == 0)
       *Longitude = 0;
     else
-      *Longitude = Eqcy_Origin_Long + dx / Ra_Cos_Eqcy_Std_Parallel;
+    {
+       double RaCosLatInv = 1.0/Ra_Cos_Eqcy_Std_Parallel;
+      *Longitude = Eqcy_Origin_Long + dx*RaCosLatInv;
+    }
 
 //     if (*Latitude > PI_OVER_2)  /* force distorted values to 90, -90 degrees */
 //       *Latitude = PI_OVER_2;


=====================================
src/projection/ossimMapProjection.cpp
=====================================
@@ -271,6 +271,14 @@ void ossimMapProjection::update()
    updateTransform();
 }
 
+void ossimMapProjection::setModelTransform (const ossimMatrix4x4& transform)
+{
+   theModelTransform = transform;
+   theInverseModelTransform = theModelTransform;
+   theInverseModelTransform.i();
+   updateFromTransform();
+}
+
 void ossimMapProjection::updateTransform()
 {
    // Assumes model coordinates in meters:


=====================================
src/projection/ossimRpcSolver.cpp
=====================================
@@ -400,6 +400,9 @@ bool ossimRpcSolver::solve(const ossimDrect& imageBounds,
             <<theMaxResidual<<") is larger than the desired error tolerance ("<<tolerance<<" p)."
             << std::endl;
    }
+
+   // Initialize metadata:
+   theRpcModel->setMetersPerPixel(geom->getMetersPerPixel());
    return converged;
 }
 


=====================================
src/support_data/ossimNitfFileHeader.cpp
=====================================
@@ -79,6 +79,7 @@ bool ossimNitfFileHeader::getDesInformation(ossimNitfDesInformation &desInfo,
          }
       }
    }
+   return false;
 }
 
 bool  ossimNitfFileHeader::hasImages()const



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

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/commit/bf8434b8f57906760109bbfcbfca9952041beeec
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/20190117/2930ad7e/attachment-0001.html>


More information about the Pkg-grass-devel mailing list