[ossim] 01/07: New upstream version 2.1.0
Bas Couwenberg
sebastic at debian.org
Wed Sep 20 15:16:30 UTC 2017
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch experimental
in repository ossim.
commit d0a7aeb8e134ace41a7ab0230b17348cee2d1c5e
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Wed Sep 20 16:48:31 2017 +0200
New upstream version 2.1.0
---
CMakeLists.txt | 13 +-
README.md | 2 +-
apps/CMakeLists.txt | 30 +-
.../ossim-extract-vertices.cpp | 37 +-
apps/ossim-icp/ossim-icp.cpp | 2 +-
apps/ossim-pc2dem/ossim-pc2dem.cpp | 2 +-
apps/ossim-rpf/ossim-rpf.cpp | 5 +-
apps/ossim-senint/ossim-senint.cpp | 2 +-
cmake/CMakeLists.txt | 12 +-
cmake/CMakeModules/FindMSP.cmake | 276 +++-----
cmake/CMakeModules/FindOpenCV.cmake | 105 +--
cmake/CMakeModules/FindOpenCV2.cmake | 94 ---
cmake/CMakeModules/Findossim.cmake | 2 +-
cmake/CMakeModules/OssimUtilities.cmake | 717 +++++++++++----------
cmake/scripts/ossim-cmake-config.sh | 20 +-
doc/Doxyfile | 2 +-
include/ossim/base/ossimBlockIStream.h | 70 ++
include/ossim/base/ossimBlockStreamBuffer.h | 282 ++++++++
include/ossim/base/ossimDpt.h | 6 +-
include/ossim/base/ossimGDoptimizer.h | 74 +++
include/ossim/base/ossimIoStream.h | 39 ++
include/ossim/base/ossimKeywordlist.h | 20 +
include/ossim/base/ossimLookUpTable.h | 31 +-
include/ossim/base/ossimPolygon.h | 11 +-
include/ossim/base/ossimRefPtr.h | 6 +
include/ossim/base/ossimStreamFactory.h | 23 -
include/ossim/base/ossimStreamFactoryBase.h | 14 -
include/ossim/base/ossimStreamFactoryRegistry.h | 168 ++++-
include/ossim/base/ossimString.h | 22 +
include/ossim/base/ossimTerm.h | 431 +++++++++++++
include/ossim/base/ossimTimer.h | 4 +
include/ossim/imaging/ossimBandAverageFilter.h | 4 +-
include/ossim/imaging/ossimBlendMosaic.h | 2 +-
include/ossim/imaging/ossimCacheTileSource.h | 4 +-
.../ossim/imaging/ossimGeneralRasterTileSource.h | 2 +-
include/ossim/imaging/ossimImageGeometry.h | 3 +-
include/ossim/imaging/ossimImageRenderer.h | 4 +-
include/ossim/imaging/ossimIndexToRgbLutFilter.h | 4 +-
include/ossim/imaging/ossimLinearStretchRemapper.h | 2 +-
include/ossim/imaging/ossimMeanMedianFilter.h | 4 +-
include/ossim/imaging/ossimScalarRemapper.h | 4 +-
include/ossim/imaging/ossimTiffWriter.h | 6 +-
include/ossim/imaging/ossimTwoColorView.h | 5 +-
include/ossim/imaging/ossimVertexExtractor.h | 4 +-
include/ossim/support_data/ossimSrtmSupportData.h | 2 +-
scripts/env.sh | 26 +-
share/ossim/templates/ossim_preferences_template | 21 +-
src/CMakeLists.txt | 13 +-
src/base/ossimArgumentParser.cpp | 6 +-
src/base/ossimBlockStreamBuffer.cpp | 267 ++++++++
src/base/ossimGDoptimizer.cpp | 102 +++
src/base/ossimKeywordlist.cpp | 26 +
src/base/ossimLookUpTable.cpp | 14 +
src/base/ossimPolygon.cpp | 12 +-
src/base/ossimStreamFactory.cpp | 90 +--
src/base/ossimStreamFactoryRegistry.cpp | 236 ++++---
src/base/ossimString.cpp | 40 ++
src/base/ossimTerm.cpp | 180 ++++++
src/elevation/ossimSrtmFactory.cpp | 14 +-
src/imaging/ossimGeneralRasterTileSource.cpp | 11 +-
src/imaging/ossimImageGeometry.cpp | 52 +-
src/imaging/ossimImageRenderer.cpp | 4 +-
src/imaging/ossimLasReader.cpp | 122 ++--
src/imaging/ossimNitfTileSource.cpp | 19 +-
src/imaging/ossimNitfWriter.cpp | 6 +-
src/imaging/ossimTiffTileSource.cpp | 6 +
src/imaging/ossimTilingPoly.cpp | 6 +-
src/init/ossimInit.cpp | 5 +-
src/parallel/ossimImageChainMtAdaptor.cpp | 4 +-
src/sockets/ossimToolServer.cpp | 3 +-
src/support_data/ossimSrtmSupportData.cpp | 33 +-
src/support_data/ossimTiffInfo.cpp | 1 -
src/util/ossimChipperUtil.cpp | 316 ++++-----
src/util/ossimInfo.cpp | 70 +-
src/util/ossimOrthoIgen.cpp | 4 +-
src/util/ossimViewshedTool.cpp | 1 +
test/src/ossim-foo.cpp | 5 +
test/src/util/ossim-tools-test.cpp | 2 +-
78 files changed, 2961 insertions(+), 1328 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab8260f..90f27e4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,10 +9,19 @@ ENDIF(NOT OSSIM_BUILD_ADDITIONAL_OSSIM_DIRECTORIES)
cmake_minimum_required(VERSION 2.8)
+SET(CMAKE_MODULE_PATH
+ "${CMAKE_CURRENT_SOURCE_DIR}/ossim/cmake/CMakeModules" ${CMAKE_MODULE_PATH})
+
+include(CMakeDetermineSystem)
INCLUDE(OssimVersion)
INCLUDE(OssimCommonVariables)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
# Expose some build options
+set(LIB_NAME ossim CACHE STRING "Name of ossim libray (default is ossim).")
OPTION(BUILD_OSSIM_FREETYPE_SUPPORT "Set to ON to build OSSIM with freetype support. Use OFF to turn off freetype support." ON)
OPTION(BUILD_OSSIM_MPI_SUPPORT "Set to ON to build OSSIM with MPI support. Use OFF to turn off MPI support." OFF)
OPTION(BUILD_OSSIM_ID_SUPPORT "Set to ON to build OSSIM GIT ID support into the library. Use OFF to turn off ID support." ON)
@@ -48,7 +57,7 @@ set( ossimDependentLibs )
#---
# GEOS - Currently optional until it is actually called.:
-find_package( GEOS )
+find_package( GEOS QUIET)
if( GEOS_FOUND )
include_directories( ${GEOS_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${GEOS_LIBRARY} )
@@ -206,7 +215,7 @@ ENDIF(NOT BUILD_OSSIM_ID_SUPPORT)
SET(OSSIM_CONFIGURE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/ossim/ossimConfig.h")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/ossimConfig.h.in"
- "${OSSIM_CONFIGURE_HEADER}")
+ "${OSSIM_CONFIGURE_HEADER}")
SET(OSSIM_VERSION_HEADER_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/src/ossimVersion.h.in")
SET(OSSIM_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/ossim/ossimVersion.h")
CONFIGURE_FILE("${OSSIM_VERSION_HEADER_CONFIG}"
diff --git a/README.md b/README.md
index f754744..0170cb4 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ If you want to contribute code, you'll need to:
The moderators will review the request and merge your changes to "dev". At that point, the automated continuous integration system (Jenkins) will get triggered to perform a build and test. If there are any failures, your merge commit will be backed out.
-#How to Build
+# How to Build
The easy way is to just run the script in `ossim/scripts/build.sh`. This approach should work for the default build configuration. This currently works for both linux and Mac. We hope to soon have a Windows `build.bat` file and world peace. Assuming all dependencies were met and no compile/link errors occured, this script will generate all build binaries under a sibling directory to the ossim repo directory, namely, `ossim/../build`. See the section on environment variables below for op [...]
This repository provides the CMAKE infrastructure necessary to build the OSSIM core library and related plugins and applications. Throughout this document, reference is made to the local, top-level directory containing this repository. We'll call this directory simply *ossim-dev-home*. (In fact, you'll find the shell variable `OSSIM_DEV_HOME` used throughout the various scripts in this and other repositories.
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index 285216e..46d05ca 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -2,21 +2,21 @@ FILE(GLOB OSSIM_APP_DIRS "ossim-*")
FILE(GLOB OSSIM_CONFIG_DIR "ossim-config*")
LIST(REMOVE_ITEM OSSIM_APP_DIRS ${OSSIM_CONFIG_DIR})
-FIND_PACKAGE(ossim)
-FIND_PACKAGE( OpenThreads )
-if( OPENTHREADS_FOUND )
- include_directories( ${OPENTHREADS_INCLUDE_DIR} )
-else( OPENTHREADS_FOUND )
- message( FATAL_ERROR "Could not find required OpenThreads package!" )
-endif( OPENTHREADS_FOUND )
+# FIND_PACKAGE(ossim)
+# FIND_PACKAGE( OpenThreads )
+# if( OPENTHREADS_FOUND )
+# include_directories( ${OPENTHREADS_INCLUDE_DIR} )
+# else( OPENTHREADS_FOUND )
+# message( FATAL_ERROR "Could not find required OpenThreads package!" )
+# endif( OPENTHREADS_FOUND )
-if( OSSIM_FOUND )
- include_directories( ${OSSIM_INCLUDE_DIR} )
-else( OSSIM_FOUND )
- message( FATAL_ERROR "Could not find required OSSIM package!" )
-endif( OSSIM_FOUND )
-set(TARGET_COMMON_LIBRARIES ${OSSIM_LIBRARY} ${OPENTHREADS_LIBRARY})
+# if( OSSIM_FOUND )
+# include_directories( ${OSSIM_INCLUDE_DIR} )
+# else( OSSIM_FOUND )
+# message( FATAL_ERROR "Could not find required OSSIM package!" )
+# endif( OSSIM_FOUND )
+# set(TARGET_COMMON_LIBRARIES ${OSSIM_LIBRARY} ${OPENTHREADS_LIBRARY})
FOREACH(f ${OSSIM_APP_DIRS})
- ADD_SUBDIRECTORY(${f})
-ENDFOREACH(f)
+ ADD_SUBDIRECTORY(${f})
+ENDFOREACH(f)
\ No newline at end of file
diff --git a/apps/ossim-extract-vertices/ossim-extract-vertices.cpp b/apps/ossim-extract-vertices/ossim-extract-vertices.cpp
index 4945824..59391b1 100644
--- a/apps/ossim-extract-vertices/ossim-extract-vertices.cpp
+++ b/apps/ossim-extract-vertices/ossim-extract-vertices.cpp
@@ -27,13 +27,13 @@ static ossimTrace traceDebug("extract_vertices:main");
void usage()
{
- cout << "\nextract_vertices <image_file> <optional_output_file>"
+ cout << "\nextract_vertices <image_file> [output_file]"
<< "\nNOTE:\n"
<< " Scans the image, extracts vertices and writes results to"
<< " a keyword list.\n"
- << " The optional_output_file parameter specifies the path for the"
- << " extracted\n"
- << " vertices. If not specified, the name of the image_file with "
+ << " The output_file parameter specifies the path for the extracted"
+ << " vertices.\n"
+ << " If not specified, the name of the image_file with "
<< "\"_vertices.kwl\"\n"
<< " appended. So if image = \"foo.tif\" then"
<< " results file = \"foo_vertices.kwl\".\n" << endl;
@@ -47,7 +47,7 @@ int main(int argc, char *argv[])
ossimInit::instance()->initialize(argc, argv);
- if (argc != 2)
+ if (argc != 2 && argc != 3)
{
usage();
exit(0);
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
{
cout << "ERROR: Unsupported image file: " << input_file
<< "\nExiting application." << endl;
- exit(0);
+ exit(1);
}
// Check for errors.
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
cerr << "ERROR: Unable to read image file: " << input_file
<< "\nExiting application." << endl;
ih = 0;
- exit(1);
+ exit(2);
}
// Initialize the image handler.
@@ -87,7 +87,6 @@ int main(int argc, char *argv[])
// Create the output file name from the input file name.
else
{
- output_file = input_file.path();
output_file = output_file.dirCat(input_file.fileNoExtension());
output_file += "_vertices.kwl";
}
@@ -112,9 +111,29 @@ int main(int argc, char *argv[])
// Add a listener for the percent complete to standard output.
ossimStdOutProgress prog(0, true);
ve->addListener(&prog);
+
+ // Check that the output file can be created
+ if (!ve->open())
+ {
+ cerr << "ERROR: Unable to open output file: " << output_file
+ << "\nExiting application." << endl;
+ ih = 0;
+ ve->disconnect();
+ ve = 0;
+ exit(3);
+ }
// Start the extraction...
- ve->execute();
+ if (!ve->execute())
+ {
+ cerr << "ERROR: Unable to create output vertices: "
+ << "\nExiting application." << endl;
+ ih = 0;
+ ve->disconnect();
+ ve = 0;
+ exit(4);
+ }
+
ih = 0;
ve->disconnect();
ve = 0;
diff --git a/apps/ossim-icp/ossim-icp.cpp b/apps/ossim-icp/ossim-icp.cpp
index fd47a9d..7720313 100644
--- a/apps/ossim-icp/ossim-icp.cpp
+++ b/apps/ossim-icp/ossim-icp.cpp
@@ -646,7 +646,7 @@ int main(int argc, char* argv[])
ossimRefPtr<ossimImageFileWriter> writer =
ossimImageWriterFactoryRegistry::instance()->createWriter(kwl, PREFIX);
- if( writer == 0 )
+ if( !writer)
{
ossimNotify(ossimNotifyLevel_NOTICE)
<< "\nCould not create writer of type: "
diff --git a/apps/ossim-pc2dem/ossim-pc2dem.cpp b/apps/ossim-pc2dem/ossim-pc2dem.cpp
index 4ecaae8..28f8485 100644
--- a/apps/ossim-pc2dem/ossim-pc2dem.cpp
+++ b/apps/ossim-pc2dem/ossim-pc2dem.cpp
@@ -646,7 +646,7 @@ int main(int argc, char* argv[])
ossimRefPtr<ossimImageFileWriter> writer =
ossimImageWriterFactoryRegistry::instance()->createWriter(kwl, PREFIX);
- if( writer == 0 )
+ if( !writer)
{
ossimNotify(ossimNotifyLevel_NOTICE)
<< "\nCould not create writer of type: "
diff --git a/apps/ossim-rpf/ossim-rpf.cpp b/apps/ossim-rpf/ossim-rpf.cpp
index ab0e589..deef2c2 100644
--- a/apps/ossim-rpf/ossim-rpf.cpp
+++ b/apps/ossim-rpf/ossim-rpf.cpp
@@ -187,9 +187,8 @@ void printFrameList( const ossimFilename& imageFile,
{
// Tell the instance to skip the empty check and open
// the file no matter if the frame images are there or not.
- ossimRefPtr<ossimCibCadrgTileSource> pRpf =
- new ossimCibCadrgTileSource();
- if ( pRpf != 0 )
+ ossimRefPtr<ossimCibCadrgTileSource> pRpf = new ossimCibCadrgTileSource();
+ if ( pRpf )
{
if( pRpf->isOpen() )
{
diff --git a/apps/ossim-senint/ossim-senint.cpp b/apps/ossim-senint/ossim-senint.cpp
index 193b125..bfda686 100644
--- a/apps/ossim-senint/ossim-senint.cpp
+++ b/apps/ossim-senint/ossim-senint.cpp
@@ -261,7 +261,7 @@ int main(int argc, char *argv[])
model[1] = PTR_CAST(ossimSensorModel,
ossimSensorModelFactory::instance()->createProjection(inputFile[1],0));
- if (model[1] == NULL)
+ if (!model[1])
{
std::cout << " loadState 2 Failed"<<std::endl;
return 0;
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 0ee5b9a..ca74d92 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -112,12 +112,8 @@ IF(BUILD_OSSIM_VIDEO AND EXISTS ${OSSIM_DEV_HOME}/ossim-video)
add_subdirectory(${OSSIM_DEV_HOME}/ossim-video ${CMAKE_CURRENT_BINARY_DIR}/ossim-video)
ENDIF()
-IF(BUILD_OSSIM_MSP AND EXISTS ${OSSIM_DEV_HOME}/ossim-msp)
- add_subdirectory(${OSSIM_DEV_HOME}/ossim-msp ${CMAKE_CURRENT_BINARY_DIR}/ossim-msp)
-ENDIF()
-
-IF(BUILD_OSSIM_ATP AND EXISTS ${OSSIM_DEV_HOME}/ossim-atp)
- add_subdirectory(${OSSIM_DEV_HOME}/ossim-atp ${CMAKE_CURRENT_BINARY_DIR}/ossim-atp)
+IF(BUILD_OSSIM_ISA AND EXISTS ${OSSIM_DEV_HOME}/ossim-isa)
+ add_subdirectory(${OSSIM_DEV_HOME}/ossim-isa ${CMAKE_CURRENT_BINARY_DIR}/ossim-isa)
ENDIF()
IF(BUILD_OMS AND EXISTS ${OSSIM_DEV_HOME}/ossim-oms)
@@ -131,7 +127,6 @@ IF(BUILD_OMS AND EXISTS ${OSSIM_DEV_HOME}/ossim-oms)
add_subdirectory(${OSSIM_DEV_HOME}/ossim-oms ${CMAKE_CURRENT_BINARY_DIR}/ossim-oms)
ENDIF()
-
IF(BUILD_OSSIM_PLANET AND EXISTS ${OSSIM_DEV_HOME}/ossim-planet)
IF(NOT OSSIMPLANET_LIBRARY)
@@ -360,6 +355,5 @@ MESSAGE( STATUS "BUILD_OSSIM_WMS = ${BUILD_OSSIM_WMS}" )
MESSAGE( STATUS "BUILD_LIBRARY_DIR = ${BUILD_LIBRARY_DIR}" )
MESSAGE( STATUS "BUILD_RUNTIME_DIR = ${BUILD_RUNTIME_DIR}" )
MESSAGE( STATUS "BUILD_DSMG = ${BUILD_DSMG}" )
-MESSAGE( STATUS "BUILD_OSSIM_MSP = ${BUILD_OSSIM_MSP}" )
-MESSAGE( STATUS "BUILD_OSSIM_ATP = ${BUILD_OSSIM_ATP}" )
+MESSAGE( STATUS "BUILD_OSSIM_ISA = ${BUILD_OSSIM_ISA}" )
MESSAGE( STATUS "Use OSSIM_BUILD_ADDITIONAL_DIRECTORIES to add other cmake builds." )
diff --git a/cmake/CMakeModules/FindMSP.cmake b/cmake/CMakeModules/FindMSP.cmake
index 1aea2bd..752aa3b 100644
--- a/cmake/CMakeModules/FindMSP.cmake
+++ b/cmake/CMakeModules/FindMSP.cmake
@@ -1,182 +1,106 @@
-SET(CMAKE_FIND_FRAMEWORK "LAST")
-FIND_PATH(MSP_INCLUDE_DIRS Mensuration/MensurationService.h
- PATHS
- /usr/local/msp-1.5/ToolKit/include
- $ENV{MSP_HOME}/include
- ${OSSIM_DEPENDENCIES}/include
- ${OSSIM_INSTALL_PREFIX}/include
-)
-
-set (MSP_INCLUDE_DIRS ${MSP_INCLUDE_DIRS}
- ${MSP_INCLUDE_DIRS}/CoordinateConversion
- ${MSP_INCLUDE_DIRS}/Terrain
- ${MSP_INCLUDE_DIRS}/common
- ${MSP_INCLUDE_DIRS}/common/utilities
- ${MSP_INCLUDE_DIRS}/common/geometry
- ${MSP_INCLUDE_DIRS}/common/math
- ${MSP_INCLUDE_DIRS}/common/csmutil
- ${MSP_INCLUDE_DIRS}/common/ntmtre
- ${MSP_INCLUDE_DIRS}/common/nitf
- ${MSP_INCLUDE_DIRS}/common/deiutil
- ${MSP_INCLUDE_DIRS}/common/dtcc
- ${MSP_INCLUDE_DIRS}/common/csm)
-
-
-MESSAGE("MSP_HOME = $ENV{MSP_HOME}")
-
-find_library(MSP_LIBRARY43 NAMES MSPPointExtractionService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY43})
-
-find_library(MSP_LIBRARY24 NAMES MSPSensorModelService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY24})
-
-find_library(MSP_LIBRARY28 NAMES MSPSourceSelectionService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY28})
-
-find_library(MSP_LIBRARY11 NAMES MSPCovarianceService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY11})
-
-find_library(MSP_LIBRARY34 NAMES MSPSupportDataService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY34})
-
-find_library(MSP_LIBRARY36 NAMES MSPTerrainService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY36})
-
-find_library(MSP_LIBRARY05 NAMES MSPCCSUtils PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY05})
-
-find_library(MSP_LIBRARY09 NAMES MSPCoordinateConversionService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY09})
-
-find_library(MSP_LIBRARY06 NAMES MSPOutputMethodService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY06})
-
-find_library(MSP_LIBRARY03 NAMES MSPasdetre PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY03})
-
-find_library(MSP_LIBRARY07 NAMES MSPcoordconverter PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY07})
-
-find_library(MSP_LIBRARY13 NAMES MSPcsisd PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY13})
-
-find_library(MSP_LIBRARY15 NAMES MSPcsm PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY15})
-
-find_library(MSP_LIBRARY17 NAMES MSPcsmutil PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY17})
-
-find_library(MSP_LIBRARY23 NAMES MSPdtcc PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY23})
-
-find_library(MSP_LIBRARY31 NAMES MSPlas PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY31})
-
-find_library(MSP_LIBRARY25 NAMES MSPgeometry PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY25})
-
-find_library(MSP_LIBRARY33 NAMES MSPmath PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY33})
-
-find_library(MSP_LIBRARY02 NAMES MSPnitf PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY02})
-
-find_library(MSP_LIBRARY04 NAMES MSPntmtre PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY04})
-
-find_library(MSP_LIBRARY12 NAMES MSPrage PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY12})
-
-find_library(MSP_LIBRARY10 NAMES MSPRageServiceUtils PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY10})
-
-find_library(MSP_LIBRARY14 NAMES MSPrageutilities PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY14})
-
-find_library(MSP_LIBRARY30 NAMES MSPSScovmodel PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY30})
-
-find_library(MSP_LIBRARY32 NAMES MSPSSrutil PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY32})
-
-find_library(MSP_LIBRARY38 NAMES MSPutilities PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY38})
-
-find_library(MSP_LIBRARY01 NAMES CSM_PCAPI PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY01})
-
-find_library(MSP_LIBRARY16 NAMES MSPrsme PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY16})
-
-find_library(MSP_LIBRARY18 NAMES MSPRsmGeneratorService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY18})
-
-find_library(MSP_LIBRARY19 NAMES MSPdei PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY19})
-
-find_library(MSP_LIBRARY20 NAMES MSPrsmg PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY20})
-
-find_library(MSP_LIBRARY21 NAMES MSPDEIUtil PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY21})
-
-find_library(MSP_LIBRARY22 NAMES MSPrutil PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY22})
-
-find_library(MSP_LIBRARY26 NAMES MSPSensorSpecificService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY26})
-
-find_library(MSP_LIBRARY27 NAMES MSPImagingGeometryService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY27})
-
-find_library(MSP_LIBRARY29 NAMES MSPjson PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY29})
-
-find_library(MSP_LIBRARY35 NAMES MSPmens PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY35})
-
-find_library(MSP_LIBRARY36 NAMES MSPTerrainService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY36})
-
-find_library(MSP_LIBRARY37 NAMES MSPMensurationService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY37})
-
-find_library(MSP_LIBRARY39 NAMES MSPMensurationSessionRecordService PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY39})
-
-find_library(MSP_LIBRARY40 NAMES MSPwriteRsmNitf PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY40})
-
-find_library(MSP_LIBRARY41 NAMES MSPMSPVersionUtils PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY41})
-
-find_library(MSP_LIBRARY42 NAMES MSPmtdCommon PATHS /usr/local/msp-1.5/ToolKit/lib $ENV{MSP_HOME}/lib ${OSSIM_DEPENDENCIES}/lib ${OSSIM_INSTALL_PREFIX}/lib${LIBSUFFIX} )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY42})
-
-find_library(MSP_LIBRARY00 NAMES pthread )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARY00})
-
-find_library(MSP_LIBRARYDL NAMES dl )
-set (MSP_LIBRARIES ${MSP_LIBRARIES} ${MSP_LIBRARYDL})
-
-
#---
-# This function sets MSP_FOUND if variables are valid.
+# This module sets MSP_FOUND if variables are valid.
#---
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( MSP DEFAULT_MSG
- MSP_LIBRARIES
- MSP_INCLUDE_DIRS )
-if(NOT MSP_FOUND)
- if( NOT MSP_FIND_QUIETLY )
- message( WARNING "Could not find MSP" )
- endif( NOT MSP_FIND_QUIETLY )
-endif(NOT MSP_FOUND)
+SET(CMAKE_FIND_FRAMEWORK "LAST")
-#if( NOT MSP_FIND_QUIETLY )
-# message( STATUS "MSP_INCLUDE_DIRS=${MSP_INCLUDE_DIRS}" )
-# message( STATUS "MSP_LIBRARIES=${MSP_LIBRARIES}" )
-#endif( NOT MSP_FIND_QUIETLY )
+##############################################################
+
+macro(FIND_MSP_LIBRARY LIBS_OK MYLIBRARYNAME)
+ if (LIBS_OK)
+ find_library( TARGET_LIBRARY_${MYLIBRARYNAME}
+ NAMES "${MYLIBRARYNAME}"
+ PATHS
+ $ENV{MSP_HOME}/lib
+ /usr/lib64
+ /usr/lib
+ /usr/local/lib )
+ if (TARGET_LIBRARY_${MYLIBRARYNAME})
+ set (MSP_LIBRARIES ${MSP_LIBRARIES} ${TARGET_LIBRARY_${MYLIBRARYNAME}})
+ else()
+ set(LIBS_OK "NO")
+ endif()
+ endif()
+endmacro(FIND_MSP_LIBRARY LIBS_OK MYLIBRARYNAME)
+
+##############################################################
+
+set(MSP_FOUND "NO")
+
+FIND_PATH(MSP_INCLUDE_DIRS Mensuration/MensurationService.h
+ PATHS
+ $ENV{MSP_HOME}/include
+ /usr/include
+ /usr/local/include)
+
+if (MSP_INCLUDE_DIRS)
+ set (MSP_INCLUDE_DIRS ${MSP_INCLUDE_DIRS}
+ ${MSP_INCLUDE_DIRS}/CoordinateConversion
+ ${MSP_INCLUDE_DIRS}/Terrain
+ ${MSP_INCLUDE_DIRS}/common
+ ${MSP_INCLUDE_DIRS}/common/utilities
+ ${MSP_INCLUDE_DIRS}/common/geometry
+ ${MSP_INCLUDE_DIRS}/common/math
+ ${MSP_INCLUDE_DIRS}/common/csmutil
+ ${MSP_INCLUDE_DIRS}/common/ntmtre
+ ${MSP_INCLUDE_DIRS}/common/nitf
+ ${MSP_INCLUDE_DIRS}/common/deiutil
+ ${MSP_INCLUDE_DIRS}/common/dtcc
+ ${MSP_INCLUDE_DIRS}/common/csm)
+ set(LIBS_OK "YES")
+ FIND_MSP_LIBRARY(LIBS_OK MSPPointExtractionService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPSensorModelService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPSourceSelectionService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPCovarianceService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPSupportDataService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPTerrainService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPCCSUtils)
+ FIND_MSP_LIBRARY(LIBS_OK MSPCoordinateConversionService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPOutputMethodService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPasdetre)
+ FIND_MSP_LIBRARY(LIBS_OK MSPcoordconverter)
+ FIND_MSP_LIBRARY(LIBS_OK MSPcsisd)
+ FIND_MSP_LIBRARY(LIBS_OK MSPcsm)
+ FIND_MSP_LIBRARY(LIBS_OK MSPcsmutil)
+ FIND_MSP_LIBRARY(LIBS_OK MSPdtcc)
+ FIND_MSP_LIBRARY(LIBS_OK MSPlas)
+ FIND_MSP_LIBRARY(LIBS_OK MSPgeometry)
+ FIND_MSP_LIBRARY(LIBS_OK MSPmath)
+ FIND_MSP_LIBRARY(LIBS_OK MSPnitf)
+ FIND_MSP_LIBRARY(LIBS_OK MSPntmtre)
+ FIND_MSP_LIBRARY(LIBS_OK MSPrage)
+ FIND_MSP_LIBRARY(LIBS_OK MSPRageServiceUtils)
+ FIND_MSP_LIBRARY(LIBS_OK MSPrageutilities)
+ FIND_MSP_LIBRARY(LIBS_OK MSPSScovmodel)
+ FIND_MSP_LIBRARY(LIBS_OK MSPSSrutil)
+ FIND_MSP_LIBRARY(LIBS_OK MSPutilities)
+ FIND_MSP_LIBRARY(LIBS_OK CSM_PCAPI)
+ FIND_MSP_LIBRARY(LIBS_OK MSPrsme)
+ FIND_MSP_LIBRARY(LIBS_OK MSPRsmGeneratorService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPdei)
+ FIND_MSP_LIBRARY(LIBS_OK MSPrsmg)
+ FIND_MSP_LIBRARY(LIBS_OK MSPDEIUtil)
+ FIND_MSP_LIBRARY(LIBS_OK MSPrutil)
+ FIND_MSP_LIBRARY(LIBS_OK MSPSensorSpecificService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPImagingGeometryService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPjson)
+ FIND_MSP_LIBRARY(LIBS_OK MSPmens)
+ FIND_MSP_LIBRARY(LIBS_OK MSPTerrainService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPMensurationService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPMensurationSessionRecordService)
+ FIND_MSP_LIBRARY(LIBS_OK MSPwriteRsmNitf)
+ FIND_MSP_LIBRARY(LIBS_OK MSPMSPVersionUtils)
+ FIND_MSP_LIBRARY(LIBS_OK MSPmtdCommon)
+ FIND_MSP_LIBRARY(LIBS_OK pthread )
+ FIND_MSP_LIBRARY(LIBS_OK dl )
+
+ if( LIBS_OK )
+ set(MSP_FOUND "YES")
+ #message("-- MSP_INCLUDE_DIRS = ${MSP_INCLUDE_DIRS}")
+ #message("-- MSP_LIBRARIES = ${MSP_LIBRARIES}")
+ endif()
+
+endif()
mark_as_advanced(MSP_INCLUDE_DIRS MSP_LIBRARIES)
+
diff --git a/cmake/CMakeModules/FindOpenCV.cmake b/cmake/CMakeModules/FindOpenCV.cmake
index b2db884..11fdbd6 100644
--- a/cmake/CMakeModules/FindOpenCV.cmake
+++ b/cmake/CMakeModules/FindOpenCV.cmake
@@ -3,6 +3,9 @@
#
# Locate OPENCV
#
+# The environment is referenced for $OPENCV_HOME first before the
+# standard install locations to perit sandbox installations of OpenCV.
+#
# This module defines:
#
# OPENCV_INCLUDE_DIR
@@ -26,71 +29,97 @@
# $Id$
# Find include path:
-find_path(OPENCV_INCLUDE_DIR opencv/cv.hpp PATHS /usr/include /usr/local/include)
+find_path(OPENCV_INCLUDE_DIR opencv/cv.hpp
+ PATHS
+ $ENV{OPENCV_HOME}/include
+ /usr/local/opencv-3.2/include
+ /usr/include
+ /usr/local/include)
macro(FIND_OPENCV_LIBRARY MYLIBRARY MYLIBRARYNAME)
find_library( ${MYLIBRARY}
NAMES "${MYLIBRARYNAME}${OPENCV_RELEASE_POSTFIX}"
PATHS
+ $ENV{OPENCV_HOME}/lib
+ /usr/local/opencv-3.2/lib
/usr/lib64
/usr/lib
- /usr/local/lib
- )
+ /usr/local/lib)
endmacro(FIND_OPENCV_LIBRARY MYLIBRARY MYLIBRARYNAME)
-FIND_OPENCV_LIBRARY(OPENCV_CALIB3D_LIBRARY opencv_calib3d)
-FIND_OPENCV_LIBRARY(OPENCV_CONTRIB_LIBRARY opencv_contrib)
+# Required
FIND_OPENCV_LIBRARY(OPENCV_CORE_LIBRARY opencv_core)
FIND_OPENCV_LIBRARY(OPENCV_FEATURES2D_LIBRARY opencv_features2d)
FIND_OPENCV_LIBRARY(OPENCV_FLANN_LIBRARY opencv_flann)
-FIND_OPENCV_LIBRARY(OPENCV_GPU_LIBRARY opencv_gpu)
FIND_OPENCV_LIBRARY(OPENCV_HIGHGUI_LIBRARY opencv_highgui)
FIND_OPENCV_LIBRARY(OPENCV_IMGPROC_LIBRARY opencv_imgproc)
-FIND_OPENCV_LIBRARY(OPENCV_LEGACY_LIBRARY opencv_legacy)
FIND_OPENCV_LIBRARY(OPENCV_ML_LIBRARY opencv_ml)
-FIND_OPENCV_LIBRARY(OPENCV_IMGCODECS_LIBRARY opencv_imgcodecs)
-
-message( STATUS "OPENCV_INCLUDE_DIR = ${OPENCV_INCLUDE_DIR}" )
-message( STATUS "OPENCV_CALIB3D_LIBRARY = ${OPENCV_CALIB3D_LIBRARY}" )
-message( STATUS "OPENCV_CONTRIB_LIBRARY = ${OPENCV_CONTRIB_LIBRARY}" )
-message( STATUS "OPENCV_CORE_LIBRARY = ${OPENCV_CORE_LIBRARY}" )
-message( STATUS "OPENCV_FEATURES2D_LIBRARY = ${OPENCV_FEATURES2D_LIBRARY}" )
-message( STATUS "OPENCV_FLANN_LIBRARY = ${OPENCV_FLANN_LIBRARY}" )
-message( STATUS "OPENCV_GPU_LIBRARY = ${OPENCV_GPU_LIBRARY}" )
-message( STATUS "OPENCV_HIGHGUI_LIBRARY = ${OPENCV_HIGHGUI_LIBRARY}" )
-message( STATUS "OPENCV_IMGPROC_LIBRARY = ${OPENCV_IMGPROC_LIBRARY}" )
-message( STATUS "OPENCV_LEGACY_LIBRARY = ${OPENCV_LEGACY_LIBRARY}" )
-message( STATUS "OPENCV_ML_LIBRARY = ${OPENCV_ML_LIBRARY}" )
-message( STATUS "OPENCV_IMGCODECS_LIBRARY = ${OPENCV_IMGCODECS_LIBRARY}" )
+FIND_OPENCV_LIBRARY(OPENCV_OBJDETECT_LIBRARY opencv_objdetect)
+FIND_OPENCV_LIBRARY(OPENCV_XFEATURES2D_LIBRARY opencv_xfeatures2d)
+FIND_OPENCV_LIBRARY(OPENCV_PHOTO_LIBRARY opencv_photo)
+FIND_OPENCV_LIBRARY(OPENCV_VIDEO_LIBRARY opencv_video)
+# Optional
+FIND_OPENCV_LIBRARY(OPENCV_IMGCODECS_LIBRARY opencv_imgcodecs)
+FIND_OPENCV_LIBRARY(OPENCV_CUDAARITHM_LIBRARY opencv_cudaarithm)
+FIND_OPENCV_LIBRARY(OPENCV_CUDAIMGPROC_LIBRARY opencv_cudaimgproc)
+FIND_OPENCV_LIBRARY(OPENCV_CUDEV_LIBRARY opencv_cudev)
-# Removed OPENCV_GPU_LIBRARY AND (drb 20140220)
+set(OPENCV_LIBRARIES ${OPENCV_OBJDETECT_LIBRARY}
+ ${OPENCV_CORE_LIBRARY}
+ ${OPENCV_FEATURES2D_LIBRARY}
+ ${OPENCV_XFEATURES2D_LIBRARY}
+ ${OPENCV_FLANN_LIBRARY}
+ ${OPENCV_HIGHGUI_LIBRARY}
+ ${OPENCV_IMGPROC_LIBRARY}
+ ${OPENCV_ML_LIBRARY}
+ ${OPENCV_PHOTO_LIBRARY}
+ ${OPENCV_VIDEO_LIBRARY})
set(OPENCV_FOUND "NO")
-if(OPENCV_INCLUDE_DIR AND OPENCV_CALIB3D_LIBRARY AND OPENCV_CONTRIB_LIBRARY AND OPENCV_CORE_LIBRARY AND OPENCV_FEATURES2D_LIBRARY AND OPENCV_FLANN_LIBRARY AND OPENCV_HIGHGUI_LIBRARY AND OPENCV_IMGPROC_LIBRARY AND OPENCV_LEGACY_LIBRARY AND OPENCV_ML_LIBRARY)
+if ( OPENCV_INCLUDE_DIR AND
+ OPENCV_CORE_LIBRARY AND
+ OPENCV_FEATURES2D_LIBRARY AND
+ OPENCV_XFEATURES2D_LIBRARY AND
+ OPENCV_FLANN_LIBRARY AND
+ OPENCV_HIGHGUI_LIBRARY AND
+ OPENCV_IMGPROC_LIBRARY AND
+ OPENCV_ML_LIBRARY AND
+ OPENCV_OBJDETECT_LIBRARY AND
+ OPENCV_PHOTO_LIBRARY AND
+ OPENCV_VIDEO_LIBRARY)
set(OPENCV_FOUND "YES")
- set(OPENCV_LIBRARIES ${OPENCV_CALIB3D_LIBRARY} ${OPENCV_CONTRIB_LIBRARY} ${OPENCV_CORE_LIBRARY} ${OPENCV_FEATURES2D_LIBRARY} ${OPENCV_FLANN_LIBRARY} ${OPENCV_HIGHGUI_LIBRARY} ${OPENCV_IMGPROC_LIBRARY} ${OPENCV_LEGACY_LIBRARY} ${OPENCV_ML_LIBRARY})
- message( STATUS "OPENCV_LIBRARIES = ${OPENCV_LIBRARIES}" )
-else(OPENCV_INCLUDE_DIR AND OPENCV_CALIB3D_LIBRARY AND OPENCV_CONTRIB_LIBRARY AND OPENCV_CORE_LIBRARY AND OPENCV_FEATURES2D_LIBRARY AND OPENCV_FLANN_LIBRARY AND OPENCV_HIGHGUI_LIBRARY AND OPENCV_IMGPROC_LIBRARY AND OPENCV_LEGACY_LIBRARY AND OPENCV_ML_LIBRARY)
- message( WARNING "Could not find OPENCV" )
-endif(OPENCV_INCLUDE_DIR AND OPENCV_CALIB3D_LIBRARY AND OPENCV_CONTRIB_LIBRARY AND OPENCV_CORE_LIBRARY AND OPENCV_FEATURES2D_LIBRARY AND OPENCV_FLANN_LIBRARY AND OPENCV_HIGHGUI_LIBRARY AND OPENCV_IMGPROC_LIBRARY AND OPENCV_LEGACY_LIBRARY AND OPENCV_ML_LIBRARY)
+else()
+ message( WARNING "Could not find all OpenCV libraries. Check the list for NOTFOUND:" )
+ message( "${OPENCV_LIBRARIES}" )
+endif()
set(OPENCV_GPU_FOUND "NO")
-if(OPENCV_FOUND AND OPENCV_GPU_LIBRARY)
+if ( OPENCV_FOUND AND
+ OPENCV_CUDAARITHM_LIBRARY AND
+ OPENCV_CUDAIMGPROC_LIBRARY AND
+ OPENCV_CUDEV_LIBRARY)
set(OPENCV_GPU_FOUND "YES")
- set(OPENCV_LIBRARIES ${OPENCV_LIBRARIES} ${OPENCV_GPU_LIBRARY})
- message( STATUS "OPENCV_GPU_LIBRARY = ${OPENCV_GPU_LIBRARY}" )
-else(OPENCV_FOUND AND OPENCV_GPU_LIBRARY)
- message( WARNING "Could not find optional OPENCV GPU Library. " )
-endif(OPENCV_FOUND AND OPENCV_GPU_LIBRARY)
+ set(OPENCV_LIBRARIES ${OPENCV_LIBRARIES}
+ ${OPENCV_CUDAARITHM_LIBRARY}
+ ${OPENCV_CUDAIMGPROC_LIBRARY}
+ ${OPENCV_CUDEV_LIBRARY} )
+else()
+ message( "Could not find optional OpenCV GPU (CUDA) Libraries. " )
+endif()
set(OPENCV_IMGCODECS_FOUND "NO")
if(OPENCV_FOUND AND OPENCV_IMGCODECS_LIBRARY)
set(OPENCV_IMGCODECS_FOUND "YES")
set(OPENCV_LIBRARIES ${OPENCV_LIBRARIES} ${OPENCV_IMGCODECS_LIBRARY})
- message( STATUS "OPENCV_IMGCODECS_LIBRARY = ${OPENCV_IMGCODECS_LIBRARY}" )
-else(OPENCV_FOUND AND OPENCV_IMGCODECS_LIBRARY)
- message( WARNING "Could not find optional OPENCV Image Codecs Library" )
-endif(OPENCV_FOUND AND OPENCV_IMGCODECS_LIBRARY)
+else()
+ message( "Could not find optional OpenCV Image Codecs Library" )
+endif()
+
+if(OPENCV_FOUND)
+ message( STATUS "OPENCV_INCLUDE_DIR = ${OPENCV_INCLUDE_DIR}" )
+ message( STATUS "OPENCV_LIBRARIES = ${OPENCV_LIBRARIES}" )
+endif()
+
diff --git a/cmake/CMakeModules/FindOpenCV2.cmake b/cmake/CMakeModules/FindOpenCV2.cmake
deleted file mode 100644
index cf58984..0000000
--- a/cmake/CMakeModules/FindOpenCV2.cmake
+++ /dev/null
@@ -1,94 +0,0 @@
-#---
-# File: FindOpenCV.cmake
-#
-# Locate OPENCV
-#
-# This module defines:
-#
-# OPENCV_INCLUDE_DIR
-#
-# OPENCV_FOUND,
-# OPENCV_CORE_FOUND
-# OPENCV_HIGHGUI_FOUND
-# OPENCV_IMGPROC_FOUND
-# OPENCV_LEGACY_FOUND
-# OPENCV_ML_FOUND
-#
-# OPENCV_CORE_LIBRARY
-# OPENCV_HIGHGUI_LIBRARY
-# OPENCV_IMGPROC_LIBRARY
-# OPENCV_LEGACY_LIBRARY
-# OPENCV_ML_LIBRARY
-# OPENCV_LIBRARIES
-#
-# Created by Garrett Potts.
-#
-# $Id$
-
-# Find include path:
-find_path(OPENCV_INCLUDE_DIR opencv/cv.h PATHS /home/okramer/dev/opencv-2.4.13.2)
-
-macro(FIND_OPENCV_LIBRARY MYLIBRARY MYLIBRARYNAME)
-
- find_library( ${MYLIBRARY}
- NAMES "${MYLIBRARYNAME}${OPENCV_RELEASE_POSTFIX}"
- PATHS
- /home/okramer/dev/opencv-2.4.13.2/lib
- )
-
-endmacro(FIND_OPENCV_LIBRARY MYLIBRARY MYLIBRARYNAME)
-
-FIND_OPENCV_LIBRARY(OPENCV_CALIB3D_LIBRARY opencv_calib3d)
-FIND_OPENCV_LIBRARY(OPENCV_CONTRIB_LIBRARY opencv_contrib)
-FIND_OPENCV_LIBRARY(OPENCV_CORE_LIBRARY opencv_core)
-FIND_OPENCV_LIBRARY(OPENCV_FEATURES2D_LIBRARY opencv_features2d)
-FIND_OPENCV_LIBRARY(OPENCV_FLANN_LIBRARY opencv_flann)
-FIND_OPENCV_LIBRARY(OPENCV_GPU_LIBRARY opencv_gpu)
-FIND_OPENCV_LIBRARY(OPENCV_HIGHGUI_LIBRARY opencv_highgui)
-FIND_OPENCV_LIBRARY(OPENCV_IMGPROC_LIBRARY opencv_imgproc)
-FIND_OPENCV_LIBRARY(OPENCV_LEGACY_LIBRARY opencv_legacy)
-FIND_OPENCV_LIBRARY(OPENCV_ML_LIBRARY opencv_ml)
-FIND_OPENCV_LIBRARY(OPENCV_IMGCODECS_LIBRARY opencv_imgcodecs)
-
-message( STATUS "OPENCV_INCLUDE_DIR = ${OPENCV_INCLUDE_DIR}" )
-message( STATUS "OPENCV_CALIB3D_LIBRARY = ${OPENCV_CALIB3D_LIBRARY}" )
-message( STATUS "OPENCV_CONTRIB_LIBRARY = ${OPENCV_CONTRIB_LIBRARY}" )
-message( STATUS "OPENCV_CORE_LIBRARY = ${OPENCV_CORE_LIBRARY}" )
-message( STATUS "OPENCV_FEATURES2D_LIBRARY = ${OPENCV_FEATURES2D_LIBRARY}" )
-message( STATUS "OPENCV_FLANN_LIBRARY = ${OPENCV_FLANN_LIBRARY}" )
-message( STATUS "OPENCV_GPU_LIBRARY = ${OPENCV_GPU_LIBRARY}" )
-message( STATUS "OPENCV_HIGHGUI_LIBRARY = ${OPENCV_HIGHGUI_LIBRARY}" )
-message( STATUS "OPENCV_IMGPROC_LIBRARY = ${OPENCV_IMGPROC_LIBRARY}" )
-message( STATUS "OPENCV_LEGACY_LIBRARY = ${OPENCV_LEGACY_LIBRARY}" )
-message( STATUS "OPENCV_ML_LIBRARY = ${OPENCV_ML_LIBRARY}" )
-message( STATUS "OPENCV_IMGCODECS_LIBRARY = ${OPENCV_IMGCODECS_LIBRARY}" )
-
-
-# Removed OPENCV_GPU_LIBRARY AND (drb 20140220)
-
-set(OPENCV_FOUND "NO")
-if(OPENCV_INCLUDE_DIR AND OPENCV_CALIB3D_LIBRARY AND OPENCV_CONTRIB_LIBRARY AND OPENCV_CORE_LIBRARY AND OPENCV_FEATURES2D_LIBRARY AND OPENCV_FLANN_LIBRARY AND OPENCV_HIGHGUI_LIBRARY AND OPENCV_IMGPROC_LIBRARY AND OPENCV_LEGACY_LIBRARY AND OPENCV_ML_LIBRARY)
- set(OPENCV_FOUND "YES")
- set(OPENCV_LIBRARIES ${OPENCV_CALIB3D_LIBRARY} ${OPENCV_CONTRIB_LIBRARY} ${OPENCV_CORE_LIBRARY} ${OPENCV_FEATURES2D_LIBRARY} ${OPENCV_FLANN_LIBRARY} ${OPENCV_HIGHGUI_LIBRARY} ${OPENCV_IMGPROC_LIBRARY} ${OPENCV_LEGACY_LIBRARY} ${OPENCV_ML_LIBRARY})
- message( STATUS "OPENCV_LIBRARIES = ${OPENCV_LIBRARIES}" )
-else(OPENCV_INCLUDE_DIR AND OPENCV_CALIB3D_LIBRARY AND OPENCV_CONTRIB_LIBRARY AND OPENCV_CORE_LIBRARY AND OPENCV_FEATURES2D_LIBRARY AND OPENCV_FLANN_LIBRARY AND OPENCV_HIGHGUI_LIBRARY AND OPENCV_IMGPROC_LIBRARY AND OPENCV_LEGACY_LIBRARY AND OPENCV_ML_LIBRARY)
- message( WARNING "Could not find OPENCV" )
-endif(OPENCV_INCLUDE_DIR AND OPENCV_CALIB3D_LIBRARY AND OPENCV_CONTRIB_LIBRARY AND OPENCV_CORE_LIBRARY AND OPENCV_FEATURES2D_LIBRARY AND OPENCV_FLANN_LIBRARY AND OPENCV_HIGHGUI_LIBRARY AND OPENCV_IMGPROC_LIBRARY AND OPENCV_LEGACY_LIBRARY AND OPENCV_ML_LIBRARY)
-
-set(OPENCV_GPU_FOUND "NO")
-if(OPENCV_FOUND AND OPENCV_GPU_LIBRARY)
- set(OPENCV_GPU_FOUND "YES")
- set(OPENCV_LIBRARIES ${OPENCV_LIBRARIES} ${OPENCV_GPU_LIBRARY})
- message( STATUS "OPENCV_GPU_LIBRARY = ${OPENCV_GPU_LIBRARY}" )
-else(OPENCV_FOUND AND OPENCV_GPU_LIBRARY)
- message( WARNING "Could not find optional OPENCV GPU Library. " )
-endif(OPENCV_FOUND AND OPENCV_GPU_LIBRARY)
-
-set(OPENCV_IMGCODECS_FOUND "NO")
-if(OPENCV_FOUND AND OPENCV_IMGCODECS_LIBRARY)
- set(OPENCV_IMGCODECS_FOUND "YES")
- set(OPENCV_LIBRARIES ${OPENCV_LIBRARIES} ${OPENCV_IMGCODECS_LIBRARY})
- message( STATUS "OPENCV_IMGCODECS_LIBRARY = ${OPENCV_IMGCODECS_LIBRARY}" )
-else(OPENCV_FOUND AND OPENCV_IMGCODECS_LIBRARY)
- message( WARNING "Could not find optional OPENCV Image Codecs Library" )
-endif(OPENCV_FOUND AND OPENCV_IMGCODECS_LIBRARY)
diff --git a/cmake/CMakeModules/Findossim.cmake b/cmake/CMakeModules/Findossim.cmake
index 917ce82..ad12e12 100644
--- a/cmake/CMakeModules/Findossim.cmake
+++ b/cmake/CMakeModules/Findossim.cmake
@@ -18,7 +18,7 @@
set(CMAKE_FIND_FRAMEWORK "LAST")
find_path(OSSIM_INCLUDE_DIR ossim/ossimVersion.h ossimVersion.h
PATHS
- $ENV{OSSIM_DEV_HOME}/core/include
+ $ENV{OSSIM_DEV_HOME}/ossim/include
$ENV{OSSIM_INSTALL_PREFIX}/include
PATH_SUFFIXES
include
diff --git a/cmake/CMakeModules/OssimUtilities.cmake b/cmake/CMakeModules/OssimUtilities.cmake
index a39b99e..c5ca5a7 100644
--- a/cmake/CMakeModules/OssimUtilities.cmake
+++ b/cmake/CMakeModules/OssimUtilities.cmake
@@ -1,357 +1,360 @@
-#################################################################################
-# This was taken from the http://www.cmake.org/Wiki/CMakeMacroParseArguments
-#################################################################################
-MACRO(OSSIM_PARSE_ARGUMENTS prefix arg_names option_names)
- SET(DEFAULT_ARGS)
- FOREACH(arg_name ${arg_names})
- SET(${prefix}_${arg_name})
- ENDFOREACH(arg_name)
- FOREACH(option ${option_names})
- SET(${prefix}_${option} FALSE)
- ENDFOREACH(option)
-
- SET(current_arg_name DEFAULT_ARGS)
- SET(current_arg_list)
- FOREACH(arg ${ARGN})
- SET(larg_names ${arg_names})
- LIST(FIND larg_names "${arg}" is_arg_name)
- IF (is_arg_name GREATER -1)
- SET(${prefix}_${current_arg_name} ${current_arg_list})
- SET(current_arg_name ${arg})
- SET(current_arg_list)
- ELSE (is_arg_name GREATER -1)
- SET(loption_names ${option_names})
- LIST(FIND loption_names "${arg}" is_option)
- IF (is_option GREATER -1)
- SET(${prefix}_${arg} TRUE)
- ELSE (is_option GREATER -1)
- SET(current_arg_list ${current_arg_list} ${arg})
- ENDIF (is_option GREATER -1)
- ENDIF (is_arg_name GREATER -1)
- ENDFOREACH(arg)
- SET(${prefix}_${current_arg_name} ${current_arg_list})
-ENDMACRO(OSSIM_PARSE_ARGUMENTS)
-
-##############################################################################################
-# This was taken from http://www.cmake.org/Wiki/CMakeMacroListOperations#CAR_and_CDR
-##############################################################################################
-MACRO(OSSIM_CAR var)
- SET(${var} ${ARGV1})
-ENDMACRO(OSSIM_CAR)
-
-#############################################################################################
-# This was taken from http://www.cmake.org/Wiki/CMakeMacroListOperations#CAR_and_CDR
-#############################################################################################
-MACRO(OSSIM_CDR var junk)
- SET(${var} ${ARGN})
-ENDMACRO(OSSIM_CDR)
-
-#################################################################################
-# MACRO: TODAYS_DATE
-#
-# DESCRIPTION:
-# MACRO FOR GETTING THE DATE AND TIME INFORMATION
-#################################################################################
-MACRO (TODAYS_DATE RESULT)
- string(TIMESTAMP ${RESULT} "%Y%m%d" UTC)
-ENDMACRO (TODAYS_DATE)
-
-#################################################################################
-# MACRO: GET_GIT_REVISION
-#
-# DESCRIPTION:
-# MACRO FOR GETTING THE GIT revision for this build
-#################################################################################
-MACRO (GET_GIT_REVISION)
- FIND_PACKAGE(Git)
- IF(GIT_FOUND)
- GIT_WC_INFO(${PROJECT_SOURCE_DIR} Project)
- # MESSAGE("Current revision is ${Project_WC_REVISION}")
- # Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
- # MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
- ENDIF()
-ENDMACRO(GET_GIT_REVISION)
-
-MACRO(LINK_EXTERNAL TRGTNAME)
- FOREACH(LINKLIB ${ARGN})
- TARGET_LINK_LIBRARIES(${TRGTNAME} "${LINKLIB}" )
- ENDFOREACH(LINKLIB)
-ENDMACRO(LINK_EXTERNAL TRGTNAME)
-
-MACRO(LINK_INTERNAL TRGTNAME)
- IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
- TARGET_LINK_LIBRARIES(${TRGTNAME} ${ARGN})
- ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
- FOREACH(LINKLIB ${ARGN})
- IF(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
- #when using versioned names, the .dll name differ from .lib name, there is a problem with that:
- #CMake 2.4.7, at least seem to use PREFIX instead of IMPORT_PREFIX for computing linkage info to use into projects,
- # so we full path name to specify linkage, this prevent automatic inferencing of dependencies, so we add explicit depemdencies
- #to library targets used
- TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_RELEASE_POSTFIX}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib")
- ADD_DEPENDENCIES(${TRGTNAME} ${LINKLIB})
- ELSE(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
- TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}${CMAKE_RELEASE_POSTFIX}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
- ENDIF(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
- ENDFOREACH(LINKLIB)
- ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
-ENDMACRO(LINK_INTERNAL TRGTNAME)
-
-######################################################################
-#
-# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plugins
-# kept in the variable TARGET_COMMON_LIBRARIES and an example or plugin specific kept in TARGET_ADDED_LIBRARIES
-# they are combined in a single list checked for unicity
-# the suffix ${CMAKE_DEBUG_POSTFIX} is used for differentiating optimized and debug
-#
-# a second variable TARGET_EXTERNAL_LIBRARIES hold the list of libraries not differentiated between debug and optimized
-##################################################################################
-MACRO(SETUP_LINK_LIBRARIES)
- SET(TARGET_LIBRARIES ${TARGET_COMMON_LIBRARIES})
-
- FOREACH(LINKLIB ${TARGET_ADDED_LIBRARIES})
- SET(TO_INSERT TRUE)
- FOREACH (value ${TARGET_COMMON_LIBRARIES})
- IF (${value} STREQUAL ${LINKLIB})
- SET(TO_INSERT FALSE)
- ENDIF (${value} STREQUAL ${LINKLIB})
- ENDFOREACH (value ${TARGET_COMMON_LIBRARIES})
- IF(TO_INSERT)
- LIST(APPEND TARGET_LIBRARIES ${LINKLIB})
- ENDIF(TO_INSERT)
- ENDFOREACH(LINKLIB)
-
- LINK_INTERNAL(${TARGET_TARGETNAME} ${TARGET_LIBRARIES})
- TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} ${TARGET_EXTERNAL_LIBRARIES})
- IF(TARGET_LIBRARIES_VARS)
- LINK_WITH_VARIABLES(${TARGET_TARGETNAME} ${TARGET_LIBRARIES_VARS})
- ENDIF(TARGET_LIBRARIES_VARS)
-ENDMACRO(SETUP_LINK_LIBRARIES)
-
-
-MACRO(OSSIM_SETUP_APPLICATION)
- OSSIM_PARSE_ARGUMENTS(APPLICATION
- "COMPONENT_NAME;SOURCE_FILES;HEADERS;TARGET_NAME;TARGET_LABEL"
- "COMMAND_LINE;INSTALL;REQUIRE_WINMAIN_FLAG"
- ${ARGN})
- OSSIM_CAR(APPLICATION_NAME "${APPLICATION_DEFAULT_ARGS}")
- OSSIM_CDR(APPLICATION_SOURCES "${APPLICATION_DEFAULT_ARGS}")
- SET(TARGET_NAME ${APPLICATION_NAME})
- SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${APPLICATION_NAME}")
- IF(APPLICATION_TARGET_NAME)
- set(TARGET_TARGETNAME "${APPLICATION_TARGET_NAME}")
- ENDIF(APPLICATION_TARGET_NAME)
-
- SET(TARGET_LABEL "${TARGET_DEFAULT_LABEL_PREFIX} ${APPLICATION_NAME}")
- IF(APPLICATION_TARGET_LABEL)
- SET(TARGET_LABEL "${APPLICATION_TARGET_LABEL}")
- ENDIF(APPLICATION_TARGET_LABEL)
-
- IF(APPLICATION_COMMAND_LINE)
- ADD_EXECUTABLE(${TARGET_TARGETNAME} ${APPLICATION_SOURCE_FILES} ${APPLICATION_HEADERS})
-
- ELSE(APPLICATION_COMMAND_LINE)
- IF(APPLE)
- # SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
- # Short Version is the "marketing version". It is the version
- # the user sees in an information panel.
- SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
- # Bundle version is the version the OS looks at.
- SET(MACOSX_BUNDLE_BUNDLE_VERSION "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
- SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ossim.${TARGET_TARGETNAME}" )
- SET(MACOSX_BUNDLE_BUNDLE_NAME "${TARGET_TARGETNAME}" )
- # SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns")
- # SET(MACOSX_BUNDLE_COPYRIGHT "")
- # SET(MACOSX_BUNDLE_INFO_STRING "Info string, localized?")
- ENDIF(APPLE)
-
- IF(WIN32)
- IF (APPLICATION_REQUIRE_WINMAIN_FLAG)
- SET(PLATFORM_SPECIFIC_CONTROL WIN32)
- ENDIF (APPLICATION_REQUIRE_WINMAIN_FLAG)
- ENDIF(WIN32)
-
- IF(APPLE)
- IF(OSSIM_BUILD_APPLICATION_BUNDLES)
- SET(PLATFORM_SPECIFIC_CONTROL MACOSX_BUNDLE)
- ENDIF(OSSIM_BUILD_APPLICATION_BUNDLES)
- ENDIF(APPLE)
- ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${APPLICATION_SOURCE_FILES} ${APPLICATION_HEADERS})
-
- ENDIF(APPLICATION_COMMAND_LINE)
-
-
- SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
- SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME})
- SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_OUTPUT_NAME "${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}")
- SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELEASE_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELEASE_POSTFIX}")
- SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELWITHDEBINFO_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}")
- SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES MINSIZEREL_OUTPUT_NAME "${TARGET_NAME}${CMAKE_MINSIZEREL_POSTFIX}")
-
- IF(MSVC_IDE AND OSSIM_MSVC_VERSIONED_DLL)
- SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../")
- ENDIF(MSVC_IDE AND OSSIM_MSVC_VERSIONED_DLL)
-
-
- SETUP_LINK_LIBRARIES()
-
- IF(APPLICATION_INSTALL)
- IF(APPLE)
- INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} BUNDLE DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${APPLICATION_COMPONENT_NAME})
- ELSE(APPLE)
- INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} ${INSTALL_COMPONENT_INFO} COMPONENT ${APPLICATION_COMPONENT_NAME})
- ENDIF(APPLE)
- ENDIF(APPLICATION_INSTALL)
-
- SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_RUNTIME_DIR}")
-
-
-ENDMACRO(OSSIM_SETUP_APPLICATION)
-
-#####################################################################################################
-# MACRO: OSSIM_LINK_LIBRARY
-#
-# Example:
-# OSSIM_LINK_LIBRARY(ossim
-# COMPONENT_NAME ossim
-# SOURCE_FILES foo.cpp
-# HEADERS foo.h
-# TYPE SHARED
-# LIBRARIES <list of libraries to link against>
-# INSTALL_LIB
-# INSTALL_HEADERS)
-#
-# The INSTALL_LIB says to add a default install command for the library by default it will setup the following
-# install(TARGETS ossim
-# FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR}
-# RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
-# LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
-# ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
-# PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR}
-# COMPONENT ossim)
-#
-# The INSTALL_HEADERS will do a default header installation if the option is passed in
-# install(FILES <list of headers> DESTINATION "include/ossim" COMPONENT ossim)
-#####################################################################################################
-MACRO(OSSIM_LINK_LIBRARY)
- # The SO_VERSION and VERSION are here for override purpose only so other libraries with their own
- # versioning scheme can use the sum linking
- #
- OSSIM_PARSE_ARGUMENTS(LINK
- "COMPONENT_NAME;SOURCE_FILES;HEADERS;TYPE;LIBRARIES;ADDITIONAL_COMPILE_FLAGS;SOVERSION;VERSION;PUBLIC_HEADERS"
- "INSTALL_LIB;INSTALL_HEADERS;VERSION_SYMLINKS"
- ${ARGN})
- OSSIM_CAR(LINK_NAME "${LINK_DEFAULT_ARGS}")
- OSSIM_CDR(LINK_SOURCES "${LINK_DEFAULT_ARGS}")
- ADD_DEFINITIONS("${OSSIM_COMMON_COMPILER_FLAGS}")
- ADD_LIBRARY(${LINK_NAME}
- ${LINK_TYPE}
- ${LINK_HEADERS}
- ${LINK_SOURCE_FILES})
- IF(NOT LINK_PUBLIC_HEADERS)
- SET(LINK_PUBLIC_HEADERS ${LINK_HEADERS})
- ENDIF()
- IF(LINK_ADDITIONAL_COMPILE_FLAGS)
- SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
- COMPILE_FLAGS ${LINK_ADDITIONAL_COMPILE_FLAGS})
- ENDIF(LINK_ADDITIONAL_COMPILE_FLAGS)
- if(APPLE)
- IF(BUILD_SHARED_LIBS)
-# SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-# SET(CMAKE_INSTALL_RPATH "${OSSIM_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
- IF(BUILD_OSSIM_FRAMEWORKS)
- SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
- FRAMEWORK TRUE
- BUILD_WITH_INSTALL_RPATH ON
- INSTALL_NAME_DIR @rpath/Frameworks)
- ELSE(BUILD_OSSIM_FRAMEWORKS)
- #---
- # Given install prefix=/usr/local and
- # install lib dir = lib64 and
- # link name = libossim.dylib
- # You get "/usr/local/lib64/libossim.dylib" in the rpath.
- #---
- SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
- FRAMEWORK FALSE
- BUILD_WITH_INSTALL_RPATH ON
- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}")
- ENDIF(BUILD_OSSIM_FRAMEWORKS)
- ELSE(BUILD_SHARED_LIBRARY)
- SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
- FRAMEWORK FALSE)
- ENDIF(BUILD_SHARED_LIBS)
- ENDIF(APPLE)
- IF(UNIX AND BUILD_SHARED_LIBS AND NOT APPLE)
- IF(LINK_VERSION_SYMLINKS)
- IF(NOT LINK_SOVERSION)
- set(LINK_SOVERSION "${OSSIM_SOVERSION}")
- ENDIF(NOT LINK_SOVERSION)
- IF(NOT LINK_VERSION)
- set(LINK_VERSION "${OSSIM_VERSION}")
- ENDIF(NOT LINK_VERSION)
- # ADD_CUSTOM_TARGET( lib DEPENDS ${LINK_NAME} )
- # change lib_target properties
- SET_TARGET_PROPERTIES( ${LINK_NAME} PROPERTIES
- # create *nix style library versions + symbolic links
- VERSION ${LINK_VERSION}
- SOVERSION ${LINK_SOVERSION}
- # allow creating static and shared libs without conflicts
- CLEAN_DIRECT_OUTPUT 1
- # avoid conflicts between library and binary target names
- OUTPUT_NAME ${LINK_NAME} )
- ENDIF(LINK_VERSION_SYMLINKS)
- ENDIF(UNIX AND BUILD_SHARED_LIBS AND NOT APPLE)
- SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_RUNTIME_DIR}")
- IF(APPLE AND BUILD_OSSIM_FRAMEWORKS)
- SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_FRAMEWORK_DIR}")
- ELSE(APPLE AND BUILD_OSSIM_FRAMEWORKS)
- SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_LIBRARY_DIR}")
- ENDIF(APPLE AND BUILD_OSSIM_FRAMEWORKS)
- SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
- ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_LIBRARY_DIR}")
-
- TARGET_LINK_LIBRARIES(${LINK_NAME} ${LINK_LIBRARIES} ${${LINK_NAME}_EXTRA_LIBS})
-
- IF(LINK_INSTALL_LIB)
- IF(LINK_INSTALL_HEADERS)
- SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PUBLIC_HEADER "${LINK_PUBLIC_HEADERS}")
- install(TARGETS ${LINK_NAME}
- FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR} COMPONENT ${LINK_COMPONENT_NAME}
- RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${LINK_COMPONENT_NAME}
- LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} COMPONENT ${LINK_COMPONENT_NAME}
- ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev
- PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev)
- ELSE(LINK_INSTALL_HEADERS)
- install(TARGETS ${LINK_NAME}
- FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR} COMPONENT ${LINK_COMPONENT_NAME}
- RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${LINK_COMPONENT_NAME}
- LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} COMPONENT ${LINK_COMPONENT_NAME}
- ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev)
- ENDIF(LINK_INSTALL_HEADERS)
- ENDIF(LINK_INSTALL_LIB)
-ENDMACRO(OSSIM_LINK_LIBRARY)
-
-MACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
-# get_target_property(TEST_UNINSTALL uninstall CREATED)
-# IF(NOT TEST_UNINSTALL)
- #-----------------------------------------------------------------------------
- ### uninstall target
- #-----------------------------------------------------------------------------
- SET(OSSIM_CMAKE_UNINSTALL_CONFIG "${PROJECT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in")
- IF(EXISTS ${OSSIM_CMAKE_UNINSTALL_CONFIG})
- CONFIGURE_FILE(
- "${OSSIM_CMAKE_UNINSTALL_CONFIG}"
- "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
- IMMEDIATE @ONLY)
- ADD_CUSTOM_TARGET(uninstall
- "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
- )
- set_target_properties(uninstall PROPERTIES CREATED 1)
- ENDIF(EXISTS ${OSSIM_CMAKE_UNINSTALL_CONFIG})
-# ENDIF(NOT TEST_UNINSTALL)
-ENDMACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
-
+#################################################################################
+# This was taken from the http://www.cmake.org/Wiki/CMakeMacroParseArguments
+#################################################################################
+MACRO(OSSIM_PARSE_ARGUMENTS prefix arg_names option_names)
+ SET(DEFAULT_ARGS)
+ FOREACH(arg_name ${arg_names})
+ SET(${prefix}_${arg_name})
+ ENDFOREACH(arg_name)
+ FOREACH(option ${option_names})
+ SET(${prefix}_${option} FALSE)
+ ENDFOREACH(option)
+
+ SET(current_arg_name DEFAULT_ARGS)
+ SET(current_arg_list)
+ FOREACH(arg ${ARGN})
+ SET(larg_names ${arg_names})
+ LIST(FIND larg_names "${arg}" is_arg_name)
+ IF (is_arg_name GREATER -1)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ SET(current_arg_name ${arg})
+ SET(current_arg_list)
+ ELSE (is_arg_name GREATER -1)
+ SET(loption_names ${option_names})
+ LIST(FIND loption_names "${arg}" is_option)
+ IF (is_option GREATER -1)
+ SET(${prefix}_${arg} TRUE)
+ ELSE (is_option GREATER -1)
+ SET(current_arg_list ${current_arg_list} ${arg})
+ ENDIF (is_option GREATER -1)
+ ENDIF (is_arg_name GREATER -1)
+ ENDFOREACH(arg)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO(OSSIM_PARSE_ARGUMENTS)
+
+##############################################################################################
+# This was taken from http://www.cmake.org/Wiki/CMakeMacroListOperations#CAR_and_CDR
+##############################################################################################
+MACRO(OSSIM_CAR var)
+ SET(${var} ${ARGV1})
+ENDMACRO(OSSIM_CAR)
+
+#############################################################################################
+# This was taken from http://www.cmake.org/Wiki/CMakeMacroListOperations#CAR_and_CDR
+#############################################################################################
+MACRO(OSSIM_CDR var junk)
+ SET(${var} ${ARGN})
+ENDMACRO(OSSIM_CDR)
+
+#################################################################################
+# MACRO: TODAYS_DATE
+#
+# DESCRIPTION:
+# MACRO FOR GETTING THE DATE AND TIME INFORMATION
+#################################################################################
+MACRO (TODAYS_DATE RESULT)
+ string(TIMESTAMP ${RESULT} "%Y%m%d" UTC)
+ENDMACRO (TODAYS_DATE)
+
+#################################################################################
+# MACRO: GET_GIT_REVISION
+#
+# DESCRIPTION:
+# MACRO FOR GETTING THE GIT revision for this build
+#################################################################################
+MACRO (GET_GIT_REVISION)
+ FIND_PACKAGE(Git)
+ IF(GIT_FOUND)
+ GIT_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+ # MESSAGE("Current revision is ${Project_WC_REVISION}")
+ # Subversion_WC_LOG(${PROJECT_SOURCE_DIR} Project)
+ # MESSAGE("Last changed log is ${Project_LAST_CHANGED_LOG}")
+ ENDIF()
+ENDMACRO(GET_GIT_REVISION)
+
+MACRO(LINK_EXTERNAL TRGTNAME)
+ FOREACH(LINKLIB ${ARGN})
+ TARGET_LINK_LIBRARIES(${TRGTNAME} "${LINKLIB}" )
+ ENDFOREACH(LINKLIB)
+ENDMACRO(LINK_EXTERNAL TRGTNAME)
+
+MACRO(LINK_INTERNAL TRGTNAME)
+ IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
+ TARGET_LINK_LIBRARIES(${TRGTNAME} ${ARGN})
+ ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
+ FOREACH(LINKLIB ${ARGN})
+ IF(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
+ #when using versioned names, the .dll name differ from .lib name, there is a problem with that:
+ #CMake 2.4.7, at least seem to use PREFIX instead of IMPORT_PREFIX for computing linkage info to use into projects,
+ # so we full path name to specify linkage, this prevent automatic inferencing of dependencies, so we add explicit depemdencies
+ #to library targets used
+ TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_RELEASE_POSTFIX}.lib" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}.lib")
+ ADD_DEPENDENCIES(${TRGTNAME} ${LINKLIB})
+ ELSE(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
+ TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}${CMAKE_RELEASE_POSTFIX}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
+ ENDIF(MSVC AND OSSIM_MSVC_VERSIONED_DLL)
+ ENDFOREACH(LINKLIB)
+ ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4)
+ENDMACRO(LINK_INTERNAL TRGTNAME)
+
+######################################################################
+#
+# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plugins
+# kept in the variable TARGET_COMMON_LIBRARIES and an example or plugin specific kept in TARGET_ADDED_LIBRARIES
+# they are combined in a single list checked for unicity
+# the suffix ${CMAKE_DEBUG_POSTFIX} is used for differentiating optimized and debug
+#
+# a second variable TARGET_EXTERNAL_LIBRARIES hold the list of libraries not differentiated between debug and optimized
+##################################################################################
+MACRO(SETUP_LINK_LIBRARIES)
+ SET(TARGET_LIBRARIES ${TARGET_COMMON_LIBRARIES})
+
+ FOREACH(LINKLIB ${TARGET_ADDED_LIBRARIES})
+ SET(TO_INSERT TRUE)
+ FOREACH (value ${TARGET_COMMON_LIBRARIES})
+ IF (${value} STREQUAL ${LINKLIB})
+ SET(TO_INSERT FALSE)
+ ENDIF (${value} STREQUAL ${LINKLIB})
+ ENDFOREACH (value ${TARGET_COMMON_LIBRARIES})
+ IF(TO_INSERT)
+ LIST(APPEND TARGET_LIBRARIES ${LINKLIB})
+ ENDIF(TO_INSERT)
+ ENDFOREACH(LINKLIB)
+
+ LINK_INTERNAL(${TARGET_TARGETNAME} ${TARGET_LIBRARIES})
+ TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} ${TARGET_EXTERNAL_LIBRARIES})
+ IF(TARGET_LIBRARIES_VARS)
+ LINK_WITH_VARIABLES(${TARGET_TARGETNAME} ${TARGET_LIBRARIES_VARS})
+ ENDIF(TARGET_LIBRARIES_VARS)
+ENDMACRO(SETUP_LINK_LIBRARIES)
+
+
+MACRO(OSSIM_SETUP_APPLICATION)
+ OSSIM_PARSE_ARGUMENTS(APPLICATION
+ "COMPONENT_NAME;SOURCE_FILES;HEADERS;TARGET_NAME;TARGET_LABEL"
+ "COMMAND_LINE;INSTALL;REQUIRE_WINMAIN_FLAG"
+ ${ARGN})
+ OSSIM_CAR(APPLICATION_NAME "${APPLICATION_DEFAULT_ARGS}")
+ OSSIM_CDR(APPLICATION_SOURCES "${APPLICATION_DEFAULT_ARGS}")
+ SET(TARGET_NAME ${APPLICATION_NAME})
+ SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${APPLICATION_NAME}")
+ IF(APPLICATION_TARGET_NAME)
+ set(TARGET_TARGETNAME "${APPLICATION_TARGET_NAME}")
+ ENDIF(APPLICATION_TARGET_NAME)
+
+ SET(TARGET_LABEL "${TARGET_DEFAULT_LABEL_PREFIX} ${APPLICATION_NAME}")
+ IF(APPLICATION_TARGET_LABEL)
+ SET(TARGET_LABEL "${APPLICATION_TARGET_LABEL}")
+ ENDIF(APPLICATION_TARGET_LABEL)
+
+ IF(APPLICATION_COMMAND_LINE)
+ ADD_EXECUTABLE(${TARGET_TARGETNAME} ${APPLICATION_SOURCE_FILES} ${APPLICATION_HEADERS})
+
+ ELSE(APPLICATION_COMMAND_LINE)
+ IF(APPLE)
+ # SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
+ # Short Version is the "marketing version". It is the version
+ # the user sees in an information panel.
+ SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
+ # Bundle version is the version the OS looks at.
+ SET(MACOSX_BUNDLE_BUNDLE_VERSION "${OSSIM_MAJOR_VERSION}.${OSSIM_MINOR_VERSION}.${OSSIM_PATCH_VERSION}")
+ SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.ossim.${TARGET_TARGETNAME}" )
+ SET(MACOSX_BUNDLE_BUNDLE_NAME "${TARGET_TARGETNAME}" )
+ # SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns")
+ # SET(MACOSX_BUNDLE_COPYRIGHT "")
+ # SET(MACOSX_BUNDLE_INFO_STRING "Info string, localized?")
+ ENDIF(APPLE)
+
+ IF(WIN32)
+ IF (APPLICATION_REQUIRE_WINMAIN_FLAG)
+ SET(PLATFORM_SPECIFIC_CONTROL WIN32)
+ ENDIF (APPLICATION_REQUIRE_WINMAIN_FLAG)
+ ENDIF(WIN32)
+
+ IF(APPLE)
+ IF(OSSIM_BUILD_APPLICATION_BUNDLES)
+ SET(PLATFORM_SPECIFIC_CONTROL MACOSX_BUNDLE)
+ ENDIF(OSSIM_BUILD_APPLICATION_BUNDLES)
+ ENDIF(APPLE)
+ ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${APPLICATION_SOURCE_FILES} ${APPLICATION_HEADERS})
+
+ ENDIF(APPLICATION_COMMAND_LINE)
+
+ if(NOT LIB_NAME)
+ message(FATAL_ERROR "LIB_NAME must be set before calling OSSIM_SETUP_APPLICATION() macro")
+ endif()
+ add_dependencies(${TARGET_TARGETNAME} ${LIB_NAME})
+ target_link_libraries(${TARGET_TARGETNAME} ${LIB_NAME})
+
+ SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
+ SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME})
+ SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_OUTPUT_NAME "${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}")
+ SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELEASE_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELEASE_POSTFIX}")
+ SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES RELWITHDEBINFO_OUTPUT_NAME "${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}")
+ SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES MINSIZEREL_OUTPUT_NAME "${TARGET_NAME}${CMAKE_MINSIZEREL_POSTFIX}")
+
+ IF(MSVC_IDE AND OSSIM_MSVC_VERSIONED_DLL)
+ SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../")
+ ENDIF(MSVC_IDE AND OSSIM_MSVC_VERSIONED_DLL)
+
+
+ SETUP_LINK_LIBRARIES()
+
+ IF(APPLICATION_INSTALL)
+ IF(APPLE)
+ INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} BUNDLE DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${APPLICATION_COMPONENT_NAME})
+ ELSE(APPLE)
+ INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} ${INSTALL_COMPONENT_INFO} COMPONENT ${APPLICATION_COMPONENT_NAME})
+ ENDIF(APPLE)
+ ENDIF(APPLICATION_INSTALL)
+
+ SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_RUNTIME_DIR}")
+
+ENDMACRO(OSSIM_SETUP_APPLICATION)
+
+#####################################################################################################
+# MACRO: OSSIM_LINK_LIBRARY
+#
+# Example:
+# OSSIM_LINK_LIBRARY(ossim
+# COMPONENT_NAME ossim
+# SOURCE_FILES foo.cpp
+# HEADERS foo.h
+# TYPE SHARED
+# LIBRARIES <list of libraries to link against>
+# INSTALL_LIB
+# INSTALL_HEADERS)
+#
+# The INSTALL_LIB says to add a default install command for the library by default it will setup the following
+# install(TARGETS ossim
+# FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR}
+# RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR}
+# LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR}
+# ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR}
+# PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR}
+# COMPONENT ossim)
+#
+# The INSTALL_HEADERS will do a default header installation if the option is passed in
+# install(FILES <list of headers> DESTINATION "include/ossim" COMPONENT ossim)
+#####################################################################################################
+MACRO(OSSIM_LINK_LIBRARY)
+ # The SO_VERSION and VERSION are here for override purpose only so other libraries with their own
+ # versioning scheme can use the sum linking
+ #
+ OSSIM_PARSE_ARGUMENTS(LINK
+ "COMPONENT_NAME;SOURCE_FILES;HEADERS;TYPE;LIBRARIES;ADDITIONAL_COMPILE_FLAGS;SOVERSION;VERSION;PUBLIC_HEADERS"
+ "INSTALL_LIB;INSTALL_HEADERS;VERSION_SYMLINKS"
+ ${ARGN})
+ OSSIM_CAR(LINK_NAME "${LINK_DEFAULT_ARGS}")
+ OSSIM_CDR(LINK_SOURCES "${LINK_DEFAULT_ARGS}")
+ ADD_DEFINITIONS("${OSSIM_COMMON_COMPILER_FLAGS}")
+ ADD_LIBRARY(${LINK_NAME}
+ ${LINK_TYPE}
+ ${LINK_HEADERS}
+ ${LINK_SOURCE_FILES})
+ IF(NOT LINK_PUBLIC_HEADERS)
+ SET(LINK_PUBLIC_HEADERS ${LINK_HEADERS})
+ ENDIF()
+ IF(LINK_ADDITIONAL_COMPILE_FLAGS)
+ SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
+ COMPILE_FLAGS ${LINK_ADDITIONAL_COMPILE_FLAGS})
+ ENDIF(LINK_ADDITIONAL_COMPILE_FLAGS)
+ if(APPLE)
+ IF(BUILD_SHARED_LIBS)
+# SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+# SET(CMAKE_INSTALL_RPATH "${OSSIM_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
+ IF(BUILD_OSSIM_FRAMEWORKS)
+ SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
+ FRAMEWORK TRUE
+ BUILD_WITH_INSTALL_RPATH ON
+ INSTALL_NAME_DIR @rpath/Frameworks)
+ ELSE(BUILD_OSSIM_FRAMEWORKS)
+ #---
+ # Given install prefix=/usr/local and
+ # install lib dir = lib64 and
+ # link name = libossim.dylib
+ # You get "/usr/local/lib64/libossim.dylib" in the rpath.
+ #---
+ SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
+ FRAMEWORK FALSE
+ BUILD_WITH_INSTALL_RPATH ON
+ INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}")
+ ENDIF(BUILD_OSSIM_FRAMEWORKS)
+ ELSE(BUILD_SHARED_LIBRARY)
+ SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
+ FRAMEWORK FALSE)
+ ENDIF(BUILD_SHARED_LIBS)
+ ENDIF(APPLE)
+ IF(UNIX AND BUILD_SHARED_LIBS AND NOT APPLE)
+ IF(LINK_VERSION_SYMLINKS)
+ IF(NOT LINK_SOVERSION)
+ set(LINK_SOVERSION "${OSSIM_SOVERSION}")
+ ENDIF(NOT LINK_SOVERSION)
+ IF(NOT LINK_VERSION)
+ set(LINK_VERSION "${OSSIM_VERSION}")
+ ENDIF(NOT LINK_VERSION)
+ # ADD_CUSTOM_TARGET( lib DEPENDS ${LINK_NAME} )
+ # change lib_target properties
+ SET_TARGET_PROPERTIES( ${LINK_NAME} PROPERTIES
+ # create *nix style library versions + symbolic links
+ VERSION ${LINK_VERSION}
+ SOVERSION ${LINK_SOVERSION}
+ # allow creating static and shared libs without conflicts
+ CLEAN_DIRECT_OUTPUT 1
+ # avoid conflicts between library and binary target names
+ OUTPUT_NAME ${LINK_NAME} )
+ ENDIF(LINK_VERSION_SYMLINKS)
+ ENDIF(UNIX AND BUILD_SHARED_LIBS AND NOT APPLE)
+ SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_RUNTIME_DIR}")
+ IF(APPLE AND BUILD_OSSIM_FRAMEWORKS)
+ SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_FRAMEWORK_DIR}")
+ ELSE(APPLE AND BUILD_OSSIM_FRAMEWORKS)
+ SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_LIBRARY_DIR}")
+ ENDIF(APPLE AND BUILD_OSSIM_FRAMEWORKS)
+ SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUILD_LIBRARY_DIR}")
+
+ TARGET_LINK_LIBRARIES(${LINK_NAME} ${LINK_LIBRARIES} ${${LINK_NAME}_EXTRA_LIBS})
+
+ IF(LINK_INSTALL_LIB)
+ IF(LINK_INSTALL_HEADERS)
+ SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PUBLIC_HEADER "${LINK_PUBLIC_HEADERS}")
+ install(TARGETS ${LINK_NAME}
+ FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR} COMPONENT ${LINK_COMPONENT_NAME}
+ RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${LINK_COMPONENT_NAME}
+ LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} COMPONENT ${LINK_COMPONENT_NAME}
+ ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev
+ PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev)
+ ELSE(LINK_INSTALL_HEADERS)
+ install(TARGETS ${LINK_NAME}
+ FRAMEWORK DESTINATION ${INSTALL_FRAMEWORK_DIR} COMPONENT ${LINK_COMPONENT_NAME}
+ RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT ${LINK_COMPONENT_NAME}
+ LIBRARY DESTINATION ${INSTALL_LIBRARY_DIR} COMPONENT ${LINK_COMPONENT_NAME}
+ ARCHIVE DESTINATION ${INSTALL_ARCHIVE_DIR} COMPONENT ${LINK_COMPONENT_NAME}-dev)
+ ENDIF(LINK_INSTALL_HEADERS)
+ ENDIF(LINK_INSTALL_LIB)
+ENDMACRO(OSSIM_LINK_LIBRARY)
+
+MACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
+# get_target_property(TEST_UNINSTALL uninstall CREATED)
+# IF(NOT TEST_UNINSTALL)
+ #-----------------------------------------------------------------------------
+ ### uninstall target
+ #-----------------------------------------------------------------------------
+ SET(OSSIM_CMAKE_UNINSTALL_CONFIG "${PROJECT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in")
+ IF(EXISTS ${OSSIM_CMAKE_UNINSTALL_CONFIG})
+ CONFIGURE_FILE(
+ "${OSSIM_CMAKE_UNINSTALL_CONFIG}"
+ "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+ ADD_CUSTOM_TARGET(uninstall
+ "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
+ )
+ set_target_properties(uninstall PROPERTIES CREATED 1)
+ ENDIF(EXISTS ${OSSIM_CMAKE_UNINSTALL_CONFIG})
+# ENDIF(NOT TEST_UNINSTALL)
+ENDMACRO(OSSIM_ADD_COMMON_MAKE_UNINSTALL)
diff --git a/cmake/scripts/ossim-cmake-config.sh b/cmake/scripts/ossim-cmake-config.sh
index cca4248..fa2ec64 100755
--- a/cmake/scripts/ossim-cmake-config.sh
+++ b/cmake/scripts/ossim-cmake-config.sh
@@ -98,10 +98,11 @@ fi
# Additional stuff for ECLIPSE CDT4 users:
CMAKE_G_ARG="Unix Makefiles"
if [ "$BUILD_TYPE_ARG" == "ECLIPSE" ]; then
- echo "Generating eclipse project files."
+ CMAKE_ECLIPSE_VERSION=4.7.0
CMAKE_G_ARG="Eclipse CDT4 - Unix Makefiles"
cp -f $CMAKE_DIR/CMakeLists.txt $OSSIM_DEV_HOME
CMAKE_DIR=$OSSIM_DEV_HOME
+ echo "Generating eclipse project files for Eclipse $CMAKE_ECLIPSE_VERSION."
fi
echo "@@@@@ OSSIM_BUILD_DIR=$OSSIM_BUILD_DIR"
@@ -140,11 +141,8 @@ fi
if [ -z $BUILD_OSSIM_CURL_APPS ] ; then
export BUILD_OSSIM_CURL_APPS=OFF
fi
-if [ -z $BUILD_OSSIM_MSP ] ; then
- export BUILD_OSSIM_MSP=OFF
-fi
-if [ -z $BUILD_OSSIM_ATP ] ; then
- export BUILD_OSSIM_ATP=OFF
+if [ -z $BUILD_OSSIM_ISA ] ; then
+ export BUILD_OSSIM_ISA=OFF
fi
# Plugins:
@@ -175,9 +173,6 @@ fi
if [ -z $BUILD_MRSID_PLUGIN ]; then
BUILD_MRSID_PLUGIN=OFF
fi
-if [ -z $BUILD_MSP_PLUGIN ]; then
- BUILD_MSP_PLUGIN=OFF
-fi
if [ -z $BUILD_OPENCV_PLUGIN ]; then
BUILD_OPENCV_PLUGIN=OFF
fi
@@ -250,14 +245,14 @@ cmake -G "$CMAKE_G_ARG" \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DCMAKE_OSX_SYSROOT=$CMAKE_OSX_SYSROOT \
-DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET \
+-DCMAKE_ECLIPSE_VERSION=$CMAKE_ECLIPSE_VERSION \
-DBUILD_OSSIM_FRAMEWORKS=${BUILD_OSSIM_FRAMEWORKS} \
-DBUILD_OMS=$BUILD_OMS \
-DBUILD_OSSIM_PLANET_GUI=${BUILD_OSSIM_PLANET_GUI} \
-DBUILD_CNES_PLUGIN=$BUILD_CNES_PLUGIN \
-DBUILD_CSM_PLUGIN=$BUILD_CSM_PLUGIN \
-DBUILD_DSMG=$BUILD_DSMG \
--DBUILD_OSSIM_MSP=$BUILD_OSSIM_MSP \
--DBUILD_OSSIM_ATP=$BUILD_OSSIM_ATP \
+-DBUILD_OSSIM_ISA=$BUILD_OSSIM_ISA \
-DBUILD_FFTW3_PLUGIN=$BUILD_FFTW3_PLUGIN \
-DBUILD_GEOPDF_PLUGIN=$BUILD_GEOPDF_PLUGIN \
-DBUILD_GDAL_PLUGIN=$BUILD_GDAL_PLUGIN \
@@ -270,7 +265,8 @@ cmake -G "$CMAKE_G_ARG" \
-DBUILD_KML_PLUGIN=$BUILD_KML_PLUGIN \
-DBUILD_MRSID_PLUGIN=$BUILD_MRSID_PLUGIN \
-DMRSID_DIR=$MRSID_DIR \
--DBUILD_MSP_PLUGIN=$BUILD_MSP_PLUGIN \
+-DOPENCV_HOME=$OPENCV_HOME \
+-DMSP_HOME=$MSP_HOME \
-DOSSIM_PLUGIN_LINK_TYPE=SHARED \
-DBUILD_OPENCV_PLUGIN=$BUILD_OPENCV_PLUGIN \
-DBUILD_OPENJPEG_PLUGIN=$BUILD_OPENJPEG_PLUGIN \
diff --git a/doc/Doxyfile b/doc/Doxyfile
index d6482d0..be8558f 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME = "OSSIM - Open Source Software Image Map"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = "Version 1.8.17"
+PROJECT_NUMBER = "Version $(OSSIM_VERSION)"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
diff --git a/include/ossim/base/ossimBlockIStream.h b/include/ossim/base/ossimBlockIStream.h
new file mode 100644
index 0000000..b6be7b0
--- /dev/null
+++ b/include/ossim/base/ossimBlockIStream.h
@@ -0,0 +1,70 @@
+#ifndef ossimBlockReader_HEADER
+#define ossimBlockReader_HEADER 1
+#include <ossim/base/ossimBlockStreamBuffer.h>
+
+namespace ossim {
+ /**
+ *
+ * @brief Allows one to adapt any input stream to be block aligned
+ * for any read it will internally read overlapping blocks filling
+ * the request.
+ *
+ * Example:
+ * @code
+ *
+ * ossim_uint64 blockSize = 4096
+ * std::shared_ptr<ossim::BlockReader> reader = std::make_shared<ossim::BlockReader>(streamToAdapt, blockSize)
+ *
+ * reader->seekg(10);
+ * reader->read(buf, 100);
+ * @endcode
+ *
+ * This will read a block of data from 0-4095 and then fill the buffer
+ * with 100 bytes of data.
+ *
+ * if another call to: reader->read(buf, 10)
+ * it will not reload the block but instead read from memory
+ *
+ */
+ class BlockIStream : public ossim::istream
+ {
+ public:
+ /**
+ * Constructor must be initialized with an inputstream.
+ *
+ * @param adaptStream Currenlty a required parameter and is initialized on construction.
+ Takes an input istream to force block aligned
+ * requests
+ * @param blockSize Specify the block size to use
+ */
+ BlockIStream(std::shared_ptr<ossim::istream> adaptStream,
+ ossim_uint64 blockSize=4096):
+ ossim::istream(&m_blockStreamBuffer),
+ m_adaptStream(adaptStream),
+ m_blockStreamBuffer(adaptStream.get(), blockSize)
+ {
+ }
+
+ /**
+ * @brief Destructor will set any shared pointer to 0
+ */
+ virtual ~BlockIStream(){
+ m_adaptStream = 0;
+ }
+
+ /**
+ * Maintain a shared pointer to the stream we are adapting
+ * to be block aligned.
+ */
+ std::shared_ptr<ossim::istream> m_adaptStream;
+
+ /**
+ *
+ * The buffer where all the block align implementation resides
+ *
+ */
+ BlockStreamBuffer m_blockStreamBuffer;
+ };
+}
+
+#endif
diff --git a/include/ossim/base/ossimBlockStreamBuffer.h b/include/ossim/base/ossimBlockStreamBuffer.h
new file mode 100644
index 0000000..c9992ce
--- /dev/null
+++ b/include/ossim/base/ossimBlockStreamBuffer.h
@@ -0,0 +1,282 @@
+#ifndef ossimBlockStreamBuffer_HEADER
+#define ossimBlockStreamBuffer_HEADER 1
+#include <ossim/base/ossimIosFwd.h>
+#include <ossim/base/ossimConstants.h>
+#include <iostream>
+#include <vector>
+
+namespace ossim{
+ /**
+ * @brief This is a utility class used by the BlockStreamBuffer.
+ * This class will hold information regarding the block that
+ * is currently loaded. It holds the start byte and the valid
+ * size and the block size of the buffer. The valid size
+ * is used because if we are at the end of a stream we could
+ * have a partial block.
+ *
+ */
+ class OSSIM_DLL BlockBufInfo{
+ public:
+ BlockBufInfo():
+ m_startByte(0),
+ m_blockSize(0),
+ m_blockBufferPtr(0),
+ m_validSize(0),
+ m_blockLoaded(false){
+
+ }
+
+ /**
+ * Returns the index of a block
+ *
+ * @param pos Is the aboslute byte position
+ * @return The block index for the abosolute
+ * position
+ */
+ ossim_int64 getBlockIndex(ossim_int64 pos){
+ ossim_int64 result = -1;
+ if(m_blockSize&&m_blockBufferPtr&&(pos>=0))
+ {
+ result = pos/m_blockSize;
+ }
+
+ return result;
+ }
+
+ /**
+ * This just tests if the given abolute position
+ * is within a block window. We will usually call
+ * @see isWithinValidWindow.
+ * @param pos Absolute position
+ * @return true if we are inside the defined window
+ * and false otherwise.
+ */
+ bool isWithinWindow(ossim_int64 pos)const{
+ return (m_blockLoaded&&
+ (pos>=m_startByte)&&
+ (pos<(m_startByte+m_blockSize)));
+ }
+
+ /**
+ * This just tests if the given abolute position
+ * is within a valid window. A valid window represents
+ * partial blocks.
+ * @param pos Absolute position
+ * @return true if we are inside the defined window
+ * and false otherwise.
+ */
+ bool isWithinValidWindow(ossim_int64 pos)const{
+ return (m_blockLoaded&&
+ (pos>=m_startByte)&&
+ (pos<getEndByte()));
+ }
+
+ /**
+ * Convenient method to get the absolute byte position
+ * of the end byte.
+ *
+ * @return the absolute byte position of the end byte
+ */
+ ossim_int64 getEndByte()const{
+ if(m_validSize>=0) return m_startByte+(m_validSize);
+ return m_startByte;
+ }
+
+ /**
+ * Get the starting address in the buffer of the absolute position.
+ * @param absolutePosition The absolute byte position
+ * @return The starting address at the aboslute position or 0 if
+ * the absolute position is outside the windows
+ */
+ const char* getBufferStart(ossim_int64 absolutePosition)const{
+ if(isWithinValidWindow(absolutePosition))
+ {
+ return m_blockBufferPtr+(absolutePosition-m_startByte);
+ }
+
+ return 0;
+ }
+
+ /**
+ * @return The starting address of the block buffer
+ */
+ const char* getBuffer()const{
+ return m_blockBufferPtr;
+ }
+
+ /**
+ * @return The starting address of the block buffer
+ */
+ char* getBuffer(){
+ return m_blockBufferPtr;
+ }
+
+ /**
+ * @return true if the the block is valid and loaded or false
+ * otherwise.
+ */
+ bool isLoaded()const{return m_blockLoaded;}
+
+ /**
+ * Will set the buffer and then reset the loaded flag to be false.
+ *
+ * @param bufPtr is the starting address of the block buffer
+ * @param blockSize is the size of the buffer
+ *
+ */
+ void setBuffer(char* bufPtr, ossim_uint32 blockSize)
+ {
+ m_blockBufferPtr = bufPtr;
+ m_blockSize = blockSize;
+ m_blockLoaded = false;
+ }
+
+ /**
+ * Is the starting absolute byte offset for the buffer
+ */
+ ossim_int64 m_startByte;
+
+ /**
+ * Is the size of the buffer
+ */
+ ossim_int64 m_blockSize;
+
+ /**
+ * is the valid size of the buffer. In most cases this is equal to the
+ * blockSize but if at the end of a stream you could have a partial
+ * buffer.
+ */
+ ossim_int64 m_validSize;
+
+ /**
+ * Starting address of the block. This is not managed by this class and
+ * will not be deleted.
+ */
+ char* m_blockBufferPtr;
+
+ /**
+ * Variable used to invalidate a block or specify whether the block is loaded
+ */
+ bool m_blockLoaded;
+ };
+
+ /**
+ * This is the BlockStreamBuffer class and derives from
+ * stream buf. This class
+ *
+ */
+ class OSSIM_DLL BlockStreamBuffer : public std::streambuf{
+ public:
+ BlockStreamBuffer(ossim::istream* adaptStream=0, ossim_uint64 blockSize=0);
+ virtual ~BlockStreamBuffer(){
+ m_adaptStream=0;
+ }
+ protected:
+ /**
+ * The block buffer that we set the buf pointers to
+ */
+ std::vector<char> m_blockBuffer;
+
+ /**
+ * holds the current absolute byte position
+ */
+ ossim_int64 m_currentPosValue;
+
+ /**
+ * Holds the information about the block. It tells us
+ * if the block is currently loaded and what the valid size
+ * is
+ */
+ BlockBufInfo m_blockInfo;
+
+ /**
+ * The stream we are adapting
+ */
+ ossim::istream* m_adaptStream;
+
+ /**
+ * This is a virtual method that can be overriden.
+ * pubsetbuf can be called and calls this protected method
+ * to set a buffer.
+ *
+ * @param s The starting address of a byte buffer
+ * @param n The size of the buffer
+ */
+ virtual std::streambuf* setbuf (char* s, std::streamsize n);
+
+ /**
+ *
+ * setgPtrs calls setg and sets the eback egptr and gptr. to the
+ * managed buffer's valid window
+ *
+ */
+ void setgPtrs();
+
+ /**
+ * loadBlock will load data into the current block and call the setgPtrs
+ * to adjust the internal pointers tha the base streambuf may use
+ *
+ */
+ void loadBlock();
+
+ /**
+ * this is a protected method overriden from streambuf base.
+ *
+ * we will convert the offset byte to an absolute if we can and
+ * then call the seek pos for the absolute seek
+ */
+ virtual pos_type seekoff(off_type offset, std::ios_base::seekdir dir,
+ std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out);
+
+ /**
+ * seekpos is overriden from the base streambuf class. This is the
+ * seek of the aboslute position. We will check to see if the new
+ * position resides in the block and if so we just update our pointers
+ * and return the pos. If bnot then we use the adapted stream call
+ * to seek to the position and update our internal pointers.
+ *
+ * @param pos The absolute position to seek to
+ * @mode the mode used. Should be in
+ * @return The absolute position if successful or EOF if not.
+ */
+ virtual pos_type seekpos(pos_type pos,
+ std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out);
+
+ /**
+ * xsgetn is a protected virtual method that we override from the base
+ * streambuf. The method will load blocks of data to service the requested
+ * buffer to fill. If the request covers several block it will iterate
+ * and load each block of data until the request is satisfied.
+ *
+ * @param s The destination buffer large enough to hold the characters
+ * being requested
+ * @param n The number of characters to request from the input stream
+ *
+ * @return The number of bytes read or -1 if failed
+ */
+ virtual std::streamsize xsgetn(char_type* s, std::streamsize n);
+
+ /**
+ * underflow is overriden from the base streambuf. It check to see
+ * if the current block is loaded and if not load the block. The method
+ * returns what is currently pointed to by the absolute offset or basically
+ * return *gptr().
+ *
+ * @return the current byte we are pointing to.
+ */
+ virtual int underflow();
+
+ /**
+ * syncCurrentPosition is a utility method that we call internally in
+ * the overriden protected methods that will sync the location of the gptr
+ * to the absolute byte offset variable we are using internally. The problem
+ * is, when things like ignore(...) peek(...) and other options are used
+ * on an input stream the base might adjust the gptr location. When this
+ * is adjusted outside our control the offsets might get out of sync
+ * this is called to ensure this does not happen
+ *
+ */
+ void syncCurrentPosition();
+ };
+}
+#endif
diff --git a/include/ossim/base/ossimDpt.h b/include/ossim/base/ossimDpt.h
index 51db80e..1835cd7 100644
--- a/include/ossim/base/ossimDpt.h
+++ b/include/ossim/base/ossimDpt.h
@@ -101,7 +101,11 @@ public:
{ return ossimDpt(d*x, d*y); }
ossimDpt operator/(const double& d) const
{ return ossimDpt(x/d, y/d); }
- ossim_float64 operator*(const ossimDpt& pt)const
+ const ossimDpt& operator*=(const double& d)
+ { x*=d; y*=d; return *this; }
+
+ /** Dot product */
+ ossim_float64 operator*(const ossimDpt& pt)const
{ return (x*pt.x+y*pt.y); }
std::ostream& print(std::ostream& os, ossim_uint32 precision=15) const;
diff --git a/include/ossim/base/ossimGDoptimizer.h b/include/ossim/base/ossimGDoptimizer.h
new file mode 100644
index 0000000..61ffe1f
--- /dev/null
+++ b/include/ossim/base/ossimGDoptimizer.h
@@ -0,0 +1,74 @@
+/**
+ * @author Dylan Thomas Cannisi
+ * @date 07/24/2017
+ *
+ * @brief Simple Gradient Descent optimizer for ossim.
+ *
+ * See top level LICENSE.txt file.
+ */
+#ifndef OSSIM_GDOPTIMIZER_H
+#define OSSIM_GDOPTIMIZER_H
+
+#include <ossim/base/ossimConstants.h>
+#include <ossim/base/ossimTerm.h>
+
+#include <vector>
+
+
+
+class OSSIMDLLEXPORT ossimGDoptimizer{
+public:
+ /**
+ * @brief Public Copy constructor
+ */
+ ossimGDoptimizer();
+ /**
+ * @brief Public Copy constructor
+ *
+ * @param[in] src The object to be copied (copies pointer not a copy of function)
+ */
+ ossimGDoptimizer(const ossimGDoptimizer& src);
+ /**
+ * @brief Destroys the object !DOES NOT DELETE FUNCTION!
+ */
+ ~ossimGDoptimizer();
+
+
+ /**
+ * @brief Public Constructor with a preset function
+ *
+ * @param function The function to be optimized
+ */
+ ossimGDoptimizer(ossimTerm* function);
+
+
+ /**
+ * @brief Sets the function to be optimized
+ *
+ * @param function The function to be optimized
+ *
+ * @return whether or not the optimizer already contained a function
+ */
+ bool setFunction(ossimTerm* function);
+
+ /**
+ * @brief Optimizes the function
+ *
+ * @param[in] startPoint The start point at which the algorithm starts its descent
+ * @param[in] gamma Determins the step size as a function of the gradient
+ * @param[in] precision The stopping point at which the algorithm will no longer descend
+ * @param[in] maxEpoch The stopping point to limit infinite loops.
+ *
+ * @return the optimial minima
+ */
+ std::vector<ossim_float64> optimize(std::vector<ossim_float64> startPoint, ossim_float64 gamma = 0.001, ossim_float64 precision = 0.0001, ossim_uint32 maxEpoch = 10000) const;
+
+private:
+ // Stores the multivariant function to be optimized.
+ ossimTerm* m_func;
+
+};
+
+
+
+#endif // OSSIM_GDOPTIMIZER_H
\ No newline at end of file
diff --git a/include/ossim/base/ossimIoStream.h b/include/ossim/base/ossimIoStream.h
index 4e7043d..f123a5e 100644
--- a/include/ossim/base/ossimIoStream.h
+++ b/include/ossim/base/ossimIoStream.h
@@ -40,6 +40,8 @@
#include <fstream>
#include <sstream>
+// needed by std::shared_ptr
+#include <memory>
//---
// Depreciated:
//---
@@ -176,6 +178,43 @@ public:
};
+/**
+* Alows one to create a buffered input stream
+*/
+class OSSIM_DLL ossimBufferedInputStream : public ossim::istream
+{
+public:
+ /**
+ * will use the read buffer of the passed in input stream and
+ * will set the buffer based on the buffer size passed in
+ */
+ ossimBufferedInputStream(std::shared_ptr<ossim::istream> in, ossim_uint32 bufferSize=1024 )
+ :ossim::istream(in->rdbuf()),
+ m_inputStream(in)
+ {
+ if(bufferSize > 0)
+ {
+ m_buffer.resize(bufferSize);
+ rdbuf()->pubsetbuf(&m_buffer.front(), m_buffer.size());
+ }
+ }
+ virtual ~ossimBufferedInputStream()
+ {
+ m_inputStream = 0;
+ }
+protected:
+ /**
+ * We have a buffer that we allocate so it does not
+ * loose scope through the life of this stream
+ */
+ std::vector<char> m_buffer;
+
+ /**
+ * We will save the input stream we set the buffer to.
+ */
+ std::shared_ptr<ossim::istream> m_inputStream;
+};
+
#ifdef _MSC_VER
diff --git a/include/ossim/base/ossimKeywordlist.h b/include/ossim/base/ossimKeywordlist.h
index 16f2412..464b7b7 100644
--- a/include/ossim/base/ossimKeywordlist.h
+++ b/include/ossim/base/ossimKeywordlist.h
@@ -419,6 +419,26 @@ public:
virtual bool parseStream(ossim::istream& is);
virtual bool parseString(const std::string& inString);
+ /**
+ * This return the sorted keys if you have a list.
+ * Example:
+ * @code
+ * // given a keywordlist called kwl with contents:
+ * // my.list.element1.prop
+ * // my.list.element345.prop
+ * // my.list.element22.prop
+ * std::vector<ossimString> sortedPrefixValues;
+ * kwl.getSortedList(sortedPrefixValues, "my.list.element");
+ * if(sortedPrefixValues.size())
+ * {
+ * // contents should be my.list.element1, my.list.element22, my.list.element345
+ *
+ * }
+ * @endcode
+ *
+ */
+ void getSortedList(std::vector<ossimString>& prefixValues,
+ const ossimString &prefixKey)const;
/*!
* Will return a list of keys that contain the string passed in.
* Later we will need to allow a user to specify regular expresion
diff --git a/include/ossim/base/ossimLookUpTable.h b/include/ossim/base/ossimLookUpTable.h
index 1b3d904..ff36fa0 100644
--- a/include/ossim/base/ossimLookUpTable.h
+++ b/include/ossim/base/ossimLookUpTable.h
@@ -22,6 +22,8 @@
#include <ossim/base/ossimString.h>
#include <ossim/base/ossimKeyword.h>
+#include <initializer_list>
+
class ossimKeywordlist;
//*******************************************************************
@@ -35,7 +37,13 @@ public:
{
NOT_FOUND = -1
};
-
+
+ /**
+ * By default if you just give an initializer list with strings
+ * then it will assume keys 0..n-1 for each string.
+ */
+ ossimLookUpTable(const std::initializer_list<ossimString>& stringInitializer);
+
virtual ~ossimLookUpTable();
/*!
@@ -91,7 +99,7 @@ public:
/*!
* Returns keyword for lookups from a Keywordlist.
*/
- virtual ossimKeyword getKeyword() const=0;
+ virtual ossimKeyword getKeyword() const;
virtual ossim_uint32 getTableSize() const;
@@ -100,13 +108,18 @@ protected:
ossimLookUpTable(ossim_int32 table_size);
- class ossimKeyValueMap
- {
- public:
- void init (ossim_int32 key, const ossimString& value) { theKey=key; theValue=value; }
- ossim_int32 theKey;
- ossimString theValue;
- };
+ class ossimKeyValueMap
+ {
+ public:
+ ossimKeyValueMap(ossim_int32 key=0, const ossimString& value=""):
+ theKey(key),
+ theValue(value)
+ {}
+ void init (ossim_int32 key, const ossimString& value) { theKey=key; theValue=value; }
+
+ ossim_int32 theKey;
+ ossimString theValue;
+ };
std::vector<ossimKeyValueMap> theTable;
diff --git a/include/ossim/base/ossimPolygon.h b/include/ossim/base/ossimPolygon.h
index c3feb59..7ac6246 100644
--- a/include/ossim/base/ossimPolygon.h
+++ b/include/ossim/base/ossimPolygon.h
@@ -183,6 +183,11 @@ public:
void resize(ossim_uint32 newSize);
/**
+ * METHOD: remove()
+ * Removes the vertex from the polygon. */
+ void removeVertex(int vertex);
+
+ /**
* METHOD: print()
*/
void print(ostream& os) const;
@@ -214,12 +219,6 @@ protected:
bool shrink(ossimPolygon &dest, double inset) const;
/**
- * METHOD: remove()
- * Removes the vertex from the polygon.
-
- */
- void removeVertex(int vertex);
- /**
* METHOD: removeSmallestContributingVertex()
* Removes the vertex that contributes the smallest area to the polygon.
*/
diff --git a/include/ossim/base/ossimRefPtr.h b/include/ossim/base/ossimRefPtr.h
index 38b2c9d..e7765d4 100644
--- a/include/ossim/base/ossimRefPtr.h
+++ b/include/ossim/base/ossimRefPtr.h
@@ -74,6 +74,12 @@ template<class T> class ossimRefPtr
inline bool valid() const { return m_ptr!=0L; }
+ /**
+ * Used in boolean expression. Example: "if (obj)" is same as "if (obj.valid())". This is
+ * the same syntax as c++11 shared_ptr.
+ */
+ inline operator bool() const { return m_ptr!=0L; }
+
inline T* get() { return m_ptr; }
inline const T* get() const { return m_ptr; }
diff --git a/include/ossim/base/ossimStreamFactory.h b/include/ossim/base/ossimStreamFactory.h
index e59943c..4ae5dfb 100644
--- a/include/ossim/base/ossimStreamFactory.h
+++ b/include/ossim/base/ossimStreamFactory.h
@@ -65,27 +65,4 @@ namespace ossim
static StreamFactory* m_instance;
};
}
-
-// Deprecated code...
-class OSSIM_DLL ossimStreamFactory : public ossimStreamFactoryBase
-{
-public:
- static ossimStreamFactory* instance();
- virtual ~ossimStreamFactory();
-
- virtual std::shared_ptr<ossim::ifstream>
- createIFStream(const ossimFilename& file,
- std::ios_base::openmode mode) const;
-
- virtual ossimRefPtr<ossimIFStream>
- createNewIFStream(const ossimFilename& file,
- std::ios_base::openmode mode) const;
-
-protected:
- ossimStreamFactory();
- ossimStreamFactory(const ossimStreamFactory&);
- static ossimStreamFactory* theInstance;
-
-};
-
#endif
diff --git a/include/ossim/base/ossimStreamFactoryBase.h b/include/ossim/base/ossimStreamFactoryBase.h
index 9fd39ec..464325c 100644
--- a/include/ossim/base/ossimStreamFactoryBase.h
+++ b/include/ossim/base/ossimStreamFactoryBase.h
@@ -61,18 +61,4 @@ namespace ossim
};
}
-class OSSIM_DLL ossimStreamFactoryBase
-{
-public:
- virtual ~ossimStreamFactoryBase(){}
-
- virtual std::shared_ptr<ossim::ifstream>
- createIFStream(const ossimFilename& file,
- std::ios_base::openmode openMode) const=0;
-
- virtual ossimRefPtr<ossimIFStream> createNewIFStream(
- const ossimFilename& file,
- std::ios_base::openmode openMode)const=0;
-};
-
#endif
diff --git a/include/ossim/base/ossimStreamFactoryRegistry.h b/include/ossim/base/ossimStreamFactoryRegistry.h
index 3cf36a8..bd61026 100644
--- a/include/ossim/base/ossimStreamFactoryRegistry.h
+++ b/include/ossim/base/ossimStreamFactoryRegistry.h
@@ -16,33 +16,139 @@
#include <ossim/base/ossimRefPtr.h>
#include <ossim/base/ossimIoStream.h>
#include <ossim/base/ossimStreamFactoryBase.h>
+#include <ossim/base/ossimRegExp.h>
#include <memory>
#include <vector>
namespace ossim
{
+ /**
+ * This is a generic stream registry. We could try to create streams for
+ * http, https, s3 protocols as well as local file. We have also exposed an
+ * exists for supporting exists() calls for different stream types.
+ *
+ * We have added support for Buffered reads. You can enable buffered
+ * reads to be block boundary. If it's not block then it will use
+ * a pubsetbuf for a buffered I/O
+ * It will read the @see ossimPreferences for the prefix key
+ * ossim.stream.factory.registry.istream.buffer[0-9]+
+ * Example key list:
+ * @code
+ * ossim.stream.factory.registry.istream.buffer1.enabled: false
+ * ossim.stream.factory.registry.istream.buffer1.includePattern: ^/
+ * ossim.stream.factory.registry.istream.buffer1.enableBlocked: true
+ * ossim.stream.factory.registry.istream.buffer1.size: 65536
+ * @endcode
+ *
+ * The includePattern keyword is a regular expression.
+ * Examples:
+ * - ^/ Anything that starts with /
+ * - ^s3:// Anything starting with s3://
+ *
+ * Local file example:
+ * @code
+ * ossimString connectionString = "/data/foo.ntf"
+ * std::shared_ptr<ossim::istream> in = ossim::StreamFactoryRegistry::instance()->createIstream(connectionString);
+ * if(in)
+ * {
+ * std::vector<char> buf(1024)
+ * in->seekg(0);
+ * in->read(&buf.front(), buf.size());
+ * }
+ * @endcode
+ * S3 file example:
+ * @code
+ * ossimString connectionString = "s3://foo-bucket/path/foo.ntf"
+ * std::shared_ptr<ossim::istream> in = ossim::StreamFactoryRegistry::instance()->createIstream(connectionString);
+ * if(in)
+ * {
+ * std::vector<char> buf(1024)
+ * in->seekg(0);
+ * in->read(&buf.front(), buf.size());
+ * }
+ * @endcode
+ * https or https file example:
+ * @code
+ * ossimString connectionString = "https://foo-host/path/foo.ntf"
+ * std::shared_ptr<ossim::istream> in = ossim::StreamFactoryRegistry::instance()->createIstream(connectionString);
+ * if(in)
+ * {
+ * std::vector<char> buf(1024)
+ * in->seekg(0);
+ * in->read(&buf.front(), buf.size());
+ * }
+ * @endcode
+ */
class OSSIM_DLL StreamFactoryRegistry : public StreamFactoryBase
{
public:
static StreamFactoryRegistry* instance();
virtual ~StreamFactoryRegistry();
+ /**
+ * Registers a stream factory. This allows for a pluggable stream
+ * Please see ossim-plugins and look at curl, aws for example
+ * stream definitions.
+ *
+ * @param factory To be added to the registry
+ */
void registerFactory(StreamFactoryBase* factory);
+
+ /**
+ * Removes a factory from the registry.
+ * @param factory To be removed from the registry
+ */
void unregisterFactory(StreamFactoryBase* factory);
+ /**
+ * Will try to creates an istream interface to the connectionString
+ * passed in
+ *
+ * @param connectionString Is the connection string used to create
+ * a stream. Possible examples: s3://<bucket>/path or
+ * /data/foo.tif or https://<host>/<path>
+ * @param options If a stream is found then this holds specific options
+ * for the stream. Defaults to empty options
+ * @param mode Is the mode to be used. Defaults to a binary input stream.
+ * @return A shared pointer to an istream if successful.
+ */
virtual std::shared_ptr<ossim::istream>
createIstream(const std::string& connectionString,
const ossimKeywordlist& options=ossimKeywordlist(),
std::ios_base::openmode mode=
std::ios_base::in|std::ios_base::binary) const;
+ /**
+ * Will try to creates an ostream interface to the connectionString
+ * passed in
+ *
+ * @param connectionString Is the connection string used to create the
+ * stream
+ * @param options If a stream is found then this holds specific options
+ * for the stream. Defaults to empty options
+ * @param mode Is the mode to be used. Defaults to a binary output
+ * stream.
+ * @return A shared pointer to an ostream if successful.
+ */
virtual std::shared_ptr<ossim::ostream>
createOstream(const std::string& connectionString,
const ossimKeywordlist& options=ossimKeywordlist(),
std::ios_base::openmode mode=
std::ios_base::out|std::ios_base::binary) const;
+ /**
+ * Will try to creates an iostream interface to the connectionString
+ * passed in
+ *
+ * @param connectionString Is the connection string used to create the
+ * stream
+ * @param options If a stream is found then this holds specific options
+ * for the stream. Defaults to empty options
+ * @param mode Is the mode to be used. Defaults to a binary output
+ * stream.
+ * @return A shared pointer to an ostream if successful.
+ */
virtual std::shared_ptr<ossim::iostream>
createIOstream(const std::string& connectionString,
const ossimKeywordlist& options=ossimKeywordlist(),
@@ -69,41 +175,47 @@ namespace ossim
StreamFactoryRegistry();
private:
-
+
+ /**
+ * This is an internal class used to store the buffer information
+ * loaded from the preferences.
+ * @see StreamFactoryRegistry
+ */
+ class BufferInfo{
+ public:
+ BufferInfo():m_enabled(false),
+ m_enableBlocked(false),
+ m_pattern(""),
+ m_size(4096){}
+ bool m_enabled;
+ bool m_enableBlocked;
+ ossimString m_pattern;
+ ossim_uint64 m_size;
+
+ };
/** @brief copy constructor hidden from use */
StreamFactoryRegistry(const StreamFactoryRegistry&);
+
+ /**
+ * This will load the buffer information from the
+ * preferences.
+ */
+ void loadPreferences();
+
+ /**
+ * @param bufferInfo Holds the result of the first buffer info
+ * matching the connection string
+ * @param connecitonString The connection string
+ */
+ bool getBufferInfo(BufferInfo& bufferInfo,
+ const ossimString& connectionString)const;
std::vector<StreamFactoryBase*> m_factoryList;
-
+ std::vector<BufferInfo> m_bufferInfoList;
static StreamFactoryRegistry* m_instance;
+ mutable ossimRegExp m_patternMatcher;
};
} // End: namespace ossim
-// Deprecated code...
-class OSSIM_DLL ossimStreamFactoryRegistry : public ossimStreamFactoryBase
-{
-public:
- static ossimStreamFactoryRegistry* instance();
- virtual ~ossimStreamFactoryRegistry();
-
- void registerFactory(ossimStreamFactoryBase* factory);
-
- virtual std::shared_ptr<ossim::ifstream>
- createIFStream(const ossimFilename& file,
- std::ios_base::openmode openMode) const;
-
- virtual ossimRefPtr<ossimIFStream> createNewIFStream(
- const ossimFilename& file, std::ios_base::openmode openMode) const;
-
-protected:
- ossimStreamFactoryRegistry();
-private:
- /** @brief copy constructor hidden from use */
- ossimStreamFactoryRegistry(const ossimStreamFactoryRegistry&);
-
- std::vector<ossimStreamFactoryBase*> theFactoryList;
- static ossimStreamFactoryRegistry* theInstance;
-};
-
#endif
diff --git a/include/ossim/base/ossimString.h b/include/ossim/base/ossimString.h
index b7cfe95..e29fbbc 100644
--- a/include/ossim/base/ossimString.h
+++ b/include/ossim/base/ossimString.h
@@ -579,6 +579,28 @@ public:
static ossim_uint64 toUInt64(const ossimString& aString);
/**
+ * This takes a string and will test for
+ * numeric followed by a unit type:
+ *
+ * 123K is 123 kilobytes
+ * 123k is 123 kilobytes
+ * 64G is 123 gigabytes
+ * 64g is 64 gigabytes
+ *
+ * you can use any of the following modifiers
+ * k|K = kilobytes
+ * b|B = bytes
+ * m|M = megabytes
+ * g|G = gigabytes
+ * t|T = terrabyte
+ *
+ * If no unit is present then it will assume bytes and just return
+ * the value
+ */
+ ossim_int64 memoryUnitToInt64()const;
+ static ossim_int64 memoryUnitToInt64(const ossimString& aString);
+
+ /**
* toLong's deprecated, please use the toInts...
*/
long toLong()const;
diff --git a/include/ossim/base/ossimTerm.h b/include/ossim/base/ossimTerm.h
new file mode 100644
index 0000000..2c3bf04
--- /dev/null
+++ b/include/ossim/base/ossimTerm.h
@@ -0,0 +1,431 @@
+/**
+ * @author Dylan Thomas Cannisi
+ * @date 07/24/2017
+ *
+ * @brief Mathematical term data structure for ossim.
+ *
+ * See top level LICENSE.txt file.
+ */
+#ifndef OSSIM_FUNCTION_H
+#define OSSIM_FUNCTION_H
+
+#include <ossim/base/ossimConstants.h>
+
+#include <vector>
+#include <cmath>
+
+
+
+/**
+ * @brief Different types for terms in a function
+ */
+enum termType : ossim_uint32 {
+ monomial,
+ polynomial,
+ variable,
+ constant,
+ product
+};
+
+
+
+/**
+ * An abstract class to containing a multivariable function.
+ */
+class OSSIMDLLEXPORT ossimTerm{
+public:
+
+
+ /**
+ * @brief Virtual destructor for destroying tree from the top node.
+ */
+ virtual ~ossimTerm() {}
+
+
+ /**
+ * @brief Evaluates a term at a given point PURE VIRTUAL
+ *
+ * @param[in] point The point to be evaluated
+ *
+ * @return the value at a point
+ */
+ virtual ossim_float64 evaluate(std::vector<ossim_float64> point) const = 0;
+ /**
+ * @brief Calculates the derivative of the term
+ *
+ * @param[in] variable The variable in which the derivative is with respect too
+ *
+ * @return A pointer containing the derivative of the term.
+ */
+ virtual ossimTerm* derivative(const ossim_uint32& variable) const = 0;
+
+
+ /**
+ * @brief Gets the type
+ *
+ * @return The type
+ */
+ virtual ossim_uint32 getType() const = 0;
+ /**
+ * @brief Returns a pointer to a copy of the term
+ *
+ * @return A pointer to a copy of the term
+ */
+ virtual ossimTerm* copy() const = 0;
+
+
+ /**
+ * @brief Evaluates the function for a point
+ *
+ * @param point The point at which the function is being evaluated
+ *
+ * @return The value at a point
+ */
+ inline ossim_float64 operator()(std::vector<ossim_float64> point) const{ return this->evaluate(point); }
+
+
+ /**
+ * @brief Returns a copy of the two terms in a polynomial
+ *
+ * @param rhs The right hand term of the polynomial
+ *
+ * @return A polynomial with !COPIES! of the two terms
+ */
+ inline ossimTerm* operator+(ossimTerm* rhs) const;
+ /**
+ * @brief Returns a copy of the two terms in a product
+ *
+ * @param rhs The right hand term of the product
+ *
+ * @return A product with !COPIES! of the two terms
+ */
+ inline ossimTerm* operator*(ossimTerm* rhs) const;
+
+};
+
+
+
+/**
+ * A monomial class to hold a monomial as a term. Example (c_0 * x_0 ^ e_0)
+ */
+class OSSIMDLLEXPORT ossimMonom : public ossimTerm{
+public:
+
+
+ /**
+ * @brief Public Constructor
+ *
+ * @param[in] coeffient The coeffient of the term
+ * @param variable The variable the variable number of the term
+ * @param[in] exponential The exponential of the term
+ */
+ ossimMonom(const ossim_float64& coeffient, ossimTerm* variable, const ossim_float64& exponential) : coef(coeffient), var(variable), exp(exponential) {}
+ /**
+ * @brief Public Copy Constructor
+ *
+ * @param[in] src The source to be copied
+ */
+ ossimMonom(const ossimMonom& src) : coef(src.coef), var(src.var->copy()), exp(src.exp) {}
+ /**
+ * @brief Destroys the monomial
+ */
+ ~ossimMonom() { delete var; }
+
+
+ /**
+ * @brief Evaluates a monomial for a point
+ *
+ * @param[in] point The point to be evaluated
+ *
+ * @return The value at a point.
+ */
+ ossim_float64 evaluate(std::vector<ossim_float64> point) const { return (coef * pow(var->evaluate(point), exp)); }
+ /**
+ * @brief Calculates the derivative for a monomial
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ ossimTerm* derivative(const ossim_uint32& variable) const;
+
+
+ /**
+ * @brief Gets the type of a monomial
+ *
+ * @return The type of a monomial
+ */
+ ossim_uint32 getType() const { return termType::monomial; }
+ /**
+ * @brief Creates a copy of the monomial
+ *
+ * @return A pointer to a copy of the monomial
+ */
+ ossimTerm* copy() const;
+
+private:
+ ossim_float64 coef; // The coefficent of the monomial
+ ossimTerm* var; // The variable number of the monomial (starts at 0 - n)
+ ossim_float64 exp; // The exponenent of the monomial
+
+};
+
+
+
+/**
+ * A polynomial class to hold a polynomial as a term.
+ */
+class OSSIMDLLEXPORT ossimPolynomial : public ossimTerm{
+public:
+
+
+ /**
+ * @brief Public Constructor
+ *
+ * @param leftTerm The left term
+ * @param rightTerm The right term
+ */
+ ossimPolynomial(ossimTerm* leftTerm, ossimTerm* rightTerm) : lTerm(leftTerm), rTerm(rightTerm) {}
+ /**
+ * @brief Public Copy Constructor
+ *
+ * @param[in] src The source to be copied
+ */
+ ossimPolynomial(const ossimPolynomial& src) : lTerm(src.lTerm->copy()), rTerm(src.rTerm->copy()) {}
+ /**
+ * @brief Destroys the polynomial
+ */
+ ~ossimPolynomial() { delete lTerm; delete rTerm; }
+
+
+ /**
+ * @brief Evaluates a polynomial for a point
+ *
+ * @param[in] point The point to be evaluated
+ *
+ * @return The value at a point.
+ */
+ ossim_float64 evaluate(std::vector<ossim_float64> point) const { return lTerm->evaluate(point) + rTerm->evaluate(point); }
+ /**
+ * @brief Calculates the derivative for a polynomial
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ ossimTerm* derivative(const ossim_uint32& variable) const;
+
+
+ /**
+ * @brief Gets the type of a polynomial
+ *
+ * @return The type of a polynomial
+ */
+ ossim_uint32 getType() const { return termType::polynomial; }
+ /**
+ * @brief Creates a copy of the polynomial
+ *
+ * @return A pointer to a copy of the polynomial
+ */
+ ossimTerm* copy() const;
+
+private:
+ ossimTerm* lTerm; // The left term of the polynomial
+ ossimTerm* rTerm; // The right term of the polynomial
+
+};
+
+
+
+/**
+ * A polynomial class to hold a product as a term.
+ */
+class OSSIMDLLEXPORT ossimProd : public ossimTerm{
+public:
+
+
+ /**
+ * @brief Public Constructor
+ *
+ * @param leftTerm The left term
+ * @param rightTerm The right term
+ */
+ ossimProd(ossimTerm* leftTerm, ossimTerm* rightTerm) : lTerm(leftTerm), rTerm(rightTerm) {}
+ /**
+ * @brief Public Copy Constructor
+ *
+ * @param[in] src The source to be copied
+ */
+ ossimProd(const ossimProd& src) : lTerm(src.lTerm->copy()), rTerm(src.rTerm->copy()) {}
+ /**
+ * @brief Destroys the product
+ */
+ ~ossimProd() { delete lTerm; delete rTerm; }
+
+
+ /**
+ * @brief Evaluates a product for a point
+ *
+ * @param[in] point The point to be evaluated
+ *
+ * @return The value at a point.
+ */
+ ossim_float64 evaluate(std::vector<ossim_float64> point) const { return lTerm->evaluate(point) * rTerm->evaluate(point); }
+ /**
+ * @brief Calculates the derivative for a product
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ ossimTerm* derivative(const ossim_uint32& variable) const;
+
+
+ /**
+ * @brief Gets the type of a product
+ *
+ * @return The type of a product
+ */
+ ossim_uint32 getType() const { return termType::product; }
+ /**
+ * @brief Creates a copy of the product
+ *
+ * @return A pointer to a copy of the product
+ */
+ ossimTerm* copy() const;
+
+private:
+ ossimTerm* lTerm; // The left term of the product
+ ossimTerm* rTerm; // The right term of the product
+
+};
+
+
+
+/**
+ * A variable class to hold a variable as a term.
+ */
+class OSSIMDLLEXPORT ossimVar : public ossimTerm{
+public:
+
+
+ /**
+ * @brief Public Constructor
+ *
+ * @param[in] variable The variable number
+ */
+ ossimVar(const ossim_uint32& variable) : var(variable) {}
+ /**
+ * @brief Public Copy Constructor
+ *
+ * @param[in] src The source to be copied
+ */
+ ossimVar(const ossimVar& src) : var(src.var) {}
+ /**
+ * @brief Destroys the variable
+ */
+ ~ossimVar() {}
+
+
+ /**
+ * @brief Evaluates a variable for a point
+ *
+ * @param[in] point The point to be evaluated
+ *
+ * @return The value at a point.
+ */
+ ossim_float64 evaluate(std::vector<ossim_float64> point) const{ return point[var]; }
+ /**
+ * @brief Calculates the derivative for a variable
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ ossimTerm* derivative(const ossim_uint32& variable) const;
+
+
+ /**
+ * @brief Gets the type of a variable
+ *
+ * @return The type of a variable
+ */
+ ossim_uint32 getType() const { return termType::variable; }
+ /**
+ * @brief Creates a copy of the variable
+ *
+ * @return A pointer to a copy of the variable
+ */
+ ossimTerm* copy() const;
+
+private:
+ ossim_uint32 var; // The number of the variable (0-n)
+
+};
+
+
+
+/**
+ * A constant class to hold a constant as a term.
+ */
+class OSSIMDLLEXPORT ossimConst : public ossimTerm{
+public:
+
+
+ /**
+ * @brief Public Constructor
+ *
+ * @param[in] value The value of the constant
+ */
+ ossimConst(const ossim_float64& value) : val(value) {}
+ /**
+ * @brief Public Copy Constructor
+ *
+ * @param[in] src The source to be copied
+ */
+ ossimConst(const ossimConst& src) : val(src.val) {}
+ /**
+ * @brief Destroys the constant
+ */
+ ~ossimConst() {}
+
+
+ /**
+ * @brief Evaluates a constant for a point
+ *
+ * @param[in] point The point to be evaluated
+ *
+ * @return The value at a point.
+ */
+ ossim_float64 evaluate(std::vector<ossim_float64> point) const{ return val; }
+ /**
+ * @brief Calculates the derivative for a constant
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ ossimTerm* derivative(const ossim_uint32& variable) const;
+
+
+ /**
+ * @brief Gets the type of a constant
+ *
+ * @return The type of a constant
+ */
+ ossim_uint32 getType() const { return termType::constant; }
+ /**
+ * @brief Creates a copy of the constant
+ *
+ * @return A pointer to a copy of the constant
+ */
+ ossimTerm* copy() const;
+
+private:
+ ossim_float64 val; // The value of the constant
+
+};
+
+
+
+#endif // OSSIM_FUNCTION_H
\ No newline at end of file
diff --git a/include/ossim/base/ossimTimer.h b/include/ossim/base/ossimTimer.h
index cfd661d..abe5f1e 100644
--- a/include/ossim/base/ossimTimer.h
+++ b/include/ossim/base/ossimTimer.h
@@ -43,15 +43,19 @@ public:
/** Get the time in seconds between timer ticks t1 and t2.*/
inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*m_secsPerTick; }
+ inline double delta_s( Timer_t t1) const { return (double)(tick() - t1)*m_secsPerTick; }
/** Get the time in milliseconds between timer ticks t1 and t2.*/
inline double delta_m( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e3; }
+ inline double delta_m( Timer_t t1) const { return delta_s(t1,tick())*1e3; }
/** Get the time in microseconds between timer ticks t1 and t2.*/
inline double delta_u( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e6; }
+ inline double delta_u( Timer_t t1) const { return delta_s(t1,tick())*1e6; }
/** Get the time in nanoseconds between timer ticks t1 and t2.*/
inline double delta_n( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e9; }
+ inline double delta_n( Timer_t t1) const { return delta_s(t1,tick())*1e9; }
/** Get the the number of seconds per tick. */
inline double getSecondsPerTick() const { return m_secsPerTick; }
diff --git a/include/ossim/imaging/ossimBandAverageFilter.h b/include/ossim/imaging/ossimBandAverageFilter.h
index 2ebf11f..c20ecd0 100644
--- a/include/ossim/imaging/ossimBandAverageFilter.h
+++ b/include/ossim/imaging/ossimBandAverageFilter.h
@@ -28,6 +28,8 @@ public:
ossimBandAverageFilter(ossimImageSource* input,
const std::vector<double>& weights);
+ virtual ~ossimBandAverageFilter();
+
/**
* The data object argument is deprecated and should not be used.
* eventually we will remove it from the base classes. This method will
@@ -92,8 +94,6 @@ public:
const char* prefix=0)const;
protected:
- virtual ~ossimBandAverageFilter();
-
ossimRefPtr<ossimImageData> theTile;
std::vector<double> theWeights;
diff --git a/include/ossim/imaging/ossimBlendMosaic.h b/include/ossim/imaging/ossimBlendMosaic.h
index f9a7bbe..1e16922 100644
--- a/include/ossim/imaging/ossimBlendMosaic.h
+++ b/include/ossim/imaging/ossimBlendMosaic.h
@@ -18,6 +18,7 @@ class OSSIMDLLEXPORT ossimBlendMosaic : public ossimImageMosaic
public:
ossimBlendMosaic();
ossimBlendMosaic(ossimConnectableObject::ConnectableObjectList& inputSources);
+ virtual ~ossimBlendMosaic();
virtual void initialize();
virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& origin,
@@ -54,7 +55,6 @@ public:
void findMinMax(double& minValue, double& maxValue)const;
protected:
- virtual ~ossimBlendMosaic();
vector<double> theWeights;
ossimRefPtr<ossimImageData> theNormResult;
/**
diff --git a/include/ossim/imaging/ossimCacheTileSource.h b/include/ossim/imaging/ossimCacheTileSource.h
index 6c74bae..7d5829d 100644
--- a/include/ossim/imaging/ossimCacheTileSource.h
+++ b/include/ossim/imaging/ossimCacheTileSource.h
@@ -26,6 +26,8 @@ public:
ossimCacheTileSource();
// ossimCacheTileSource(ossimImageSource* inputSource);
+ virtual ~ossimCacheTileSource();
+
virtual ossimString getLongName() const;
virtual ossimString getShortName() const;
@@ -59,8 +61,6 @@ public:
protected:
- virtual ~ossimCacheTileSource();
-
void allocate();
void deleteRlevelCache();
void initializeRlevelCache();
diff --git a/include/ossim/imaging/ossimGeneralRasterTileSource.h b/include/ossim/imaging/ossimGeneralRasterTileSource.h
index 9fab0b5..eae48e3 100644
--- a/include/ossim/imaging/ossimGeneralRasterTileSource.h
+++ b/include/ossim/imaging/ossimGeneralRasterTileSource.h
@@ -189,7 +189,7 @@ protected:
ossim_uint8* m_buffer;
ossim_uint8* m_lineBuffer;
ossimInterleaveType m_bufferInterleave;
- std::vector< std::shared_ptr<ossim::ifstream> > m_fileStrList;
+ std::vector< std::shared_ptr<ossim::istream> > m_fileStrList;
// std::vector< std::ifstream* > m_fileStrList;
ossimGeneralRasterInfo m_rasterInfo;
ossimIrect m_bufferRect;
diff --git a/include/ossim/imaging/ossimImageGeometry.h b/include/ossim/imaging/ossimImageGeometry.h
index 242eec3..ea803ce 100644
--- a/include/ossim/imaging/ossimImageGeometry.h
+++ b/include/ossim/imaging/ossimImageGeometry.h
@@ -441,8 +441,9 @@ public:
/**
* @return Returns the angle to "up is up" in decimal degrees, 0.0 if image
- * is not affected by elevation, ossim::nan on error.
+ * is not affected by elevation, ossim::nan on error.
*/
+ ossim_float64 upIsUpAngle(const ossimDpt&) const;
ossim_float64 upIsUpAngle() const;
/**
diff --git a/include/ossim/imaging/ossimImageRenderer.h b/include/ossim/imaging/ossimImageRenderer.h
index 5816938..28742ab 100644
--- a/include/ossim/imaging/ossimImageRenderer.h
+++ b/include/ossim/imaging/ossimImageRenderer.h
@@ -31,6 +31,8 @@ public:
ossimImageRenderer(ossimImageSource* inputSource,
ossimImageViewTransform* imageViewTrans = NULL);
+ virtual ~ossimImageRenderer();
+
virtual ossimString getLongName() const;
virtual ossimString getShortName() const;
@@ -150,8 +152,6 @@ public:
protected:
- virtual ~ossimImageRenderer();
-
private:
class ossimRendererSubRectInfo
diff --git a/include/ossim/imaging/ossimIndexToRgbLutFilter.h b/include/ossim/imaging/ossimIndexToRgbLutFilter.h
index 910221f..77142ca 100644
--- a/include/ossim/imaging/ossimIndexToRgbLutFilter.h
+++ b/include/ossim/imaging/ossimIndexToRgbLutFilter.h
@@ -107,6 +107,8 @@ public:
ossimIndexToRgbLutFilter();
+ virtual ~ossimIndexToRgbLutFilter();
+
virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& origin,
ossim_uint32 resLevel=0);
@@ -147,8 +149,6 @@ public:
virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=NULL);
protected:
- virtual ~ossimIndexToRgbLutFilter();
-
/**
* Called on first getTile, will initialize all data needed.
*/
diff --git a/include/ossim/imaging/ossimLinearStretchRemapper.h b/include/ossim/imaging/ossimLinearStretchRemapper.h
index bd005bf..f8174f0 100644
--- a/include/ossim/imaging/ossimLinearStretchRemapper.h
+++ b/include/ossim/imaging/ossimLinearStretchRemapper.h
@@ -36,6 +36,7 @@ class OSSIM_DLL ossimLinearStretchRemapper : public ossimImageSourceFilter
public:
ossimLinearStretchRemapper();
+ virtual ~ossimLinearStretchRemapper();
virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& origin,
ossim_uint32 resLevel=0);
@@ -55,7 +56,6 @@ public:
virtual ossimScalarType getOutputScalarType() const { return OSSIM_NORMALIZED_DOUBLE; }
protected:
- virtual ~ossimLinearStretchRemapper();
/**
* Called on first getTile, will initialize all data needed.
diff --git a/include/ossim/imaging/ossimMeanMedianFilter.h b/include/ossim/imaging/ossimMeanMedianFilter.h
index 9e50e9b..ec4bab1 100644
--- a/include/ossim/imaging/ossimMeanMedianFilter.h
+++ b/include/ossim/imaging/ossimMeanMedianFilter.h
@@ -49,6 +49,8 @@ public:
ossimMeanMedianFilter(ossimObject* owner=NULL);
+ virtual ~ossimMeanMedianFilter();
+
virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& rect,
ossim_uint32 resLevel=0);
virtual void initialize();
@@ -93,8 +95,6 @@ public:
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0)const;
protected:
- virtual ~ossimMeanMedianFilter();
-
ossimRefPtr<ossimImageData> theTile;
ossimMeanMedianFilterType theFilterType;
ossim_uint32 theWindowSize;
diff --git a/include/ossim/imaging/ossimScalarRemapper.h b/include/ossim/imaging/ossimScalarRemapper.h
index 7601afd..d60fa2e 100644
--- a/include/ossim/imaging/ossimScalarRemapper.h
+++ b/include/ossim/imaging/ossimScalarRemapper.h
@@ -24,6 +24,8 @@ public:
ossimScalarRemapper(ossimImageSource* inputSource,
ossimScalarType outputScalarType);
+ virtual ~ossimScalarRemapper();
+
virtual void initialize();
virtual ossimString getLongName() const;
@@ -86,8 +88,6 @@ public:
virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
protected:
- virtual ~ossimScalarRemapper();
-
/**
* Called on first getTile, will initialize all data needed.
*/
diff --git a/include/ossim/imaging/ossimTiffWriter.h b/include/ossim/imaging/ossimTiffWriter.h
index e6b134b..07857aa 100644
--- a/include/ossim/imaging/ossimTiffWriter.h
+++ b/include/ossim/imaging/ossimTiffWriter.h
@@ -28,7 +28,9 @@ public:
ossimTiffWriter();
- enum UnitType
+ virtual ~ossimTiffWriter();
+
+ enum UnitType
{
UNDEFINED = 0,
LINEAR_METER = 9001,
@@ -148,8 +150,6 @@ public:
static void dumpTileToFile(ossimRefPtr<ossimImageData> t, const ossimFilename& f);
protected:
- virtual ~ossimTiffWriter();
-
virtual bool writeFile();
/**
diff --git a/include/ossim/imaging/ossimTwoColorView.h b/include/ossim/imaging/ossimTwoColorView.h
index c578b38..5049369 100644
--- a/include/ossim/imaging/ossimTwoColorView.h
+++ b/include/ossim/imaging/ossimTwoColorView.h
@@ -11,8 +11,9 @@
#include <ossim/imaging/ossimImageCombiner.h>
/**
- * This is a 2 color view of the input. It basically allows for a change detection and by default will take the first input and map
- * it to the blue channel and takes the second input and maps to the red channel. The unused channel is mapped to a min pixel value.
+ * This is a 2 color view of the input. It basically allows for a change detection and by default
+ * will take the first input and map it to the blue channel and takes the second input and maps to
+ * the red channel. The unused channel is mapped to a min pixel value.
*/
class OSSIM_DLL ossimTwoColorView : public ossimImageCombiner
{
diff --git a/include/ossim/imaging/ossimVertexExtractor.h b/include/ossim/imaging/ossimVertexExtractor.h
index 19cc680..d7885ba 100644
--- a/include/ossim/imaging/ossimVertexExtractor.h
+++ b/include/ossim/imaging/ossimVertexExtractor.h
@@ -109,7 +109,7 @@ public:
return (object&& PTR_CAST(ossimImageSource, object));
}
- vector<ossimIpt> getVertices() { return theVertice; }
+ const vector<ossimIpt>& getVertices() const { return theVertice; }
protected:
virtual ~ossimVertexExtractor();
@@ -149,7 +149,7 @@ protected:
ossim_int32* theRightEdge;
//! Disallow copy constructor and operator=
- ossimVertexExtractor(const ossimVertexExtractor&) {}
+ ossimVertexExtractor(const ossimVertexExtractor&) : theLeftEdge(0), theRightEdge(0) {}
const ossimVertexExtractor& operator=(const ossimVertexExtractor& rhs)
{return rhs;}
diff --git a/include/ossim/support_data/ossimSrtmSupportData.h b/include/ossim/support_data/ossimSrtmSupportData.h
index 2d97a0f..f134743 100644
--- a/include/ossim/support_data/ossimSrtmSupportData.h
+++ b/include/ossim/support_data/ossimSrtmSupportData.h
@@ -197,7 +197,7 @@ private:
ossimScalarType m_scalarType;
// mutable ossimRefPtr<ossimIFStream> theFileStream;
- mutable std::shared_ptr<ossim::ifstream> m_str;
+ mutable std::shared_ptr<ossim::istream> m_str;
template <class T>
bool computeMinMaxTemplate(T dummy, double defaultNull);
diff --git a/scripts/env.sh b/scripts/env.sh
index fb1ea56..1d2da86 100755
--- a/scripts/env.sh
+++ b/scripts/env.sh
@@ -69,7 +69,7 @@ if [ -z $BUILD_OSSIM_APPS ] ; then
fi
if [ -z $BUILD_OSSIM_CURL_APPS ] ; then
- export BUILD_OSSIM_CURL_APPS=ON
+ export BUILD_OSSIM_CURL_APPS=OFF
fi
if [ -d $OSSIM_DEV_HOME/ossim-video ] ; then
@@ -119,27 +119,27 @@ if [ -d $OSSIM_DEV_HOME/ossim-plugins ] ; then
fi
if [ -z $BUILD_CSM_PLUGIN ] ; then
- export BUILD_CSM_PLUGIN=ON
+ export BUILD_CSM_PLUGIN=OFF
fi
if [ -z $BUILD_WEB_PLUGIN ] ; then
- export BUILD_WEB_PLUGIN=ON
+ export BUILD_WEB_PLUGIN=OFF
fi
if [ -z $BUILD_SQLITE_PLUGIN ] ; then
- export BUILD_SQLITE_PLUGIN=ON
+ export BUILD_SQLITE_PLUGIN=OFF
fi
if [ -z $BUILD_KAKADU_PLUGIN ] ; then
- export BUILD_KAKADU_PLUGIN=ON
+ export BUILD_KAKADU_PLUGIN=OFF
fi
if [ -z $BUILD_KML_PLUGIN ] ; then
- export BUILD_KML_PLUGIN=ON
+ export BUILD_KML_PLUGIN=OFF
fi
if [ -z $BUILD_GDAL_PLUGIN ] ; then
- export BUILD_GDAL_PLUGIN=ON
+ export BUILD_GDAL_PLUGIN=OFF
fi
#if [ -z $BUILD_HDF5_PLUGIN ] ; then
@@ -147,15 +147,15 @@ if [ -d $OSSIM_DEV_HOME/ossim-plugins ] ; then
#fi
if [ -z $BUILD_POTRACE_PLUGIN ] ; then
- export BUILD_POTRACE_PLUGIN=ON
+ export BUILD_POTRACE_PLUGIN=OFF
fi
if [ -z $BUILD_FFTW3_PLUGIN ] ; then
- export BUILD_FFTW3_PLUGIN=ON
+ export BUILD_FFTW3_PLUGIN=OFF
fi
if [ -z $BUILD_GEOPDF_PLUGIN ] ; then
- export BUILD_GEOPDF_PLUGIN=ON
+ export BUILD_GEOPDF_PLUGIN=OFF
fi
if [ -z $BUILD_OPENCV_PLUGIN ] ; then
@@ -163,11 +163,11 @@ if [ -d $OSSIM_DEV_HOME/ossim-plugins ] ; then
fi
if [ -z $BUILD_OPENJPEG_PLUGIN ] ; then
- export BUILD_OPENJPEG_PLUGIN=ON
+ export BUILD_OPENJPEG_PLUGIN=OFF
fi
if [ -z $BUILD_PNG_PLUGIN ] ; then
- export BUILD_PNG_PLUGIN=ON
+ export BUILD_PNG_PLUGIN=OFF
fi
if [ -z $BUILD_JPEG12_PLUGIN ] ; then
@@ -175,7 +175,7 @@ if [ -d $OSSIM_DEV_HOME/ossim-plugins ] ; then
fi
if [ -z $BUILD_OSSIM_HDF5_SUPPORT ] ; then
- export BUILD_OSSIM_HDF5_SUPPORT=ON
+ export BUILD_OSSIM_HDF5_SUPPORT=OFF
fi
fi
diff --git a/share/ossim/templates/ossim_preferences_template b/share/ossim/templates/ossim_preferences_template
index c07c6f9..c2972a2 100644
--- a/share/ossim/templates/ossim_preferences_template
+++ b/share/ossim/templates/ossim_preferences_template
@@ -337,7 +337,7 @@ plugin0.file: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_png_plugin.s
// plugin0.options:
// NTM plugin, alway make second plugin:
-plugin1.file1: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_ntm_plugin.so
+plugin1.file: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_ntm_plugin.so
plugin1.options:
plugin3.file: $(OSSIM_INSTALL_PREFIX)/lib64/ossim/plugins/libossim_aws_plugin.so
@@ -698,6 +698,11 @@ ossim.plugins.aws.s3.region: us-east-1
//
ossim.plugins.aws.s3.nReadCacheHeaders: 10000
+// We can also specify if we cache invalid locations. So if there is a s3://..... URL
+// and it is invalid and can't get the header size it will cache and mark it as invalid
+//
+ossim.plugins.aws.s3.cacheInvalidLocations: true
+
//---
// Turn on/off progress output to console standard output. Code
// auto detects if running in a console window; hence, typically this is not
@@ -731,4 +736,16 @@ ossim.plugins.aws.s3.nReadCacheHeaders: 10000
// If a password is on your private key file then specify it here.
//ossim.plugins.web.curl.clientKeyPassword:
-/---
+
+
+// Keywords
+// This is used by the stream factory registry when generating
+// input streams. If the connection pattern matches the includePattern
+// then it will wrap that stream with an ossim::BlockIStream if
+// enableBlocked is true or it will wrap with an ossimBufferedIStream
+// if enabledBlock is false
+//
+//ossim.stream.factory.registry.istream.buffer1.enabled: false
+//ossim.stream.factory.registry.istream.buffer1.enableBlocked: false
+//ossim.stream.factory.registry.istream.buffer1.includePattern: ^/
+//ossim.stream.factory.registry.istream.buffer1.size: 65536
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7f9f9e4..68e4586 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,4 +1,3 @@
-SET(LIB_NAME ossim)
########################################### BEGIN: GRAB SOURCE FILES ##########################################
FILE(GLOB ossim_SRCS RELATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}
@@ -24,7 +23,7 @@ IF(UNIX)
LIST(APPEND ossim_SRCS "${ossim_sockets_SRCS}")
ELSEIF(WIN32)
FILE(GLOB ossim_dll_main_SRCS RELATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/dll_main/*.cpp")
- LIST(APPEND ossim_SRCS "${ossim_dll_main_SRCS}")
+ LIST(APPEND ossim_SRCS "${ossim_dll_main_SRCS}")
ENDIF(UNIX)
IF (OSSIM_HAS_HDF5)
@@ -64,11 +63,11 @@ ENDIF (OSSIM_HAS_HDF5)
MESSAGE( "${ossim_HDRS}" )
SET(OSSIM_HEADER_FILES
- ${ossim_HDRS}
- ${ossim_base_HDRS} ${ossim_elevation_HDRS} ${ossim_font_HDRS} ${ossim_imaging_HDRS}
- ${ossim_init_HDRS} ${ossim_matrix_HDRS} ${ossim_parallel_HDRS} ${ossim_plugin_HDRS}
- ${ossim_point_cloud_HDRS} ${ossim_projection_HDRS} ${ossim_support_data_HDRS} ${ossim_util_HDRS}
- ${ossim_vec_HDRS} ${ossim_video_HDRS} ${ossim_vpfutil_HDRS} ${ossim_sockets_HDRS} ${ossim_hdf5_HDRS} )
+ ${ossim_HDRS}
+ ${ossim_base_HDRS} ${ossim_elevation_HDRS} ${ossim_font_HDRS} ${ossim_imaging_HDRS}
+ ${ossim_init_HDRS} ${ossim_matrix_HDRS} ${ossim_parallel_HDRS} ${ossim_plugin_HDRS}
+ ${ossim_point_cloud_HDRS} ${ossim_projection_HDRS} ${ossim_support_data_HDRS} ${ossim_util_HDRS}
+ ${ossim_vec_HDRS} ${ossim_video_HDRS} ${ossim_vpfutil_HDRS} ${ossim_sockets_HDRS} ${ossim_hdf5_HDRS} )
################################## APPLE Framework support deep header mapping ###################################
diff --git a/src/base/ossimArgumentParser.cpp b/src/base/ossimArgumentParser.cpp
index 3bd5b07..6cdb0e8 100755
--- a/src/base/ossimArgumentParser.cpp
+++ b/src/base/ossimArgumentParser.cpp
@@ -184,7 +184,7 @@ ossimArgumentParser::ossimArgumentParser(const ossimString& commandLine):
{
vector<ossimString> args = commandLine.split(" ", true);
*theArgc = (int)args.size();
- if (theArgc > 0)
+ if (*theArgc > 0)
{
theArgv = new char* [*theArgc];
for (size_t i=0; i<args.size(); i++)
@@ -211,7 +211,7 @@ ossimArgumentParser::~ossimArgumentParser()
void ossimArgumentParser::initialize(int* argc, const char **argv)
{
- if(argc > 0) delete (theArgv);
+ if(*argc > 0) delete (theArgv);
theArgc = argc;
theArgv = new char*[*argc];
for(int i=0;i<*argc;i++)
@@ -474,7 +474,7 @@ bool ossimArgumentParser::read(const std::string& str, std::vector<ossimString>&
while (pos < *theArgc)
{
// Check for occurence of next option:
- if ((theArgv[pos][0] == '-'))
+ if (theArgv[pos][0] == '-')
break;
// Skip a comma surrounded by spaces:
diff --git a/src/base/ossimBlockStreamBuffer.cpp b/src/base/ossimBlockStreamBuffer.cpp
new file mode 100644
index 0000000..e4dd6b0
--- /dev/null
+++ b/src/base/ossimBlockStreamBuffer.cpp
@@ -0,0 +1,267 @@
+#include <ossim/base/ossimBlockStreamBuffer.h>
+#include <ossim/base/ossimTrace.h>
+#include <cstring> /* for memcpy */
+
+static ossimTrace traceDebug("BlockStreamBuffer:debug");
+
+ossim::BlockStreamBuffer::BlockStreamBuffer(ossim::istream* adaptStream, ossim_uint64 blockSize)
+: m_adaptStream(adaptStream),
+ m_currentPosValue(0)
+{
+ m_blockInfo.m_blockSize = blockSize;
+ if(m_blockInfo.m_blockSize)
+ {
+ m_blockBuffer.resize(m_blockInfo.m_blockSize);
+ m_blockInfo.m_blockBufferPtr = &m_blockBuffer.front();
+ }
+ setg(0, 0, 0);
+}
+
+std::streambuf* ossim::BlockStreamBuffer::setbuf (char* s,
+ std::streamsize n)
+{
+ if(n>0)
+ {
+ m_blockBuffer.clear();
+ m_blockInfo.setBuffer(s,n);
+ setg(0, 0, 0);
+ }
+ return this;
+}
+
+void ossim::BlockStreamBuffer::setgPtrs()
+{
+ if(m_blockInfo.isLoaded())
+ {
+ setg(m_blockInfo.getBuffer(),
+ m_blockInfo.getBuffer() + (m_currentPosValue - m_blockInfo.m_startByte),
+ m_blockInfo.getBuffer() + m_blockInfo.m_validSize);
+ }
+ else
+ {
+ setg(0,0,0);
+ }
+
+}
+
+void ossim::BlockStreamBuffer::loadBlock()
+{
+ m_blockInfo.m_blockLoaded = false;
+ m_blockInfo.m_validSize = 0;
+ if(m_adaptStream)
+ {
+ if(m_currentPosValue < 0) m_currentPosValue = 0;
+ ossim_int64 blockIndex = m_blockInfo.getBlockIndex(m_currentPosValue);
+ m_blockInfo.m_startByte = blockIndex*m_blockInfo.m_blockSize;
+ if(!m_adaptStream->good()) m_adaptStream->clear();
+ if(m_blockInfo.m_startByte != m_adaptStream->tellg())
+ {
+ m_adaptStream->seekg(m_blockInfo.m_startByte);
+ }
+ m_adaptStream->read(m_blockInfo.m_blockBufferPtr,
+ m_blockInfo.m_blockSize);
+ ossim_int64 bytesRead = m_adaptStream->gcount();
+ if(!m_adaptStream->bad()&&(bytesRead>0))
+ {
+ m_blockInfo.m_blockLoaded = true;
+ m_blockInfo.m_validSize = bytesRead;
+ if((m_blockInfo.m_validSize<=0)||(!m_blockInfo.isWithinValidWindow(m_currentPosValue)))
+ {
+ m_blockInfo.m_blockLoaded = false;
+ }
+ }
+ }
+ setgPtrs();
+}
+
+std::streambuf::pos_type ossim::BlockStreamBuffer::seekoff(off_type offset,
+ std::ios_base::seekdir dir,
+ std::ios_base::openmode mode)
+{
+ // make sure we are in synch with current pos
+ // gptr can be updated by other means
+ syncCurrentPosition();
+ pos_type result = pos_type(off_type(-1));
+ if(m_adaptStream)
+ {
+ ossim_int64 pos = m_currentPosValue;
+ switch(dir)
+ {
+ case std::ios_base::beg:
+ {
+ pos = offset;
+ result = seekpos(pos, std::ios_base::in);
+ break;
+ }
+ case std::ios_base::cur:
+ {
+ pos += offset;
+ result = seekpos(pos, std::ios_base::in);
+ break;
+ }
+ case std::ios_base::end:
+ {
+ // at this point in time of implementation
+ // we do not know the offset to the end of the stream
+ // we are adapting
+ //
+ // we have no choice but to call the adapted stream
+ // implementation
+ result = m_adaptStream->rdbuf()->pubseekoff(pos, dir);
+ m_currentPosValue = result;
+ setgPtrs();
+
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+ return result;
+}
+
+std::streambuf::pos_type ossim::BlockStreamBuffer::seekpos(pos_type pos,
+ std::ios_base::openmode mode)
+{
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "BlockStreamBuffer::seekpos DEBUG: entered with absolute position: " << pos << "\n";
+
+ }
+ pos_type result = pos_type(off_type(-1));
+
+ if(m_adaptStream)
+ {
+ if(pos == m_currentPosValue)
+ {
+ result = pos;
+ }
+ else if(m_blockInfo.isLoaded()&&m_blockInfo.isWithinValidWindow(pos))
+ {
+ result = pos;
+ m_currentPosValue = result;
+ }
+ else
+ {
+ result = m_adaptStream->rdbuf()->pubseekpos(pos, mode);
+ m_currentPosValue = result;
+ }
+ setgPtrs();
+ }
+
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "BlockStreamBuffer::seekpos DEBUG: leaving\n";
+
+ }
+ return result;
+
+}
+
+std::streamsize ossim::BlockStreamBuffer::xsgetn(char_type* s,
+ std::streamsize n)
+{
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "BlockStreamBuffer::xsgetn DEBUG: entered ......"<<n<<"\n";
+
+ }
+ std::streamsize result = EOF;
+
+ if(m_adaptStream)
+ {
+ ossim_int64 bytesNeedToRead = n;
+ ossim_int64 bytesRead = 0;
+ syncCurrentPosition();
+
+ while(bytesNeedToRead>0)
+ {
+ if(!m_blockInfo.isWithinValidWindow(m_currentPosValue))
+ {
+ loadBlock();
+ }
+
+ if(m_blockInfo.isLoaded())
+ {
+ ossim_int64 delta = (m_blockInfo.getEndByte()-
+ m_currentPosValue);
+ if(delta <= bytesNeedToRead)
+ {
+ std::memcpy(s+bytesRead,
+ m_blockInfo.getBufferStart(m_currentPosValue),
+ delta);
+ bytesRead+=delta;
+ bytesNeedToRead-=delta;
+ m_currentPosValue+=delta;
+ }
+ else
+ {
+ std::memcpy(s+bytesRead,
+ m_blockInfo.getBufferStart(m_currentPosValue),
+ bytesNeedToRead);
+ m_currentPosValue+=bytesNeedToRead;
+ bytesRead+=bytesNeedToRead;
+ bytesNeedToRead=0;
+ }
+ }
+ else
+ {
+ bytesNeedToRead=0;
+ }
+ }
+ // specify the current absolute position after read
+ // so we are in sync.
+ setgPtrs();
+ result = bytesRead;
+ }
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "BlockStreamBuffer::xsgetn DEBUG: leaving ......\n";
+
+ }
+ return result;
+}
+
+int ossim::BlockStreamBuffer::underflow()
+{
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "BlockStreamBuffer::underflow DEBUG: entered ......\n";
+
+ }
+ if(!m_adaptStream) return EOF;
+ else{
+ syncCurrentPosition();
+ if(!m_blockInfo.isWithinValidWindow(m_currentPosValue))
+ {
+ loadBlock();
+ }
+
+ if(!m_blockInfo.isLoaded())
+ {
+ return EOF;
+ }
+ }
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_DEBUG)
+ << "BlockStreamBuffer::underflow DEBUG: leaving ......\n";
+
+ }
+ return (int)static_cast<ossim_uint8>(*gptr());
+}
+
+void ossim::BlockStreamBuffer::syncCurrentPosition()
+{
+ if(m_blockInfo.isLoaded()&&gptr())
+ {
+ m_currentPosValue = (m_blockInfo.m_startByte+(gptr()-eback()));
+ }
+}
diff --git a/src/base/ossimGDoptimizer.cpp b/src/base/ossimGDoptimizer.cpp
new file mode 100644
index 0000000..81be852
--- /dev/null
+++ b/src/base/ossimGDoptimizer.cpp
@@ -0,0 +1,102 @@
+/**
+ * @author Dylan Thomas Cannisi
+ * @date 07/24/2017
+ *
+ * @brief Simple Gradient Descent optimizer for ossim.
+ *
+ * See top level LICENSE.txt file.
+ */
+#include <ossim/base/ossimGDoptimizer.h>
+
+#include <cmath>
+#include <iostream>
+
+/**
+ * @brief Public Copy constructor
+ */
+ossimGDoptimizer::ossimGDoptimizer(){
+ m_func = nullptr;
+}
+
+
+/**
+ * @brief Public Copy constructor
+ *
+ * @param[in] src The object to be copied (copies pointer not a copy of function)
+ */
+ossimGDoptimizer::ossimGDoptimizer(const ossimGDoptimizer& src){
+ m_func = src.m_func;
+}
+
+
+/**
+ * @brief Destroys the object !DOES NOT DELETE FUNCTION!
+ */
+ossimGDoptimizer::~ossimGDoptimizer(){
+}
+
+
+/**
+ * @brief Public Constructor with a preset function
+ *
+ * @param function The function to be optimized
+ */
+ossimGDoptimizer::ossimGDoptimizer(ossimTerm* function){
+ m_func = function;
+}
+
+
+/**
+ * @brief Sets the function to be optimized
+ *
+ * @param function The function to be optimized
+ *
+ * @return whether or not the optimizer already contained a function
+ */
+bool ossimGDoptimizer::setFunction(ossimTerm* function){
+ bool retVal = false;
+
+ if(m_func != nullptr) retVal = true;
+ m_func = function;
+
+return retVal;
+}
+
+
+/**
+ * @brief Optimizes the function
+ *
+ * @param[in] startPoint The start point at which the algorithm starts its descent
+ * @param[in] gamma Determins the step size as a function of the gradient
+ * @param[in] precision The stopping point at which the algorithm will no longer descend
+ * @param[in] maxEpoch The stopping point to limit infinite loops.
+ *
+ * @return the optimial minima
+ */
+std::vector<ossim_float64> ossimGDoptimizer::optimize(std::vector<ossim_float64> point, ossim_float64 gamma, ossim_float64 precision, ossim_uint32 maxEpoch) const {
+
+ ossim_uint32 iter = 0;
+ ossim_float64 step = 10000;
+
+ std::vector<ossimTerm*> derivative;
+ for(size_t i = 0; i < point.size(); ++i){
+ derivative.push_back(m_func->derivative(i));
+ }
+
+ std::vector<ossim_float64> prevPoint;
+ while(step > precision && iter < maxEpoch){
+ step = 0;
+ prevPoint = point;
+ for(size_t i = 0; i < point.size(); ++i){
+ point[i] += -gamma * derivative[i]->evaluate(point);
+ step += pow(point[i]-prevPoint[i], 2);
+ }
+ step = sqrt(step);
+ }
+
+ for(size_t i = 0; i < derivative.size(); ++i){
+ delete derivative[i];
+ }
+
+return point;
+}
\ No newline at end of file
diff --git a/src/base/ossimKeywordlist.cpp b/src/base/ossimKeywordlist.cpp
index 43bc6ae..37f6d80 100755
--- a/src/base/ossimKeywordlist.cpp
+++ b/src/base/ossimKeywordlist.cpp
@@ -1080,6 +1080,32 @@ bool ossimKeywordlist::parseStream(ossim::istream& is)
return true;
}
+void ossimKeywordlist::getSortedList(std::vector<ossimString>& prefixValues,
+ const ossimString &prefixKey)const
+{
+ ossimString regExpression = ossimString("^(") + prefixKey+ "[0-9]+)";
+ prefixValues.clear();
+ std::vector<ossimString> keys;
+ getSubstringKeyList(keys, regExpression);
+ ossim_uint32 nKeys = (long)keys.size();
+
+ ossim_uint32 offset = (int)ossimString(prefixKey).size();
+ ossim_uint32 idx = 0;
+ std::vector<ossim_uint32> numberList(nKeys);
+ for(idx = 0; idx < (int)numberList.size();++idx)
+ {
+ ossimString numberStr(keys[idx].begin() + offset,
+ keys[idx].end());
+ numberList[idx] = numberStr.toInt();
+ }
+ std::sort(numberList.begin(), numberList.end());
+
+ for(idx=0;idx < (int)numberList.size();++idx)
+ {
+ prefixValues.push_back(prefixKey+ossimString::toString(numberList[idx]));
+ }
+}
+
std::vector<ossimString> ossimKeywordlist::findAllKeysThatContains(const ossimString &searchString)const
{
KeywordMap::const_iterator i;
diff --git a/src/base/ossimLookUpTable.cpp b/src/base/ossimLookUpTable.cpp
index 87458d4..da91b5d 100644
--- a/src/base/ossimLookUpTable.cpp
+++ b/src/base/ossimLookUpTable.cpp
@@ -16,6 +16,15 @@ using namespace std;
#include <ossim/base/ossimLookUpTable.h>
#include <ossim/base/ossimKeywordlist.h>
+ossimLookUpTable::ossimLookUpTable(const std::initializer_list<ossimString>& stringInitializer)
+{
+ ossim_uint32 idx = 0;
+ for(auto value:stringInitializer)
+ {
+ theTable.push_back(ossimKeyValueMap(idx, value));
+ ++idx;
+ }
+}
//*******************************************************************
// Protected Constructor:
//*******************************************************************
@@ -125,6 +134,11 @@ ossim_uint32 ossimLookUpTable::getTableSize() const
return (ossim_uint32)theTable.size();
}
+ossimKeyword ossimLookUpTable::getKeyword() const
+{
+ return ossimKeyword();
+}
+
void ossimLookUpTable::dumpValues(std::ostream& out)const
{
ossim_uint32 tableSize = getTableSize();
diff --git a/src/base/ossimPolygon.cpp b/src/base/ossimPolygon.cpp
index c9a0435..d1b82d3 100644
--- a/src/base/ossimPolygon.cpp
+++ b/src/base/ossimPolygon.cpp
@@ -1276,16 +1276,20 @@ bool ossimPolygon::shrink(ossimPolygon &dest, double inset) const
ossimDpt pt;
//don't let people shrink themselves, that isn't going to work
- if(&dest==this) return false;
+ if (&dest==this)
+ return false;
dest.clear();
- for(int i=0;i<numpts;i++) {
+ for(int i=0;i<numpts;i++)
+ {
fitCircleInsideVertex(pt,i,inset);
dest.addPoint(pt);
}
- if(isPolyWithin(dest)) {
+ if(isPolyWithin(dest))
+ {
return true;
- } else {
+ } else
+ {
//return an empty polygon
dest=ossimPolygon();
return false;
diff --git a/src/base/ossimStreamFactory.cpp b/src/base/ossimStreamFactory.cpp
index 0e0b55a..889a13f 100644
--- a/src/base/ossimStreamFactory.cpp
+++ b/src/base/ossimStreamFactory.cpp
@@ -65,6 +65,7 @@ std::shared_ptr<ossim::istream> ossim::StreamFactory::createIstream(
result = testResult;
}
+
return result;
}
@@ -143,92 +144,3 @@ ossim::StreamFactory::StreamFactory()
ossim::StreamFactory::StreamFactory(const ossim::StreamFactory& )
{
}
-
-// Deprecated code...
-ossimStreamFactory* ossimStreamFactory::theInstance = 0;
-
-ossimStreamFactory::ossimStreamFactory(): ossimStreamFactoryBase()
-{
-}
-
-ossimStreamFactory::~ossimStreamFactory()
-{
-}
-
-ossimStreamFactory* ossimStreamFactory::instance()
-{
- if(!theInstance)
- {
- theInstance = new ossimStreamFactory();
- }
-
- return theInstance;
-}
-
-std::shared_ptr<ossim::ifstream> ossimStreamFactory::createIFStream(
- const ossimFilename& file, std::ios_base::openmode openMode) const
-{
- std::shared_ptr<ossim::ifstream> result(0);
-
- if ( file.exists() )
- {
- // there is a bug in gcc < 5.0 and we can't use constructors in the
- // C++11 build. Will refactor to do a new ifstream then use open
- //
- result = std::make_shared<ossim::ifstream>();
- result->open(file.c_str(), openMode);
- if ( result->is_open() == false )
- {
- result.reset();
- }
- }
- return result;
-}
-
-ossimRefPtr<ossimIFStream> ossimStreamFactory::createNewIFStream(
- const ossimFilename& file,
- std::ios_base::openmode mode) const
-{
- ossimRefPtr<ossimIFStream> result = 0;
-
-#if OSSIM_HAS_LIBZ
- ossimFilename copyFile = file;
-
- if(!copyFile.exists())
- {
- ossimString ext = copyFile.ext();
- copyFile.setExtension("gz");
- if(!copyFile.exists())
- {
- copyFile.setExtension(ext);
- copyFile += ".gz";
-
- if(!copyFile.exists())
- {
- return result;
- }
- }
- }
-
- std::ifstream in(copyFile.c_str(), std::ios::in|std::ios::binary);
-
- if(!in) return result;
-
- unsigned char buf[2];
-
- in.read((char*)buf, 2);
- in.close();
- // check for gzip magic number
- //
- if((buf[0] == 0x1F) &&
- (buf[1] == 0x8B))
- {
- result = new ossimIgzStream(copyFile.c_str(), mode);
- }
-#endif
- return result;
-}
-
-ossimStreamFactory::ossimStreamFactory(const ossimStreamFactory&)
- : ossimStreamFactoryBase()
-{}
diff --git a/src/base/ossimStreamFactoryRegistry.cpp b/src/base/ossimStreamFactoryRegistry.cpp
index cb0719b..e8b4a4f 100644
--- a/src/base/ossimStreamFactoryRegistry.cpp
+++ b/src/base/ossimStreamFactoryRegistry.cpp
@@ -11,16 +11,24 @@
#include <ossim/base/ossimStreamFactory.h>
#include <ossim/base/ossimIoStream.h>
#include <ossim/base/ossimFilename.h>
+#include <ossim/base/ossimPreferences.h>
+#include <ossim/base/ossimBlockIStream.h>
#include <fstream>
#include <algorithm>
+#include <ossim/base/ossimTrace.h>
+
ossim::StreamFactoryRegistry* ossim::StreamFactoryRegistry::m_instance = 0;
+static const ossimString ISTREAM_BUFFER_KW = "ossim.stream.factory.registry.istream.buffer";
+static ossimTrace traceDebug("ossimStreamFactoryRegistry:debug");
ossim::StreamFactoryRegistry::StreamFactoryRegistry()
{
+ loadPreferences();
}
+
ossim::StreamFactoryRegistry::~StreamFactoryRegistry()
{
}
@@ -30,21 +38,142 @@ ossim::StreamFactoryRegistry* ossim::StreamFactoryRegistry::instance()
if(!m_instance)
{
m_instance = new ossim::StreamFactoryRegistry();
+
}
return m_instance;
}
+void ossim::StreamFactoryRegistry::loadPreferences()
+{
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_WARN)
+ << "ossim::StreamFactoryRegistry::loadPreferences: ....... entered!\n";
+ }
+ std::vector<ossimString> sortedList;
+ ossimPreferences::instance()->preferencesKWL()
+ .getSortedList(sortedList, ISTREAM_BUFFER_KW);
+ if(sortedList.size())
+ {
+ m_bufferInfoList.resize(sortedList.size());
+ }
+ else
+ {
+ m_bufferInfoList.clear();
+ }
+ ossim_uint32 idx=0;
+ for(std::vector<ossimString>::const_iterator iter = sortedList.begin();
+ iter!=sortedList.end();
+ ++iter,++idx)
+ {
+ ossimString prefix = *iter;
+ ossimString bufferIStreamEnabled = ossimPreferences::instance()->findPreference(prefix+".enabled");
+ ossimString bufferIStreamBlockEnabled = ossimPreferences::instance()->findPreference(prefix+".enableBlocked");
+ ossimString bufferIStreamIncludePattern = ossimPreferences::instance()->findPreference(prefix+".includePattern");
+ ossimString bufferIStreamSize = ossimPreferences::instance()->findPreference(prefix+".size");
+
+ if(!bufferIStreamSize.empty())
+ {
+ m_bufferInfoList[idx].m_size = bufferIStreamSize.toUInt64();
+ }
+ if(!bufferIStreamEnabled.empty())
+ {
+ m_bufferInfoList[idx].m_enabled = bufferIStreamEnabled.toBool();
+ }
+ if(!bufferIStreamBlockEnabled.empty())
+ {
+ m_bufferInfoList[idx].m_enableBlocked = bufferIStreamBlockEnabled.toBool();
+ }
+ if(!bufferIStreamIncludePattern.empty())
+ {
+ m_bufferInfoList[idx].m_pattern = bufferIStreamIncludePattern;
+ }
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_WARN)
+ << "ossim::StreamFactoryRegistry adding BufferInfo: \n"
+ << "enabled: " << ossimString::toString(m_bufferInfoList[idx].m_enabled)<< "\n"
+ << "enableBlocked: " << ossimString::toString(m_bufferInfoList[idx].m_enableBlocked)<< "\n"
+ << "size: " << m_bufferInfoList[idx].m_size << "\n"
+ << "pattern: " << m_bufferInfoList[idx].m_pattern << "\n";
+ }
+
+ }
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_WARN)
+ << "ossim::StreamFactoryRegistry::loadPreferences: ....... leaving!\n";
+ }
+}
+
+bool ossim::StreamFactoryRegistry::getBufferInfo(BufferInfo& bufferInfo,
+ const ossimString& connectionString)const
+{
+ bool result = false;
+
+ for(std::vector<BufferInfo>::const_iterator iter = m_bufferInfoList.begin();
+ iter != m_bufferInfoList.end();
+ ++iter)
+ {
+ if(iter->m_enabled)
+ {
+ m_patternMatcher.compile(iter->m_pattern);
+ if(m_patternMatcher.is_valid())
+ {
+ if(m_patternMatcher.find(connectionString.c_str()))
+ {
+ bufferInfo = *iter;
+ result = true;
+ break;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+
std::shared_ptr<ossim::istream> ossim::StreamFactoryRegistry::createIstream(
const std::string& connectionString,
const ossimKeywordlist& options,
std::ios_base::openmode openMode) const
{
std::shared_ptr<ossim::istream> result(0);
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_WARN)
+ << "ossim::StreamFactoryRegistry::createIstream: ....... entered: "<< connectionString << "\n";
+ }
+
ossim_uint32 i = 0;
for(i = 0; (i < m_factoryList.size())&&(!result); ++i)
{
result = m_factoryList[i]->createIstream(connectionString, options, openMode);
+
+ if(result)
+ {
+ BufferInfo bufferInfo;
+ if(getBufferInfo(bufferInfo, connectionString))
+ {
+ if(bufferInfo.m_enableBlocked)
+ {
+ result = std::make_shared<ossim::BlockIStream>(result, bufferInfo.m_size);
+ }
+ else
+ {
+ result = std::make_shared<ossimBufferedInputStream>(result, bufferInfo.m_size);
+ }
+ }
+ }
+ }
+
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_WARN)
+ << "ossim::StreamFactoryRegistry::createIstream: ....... leaving!\n";
}
+
return result;
}
@@ -75,13 +204,23 @@ bool ossim::StreamFactoryRegistry::exists(const std::string& connectionString) c
bool ossim::StreamFactoryRegistry::exists(const std::string& connectionString,
bool& continueFlag) const
{
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_WARN)
+ << "ossim::StreamFactoryRegistry::exists: ....... entered: "<< connectionString << "\n";
+ }
bool result = false;
- std::vector<ossim::StreamFactoryBase*>::const_iterator i = m_factoryList.begin();
- while ( i != m_factoryList.end() )
+ for(auto factory:m_factoryList)
{
- result = (*i)->exists( connectionString, continueFlag );
+
+ result = factory->exists( connectionString, continueFlag );
if ( ( result == true ) || (continueFlag == false ) ) break;
- ++i;
+ }
+
+ if(traceDebug())
+ {
+ ossimNotify(ossimNotifyLevel_WARN)
+ << "ossim::StreamFactoryRegistry::createIstream: ....... leaving!\n";
}
return result;
}
@@ -106,92 +245,3 @@ void ossim::StreamFactoryRegistry::unregisterFactory(StreamFactoryBase* factory)
m_factoryList.erase( iter );
}
}
-
-// Deprecated code:
-ossimStreamFactoryRegistry* ossimStreamFactoryRegistry::theInstance = 0;
-
-ossimStreamFactoryRegistry::ossimStreamFactoryRegistry()
-{
-}
-
-ossimStreamFactoryRegistry::~ossimStreamFactoryRegistry()
-{
-}
-
-ossimStreamFactoryRegistry* ossimStreamFactoryRegistry::instance()
-{
- if(!theInstance)
- {
- theInstance = new ossimStreamFactoryRegistry();
- }
- return theInstance;
-}
-
-std::shared_ptr<ossim::ifstream> ossimStreamFactoryRegistry::createIFStream(
- const ossimFilename& file, std::ios_base::openmode openMode) const
-{
- std::shared_ptr<ossim::ifstream>result(0);
-
- for(ossim_uint32 idx = 0; ((idx < theFactoryList.size())&&(!result)); ++idx)
- {
- result = theFactoryList[idx]->createIFStream(file, openMode);
- }
-
- if(!result)
- {
- if(file.exists())
- {
- // there is a bug in gcc < 5.0 and we can't use constructors in the
- // C++11 build. Will refactor to do a new ifstream then use open
- //
-
- result = std::make_shared<ossim::ifstream>();
- result->open(file.c_str(), openMode);
- if(!result->is_open())
- {
- result.reset();
- }
- }
- }
-
- return result;
-
-}
-
-ossimRefPtr<ossimIFStream>
-ossimStreamFactoryRegistry::createNewIFStream(
- const ossimFilename& file,
- std::ios_base::openmode openMode) const
-{
- ossim_uint32 idx = 0;
- ossimRefPtr<ossimIFStream> result = 0;
- for(idx = 0; ((idx < theFactoryList.size())&&(!result)); ++idx)
- {
- result = theFactoryList[idx]->createNewIFStream(file, openMode);
- }
-
- if(!result)
- {
- result = new ossimIFStream(file.c_str(),
- openMode);
-// result = new std::ifstream(file.c_str(),
-// openMode);
- }
-
- return result;
-}
-
-
-void ossimStreamFactoryRegistry::registerFactory(ossimStreamFactoryBase* factory)
-{
- std::vector<ossimStreamFactoryBase*>::iterator iter = std::find(theFactoryList.begin(),
- theFactoryList.end(),
- factory);
- if(iter == theFactoryList.end())
- {
- theFactoryList.push_back(factory);
- }
-}
-
-ossimStreamFactoryRegistry::ossimStreamFactoryRegistry(const ossimStreamFactoryRegistry&)
-{}
diff --git a/src/base/ossimString.cpp b/src/base/ossimString.cpp
index 14c8cd8..94c3ddb 100644
--- a/src/base/ossimString.cpp
+++ b/src/base/ossimString.cpp
@@ -706,6 +706,46 @@ ossim_uint64 ossimString::toUInt64(const ossimString& aString)
return aString.toUInt64();
}
+ossim_int64 ossimString::memoryUnitToInt64()const
+{
+ ossim_int64 result = toInt64();
+ if((result != 0)&&size()>0)
+ {
+ ossimString byteType = *(begin()+(size()-1));
+ byteType.upcase();
+ if ( byteType == "K")
+ {
+ result *= static_cast<ossim_int64>(1024);
+ }
+ else if ( byteType == "M")
+ {
+ result *= static_cast<ossim_int64>(1048576);
+ }
+ else if ( byteType == "G")
+ {
+ result *= static_cast<ossim_int64>(1073741824);
+ }
+ else if( byteType == "T")
+ {
+ // to avoid possible integer size warnings
+ // we will start with a number that is 1 gig
+ // for it fits within a standard integer then
+ // force 64 bit mutliplication.
+ // Will do it like this for I do not know the
+ // outcome for other compilers.
+ result *= static_cast<ossim_int64>(1073741824);
+ result *= static_cast<ossim_int64>(1024);
+ }
+ }
+
+ return result;
+}
+
+ossim_int64 ossimString::memoryUnitToInt64(const ossimString& aString)
+{
+ return aString.memoryUnitToInt64();
+}
+
long ossimString::toLong()const
{
long i = 0;
diff --git a/src/base/ossimTerm.cpp b/src/base/ossimTerm.cpp
new file mode 100644
index 0000000..db3aade
--- /dev/null
+++ b/src/base/ossimTerm.cpp
@@ -0,0 +1,180 @@
+/**
+ * @author Dylan Thomas Cannisi
+ * @date 07/24/2017
+ *
+ * @brief Mathematical term data structure for ossim.
+ *
+ * See top level LICENSE.txt file.
+ */
+#include <ossim/base/ossimTerm.h>
+
+
+#include <iostream>
+
+
+/**
+ * OSSIM TERM
+ */
+
+
+/**
+ * @brief Returns a copy of the two terms in a polynomial
+ *
+ * @param rhs The right hand term of the polynomial
+ *
+ * @return A polynomial with !COPIES! of the two terms
+ */
+inline ossimTerm* ossimTerm::operator+(ossimTerm* rhs) const{
+ return new ossimPolynomial(this->copy(), rhs->copy());
+}
+/**
+ * @brief Returns a copy of the two terms in a product
+ *
+ * @param rhs The right hand term of the product
+ *
+ * @return A product with !COPIES! of the two terms
+ */
+inline ossimTerm* ossimTerm::operator*(ossimTerm* rhs) const{
+ return new ossimProd(this->copy(), rhs->copy());
+}
+
+
+
+/**
+ * OSSIM MONOMIAL AS A TERM
+ */
+
+
+/**
+ * @brief Calculates the derivative for a monomial
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ossimTerm* ossimMonom::derivative(const ossim_uint32& variable) const{
+ return new ossimMonom(coef*exp, var->derivative(variable), exp-1);
+}
+
+
+/**
+ * @brief Creates a copy of the monomial
+ *
+ * @return A pointer to a copy of the monomial
+ */
+ossimTerm* ossimMonom::copy() const{
+ return new ossimMonom(coef, var->copy(), exp);
+}
+
+
+
+/**
+ * OSSIM POLYNOMIAL AS A TERM
+ */
+
+
+/**
+ * @brief Calculates the derivative for a polynomial
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ossimTerm* ossimPolynomial::derivative(const ossim_uint32& variable) const{
+ return new ossimPolynomial(lTerm->derivative(variable), rTerm->derivative(variable));
+}
+
+
+/**
+ * @brief Creates a copy of the polynomial
+ *
+ * @return A pointer to a copy of the polynomial
+ */
+ossimTerm* ossimPolynomial::copy() const{
+ return new ossimPolynomial(lTerm->copy(), rTerm->copy());
+}
+
+
+
+/**
+ * OSSIM PRODUCT AS A TERM
+ */
+
+
+/**
+ * @brief Calculates the derivative for a product
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ossimTerm* ossimProd::derivative(const ossim_uint32& variable) const{
+ return new ossimPolynomial(new ossimProd(lTerm->copy(), rTerm->derivative(variable)), new ossimProd(lTerm->derivative(variable), rTerm->copy()));
+}
+
+
+/**
+ * @brief Creates a copy of the product
+ *
+ * @return A pointer to a copy of the product
+ */
+ossimTerm* ossimProd::copy() const{
+ return new ossimProd(lTerm->copy(), rTerm->copy());
+}
+
+
+
+/**
+ * OSSIM VARIABLE AS A TERM
+ */
+
+
+/**
+ * @brief Calculates the derivative for a variable
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ossimTerm* ossimVar::derivative(const ossim_uint32& variable) const{
+ if(var == variable) return new ossimVar(var);
+return new ossimConst(0);
+}
+
+
+/**
+ * @brief Creates a copy of the variable
+ *
+ * @return A pointer to a copy of the variable
+ */
+ossimTerm* ossimVar::copy() const{
+ return new ossimVar(var);
+}
+
+
+
+/**
+ * OSSIM CONSTANT AS A TERM
+ */
+
+
+/**
+ * @brief Calculates the derivative for a constant
+ *
+ * @param[in] variable The variable in which the derivative is with respect too.
+ *
+ * @return A pointer to that contains the derivative of the term.
+ */
+ossimTerm* ossimConst::derivative(const ossim_uint32& variable) const{
+ return new ossimConst(0);
+}
+
+
+/**
+ * @brief Creates a copy of the constant
+ *
+ * @return A pointer to a copy of the constant
+ */
+ossimTerm* ossimConst::copy() const{
+ return new ossimConst(val);
+}
\ No newline at end of file
diff --git a/src/elevation/ossimSrtmFactory.cpp b/src/elevation/ossimSrtmFactory.cpp
index 32e8be1..f4f1751 100644
--- a/src/elevation/ossimSrtmFactory.cpp
+++ b/src/elevation/ossimSrtmFactory.cpp
@@ -119,10 +119,9 @@ ossimElevSource* ossimSrtmFactory::getNewElevSource(const ossimGpt& gpt) const
<< "\nSearching for file: " << srtmFile
<< std::endl;
}
-
// ossimRefPtr<ossimIFStream> is = ossimStreamFactoryRegistry::instance()->
- std::shared_ptr<ossim::ifstream> is = ossimStreamFactoryRegistry::instance()->
- createIFStream(srtmFile, std::ios::in | std::ios::binary);
+ std::shared_ptr<ossim::istream> is = ossim::StreamFactoryRegistry::instance()->
+ createIstream(srtmFile);
// Look for the file mix case, then all lower case, then all upper case.
if ( is )
@@ -133,8 +132,8 @@ ossimElevSource* ossimSrtmFactory::getNewElevSource(const ossimGpt& gpt) const
srtmFileBasename = srtmFileBasename.downcase();
srtmFile = theDirectory.dirCat(srtmFileBasename);
- is = ossimStreamFactoryRegistry::instance()->
- createIFStream(srtmFile, std::ios::in | std::ios::binary);
+ is = ossim::StreamFactoryRegistry::instance()->
+ createIstream(srtmFile);
if ( is )
{
if(is->fail())
@@ -142,8 +141,8 @@ ossimElevSource* ossimSrtmFactory::getNewElevSource(const ossimGpt& gpt) const
// OK, try upcasing the whole thing.
srtmFileBasename = srtmFileBasename.upcase();
srtmFile = theDirectory.dirCat(srtmFileBasename);
- is = ossimStreamFactoryRegistry::instance()->
- createIFStream(srtmFile, std::ios::in | std::ios::binary);
+ is = ossim::StreamFactoryRegistry::instance()->
+ createIstream(srtmFile);
}
}
}
@@ -151,7 +150,6 @@ ossimElevSource* ossimSrtmFactory::getNewElevSource(const ossimGpt& gpt) const
if ( is && (!is->fail()) )
{
- // is->close();
is.reset();
srtmPtr = new ossimSrtmHandler();
if(srtmPtr->open(srtmFile)&&srtmPtr->pointHasCoverage(gpt) )
diff --git a/src/imaging/ossimGeneralRasterTileSource.cpp b/src/imaging/ossimGeneralRasterTileSource.cpp
index 1b2ab31..ad78b55 100644
--- a/src/imaging/ossimGeneralRasterTileSource.cpp
+++ b/src/imaging/ossimGeneralRasterTileSource.cpp
@@ -919,8 +919,8 @@ bool ossimGeneralRasterTileSource::initializeHandler()
ossimFilename f = aList[i];
// open it...
- std::shared_ptr<ossim::ifstream> is = ossimStreamFactoryRegistry::instance()->
- createIFStream(f, std::ios::in|std::ios::binary);
+ std::shared_ptr<ossim::istream> is = ossim::StreamFactoryRegistry::instance()->
+ createIstream(f);
// check the stream...
if( is )
@@ -1019,12 +1019,11 @@ void ossimGeneralRasterTileSource::close()
m_lineBuffer = 0;
}
- std::vector< shared_ptr<ossim::ifstream> >::iterator is = m_fileStrList.begin();
+ std::vector< shared_ptr<ossim::istream> >::iterator is = m_fileStrList.begin();
while (is != m_fileStrList.end())
{
- (*is)->close();
- // delete (*is);
- // (*is) = 0;
+ (*is) = 0;
+
++is;
}
m_fileStrList.clear();
diff --git a/src/imaging/ossimImageGeometry.cpp b/src/imaging/ossimImageGeometry.cpp
index 1be6b76..8ce8f57 100644
--- a/src/imaging/ossimImageGeometry.cpp
+++ b/src/imaging/ossimImageGeometry.cpp
@@ -1472,7 +1472,8 @@ bool ossimImageGeometry::computeGroundToImagePartials(NEWMAT::Matrix& result,
return false;
}
-ossim_float64 ossimImageGeometry::upIsUpAngle() const
+
+ossim_float64 ossimImageGeometry::upIsUpAngle(const ossimDpt& pt) const
{
ossim_float64 result = ossim::nan();
@@ -1490,15 +1491,19 @@ ossim_float64 ossimImageGeometry::upIsUpAngle() const
if( !bounds.hasNans() )
{
- ossim_float64 widthPercent = bounds.width()*.1;
- ossim_float64 heightPercent = bounds.height()*.1;
+ // only need an average
+ // so will keep the test close to the pixel location
+ // we are sampling
+ // let's get rid of the scale
+ ossim_float64 widthPercent = 1;//bounds.width()*.1;
+ ossim_float64 heightPercent = 1;//bounds.height()*.1;
//---
// Sanity check to make sure that taking 10 percent out on the image
// gets us to at least 1 pixel away.
//---
- if(widthPercent < 1.0) widthPercent = 1.0;
- if(heightPercent < 1.0) heightPercent = 1.0;
+ // if(widthPercent < 1.0) widthPercent = 1.0;
+ // if(heightPercent < 1.0) heightPercent = 1.0;
// set up some work variables to help calculate the average partial
//
@@ -1507,9 +1512,11 @@ ossim_float64 ossimImageGeometry::upIsUpAngle() const
std::vector<ossimDpt> iptsDisplacement(NUMBER_OF_SAMPLES);
std::vector<ossimDpt> partials(NUMBER_OF_SAMPLES);
ossimDpt averageDelta(0.0,0.0);
-
- ossimDpt centerIpt = bounds.midPoint();
-
+ ossimDpt centerIpt = pt;
+ if(centerIpt.hasNans())
+ {
+ centerIpt = bounds.midPoint();
+ }
//---
// Lets take an average displacement about the center point (3x3 grid)
// we will go 10 percent out of the width and height of the image and
@@ -1600,6 +1607,35 @@ ossim_float64 ossimImageGeometry::upIsUpAngle() const
} // Matches: if ( m_projection.valid() && m_projection->isAffectedByElevation() )
return result;
+
+}
+
+
+ossim_float64 ossimImageGeometry::upIsUpAngle() const
+{
+ ossim_float64 result = ossim::nan();
+
+ if ( m_projection.valid() )
+ {
+ if ( m_projection->isAffectedByElevation() )
+ {
+
+ ossimDrect bounds;
+ getBoundingRect( bounds );
+
+ if( !bounds.hasNans() )
+ {
+ return upIsUpAngle(bounds.midPoint());
+ }
+ }
+ else
+ {
+ result = 0;
+ }
+
+ } // Matches: if ( m_projection.valid() && m_projection->isAffectedByElevation() )
+
+ return result;
} // End: ossimImageGeometry::upIsUpAngle()
diff --git a/src/imaging/ossimImageRenderer.cpp b/src/imaging/ossimImageRenderer.cpp
index f89595d..7a388b4 100644
--- a/src/imaging/ossimImageRenderer.cpp
+++ b/src/imaging/ossimImageRenderer.cpp
@@ -2471,8 +2471,8 @@ void ossimImageRenderer::refreshEvent(ossimRefreshEvent& event)
(event.getRefreshType() & ossimRefreshEvent::REFRESH_GEOMETRY))
{
ossimRefPtr<ossimImageGeometry> inputGeom =
- theInputConnection?theInputConnection->getImageGeometry():0;
- if(inputGeom.valid())
+ theInputConnection?theInputConnection->getImageGeometry().get():0;
+ if(inputGeom)
{
ossimImageViewProjectionTransform* ivpt =
dynamic_cast<ossimImageViewProjectionTransform*>(m_ImageViewTransform.get());
diff --git a/src/imaging/ossimLasReader.cpp b/src/imaging/ossimLasReader.cpp
index de8e68d..d338a48 100644
--- a/src/imaging/ossimLasReader.cpp
+++ b/src/imaging/ossimLasReader.cpp
@@ -1,4 +1,4 @@
-//----------------------------------------------------------------------------
+//---
//
// File: ossimLasReader.cpp
//
@@ -10,7 +10,7 @@
//
// Description: OSSIM LAS LIDAR reader.
//
-//----------------------------------------------------------------------------
+//---
// $Id$
#include <ossim/imaging/ossimLasReader.h>
@@ -208,8 +208,6 @@ bool ossimLasReader::getTile(ossimImageData* result, ossim_uint32 resLevel)
const ossim_int32 TILE_WIDTH = static_cast<ossim_int32>(TILE_RECT.width());
const ossim_int32 TILE_SIZE = static_cast<ossim_int32>(TILE_RECT.area());
- const ossim_uint16 ENTRY = m_entry;
-
// Get the scale for this resLevel:
ossimDpt scale;
getScale(scale, resLevel);
@@ -265,33 +263,33 @@ bool ossimLasReader::getTile(ossimImageData* result, ossim_uint32 resLevel)
//if ( lasPtRec->getReturnNumber() == ENTRY )
//{
- lasPt.x = lasPtRec->getX() * SCALE_X + OFFSET_X;
- lasPt.y = lasPtRec->getY() * SCALE_Y + OFFSET_Y;
- if ( m_unitConverter )
- {
- convertToMeters(lasPt.x);
- convertToMeters(lasPt.y);
- }
- if ( PROJ_RECT.pointWithin( lasPt ) )
- {
- // Compute the bucket index:
- ossim_int32 line = static_cast<ossim_int32>((UL_PROG_PT.y - lasPt.y) / scale.y);
- ossim_int32 samp = static_cast<ossim_int32>((lasPt.x - UL_PROG_PT.x) / scale.x );
- ossim_int32 bucketIndex = line * TILE_WIDTH + samp;
+ lasPt.x = lasPtRec->getX() * SCALE_X + OFFSET_X;
+ lasPt.y = lasPtRec->getY() * SCALE_Y + OFFSET_Y;
+ if ( m_unitConverter )
+ {
+ convertToMeters(lasPt.x);
+ convertToMeters(lasPt.y);
+ }
+ if ( PROJ_RECT.pointWithin( lasPt ) )
+ {
+ // Compute the bucket index:
+ ossim_int32 line = static_cast<ossim_int32>((UL_PROG_PT.y - lasPt.y) / scale.y);
+ ossim_int32 samp = static_cast<ossim_int32>((lasPt.x - UL_PROG_PT.x) / scale.x );
+ ossim_int32 bucketIndex = line * TILE_WIDTH + samp;
- // Range check and add if in there.
- if ( ( bucketIndex >= 0 ) && ( bucketIndex < TILE_SIZE ) )
- {
- ossim_float64 z = lasPtRec->getZ() * SCALE_Z + OFFSET_Z;
- if ( m_unitConverter ) convertToMeters(z);
- bucket[bucketIndex].add( z );
- bucket[bucketIndex].setRed(lasPtRec->getRed());
- bucket[bucketIndex].setGreen(lasPtRec->getGreen());
- bucket[bucketIndex].setBlue(lasPtRec->getBlue());
- bucket[bucketIndex].setIntensity(lasPtRec->getIntensity());
+ // Range check and add if in there.
+ if ( ( bucketIndex >= 0 ) && ( bucketIndex < TILE_SIZE ) )
+ {
+ ossim_float64 z = lasPtRec->getZ() * SCALE_Z + OFFSET_Z;
+ if ( m_unitConverter ) convertToMeters(z);
+ bucket[bucketIndex].add( z );
+ bucket[bucketIndex].setRed(lasPtRec->getRed());
+ bucket[bucketIndex].setGreen(lasPtRec->getGreen());
+ bucket[bucketIndex].setBlue(lasPtRec->getBlue());
+ bucket[bucketIndex].setIntensity(lasPtRec->getIntensity());
- }
}
+ }
//}
if ( m_str.eof() ) break;
}
@@ -307,37 +305,37 @@ bool ossimLasReader::getTile(ossimImageData* result, ossim_uint32 resLevel)
//ossim_float32* buf = result->getFloatBuf(); // Tile buffer to fill.
if(m_entry == 1)
{
- ossim_uint32 BANDS = getNumberOfOutputBands();
- std::vector<ossim_uint16> tempBuf(TILE_SIZE * BANDS);
- ossim_uint16* buffer = &tempBuf.front();
- for (ossim_int32 band = 0; band < BANDS; ++band)
- {
- for (ossim_int32 i = 0; i < TILE_SIZE; ++i)
- {
- if(band == 0) buffer[i] = bucket[i].getRed();
- if(band == 1) buffer[i] = bucket[i].getGreen();
- if(band == 2) buffer[i] = bucket[i].getBlue();
- }
- }
- result->loadTile(buffer, TILE_RECT, TILE_RECT, OSSIM_BIP);
+ const ossim_uint32 BANDS = getNumberOfOutputBands();
+ std::vector<ossim_uint16> tempBuf(TILE_SIZE * BANDS);
+ ossim_uint16* buffer = &tempBuf.front();
+ for (ossim_uint32 band = 0; band < BANDS; ++band)
+ {
+ for (ossim_int32 i = 0; i < TILE_SIZE; ++i)
+ {
+ if(band == 0) buffer[i] = bucket[i].getRed();
+ if(band == 1) buffer[i] = bucket[i].getGreen();
+ if(band == 2) buffer[i] = bucket[i].getBlue();
+ }
+ }
+ result->loadTile(buffer, TILE_RECT, TILE_RECT, OSSIM_BIP);
}
else if (m_entry == 2)
{
- ossim_uint16* buf = result->getUshortBuf();
- for (ossim_int32 i = 0; i < TILE_SIZE; ++i)
- {
- buf[i] = bucket[i].getIntensity();
- }
+ ossim_uint16* buf = result->getUshortBuf();
+ for (ossim_int32 i = 0; i < TILE_SIZE; ++i)
+ {
+ buf[i] = bucket[i].getIntensity();
+ }
}
else
{
- ossim_float32* buf = result->getFloatBuf();
+ ossim_float32* buf = result->getFloatBuf();
- // Fill the tile. Currently no band loop:
- for (ossim_int32 i = 0; i < TILE_SIZE; ++i)
- {
- buf[i] = bucket[i].getValue();
- }
+ // Fill the tile. Currently no band loop:
+ for (ossim_int32 i = 0; i < TILE_SIZE; ++i)
+ {
+ buf[i] = bucket[i].getValue();
+ }
}
// Revalidate.
@@ -690,13 +688,17 @@ bool ossimLasReader::init()
}
}
- // There is nothing we can do if parseVarRecords fails.
- // VAR record is optional, so guess the projection
- // Moved to setCurrentEntry
- //if ( result )
- //{
- // initTile();
- //}
+ if ( !result )
+ {
+ // Check for option var record.
+ result = parseVarRecords();
+
+ if ( !result )
+ {
+ // Checks for external FGDC text file.
+ result = initFromExternalMetadata();
+ }
+ }
}
return result;
@@ -1287,4 +1289,4 @@ void ossimLasReader::setGsd( const ossim_float64& gsd )
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/imaging/ossimNitfTileSource.cpp b/src/imaging/ossimNitfTileSource.cpp
index 125a30a..1646b0b 100644
--- a/src/imaging/ossimNitfTileSource.cpp
+++ b/src/imaging/ossimNitfTileSource.cpp
@@ -175,14 +175,17 @@ bool ossimNitfTileSource::open()
theErrorStatus = ossimErrorCodes::OSSIM_OK;
- if ( parseFile() )
- {
- result = allocate();
- }
- if (result)
- {
- completeOpen();
- }
+ std::shared_ptr<ossim::istream> nitfStream= ossim::StreamFactoryRegistry::instance()->createIstream(getFilename().c_str());
+
+ result = open(nitfStream, getFilename().c_str());
+ // if ( parseFile() )
+ // {
+ // result = allocate();
+ // }
+ // if (result)
+ // {
+ // completeOpen();
+ // }
return result;
}
diff --git a/src/imaging/ossimNitfWriter.cpp b/src/imaging/ossimNitfWriter.cpp
index a123d38..f5317c4 100644
--- a/src/imaging/ossimNitfWriter.cpp
+++ b/src/imaging/ossimNitfWriter.cpp
@@ -887,8 +887,10 @@ void ossimNitfWriter::addDataExtensionSegment(const ossimNitfDataExtensionSegmen
if (allowTreOverflow == false)
{
ossimRefPtr<ossimProperty> pId = des.getProperty(ossimNitfDataExtensionSegmentV2_1::DESID_KW);
- if (pId == NULL || pId->valueToString() == "TRE_OVERFLOW" ||
- pId->valueToString() == "REGISTERED EXTENSIONS" || pId->valueToString() == "CONTROLLED EXTENSIONS")
+ if ( !pId ||
+ (pId->valueToString() == "TRE_OVERFLOW") ||
+ (pId->valueToString() == "REGISTERED EXTENSIONS") ||
+ (pId->valueToString() == "CONTROLLED EXTENSIONS"))
{
return;
}
diff --git a/src/imaging/ossimTiffTileSource.cpp b/src/imaging/ossimTiffTileSource.cpp
index ed270ad..c28836d 100644
--- a/src/imaging/ossimTiffTileSource.cpp
+++ b/src/imaging/ossimTiffTileSource.cpp
@@ -132,6 +132,12 @@ toff_t tiff_Seek(thandle_t st,toff_t pos, int whence)
TiffStreamAdaptor* streamAdaptor = (TiffStreamAdaptor*)st;
toff_t result = -1;
std::ios_base::seekdir seekDir = std::ios::beg;
+
+ // Because we are adapting, on each seek we need to clear our previous error so
+ // we can continue on. Do not want the stream to stay in a failed state.
+ //
+ streamAdaptor->m_tiffStream->clear();
+
// std::cout << "SIZE OF POS =============== " << sizeof(toff_t) << std::endl;
// std::cout << "tiff_Seek POS =============== " << pos << std::endl;
//std::cout<< "CALLING THE tiff_Seek!!!!!!!!!!!!!!\n" << std::endl;
diff --git a/src/imaging/ossimTilingPoly.cpp b/src/imaging/ossimTilingPoly.cpp
index 61ddc56..3a5a7eb 100644
--- a/src/imaging/ossimTilingPoly.cpp
+++ b/src/imaging/ossimTilingPoly.cpp
@@ -145,7 +145,7 @@ bool ossimTilingPoly::loadState(const ossimKeywordlist& kwl,
bool ossimTilingPoly::nextFeature()
{
- if (m_exteriorCut == 0)
+ if (!m_exteriorCut)
{
m_exteriorCut = new ossimGeoPolyCutter;
m_exteriorCut->setView(theMapProjection.get());
@@ -159,7 +159,7 @@ bool ossimTilingPoly::nextFeature()
{
if (m_features[tileId].m_polyType == ossimGeoAnnotationPolyObject::OSSIM_POLY_INTERIOR_RING)
{
- if (m_interiorCut == 0)
+ if (!m_interiorCut)
{
m_interiorCut = new ossimGeoPolyCutter;
m_interiorCut->setView(theMapProjection.get());
@@ -187,7 +187,7 @@ bool ossimTilingPoly::nextFeature()
std::vector<ossimGeoPolygon> holePolys = geoPoly.getHoleList();
if (holePolys.size() > 0)
{
- if (m_interiorCut == 0)
+ if (!m_interiorCut)
{
m_interiorCut = new ossimGeoPolyCutter;
m_interiorCut->setView(theMapProjection.get());
diff --git a/src/init/ossimInit.cpp b/src/init/ossimInit.cpp
index 12167ee..0a3fd0b 100644
--- a/src/init/ossimInit.cpp
+++ b/src/init/ossimInit.cpp
@@ -142,9 +142,6 @@ void ossimInit::initialize(ossimArgumentParser& parser)
theInstance->parseEnvOptions(parser);
theInstance->parseNotifyOption(parser);
theInstance->parsePrefsOptions(parser);
- // Stream factories must be initialized before call to: ossimPreferences::instance()
- ossim::StreamFactoryRegistry::instance()->registerFactory(ossim::StreamFactory::instance());
- ossimStreamFactoryRegistry::instance()->registerFactory(ossimStreamFactory::instance());
theInstance->theAppName = parser.getApplicationUsage()->getApplicationName();
@@ -525,6 +522,8 @@ void ossimInit::removeOption(int& argc,
void ossimInit::initializeDefaultFactories()
{
+ ossim::StreamFactoryRegistry::instance()->registerFactory(ossim::StreamFactory::instance());
+
ossimObjectFactoryRegistry::instance()->registerFactory(ossimImageSourceFactoryRegistry::instance());
//---
diff --git a/src/parallel/ossimImageChainMtAdaptor.cpp b/src/parallel/ossimImageChainMtAdaptor.cpp
index 4bad7fc..19f1c89 100644
--- a/src/parallel/ossimImageChainMtAdaptor.cpp
+++ b/src/parallel/ossimImageChainMtAdaptor.cpp
@@ -190,7 +190,7 @@ bool ossimImageChainMtAdaptor::replicate()
{
// Fetch a handler from the chain and wrap it with a handler adaptor:
handler = visitor.getObjectAs<ossimImageHandler>(handler_idx++);
- if (handler == NULL)
+ if (!handler)
break; // Only exit point of while loop
handler_adaptor = new ossimImageHandlerMtAdaptor(handler.get(), d_useCache, d_cacheTileSize);
@@ -347,7 +347,7 @@ bool ossimImageChainMtAdaptor::loadState(const ossimKeywordlist& kwl, const char
candidate = visitor.getObject();
m_chainContainers[i]->makeUniqueIds();
ossimRefPtr<ossimImageSource> clone_source = dynamic_cast<ossimImageSource*>(candidate);
- if (clone_source == NULL)
+ if (!clone_source)
return false;
m_clones.push_back(clone_source);
}
diff --git a/src/sockets/ossimToolServer.cpp b/src/sockets/ossimToolServer.cpp
index 6ce88e1..870c740 100644
--- a/src/sockets/ossimToolServer.cpp
+++ b/src/sockets/ossimToolServer.cpp
@@ -40,6 +40,7 @@
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/tcp.h>
+#include <netinet/in.h>
#endif
@@ -168,7 +169,7 @@ void ossimToolServer::initSocket(const char* portid)
if (setsockopt(m_svrsockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof yes) == -1)
error("Error on setsockopt() call");
-#ifdef __APPLE__
+#if defined (__APPLE__) || defined(__FreeBSD__)
int bindResult = ::bind(m_svrsockfd, server_info->ai_addr, server_info->ai_addrlen);
#else
int bindResult = bind(m_svrsockfd, server_info->ai_addr, server_info->ai_addrlen);
diff --git a/src/support_data/ossimSrtmSupportData.cpp b/src/support_data/ossimSrtmSupportData.cpp
index 0d066d9..e7fc161 100644
--- a/src/support_data/ossimSrtmSupportData.cpp
+++ b/src/support_data/ossimSrtmSupportData.cpp
@@ -76,8 +76,8 @@ bool ossimSrtmSupportData::setFilename(const ossimFilename& srtmFile,
<< std::endl;
}
- m_str = ossimStreamFactoryRegistry::instance()->
- createIFStream(m_file, std::ios_base::in | std::ios_base::binary);
+ m_str = ossim::StreamFactoryRegistry::instance()->
+ createIstream(m_file);
if (m_str)
{
if(m_str->fail())
@@ -165,10 +165,11 @@ bool ossimSrtmSupportData::setFilename(const ossimFilename& srtmFile,
kwl.write(omdFile);
}
- if(m_str->is_open())
- {
- m_str->close();
- }
+ m_str = 0;
+ // if(m_str->is_open())
+ // {
+ // m_str->close();
+ // }
if (traceDebug())
{
@@ -669,11 +670,10 @@ bool ossimSrtmSupportData::setSize()
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimSrtmSupportData::setSize(): entered..." << std::endl;
}
-
- if(m_str->is_open() == false)
+ if(!m_str)
{
- m_str = ossimStreamFactoryRegistry::instance()->createIFStream(
- m_file, std::ios_base::in | std::ios_base::binary);
+ m_str = ossim::StreamFactoryRegistry::instance()->createIstream(
+ m_file);
}
if (!m_str)
@@ -812,7 +812,7 @@ bool ossimSrtmSupportData::setSize()
<< std::endl;
}
- m_str->close();
+ m_str=0;
return true;
}
@@ -832,12 +832,12 @@ template <class T>
bool ossimSrtmSupportData::computeMinMaxTemplate(T /* dummy */,
double defaultNull)
{
- if(m_str->is_open() == false)
+
+ if(!m_str)
{
m_str =
- ossimStreamFactoryRegistry::instance()->createIFStream(
- m_file,
- std::ios_base::in | std::ios_base::binary);
+ ossim::StreamFactoryRegistry::instance()->createIstream(
+ m_file);
}
if (!m_str)
@@ -878,8 +878,7 @@ bool ossimSrtmSupportData::computeMinMaxTemplate(T /* dummy */,
m_minPixelValue = minValue;
m_maxPixelValue = maxValue;
- m_str->close();
-
+ m_str = 0;
return true;
}
diff --git a/src/support_data/ossimTiffInfo.cpp b/src/support_data/ossimTiffInfo.cpp
index 6f7f989..99b9c8b 100644
--- a/src/support_data/ossimTiffInfo.cpp
+++ b/src/support_data/ossimTiffInfo.cpp
@@ -402,7 +402,6 @@ std::ostream& ossimTiffInfo::print(std::ostream& out) const
m_inputStream.reset();
return out;
}
-
// Get the array size in bytes.
arraySizeInBytes = getArraySizeInBytes(count, type);
if (arraySizeInBytes == 0)
diff --git a/src/util/ossimChipperUtil.cpp b/src/util/ossimChipperUtil.cpp
index 344bb19..2694e6d 100644
--- a/src/util/ossimChipperUtil.cpp
+++ b/src/util/ossimChipperUtil.cpp
@@ -1086,7 +1086,10 @@ ossimRefPtr<ossimImageSource> ossimChipperUtil::initializeChain( ossimIrect& aoi
// the ossimImageGeometry::worldToLocal call for a geographic projection to handle wrapping
// accross the date line.
//---
- m_geom->setImageSize( aoi.size() );
+ if(m_geom.valid())
+ {
+ m_geom->setImageSize( aoi.size() );
+ }
if ( hasThumbnailResolution() )
{
@@ -1771,167 +1774,166 @@ ossimRefPtr<ossimSingleImageChain> ossimChipperUtil::createChain(const ossimFile
ossimRefPtr<ossimSingleImageChain> ic = 0;
- if ( file.size() )
+ if ( !file.empty()&&file.exists() )
{
- // ossimFilename::exists() currently does not work with s3 url's.
- // if ( file.exists() )
- if ( 1 )
- {
- ic = new ossimSingleImageChain;
- if ( ic->open( file ) )
- {
- // Set any reader props:
- setReaderProps( ic->getImageHandler().get() );
-
- // we can't guarantee the state of the image handler at this point so
- // let's make sure that the entry is always set to the requested location
- // On Cib/Cadrg we were having problems. Removed the compare for entry 0
- //
-
- if ( setChainEntry( ic, entryIndex ) == false )
- {
- std::ostringstream errMsg;
- errMsg << MODULE << " ERROR:\nEntry " << entryIndex << " out of range!"
- << std::endl;
- throw ossimException( errMsg.str() );
- }
-
- //---
- // If PSM (pan sharpening) operation and this input is one band, don't
- // mess with its bands.
- //---
- bool psmPanInput = false;
- if ( ( m_operation == OSSIM_CHIPPER_OP_PSM ) && ( ic->getNumberOfOutputBands() == 1 ) )
- {
- psmPanInput = true;
- }
-
- // Bands selection. Note: Not performed on PSM pan band.
- if ( !psmPanInput )
- {
- if ( isThreeBandOut() )
- {
- //---
- // This will guarantee three bands out. Will put band
- // selector at the end of the chain if input is one band. If input image
- // handler has implemented a getRgbBandlist(...) it will also set the
- // rgb band order.
- //---
- ic->setThreeBandFlag( true );
- }
-
- if ( hasBandSelection() )
- {
- // User entered band list.
- std::vector<ossim_uint32> bandList(0);
- getBandList( bandList );
- if ( bandList.size() )
- {
- ic->setBandSelection( bandList );
- }
- else
- {
- ic->setDefaultBandSelection();
- }
- }
- }
-
- //---
- // If multiple inputs and scaleToEightBit do it at the end of the processing
- // chain to alleviate un-even stretches between inputs.
- //---
- const ossim_uint32 INPUT_COUNT = getNumberOfInputs();
- bool scaleFlag = ( scaleToEightBit() && (INPUT_COUNT == 1) );
- ic->setRemapToEightBitFlag( scaleFlag );
-
- // Always have resampler cache.
- ic->setAddResamplerCacheFlag(true);
-
- //---
- // Don't need a chain cache as we're doing a sequential write. So the same tile
- // should never be visited more than once.
- //---
- ic->setAddChainCacheFlag(false);
-
- //---
- // Histogram:
- // Don't apply histogram stretch to dem sources for hill shade
- // operation.
- //---
- if ( ( isDemSource == false ) ||
- ( isDemSource && (m_operation != OSSIM_CHIPPER_OP_HILL_SHADE) ) )
- {
- ic->setAddHistogramFlag( hasHistogramOperation() );
- }
-
- // Brightness, contrast. Note in same filter.
- if ( hasBrightnesContrastOperation() )
- {
- ic->setBrightnessContrastFlag(true);
- }
-
- std::string sharpnessMode = getSharpenMode();
- if ( sharpnessMode.size() )
- {
- ic->setSharpenFlag(true);
- }
-
- // Create the chain.
- ic->createRenderedChain();
-
- // Set the filter type if needed.
- ossimString lookup = m_kwl->findKey( RESAMPLER_FILTER_KW );
- if ( lookup.size() )
- {
- // Assumption image renderer is in chain:
- ic->getImageRenderer()->getResampler()->setFilterType( lookup );
- }
-
- // Histogram setup.
- if ( hasHistogramOperation() )
- {
- setupChainHistogram( ic );
- }
-
- // Brightness constrast setup:
- if ( hasBrightnesContrastOperation() )
- {
- // Assumption bright contrast filter in chain:
-
- ossim_float64 value = getBrightness();
- ic->getBrightnessContrast()->setBrightness( value );
+ ic = new ossimSingleImageChain;
+ if ( ic->open( file ) )
+ {
+ // Set any reader props:
+ setReaderProps( ic->getImageHandler().get() );
- value = getContrast();
- ic->getBrightnessContrast()->setContrast( value );
- }
+ // we can't guarantee the state of the image handler at this point so
+ // let's make sure that the entry is always set to the requested location
+ // On Cib/Cadrg we were having problems. Removed the compare for entry 0
+ //
- // Sharpness:
- if ( sharpnessMode.size() )
- {
- if ( sharpnessMode == "light" )
- {
- ic->getSharpenFilter()->setWidthAndSigma( 3, 0.5 );
- }
- else if ( sharpnessMode == "heavy" )
- {
- ic->getSharpenFilter()->setWidthAndSigma( 5, 1.0 );
- }
- }
-
- if(hasGeoPolyCutterOption())
- {
- ossimGeoPolygon polygon;
- getClipPolygon(polygon);
- if(polygon.size()>0)
- {
- ic->addGeoPolyCutterPolygon(polygon);
- }
- }
+ if ( setChainEntry( ic, entryIndex ) == false )
+ {
+ std::ostringstream errMsg;
+ errMsg << MODULE << " ERROR:\nEntry " << entryIndex << " out of range!"
+ << std::endl;
+ throw ossimException( errMsg.str() );
}
- }
- }
- if ( ic.valid() == false )
+ //---
+ // If PSM (pan sharpening) operation and this input is one band, don't
+ // mess with its bands.
+ //---
+ bool psmPanInput = false;
+ if ( ( m_operation == OSSIM_CHIPPER_OP_PSM ) && ( ic->getNumberOfOutputBands() == 1 ) )
+ {
+ psmPanInput = true;
+ }
+
+ // Bands selection. Note: Not performed on PSM pan band.
+ if ( !psmPanInput )
+ {
+ if ( isThreeBandOut() )
+ {
+ //---
+ // This will guarantee three bands out. Will put band
+ // selector at the end of the chain if input is one band. If input image
+ // handler has implemented a getRgbBandlist(...) it will also set the
+ // rgb band order.
+ //---
+ ic->setThreeBandFlag( true );
+ }
+
+ if ( hasBandSelection() )
+ {
+ // User entered band list.
+ std::vector<ossim_uint32> bandList(0);
+ getBandList( bandList );
+ if ( bandList.size() )
+ {
+ ic->setBandSelection( bandList );
+ }
+ else
+ {
+ ic->setDefaultBandSelection();
+ }
+ }
+ }
+
+ //---
+ // If multiple inputs and scaleToEightBit do it at the end of the processing
+ // chain to alleviate un-even stretches between inputs.
+ //---
+ const ossim_uint32 INPUT_COUNT = getNumberOfInputs();
+ bool scaleFlag = ( scaleToEightBit() && (INPUT_COUNT == 1) );
+ ic->setRemapToEightBitFlag( scaleFlag );
+
+ // Always have resampler cache.
+ ic->setAddResamplerCacheFlag(true);
+
+ //---
+ // Don't need a chain cache as we're doing a sequential write. So the same tile
+ // should never be visited more than once.
+ //---
+ ic->setAddChainCacheFlag(false);
+
+ //---
+ // Histogram:
+ // Don't apply histogram stretch to dem sources for hill shade
+ // operation.
+ //---
+ if ( ( isDemSource == false ) ||
+ ( isDemSource && (m_operation != OSSIM_CHIPPER_OP_HILL_SHADE) ) )
+ {
+ ic->setAddHistogramFlag( hasHistogramOperation() );
+ }
+
+ // Brightness, contrast. Note in same filter.
+ if ( hasBrightnesContrastOperation() )
+ {
+ ic->setBrightnessContrastFlag(true);
+ }
+
+ std::string sharpnessMode = getSharpenMode();
+ if ( sharpnessMode.size() )
+ {
+ ic->setSharpenFlag(true);
+ }
+
+ // Create the chain.
+ ic->createRenderedChain();
+
+ // Set the filter type if needed.
+ ossimString lookup = m_kwl->findKey( RESAMPLER_FILTER_KW );
+ if ( lookup.size() )
+ {
+ // Assumption image renderer is in chain:
+ ic->getImageRenderer()->getResampler()->setFilterType( lookup );
+ }
+
+ // Histogram setup.
+ if ( hasHistogramOperation() )
+ {
+ setupChainHistogram( ic );
+ }
+
+ // Brightness constrast setup:
+ if ( hasBrightnesContrastOperation() )
+ {
+ // Assumption bright contrast filter in chain:
+
+ ossim_float64 value = getBrightness();
+ ic->getBrightnessContrast()->setBrightness( value );
+
+ value = getContrast();
+ ic->getBrightnessContrast()->setContrast( value );
+ }
+
+ // Sharpness:
+ if ( sharpnessMode.size() )
+ {
+ if ( sharpnessMode == "light" )
+ {
+ ic->getSharpenFilter()->setWidthAndSigma( 3, 0.5 );
+ }
+ else if ( sharpnessMode == "heavy" )
+ {
+ ic->getSharpenFilter()->setWidthAndSigma( 5, 1.0 );
+ }
+ }
+
+ if(hasGeoPolyCutterOption())
+ {
+ ossimGeoPolygon polygon;
+ getClipPolygon(polygon);
+ if(polygon.size()>0)
+ {
+ ic->addGeoPolyCutterPolygon(polygon);
+ }
+ }
+ }
+ else
+ {
+ ic = 0;
+ }
+ }
+
+ if ( !ic.valid())
{
std::string errMsg = "Could not open: ";
errMsg += file.string();
diff --git a/src/util/ossimInfo.cpp b/src/util/ossimInfo.cpp
index 35bae2b..09e4430 100644
--- a/src/util/ossimInfo.cpp
+++ b/src/util/ossimInfo.cpp
@@ -94,7 +94,9 @@ static const char RAD2DEG_KW[] = "rad2deg";
static const char READER_PROPS_KW[] = "reader_props";
static const char RESAMPLER_FILTERS_KW[] = "resampler_filters";
static const char REVISION_NUMBER_KW[] = "revision_number";
-static const char UP_IS_UP_KW[] = "up_is_up_angle";
+static const char UP_IS_UP_KW[] = "up_is_up";
+static const char UP_IS_UP_GPT_KW[] = "up_is_up_gpt";
+static const char UP_IS_UP_IPT_KW[] = "up_is_up_ipt";
static const char VERSION_KW[] = "version";
static const char WRITERS_KW[] = "writers_kw";
static const char WRITER_PROPS_KW[] = "writer_props";
@@ -207,8 +209,9 @@ void ossimInfo::setUsage(ossimArgumentParser& ap)
au->addCommandLineOption("-s", "Force the ground rect to be the specified datum");
- au->addCommandLineOption("-u or --up-is-up", "Rotation angle to \"up is up\" for an image.\nWill return 0 if image's projection is not affected by elevation.");
-
+ au->addCommandLineOption("--up-is-up or -u", "Rotation angle to \"up is up\" for an image.\nWill return 0 if image's projection is not affected by elevation.");
+ au->addCommandLineOption("--up-is-up-gpt", "Computes up angle given gpt: <lat> <lon>");
+ au->addCommandLineOption("--up-is-up-ipt", "Computes up angle given full res image point: <x> <y>");
au->addCommandLineOption("-v", "Overwrite existing geometry.");
au->addCommandLineOption("-V or --vesion", "Version of code, e.g. 1.8.20");
@@ -218,8 +221,6 @@ void ossimInfo::setUsage(ossimArgumentParser& ap)
au->addCommandLineOption("--writers", "Prints list of available writers.");
au->addCommandLineOption("--zoom-level-gsds", "Prints zoom level gsds for projections EPSG:4326 and EPSG:3857.");
- au->addCommandLineOption("--image-to-ground", "Takes a 3 tuple of the form x y res where x and y are image coordinates and res is the resolution. res = 0 is full resolution");
- au->addCommandLineOption("--ground-to-image", "Takes a 2 or 3 tuple of the form lat lon h where x and y are image coordinates and res is the resolution");
ostringstream description;
description << DESCRIPTION << "\n\n Examples:\n\n"
@@ -408,7 +409,7 @@ bool ossimInfo::initialize(ossimArgumentParser& ap)
break;
}
}
-
+
if( ap.read("--fonts") )
{
m_kwl.add( FONTS_KW, TRUE_KW );
@@ -475,6 +476,7 @@ bool ossimInfo::initialize(ossimArgumentParser& ap)
if( ap.read("--img2grd", sp1, sp2) )
{
+ requiresInputImage = true;
ossimString x = ts1;
ossimString y = ts2;
ossimDpt dpt;
@@ -489,6 +491,7 @@ bool ossimInfo::initialize(ossimArgumentParser& ap)
if( ap.read("--grd2img", sp1, sp2, sp3) )
{
+ requiresInputImage = true;
ossimString lat = ts1;
ossimString lon = ts2;
ossimString hgt = ts3;
@@ -657,7 +660,7 @@ bool ossimInfo::initialize(ossimArgumentParser& ap)
}
if( ap.read("--revision") ||
- ap.read("--revision-number") ) // backwards compat
+ ap.read("--revision-number") ) // backwards compat
{
m_kwl.add( REVISION_NUMBER_KW, TRUE_KW );
if ( ap.argc() < 2 )
@@ -668,13 +671,34 @@ bool ossimInfo::initialize(ossimArgumentParser& ap)
if( ap.read("-u") || ap.read("--up-is-up") )
{
+ requiresInputImage = true;
m_kwl.add( UP_IS_UP_KW, TRUE_KW );
if ( ap.argc() < 2 )
{
break;
}
}
-
+ if( ap.read("--up-is-up-ipt", sp1, sp2))
+ {
+ requiresInputImage = true;
+ m_kwl.add( UP_IS_UP_KW, TRUE_KW);
+ m_kwl.add( UP_IS_UP_IPT_KW, (ts1 +" "+ts2).c_str() );
+ if ( ap.argc() < 2 )
+ {
+ break;
+ }
+ }
+ if(ap.read("--up-is-up-gpt",sp1, sp2))
+ {
+ requiresInputImage = true;
+ m_kwl.add( UP_IS_UP_KW, TRUE_KW);
+ m_kwl.add( UP_IS_UP_GPT_KW, (ts1 +" "+ ts2).c_str() );
+ if ( ap.argc() < 2 )
+ {
+ break;
+ }
+ }
+
if( ap.read("-v") )
{
m_kwl.add( OVERWRITE_KW, TRUE_KW );
@@ -738,8 +762,12 @@ bool ossimInfo::initialize(ossimArgumentParser& ap)
m_kwl.add( IMAGE_FILE_KW, ap[1] );
}
- if ( requiresInputImage && ( ap.argc() == 1 ) )
+ if ( (( ap.argc() == 1 ) && requiresInputImage) || (m_kwl.getSize() == 0) )
{
+ if ( requiresInputImage )
+ {
+ ossimNotify(ossimNotifyLevel_NOTICE) << "\nError: Option requires input image!\n\n";
+ }
setUsage(ap);
ap.getApplicationUsage()->write(ossimNotify(ossimNotifyLevel_INFO));
result = false;
@@ -2310,7 +2338,29 @@ void ossimInfo::getUpIsUpAngle( ossimImageHandler* ih,
ossim_float64 upIsUp = 0.0;
if ( geom->isAffectedByElevation() )
{
- upIsUp = geom->upIsUpAngle();
+ ossimDpt imagePt;
+ imagePt.makeNan();
+ ossimString lookup = m_kwl.find(UP_IS_UP_GPT_KW);
+ if(!lookup.empty())
+ {
+ std::istringstream in(lookup.c_str());
+ ossim_float64 lat,lon;
+ in>>lat>>lon;
+ ossimGpt gpt(lat,lon);
+ geom->worldToLocal(gpt, imagePt);
+ }
+ else
+ {
+ lookup = m_kwl.find(UP_IS_UP_IPT_KW);
+ if(!lookup.empty())
+ {
+ std::istringstream in(lookup.c_str());
+ ossim_float64 x,y;
+ in>>x>>y;
+ imagePt = ossimDpt(x,y);
+ }
+ }
+ upIsUp = geom->upIsUpAngle(imagePt);
kwl.add(prefix, UP_IS_UP_KW, upIsUp, true);
}
}
diff --git a/src/util/ossimOrthoIgen.cpp b/src/util/ossimOrthoIgen.cpp
index 1f42c78..f91b413 100644
--- a/src/util/ossimOrthoIgen.cpp
+++ b/src/util/ossimOrthoIgen.cpp
@@ -1220,7 +1220,7 @@ void ossimOrthoIgen::setupIgenChain()
if (theSrcRecords[idx].isRgbData())
{
- if (bandMergeObject == 0)
+ if (!bandMergeObject)
{
bandMergeObject = new ossimBandMergeSource();
}
@@ -1242,7 +1242,7 @@ void ossimOrthoIgen::setupIgenChain()
// Finished initializing the inputs to the mosaic. Add the mosaic to the product chain.
theProductChain = new ossimImageChain;
- if (bandMergeObject != 0)
+ if (bandMergeObject)
{
theProductChain->addFirst(bandMergeObject.get());
}
diff --git a/src/util/ossimViewshedTool.cpp b/src/util/ossimViewshedTool.cpp
index 2771a60..f6c7485 100644
--- a/src/util/ossimViewshedTool.cpp
+++ b/src/util/ossimViewshedTool.cpp
@@ -610,6 +610,7 @@ bool ossimViewshedTool::optimizeFOV()
stop = m_observerGpt.azimuthTo(m_aoiGroundRect.ll());
break;
case NW:
+ default:
start = m_observerGpt.azimuthTo(m_aoiGroundRect.ur());
stop = m_observerGpt.azimuthTo(m_aoiGroundRect.ll());
break;
diff --git a/test/src/ossim-foo.cpp b/test/src/ossim-foo.cpp
index 3af5a81..f8b79b0 100644
--- a/test/src/ossim-foo.cpp
+++ b/test/src/ossim-foo.cpp
@@ -41,7 +41,11 @@
#include <ossim/base/ossimTrace.h>
#include <ossim/base/ossimUrl.h>
#include <ossim/base/ossimVisitor.h>
+#include <ossim/base/ossimEcefPoint.h>
+#include <ossim/base/ossimEcefVector.h>
+#include <ossim/base/ossim2dBilinearTransform.h>
+#include <ossim/imaging/ossimNitfTileSource.h>
#include <ossim/imaging/ossimBrightnessContrastSource.h>
#include <ossim/imaging/ossimBumpShadeTileSource.h>
#include <ossim/imaging/ossimFilterResampler.h>
@@ -62,6 +66,7 @@
#include <ossim/imaging/ossimSFIMFusion.h>
#include <ossim/imaging/ossimTwoColorView.h>
#include <ossim/imaging/ossimImageSourceFactoryRegistry.h>
+#include <ossim/imaging/ossimImageHandlerRegistry.h>
#include <ossim/init/ossimInit.h>
diff --git a/test/src/util/ossim-tools-test.cpp b/test/src/util/ossim-tools-test.cpp
index dc16bc5..a1d6ff2 100644
--- a/test/src/util/ossim-tools-test.cpp
+++ b/test/src/util/ossim-tools-test.cpp
@@ -59,7 +59,7 @@ int main(int argc, char* argv[])
string toolName = argv[1];
ossimRefPtr<ossimChipProcTool> chipProcUtil =
(ossimChipProcTool*) ossimToolRegistry::instance()->createTool(toolName);
- if (chipProcUtil == 0)
+ if (!chipProcUtil)
cerr<<"OssimTools() Bad opeation requested: <"<<toolName<<">. Ignoring."<<endl;
chipProcUtil->initialize(kwl);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/ossim.git
More information about the Pkg-grass-devel
mailing list