[Git][debian-gis-team/ossim][experimental] 23 commits: Revert "Update branch in gbp.conf & Vcs-Git URL."
Bas Couwenberg
gitlab at salsa.debian.org
Fri Aug 24 09:40:08 BST 2018
Bas Couwenberg pushed to branch experimental at Debian GIS Project / ossim
Commits:
9f01c8db by Bas Couwenberg at 2018-05-30T14:07:46Z
Revert "Update branch in gbp.conf & Vcs-Git URL."
This reverts commit 1e92071ac97d140b00359bcfe448ece0480f52c1.
- - - - -
354173d5 by Bas Couwenberg at 2018-06-01T06:20:31Z
Move from experimental to unstable.
- - - - -
6fbca332 by Bas Couwenberg at 2018-06-29T05:22:44Z
New upstream version 2.4.1
- - - - -
57097616 by Bas Couwenberg at 2018-06-29T05:22:53Z
Merge tag 'upstream/2.4.1'
Upstream version 2.4.1
- - - - -
98de7a1a by Bas Couwenberg at 2018-06-29T05:23:12Z
New upstream release.
- - - - -
f27f6cab by Bas Couwenberg at 2018-06-29T05:24:35Z
Set distribution to unstable.
- - - - -
bdd78709 by Bas Couwenberg at 2018-07-05T08:48:45Z
Bump Standards-Version to 4.1.5, no changes.
- - - - -
2145cfef by Bas Couwenberg at 2018-07-24T05:39:35Z
New upstream version 2.4.2
- - - - -
e26fb8ff by Bas Couwenberg at 2018-07-24T05:39:42Z
Merge tag 'upstream/2.4.2'
Upstream version 2.4.2
- - - - -
68538350 by Bas Couwenberg at 2018-07-24T05:40:35Z
New upstream release.
- - - - -
c24432c4 by Bas Couwenberg at 2018-07-24T05:41:25Z
Refresh patches.
- - - - -
1b183aa4 by Bas Couwenberg at 2018-07-24T06:05:10Z
Update lintian override for spelling-error-in-binary.
- - - - -
df9ea594 by Bas Couwenberg at 2018-07-24T06:05:10Z
Set distribution to experimental.
- - - - -
2789df85 by Bas Couwenberg at 2018-08-01T09:36:36Z
Drop autopkgtest to test installability.
- - - - -
f001a25c by Bas Couwenberg at 2018-08-01T09:36:43Z
Add lintian override for testsuite-autopkgtest-missing.
- - - - -
cdf70811 by Bas Couwenberg at 2018-08-01T09:37:03Z
Set distribution to unstable.
- - - - -
f78f230b by Bas Couwenberg at 2018-08-05T18:40:19Z
Bump Standards-Version to 4.2.0, no changes.
- - - - -
16857d5b by Bas Couwenberg at 2018-08-15T17:02:31Z
Update watch file to limit matches to archive path.
- - - - -
167d611f by Bas Couwenberg at 2018-08-24T07:14:14Z
Update branch in gbp.conf & Vcs-Git URL.
- - - - -
546bd5af by Bas Couwenberg at 2018-08-24T07:14:53Z
New upstream version 2.5.0
- - - - -
a12fe5c1 by Bas Couwenberg at 2018-08-24T07:14:57Z
Merge tag 'upstream/2.5.0' into experimental
Upstream version 2.5.0
- - - - -
e22a24c3 by Bas Couwenberg at 2018-08-24T07:15:16Z
New upstream release.
- - - - -
da681207 by Bas Couwenberg at 2018-08-24T07:44:14Z
Set distribution to experimental.
- - - - -
28 changed files:
- + apps/ossim-envi-cg/CMakeLists.txt
- + apps/ossim-envi-cg/ossim-envi-cg.cpp
- cmake/CMakeModules/OssimCommonVariables.cmake
- debian/changelog
- debian/control
- debian/libossim1.lintian-overrides
- debian/patches/spelling-errors.patch
- + debian/source/lintian-overrides
- − debian/tests/control
- debian/watch
- include/ossim/base/ossimGpt.h
- include/ossim/imaging/ossimImageGeometry.h
- include/ossim/imaging/ossimImageRenderer.h
- + include/ossim/projection/ossimEnviCgModel.h
- include/ossim/projection/ossimImageViewTransform.h
- include/ossim/util/ossimChipProcTool.h
- + sonar-project.properties
- src/imaging/ossimImageGeometry.cpp
- src/imaging/ossimImageRenderer.cpp
- src/imaging/ossimTiffOverviewBuilder.cpp
- src/imaging/ossimTiffWriter.cpp
- src/projection/ossimCoarseGridModel.cpp
- + src/projection/ossimEnviCgModel.cpp
- src/projection/ossimImageViewTransform.cpp
- src/projection/ossimRsmModel.cpp
- src/util/ossimChipProcTool.cpp
- src/util/ossimViewshedTool.cpp
- test/src/ossim-foo.cpp
Changes:
=====================================
apps/ossim-envi-cg/CMakeLists.txt
=====================================
--- /dev/null
+++ b/apps/ossim-envi-cg/CMakeLists.txt
@@ -0,0 +1,2 @@
+FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
+OSSIM_SETUP_APPLICATION(ossim-envi-cg INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
=====================================
apps/ossim-envi-cg/ossim-envi-cg.cpp
=====================================
--- /dev/null
+++ b/apps/ossim-envi-cg/ossim-envi-cg.cpp
@@ -0,0 +1,72 @@
+//---
+//
+// License: MIT
+//
+//---
+
+// System includes:
+#include <cmath>
+#include <memory>
+#include <sstream>
+#include <iostream>
+
+// ossim includes: These are here just to save time/typing...
+#include <ossim/base/ossimApplicationUsage.h>
+#include <ossim/base/ossimArgumentParser.h>
+#include <ossim/base/ossimConnectableObject.h>
+#include <ossim/base/ossimException.h>
+#include <ossim/base/ossimNotify.h>
+#include <ossim/base/ossimObjectFactoryRegistry.h>
+#include <ossim/init/ossimInit.h>
+#include <ossim/base/Thread.h>
+#include <ossim/projection/ossimEnviCgModel.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+
+// Put your includes here:
+
+int main(int argc, char *argv[])
+{
+ int returnCode = 0;
+ if (argc < 2)
+ {
+ cout<<"\nUsage: "<<argv[0]<<" <filename.geoc>\n"<<endl;
+ return 1;
+ }
+
+ ossimArgumentParser ap(&argc, argv);
+ ossimInit::instance()->addOptions(ap);
+ ossimInit::instance()->initialize(ap);
+
+ ossimFilename fname (argv[1]);
+
+ try
+ {
+ ossimRefPtr<ossimEnviCgModel> model = new ossimEnviCgModel;
+ if (model->loadEnviGeocFile(fname))
+ {
+ ossimFilename geomFname(fname);
+ geomFname.setExtension("geom");
+ model->saveCoarseGrid(geomFname);
+ ossimKeywordlist kwl;
+ ossimImageGeometry geom;
+ geom.setProjection(model.get());
+ ossimIpt size (model->imageSize());
+ geom.setImageSize(size);
+ geom.saveState(kwl);
+ kwl.write(geomFname);
+ }
+ }
+ catch(const ossimException& e)
+ {
+ ossimNotify(ossimNotifyLevel_WARN) << e.what() << std::endl;
+ returnCode = 1;
+ }
+ catch( ... )
+ {
+ ossimNotify(ossimNotifyLevel_WARN)
+ << "ossim-foo caught unhandled exception!" << std::endl;
+ returnCode = 1;
+ }
+
+ return returnCode;
+}
=====================================
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)
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,44 @@
+ossim (2.5.0-1~exp1) experimental; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+ * Bump Standards-Version to 4.2.0, no changes.
+ * Update watch file to limit matches to archive path.
+
+ -- Bas Couwenberg <sebastic at debian.org> Fri, 24 Aug 2018 09:15:55 +0200
+
+ossim (2.4.2-2) unstable; urgency=medium
+
+ * Team upload.
+ * Drop autopkgtest to test installability.
+ * Add lintian override for testsuite-autopkgtest-missing.
+
+ -- Bas Couwenberg <sebastic at debian.org> Wed, 01 Aug 2018 11:36:44 +0200
+
+ossim (2.4.2-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+ * Bump Standards-Version to 4.1.5, no changes.
+ * Refresh patches.
+ * Update lintian override for spelling-error-in-binary.
+
+ -- Bas Couwenberg <sebastic at debian.org> Tue, 24 Jul 2018 07:41:26 +0200
+
+ossim (2.4.1-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Fri, 29 Jun 2018 07:24:22 +0200
+
+ossim (2.4.0-1) unstable; urgency=medium
+
+ * Team upload.
+ * Move from experimental to unstable.
+
+ -- Bas Couwenberg <sebastic at debian.org> Wed, 30 May 2018 16:08:12 +0200
+
ossim (2.4.0-1~exp1) experimental; urgency=medium
* Team upload.
=====================================
debian/control
=====================================
--- a/debian/control
+++ b/debian/control
@@ -14,7 +14,7 @@ Build-Depends: cmake (>= 2.8),
libpng-dev,
libtiff-dev,
zlib1g-dev
-Standards-Version: 4.1.4
+Standards-Version: 4.2.0
Vcs-Browser: https://salsa.debian.org/debian-gis-team/ossim
Vcs-Git: https://salsa.debian.org/debian-gis-team/ossim.git -b experimental
Homepage: https://trac.osgeo.org/ossim/
=====================================
debian/libossim1.lintian-overrides
=====================================
--- a/debian/libossim1.lintian-overrides
+++ b/debian/libossim1.lintian-overrides
@@ -1,6 +1,7 @@
# Symbols are problematic for C++ libraries, shlibs is used instead.
-libossim1: no-symbols-control-file usr/lib/libossim.so.*
+no-symbols-control-file usr/lib/libossim.so.*
# False positive, string not included in source.
-libossim1: spelling-error-in-binary usr/lib/libossim.so.* PROCES PROCESS
+spelling-error-in-binary usr/lib/libossim.so.* PROCES PROCESS
+spelling-error-in-binary usr/lib/libossim.so.* nam name
=====================================
debian/patches/spelling-errors.patch
=====================================
--- a/debian/patches/spelling-errors.patch
+++ b/debian/patches/spelling-errors.patch
@@ -199,7 +199,7 @@ Author: Bas Couwenberg <sebastic at debian.org>
handler->setFilename(ossimFilename(value));
--- a/src/util/ossimChipProcTool.cpp
+++ b/src/util/ossimChipProcTool.cpp
-@@ -1054,7 +1054,7 @@ void ossimChipProcTool::initializeAOI()
+@@ -1111,7 +1111,7 @@ void ossimChipProcTool::initializeAOI()
// Geo-scaled projection needs to know the reference latitude:
if (m_geoScaled)
{
=====================================
debian/source/lintian-overrides
=====================================
--- /dev/null
+++ b/debian/source/lintian-overrides
@@ -0,0 +1,3 @@
+# Not worth the effort
+testsuite-autopkgtest-missing
+
=====================================
debian/tests/control deleted
=====================================
--- a/debian/tests/control
+++ /dev/null
@@ -1,3 +0,0 @@
-# Test installability
-Depends: @
-Test-Command: /bin/true
=====================================
debian/watch
=====================================
--- a/debian/watch
+++ b/debian/watch
@@ -5,4 +5,4 @@ uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/;s/RC/rc/;
filenamemangle=s/(?:.*?)?(?:rel|v|ossim|\w+?)?[\-\_]?(\d\S+)\.(tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))/ossim-$1.$2/,\
repacksuffix=+ds \
https://github.com/ossimlabs/ossim/releases \
-(?:.*?/)?(?:rel|v|ossim|\w+?)?[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
+(?:.*?/archive/)?(?:rel|v|ossim|\w+?)?[\-\_]?(\d[\d\-\.]+)\.(?:tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
=====================================
include/ossim/base/ossimGpt.h
=====================================
--- a/include/ossim/base/ossimGpt.h
+++ b/include/ossim/base/ossimGpt.h
@@ -26,128 +26,136 @@
#include <ossim/base/ossimString.h>
#include <iosfwd>
-class ossimDatum;
+class ossimDatum;
class OSSIM_DLL ossimGpt
{
public:
- /**
+ /**
* Constructor. The values are assumed to be in DEGREES.
*/
- ossimGpt(const double alat=0, // degrees
- const double alon=0, // degrees
- const double ahgt=0,
- const ossimDatum* aDatum=ossimDatumFactory::instance()->wgs84())
+ ossimGpt(const double alat = 0, // degrees
+ const double alon = 0, // degrees
+ const double ahgt = 0,
+ const ossimDatum *aDatum = ossimDatumFactory::instance()->wgs84())
: lat(alat),
lon(alon),
- hgt(ahgt), // relative to the ellipsoid
- theDatum(aDatum) {}//limitLonTo180();}
+ hgt(ahgt), // relative to the ellipsoid
+ theDatum(aDatum)
+ {
+ } //limitLonTo180();}
- /**
+ /**
* Copy Constructor:
*/
- ossimGpt(const ossimGpt& src);
-
- /**
+ ossimGpt(const ossimGpt &src);
+
+ /**
* Constructor. Conversion from geocentric to ground.
*/
- ossimGpt(const ossimEcefPoint &aPt,
- const ossimDatum* aDatum=ossimDatumFactory::instance()->wgs84());
+ ossimGpt(const ossimEcefPoint &aPt,
+ const ossimDatum *aDatum = ossimDatumFactory::instance()->wgs84());
- /**
+ /**
* Argument aPt (x, y, z) is understood to represent (lon, lat, hgt) relative to WGS84 datum.
*/
- ossimGpt(const ossimDpt3d &aPt) :
- lat(aPt.y), lon(aPt.x), hgt(aPt.z), theDatum(ossimDatumFactory::instance()->wgs84()) {}
+ ossimGpt(const ossimDpt3d &aPt) : lat(aPt.y), lon(aPt.x), hgt(aPt.z), theDatum(ossimDatumFactory::instance()->wgs84()) {}
- /**
+ /**
* latr(). Returns the latitude in radian measure.
*/
- double latr()const{return lat*RAD_PER_DEG;}
+ double latr() const { return lat * RAD_PER_DEG; }
- /**
+ /**
* Returns the latitude in radian measure.
*/
- void latr(double radianValue){lat = radianValue*DEG_PER_RAD;}
+ void latr(double radianValue) { lat = radianValue * DEG_PER_RAD; }
- /**
+ /**
* Returns the longitude in radian measure.
*/
- double lonr()const{return lon*RAD_PER_DEG;}
+ double lonr() const { return lon * RAD_PER_DEG; }
- /**
+ /**
* Assumes the value being passed in is in radians.
*/
- void lonr(double radianValue)
- {lon = radianValue*DEG_PER_RAD; }//limitLonTo180();}
+ void lonr(double radianValue)
+ {
+ lon = radianValue * DEG_PER_RAD;
+ } //limitLonTo180();}
- /**
+ /**
* Will convert the radian measure to degrees.
*/
- double latd()const{return lat;}
+ double latd() const { return lat; }
- /**
+ /**
* Assumes the passed in value is in degrees.
*/
- void latd(double degreeValue){lat = degreeValue;}
+ void latd(double degreeValue) { lat = degreeValue; }
- /**
+ /**
* Will convert the radian measure to degrees.
*/
- double lond()const{return lon;}
+ double lond() const { return lon; }
- /**
+ /**
* Assumes the passed in value is in degrees.
*/
- void lond(double degreeValue){lon = degreeValue; }//limitLonTo180();}
+ void lond(double degreeValue) { lon = degreeValue; } //limitLonTo180();}
- /**
+ /**
* @return Returns the height in meters above the ellipsoid.
*/
- double height()const{return hgt;}
+ double height() const { return hgt; }
- /**
+ /**
* @return Returns the height in meters above mean sea level (msl).
*
* @note This is the height above the ellipsoid minus any geoid offset.
*/
- double heightMSL() const;
+ double heightMSL() const;
- /**
+ /**
* Sets the "hgt" data member to height.
*
* @param height Height above the ellipsoid in meters.
*/
- void height(double height){hgt = height;}
+ void height(double height) { hgt = height; }
- /**
+ /**
* Sets the "hgt" data member to heightMsl adding any geiod offset.
*
* @param heightMSL Height in meters above msl.
*/
- void heightMSL(double heightMSL);
-
- void makeNan(){lat=ossim::nan(); lon=ossim::nan(); hgt=ossim::nan();}
- bool isNan()const
- {
- return (ossim::isnan(lat)&&ossim::isnan(lon)&&ossim::isnan(hgt));
- }
- bool hasNans()const
- {
- return (ossim::isnan(lat)||ossim::isnan(lon)||ossim::isnan(hgt));
- }
- bool isLatNan()const{return ossim::isnan(lat);}
- bool isLonNan()const{return ossim::isnan(lon);}
- bool isLonLatNan()const{return (ossim::isnan(lat)||ossim::isnan(lon));}
- bool isLatLonNan() const{return (ossim::isnan(lat)||ossim::isnan(lon));}
- bool isHgtNan()const{return ossim::isnan(hgt);}
-
- std::ostream& print(std::ostream& os, ossim_uint32 precision=15) const;
-
- friend OSSIMDLLEXPORT std::ostream& operator<<(std::ostream& os,
- const ossimGpt& pt);
-
- /**
+ void heightMSL(double heightMSL);
+
+ void makeNan()
+ {
+ lat = ossim::nan();
+ lon = ossim::nan();
+ hgt = ossim::nan();
+ }
+ bool isNan() const
+ {
+ return (ossim::isnan(lat) && ossim::isnan(lon) && ossim::isnan(hgt));
+ }
+ bool hasNans() const
+ {
+ return (ossim::isnan(lat) || ossim::isnan(lon) || ossim::isnan(hgt));
+ }
+ bool isLatNan() const { return ossim::isnan(lat); }
+ bool isLonNan() const { return ossim::isnan(lon); }
+ bool isLonLatNan() const { return (ossim::isnan(lat) || ossim::isnan(lon)); }
+ bool isLatLonNan() const { return (ossim::isnan(lat) || ossim::isnan(lon)); }
+ bool isHgtNan() const { return ossim::isnan(hgt); }
+
+ std::ostream &print(std::ostream &os, ossim_uint32 precision = 15) const;
+
+ friend OSSIMDLLEXPORT std::ostream &operator<<(std::ostream &os,
+ const ossimGpt &pt);
+
+ /**
* @param precision Output floating point precision.
*
* @return ossimString representing point.
@@ -156,9 +164,9 @@ public:
* ( 30.00000000000000, -90.00000000000000, 0.00000000000000, WGE )
* -----latitude---- -----longitude---- ------height---- datum
*/
- ossimString toString(ossim_uint32 precision=15) const;
+ ossimString toString(ossim_uint32 precision = 15) const;
- /**
+ /**
* Initializes this point from string. This method opens an istream to
* s and then calls operator>>.
*
@@ -170,9 +178,9 @@ public:
*
* @see operator>>
*/
- void toPoint(const std::string& s);
-
- /**
+ void toPoint(const std::string &s);
+
+ /**
* Method to input the formatted string of the "operator<<".
*
* This method starts by doing a "makeNan" on aPt. So if anything goes
@@ -186,174 +194,188 @@ public:
* ( 30.00000000000000, -90.00000000000000, 0.00000000000000, WGE )
* -----latitude---- -----longitude---- ------height---- datum
*/
- friend OSSIMDLLEXPORT std::istream& operator>>(std::istream& is,
- ossimGpt& pt);
+ friend OSSIMDLLEXPORT std::istream &operator>>(std::istream &is,
+ ossimGpt &pt);
- /**
+ /**
* datum(). returns the datum associated with this ground.
*
*/
- const ossimDatum* datum()const{return theDatum;}
+ const ossimDatum *datum() const { return theDatum; }
- /**
+ /**
* Note: this will not do a shift. This just allows you to set the datum.
* If you want an automatic shift to occur then you must call the
* changeDatum method
*/
- void datum(const ossimDatum* aDatum){theDatum = aDatum?aDatum:theDatum;}
+ void datum(const ossimDatum *aDatum) { theDatum = aDatum ? aDatum : theDatum; }
- /**
+ /**
* This will actually perform a shift.
*/
- void changeDatum(const ossimDatum *datum);
+ void changeDatum(const ossimDatum *datum);
+
+ const ossimGpt &operator=(const ossimGpt &aPt);
+ bool operator==(const ossimGpt &gpt) const;
- const ossimGpt& operator = (const ossimGpt &aPt);
- bool operator ==(const ossimGpt& gpt)const;
+ bool operator!=(const ossimGpt &gpt) const { return !(*this == gpt); }
- bool operator != (const ossimGpt& gpt) const { return !(*this == gpt); }
-
- /**
+ /**
* METHOD: limitLonTo180()
* Converts the lon data member to a value between -180 and +180:
*/
- void limitLonTo180()
- { if (lon <= -180.0) lon += 360.0; else if (lon > 180.0) lon -= 360.0; }
-
- /**
+ void limitLonTo180()
+ {
+ if (lon <= -180.0)
+ lon += 360.0;
+ else if (lon > 180.0)
+ lon -= 360.0;
+ }
+
+ /**
* @brief Wrap method to maintain longitude between -180 and +180 and latitude between
* -90 and +90. Inlined below.
*/
- void wrap();
-
- void clampLon(double low, double high)
- {
- if(lon < low) lon = low;
- if(lon > high) lon = high;
- }
-
- void clampLat(double low, double high)
- {
- if(lat < low) lat = low;
- if(lat > high) lat = high;
- }
-
- void clampHgt(double low, double high)
- {
- if(hgt < low) hgt = low;
- if(hgt > high) hgt = high;
- }
-
- /**
+ void wrap();
+
+ void clampLon(double low, double high)
+ {
+ if (lon < low)
+ lon = low;
+ if (lon > high)
+ lon = high;
+ }
+
+ void clampLat(double low, double high)
+ {
+ if (lat < low)
+ lat = low;
+ if (lat > high)
+ lat = high;
+ }
+
+ void clampHgt(double low, double high)
+ {
+ if (hgt < low)
+ hgt = low;
+ if (hgt > high)
+ hgt = high;
+ }
+
+ /**
* METHOD: distanceTo(ossimGpt)
* Computes straight-line distance in meters between this and arg gpt:
*/
- double distanceTo(const ossimGpt& arg_gpt) const;
+ double distanceTo(const ossimGpt &arg_gpt) const;
- /**
+ /**
* METHOD: azimuthTo(ossimGpt)
* Computes the great-circle starting azimuth (i.e., at this gpt) to the argument gpt in degrees.
* In other words, what direction we would need to start walking in to travel the shortest
* distance to arg_gpt (assumes spherical earth)
*/
- double azimuthTo(const ossimGpt& arg_gpt) const;
+ double azimuthTo(const ossimGpt &arg_gpt) const;
+
+ ossimDpt metersPerDegree() const;
- ossimDpt metersPerDegree() const;
-
- ossimString toDmsString()const;
+ ossimString toDmsString() const;
- bool isEqualTo(const ossimGpt& rhs, ossimCompareType compareType=OSSIM_COMPARE_FULL)const;
- ossim_float64 lat; //> latitude in degrees measure
- ossim_float64 lon; //> longitude in degrees measure
+ bool isEqualTo(const ossimGpt &rhs, ossimCompareType compareType = OSSIM_COMPARE_FULL) const;
+ ossim_float64 lat; //> latitude in degrees measure
+ ossim_float64 lon; //> longitude in degrees measure
- /**
+ /**
* Height in meters above the ellipsiod.
*
* @note This is NOT the same as "height msl". "Height msl" is above
* the geoid or better know as mean sea level.
- */
- ossim_float64 hgt;
+ */
+ ossim_float64 hgt;
private:
-
- /**
+ /**
* Know reference location plus an implied ellipsoid.
*/
- const ossimDatum* theDatum;
-
+ const ossimDatum *theDatum;
};
-inline const ossimGpt& ossimGpt::operator=(const ossimGpt& aPt)
+inline const ossimGpt &ossimGpt::operator=(const ossimGpt &aPt)
{
- if ( this != &aPt )
- {
- lat = aPt.lat;
- lon = aPt.lon;
- hgt = aPt.hgt;
-
- if(aPt.datum())
- {
- theDatum = aPt.datum();
- }
- if(!theDatum)
- {
- theDatum = ossimDatumFactory::instance()->wgs84();
- }
- }
- return *this;
+ if (this != &aPt)
+ {
+ lat = aPt.lat;
+ lon = aPt.lon;
+ hgt = aPt.hgt;
+
+ if (aPt.datum())
+ {
+ theDatum = aPt.datum();
+ }
+ if (!theDatum)
+ {
+ theDatum = ossimDatumFactory::instance()->wgs84();
+ }
+ }
+ return *this;
}
inline void ossimGpt::wrap()
{
- if ( lon > 180.0 )
- {
+ // only wrap if values are not nan
+ // may want to change this to isbad because
+ // hey could be INF instead of NAN
+ if (ossim::isnan(lon) || ossim::isnan(lat))
+ return;
+ if (lon > 180.0)
+ {
+ do
+ {
+ lon = lon - 360.0;
+ } while (lon > 180.0);
+ }
+ else if (lon < -180.0)
+ {
+ do
+ {
+ lon = lon + 360.0;
+ } while (lon < -180.0);
+ }
+ if (lat > 90.0)
+ {
+ if (lat > 360.0) // Remove total wraps.
+ {
do
{
- lon = lon - 360.0;
- } while ( lon > 180.0 );
- }
- else if ( lon < -180.0 )
- {
+ lat = lat - 360.0;
+ } while (lat > 360.0);
+ }
+ if (lat > 270.0) // Between 270 and 360.
+ {
+ lat = lat - 360.0;
+ }
+ else if (lat > 90) // Between 90 and 270.
+ {
+ lat = 180.0 - lat;
+ }
+ }
+ else if (lat < -90.0)
+ {
+ if (lat < -360.0) // Remove total wraps.
+ {
do
{
- lon = lon + 360.0;
- } while ( lon < -180.0 );
- }
- if ( lat > 90.0 )
- {
- if ( lat > 360.0 ) // Remove total wraps.
- {
- do
- {
- lat = lat - 360.0;
- } while ( lat > 360.0);
- }
- if ( lat > 270.0 ) // Between 270 and 360.
- {
- lat = lat - 360.0;
- }
- else if ( lat > 90 ) // Between 90 and 270.
- {
- lat = 180.0 - lat;
- }
- }
- else if ( lat < -90.0 )
- {
- if ( lat < -360.0 ) // Remove total wraps.
- {
- do
- {
- lat = lat + 360.0;
- } while ( lat < -360.0);
- }
- if ( lat < -270.0 )
- {
- lat = 360.0 + lat; // Between -270 and -360;
- }
- else if ( lat < -90.0 )
- {
- lat = -180.0 - lat;
- }
- }
+ lat = lat + 360.0;
+ } while (lat < -360.0);
+ }
+ if (lat < -270.0)
+ {
+ lat = 360.0 + lat; // Between -270 and -360;
+ }
+ else if (lat < -90.0)
+ {
+ lat = -180.0 - lat;
+ }
+ }
}
#endif /* #ifndef ossimGpt_HEADER */
=====================================
include/ossim/imaging/ossimImageGeometry.h
=====================================
--- a/include/ossim/imaging/ossimImageGeometry.h
+++ b/include/ossim/imaging/ossimImageGeometry.h
@@ -166,6 +166,13 @@ public:
ossimProjection* getProjection() { return m_projection.get(); }
/**
+ * @brief Returns true if underlying projection is derived from
+ * ossimMapProjection.
+ * @return true if map projected; false, if not.
+ */
+ bool isMapProjected() const;
+
+ /**
* @return const ossimMapProjection* or NULL if projection not set or not
* derived from ossimMapProjection.
*/
=====================================
include/ossim/imaging/ossimImageRenderer.h
=====================================
--- a/include/ossim/imaging/ossimImageRenderer.h
+++ b/include/ossim/imaging/ossimImageRenderer.h
@@ -214,7 +214,8 @@ private:
ossimDpt computeRoundTripErrorViewPt(const ossimDpt& dpt)const;
bool isViewAPoint()const;
bool isIdentity()const;
- bool canBilinearInterpolate(double error)const;
+ //bool canBilinearInterpolate(double error) const;
+ bool canBilinearInterpolate() const;
ossimDpt getParametricCenter(const ossimDpt& ul, const ossimDpt& ur,
const ossimDpt& lr, const ossimDpt& ll)const;
@@ -321,7 +322,7 @@ private:
* renderers together. So if we have one
* renderer doing a scale and they pass an r-level
* down and we have another renderer within the
- * chain he will be starting at a different r-level.
+ * chain we will be starting at a different r-level.
* The default will be r-level 0 request coming
* from the right.
*/
@@ -338,8 +339,11 @@ private:
ossimPolyArea2d m_viewArea;
bool m_crossesDateline;
-
-TYPE_DATA
+
+ double m_averageViewToImageScale;
+ double m_averageViewToImageRLevelScale;
+
+ TYPE_DATA
};
inline ossimImageRenderer::ossimRendererSubRectInfo::ossimRendererSubRectInfo(ossimImageViewTransform* transform)
=====================================
include/ossim/projection/ossimEnviCgModel.h
=====================================
--- /dev/null
+++ b/include/ossim/projection/ossimEnviCgModel.h
@@ -0,0 +1,28 @@
+//*******************************************************************
+//
+// License: See top level LICENSE.txt file.
+//
+//*******************************************************************
+
+#ifndef ossimEnviCgModel_HEADER
+#define ossimEnviCgModel_HEADER
+
+#include <ossim/projection/ossimCoarseGridModel.h>
+#include <ossim/base/ossimFilename.h>
+
+class OSSIMDLLEXPORT ossimEnviCgModel : public ossimCoarseGridModel
+{
+public:
+ ossimEnviCgModel();
+ ossimEnviCgModel(const ossimFilename& geoc_file);
+
+ bool loadEnviGeocFile(const ossimFilename& geoc_file);
+ bool saveState(ossimKeywordlist& kwl, const char* prefix=0) const;
+
+private:
+ double readValue(ifstream& s, bool bigEndian) const;
+
+TYPE_DATA
+};
+
+#endif
=====================================
include/ossim/projection/ossimImageViewTransform.h
=====================================
--- a/include/ossim/projection/ossimImageViewTransform.h
+++ b/include/ossim/projection/ossimImageViewTransform.h
@@ -57,7 +57,7 @@ public:
*/
virtual void getImageToViewScale(ossimDpt& resultScale,
const ossimDpt& imagePoint,
- const ossimDpt& deltaImagePointXY)const;
+ const ossimDpt& deltaImagePointXY=ossimDpt(1.0,1.0))const;
/*!
* If it needs to it will use the information passed in to get the
@@ -70,10 +70,10 @@ public:
* of one. We have to see how this works before we actually keep this
* implementation.
*/
- virtual void getViewToImageScale(ossimDpt& resultScale,
- const ossimDpt& imagePoint,
- const ossimDpt& deltaImagePointXY)const;
-
+ virtual void getViewToImageScale(ossimDpt &resultScale,
+ const ossimDpt &imagePoint,
+ const ossimDpt &deltaImagePointXY = ossimDpt(1.0, 1.0)) const;
+
virtual void imageToView(const ossimDpt& imagePoint,
ossimDpt& viewPoint)const;
@@ -114,7 +114,7 @@ public:
/** Computes the bounding rect in image space of the quad formed by the transformed view points
* of the input rect corners. */
virtual ossimDrect getViewToImageBounds(const ossimDrect& viewRect) const;
-
+
virtual bool loadState(const ossimKeywordlist& kwl,
const char* prefix =0);
=====================================
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:
=====================================
sonar-project.properties
=====================================
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,15 @@
+# must be unique in a given SonarQube instance
+sonar.projectKey=ossim
+sonar.projectVersion=1.0
+
+# source-code location folder
+sonar.sources=src
+
+# source-code language
+sonar.language=c++
+
+# Verbose output
+sonar.verbose=true
+
+# Encoding of the source code. Default is default system encoding
+sonar.sourceEncoding=UTF-8
=====================================
src/imaging/ossimImageGeometry.cpp
=====================================
--- a/src/imaging/ossimImageGeometry.cpp
+++ b/src/imaging/ossimImageGeometry.cpp
@@ -1079,6 +1079,10 @@ void ossimImageGeometry::getImageEdgePoints(std::vector<ossimDpt>& result, ossim
// error out
return;
}
+
+ // Make edge to edge.
+ imageRect.expand( ossimDpt(0.5, 0.5) );
+
result.clear();
// First get the image points we will be transforming
if(partitions > 2)
@@ -1151,7 +1155,7 @@ void ossimImageGeometry::calculatePolyBounds(ossimPolyArea2d& result, ossim_uint
ossimDpt(180,90),
ossimDpt(180,-90));
getBoundingRect(imageRect);
- bool affectedByElevation = isAffectedByElevation();
+ // bool affectedByElevation = isAffectedByElevation();
bool crossesDateline = getCrossesDateline();
result.clear();
if(imageRect.hasNans())
@@ -1221,7 +1225,6 @@ void ossimImageGeometry::calculatePolyBounds(ossimPolyArea2d& result, ossim_uint
}
else
{
- ossim_uint32 idx=0;
for(std::vector<ossimDpt>::const_iterator iter=points.begin();
iter != points.end();++iter)
{
@@ -1674,3 +1677,9 @@ ossim_float64 ossimImageGeometry::northUpAngle()const
return result;
} // End: ossimImageGeometry::northUpAngle()
+
+bool ossimImageGeometry::isMapProjected() const
+{
+ return dynamic_cast<const ossimMapProjection*>( m_projection.get() ) != 0;
+}
+
=====================================
src/imaging/ossimImageRenderer.cpp
=====================================
--- a/src/imaging/ossimImageRenderer.cpp
+++ b/src/imaging/ossimImageRenderer.cpp
@@ -380,7 +380,7 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::tooBig()const
ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
{
- #if 0
+ #if 1
ossim_uint16 result = SPLIT_NONE;
ossimDrect vRect = getViewRect();
@@ -389,7 +389,7 @@ ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
// very small rectangles in canBilinearInterpolate(...) method.
// DRB 05 Dec. 2017
//---
- if ( imageHasNans()||(vRect.width() < 8 && vRect.height() < 8) )
+ if ( imageIsNan()||(vRect.width() < 8 && vRect.height() < 8) )
{
return result;
}
@@ -434,7 +434,10 @@ ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
if(result != SPLIT_ALL)
{
ossim_float64 bias = m_ImageToViewScale.length();
- if(bias < 1.0) bias = 1.0/bias;
+ //ossim_float64 bias = (m_ImageToViewScale.x+m_ImageToViewScale.y)/2.0;
+ //std::cout << "SCALE BIAS = " << bias << "\n";
+ if (bias < 1.0)
+ bias = 1.0 / bias;
bias = std::sqrt(bias);
if(bias < 1) bias = 1.0;
@@ -459,11 +462,9 @@ ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
// if(m_llRoundTripError.length() > sensitivityScale) result |= LOWER_LEFT_SPLIT_FLAG;
// std::cout << result << " == " << SPLIT_ALL << "\n";
- if((result!=SPLIT_ALL)&&!canBilinearInterpolate(bias))
+ if(!canBilinearInterpolate())
{
- // std::cout << "TESTING BILINEAR!!!!\n";
result = SPLIT_ALL;
-
}
else
{
@@ -575,19 +576,24 @@ void ossimImageRenderer::ossimRendererSubRectInfo::transformViewToImage()
// m_llRoundTripError = m_transform->getRoundTripErrorView(m_Vll);
#if 1
- m_VulScale = computeViewToImageScale(m_Vul, ossimDpt( w, h));
- m_VurScale = computeViewToImageScale(m_Vur, ossimDpt(-w, h));
- m_VlrScale = computeViewToImageScale(m_Vlr, ossimDpt(-w,-h));
- m_VllScale = computeViewToImageScale(m_Vll, ossimDpt( w,-h));
+ m_transform->getViewToImageScale(m_VulScale, m_Vul);
+ m_transform->getViewToImageScale(m_VurScale, m_Vur);
+ m_transform->getViewToImageScale(m_VlrScale, m_Vlr);
+ m_transform->getViewToImageScale(m_VllScale, m_Vll);
+
+ // m_VulScale = computeViewToImageScale(m_Vul, ossimDpt( w, h));
+ // m_VurScale = computeViewToImageScale(m_Vur, ossimDpt(-w, h));
+ // m_VlrScale = computeViewToImageScale(m_Vlr, ossimDpt(-w,-h));
+ // m_VllScale = computeViewToImageScale(m_Vll, ossimDpt( w,-h));
ossim_int32 n = 0;
m_ViewToImageScale.x = 0.0;
m_ViewToImageScale.y = 0.0;
- if(!m_VulScale.hasNans())
+ if (!m_VulScale.hasNans())
{
- m_ViewToImageScale += m_VulScale;
- ++n;
+ m_ViewToImageScale += m_VulScale;
+ ++n;
}
if(!m_VurScale.hasNans())
{
@@ -757,16 +763,16 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::isIdentity()const
(illDelta <= FLT_EPSILON));
}
-
-bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double error)const
+bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate() const
+//bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double error) const
{
bool result = false;
// now check point placement
ossimDpt imageToViewScale = getAbsValueImageToViewScales();
- double testScale = imageToViewScale.length();
-
+// double testScale = imageToViewScale.length();
+ double testScale = ossim::max<ossim_float64>(imageToViewScale.x, imageToViewScale.y);
// ossimDpt errorUl = transform->getRoundTripErrorView(m_Vul);
// ossimDpt errorUr = transform->getRoundTripErrorView(m_Vur);
// ossimDpt errorLr = transform->getRoundTripErrorView(m_Vlr);
@@ -888,6 +894,67 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double
double errorCheck3 = (testRight - iRight).length();
double errorCheck4 = (testBottom - iBottom).length();
double errorCheck5 = (testLeft - iLeft).length();
+ double error = 1.0;
+ if (testScale >= 1)
+ {
+ // std::cout <<"testScale MUL: " << testScale << "\n";
+ // std::cout << "errorCheck1: " << errorCheck1 << "\n";
+ // std::cout << "errorCheck2: " << errorCheck2 << "\n";
+ // std::cout << "errorCheck3: " << errorCheck3 << "\n";
+ // std::cout << "errorCheck4: " << errorCheck4 << "\n";
+ // std::cout << "errorCheck5: " << errorCheck5 << "\n";
+ // std::cout << "AFTER\n";
+ // errorCheck1 *= testScale;
+ // errorCheck2 *= testScale;
+ // errorCheck3 *= testScale;
+ // errorCheck4 *= testScale;
+ // errorCheck5 *= testScale;
+ // error*=testScale;
+ // std::cout << "errorCheck1: " << errorCheck1 << "\n";
+ // std::cout << "errorCheck2: " << errorCheck2 << "\n";
+ // std::cout << "errorCheck3: " << errorCheck3 << "\n";
+ // std::cout << "errorCheck4: " << errorCheck4 << "\n";
+ // std::cout << "errorCheck5: " << errorCheck5 << "\n";
+ }
+ else if (testScale >= FLT_EPSILON)
+ {
+ // std::cout << "testScale DIV: " << testScale << "\n";
+ // std::cout << "errorCheck1: " << errorCheck1 << "\n";
+ // std::cout << "errorCheck2: " << errorCheck2 << "\n";
+ // std::cout << "errorCheck3: " << errorCheck3 << "\n";
+ // std::cout << "errorCheck4: " << errorCheck4 << "\n";
+ // std::cout << "errorCheck5: " << errorCheck5 << "\n";
+ // errorCheck1 /= testScale;
+ // errorCheck2 /= testScale;
+ // errorCheck3 /= testScale;
+ // errorCheck4 /= testScale;
+ // errorCheck5 /= testScale;
+ // std::cout << "AFTER\n";
+ // std::cout << "errorCheck1: " << errorCheck1 << "\n";
+ // std::cout << "errorCheck2: " << errorCheck2 << "\n";
+ // std::cout << "errorCheck3: " << errorCheck3 << "\n";
+ // std::cout << "errorCheck4: " << errorCheck4 << "\n";
+ // std::cout << "errorCheck5: " << errorCheck5 << "\n";
+ // error /= testScale;
+ }
+ else
+ {
+ errorCheck1 = 0.0;
+ errorCheck2 = 0.0;
+ errorCheck3 = 0.0;
+ errorCheck4 = 0.0;
+ errorCheck5 = 0.0;
+ }
+
+ //std::cout << "errorCheck1:" << errorCheck1 << " ?????? " << error << "\n";
+ //std::cout << "DIV:" << (errorCheck1 / error) << " ?????? " << error << "\n";
+ //std::cout << "MULT:" << (errorCheck1 * error) << " ?????? " << error << "\n";
+ // result = ((errorCheck1 < error) &&
+ // (errorCheck2 < error) &&
+ // (errorCheck3 < error) &&
+ // (errorCheck4 < error) &&
+ // (errorCheck5 < error));
+ // std::cout << "error: " << error << "\n";
result = ((errorCheck1 < error) &&
(errorCheck2 < error) &&
(errorCheck3 < error) &&
@@ -1037,43 +1104,47 @@ ossimDpt ossimImageRenderer::ossimRendererSubRectInfo::getParametricCenter(const
}
ossimImageRenderer::ossimImageRenderer()
-:
-ossimImageSourceFilter(),
-ossimViewInterface(0),
-m_Resampler(0),
-m_BlankTile(0),
-m_Tile(0),
-m_TemporaryBuffer(0),
-m_StartingResLevel(0),
-m_ImageViewTransform(0),
-m_inputR0Rect(),
-m_viewRect(),
-m_rectsDirty(true),
-m_MaxRecursionLevel(5),
-m_AutoUpdateInputTransform(true),
-m_MaxLevelsToCompute(999999) // something large so it will always compute
+ : ossimImageSourceFilter(),
+ ossimViewInterface(0),
+ m_Resampler(0),
+ m_BlankTile(0),
+ m_Tile(0),
+ m_TemporaryBuffer(0),
+ m_StartingResLevel(0),
+ m_ImageViewTransform(0),
+ m_inputR0Rect(),
+ m_viewRect(),
+ m_rectsDirty(true),
+ m_MaxRecursionLevel(5),
+ m_AutoUpdateInputTransform(true),
+ m_MaxLevelsToCompute(999999), // something large so it will always compute
+ m_averageViewToImageScale(1.0),
+ m_averageViewToImageRLevelScale(0.0)
{
- ossimViewInterface::theObject = this;
- m_Resampler = new ossimFilterResampler();
- m_ImageViewTransform = new ossimImageViewProjectionTransform;
+ ossimViewInterface::theObject = this;
+ m_Resampler = new ossimFilterResampler();
+ m_ImageViewTransform = new ossimImageViewProjectionTransform;
}
-ossimImageRenderer::ossimImageRenderer(ossimImageSource* inputSource,
- ossimImageViewTransform* imageViewTrans)
- : ossimImageSourceFilter(inputSource),
- ossimViewInterface(0),
- m_Resampler(0),
- m_BlankTile(0),
- m_Tile(0),
- m_TemporaryBuffer(0),
- m_StartingResLevel(0),
- m_ImageViewTransform(imageViewTrans),
- m_inputR0Rect(),
- m_viewRect(),
- m_rectsDirty(true),
- m_MaxRecursionLevel(5),
- m_AutoUpdateInputTransform(true),
- m_MaxLevelsToCompute(999999) // something large so it will always compute
+ossimImageRenderer::ossimImageRenderer(ossimImageSource *inputSource,
+ ossimImageViewTransform *imageViewTrans)
+ : ossimImageSourceFilter(inputSource),
+ ossimViewInterface(0),
+ m_Resampler(0),
+ m_BlankTile(0),
+ m_Tile(0),
+ m_TemporaryBuffer(0),
+ m_StartingResLevel(0),
+ m_ImageViewTransform(imageViewTrans),
+ m_inputR0Rect(),
+ m_viewRect(),
+ m_rectsDirty(true),
+ m_MaxRecursionLevel(5),
+ m_AutoUpdateInputTransform(true),
+ m_MaxLevelsToCompute(999999),
+ m_averageViewToImageScale(1.0),
+ m_averageViewToImageRLevelScale(0.0)
+// something large so it will always compute
{
ossimViewInterface::theObject = this;
m_Resampler = new ossimFilterResampler();
@@ -1098,7 +1169,7 @@ ossimRefPtr<ossimImageData> ossimImageRenderer::getTile(
const ossimIrect& tileRect,
ossim_uint32 resLevel)
{
- // std::cout << "_________________________\n";
+ // std::cout << "_________________________\n";
static const char MODULE[] = "ossimImageRenderer::getTile";
if(traceDebug())
{
@@ -1191,19 +1262,59 @@ ossimRefPtr<ossimImageData> ossimImageRenderer::getTile(
// return m_BlankTile;
//}
-#if 0
+#if 1
+ ossimIrect tempRect = tileRect;
+ ossim_uint32 levels = theInputConnection->getNumberOfDecimationLevels();
+ ossim_float64 length = ossim::max<ossim_float64>(m_inputR0Rect.width(), m_inputR0Rect.height());
+
+ // if we are zoomed out or we are completely within the requesting tile rect
+ bool canClip = (m_viewRect.completely_within(tileRect));
+
+ if(!canClip)
+ {
+ if(m_averageViewToImageScale > 1.0)
+ {
+ if ((length / m_averageViewToImageScale) <= 256)
+ {
+ // we are very small so we can clip
+ canClip = true;
+ }
+ }
+ }
+ // gpotts: Until I can fix the entire resampling process we will add a sanity
+ // if we are zoomed out or the rect completely fits within the tile
+ // then we will clip to the view rect
+ if (canClip)
+ {
+ ossimPolyArea2d tileRectArea(tileRect);
+ if (!(m_viewArea.intersects(tileRectArea)))
+ {
+ return m_BlankTile;
+ }
+ else
+ {
+ ossimDrect rect;
+ tileRectArea &= m_viewArea;
+ tileRectArea.getBoundingRect(rect);
+ tempRect = rect;
+
+ }
+ }
+// tempRect = tileRect.clipToRect(m_viewRect);
// expand a small patch just to alleviate errors in the size of the rect when resampling
// ossimIrect viewRectClip = tileRect.clipToRect(ossimIrect(m_viewRect.ul() + ossimIpt(-8,-8),
// m_viewRect.lr() + ossimIpt(8,8)));
- ossimIrect viewRectClip = tileRect.clipToRect(m_viewRect);
- std::cout << "_____________________" << std::endl;
- std::cout << "viewRectClip = " << viewRectClip << std::endl;
-// std::cout << "tileRect = " << tileRect << std::endl;
-// std::cout << "m_viewRect = " << m_viewRect << std::endl;
- ossimRendererSubRectInfo subRectInfo(viewRectClip.ul(),
- viewRectClip.ur(),
- viewRectClip.lr(),
- viewRectClip.ll());
+ //ossimIrect viewRectClip = tileRect.clipToRect(m_viewRect);
+
+ // std::cout << "_____________________" << std::endl;
+ // std::cout << "viewRectClip = " << viewRectClip << std::endl;
+ // std::cout << "tileRect = " << tileRect << std::endl;
+ // std::cout << "m_viewRect = " << m_viewRect << std::endl;
+ ossimRendererSubRectInfo subRectInfo(m_ImageViewTransform.get(),
+ tempRect.ul(),
+ tempRect.ur(),
+ tempRect.lr(),
+ tempRect.ll());
#else
ossimRendererSubRectInfo subRectInfo(m_ImageViewTransform.get(),
tileRect.ul(),
@@ -1599,131 +1710,145 @@ void ossimImageRenderer::getBoundingRect(ossimIrect& rect, ossim_uint32 resLevel
void ossimImageRenderer::initializeBoundingRects()
{
- m_rectsDirty = true;
- ossimImageViewProjectionTransform* ivpt =
- dynamic_cast<ossimImageViewProjectionTransform*>(m_ImageViewTransform.get());
- if(!theInputConnection||!m_ImageViewTransform.valid()) return;
- m_inputR0Rect = theInputConnection->getBoundingRect(0);
- if (!m_inputR0Rect.hasNans() )
- {
- if(ivpt&&ivpt->getImageGeometry()&&ivpt->getViewGeometry())
- {
- // Little complicated but instead of always setting the edge walk
- // to a high number like 50 points per edge
- // we will look at the image to view scale change
- // and use that as a factor. So as the image zooms out we
- // need fewer points to estimate the edge.
- //
- // ossim_uint32 idx;
- std::vector<ossimDrect> boundList;
- ossimImageGeometry* igeom = ivpt->getImageGeometry(); // look at projected meters
- ossimImageGeometry* vgeom = ivpt->getViewGeometry(); // look at projected meters
- ossimDrect testRect;
- igeom->getBoundingRect(testRect);
- ossimDpt mpp = igeom->getMetersPerPixel();
- ossimDpt vmpp = vgeom->getMetersPerPixel();
- ossim_float64 scale = 1.0;
- ossim_uint32 maxLen = ossim::max(testRect.width(), testRect.height());
-
- // (GP March 2, 2017) determine goodMatch : test if we have either enough samples to closely match the post spacing
- // or if we have at least half the number of pixels along the edge of an image
- //
- // This is hopefully to help avoid when using the polygon for intersection to not have
- // bad intersection tests when zooming. We might have to rethink it and implement
- // this as a windowed edge walker. So when zooming we create a polygon that
- // is denser for only what the view can see and not the entire image. Basically interatively
- // tesselate the input image model based on bounding volumes and then create a dense edge walker
- // for what lies in the view at the given scale. Too much to implement right now so we will cheet
- // and take an easy way out for now.
- //
-
- if(!mpp.hasNans()&&!vmpp.hasNans())
- {
- scale = mpp.y/vmpp.y;
- if(scale > 1.0) scale = 1.0;
- }
- ossim_float64 mppTest = mpp.y;
- ossim_float64 divisor = mppTest; // default to 30 meter elevation
- if(mppTest < 500 )
- {
- if(mppTest >= 45 )
- {
- divisor = 90; // 90 meters
- }
- }
- else
- {
- divisor = 1000; // 1 kilometer
- }
- if(divisor < 30) divisor = 30.0;
-
-
- // now test to see if our edge walk is close to matching enough
- // points for a good match.
- //
- ossim_uint32 maxEdgeSample = ossim::min(static_cast<ossim_uint32>(50), maxLen);
- if(maxEdgeSample < 1) maxEdgeSample = 1;
- ossim_uint32 testEdgeSample = ossim::round<ossim_uint32>((maxLen*scale*mpp.y)/divisor);
-
- bool goodMatch = (testEdgeSample<=maxEdgeSample)||(testEdgeSample>=(maxLen>>1));
- ossim_float64 steps = ossim::min(testEdgeSample, maxEdgeSample);
+ m_averageViewToImageScale = 1.0;
+ m_rectsDirty = true;
+ ossimImageViewProjectionTransform *ivpt =
+ dynamic_cast<ossimImageViewProjectionTransform *>(m_ImageViewTransform.get());
+ if (!theInputConnection || !m_ImageViewTransform.valid())
+ return;
+ m_inputR0Rect = theInputConnection->getBoundingRect(0);
+ if (!m_inputR0Rect.hasNans())
+ {
+ if (ivpt && ivpt->getImageGeometry() && ivpt->getViewGeometry())
+ {
+ // Little complicated but instead of always setting the edge walk
+ // to a high number like 50 points per edge
+ // we will look at the image to view scale change
+ // and use that as a factor. So as the image zooms out we
+ // need fewer points to estimate the edge.
+ //
+ // ossim_uint32 idx;
+ std::vector<ossimDrect> boundList;
+ ossimImageGeometry *igeom = ivpt->getImageGeometry(); // look at projected meters
+ ossimImageGeometry *vgeom = ivpt->getViewGeometry(); // look at projected meters
+ ossimDrect testRect;
+ igeom->getBoundingRect(testRect);
+ ossimDpt mpp = igeom->getMetersPerPixel();
+ ossimDpt vmpp = vgeom->getMetersPerPixel();
+ ossim_float64 scale = 1.0;
+ ossim_uint32 maxLen = ossim::max(testRect.width(), testRect.height());
+
+ // (GP March 2, 2017) determine goodMatch : test if we have either enough samples to closely match the post spacing
+ // or if we have at least half the number of pixels along the edge of an image
+ //
+ // This is hopefully to help avoid when using the polygon for intersection to not have
+ // bad intersection tests when zooming. We might have to rethink it and implement
+ // this as a windowed edge walker. So when zooming we create a polygon that
+ // is denser for only what the view can see and not the entire image. Basically interatively
+ // tesselate the input image model based on bounding volumes and then create a dense edge walker
+ // for what lies in the view at the given scale. Too much to implement right now so we will cheet
+ // and take an easy way out for now.
+ //
- ossim_uint32 finalSteps = ossim::round<ossim_uint32>(steps);
- if(finalSteps<1) finalSteps=1;
- if(igeom->getCrossesDateline())
- {
- if(finalSteps < maxEdgeSample) finalSteps = maxEdgeSample;
- }
+ if (!mpp.hasNans() && !vmpp.hasNans())
+ {
+ scale = mpp.y / vmpp.y;
+ if (scale > 1.0)
+ scale = 1.0;
+ }
+ ossim_float64 mppTest = mpp.y;
+ ossim_float64 divisor = mppTest; // default to 30 meter elevation
+ if (mppTest < 500)
+ {
+ if (mppTest >= 45)
+ {
+ divisor = 90; // 90 meters
+ }
+ }
+ else
+ {
+ divisor = 1000; // 1 kilometer
+ }
+ if (divisor < 30)
+ divisor = 30.0;
- ivpt->getViewSegments(boundList, m_viewArea, finalSteps);
- if(boundList.size())
- {
- m_viewRect = boundList[0];
- ossim_uint32 idx = 0;
+ // now test to see if our edge walk is close to matching enough
+ // points for a good match.
+ //
+ ossim_uint32 maxEdgeSample = ossim::min(static_cast<ossim_uint32>(50), maxLen);
+ if (maxEdgeSample < 1)
+ maxEdgeSample = 1;
+ ossim_uint32 testEdgeSample = ossim::round<ossim_uint32>((maxLen * scale * mpp.y) / divisor);
+
+ bool goodMatch = (testEdgeSample <= maxEdgeSample) || (testEdgeSample >= (maxLen >> 1));
+ ossim_float64 steps = ossim::min(testEdgeSample, maxEdgeSample);
+
+ ossim_uint32 finalSteps = ossim::round<ossim_uint32>(steps);
+ if (finalSteps < 1)
+ finalSteps = 1;
+ if (igeom->getCrossesDateline())
+ {
+ if (finalSteps < maxEdgeSample)
+ finalSteps = maxEdgeSample;
+ }
- if(goodMatch)
- {
- m_viewArea = boundList[idx];
- }
- else
- {
- m_viewArea = m_viewRect;
- }
- for(idx=1;idx<boundList.size();++idx)
- {
- ossimIrect rectBounds = ossimIrect(boundList[idx]);
- m_viewRect = m_viewRect.combine(rectBounds);
- if(goodMatch)
- {
- m_viewArea.add(ossimPolygon(boundList[idx]));
- }
- else
- {
- m_viewArea.add(rectBounds);
- }
- } //
- if(!m_viewRect.hasNans())
- {
- m_rectsDirty = false;
- }
- } //END if boundList.size()
- }
- else if(m_ImageViewTransform.valid())
- {
- m_viewRect = m_ImageViewTransform->getImageToViewBounds(m_inputR0Rect);
+ ivpt->getViewSegments(boundList, m_viewArea, finalSteps);
+ if (boundList.size())
+ {
+ m_viewRect = boundList[0];
+ ossim_uint32 idx = 0;
- if(!m_viewRect.hasNans())
- {
+ if (goodMatch)
+ {
+ m_viewArea = boundList[idx];
+ }
+ else
+ {
+ m_viewArea = m_viewRect;
+ }
+ for (idx = 1; idx < boundList.size(); ++idx)
+ {
+ ossimIrect rectBounds = ossimIrect(boundList[idx]);
+ m_viewRect = m_viewRect.combine(rectBounds);
+ if (goodMatch)
+ {
+ m_viewArea.add(ossimPolygon(boundList[idx]));
+ }
+ else
+ {
+ m_viewArea.add(rectBounds);
+ }
+ } //
+ if (!m_viewRect.hasNans())
+ {
m_rectsDirty = false;
- }
+ }
+ } //END if boundList.size()
+ }
+ else if (m_ImageViewTransform.valid())
+ {
+ m_viewRect = m_ImageViewTransform->getImageToViewBounds(m_inputR0Rect);
- m_viewArea = m_viewRect;
- }
+ if (!m_viewRect.hasNans())
+ {
+ m_rectsDirty = false;
+ }
+
+ m_viewArea = m_viewRect;
+ }
+ }
+ if(!m_viewRect.hasNans()&&m_ImageViewTransform)
+ {
+ ossimDpt result;
+ m_ImageViewTransform->getViewToImageScale(result, m_viewRect.midPoint());
+ m_averageViewToImageScale = (result.x+result.y)/2.0;
+ m_averageViewToImageRLevelScale = log(m_averageViewToImageScale) / log(2);
}
if ( m_rectsDirty )
{
m_viewRect.makeNan();
}
+
#if 0 /* Please leave for debug. */
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimImageRenderer::initializeBoundingRects() debug:\n"
=====================================
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/projection/ossimEnviCgModel.cpp
=====================================
--- /dev/null
+++ b/src/projection/ossimEnviCgModel.cpp
@@ -0,0 +1,149 @@
+//*****************************************************************************
+// FILE: ossimCoarseGridModel.cc
+//
+// License: See LICENSE.txt file in the top level directory.
+//
+// AUTHOR: Oscar Kramer
+//
+// DESCRIPTION:
+// Contains implementation of class ossimCoarseGridModel. This is an
+// implementation of an interpolation sensor model.
+//
+// IMPORTANT: The lat/lon grid is for ground points on the ellipsoid.
+// The dLat/dHgt and dLon/dHgt partials therefore are used against
+// elevations relative to the ellipsoid.
+//
+//*****************************************************************************
+// $Id: ossimCoarseGridModel.cpp 22825 2014-07-07 23:14:52Z dburken $
+
+#include <ossim/projection/ossimEnviCgModel.h>
+
+RTTI_DEF1(ossimEnviCgModel, "ossimEnviCgModel", ossimCoarseGridModel);
+
+#include <ossim/elevation/ossimElevManager.h>
+#include <ossim/imaging/ossimImageGeometry.h>
+#include <ossim/support_data/ossimSupportFilesList.h>
+#include <ossim/projection/ossimProjectionFactoryRegistry.h>
+#include <ossim/base/ossimKeywordlist.h>
+
+static const char* MODEL_TYPE = "ossimEnviCgModel";
+
+//*****************************************************************************
+ossimEnviCgModel::ossimEnviCgModel()
+ : ossimCoarseGridModel()
+{}
+
+//*****************************************************************************
+ossimEnviCgModel::ossimEnviCgModel(const ossimFilename& geoc_file)
+ : ossimCoarseGridModel()
+{
+ loadEnviGeocFile(geoc_file);
+}
+
+
+//*****************************************************************************
+bool ossimEnviCgModel::loadEnviGeocFile(const ossimFilename& geoc_file)
+{
+ theHeightEnabledFlag = false;
+ setErrorStatus();
+
+ ossimFilename geoc_hdr (geoc_file + ".hdr");
+
+ ifstream geocHdrStream (geoc_hdr.c_str());
+ if (geocHdrStream.fail())
+ {
+ cout << "ossimEnviCgModel:loadEnviGeocFile() Error encountered opening GEOC header file <"<<geoc_hdr<<">"<<endl;
+ return false;
+ }
+
+ char line[1024];
+ ossimIpt imageSize;
+ geocHdrStream.getline(line, 1024);
+ ossimString oline(line);
+ int bigEndian=0;
+ if (!oline.contains("ENVI"))
+ {
+ cout << "ossimEnviCgModel:loadEnviGeocFile() Error: GEOC header file <"<<geoc_hdr
+ <<"> missing \"ENVI\" magic number."<<endl;
+ return false;
+ }
+ while (!geocHdrStream.eof())
+ {
+ geocHdrStream.getline(line, 1024);
+ oline = line;
+ vector<ossimString> strSplit;
+ if (oline.contains("samples"))
+ imageSize.x = oline.after("=").trim().toInt();
+ else if (oline.contains("lines"))
+ imageSize.y = oline.after("=").trim().toInt();
+ else if (oline.contains("byte order"))
+ bigEndian = oline.after("=").trim().toInt();
+ }
+
+ ossimDpt gridOrigin(0,0);
+
+ ifstream geocStream (geoc_file.c_str(), ios_base::binary|ios_base::in);
+ if (geocStream.fail())
+ {
+ cout << "ossimEnviCgModel:Ctor Error encountered opening GEOC file <"<<geoc_file<<">"<<endl;
+ return false;
+ }
+
+ ossimDpt spacing (1,1);
+ theLatGrid.initialize(imageSize, gridOrigin, spacing);
+ theLonGrid.initialize(imageSize, gridOrigin, spacing);
+ theDlatDhGrid.initialize(imageSize, gridOrigin, spacing);
+ theDlonDhGrid.initialize(imageSize, gridOrigin, spacing);
+
+ double value;
+ for (int y=0; (y<imageSize.y) && !geocStream.eof() ; ++y)
+ {
+ for (int x=0; (x<imageSize.x) && !geocStream.eof() ; ++x)
+ {
+ value = readValue(geocStream, (bool) bigEndian);
+ theLonGrid.setNode(x, y, value);
+ }
+ }
+ for (int y=0; (y<imageSize.y) && !geocStream.eof() ; ++y)
+ {
+ for (int x=0; (x<imageSize.x) && !geocStream.eof() ; ++x)
+ {
+ value = readValue(geocStream, (bool) bigEndian);
+ theLatGrid.setNode(x, y, value);
+ }
+ }
+
+ theDlatDhGrid.fill(0.0);
+ theDlonDhGrid.fill(0.0);
+ theLatGrid.setDomainType(ossimDblGrid::SAWTOOTH_90);
+ theLonGrid.setDomainType(ossimDblGrid::WRAP_180);
+
+ ossimIrect imageBounds(0, 0, imageSize.x-1, imageSize.y-1);
+ initializeModelParams(imageBounds);
+
+ return true;
+}
+
+bool ossimEnviCgModel::saveState(ossimKeywordlist& kwl, const char* prefix) const
+{
+ bool status = ossimCoarseGridModel::saveState(kwl, prefix);
+ if (status)
+ kwl.add(prefix, "type", "ossimCoarseGridModel");
+ return status;
+}
+
+double ossimEnviCgModel::readValue(ifstream& s, bool bigEndian) const
+{
+ double value;
+ s.read( reinterpret_cast<char*>(&value) , sizeof(double) );
+ if (bigEndian)
+ {
+ char * pc = reinterpret_cast<char *>(&value);
+ std::swap(pc[0], pc[7]);
+ std::swap(pc[1], pc[6]);
+ std::swap(pc[2], pc[5]);
+ std::swap(pc[3], pc[4]);
+ cout<<endl;
+ }
+ return value;
+}
=====================================
src/projection/ossimImageViewTransform.cpp
=====================================
--- a/src/projection/ossimImageViewTransform.cpp
+++ b/src/projection/ossimImageViewTransform.cpp
@@ -211,55 +211,47 @@ void ossimImageViewTransform::getScaleChangeViewToImage(ossimDpt& result,
}
}
-void ossimImageViewTransform::getImageToViewScale(ossimDpt& resultScale,
- const ossimDpt& imagePoint,
- const ossimDpt& deltaImagePointXY)const
+
+ossimDrect ossimImageViewTransform::getImageToViewBounds(const ossimDrect& imageRect)const
{
- ossimDpt p1 = imagePoint;
- ossimDpt p2(imagePoint.x + deltaImagePointXY.x,
- imagePoint.y);
- ossimDpt p3(imagePoint.x,
- imagePoint.y + deltaImagePointXY.y);
-
- ossimDpt transformedP1;
- ossimDpt transformedP2;
- ossimDpt transformedP3;
+ ossimDpt p1;
+ ossimDpt p2;
+ ossimDpt p3;
+ ossimDpt p4;
- imageToView(p1, transformedP1);
- imageToView(p2, transformedP2);
- imageToView(p3, transformedP3);
+ imageToView(imageRect.ul(), p1);
+ imageToView(imageRect.ur(), p2);
+ imageToView(imageRect.lr(), p3);
+ imageToView(imageRect.ll(), p4);
- ossimDpt deltaP1P2 = transformedP1 - transformedP2;
- ossimDpt deltaP1P3 = transformedP1 - transformedP3;
-
- // now compute the distances.
- double sumSquaredSqrtP1P2 = sqrt((deltaP1P2.x*deltaP1P2.x) +
- (deltaP1P2.y*deltaP1P2.y));
- double sumSquaredSqrtP1P3 = sqrt((deltaP1P3.x*deltaP1P3.x) +
- (deltaP1P3.y*deltaP1P3.y));
+ return ossimDrect(p1, p2, p3, p4);
+}
- resultScale.x = 0;
- resultScale.y = 0;
+ossimDrect ossimImageViewTransform::getViewToImageBounds(const ossimDrect& viewRect)const
+{
+ ossimDpt p1;
+ ossimDpt p2;
+ ossimDpt p3;
+ ossimDpt p4;
- if(sumSquaredSqrtP1P2 > FLT_EPSILON)
- {
- resultScale.x = sumSquaredSqrtP1P2/deltaImagePointXY.x;
- }
- if(sumSquaredSqrtP1P3 > FLT_EPSILON)
- {
- resultScale.y = sumSquaredSqrtP1P3/deltaImagePointXY.y;
- }
+ viewToImage(viewRect.ul(), p1);
+ viewToImage(viewRect.ur(), p2);
+ viewToImage(viewRect.lr(), p3);
+ viewToImage(viewRect.ll(), p4);
+
+ return ossimDrect(p1, p2, p3, p4);
}
-void ossimImageViewTransform::getViewToImageScale(ossimDpt& resultScale,
- const ossimDpt& viewPoint,
- const ossimDpt& deltaViewPointXY)const
+#if 0
+void ossimImageViewTransform::getViewToImageScale(ossimDpt &resultScale,
+ const ossimDpt &viewPoint,
+ const ossimDpt &deltaViewPointXY) const
{
ossimDpt p1 = viewPoint;
ossimDpt p2(viewPoint.x + deltaViewPointXY.x,
- viewPoint.y);
+ viewPoint.y);
ossimDpt p3(viewPoint.x,
- viewPoint.y + deltaViewPointXY.y);
+ viewPoint.y + deltaViewPointXY.y);
ossimDpt transformedP1;
ossimDpt transformedP2;
@@ -273,54 +265,192 @@ void ossimImageViewTransform::getViewToImageScale(ossimDpt& resultScale,
ossimDpt deltaP1P3 = transformedP1 - transformedP3;
// now compute the distances.
- double sumSquaredSqrtP1P2 = sqrt((deltaP1P2.x*deltaP1P2.x) +
- (deltaP1P2.y*deltaP1P2.y));
- double sumSquaredSqrtP1P3 = sqrt((deltaP1P3.x*deltaP1P3.x) +
- (deltaP1P3.y*deltaP1P3.y));
+ double sumSquaredSqrtP1P2 = sqrt((deltaP1P2.x * deltaP1P2.x) +
+ (deltaP1P2.y * deltaP1P2.y));
+ double sumSquaredSqrtP1P3 = sqrt((deltaP1P3.x * deltaP1P3.x) +
+ (deltaP1P3.y * deltaP1P3.y));
resultScale.x = 0;
resultScale.y = 0;
- if(sumSquaredSqrtP1P2 > FLT_EPSILON)
+ if (sumSquaredSqrtP1P2 > FLT_EPSILON)
+ {
+ resultScale.x = sumSquaredSqrtP1P2 / deltaViewPointXY.x;
+ }
+ if (sumSquaredSqrtP1P3 > FLT_EPSILON)
+ {
+ resultScale.y = sumSquaredSqrtP1P3 / deltaViewPointXY.y;
+ }
+}
+#else
+void ossimImageViewTransform::getViewToImageScale(ossimDpt &result,
+ const ossimDpt &viewSeedPoint,
+ const ossimDpt &dxdy) const
+{
+ result.makeNan();
+
+ ossimDpt dxdyHalf(dxdy.x / 2.0, dxdy.y / 2.0);
+ ossimDpt iptdx1 = viewSeedPoint - ossimDpt(dxdyHalf.x, 0.0);
+ ossimDpt iptdx2 = iptdx1 + ossimDpt(dxdy.x, 0.0);
+ ossimDpt iptdy1 = viewSeedPoint - ossimDpt(dxdyHalf.y, 0.0);
+ ossimDpt iptdy2 = iptdx1 + ossimDpt(0.0, dxdy.y);
+ ossimDpt dx1;
+ ossimDpt dx2;
+ ossimDpt dy1;
+ ossimDpt dy2;
+
+ viewToImage(iptdx1, dx1);
+ viewToImage(iptdx2, dx2);
+
+ viewToImage(iptdy1, dy1);
+ viewToImage(iptdy2, dy2);
+
+ if (!(dx1.hasNans() || dx2.hasNans()))
+ {
+ ossimDpt delta = dx1 - dx2;
+
+ // now compute the distances.
+ ossim_float64 sumSquared = sqrt((delta.x * delta.x) +
+ (delta.y * delta.y));
+
+ if (sumSquared > FLT_EPSILON)
{
- resultScale.x = sumSquaredSqrtP1P2/deltaViewPointXY.x;
+ result.x = sumSquared / dxdy.x;
}
- if(sumSquaredSqrtP1P3 > FLT_EPSILON)
+ else
{
- resultScale.y = sumSquaredSqrtP1P3/deltaViewPointXY.y;
+ result.x = ossim::nan();
}
-}
+ }
+ if (!(dy1.hasNans() || dy2.hasNans()))
+ {
+ ossimDpt delta = dy1 - dy2;
-ossimDrect ossimImageViewTransform::getImageToViewBounds(const ossimDrect& imageRect)const
-{
- ossimDpt p1;
- ossimDpt p2;
- ossimDpt p3;
- ossimDpt p4;
+ // now compute the distances.
+ ossim_float64 sumSquared = sqrt((delta.x * delta.x) +
+ (delta.y * delta.y));
- imageToView(imageRect.ul(), p1);
- imageToView(imageRect.ur(), p2);
- imageToView(imageRect.lr(), p3);
- imageToView(imageRect.ll(), p4);
+ if (sumSquared > FLT_EPSILON)
+ {
+ result.y = sumSquared / dxdy.y;
+ }
+ else
+ {
+ result.y = ossim::nan();
+ }
+ }
- return ossimDrect(p1, p2, p3, p4);
+ if (result.hasNans())
+ {
+ result.makeNan();
+ }
}
+#endif
-ossimDrect ossimImageViewTransform::getViewToImageBounds(const ossimDrect& viewRect)const
+#if 0
+void ossimImageViewTransform::getImageToViewScale(ossimDpt &resultScale,
+ const ossimDpt &imagePoint,
+ const ossimDpt &deltaImagePointXY) const
{
- ossimDpt p1;
- ossimDpt p2;
- ossimDpt p3;
- ossimDpt p4;
+ ossimDpt p1 = imagePoint;
+ ossimDpt p2(imagePoint.x + deltaImagePointXY.x,
+ imagePoint.y);
+ ossimDpt p3(imagePoint.x,
+ imagePoint.y + deltaImagePointXY.y);
- viewToImage(viewRect.ul(), p1);
- viewToImage(viewRect.ur(), p2);
- viewToImage(viewRect.lr(), p3);
- viewToImage(viewRect.ll(), p4);
+ ossimDpt transformedP1;
+ ossimDpt transformedP2;
+ ossimDpt transformedP3;
- return ossimDrect(p1, p2, p3, p4);
+ imageToView(p1, transformedP1);
+ imageToView(p2, transformedP2);
+ imageToView(p3, transformedP3);
+
+ ossimDpt deltaP1P2 = transformedP1 - transformedP2;
+ ossimDpt deltaP1P3 = transformedP1 - transformedP3;
+
+ // now compute the distances.
+ double sumSquaredSqrtP1P2 = sqrt((deltaP1P2.x * deltaP1P2.x) +
+ (deltaP1P2.y * deltaP1P2.y));
+ double sumSquaredSqrtP1P3 = sqrt((deltaP1P3.x * deltaP1P3.x) +
+ (deltaP1P3.y * deltaP1P3.y));
+
+ resultScale.x = 0;
+ resultScale.y = 0;
+
+ if (sumSquaredSqrtP1P2 > FLT_EPSILON)
+ {
+ resultScale.x = sumSquaredSqrtP1P2 / deltaImagePointXY.x;
+ }
+ if (sumSquaredSqrtP1P3 > FLT_EPSILON)
+ {
+ resultScale.y = sumSquaredSqrtP1P3 / deltaImagePointXY.y;
+ }
}
+#else
+void ossimImageViewTransform::getImageToViewScale(ossimDpt &result,
+ const ossimDpt &imageSeedPoint,
+ const ossimDpt &dxdy) const
+{
+ result.makeNan();
+ ossimDpt dxdyHalf(dxdy.x / 2.0, dxdy.y / 2.0);
+ ossimDpt iptdx1 = imageSeedPoint - ossimDpt(dxdyHalf.x, 0.0);
+ ossimDpt iptdx2 = iptdx1 + ossimDpt(dxdy.x,0.0);
+ ossimDpt iptdy1 = imageSeedPoint - ossimDpt(dxdyHalf.y, 0.0);
+ ossimDpt iptdy2 = iptdx1 + ossimDpt(0.0,dxdy.y);
+ ossimDpt dx1;
+ ossimDpt dx2;
+ ossimDpt dy1;
+ ossimDpt dy2;
+
+ imageToView(iptdx1, dx1);
+ imageToView(iptdx2, dx2);
+
+ imageToView(iptdy1, dy1);
+ imageToView(iptdy2, dy2);
+
+ if (!(dx1.hasNans() || dx2.hasNans()))
+ {
+ ossimDpt delta = dx1 - dx2;
+
+ // now compute the distances.
+ ossim_float64 sumSquared = sqrt((delta.x * delta.x) +
+ (delta.y * delta.y));
+
+ if (sumSquared > FLT_EPSILON)
+ {
+ result.x = sumSquared / dxdy.x;
+ }
+ else
+ {
+ result.x = ossim::nan();
+ }
+ }
+ if (!(dy1.hasNans() || dy2.hasNans()))
+ {
+ ossimDpt delta = dy1 - dy2;
+
+ // now compute the distances.
+ ossim_float64 sumSquared = sqrt((delta.x * delta.x) +
+ (delta.y * delta.y));
+
+ if (sumSquared > FLT_EPSILON)
+ {
+ result.y = sumSquared / dxdy.y;
+ }
+ else
+ {
+ result.y = ossim::nan();
+ }
+ }
+
+ if (result.hasNans())
+ {
+ result.makeNan();
+ }
+}
+#endif
std::ostream& ossimImageViewTransform::print(std::ostream& out) const
{
return out;
=====================================
src/projection/ossimRsmModel.cpp
=====================================
--- a/src/projection/ossimRsmModel.cpp
+++ b/src/projection/ossimRsmModel.cpp
@@ -338,11 +338,11 @@ void ossimRsmModel::lineSampleHeightToWorld(const ossimDpt& image_point,
gpt.lon = ossim::radiansToDegrees(nlon*m_pca[pcaIndex].m_xnrmsf + m_pca[pcaIndex].m_xnrmo);
gpt.hgt = (nhgt * m_pca[pcaIndex].m_znrmsf) + m_pca[pcaIndex].m_znrmo; //ellHeight;
+ gpt.wrap();
//---
// Note: See above note. Added in wrap call. Longitude was coming out 242
// when should have been -118. (drb - 22 May 2015)
//---
- gpt.wrap();
} // End: ossimRsmModel::lineSampleHeightToWorld( ... )
=====================================
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/compare/1530d902d8baee13e583f12c4a22b71b5e291657...da681207daf76d79e0aa5caec09c71aff45e7151
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/compare/1530d902d8baee13e583f12c4a22b71b5e291657...da681207daf76d79e0aa5caec09c71aff45e7151
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/20180824/d36d72db/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list