[Git][debian-gis-team/ossim][master] 6 commits: New upstream version 2.3.2
Bas Couwenberg
gitlab at salsa.debian.org
Tue May 1 17:18:30 BST 2018
Bas Couwenberg pushed to branch master at Debian GIS Project / ossim
Commits:
d9b6f25a by Bas Couwenberg at 2018-05-01T16:41:42+02:00
New upstream version 2.3.2
- - - - -
e190080d by Bas Couwenberg at 2018-05-01T16:41:49+02:00
Merge tag 'upstream/2.3.2'
Upstream version 2.3.2
- - - - -
a99415a3 by Bas Couwenberg at 2018-05-01T16:42:12+02:00
New upstream release.
- - - - -
92b96907 by Bas Couwenberg at 2018-05-01T16:44:28+02:00
Refresh patches.
- - - - -
62c4b04e by Bas Couwenberg at 2018-05-01T17:43:35+02:00
Update spelling-errors.patch for new typos.
- - - - -
d10f5ca7 by Bas Couwenberg at 2018-05-01T17:43:35+02:00
Set distribution to unstable.
- - - - -
29 changed files:
- + apps/ossim-header-crawl/CMakeLists.txt
- + apps/ossim-header-crawl/ossim-header-crawl.cpp
- cmake/CMakeLists.txt
- cmake/CMakeModules/FindOpenCV.cmake
- cmake/CMakeModules/OssimCommonVariables.cmake
- cmake/CMakeModules/OssimUtilities.cmake
- debian/changelog
- debian/manpages/ossim-chipper.1
- debian/patches/spelling-errors.patch
- include/ossim/imaging/ossimNitfWriterBase.h
- include/ossim/projection/ossimNitfProjectionFactory.h
- + include/ossim/support_data/ossimNitfGeolobTag.h
- − include/ossim/support_data/ossimNitfLocalGeographicTag.h
- include/ossim/util/ossimChipperUtil.h
- + scripts/create-sandbox.sh
- + scripts/ocpld.sh
- share/ossim/templates/ossim_preferences_template
- src/imaging/ossimImageRenderer.cpp
- src/imaging/ossimNitf20Writer.cpp
- src/imaging/ossimNitfWriter.cpp
- src/imaging/ossimNitfWriterBase.cpp
- src/imaging/ossimSingleImageChain.cpp
- src/projection/ossimNitfProjectionFactory.cpp
- + src/support_data/ossimNitfGeolobTag.cpp
- src/support_data/ossimNitfImageBandV2_0.cpp
- − src/support_data/ossimNitfLocalGeographicTag.cpp
- src/support_data/ossimNitfRegisteredTagFactory.cpp
- src/util/ossimChipperUtil.cpp
- src/util/ossimImageUtil.cpp
Changes:
=====================================
apps/ossim-header-crawl/CMakeLists.txt
=====================================
--- /dev/null
+++ b/apps/ossim-header-crawl/CMakeLists.txt
@@ -0,0 +1,2 @@
+FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
+OSSIM_SETUP_APPLICATION(ossim-header-crawl INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
=====================================
apps/ossim-header-crawl/ossim-header-crawl.cpp
=====================================
--- /dev/null
+++ b/apps/ossim-header-crawl/ossim-header-crawl.cpp
@@ -0,0 +1,315 @@
+//*******************************************************************
+// Copyright (C) 2000 ImageLinks Inc.
+//
+// License: See top level LICENSE.txt file.
+//
+// Author: Ken Melero
+// Originally written by Oscar Kramer.
+//
+// Description: This app displays a binary file in a nice
+// formatted view. Very helpful for finding offsets of
+// binary headers.
+//
+//********************************************************************
+#include <iostream>
+#include <vector>
+#include <map>
+#include <fstream>
+#include <ossim/base/ossimString.h>
+#include <ossim/base/ossimFilename.h>
+#include <memory>
+#include <sstream>
+
+using namespace std;
+
+// first: header file name only, second: header file's "namespace" or full path if relative
+typedef map<ossimFilename, ossimFilename> HeaderMap;
+
+typedef vector<ossimFilename> FileList;
+
+
+class CppHeaderCrawler
+{
+public:
+ CppHeaderCrawler();
+
+ // Mines the CMake output files for include paths and home directory
+ bool loadBuild(const ossimFilename &buildDir);
+
+ // Opens each source and header to determine external header dependencies
+ bool scanForHeaders();
+
+ // Copies all external headers to the sandbox output directory, preserving the relative namespace
+ bool copyHeaders(const ossimFilename &outDir);
+
+private:
+
+ // Scans specified file for include files to record:
+ bool scanFile(const ossimFilename &file);
+
+ // Finds the path needed to prepend to the includeSpec to locate the existing include file.
+ // Returns empty string if not found:
+ ossimFilename findPath(const ossimFilename &includeSpec);
+
+ ossimFilename m_ossimDevHome; // = $OSSIM_DEV_HOME as specified in CMakeCache.txt
+ FileList m_includeDirs; // List of all include paths searched in build
+ FileList m_sourceNames; // List of all OSSIM source and header files accessed in build
+ HeaderMap m_includePathMap; // Contains existing include path for every header file
+};
+
+
+void usage(char* appname)
+{
+ cout<<"\nUsage: " << appname << " <path/to/OSSIM_BUILD_DIR> <path-to-output-dir>\n" << endl;
+ cout<<" Utility app to copy all external header files on a system that are referenced by the \n"
+ <<" OSSIM build. The headers are copied into a \"sandbox\" directory (usually appended with \n"
+ <<" \"include\"), preserving namespaces. This is to enable sandbox builds. See the script in\n"
+ <<" ossim/scripts/ocpld.sh for copying the external libraries needed.\n"<<endl;
+ return;
+}
+
+int main(int argc, char** argv)
+{
+ if (argc < 3)
+ {
+ usage(argv[0]);
+ return 1;
+ }
+
+ ossimFilename buildPath = argv[1];
+ ossimFilename destDir = argv[2];
+
+ CppHeaderCrawler crawler;
+
+ if (!crawler.loadBuild(buildPath))
+ return -1;
+
+ if (!crawler.scanForHeaders())
+ return -1;
+
+ if (!crawler.copyHeaders(destDir))
+ return -1;
+
+ return 0;
+}
+
+CppHeaderCrawler::CppHeaderCrawler()
+{
+}
+
+bool CppHeaderCrawler::loadBuild(const ossimFilename &build_dir)
+{
+ static const string OSSIM_DEV_HOME_STR = "OSSIM_DEV_HOME:";
+ ossimString line;
+
+ // Check environment for OSSIM_DEV_HOME:
+ const char* envVar = getenv("OSSIM_DEV_HOME");
+ if (envVar)
+ {
+ m_ossimDevHome = envVar;
+ }
+ else
+ {
+ // Checkout the CMakeCache.txt to mine it for OSSIM_DEV_HOME:
+ ossimFilename cmakeCacheFile = build_dir + "/CMakeCache.txt";
+ ifstream f(cmakeCacheFile.string());
+ if (f.fail())
+ {
+ cout << "Failed file open for CMake file: " << cmakeCacheFile << endl;
+ return false;
+ }
+
+ // Loop to read read one line at a time to find OSSIM_DEV_HOME:
+ while (getline(f, line))
+ {
+ if (!line.contains(OSSIM_DEV_HOME_STR))
+ continue;
+ m_ossimDevHome = line.after("=");
+ break;
+ }
+ f.close();
+ }
+ if (m_ossimDevHome.empty())
+ {
+ cout << "Could not determine OSSIM_DEV_HOME. This should not happen!" << endl;
+ return false;
+ }
+
+ // Now read the cmake-generated list files. First the include directories:
+ ossimFilename cmakeIncludeDirs (build_dir.dirCat("CMakeIncludeDirs.txt"));
+ ifstream f(cmakeIncludeDirs.string());
+ if (f.fail())
+ {
+ cout << "Failed file open for CMake file: " << cmakeIncludeDirs << endl;
+ return false;
+ }
+ while (getline(f, line))
+ {
+ if (!line.contains(m_ossimDevHome))
+ {
+ cout << "Adding include path <" << line << ">" << endl;
+ m_includeDirs.emplace_back(line);
+ }
+ }
+ f.close();
+
+ // Read list of sources and headers included in the build:
+ ossimFilename cmakeFilenames (build_dir.dirCat("CMakeFileNames.txt"));
+ f.open(cmakeFilenames.string());
+ if (f.fail())
+ {
+ cout << "Failed file open for CMake file: " << cmakeFilenames << endl;
+ return false;
+ }
+ while (getline(f, line))
+ {
+ cout << "Adding source/header file <" << line << ">" << endl;
+ m_sourceNames.emplace_back(line);
+ }
+ f.close();
+
+ return true;
+}
+
+
+bool CppHeaderCrawler::scanForHeaders()
+{
+ // First find all files that match pattern:
+ for (auto &sourceName : m_sourceNames)
+ {
+ scanFile(sourceName);
+ }
+ return true;
+}
+
+bool CppHeaderCrawler::scanFile(const ossimFilename& sourceName)
+{
+ static const ossimString INCLUDE_STRING = "#include ";
+ static const size_t SIZE_INCLUDE_STRING = INCLUDE_STRING.length();
+
+ // The file may be an absolute path or may need to be searched among include paths:
+ // Open one file:
+ ifstream f(sourceName.string());
+ if (f.fail())
+ {
+ cout << "Failed file open for: " << sourceName << endl;
+ return false;
+ }
+
+ cout << "Scanning file: " << sourceName << endl;
+ bool foundInclude = false;
+ int noIncludeCount = 0;
+ ossimString lineOfCode;
+
+ // Loop to read read one line at a time to check for includes:
+ while (getline(f, lineOfCode) && (noIncludeCount < 10))
+ {
+ ossimString substring(lineOfCode.substr(0, SIZE_INCLUDE_STRING));
+ if (substring != INCLUDE_STRING)
+ {
+ if (foundInclude)
+ noIncludeCount++;
+ continue;
+ }
+ foundInclude = true;
+ noIncludeCount = 0;
+
+ // Get the include file path/name. Determine if relative or "namespaced". Truly relative
+ // include spec need not be copied to destination directory since the shall be present with
+ // the source build anyway.
+ ossimString includeSpec = lineOfCode.after(INCLUDE_STRING);
+ includeSpec.trim();
+ if (includeSpec.empty())
+ continue;
+ if (includeSpec[0] == '"')
+ {
+ // Relative. Some people are sloppy and use quoted header file spec even when it is really
+ // namespaced, so need to search relative first:
+ includeSpec = includeSpec.after("\"").before("\""); // stop before second quote (in case comments follow)
+ ossimFilename pathFile = sourceName.path().dirCat(includeSpec);
+ if (pathFile.exists())
+ continue;
+ }
+ else
+ {
+ includeSpec = includeSpec.after("<").before(">"); // stop before second quote (in case comments follow)
+ }
+
+ // Search the namespaced include spec list if already entered:
+ auto entry = m_includePathMap.find(includeSpec);
+ if (entry != m_includePathMap.end())
+ continue;
+
+
+ // Exclude copying headers that are in the source tree (not external):
+ auto sourcePath = m_sourceNames.begin();
+ for (; sourcePath != m_sourceNames.end(); ++sourcePath)
+ {
+ if (sourcePath->contains(includeSpec))
+ break;
+ }
+ if (sourcePath!=m_sourceNames.end())
+ continue;
+
+ // First time this external header has been encountered, Find it on the system and save the
+ // associated include path and namespace portion:
+ ossimFilename path = findPath(includeSpec);
+ if (!path.empty())
+ {
+ cout << "Inserting " << includeSpec << endl;
+ m_includePathMap.emplace(includeSpec, path);
+ }
+
+ // Now recursion into the rabbit hole of header dependencies:
+ ossimFilename fullPathFile = path.dirCat(includeSpec);
+ if (fullPathFile.ext().empty())
+ continue; // System include should be on target already
+ scanFile(fullPathFile);
+ }
+ f.close();
+ return true;
+}
+
+bool CppHeaderCrawler::copyHeaders(const ossimFilename& outputDir)
+{
+ ossimFilename path, existingLocation, newLocation;
+ for (auto &header : m_includePathMap)
+ {
+ // Check existence of header on system:
+ existingLocation = header.second.dirCat(header.first);
+ if (!existingLocation.isFile())
+ {
+ cout << "ERROR: Could not find <" << existingLocation << ">. Header was not copied." << endl;
+ continue;
+ }
+
+ // Copy the file to the output directory:
+ newLocation = outputDir.dirCat(header.first);
+ ossimFilename newDir (newLocation.path());
+ ossimFilename newFile(newLocation.file());
+ if (!newDir.createDirectory())
+ {
+ cout << "ERROR: Could not create directory <" << newDir << ">. Check permissions." << endl;
+ return false;
+ }
+
+ existingLocation.copyFileTo(newLocation);
+ cout << "Copied <" << header.first << ">"<< endl;
+ }
+ return true;
+}
+
+ossimFilename CppHeaderCrawler::findPath(const ossimFilename &file)
+{
+ ossimFilename fullPath, result;
+ for (auto &path: m_includeDirs)
+ {
+ fullPath = path.dirCat(file);
+ if (fullPath.exists())
+ {
+ result = path;
+ break;
+ }
+ }
+ return result;
+}
=====================================
cmake/CMakeLists.txt
=====================================
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -35,6 +35,9 @@ INCLUDE(OssimVersion)
INCLUDE(OssimUtilities)
INCLUDE(OssimCommonVariables)
+FILE(REMOVE ${CMAKE_INCLUDE_DIRS_FILE})
+FILE(REMOVE ${CMAKE_FILENAMES_FILE})
+
IF(NOT APPLE)
cmake_minimum_required(VERSION 2.6)
ELSE(NOT APPLE)
=====================================
cmake/CMakeModules/FindOpenCV.cmake
=====================================
--- a/cmake/CMakeModules/FindOpenCV.cmake
+++ b/cmake/CMakeModules/FindOpenCV.cmake
@@ -93,7 +93,7 @@ if (OPENCV_FOUND)
if ( OPENCV_LIBTIFF_LIBRARY )
set( OPENCV_LIBRARIES ${OPENCV_LIBRARIES} ${OPENCV_LIBTIFF_LIBRARY} )
else()
- message( WARNING "Could not find libtiff needed by OpenCV." )
+ message( WARNING "Could not find libtiff needed by OpenCV." )
endif()
# Optional
=====================================
cmake/CMakeModules/OssimCommonVariables.cmake
=====================================
--- a/cmake/CMakeModules/OssimCommonVariables.cmake
+++ b/cmake/CMakeModules/OssimCommonVariables.cmake
@@ -218,7 +218,6 @@ MACRO(OSSIM_ADD_COMMON_SETTINGS)
SET(INSTALL_FRAMEWORK_DIR "Frameworks")
SET(INSTALL_RUNTIME_DIR "bin")
SET(INSTALL_INCLUDE_DIR "include")
-
set(INSTALL_LIBRARY_DIR lib${LIBSUFFIX} CACHE PATH "Installation directory for libraries")
set(INSTALL_ARCHIVE_DIR lib${LIBSUFFIX} CACHE PATH "Installation directory for archive")
mark_as_advanced(LIBSUFFIX)
@@ -280,6 +279,8 @@ MACRO(OSSIM_ADD_COMMON_SETTINGS)
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)
+ SET(CMAKE_INCLUDE_DIRS_FILE "${CMAKE_BINARY_DIR}/CMakeIncludeDirs.txt")
+ SET(CMAKE_FILENAMES_FILE "${CMAKE_BINARY_DIR}/CMakeFileNames.txt")
ENDMACRO(OSSIM_ADD_COMMON_SETTINGS)
=====================================
cmake/CMakeModules/OssimUtilities.cmake
=====================================
--- a/cmake/CMakeModules/OssimUtilities.cmake
+++ b/cmake/CMakeModules/OssimUtilities.cmake
@@ -200,6 +200,9 @@ MACRO(OSSIM_SETUP_APPLICATION)
SETUP_LINK_LIBRARIES()
+ OSSIM_SAVE_INCLUDE_DIRECTORIES()
+ OSSIM_SAVE_FILENAMES()
+
IF(APPLICATION_INSTALL)
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} BUNDLE DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${APPLICATION_COMPONENT_NAME})
@@ -211,6 +214,7 @@ MACRO(OSSIM_SETUP_APPLICATION)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_RUNTIME_DIR}")
+
ENDMACRO(OSSIM_SETUP_APPLICATION)
#####################################################################################################
@@ -337,6 +341,10 @@ MACRO(OSSIM_LINK_LIBRARY)
ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev)
ENDIF(LINK_INSTALL_HEADERS)
ENDIF(LINK_INSTALL_LIB)
+
+ OSSIM_SAVE_INCLUDE_DIRECTORIES()
+ OSSIM_SAVE_FILENAMES()
+
ENDMACRO(OSSIM_LINK_LIBRARY)
MACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
@@ -358,3 +366,33 @@ MACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
ENDIF(EXISTS ${OSSIM_CMAKE_UNINSTALL_CONFIG})
# ENDIF(NOT TEST_UNINSTALL)
ENDMACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
+
+####################################################################################################
+# Writes all include directory paths to a central file for later parsing dependencies
+####################################################################################################
+MACRO(OSSIM_SAVE_INCLUDE_DIRECTORIES)
+ GET_DIRECTORY_PROPERTY(include_dir_list INCLUDE_DIRECTORIES)
+ FOREACH(item ${include_dir_list})
+ FILE(APPEND ${CMAKE_INCLUDE_DIRS_FILE} "${item}\n" )
+ ENDFOREACH()
+ENDMACRO(OSSIM_SAVE_INCLUDE_DIRECTORIES)
+
+
+####################################################################################################
+# Caches all source file names to a central file for later parsing dependencies
+####################################################################################################
+MACRO(OSSIM_SAVE_FILENAMES)
+ #GET_DIRECTORY_PROPERTY(lib_sources LINK_SOURCES)
+ FOREACH(item ${LINK_SOURCE_FILES})
+ FILE(APPEND ${CMAKE_FILENAMES_FILE} "${item}\n" )
+ ENDFOREACH()
+
+ #GET_DIRECTORY_PROPERTY(app_sources APPLICATION_SOURCES)
+ FOREACH(item ${APPLICATION_SOURCE_FILES})
+ FILE(APPEND ${CMAKE_FILENAMES_FILE} "${CMAKE_CURRENT_SOURCE_DIR}/${item}\n" )
+ ENDFOREACH()
+
+ FOREACH(item ${LINK_HEADERS})
+ FILE(APPEND ${CMAKE_FILENAMES_FILE} "${item}\n" )
+ ENDFOREACH()
+ENDMACRO(OSSIM_SAVE_FILENAMES)
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
-ossim (2.3.1-2) UNRELEASED; urgency=medium
+ossim (2.3.2-1) unstable; urgency=medium
+ * Team upload.
+ * New upstream release.
* Bump Standards-Version to 4.1.4, no changes.
+ * Refresh patches.
+ * Update spelling-errors.patch for new typos.
- -- Bas Couwenberg <sebastic at debian.org> Wed, 18 Apr 2018 20:37:51 +0200
+ -- Bas Couwenberg <sebastic at debian.org> Tue, 01 May 2018 16:44:41 +0200
ossim (2.3.1-1) unstable; urgency=medium
=====================================
debian/manpages/ossim-chipper.1
=====================================
--- a/debian/manpages/ossim-chipper.1
+++ b/debian/manpages/ossim-chipper.1
@@ -88,8 +88,8 @@ ossimImageMosaic. Default: ossimImageMosaic.
Example \fB\-\-combiner\-type\fR ossimImageMosaic
.TP
\fB\-\-contrast\fR
-<constrast>
-Apply constrast to input image(s). Valid range:
+<contrast>
+Apply contrast to input image(s). Valid range:
\fB\-1\fR.0 to 1.0
.TP
\fB\-\-cut\-bbox\-ll\fR
=====================================
debian/patches/spelling-errors.patch
=====================================
--- a/debian/patches/spelling-errors.patch
+++ b/debian/patches/spelling-errors.patch
@@ -9,6 +9,8 @@ Description: Fix spelling errors.
* prefered -> preferred
* repaced -> replaced
* explicitely -> explicitly
+ * constrast -> contrast
+ * seperated -> separated
Author: Bas Couwenberg <sebastic at debian.org>
--- a/src/base/ossimDatumFactory.inc
@@ -99,7 +101,7 @@ Author: Bas Couwenberg <sebastic at debian.org>
return outStr;
--- a/src/util/ossimChipperUtil.cpp
+++ b/src/util/ossimChipperUtil.cpp
-@@ -207,7 +207,7 @@ void ossimChipperUtil::addArguments(ossi
+@@ -208,11 +208,11 @@ void ossimChipperUtil::addArguments(ossi
au->addCommandLineOption("--central-meridian","<central_meridian_in_decimal_degrees>\nNote if set this will be used for the central meridian of the projection. This can be used to lock the utm zone.");
@@ -108,6 +110,38 @@ Author: Bas Couwenberg <sebastic at debian.org>
au->addCommandLineOption("--color-table","<color-table.kwl>\nhillshade or color-relief option - Keyword list containing color table for color-relief option.");
+- au->addCommandLineOption( "--contrast", "<constrast>\nApply constrast to input image(s). Valid range: -1.0 to 1.0" );
++ au->addCommandLineOption( "--contrast", "<contrast>\nApply contrast to input image(s). Valid range: -1.0 to 1.0" );
+
+ au->addCommandLineOption("--cut-bbox-xywh", "<x>,<y>,<width>,<height>\nSpecify a comma separated bounding box.");
+
+@@ -245,7 +245,7 @@ void ossimChipperUtil::addArguments(ossi
+
+ au->addCommandLineOption("--exaggeration", "<factor>\nMultiplier for elevation values when computing surface normals. Has the effect of lengthening shadows for oblique lighting.\nRange: .0001 to 50000, Default = 1.0");
+
+- au->addCommandLineOption("--fullres-xys", "<full res center x>,<full res center y>,<scale>[,<scale>]\nSpecify a full resolution x,y point (Used as pivot and center cut) and scale, comma seperated with no spaces. If two scales are specified then first is x and second is y else x and y are set to equal scales");
++ au->addCommandLineOption("--fullres-xys", "<full res center x>,<full res center y>,<scale>[,<scale>]\nSpecify a full resolution x,y point (Used as pivot and center cut) and scale, comma separated with no spaces. If two scales are specified then first is x and second is y else x and y are set to equal scales");
+
+ au->addCommandLineOption("-h or --help", "Display this help and exit.");
+
+@@ -1881,7 +1881,7 @@ ossimRefPtr<ossimSingleImageChain> ossim
+ setupChainHistogram( ic );
+ }
+
+- // Brightness constrast setup:
++ // Brightness contrast setup:
+ if ( hasBrightnesContrastOperation() )
+ {
+ // Assumption bright contrast filter in chain:
+@@ -2066,7 +2066,7 @@ ossimRefPtr<ossimSingleImageChain> ossim
+ setupChainHistogram( ic , std::make_shared<ossimSrcRecord>(rec));
+ }
+
+- // Brightness constrast setup:
++ // Brightness contrast setup:
+ if ( hasBrightnesContrastOperation() )
+ {
+ // Assumption bright contrast filter in chain:
--- a/src/util/ossimHillshadeTool.cpp
+++ b/src/util/ossimHillshadeTool.cpp
@@ -233,7 +233,7 @@ void ossimHillshadeTool::setUsage(ossimA
@@ -174,3 +208,27 @@ Author: Bas Couwenberg <sebastic at debian.org>
ossimGpt origin;
if (!getProjectionOrigin(origin))
origin = m_aoiGroundRect.midPoint();
+--- a/include/ossim/imaging/ossimSingleImageChain.h
++++ b/include/ossim/imaging/ossimSingleImageChain.h
+@@ -473,7 +473,7 @@ public:
+ void setBrightnessContrastFlag(bool flag);
+
+ /**
+- * @brief Get the brightness constrast flag.
++ * @brief Get the brightness contrast flag.
+ * @return true or false.
+ */
+ bool getBrightnessContrastFlag() const;
+--- a/share/ossim/templates/ossim_preferences_template
++++ b/share/ossim/templates/ossim_preferences_template
+@@ -687,8 +687,8 @@ tfrd_iamp_file: $(OSSIM_INSTALL_PREFIX)/
+ // allows on to specify configuration options and parsing for the hdf5 plugin
+ // In this example we have only the Radiance file supported for VIIRS data
+ // to get a listing of dataset use the ossim-info -d on any hdf5 dataset file
+-// and look at the top for the dataset comma seperated list of dataset paths.
+-// You can add a comma seperated list for renderable_datasets and only those will show
++// and look at the top for the dataset comma separated list of dataset paths.
++// You can add a comma separated list for renderable_datasets and only those will show
+ // up in an ossim-info
+ //
+ hdf5.options.max_recursion_level: 8
=====================================
include/ossim/imaging/ossimNitfWriterBase.h
=====================================
--- a/include/ossim/imaging/ossimNitfWriterBase.h
+++ b/include/ossim/imaging/ossimNitfWriterBase.h
@@ -1,18 +1,16 @@
-//----------------------------------------------------------------------------
+//---
//
-// License: MIT
-//
-// See LICENSE.txt file in the top level directory for more details.
+// License: MIT
//
// Author: David Burken
//
// Description: OSSIM nitf writer base class to hold methods common to
// all nitf writers.
//
-//----------------------------------------------------------------------------
-// $Id: ossimNitfWriterBase.h 2981 2011-10-10 21:14:02Z david.burken $
+//---
+// $Id$
#ifndef ossimNitfWriterBase_HEADER
-#define ossimNitfWriterBase_HEADER
+#define ossimNitfWriterBase_HEADER 1
#include <ossim/imaging/ossimImageFileWriter.h>
#include <ossim/support_data/ossimNitfRegisteredTag.h>
@@ -148,6 +146,19 @@ protected:
ossimNitfImageHeaderV2_X* hdr);
/**
+ * @brief Adds the GEOLOB tag.
+ *
+ * This will only be added if projection is geographic.
+ *
+ * @param mapInfo ossimMapProjectionInfo to use to set tag with.
+ * @param hdr The header to write to.
+ *
+ * @note Currently only used with map projected images.
+ */
+ void addGeolobTag(const ossimMapProjection* mapProj,
+ ossimNitfImageHeaderV2_X* hdr);
+
+ /**
* @brief Adds the RPC00B tag.
*
* @param rect Requested rectangle of image to write.
@@ -185,6 +196,11 @@ protected:
*/
bool theEnableBlockaTagFlag;
+ /**
+ * @brief If true user wants to set GEOLOG tag. (DEFAULT = true)
+ * This will only be set if a geographic projection.
+ */
+ bool theEnableGeolobTagFlag;
private:
=====================================
include/ossim/projection/ossimNitfProjectionFactory.h
=====================================
--- a/include/ossim/projection/ossimNitfProjectionFactory.h
+++ b/include/ossim/projection/ossimNitfProjectionFactory.h
@@ -1,6 +1,5 @@
-//----------------------------------------------------------------------------
-//
-// License: See top level LICENSE.txt file.
+//---
+// License: MIT
//
// Author: Matt Revelle
// David Burken
@@ -8,9 +7,9 @@
// Description:
//
// Contains class declaration for ossimNitfProjectionFactory.
-//
-// $Id: ossimNitfProjectionFactory.h 18905 2011-02-16 13:30:11Z dburken $
-//----------------------------------------------------------------------------
+//---
+// $Id$
+
#ifndef ossimNitfProjectionFactory_HEADER
#define ossimNitfProjectionFactory_HEADER 1
@@ -236,9 +235,19 @@ private:
* @return true if BLOCKA tag was parsed.
*/
bool getBlockaPoints(const ossimNitfImageHeader* hdr,
- std::vector<ossimGpt>& gpts)const;//,
- //const ossimFilename& filename) const;
-
+ std::vector<ossimGpt>& gpts)const;
+
+ /**
+ * @param hdr The nitf image header from the currently opened nitf file.
+ *
+ * @param gpts Ground points to initialize from GEOLOB tag. This should
+ * be an empty vector.
+ *
+ * @return true if GEOLOB tag was parsed.
+ */
+ bool getGeolobPoints(const ossimNitfImageHeader* hdr,
+ std::vector<ossimGpt>& gpts)const;
+
/**
* Private constructor, users must go through instance() method.
*/
=====================================
include/ossim/support_data/ossimNitfGeolobTag.h
=====================================
--- /dev/null
+++ b/include/ossim/support_data/ossimNitfGeolobTag.h
@@ -0,0 +1,200 @@
+//---
+//
+// License: MIT
+//
+// Author: David Burken
+//
+// Description: GEOLOB tag class declaration.
+//
+// References:
+//
+// 1) DIGEST 2.1 Part 2 - Annex D
+// Appendix 1 - NSIF Standard Geospatial Support Data Extension
+//
+// 2) STDI-0006
+//---
+// $Id$
+
+#ifndef ossimNitfGeolobTag_HEADER
+#define ossimNitfGeolobTag_HEADER 1
+
+#include <ossim/support_data/ossimNitfRegisteredTag.h>
+#include <ossim/base/ossimConstants.h>
+#include <string>
+
+class OSSIM_DLL ossimNitfGeolobTag : public ossimNitfRegisteredTag
+{
+public:
+ enum
+ {
+ ARV_SIZE = 9,
+ BRV_SIZE = 9,
+ LSO_SIZE = 15,
+ PSO_SIZE = 15,
+ TAG_SIZE = 48
+ // -----
+ // 48
+ };
+
+ /** default constructor */
+ ossimNitfGeolobTag();
+
+ /**
+ * Parse method.
+ *
+ * @param in Stream to parse.
+ */
+ virtual void parseStream(ossim::istream& in);
+
+ /**
+ * Write method.
+ *
+ * @param out Stream to write to.
+ */
+ virtual void writeStream(ossim::ostream& out);
+
+ /**
+ * @brief Print method that outputs a key/value type format
+ * adding prefix to keys.
+ * @param out Stream to output to.
+ * @param prefix Prefix added to key like "image0.";
+ */
+ virtual std::ostream& print(std::ostream& out,
+ const std::string& prefix) const;
+
+ /**
+ * @brief Gets the ARV field.
+ *
+ * Longitude density:
+ * This field shall contain the pixel ground spacing in E/W direction that
+ * is the number of pixels or elements intervals in 360°
+ *
+ * Pixel size in decimal degree = 360.0 / AVR
+ *
+ * @return ARV field as a string.
+ */
+ std::string getArvString() const;
+
+ /**
+ * @brief Gets the ARV field.
+ * @return ARV field as a positive integer.
+ **/
+ ossim_uint32 getArv() const;
+
+ /**
+ * @brief Gets degrees per pixel in lonitude direction from BRV field.
+ *
+ * Pixel size in decimal degree = 360.0 / AVR
+ *
+ * @return Degrees per pixel in lonitude direction.
+ */
+ ossim_float64 getDegreesPerPixelLon() const;
+
+ /**
+ * @brief Sets the ARV field. Valid range: 000000002 to 999999999
+ * @pararm arv
+ */
+ void setArv(ossim_uint32 arv);
+
+ /**
+ * @brief Sets the ARV field from decimal degrees per pixel longitude.
+ * @pararm deltaLon
+ */
+ void setDegreesPerPixelLon(const ossim_float64& deltaLon);
+
+ /**
+ * @brief Gets the BRV field.
+ *
+ * Latitude density:
+ * This field shall contain the pixel ground spacing in N/S direction that
+ * is the number of pixels or elements intervals in 360°.
+ *
+ * Pixel size in decimal degree = 360.0 / BVR
+ *
+ * @return BRV field as a string.
+ */
+ std::string getBrvString() const;
+
+ /**
+ * @brief Gets the BRV field.
+ * @return BRV field as a positive integer.
+ **/
+ ossim_uint32 getBrv() const;
+
+ /**
+ * @brief Gets degrees per pixel in latitude direction from BRV field.
+ *
+ * Pixel size in decimal degree = 360.0 / BVR
+ *
+ * @return Degrees per pixel in latitude direction.
+ */
+ ossim_float64 getDegreesPerPixelLat() const;
+
+ /**
+ * @brief Sets the BRV field. Valid range: 000000002 to 999999999
+ * @pararm brv
+ */
+ void setBrv(ossim_uint32 brv);
+
+ /**
+ * @brief Sets the BRV field from decimal degrees per pixel latitude.
+ * @pararm deltaLon
+ */
+ void setDegreesPerPixelLat(const ossim_float64& deltaLat);
+
+ /**
+ * @brief Gets the LSO field.
+ *
+ * Longitude of Reference Origin:
+ * This field shall contain the longitude of the origin pixel
+ * (row number 0, column number 0) in the absolute coordinate system.
+ *
+ * @return LSO field as a string.
+ */
+ std::string getLsoString() const;
+
+ /**
+ * @brief Gets the LSO field(Longitude Origin).
+ * @return LSO field as a positive integer.
+ **/
+ ossim_float64 getLso() const;
+
+ /**
+ * @brief Sets the LSO field(Longitude Origin).
+ * Valid range: -180.0 to +180.0
+ * @pararm lso
+ */
+ void setLso(const ossim_float64& lso);
+
+ /**
+ * @brief Gets the PSO field.
+ *
+ * Latitude of Reference Origin:
+ * This field shall contain the latitude of the origin pixel
+ * (row number 0, column number 0) in the absolute coordinate system.
+ *
+ * @return PSO field as a string.
+ */
+ std::string getPsoString() const;
+
+ /**
+ * @brief Gets the PSO field(Latitude Origin).
+ * @return PSO field as a positive integer.
+ **/
+ ossim_float64 getPso() const;
+
+ /**
+ * @brief Sets the PSO field(Latitude Origin).
+ * Valid range: -90.0 to +90.0
+ * @pararm pso
+ */
+ void setPso(const ossim_float64& pso);
+
+protected:
+
+ std::string m_tagData;
+
+TYPE_DATA
+};
+
+#endif /* End of "#ifndef ossimNitfGeolobTag_HEADER" */
=====================================
include/ossim/support_data/ossimNitfLocalGeographicTag.h deleted
=====================================
--- a/include/ossim/support_data/ossimNitfLocalGeographicTag.h
+++ /dev/null
@@ -1,81 +0,0 @@
-//*******************************************************************
-// Copyright (C) 2004 Intelligence Data Systems.
-//
-// LICENSE: MIT
-//
-// see top level LICENSE.txt
-//
-// Author: Garrett Potts
-// Description: Nitf support class
-//
-//********************************************************************
-// $Id: ossimNitfLocalGeographicTag.h 22013 2012-12-19 17:37:20Z dburken $
-#ifndef ossimNitfLocalGeographicTag_HEADER
-#define ossimNitfLocalGeographicTag_HEADER
-#include <ossim/support_data/ossimNitfRegisteredTag.h>
-
-class OSSIM_DLL ossimNitfLocalGeographicTag : public ossimNitfRegisteredTag
-{
-public:
- ossimNitfLocalGeographicTag();
- virtual ~ossimNitfLocalGeographicTag();
-
- virtual void parseStream(std::istream& in);
- virtual void writeStream(std::ostream& out);
-
- virtual void clearFields();
-
- virtual void setDegreesPerPixelLat(double deltaLat);
- virtual void setDegreesPerPixelLon(double deltaLon);
- virtual void setLatOrigin(double origin);
- virtual void setLonOrigin(double origin);
-
-protected:
- /**
- * FIELD: ARV
- *
- * required 9 byte field
- *
- * Longitude density
- *
- * This field shall contain the pixel ground spacing in E/W direction that is
- * the number of pixels or elements intervals in 360 degrees.
- * 9 BCS-N positive integer 000000002 to 999999999.
- */
- char theLonDensity[10];
-
- /**
- * FIELD: BRV
- *
- * required 9 byte field
- *
- * Latitude density
- *
- * This field shall contain the pixel ground spacing in N/S direction that is the number of
- * pixels or elements intervals in 360 degrees. 9 BCS-N positive integer 000000002 to 999999999 R
- */
- char theLatDensity[10];
-
- /**
- * FIELD: LSO
- *
- * required 15 byte field
- *
- * Longitude of Reference Origin This field shall contain the longitude of the origin pixel
- * (row number 0, column number 0) in the absolute coordinate system. 15 BCS-N R
- */
- char theLonOrigin[16];
-
- /**
- * FIELD: PSO
- *
- * required 15 byte field
- *
- * Latitude of Reference Origin This field shall contain the latitude of the origin
- * pixel (row number 0, column number 0) in the absolute coordinate system. 15 BCS-N R
- */
- char theLatOrigin[15];
-
-TYPE_DATA
-};
-#endif
=====================================
include/ossim/util/ossimChipperUtil.h
=====================================
--- a/include/ossim/util/ossimChipperUtil.h
+++ b/include/ossim/util/ossimChipperUtil.h
@@ -646,11 +646,25 @@ private:
* Keys:
* IMAGE_SPACE_SCALE_X_KW
* IMAGE_SPACE_SCALE_Y_KW
+ * FULLRES_XYS
*
* Scale will be 1.0, 1.0 if keys not found.
*/
- void getImageSpaceScale( ossimDpt& imageSpaceScale ) const;
-
+ void getImageSpaceScale(ossimDpt &imageSpaceScale) const;
+
+ /**
+ * @brief Gets the image space pivot.
+ *
+ * This is a "chip" operation only. Will extract the center
+ * from the FULLRES keyword
+ *
+ * Keys:
+ * FULLRES_XYS
+ *
+ * This will return NaN if not set
+ */
+ void getImageSpacePivot(ossimDpt &imageSpacePivot) const;
+
/**
* @brief Gets rotation.
*
=====================================
scripts/create-sandbox.sh
=====================================
--- /dev/null
+++ b/scripts/create-sandbox.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+# OCPLD -- Ossim CoPy Library Dependencies
+# Adapted from code written by Hemanth.HM
+
+# Uncomment to step/debug
+#set -x; trap read debug
+pushd `dirname ${BASH_SOURCE[0]}` >/dev/null
+export SCRIPT_DIR=`pwd -P`
+popd >/dev/null
+
+if [ $# -ne 2 ]
+then
+ echo "Usage: `basename $0` <ossim_build_dir> <sandbox_dir>"
+ exit 1
+fi
+
+OSSIM_BUILD_DIR=$1
+SANDBOX_DIR=$2
+
+echo "Copying libraries..."
+$SCRIPT_DIR/ocpld.sh $OSSIM_BUILD_DIR/lib $SANDBOX_DIR/lib
+if [ $? -ne 0 ]; then
+ echo; echo "Error encountered during ocpld."
+ popd>/dev/null
+ exit 1
+fi
+
+echo "Copying headers..."
+ossim-header-crawl $OSSIM_BUILD_DIR $SANDBOX_DIR/include
+if [ $? -ne 0 ]; then
+ echo; echo "Error encountered during ossim-header-crawl."
+ popd>/dev/null
+ exit 1
+fi
+
+echo; echo "Sandbox of dependencies has been successfully created in $SANDBOX_DIR."; echo
\ No newline at end of file
=====================================
scripts/ocpld.sh
=====================================
--- /dev/null
+++ b/scripts/ocpld.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# OCPLD -- Ossim CoPy Library Dependencies
+# Adapted from code written by Hemanth.HM
+
+# Uncomment to step/debug
+#set -x; trap read debug
+
+function do_cpld {
+ echo; echo "Scanning dependencies of $1"
+ deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1~/^\//{print $1}$3~/^\//{print $3}' | sed 's/,$/\n/')
+
+ for dep in $deps
+ do
+ b=$(basename $dep)
+ if [ -e $2/$b ]; then
+ echo " $b already there."
+ else
+ echo " copying $dep to $2"
+ cp -n $dep $2
+ fi
+ done
+}
+export -f do_cpld
+
+if [[ $# < 2 ]]; then
+ s=$(basename $0)
+ echo; echo "Usage: $s <path to OSSIM libraries> <destination path for dependencies>"; echo
+ exit 1
+fi
+
+if [ ! -d $1 ]; then
+ echo; echo "<$1> is not a valid input directory. Aborting..."; echo
+ exit 1
+fi
+
+if [ ! -d $2 ]; then
+ echo; echo "Output directory <$2> does not exist. Creating..."; echo
+ mkdir -p $2
+fi
+
+find $1 -type f -name "*.so" -exec bash -c "do_cpld {} $2" \;
+
+echo; echo "All dependencies were copied to $2. Done!"; echo
\ No newline at end of file
=====================================
share/ossim/templates/ossim_preferences_template
=====================================
--- a/share/ossim/templates/ossim_preferences_template
+++ b/share/ossim/templates/ossim_preferences_template
@@ -394,9 +394,22 @@ plugin55.file: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_geopdf_plugi
//---
// Always put gdal last as it has duplicate readers and need to pick ours up
// first.
-//---
-//plugin85.file: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_gdal_plugin.so
-// plugin85.options:
+//
+// The enable and disable is a regular expression. a REgular expression with
+// the value of ".*" will match all and a regular expression with the value of
+// "NITF|HFA" will match HFA or NITF drivers.
+//
+// The plugin also support environment variables:
+// GDAL_ENABLE_DRIVERS=
+// GDAL_DISABLE_DRIVERS=
+//---
+plugin85.file: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_gdal_plugin.so
+plugin85.options:"""
+ reader_factory.location:back
+ writer_factory.location:back
+ enable_drivers: .*
+ //disable_drivers:
+"""
//---
// Old style with no options keyword:
=====================================
src/imaging/ossimImageRenderer.cpp
=====================================
--- a/src/imaging/ossimImageRenderer.cpp
+++ b/src/imaging/ossimImageRenderer.cpp
@@ -281,7 +281,8 @@ void ossimImageRenderer::ossimRendererSubRectInfo::splitView(std::vector<ossimRe
if(!splitFlags)
{
return;
- }
+ }
+
// just do horizontal split for test
ossimIrect vrect(m_Vul,
@@ -295,33 +296,19 @@ void ossimImageRenderer::ossimRendererSubRectInfo::splitView(std::vector<ossimRe
if((w2 <2)&&(h2<2))
{
- if(splitFlags)
+ ossimRendererSubRectInfo rect(m_transform.get(),m_Vul,
+ m_Vul,
+ m_Vul,
+ m_Vul);
+ rect.m_viewBounds = m_viewBounds;
+ rect.transformViewToImage();
+
+ if(rect.imageHasNans())
{
- ossimRendererSubRectInfo rect(m_transform.get(),m_Vul,
- m_Vul,
- m_Vul,
- m_Vul);
- rect.m_viewBounds = m_viewBounds;
- rect.transformViewToImage();
-
- if(rect.imageHasNans())
- {
- if(rect.m_viewBounds->intersects(rect.getViewRect()))
- {
- result.push_back(rect);
- }
- }
- // if(rect.imageIsNan())
- // {
- // if(rect.m_viewBounds->intersects(rect.getViewRect()))
- // {
- // result.push_back(rect);
- // }
- // }
- // else
- // {
- // result.push_back(rect);
- // }
+ if(rect.m_viewBounds->intersects(rect.getViewRect()))
+ {
+ result.push_back(rect);
+ }
}
}
// horizontal split if only the upper left and lower left
@@ -393,6 +380,7 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::tooBig()const
ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
{
+ #if 0
ossim_uint16 result = SPLIT_NONE;
ossimDrect vRect = getViewRect();
@@ -401,7 +389,7 @@ ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
// very small rectangles in canBilinearInterpolate(...) method.
// DRB 05 Dec. 2017
//---
- if ( vRect.width() < 8 && vRect.height() < 8 )
+ if ( imageHasNans()||(vRect.width() < 8 && vRect.height() < 8) )
{
return result;
}
@@ -484,6 +472,88 @@ ossim_uint16 ossimImageRenderer::ossimRendererSubRectInfo::getSplitFlags()const
}
return result;
+#else
+ ossim_uint16 result = SPLIT_NONE;
+ ossimDrect vRect = getViewRect();
+
+ if(imageHasNans()||tooBig())
+ {
+ if(m_viewBounds->intersects(getViewRect()))
+ {
+ result = SPLIT_ALL;
+ }
+ else
+ {
+ return result;
+ }
+ }
+ /*
+ if(result != SPLIT_ALL)
+ {
+ if(m_ulRoundTripError.hasNans()&&m_urRoundTripError.hasNans()&&
+ m_lrRoundTripError.hasNans()&&m_llRoundTripError.hasNans())
+ {
+ if(m_viewBounds->intersects(getViewRect()))
+ {
+ result = SPLIT_ALL;
+ }
+ return result;
+ }
+ else if(tooBig())
+ {
+ result = SPLIT_ALL;
+ }
+ }
+
+ if(result != SPLIT_ALL)
+ {
+ if(m_ulRoundTripError.hasNans()) result |= UPPER_LEFT_SPLIT_FLAG;
+ if(m_urRoundTripError.hasNans()) result |= UPPER_RIGHT_SPLIT_FLAG;
+ if(m_lrRoundTripError.hasNans()) result |= LOWER_RIGHT_SPLIT_FLAG;
+ if(m_llRoundTripError.hasNans()) result |= LOWER_LEFT_SPLIT_FLAG;
+ }
+*/
+ if(result != SPLIT_ALL)
+ {
+ ossim_float64 sensitivityScale = m_ImageToViewScale.length();
+ //std::cout << sensitivityScale << std::endl;
+ if(sensitivityScale < 1.0) sensitivityScale = 1.0/sensitivityScale;
+
+
+ // if((m_ulRoundTripError.length() > sensitivityScale)||
+ // (m_urRoundTripError.length() > sensitivityScale)||
+ // (m_lrRoundTripError.length() > sensitivityScale)||
+ // (m_llRoundTripError.length() > sensitivityScale))
+ // {
+ // std::cout << "________________\n";
+
+ // std::cout << "Sens: " << sensitivityScale << "\n"
+ // << "View: " << getViewRect() << "\n"
+ // << "UL: " << m_ulRoundTripError.length() << "\n"
+ // << "UR: " << m_urRoundTripError.length() << "\n"
+ // << "LR: " << m_lrRoundTripError.length() << "\n"
+ // << "LL: " << m_llRoundTripError.length() << "\n";
+ // }
+ // if(m_ulRoundTripError.length() > sensitivityScale) result |= UPPER_LEFT_SPLIT_FLAG;
+ // if(m_urRoundTripError.length() > sensitivityScale) result |= UPPER_RIGHT_SPLIT_FLAG;
+ // if(m_lrRoundTripError.length() > sensitivityScale) result |= LOWER_RIGHT_SPLIT_FLAG;
+ // if(m_llRoundTripError.length() > sensitivityScale) result |= LOWER_LEFT_SPLIT_FLAG;
+ // std::cout << result << " == " << SPLIT_ALL << "\n";
+
+ if((result!=SPLIT_ALL)&&!canBilinearInterpolate(sensitivityScale))
+ {
+ // std::cout << "TESTING BILINEAR!!!!\n";
+ result = SPLIT_ALL;
+
+ }
+ else
+ {
+ // std::cout << "CAN BILINEAR!!!!\n";
+ }
+ }
+
+ return result;
+#endif
}
void ossimImageRenderer::ossimRendererSubRectInfo::transformViewToImage()
@@ -692,51 +762,50 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double
{
bool result = false;
- // now check point placement
+ // now check point placement
ossimDpt imageToViewScale = getAbsValueImageToViewScales();
double testScale = imageToViewScale.length();
-// ossimDpt errorUl = transform->getRoundTripErrorView(m_Vul);
-// ossimDpt errorUr = transform->getRoundTripErrorView(m_Vur);
-// ossimDpt errorLr = transform->getRoundTripErrorView(m_Vlr);
-// ossimDpt errorLl = transform->getRoundTripErrorView(m_Vll);
-
-// if((errorUl.length() > 2 )||
-// (errorUr.length() > 2 )||
-// (errorLr.length() > 2 )||
-// (errorLl.length() > 2))
-// {
-// return result;
-// }
-// std::cout << "_______________________\n"
-// << "errorUl: " << errorUl << "\n"
-// << "errorUr: " << errorUr << "\n"
-// << "errorLr: " << errorLr << "\n"
-// << "errorLl: " << errorLl << "\n";
+ // ossimDpt errorUl = transform->getRoundTripErrorView(m_Vul);
+ // ossimDpt errorUr = transform->getRoundTripErrorView(m_Vur);
+ // ossimDpt errorLr = transform->getRoundTripErrorView(m_Vlr);
+ // ossimDpt errorLl = transform->getRoundTripErrorView(m_Vll);
+
+ // if((errorUl.length() > 2 )||
+ // (errorUr.length() > 2 )||
+ // (errorLr.length() > 2 )||
+ // (errorLl.length() > 2))
+ // {
+ // return result;
+ // }
+ // std::cout << "_______________________\n"
+ // << "errorUl: " << errorUl << "\n"
+ // << "errorUr: " << errorUr << "\n"
+ // << "errorLr: " << errorLr << "\n"
+ // << "errorLl: " << errorLl << "\n";
// if there is a large shrink or expansion then just return true.
// You are probably not worried about error in bilinear interpolation
//
- if((testScale > 256)||
- (testScale < 1.0/256.0))
+ if ((testScale > 256) ||
+ (testScale < 1.0 / 256.0))
{
- return true;
+ return true;
}
- if(m_VulScale.hasNans()||
- m_VurScale.hasNans()||
- m_VlrScale.hasNans()||
- m_VllScale.hasNans())
+ if (m_VulScale.hasNans() ||
+ m_VurScale.hasNans() ||
+ m_VlrScale.hasNans() ||
+ m_VllScale.hasNans())
{
return result;
}
-// std::cout << "ulScale: " << m_VulScale << "\n"
-// << "urScale: " << m_VurScale << "\n"
-// << "lrScale: " << m_VlrScale << "\n"
-// << "llScale: " << m_VllScale << "\n";
-
+ // std::cout << "ulScale: " << m_VulScale << "\n"
+ // << "urScale: " << m_VurScale << "\n"
+ // << "lrScale: " << m_VlrScale << "\n"
+ // << "llScale: " << m_VllScale << "\n";
// check overage power of 2 variance
// If there is a variance of 1 resolution level
@@ -753,84 +822,64 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double
// std::cout << log(averageLrScale)/(log(2)) << "\n";
// std::cout << log(averageLlScale)/(log(2)) << "\n";
-
- ossim_float64 ratio1 = averageUlScale/averageUrScale;
- ossim_float64 ratio2 = averageUlScale/averageLrScale;
- ossim_float64 ratio3 = averageUlScale/averageLlScale;
+ ossim_float64 ratio1 = averageUlScale / averageUrScale;
+ ossim_float64 ratio2 = averageUlScale / averageLrScale;
+ ossim_float64 ratio3 = averageUlScale / averageLlScale;
// std::cout << "_________________________\n";
// std::cout << "ratio1: " << ratio1 << "\n";
// std::cout << "ratio2: " << ratio2 << "\n";
// std::cout << "ratio3: " << ratio3 << "\n";
-
// make sure all are within a power of 2 shrink or expand
- // which means the range of each ratio should be
+ // which means the range of each ratio should be
// between .5 and 2
- result = (((ratio1 < 2) && (ratio1 > 0.5))&&
- ((ratio2 < 2) && (ratio2 > 0.5))&&
- ((ratio3 < 2) && (ratio3 > 0.5)));
+ result = (((ratio1 < 2) && (ratio1 > 0.5)) &&
+ ((ratio2 < 2) && (ratio2 > 0.5)) &&
+ ((ratio3 < 2) && (ratio3 > 0.5)));
//result = ((diff1<=2)&&(diff2<=2)&&(diff3<=2));
//std::cout << "DIFF1: " << diff1 << std::endl;
//std::cout << "DIFF2: " << diff2 << std::endl;
//std::cout << "DIFF3: " << diff3 << std::endl;
-
- if(result)
+ if (result)
{
#if 1
ossimDpt vUpper, vRight, vBottom, vLeft, vCenter;
ossimDpt iUpper, iRight, iBottom, iLeft, iCenter;
ossimDpt testUpper, testRight, testBottom, testLeft, testCenter;
- ossim2dBilinearTransform viewToImageTransform(m_Vul, m_Vur, m_Vlr, m_Vll
- ,m_Iul, m_Iur, m_Ilr, m_Ill);
-
-// std::cout << "vMid: " << testMid << "\n";
-// std::cout << "testMid: " << testMid << "\n";
-// std::cout << "testCenter: " << testCenter << "\n";
-
getViewMids(vUpper, vRight, vBottom, vLeft, vCenter);
-
- // do a bilinear transform of some test points
- viewToImageTransform.forward(vUpper, iUpper);
- viewToImageTransform.forward(vRight, iRight);
- viewToImageTransform.forward(vBottom, iBottom);
- viewToImageTransform.forward(vLeft, iLeft);
- viewToImageTransform.forward(vCenter, iCenter);
-
-
- // viewToImageTransform.forward(vMid, iTestMid);
- //m_transform->viewToImage(vMid, testCenter);
+ getImageMids(iUpper, iRight, iBottom, iLeft, iCenter);
- //getImageMids(iUpper, iRight, iBottom, iLeft, iCenter);
-
// get the model centers for the mid upper left right bottom
m_transform->viewToImage(vCenter, testCenter);
- if(testCenter.hasNans())
+
+ if (testCenter.hasNans())
{
- return false;
+ return false;
}
+
m_transform->viewToImage(vUpper, testUpper);
- if(testUpper.hasNans())
+ if (testCenter.hasNans())
{
- return false;
+ return false;
}
m_transform->viewToImage(vRight, testRight);
- if(testRight.hasNans())
+ if (testRight.hasNans())
{
- return false;
+ return false;
}
m_transform->viewToImage(vBottom, testBottom);
- if(testBottom.hasNans())
+ if (testBottom.hasNans())
{
- return false;
+ return false;
}
m_transform->viewToImage(vLeft, testLeft);
- if(testLeft.hasNans())
+ if (testLeft.hasNans())
{
- return false;
+ return false;
}
// now get the model error to bilinear estimate of those points
@@ -839,23 +888,18 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double
double errorCheck3 = (testRight - iRight).length();
double errorCheck4 = (testBottom - iBottom).length();
double errorCheck5 = (testLeft - iLeft).length();
- result = ((errorCheck1 < error)&&
- (errorCheck2 < error)&&
- (errorCheck3 < error)&&
- (errorCheck4 < error)&&
+ result = ((errorCheck1 < error) &&
+ (errorCheck2 < error) &&
+ (errorCheck3 < error) &&
+ (errorCheck4 < error) &&
(errorCheck5 < error));
- // if(!result)
- // {
- // std::cout <<"__________________________\n"
- // << "ERROR1:" <<errorCheck1 << "\n"
- // << "ERROR2:" <<errorCheck2 << "\n"
- // << "ERROR3:" <<errorCheck3 << "\n"
- // << "ERROR4:" <<errorCheck4 << "\n"
- // << "ERROR5:" <<errorCheck5 << "\n"
- // << "SENS: " << error << "\n";
-
- // std::cout << "Can't bilinear!!\n";
- // }
+ // std::cout <<"__________________________\n"
+ // << "ERROR1:" <<errorCheck1 << "\n"
+ // << "ERROR2:" <<errorCheck2 << "\n"
+ // << "ERROR3:" <<errorCheck3 << "\n"
+ // << "ERROR4:" <<errorCheck4 << "\n"
+ // << "ERROR5:" <<errorCheck5 << "\n"
+ // << "SENS: " << error << "\n";
#else
ossimDpt vUpper, vRight, vBottom, vLeft, vCenter;
@@ -865,82 +909,81 @@ bool ossimImageRenderer::ossimRendererSubRectInfo::canBilinearInterpolate(double
getViewMids(vUpper, vRight, vBottom, vLeft, vCenter);
getImageMids(iUpper, iRight, iBottom, iLeft, iCenter);
- ossimDpt iFullRes(iCenter.x*imageToViewScale.x,
- iCenter.y*imageToViewScale.y);
+ ossimDpt iFullRes(iCenter.x * imageToViewScale.x,
+ iCenter.y * imageToViewScale.y);
m_transform->viewToImage(vCenter, testCenter);
- if(testCenter.hasNans())
+ if (testCenter.hasNans())
{
- return false;
+ return false;
}
- ossimDpt testFullRes(testCenter.x*imageToViewScale.x,
- testCenter.y*imageToViewScale.y);
+ ossimDpt testFullRes(testCenter.x * imageToViewScale.x,
+ testCenter.y * imageToViewScale.y);
double errorCheck1 = (testFullRes - iFullRes).length();
- iFullRes = ossimDpt(iUpper.x*imageToViewScale.x,
- iUpper.y*imageToViewScale.y);
+ iFullRes = ossimDpt(iUpper.x * imageToViewScale.x,
+ iUpper.y * imageToViewScale.y);
m_transform->viewToImage(vUpper, testCenter);
- if(testCenter.hasNans())
+ if (testCenter.hasNans())
{
- return false;
+ return false;
}
- testFullRes = ossimDpt(testCenter.x*imageToViewScale.x,
- testCenter.y*imageToViewScale.y);
+ testFullRes = ossimDpt(testCenter.x * imageToViewScale.x,
+ testCenter.y * imageToViewScale.y);
double errorCheck2 = (testFullRes - iFullRes).length();
- iFullRes = ossimDpt(iRight.x*imageToViewScale.x,
- iRight.y*imageToViewScale.y);
+ iFullRes = ossimDpt(iRight.x * imageToViewScale.x,
+ iRight.y * imageToViewScale.y);
m_transform->viewToImage(vRight, testCenter);
- if(testCenter.hasNans())
+ if (testCenter.hasNans())
{
- return false;
+ return false;
}
- testFullRes = ossimDpt(testCenter.x*imageToViewScale.x,
- testCenter.y*imageToViewScale.y);
+ testFullRes = ossimDpt(testCenter.x * imageToViewScale.x,
+ testCenter.y * imageToViewScale.y);
double errorCheck3 = (testFullRes - iFullRes).length();
- iFullRes = ossimDpt(iBottom.x*imageToViewScale.x,
- iBottom.y*imageToViewScale.y);
+ iFullRes = ossimDpt(iBottom.x * imageToViewScale.x,
+ iBottom.y * imageToViewScale.y);
m_transform->viewToImage(vBottom, testCenter);
- if(testCenter.hasNans())
+ if (testCenter.hasNans())
{
- return false;
+ return false;
}
- testFullRes = ossimDpt(testCenter.x*imageToViewScale.x,
- testCenter.y*imageToViewScale.y);
+ testFullRes = ossimDpt(testCenter.x * imageToViewScale.x,
+ testCenter.y * imageToViewScale.y);
double errorCheck4 = (testFullRes - iFullRes).length();
- iFullRes = ossimDpt(iLeft.x*imageToViewScale.x,
- iLeft.y*imageToViewScale.y);
+ iFullRes = ossimDpt(iLeft.x * imageToViewScale.x,
+ iLeft.y * imageToViewScale.y);
m_transform->viewToImage(vLeft, testCenter);
- testFullRes = ossimDpt(testCenter.x*imageToViewScale.x,
- testCenter.y*imageToViewScale.y);
+ testFullRes = ossimDpt(testCenter.x * imageToViewScale.x,
+ testCenter.y * imageToViewScale.y);
double errorCheck5 = (testFullRes - iFullRes).length();
- std::cout <<"__________________________\n"
- << "ERROR1:" <<errorCheck1 << "\n"
- << "ERROR2:" <<errorCheck2 << "\n"
- << "ERROR3:" <<errorCheck3 << "\n"
- << "ERROR4:" <<errorCheck4 << "\n"
- << "ERROR5:" <<errorCheck5 << "\n"
- << "SENS: " << error << "\n";
-
- result = ((errorCheck1 < error)&&
- (errorCheck2 < error)&&
- (errorCheck3 < error)&&
- (errorCheck4 < error)&&
- (errorCheck5 < error));
+ std::cout << "__________________________\n"
+ << "ERROR1:" << errorCheck1 << "\n"
+ << "ERROR2:" << errorCheck2 << "\n"
+ << "ERROR3:" << errorCheck3 << "\n"
+ << "ERROR4:" << errorCheck4 << "\n"
+ << "ERROR5:" << errorCheck5 << "\n"
+ << "SENS: " << error << "\n";
+
+ result = ((errorCheck1 < error) &&
+ (errorCheck2 < error) &&
+ (errorCheck3 < error) &&
+ (errorCheck4 < error) &&
+ (errorCheck5 < error));
// std::cout << "CAN INTERPOLATE? " << result <<"\n";
#endif
}
return result;
-
}
void ossimImageRenderer::ossimRendererSubRectInfo::getViewMids(ossimDpt& upperMid,
@@ -1063,7 +1106,6 @@ ossimRefPtr<ossimImageData> ossimImageRenderer::getTile(
<< MODULE << " Requesting view rect = "
<< tileRect << endl;
}
-
// long w = tileRect.width();
// long h = tileRect.height();
// ossimIpt origin = tileRect.ul();
=====================================
src/imaging/ossimNitf20Writer.cpp
=====================================
--- a/src/imaging/ossimNitf20Writer.cpp
+++ b/src/imaging/ossimNitf20Writer.cpp
@@ -30,12 +30,12 @@
#include <ossim/base/ossimBooleanProperty.h>
#include <ossim/base/ossimVisitor.h>
#include <ossim/support_data/ossimNitfCommon.h>
-#include <ossim/support_data/ossimNitfGeoPositioningTag.h>
-#include <ossim/support_data/ossimNitfLocalGeographicTag.h>
-#include <ossim/support_data/ossimNitfLocalCartographicTag.h>
-#include <ossim/support_data/ossimNitfProjectionParameterTag.h>
-#include <ossim/support_data/ossimNitfNameConversionTables.h>
-#include <ossim/support_data/ossimNitfBlockaTag.h>
+// #include <ossim/support_data/ossimNitfGeoPositioningTag.h>
+// #include <ossim/support_data/ossimNitfLocalGeographicTag.h>
+// #include <ossim/support_data/ossimNitfLocalCartographicTag.h>
+// #include <ossim/support_data/ossimNitfProjectionParameterTag.h>
+// #include <ossim/support_data/ossimNitfNameConversionTables.h>
+// #include <ossim/support_data/ossimNitfBlockaTag.h>
#include <tiffio.h>
#include <fstream>
#include <algorithm>
=====================================
src/imaging/ossimNitfWriter.cpp
=====================================
--- a/src/imaging/ossimNitfWriter.cpp
+++ b/src/imaging/ossimNitfWriter.cpp
@@ -62,7 +62,9 @@ ossimNitfWriter::ossimNitfWriter(const ossimFilename& filename,
// geometry out as default behavior. Users can disable this via the
// property interface or keyword list.
//---
- setWriteExternalGeometryFlag(true);
+ // Added GEOLOB tag for geographic output. UTM is good with BLOCKA.
+ // No longer needed. (drb - 30 March 2018)
+ // setWriteExternalGeometryFlag(true);
m_fileHeader = new ossimNitfFileHeaderV2_1;
m_imageHeader = new ossimNitfImageHeaderV2_1;
@@ -887,10 +889,10 @@ void ossimNitfWriter::addDataExtensionSegment(const ossimNitfDataExtensionSegmen
if (allowTreOverflow == false)
{
ossimRefPtr<ossimProperty> pId = des.getProperty(ossimNitfDataExtensionSegmentV2_1::DESID_KW);
- if ( !pId ||
- (pId->valueToString() == "TRE_OVERFLOW") ||
- (pId->valueToString() == "REGISTERED EXTENSIONS") ||
- (pId->valueToString() == "CONTROLLED EXTENSIONS"))
+ if ( !pId.valid() ||
+ pId->valueToString() == "TRE_OVERFLOW" ||
+ pId->valueToString() == "REGISTERED EXTENSIONS" ||
+ pId->valueToString() == "CONTROLLED EXTENSIONS")
{
return;
}
=====================================
src/imaging/ossimNitfWriterBase.cpp
=====================================
--- a/src/imaging/ossimNitfWriterBase.cpp
+++ b/src/imaging/ossimNitfWriterBase.cpp
@@ -1,9 +1,15 @@
-//**************************************************************************************************
+//---
//
-// OSSIM Open Source Geospatial Data Processing Library
-// See top level LICENSE.txt file for license information
+// License: MIT
+//
+// Author: David Burken
//
-//**************************************************************************************************
+// Description: OSSIM nitf writer base class to hold methods common to
+// all nitf writers.
+//
+//---
+// $Id$
+
#include <ossim/imaging/ossimNitfWriterBase.h>
#include <ossim/base/ossimBooleanProperty.h>
#include <ossim/base/ossimFilename.h>
@@ -23,6 +29,7 @@
#include <ossim/support_data/ossimNitfBlockaTag.h>
#include <ossim/support_data/ossimNitfFileHeader.h>
#include <ossim/support_data/ossimNitfFileHeaderV2_X.h>
+#include <ossim/support_data/ossimNitfGeolobTag.h>
#include <ossim/support_data/ossimNitfImageHeader.h>
#include <ossim/support_data/ossimNitfImageHeaderV2_X.h>
#include <ossim/support_data/ossimNitfRegisteredTag.h>
@@ -30,6 +37,7 @@
static const char ENABLE_BLOCKA_KW[] = "enable_blocka_tag";
static const char ENABLE_RPCB_KW[] = "enable_rpcb_tag";
+static const char ENABLE_GEOLOB_KW[] = "enable_geolob_tag";
RTTI_DEF1(ossimNitfWriterBase, "ossimNitfWriterBase", ossimImageFileWriter)
@@ -38,7 +46,8 @@ static ossimTrace traceDebug(ossimString("ossimNitfWriterBase:debug"));
ossimNitfWriterBase::ossimNitfWriterBase()
: ossimImageFileWriter(),
theEnableRpcbTagFlag(false),
- theEnableBlockaTagFlag(true)
+ theEnableBlockaTagFlag(true),
+ theEnableGeolobTagFlag(true)
{
}
@@ -46,7 +55,8 @@ ossimNitfWriterBase::ossimNitfWriterBase(const ossimFilename& filename,
ossimImageSource* inputSource)
: ossimImageFileWriter(filename, inputSource, 0),
theEnableRpcbTagFlag(false),
- theEnableBlockaTagFlag(true)
+ theEnableBlockaTagFlag(true),
+ theEnableGeolobTagFlag(true)
{
}
@@ -68,6 +78,10 @@ void ossimNitfWriterBase::setProperty(ossimRefPtr<ossimProperty> property)
{
theEnableBlockaTagFlag = property->valueToString().toBool();
}
+ else if (name == ENABLE_GEOLOB_KW)
+ {
+ theEnableGeolobTagFlag = property->valueToString().toBool();
+ }
else
{
ossimImageFileWriter::setProperty(property);
@@ -80,14 +94,18 @@ ossimRefPtr<ossimProperty> ossimNitfWriterBase::getProperty(
{
ossimRefPtr<ossimProperty> result = 0;
- if(name == ENABLE_RPCB_KW)
- {
- result = new ossimBooleanProperty(name, theEnableRpcbTagFlag);
- }
- else if(name == ENABLE_BLOCKA_KW)
+ if(name == ENABLE_BLOCKA_KW)
{
result = new ossimBooleanProperty(name, theEnableBlockaTagFlag);
- }
+ }
+ else if (name == ENABLE_GEOLOB_KW)
+ {
+ result = new ossimBooleanProperty(name, theEnableGeolobTagFlag);
+ }
+ else if(name == ENABLE_RPCB_KW)
+ {
+ result = new ossimBooleanProperty(name, theEnableRpcbTagFlag);
+ }
else
{
result = ossimImageFileWriter::getProperty(name);
@@ -102,6 +120,7 @@ void ossimNitfWriterBase::getPropertyNames(
ossimImageFileWriter::getPropertyNames(propertyNames);
propertyNames.push_back(ENABLE_BLOCKA_KW);
+ propertyNames.push_back(ENABLE_GEOLOB_KW);
propertyNames.push_back(ENABLE_RPCB_KW);
}
@@ -109,8 +128,9 @@ void ossimNitfWriterBase::getPropertyNames(
bool ossimNitfWriterBase::saveState(ossimKeywordlist& kwl,
const char* prefix) const
{
- kwl.add(prefix, ENABLE_RPCB_KW, theEnableRpcbTagFlag, true);
kwl.add(prefix, ENABLE_BLOCKA_KW, theEnableBlockaTagFlag, true);
+ kwl.add(prefix, ENABLE_GEOLOB_KW, theEnableGeolobTagFlag, true);
+ kwl.add(prefix, ENABLE_RPCB_KW, theEnableRpcbTagFlag, true);
return ossimImageFileWriter::saveState(kwl, prefix);
}
@@ -119,19 +139,29 @@ bool ossimNitfWriterBase::loadState(const ossimKeywordlist& kwl,
const char* prefix)
{
// Look for the rpcb enable flag keyword.
- const char* lookup = kwl.find(prefix, ENABLE_RPCB_KW);
+
+
+ // Look for the blocka enable flag keyword.
+ const char* lookup = kwl.find(prefix, ENABLE_BLOCKA_KW);
if(lookup)
{
ossimString os = lookup;
- theEnableRpcbTagFlag = os.toBool();
+ theEnableBlockaTagFlag = os.toBool();
}
- // Look for the blocka enable flag keyword.
- lookup = kwl.find(prefix, ENABLE_BLOCKA_KW);
+ // Look for the geolob enable flag keyword.
+ lookup = kwl.find(prefix, ENABLE_GEOLOB_KW);
if(lookup)
{
ossimString os = lookup;
- theEnableBlockaTagFlag = os.toBool();
+ theEnableGeolobTagFlag = os.toBool();
+ }
+
+ lookup = kwl.find(prefix, ENABLE_RPCB_KW);
+ if(lookup)
+ {
+ ossimString os = lookup;
+ theEnableRpcbTagFlag = os.toBool();
}
return ossimImageFileWriter::loadState(kwl, prefix);
@@ -191,6 +221,11 @@ void ossimNitfWriterBase::writeGeometry(ossimNitfImageHeaderV2_X* hdr,
{
addBlockaTag(mapInfo, hdr);
}
+
+ if ( theEnableGeolobTagFlag )
+ {
+ addGeolobTag( mapProj, hdr );
+ }
}
else
{
@@ -263,6 +298,52 @@ void ossimNitfWriterBase::addBlockaTag(ossimMapProjectionInfo& mapInfo,
} // matches: if (hdr)
}
+void ossimNitfWriterBase::addGeolobTag(const ossimMapProjection* mapProj,
+ ossimNitfImageHeaderV2_X* hdr)
+{
+ if (hdr && mapProj)
+ {
+ if ( mapProj->isGeographic() == true )
+ {
+ ossimRefPtr<ossimNitfGeolobTag> geolobTag = new ossimNitfGeolobTag();
+
+ // Get the scale:
+ ossimDpt gsd = mapProj->getDecimalDegreesPerPixel();
+ if ( (gsd.hasNans() == false) && (gsd.x > 0.0) && (gsd.y > 0.0) )
+ {
+ ossimGpt tie = mapProj->getUlGpt();
+ if ( tie.hasNans() == false )
+ {
+ // Shift the tie to edge of pixel:
+ tie.lat = tie.lat + gsd.y*0.5;
+ tie.lon = tie.lon - gsd.x*0.5;
+ if ( (tie.lat <= 90.0) && (tie.lon >= -180.0) )
+ {
+ ossimRefPtr<ossimNitfGeolobTag> geolobTag = new ossimNitfGeolobTag();
+ geolobTag->setDegreesPerPixelLon( gsd.x );
+ geolobTag->setDegreesPerPixelLat( gsd.y );
+ geolobTag->setLso( tie.lon ); // Origin Longitude
+ geolobTag->setPso( tie.lat ); // Origin Latitude
+
+ // Add the tag to the header.
+ ossimRefPtr<ossimNitfRegisteredTag> geolobTagRp = geolobTag.get();
+ ossimNitfTagInformation geolobTagInfo(geolobTagRp);
+ hdr->addTag(geolobTagInfo);
+
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "ossimNitfWriterBase::addGeolobTag DEBUG:"
+ << "\nAdded GEOLOB Tag:\n" << *(geolobTag.get())
+ << "\n";
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
void ossimNitfWriterBase::addRpcbTag(const ossimIrect& rect,
ossimProjection* proj,
ossimNitfImageHeaderV2_X* hdr)
=====================================
src/imaging/ossimSingleImageChain.cpp
=====================================
--- a/src/imaging/ossimSingleImageChain.cpp
+++ b/src/imaging/ossimSingleImageChain.cpp
@@ -181,6 +181,14 @@ void ossimSingleImageChain::createRenderedChain()
{
addBandSelector();
}
+
+ // will do this here. Not sure if we want flipped just before the resampler or if we want to do it here.
+ // I think this is a better place for you can now manipulate the flipped pixel
+ if (m_addNullPixelFlipFlag)
+ {
+ addNullPixelFlip();
+ }
+
// histogram:
if ( m_addHistogramFlag )
{
@@ -217,13 +225,6 @@ void ossimSingleImageChain::createRenderedChain()
}
}
- // cheaper operation to put the flip after the remapper
- //
- if(m_addNullPixelFlipFlag)
- {
- addNullPixelFlip();
- }
-
// resampler cache
if ( m_addResamplerCacheFlag )
{
=====================================
src/projection/ossimNitfProjectionFactory.cpp
=====================================
--- a/src/projection/ossimNitfProjectionFactory.cpp
+++ b/src/projection/ossimNitfProjectionFactory.cpp
@@ -1,13 +1,11 @@
-//----------------------------------------------------------------------------
-//
-// License: See top level LICENSE.txt file.
+//---
+// License: MIT
//
// Description:
//
// Contains class definition for ossimNitfProjectionFactory.
-//
-// $Id: ossimNitfProjectionFactory.cpp 23671 2015-12-19 01:07:26Z gpotts $
-//----------------------------------------------------------------------------
+//---
+// $Id$
#include <ossim/projection/ossimNitfProjectionFactory.h>
#include <ossim/base/ossimDms.h>
@@ -26,6 +24,7 @@
#include <ossim/support_data/ossimNitfBlockaTag.h>
#include <ossim/support_data/ossimNitfFile.h>
#include <ossim/support_data/ossimNitfFileHeader.h>
+#include <ossim/support_data/ossimNitfGeolobTag.h>
#include <ossim/support_data/ossimNitfImageHeader.h>
#include <fstream>
#include <cmath>
@@ -214,18 +213,34 @@ ossimProjection* ossimNitfProjectionFactory::makeGeographic(
if (hdr)
{
// To hold corner points.
- std::vector<ossimGpt> gpts;
-
+ std::vector<ossimGpt> gpts(0);
+ std::vector<ossimGpt> geolobPts(0);
+ std::vector<ossimGpt> blockaPts(0);
+ std::vector<ossimGpt> igeoloPts(0);
+
+ //---
+ // Look for points from the GEOLOB tag if geographic coordinate
+ // system. This has an origin and scale with good precision.
+ //
+ // NOTES:
+ // 1) More precise than the BLOCKA
+ // 2) Making an assumption this is not present if rotated.
+ // Might need to test for rotation in BLOCKA and IGEOLO
+ // 3) GEOLOB points are always rectangular as they are derived
+ // from a single origin.
+ //---
+ getGeolobPoints(hdr, geolobPts);
+
//---
- // Get the corner points.
- //
// Look for points from the BLOCKA tag. This may or may not be present.
// If present since it has six digit precision use it for the points.
//---
- if ( getBlockaPoints(hdr, gpts) == false )
+ getBlockaPoints(hdr, blockaPts);
+
+ if ( blockaPts.empty() )
{
+ // Least precise IGEOLO field:
ossimString geographicLocation = hdr->getGeographicLocation();
-
if ( geographicLocation.size() )
{
if (traceDebug())
@@ -247,7 +262,7 @@ ossimProjection* ossimNitfProjectionFactory::makeGeographic(
// where d is degrees and m is minutes
// and s is seconds and X is either N (North) or S (South).
//---
- parseGeographicString(geographicLocation, gpts);
+ parseGeographicString(geographicLocation, igeoloPts);
}
else if (coordinateSysetm == "D")
{
@@ -257,19 +272,49 @@ ossimProjection* ossimNitfProjectionFactory::makeGeographic(
// - is souther hemisphere for lat and longitude
// + is easting and - is westing.
//---
- parseDecimalDegreesString(geographicLocation, gpts);
+ parseDecimalDegreesString(geographicLocation, igeoloPts);
}
} // matches: if ( geographicLocation.size() )
} // matches: if ( getBlockaPoints(hdr, gpts) == false )
+
+ bool isSkewedFlag = false;
+ if ( blockaPts.size() )
+ {
+ isSkewedFlag = isSkewed(blockaPts);
+ if ( (isSkewedFlag == false) && geolobPts.size() )
+ {
+ gpts = geolobPts; // Not skewed and have more accurate geolob points.
+ }
+ else
+ {
+ gpts = blockaPts;
+ }
+ }
+ else if ( igeoloPts.size() )
+ {
+ isSkewedFlag = isSkewed(igeoloPts);
+ if ( (isSkewedFlag == false) && geolobPts.size() )
+ {
+ gpts = geolobPts; // Not skewed and have more accurate geolob points.
+ }
+ else
+ {
+ gpts = igeoloPts;
+ }
+ }
if (gpts.size() == 4)
{
ossimDpt scaleTest;
computeScaleInDecimalDegrees(hdr, gpts, scaleTest);
- if (!isSkewed(gpts)&&(ossim::abs(scaleTest.y/scaleTest.x) <= 1.0))
+ //---
+ // Getting very small value above 1.0 when dividing; hence the .000001.
+ // Code calling arc cosine function in makeEquDistant(...) clamps to 1.0.
+ //---
+ if ( !isSkewedFlag && (ossim::abs(scaleTest.y/scaleTest.x) <= 1.000001))
{
proj = makeEuiDistant(hdr, gpts);
}
@@ -548,7 +593,9 @@ ossimProjection* ossimNitfProjectionFactory::makeEuiDistant(
// computation. So is not set in tiff tags, compute to achieve the proper
// horizontal scaling.
//---
- origin.lat = ossim::acosd(scale.y/scale.x);
+ ossim_float64 x = (scale.y/scale.x);
+ if ( x > 1.0 ) x = 1.0; // Limit to domain of arc cosine function.
+ origin.lat = ossim::acosd(x);
proj->setOrigin(origin);
}
@@ -697,6 +744,87 @@ bool ossimNitfProjectionFactory::getBlockaPoints(
return true;
}
+bool ossimNitfProjectionFactory::getGeolobPoints(
+ const ossimNitfImageHeader* hdr,
+ std::vector<ossimGpt>& gpts) const
+{
+ static const char MODULE[] = "ossimNitfProjectionFactory::getGeolobPoints";
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << MODULE << " entered...\n";
+ }
+ bool result = false;
+
+ gpts.clear();
+
+ if ( hdr )
+ {
+ ossimRefPtr<ossimNitfRegisteredTag> tag = hdr->getTagData(ossimString("GEOLOB"));
+ if ( tag.valid() )
+ {
+ ossimNitfGeolobTag* geolob = dynamic_cast<ossimNitfGeolobTag*>(tag.get());
+ if ( geolob )
+ {
+ ossimDpt gsd( geolob->getDegreesPerPixelLon(), geolob->getDegreesPerPixelLat() );
+ if ( (gsd.x > 0.0 ) && (gsd.y > 0.0) )
+ {
+ ossim_int32 rows = hdr->getNumberOfRows();
+ ossim_int32 cols = hdr->getNumberOfCols();
+ if ( (rows > 0) && (cols > 0) )
+ {
+ ossimGpt gpt(0.0, 0.0, 0.0);
+ ossimDpt origin( geolob->getLso(), geolob->getPso() );
+
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "origin: " << origin
+ << "\ngsd: " << gsd << "\n";
+ }
+
+ // Note: Edge to edge here as origin is shifted makeEuiDistant method.
+ // UL:
+ gpt.latd(origin.y);
+ gpt.lond(origin.x);
+ gpts.push_back(gpt);
+
+ // UR:
+ gpt.latd(origin.y);
+ gpt.lond(origin.x + cols*gsd.x);
+ gpts.push_back(gpt);
+
+ // LR:
+ gpt.latd(origin.y - rows*gsd.y);
+ gpt.lond(origin.x + cols*gsd.x);
+ gpts.push_back(gpt);
+
+ // LL:
+ gpt.latd(origin.y - rows*gsd.y);
+ gpt.lond(origin.x);
+ gpts.push_back(gpt);
+
+ result = true;
+ }
+ }
+ }
+ }
+ else if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "No GEOLOB tag found.\n";
+ }
+ }
+
+ if (traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << MODULE << " exit status: " << (result?"true":"false") << "\n";
+ }
+
+ return result;
+}
+
void ossimNitfProjectionFactory::computeScaleInDecimalDegrees(
const ossimNitfImageHeader* hdr,
const std::vector<ossimGpt>& gpts,
=====================================
src/support_data/ossimNitfGeolobTag.cpp
=====================================
--- /dev/null
+++ b/src/support_data/ossimNitfGeolobTag.cpp
@@ -0,0 +1,229 @@
+//---
+//
+// License: MIT
+//
+// Author: David Burken
+//
+// Description: GEOLOB tag class definition.
+//
+// References:
+//
+// 1) DIGEST 2.1 Part 2 - Annex D
+// Appendix 1 - NSIF Standard Geospatial Support Data Extension
+//
+// 2) STDI-0006
+//
+//---
+// $Id: ossimNitfBlockaTag.cpp 23245 2015-04-08 20:53:04Z rashadkm $
+
+#include <cstring> /* for memcpy */
+#include <sstream>
+#include <iomanip>
+
+#include <ossim/support_data/ossimNitfGeolobTag.h>
+#include <ossim/support_data/ossimNitfCommon.h>
+#include <ossim/base/ossimNotifyContext.h>
+#include <ossim/base/ossimTrace.h>
+#include <ossim/base/ossimDms.h>
+#include <ossim/base/ossimDpt.h>
+
+static const ossimTrace traceDebug(ossimString("ossimNitfBlockaTag:debug"));
+
+RTTI_DEF1(ossimNitfGeolobTag, "ossimNitfGeolobTag", ossimNitfRegisteredTag);
+
+ossimNitfGeolobTag::ossimNitfGeolobTag()
+ : ossimNitfRegisteredTag(std::string("GEOLOB"), ossimNitfGeolobTag::TAG_SIZE),
+ m_tagData(ossimNitfGeolobTag::TAG_SIZE, '0')
+{
+}
+
+void ossimNitfGeolobTag::parseStream(std::istream& in)
+{
+ in.read((char*)m_tagData.data(), ossimNitfGeolobTag::TAG_SIZE);
+}
+
+void ossimNitfGeolobTag::writeStream(std::ostream& out)
+{
+ out.write(m_tagData.data(), ossimNitfGeolobTag::TAG_SIZE);
+}
+
+std::ostream& ossimNitfGeolobTag::print(std::ostream& out,
+ const std::string& prefix) const
+{
+ std::string pfx = prefix;
+ pfx += getTagName();
+ pfx += ".";
+
+ out << setiosflags(ios::left)
+ << pfx << std::setw(24) << "CETAG:" << getTagName() << "\n"
+ << pfx << std::setw(24) << "CEL:" << getTagLength() << "\n"
+ << pfx << std::setw(24) << "ARV:" << getArvString() << "\n"
+ << pfx << std::setw(24) << "BRV:" << getBrvString() << "\n"
+ << pfx << std::setw(24) << "LSO:" << getLsoString() << "\n"
+ << pfx << std::setw(24) << "PSO:" << getPsoString() << "\n";
+
+ return out;
+}
+
+// Longitude density:
+std::string ossimNitfGeolobTag::getArvString() const
+{
+ return m_tagData.substr(0, ossimNitfGeolobTag::ARV_SIZE);
+}
+
+ossim_uint32 ossimNitfGeolobTag::getArv() const
+{
+ ossim_uint32 result = 0;
+ std::string s = getArvString();
+ if ( s.size() )
+ {
+ result = ossimString(s).toUInt32();
+ }
+ return result;
+}
+
+ossim_float64 ossimNitfGeolobTag::getDegreesPerPixelLon() const
+{
+ ossim_float64 result = 0.0;
+ ossim_uint32 arv = getArv();
+ if ( arv > 0 )
+ {
+ result = 360.0 / arv;
+ }
+ return result;
+}
+
+void ossimNitfGeolobTag::setArv(ossim_uint32 arv)
+{
+ if ( (arv >= 2) && (arv <= 999999999) )
+ {
+ std::ostringstream s;
+ s.fill('0');
+ s << std::setw(ossimNitfGeolobTag::ARV_SIZE) << arv;
+ m_tagData.replace( 0, ossimNitfGeolobTag::ARV_SIZE, s.str() );
+ }
+}
+
+void ossimNitfGeolobTag::setDegreesPerPixelLon(const ossim_float64& deltaLon)
+{
+ if ( deltaLon > 0.0 )
+ {
+ ossim_uint32 pixels = (ossim_uint32)((1.0/deltaLon)*360.0 + .5);
+ setArv(pixels);
+ }
+}
+
+// Latitude density:
+std::string ossimNitfGeolobTag::getBrvString() const
+{
+ return m_tagData.substr(9, ossimNitfGeolobTag::BRV_SIZE);
+}
+
+ossim_float64 ossimNitfGeolobTag::getDegreesPerPixelLat() const
+{
+ ossim_float64 result = 0.0;
+ ossim_uint32 brv = getBrv();
+ if ( brv > 0 )
+ {
+ result = 360.0 / brv;
+ }
+ return result;
+}
+
+ossim_uint32 ossimNitfGeolobTag::getBrv() const
+{
+ ossim_uint32 result = 0;
+ std::string s = getBrvString();
+ if ( s.size() )
+ {
+ result = ossimString(s).toUInt32();
+ }
+ return result;
+}
+
+void ossimNitfGeolobTag::setBrv(ossim_uint32 brv)
+{
+ if ( (brv >= 2) && (brv <= 999999999) )
+ {
+ std::ostringstream s;
+ s.fill('0');
+ s << std::setw(ossimNitfGeolobTag::BRV_SIZE) << brv;
+
+ m_tagData.replace( 9, ossimNitfGeolobTag::BRV_SIZE, s.str() );
+ }
+}
+
+void ossimNitfGeolobTag::setDegreesPerPixelLat(const ossim_float64& deltaLat)
+{
+ if ( deltaLat > 0.0 )
+ {
+ ossim_uint32 pixels = (ossim_uint32)((1.0/deltaLat)*360.0 + .5);
+ setBrv(pixels);
+ }
+}
+
+// Longitude of Reference Origin:
+std::string ossimNitfGeolobTag::getLsoString() const
+{
+ return m_tagData.substr(18, ossimNitfGeolobTag::LSO_SIZE);
+}
+
+ossim_float64 ossimNitfGeolobTag::getLso() const
+{
+ ossim_float64 result = 0;
+ std::string s = getLsoString();
+ if ( s.size() )
+ {
+ result = ossimString(s).toFloat64();
+ }
+ return result;
+}
+
+void ossimNitfGeolobTag::setLso(const ossim_float64& lso)
+{
+ if ( (lso >= -180.0) && (lso <= 180.0) )
+ {
+ std::ostringstream s;
+ s.precision(10);
+ s.fill('0');
+ s << std::left << std::showpos << std::fixed
+ << std::setw(ossimNitfGeolobTag::LSO_SIZE) << lso;
+
+ m_tagData.replace( 18, ossimNitfGeolobTag::LSO_SIZE, s.str() );
+ }
+}
+
+// Latitude of Reference Origin:
+std::string ossimNitfGeolobTag::getPsoString() const
+{
+ return m_tagData.substr(33, ossimNitfGeolobTag::PSO_SIZE);
+}
+
+ossim_float64 ossimNitfGeolobTag::getPso() const
+{
+ ossim_float64 result = 0;
+ std::string s = getPsoString();
+ if ( s.size() )
+ {
+ result = ossimString(s).toFloat64();
+ }
+ return result;
+}
+
+void ossimNitfGeolobTag::setPso(const ossim_float64& pso)
+{
+ if ( (pso >= -180.0) && (pso <= 180.0) )
+ {
+ std::ostringstream s;
+ s.precision(10);
+ s.fill('0');
+ s << std::left << std::showpos << std::fixed
+ << std::setw(ossimNitfGeolobTag::PSO_SIZE) << pso;
+
+ m_tagData.replace( 33, ossimNitfGeolobTag::PSO_SIZE, s.str() );
+ }
+}
+
+
+
+
=====================================
src/support_data/ossimNitfImageBandV2_0.cpp
=====================================
--- a/src/support_data/ossimNitfImageBandV2_0.cpp
+++ b/src/support_data/ossimNitfImageBandV2_0.cpp
@@ -190,7 +190,6 @@ void ossimNitfImageBandV2_0::clearFields()
memset(theBandSignificance, ' ', 6);
memset(theBandImageFilterCondition, 'N', 1);
memset(theBandStandardImageFilterCode, ' ', 3);
- memset(theBandNumberOfLuts, 0, 1);
memset(theBandNumberOfLutEntries, ' ', 5);
theLookupTables.clear();
@@ -198,6 +197,7 @@ void ossimNitfImageBandV2_0::clearFields()
theBandSignificance[6] = '\0';
theBandImageFilterCondition[1] = '\0';
theBandStandardImageFilterCode[3] = '\0';
+ theBandNumberOfLuts[0] = 0x30;
theBandNumberOfLuts[1] = '\0';
theBandNumberOfLutEntries[5] = '\0';
}
=====================================
src/support_data/ossimNitfLocalGeographicTag.cpp deleted
=====================================
--- a/src/support_data/ossimNitfLocalGeographicTag.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-//*******************************************************************
-// Copyright (C) 2004 Intelligence Data Systems.
-//
-// LICENSE: LGPL
-//
-// see top level LICENSE.txt
-//
-// Author: Garrett Potts
-// Description: Nitf support class
-//
-//********************************************************************
-// $Id: ossimNitfLocalGeographicTag.cpp 23245 2015-04-08 20:53:04Z rashadkm $
-#include <ossim/support_data/ossimNitfLocalGeographicTag.h>
-#include <iomanip>
-#include <sstream>
-
-RTTI_DEF1(ossimNitfLocalGeographicTag, "ossimNitfLocalGeographicTag", ossimNitfRegisteredTag);
-
-ossimNitfLocalGeographicTag::ossimNitfLocalGeographicTag()
- : ossimNitfRegisteredTag(std::string("GEOLOB"), 48)
-{
- clearFields();
-}
-
-ossimNitfLocalGeographicTag::~ossimNitfLocalGeographicTag()
-{
-}
-
-void ossimNitfLocalGeographicTag::parseStream(std::istream& in)
-{
- in.read(theLonDensity, 9);
- in.read(theLatDensity, 9);
- in.read(theLonOrigin, 15);
- in.read(theLatOrigin, 15);
-}
-
-void ossimNitfLocalGeographicTag::writeStream(std::ostream& out)
-{
- out.write(theLonDensity, 9);
- out.write(theLatDensity, 9);
- out.write(theLonOrigin, 15);
- out.write(theLatOrigin, 15);
-}
-
-void ossimNitfLocalGeographicTag::clearFields()
-{
- memset(theLonDensity, ' ', 9);
- memset(theLatDensity, ' ', 9);
- memset(theLonOrigin, 0, 15);
- memset(theLatOrigin, 0, 15);
-
-
-
- theLonDensity[9] = '\0';
- theLatDensity[9] = '\0';
- theLonOrigin[15] = '\0';
- theLatOrigin[14] = '\0';
-}
-
-void ossimNitfLocalGeographicTag::setDegreesPerPixelLat(double deltaLat)
-{
- ossim_uint32 pixels = 0;
- if(deltaLat > 0.0)
- {
- pixels = (ossim_uint32)((1.0/deltaLat)*360.0 + .5);
- }
- std::ostringstream out;
-
- out << std::setw(9)
- << std::setfill('0')
- << pixels;
-
- memcpy(theLatDensity, out.str().c_str(), 9);
-}
-
-void ossimNitfLocalGeographicTag::setDegreesPerPixelLon(double deltaLon)
-{
- ossim_uint32 pixels = 0;
- if(deltaLon > 0.0)
- {
- pixels = (ossim_uint32)((1.0/deltaLon)*360.0 + .5);
- }
- std::ostringstream out;
-
- out << std::setw(9)
- << std::setfill('0')
- << pixels;
-
- memcpy(theLonDensity, out.str().c_str(), 9);
-}
-
-void ossimNitfLocalGeographicTag::setLatOrigin(double origin)
-{
- std::ostringstream out;
-
- out << std::setw(15)
- << std::setfill('0')
- << origin;
- memcpy(theLatOrigin, out.str().c_str(), 15);
-}
-
-void ossimNitfLocalGeographicTag::setLonOrigin(double origin)
-{
- std::ostringstream out;
-
- out << std::setw(15)
- << std::setfill('0')
- << origin;
- memcpy(theLonOrigin, out.str().c_str(), 15);
-}
=====================================
src/support_data/ossimNitfRegisteredTagFactory.cpp
=====================================
--- a/src/support_data/ossimNitfRegisteredTagFactory.cpp
+++ b/src/support_data/ossimNitfRegisteredTagFactory.cpp
@@ -22,9 +22,10 @@
#include <ossim/support_data/ossimNitfCsexraTag.h>
#include <ossim/support_data/ossimNitfEngrdaTag.h>
#include <ossim/support_data/ossimNitfGeoPositioningTag.h>
+#include <ossim/support_data/ossimNitfGeolobTag.h>
#include <ossim/support_data/ossimNitfIchipbTag.h>
#include <ossim/support_data/ossimNitfJ2klraTag.h>
-#include <ossim/support_data/ossimNitfLocalGeographicTag.h>
+// #include <ossim/support_data/ossimNitfLocalGeographicTag.h>
#include <ossim/support_data/ossimNitfLocalCartographicTag.h>
#include <ossim/support_data/ossimNitfMstgtaTag.h>
#include <ossim/support_data/ossimNitfPiaimcTag.h>
@@ -54,6 +55,7 @@ static const char CSCRNA_TAG[] = "CSCRNA";
static const char CSDIDA_TAG[] = "CSDIDA";
static const char CSEXRA_TAG[] = "CSEXRA";
static const char ENGRDA_TAG[] = "ENGRDA";
+static const char GEOLOB_TAG[] = "GEOLOB";
static const char GEO_POSITIONING_TAG[] = "GEOPSB";
static const char ICHIPB_TAG[] = "ICHIPB";
static const char J2KLRA_TAG[] = "J2KLRA";
@@ -123,6 +125,10 @@ ossimRefPtr<ossimNitfRegisteredTag> ossimNitfRegisteredTagFactory::create(
{
return new ossimNitfEngrdaTag;
}
+ else if(tagName == GEOLOB_TAG)
+ {
+ return new ossimNitfGeolobTag;
+ }
else if(tagName == GEO_POSITIONING_TAG)
{
return new ossimNitfGeoPositioningTag;
@@ -135,10 +141,12 @@ ossimRefPtr<ossimNitfRegisteredTag> ossimNitfRegisteredTagFactory::create(
{
return new ossimNitfJ2klraTag;
}
+#if 0 /* ossimNitfGeolobTag */
else if(tagName == LOCAL_GEOGRAPHIC_TAG)
{
return new ossimNitfLocalGeographicTag;
}
+#endif
else if(tagName == LOCAL_CARTOGRAPHIC_TAG)
{
return new ossimNitfLocalCartographicTag;
=====================================
src/util/ossimChipperUtil.cpp
=====================================
--- a/src/util/ossimChipperUtil.cpp
+++ b/src/util/ossimChipperUtil.cpp
@@ -98,6 +98,7 @@ static const std::string CUT_WIDTH_KW = "cut_width"; // pixels
static const std::string DEM_KW = "dem";
static const std::string GAIN_KW = "gain";
static const std::string FILE_KW = "file";
+static const std::string FULLRES_XYS_KW = "fullres_xys";
static const std::string HIST_AOI_KW = "hist_aoi";
static const std::string HIST_CENTER_KW = "hist_center";
static const std::string HIST_LLWH_KW = "hist_llwh";
@@ -222,7 +223,7 @@ void ossimChipperUtil::addArguments(ossimArgumentParser& ap)
au->addCommandLineOption("--cut-width", "<width>\nSpecify the cut width in pixel");
au->addCommandLineOption("--cut-height", "<height>\nSpecify the cut height in pixel");
-
+
au->addCommandLineOption("--clip-wms-bbox-ll", "<minx>,<miny>,<maxx>,<maxy>\nSpecify a comma separated list in the format of a WMS BBOX.\nThe units are always decimal degrees");
au->addCommandLineOption("--clip-poly-lat-lon", "Polygon in the form of a string: (lat,lon),(lat,lon),...(lat,lon)");
@@ -244,6 +245,8 @@ void ossimChipperUtil::addArguments(ossimArgumentParser& ap)
au->addCommandLineOption("--exaggeration", "<factor>\nMultiplier for elevation values when computing surface normals. Has the effect of lengthening shadows for oblique lighting.\nRange: .0001 to 50000, Default = 1.0");
+ au->addCommandLineOption("--fullres-xys", "<full res center x>,<full res center y>,<scale>[,<scale>]\nSpecify a full resolution x,y point (Used as pivot and center cut) and scale, comma seperated with no spaces. If two scales are specified then first is x and second is y else x and y are set to equal scales");
+
au->addCommandLineOption("-h or --help", "Display this help and exit.");
au->addCommandLineOption("--hemisphere", "<hemisphere>\nSpecify a projection hemisphere if supported. E.g. UTM projection. This will lock the hemisphere even if input scene center is the other hemisphere. Valid values for UTM are \"N\" and \"S\"");
@@ -526,9 +529,29 @@ bool ossimChipperUtil::initialize(ossimArgumentParser& ap)
m_kwl->addPair( std::string(ossimKeywordNames::ENTRY_KW), tempString1 );
}
- if ( ap.read("--exaggeration", stringParam1) )
+ if (ap.read("--exaggeration", stringParam1))
{
- m_kwl->addPair( GAIN_KW, tempString1 );
+ m_kwl->addPair(GAIN_KW, tempString1);
+ }
+
+ if (ap.read("--fullres-xys", stringParam1))
+ {
+ m_kwl->addPair(FULLRES_XYS_KW, tempString1);
+
+ std::vector<ossimString> values;
+ ossimString(tempString1).split(values, ",");
+ double sx,sy;
+ if(values.size() > 2)
+ {
+ sx = values[2].toDouble();
+ sy = sx;
+ if(values.size() > 3)
+ {
+ sy = values[3].toDouble();
+ }
+ m_kwl->add(IMAGE_SPACE_SCALE_X_KW.c_str(), sx);
+ m_kwl->add(IMAGE_SPACE_SCALE_Y_KW.c_str(), sy);
+ }
}
if ( ap.read("--hemisphere", stringParam1) )
@@ -1975,6 +1998,11 @@ ossimRefPtr<ossimSingleImageChain> ossimChipperUtil::createChain(const ossimSrcR
}
}
}
+ ossimString nullPixelFlip = m_kwl->find(NULL_PIXEL_FLIP_KW.c_str());
+ if (nullPixelFlip.toBool())
+ {
+ ic->setAddNullPixelFlipFlag(true);
+ }
//---
// If multiple inputs and scaleToEightBit do it at the end of the processing
@@ -2322,10 +2350,13 @@ void ossimChipperUtil::createIdentityProjection()
ossimDpt imageSpaceScale;
getImageSpaceScale( imageSpaceScale );
- ossimDrect rect;
- m_geom->getBoundingRect(rect);
- ossimDpt midPt = rect.midPoint();
+
+ //ossimDrect rect;
+ //m_geom->getBoundingRect(rect);
+ ossimDpt midPt;// = rect.midPoint();
+ getImageSpacePivot(midPt);
+
if ( traceDebug() )
{
ossimNotify(ossimNotifyLevel_DEBUG)
@@ -2340,7 +2371,8 @@ void ossimChipperUtil::createIdentityProjection()
imageSpaceScale.y, // image space scale y
1.0,1.0, //scale x and y
0.0, 0.0, // translate x,y
- midPt.x, midPt.y); // pivot point
+ midPt.x*imageSpaceScale.x,
+ midPt.y*imageSpaceScale.y); // pivot point
if ( m_kwl->hasKey( METERS_KW ) ||
m_kwl->hasKey( DEGREES_X_KW ) ||
@@ -2350,6 +2382,7 @@ void ossimChipperUtil::createIdentityProjection()
initializeIvtScale();
}
+
resampler->setImageViewTransform( m_ivt.get() );
} // Matches: if ( m_geom.valid() )
@@ -4362,8 +4395,44 @@ void ossimChipperUtil::getAreaOfInterest(ossimImageSource* source, ossimIrect& r
std::string cutBbox = m_kwl->findKey( CUT_BBOX_XYWH_KW );
getIrect( cutBbox, rect );
}
-
- if ( rect.hasNans() )
+ if (rect.hasNans() &&
+ m_kwl->hasKey(FULLRES_XYS_KW) &&
+ m_kwl->hasKey(CUT_WIDTH_KW) &&
+ m_kwl->hasKey(CUT_HEIGHT_KW))
+ {
+ ossimString tempFullXys = m_kwl->findKey(FULLRES_XYS_KW);
+ ossimString tempWidth = m_kwl->findKey(CUT_WIDTH_KW);
+ ossimString tempHeight = m_kwl->findKey(CUT_HEIGHT_KW);
+ double w = tempWidth.toDouble();
+ double h = tempHeight.toDouble();
+ if (m_geom && m_ivt)
+ {
+ std::vector<ossimString> values;
+ tempFullXys.split(values, ",");
+ ossimDpt scale;
+ ossimDpt location;
+ scale.makeNan();
+ location.makeNan();
+ double w = tempWidth.toDouble();
+ double h = tempHeight.toDouble();
+ if (values.size() > 2)
+ {
+ location.x = values[0].toDouble();
+ location.y = values[1].toDouble();
+ // ossimDrect r;
+ // m_geom->getBoundingRect(r);
+ // r = m_ivt->getImageToViewBounds(r);
+ ossimDpt mid;
+ m_ivt->imageToView(location, mid);
+ ossimIpt ul(ossim::round<int>(mid.x - (w / 2)),
+ ossim::round<int>(mid.y - (h / 2)));
+ ossimIpt lr((ul.x + w - 1), ul.y + h - 1);
+ //rect = resampler->getBoundingRect();
+ rect = ossimIrect(ul, lr);
+ }
+ }
+ }
+ if (rect.hasNans())
{
if ( m_geom.valid() )
{
@@ -5154,23 +5223,72 @@ bool ossimChipperUtil::snapTieToOrigin() const
void ossimChipperUtil::getImageSpaceScale( ossimDpt& imageSpaceScale ) const
{
- std::string value = m_kwl->findKey( IMAGE_SPACE_SCALE_X_KW );
- if ( value.size() )
+ imageSpaceScale.x = 1.0;
+ imageSpaceScale.y = 1.0;
+ ossimString lookup;
+
+ if (m_kwl->hasKey(FULLRES_XYS_KW))
{
- imageSpaceScale.x = ossimString(value).toFloat64();
+ lookup = m_kwl->findKey(FULLRES_XYS_KW);
+ std::vector<ossimString> values;
+ lookup.trim().split(values, ",");
+ if (values.size() > 2)
+ {
+ imageSpaceScale.x = values[2].toDouble();
+ imageSpaceScale.y = imageSpaceScale.x;
+ if (values.size() > 3)
+ {
+ imageSpaceScale.y = values[3].toDouble();
+ }
+ }
}
else
{
- imageSpaceScale.x = 1.0;
+ std::string value = m_kwl->findKey(IMAGE_SPACE_SCALE_X_KW);
+ if (value.size())
+ {
+ imageSpaceScale.x = ossimString(value).toFloat64();
+ }
+ else
+ {
+ imageSpaceScale.x = 1.0;
+ }
+ value = m_kwl->findKey(IMAGE_SPACE_SCALE_Y_KW);
+ if (value.size())
+ {
+ imageSpaceScale.y = ossimString(value).toFloat64();
+ }
+ else
+ {
+ imageSpaceScale.y = 1.0;
+ }
}
- value = m_kwl->findKey( IMAGE_SPACE_SCALE_Y_KW );
- if ( value.size() )
+}
+
+void ossimChipperUtil::getImageSpacePivot(ossimDpt &imageSpacePivot) const
+{
+ ossimString lookup;
+ imageSpacePivot.makeNan();
+ if (m_kwl->hasKey(FULLRES_XYS_KW))
{
- imageSpaceScale.y = ossimString(value).toFloat64();
+ lookup = m_kwl->findKey(FULLRES_XYS_KW);
+ std::vector<ossimString> values;
+ lookup.trim().split(values, ",");
+
+ if(values.size() > 1)
+ {
+ imageSpacePivot.x = values[0].toDouble();
+ imageSpacePivot.y = values[1].toDouble();
+ }
}
else
{
- imageSpaceScale.y = 1.0;
+ if (m_geom)
+ {
+ ossimDrect rect;
+ m_geom->getBoundingRect(rect);
+ imageSpacePivot = rect.midPoint();
+ }
}
}
=====================================
src/util/ossimImageUtil.cpp
=====================================
--- a/src/util/ossimImageUtil.cpp
+++ b/src/util/ossimImageUtil.cpp
@@ -753,25 +753,25 @@ void ossimImageUtil::processFile(const ossimFilename& file)
createOverview(ih, consumedHistogramOptions, consumedCmmOptions);
}
}
- if(createThumbnails())
+ if (createThumbnails())
{
- for(ossim_uint32 idx = 0; idx < ih->getNumberOfEntries();++idx)
- {
- ih->setCurrentEntry(idx);
- if(ih->getNumberOfDecimationLevels() <=1)
+ for (ossim_uint32 idx = 0; idx < ih->getNumberOfEntries(); ++idx)
{
- ih->getState()->setOverviewState(0);
- ih->openOverview();
+ ih->setCurrentEntry(idx);
+ if (ih->getNumberOfDecimationLevels() <= 1)
+ {
+ ih->setState(0);
+ ih->openOverview();
+ }
+ createThumbnail(ih);
}
- }
- createThumbnail(ih);
}
// Build stand alone histogram. Note the overview sequencer may have computed for us.
if ( hasHistogramOption() && !consumedHistogramOptions)
{
createHistogram( ih );
}
-
+
// Launch any file system commands.
executeFileCommands( file );
}
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/compare/7286c6966993f35fcfc44f4e7de2522d56bdfa46...d10f5ca7cdd9545647086e9a8f5f37c16935731e
---
View it on GitLab: https://salsa.debian.org/debian-gis-team/ossim/compare/7286c6966993f35fcfc44f4e7de2522d56bdfa46...d10f5ca7cdd9545647086e9a8f5f37c16935731e
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/20180501/513581c1/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list