pax_global_header 0000666 0000000 0000000 00000000064 13527512531 0014516 g ustar 00root root 0000000 0000000 52 comment=31217cec69d11b6c6a70dc114fbbf5d4c7204bd3
ossim-Miami-2.9.1/ 0000775 0000000 0000000 00000000000 13527512531 0013713 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/.gitignore 0000664 0000000 0000000 00000000216 13527512531 0015702 0 ustar 00root root 0000000 0000000 *~
include/ossim/ossimConfig.h
include/ossim/ossimVersion.h
doc/html
*CMakeFiles*
*Makefile
cmake_install*
*.swp
CMakeCache.txt
.gradle
.idea
ossim-Miami-2.9.1/CMakeLists.txt 0000664 0000000 0000000 00000027506 13527512531 0016465 0 ustar 00root root 0000000 0000000 PROJECT(ossim)
SET(CMAKE_MODULE_PATH "${${PROJECT_NAME}_SOURCE_DIR}/cmake/CMakeModules;${CMAKE_MODULE_PATH}")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Message("################## Setting up OSSIM core library #########################")
IF(NOT OSSIM_BUILD_ADDITIONAL_OSSIM_DIRECTORIES)
SET(OSSIM_BUILD_ADDITIONAL_OSSIM_DIRECTORIES "" CACHE PATH "Specify full paths separated by ; to additional OSSIM applications you wish to include into the ossim build framework. These will have variables setup for the ossim includes" FORCE)
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)
# 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)
OPTION(BUILD_OSSIM_APPS "Set to ON to build OSSIM applications." ON)
OPTION(BUILD_OSSIM_CURL_APPS "Set to ON to build ossim curl dependent apps. Use ON to enable." OFF)
OPTION(BUILD_OSSIM_TESTS "Set to ON to build OSSIM unit/functional tests." ON)
###################################################################################
# Include the Utilities in the root make
###################################################################################
INCLUDE(OssimUtilities)
INCLUDE(CheckIncludeFile)
CHECK_INCLUDE_FILE("dirent.h" CMAKE_HAVE_DIRENT_H)
CHECK_INCLUDE_FILE("unistd.h" CMAKE_HAVE_UNISTD_H)
CHECK_INCLUDE_FILE("getopt.h" CMAKE_HAVE_GETOPT_H)
CHECK_INCLUDE_FILE("fcntl.h" CMAKE_HAVE_FCNTL_H)
CHECK_INCLUDE_FILE("dbmalloc.h" CMAKE_HAVE_DBMALLOC_H)
CHECK_INCLUDE_FILE("malloc.h" CMAKE_HAVE_MALLOC_H)
CHECK_INCLUDE_FILE("dlfcn.h" CMAKE_HAVE_DLFCN_H)
# Set our include paths:
include_directories( ${PROJECT_SOURCE_DIR}/include )
include_directories( ${PROJECT_BINARY_DIR}/include )
include_directories( ${OSSIM_INCLUDE_DIR} )
# Stores list of libs to link with. Initialized throughout.
set( ossimDependentLibs )
#---
# Find required and optional packages and add their include paths and libraries:
#---
# GEOS - Required:
find_package( GEOS )
if( GEOS_FOUND )
include_directories( ${GEOS_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${GEOS_LIBRARY} )
else( GEOS_FOUND )
message( FATAL_ERROR "Could not find required geos package!" )
endif( GEOS_FOUND )
# GEOFIFF - Required:
set( OSSIM_HAS_GEOTIFF 0 )
find_package( GEOTIFF )
if( GEOTIFF_FOUND )
include_directories( ${GEOTIFF_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${GEOTIFF_LIBRARY} )
set( OSSIM_HAS_GEOTIFF 1 )
else( GEOTIFF_FOUND )
message( FATAL_ERROR "Could not find required geotiff package!" )
endif( GEOTIFF_FOUND )
# GEOTRANS - Required: (GeoTrans 3.4.x port future...)
# find_package( Geotrans )
# if( GEOTRANS_FOUND )
# include_directories( ${GEOTRANS_INCLUDE_DIR} )
# set( ossimDependentLibs ${ossimDependentLibs} ${GEOTRANS_LIBRARY} )
# else( GEOTRANS_FOUND )
# message( FATAL_ERROR "Could not find required geotrans package!" )
# endif( GEOTRANS_FOUND )
# JPEG - Required package:
find_package( JPEG )
if( JPEG_FOUND )
include_directories( ${JPEG_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${JPEG_LIBRARY} )
else( JPEG_FOUND )
message( FATAL_ERROR "Could not find required jpeg package!" )
endif( JPEG_FOUND )
# TIFF - Required:
find_package( TIFF )
if( TIFF_FOUND )
include_directories( ${TIFF_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${TIFF_LIBRARY} )
else( TIFF_FOUND )
message( FATAL_ERROR "Could not find required tiff package!" )
endif( TIFF_FOUND )
# JSONCPP - Required:
find_package( JsonCpp )
if( JSONCPP_FOUND )
include_directories( ${JSONCPP_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${JSONCPP_LIBRARY} )
message("Found JsonCpp" )
else( JSONCPP_FOUND )
message( FATAL_ERROR "Could not find required JsonCpp package!" )
endif( JSONCPP_FOUND )
# This caused a core dump on ossim executables running in jenins pipeline (ossim-test-dev)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
find_library( DL_LIBRARY dl )
if ( DL_LIBRARY )
set( ossimDependentLibs ${ossimDependentLibs} ${DL_LIBRARY} )
else( DL_LIBRARY )
# TODO: Is this required on unix? If so move to the required section.
message( FATAL_ERROR "Could not find dl library!" )
endif( DL_LIBRARY )
endif() # if (CMAKE_SYSTEM_NAME MATCHES "Linux")
#if( UNIX )
# find_library( DL_LIBRARY dl )
# if ( DL_LIBRARY )
# set( ossimDependentLibs ${ossimDependentLibs} ${DL_LIBRARY} )
# else( DL_LIBRARY )
# # TODO: Is this required on unix? If so move to the required section.
# message( FATAL_ERROR "Could not find dl library!" )
# endif( DL_LIBRARY )
#endif( UNIX )
# JSONCPP - Optional:
set( OSSIM_HAS_JSONCPP 0 )
find_package( JsonCpp )
if( JSONCPP_FOUND )
include_directories( ${JSONCPP_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${JSONCPP_LIBRARY} )
set( OSSIM_HAS_JSONCPP 1 )
else( JSONCPP_FOUND )
message("Could not find optional JSONCPP package! Consider installing this as it will soon become a required package." )
endif( JSONCPP_FOUND )
# FREETYPE - Optional:
set( OSSIM_HAS_FREETYPE 0 )
if( BUILD_OSSIM_FREETYPE_SUPPORT )
find_package(Freetype)
if( FREETYPE_FOUND )
include_directories( ${FREETYPE_INCLUDE_DIRS} )
set( ossimDependentLibs ${ossimDependentLibs} ${FREETYPE_LIBRARIES} )
set( OSSIM_HAS_FREETYPE 1 )
else( FREETYPE_FOUND )
message( WARNING "Could not find optional freetype package!" )
endif( FREETYPE_FOUND )
endif( BUILD_OSSIM_FREETYPE_SUPPORT )
# MPI - Optional:
set( OSSIM_HAS_MPI 0 )
if( BUILD_OSSIM_MPI_SUPPORT )
find_package(MPI)
if ( MPI_FOUND )
include_directories( ${MPI_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${MPI_LIBRARY} )
set( OSSIM_HAS_MPI 1 )
else ( MPI_FOUND )
message( WARNING "Could not find optional MPI package!" )
endif ( MPI_FOUND )
endif( BUILD_OSSIM_MPI_SUPPORT )
# ZLIB - Optional:
set( OSSIM_HAS_LIBZ 0 )
find_package( ZLIB )
if ( ZLIB_FOUND )
include_directories( ${ZLIB_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${ZLIB_LIBRARY} )
set( OSSIM_HAS_LIBZ 1 )
else ( ZLIB_FOUND )
message( WARNING "Could not find optional zlib package!" )
endif ( ZLIB_FOUND )
# HDF5 - Optional:
set( OSSIM_HAS_HDF5 0 )
if (BUILD_OSSIM_HDF5_SUPPORT)
message( STATUS "Native HDF5 support requested. Searching for HDF5 library..." )
find_package( HDF5A )
if ( HDF5A_FOUND)
include_directories( ${HDF5A_INCLUDE_DIR} )
set( ossimDependentLibs ${ossimDependentLibs} ${HDF5A_LIBRARIES} )
set( OSSIM_HAS_HDF5 1 )
else ( HDF5A_FOUND )
message( WARNING "Could not find optional HDF5A package. Excluding native support." )
endif ( HDF5A_FOUND )
else (BUILD_OSSIM_HDF5_SUPPORT)
message( STATUS "Native HDF5 support was not requested. If you want HDF5 support, set the environment BUILD_OSSIM_HDF5_SUPPORT=ON..." )
endif ( BUILD_OSSIM_HDF5_SUPPORT )
find_package( Threads )
set( ossimDependentLibs ${ossimDependentLibs} ${CMAKE_THREAD_LIBS_INIT} )
#---
# Call the OSSIM macros in OssimUtilities.cmake
#---
if ( NOT OSSIM_BUILD_DATE )
TODAYS_DATE(OSSIM_BUILD_DATE)
endif( NOT OSSIM_BUILD_DATE )
SET(OSSIM_GIT_REVISION_NUMBER "UNKNOWN")
GET_GIT_REVISION()
if ( NOT ${Project_WC_REVISION} EQUAL 0 )
set( OSSIM_GIT_REVISION_NUMBER ${Project_WC_REVISION} )
endif()
#####################################################################################
# Call the configure files for ossimConfig and ossimVersion setup
#####################################################################################
set(OSSIM_VERSION_NUMBER "\"${OSSIM_VERSION}\"")
set(OSSIM_BUILD_DATE "\"${OSSIM_BUILD_DATE}\"")
set(OSSIM_REVISION "\"${OSSIM_GIT_REVISION_NUMBER}\"")
# Setting of OSSIM_ID to variable expanded $Id$ results. Embedded troughout code.
set(OSSIM_ID_ENABLED 1)
IF(NOT BUILD_OSSIM_ID_SUPPORT)
set(OSSIM_ID_ENABLED 0)
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}")
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}"
"${OSSIM_VERSION_HEADER}")
##################################################################################################
# Point to the CMakeLists.txt in the src dir. OLK: Removed unnecessary src/ossim structure and
# replaced with simply src.
##################################################################################################
subdirs(src)
set(TARGET_COMMON_LIBRARIES ossim)
##################################################################################################
#
# Setup install destinations for the shared files:
# 1) Projection CSV files:
#
##################################################################################################
FILE(GLOB ossim_projection_codes_csv ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/projection/*.csv ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/projection/*.txt)
INSTALL(FILES ${ossim_projection_codes_csv} DESTINATION share/ossim/projection COMPONENT ossim)
# 2) Utility API JSON files
FILE(GLOB ossim_util_api_json ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/util/*.json)
INSTALL(FILES ${ossim_util_api_json} DESTINATION share/ossim/util COMPONENT ossim)
# 3) Fonts
FILE(GLOB ossim_fonts ${${PROJECT_NAME}_SOURCE_DIR}/share/ossim/fonts/*.ttf)
INSTALL(FILES ${ossim_fonts} DESTINATION share/ossim/fonts COMPONENT ossim)
###################### OUTPUT GENERAL VARIABLE SETTINGS #######################
MESSAGE( STATUS "OSSIM_REVISION = ${OSSIM_REVISION}" )
MESSAGE( STATUS "FREETYPE_LIBRARY = ${FREETYPE_LIBRARIES}" )
MESSAGE( STATUS "FREETYPE_INCLUDE = ${FREETYPE_INCLUDE_DIRS}" )
MESSAGE( STATUS "GEOTIFF_LIBRARY = ${GEOTIFF_LIBRARIES}" )
MESSAGE( STATUS "GEOTIFF_INCLUDE = ${GEOTIFF_INCLUDE_DIR}" )
MESSAGE( STATUS "GEOTRANS_LIBRARY = ${GEOTRANS_LIBRARY}" )
MESSAGE( STATUS "GEOTRANS_INCLUDE = ${GEOTRANS_INCLUDE_DIR}" )
MESSAGE( STATUS "GEOS_LIBRARY = ${GEOS_LIBRARY}" )
MESSAGE( STATUS "GEOS_INCLUDE = ${GEOS_INCLUDE_DIR}" )
MESSAGE( STATUS "JPEG_LIBRARY = ${JPEG_LIBRARIES}" )
MESSAGE( STATUS "JPEG_INCLUDE = ${JPEG_INCLUDE_DIR}" )
MESSAGE( STATUS "OSSIM DEPENDENT LIBRARIES = ${ossimDependentLibs}" )
MESSAGE( STATUS "OSSIM_HAS_HDF5 = ${OSSIM_HAS_HDF5}" )
MESSAGE( STATUS "OSSIM_HAS_JSONCPP = ${OSSIM_HAS_JSONCPP}" )
#-----------------------------------------------------------------------------
# uninstall target
#-----------------------------------------------------------------------------
#OSSIM_ADD_COMMON_MAKE_UNINSTALL()
IF(BUILD_OSSIM_APPS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps ${CMAKE_CURRENT_BINARY_DIR}/apps)
ENDIF()
#---
# Building curl dependant apps optional. default=OFF
#---
if(BUILD_OSSIM_CURL_APPS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/curl_apps)
endif()
IF(BUILD_OSSIM_TESTS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/src ${CMAKE_CURRENT_BINARY_DIR}/test/src)
ENDIF()
message("################## end of OSSIM core library setup #########################\n")
ossim-Miami-2.9.1/Jenkinsfile 0000664 0000000 0000000 00000015437 13527512531 0016111 0 ustar 00root root 0000000 0000000 properties([
parameters ([
string(name: 'BUILD_NODE', defaultValue: 'ossim-build', description: 'The build node to run on'),
string(name: 'MAKE_VERBOSE', defaultValue: 'VERBOSE=true', description: ''),
booleanParam(name: 'BUILD_WITH_FORTIFY', defaultValue: false, description: 'Check to build and scan source using HP Fortify tool'),
booleanParam(name: 'SCAN_WITH_SONARQUBE', defaultValue: false, description: 'Check to perform SonarQube analysis'),
booleanParam(name: 'CLEAN_WORKSPACE', defaultValue: true, description: 'Clean the workspace at the end of the run')
]),
pipelineTriggers([
[$class: "GitHubPushTrigger"]
]),
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/ossimlabs/ossim'],
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '3', daysToKeepStr: '', numToKeepStr: '20')),
disableConcurrentBuilds()
])
node ("${BUILD_NODE}"){
try {
stage( "Download Artifacts" ) {
env.OPENCV_HOME = "${env.WORKSPACE}/opencv-3.2-minimal-install"
withCredentials([string(credentialsId: 'o2-artifact-project', variable: 'o2ArtifactProject')]) {
step ([$class: "CopyArtifact",
projectName: o2ArtifactProject,
filter: "common-variables.groovy",
flatten: true])
}
dir( "${ env.WORKSPACE }" ) {
step ([$class: "CopyArtifact",
projectName: "kakadu-build",
filter: "kakadu.tgz",
flatten: true])
sh "tar xvfz kakadu.tgz"
step ([$class: "CopyArtifact",
projectName: "opencv-build",
filter: "opencv-3.2-minimal-install.tgz",
flatten: true,
target: "${ env.WORKSPACE }/opencv-3.2-minimal-install"])
sh """
pushd opencv-3.2-minimal-install
tar xvfz opencv-3.2-minimal-install.tgz
popd
"""
}
load "common-variables.groovy"
}
stage( "Checkout" ) {
dir( "ossim" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-video" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-video.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-planet" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-planet.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-gui" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-gui.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-oms" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-oms.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-plugins" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-plugins.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-wms" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PUBLIC_SERVER_URL }/ossim-wms.git",
credentialsId: "${ CREDENTIALS_ID }"
}
dir( "ossim-private" ) {
git branch: "$BRANCH_NAME",
url: "${ GIT_PRIVATE_SERVER_URL }/ossim-private.git",
credentialsId: "${ CREDENTIALS_ID }"
}
}
stage( "Build" ) {
dir( "${ env.WORKSPACE }" ) {
sh """
rm -rf ${ env.WORKSPACE }/build/CMakeCache.txt
export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
${ env.WORKSPACE }/ossim/scripts/ossim-build.sh
${ env.WORKSPACE }/ossim/scripts/ossim-install.sh
"""
}
}
stage ( "Publish Nexus" ) {
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'nexusCredentials',
usernameVariable: 'REPOSITORY_MANAGER_USER',
passwordVariable: 'REPOSITORY_MANAGER_PASSWORD']]) {
dir( "${ env.WORKSPACE }" ) {
sh "${ env.WORKSPACE }/ossim/scripts/oms-deploy.sh"
}
}
}
stage( "Archive" ) {
dir( "${ env.WORKSPACE }" ) {
sh "tar cvfz ossim-install.tgz install"
}
dir( "${ env.WORKSPACE }/artifacts" ) {
sh "mv ${ env.WORKSPACE }/ossim-install.tgz ."
sh "cp ${ env.WORKSPACE }/ossim-oms/lib/joms-*.jar ."
}
archiveArtifacts "artifacts/*"
}
if (SCAN_WITH_SONARQUBE == "true" ) {
stage( 'SonarQube analysis' ) {
withSonarQubeEnv( "${ SONARQUBE_NAME }" ) {
// requires SonarQube Scanner for Gradle 2.1+
// It's important to add --info because of SONARJNKNS-281
sh "sonar-scanner"
}
}
}
if ( BUILD_WITH_FORTIFY == "true" ) {
stage( 'Fortify SCA' ) {
dir( "${ env.WORKSPACE }/build" ) {
sh """
export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
sourceanalyzer -64 -b ossimlabs -scan -f fortifyResults-ossim.fpr
"""
archiveArtifacts "fortifyResults-ossim.fpr"
withCredentials([[$class: 'UsernamePasswordMultiBinding',
credentialsId: 'fortifyCredentials',
usernameVariable: 'HP_FORTIFY_USERNAME',
passwordVariable: 'HP_FORTIFY_PASSWORD']]) {
sh """
export PATH=${ PATH }:/opt/HPE_Security/Fortify_SCA_and_Apps_17.20/bin
fortifyclient -url ${ HP_FORTIFY_URL } -user "${ HP_FORTIFY_USERNAME }" -password "${ HP_FORTIFY_PASSWORD }" uploadFPR -file fortifyResults-ossim.fpr -project ossim -version 1.0
"""
}
}
}
}
}
finally {
stage( "Clean Workspace" ) {
if ( "${ CLEAN_WORKSPACE }" == "true" )
step([$class: 'WsCleanup'])
}
}
}
ossim-Miami-2.9.1/LICENSE.txt 0000664 0000000 0000000 00000002054 13527512531 0015537 0 ustar 00root root 0000000 0000000 The MIT License (MIT)
Copyright (c) 2015
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
ossim-Miami-2.9.1/README.md 0000664 0000000 0000000 00000042740 13527512531 0015201 0 ustar 00root root 0000000 0000000 ### Jenkins Build Status
Resource | *master* | *dev* |
------------ | ------------- | -------------
OSSIM Build Centos7 |  | 
Batch Test|  | 
RPMS Build Centos7 |  | 
RPMS Publish Centos7 |  | 
# Welcome to OSSIM
OSSIM is an open source, C++ (mostly), geospatial image processing library used by government, commercial, educational, and private entities throughout the solar system. It has been in active development since the last millenium. This repository contains the full OSSIM package including core library, applications, tests, and build system. It does *not* contain the OSSIM plugins and other OSSIM-related code such as java-bindings ([ossim-oms](https://github.com/ossimlabs/ossim-oms)), and GUI. Those are available for individually cloning. Refer to the root github page for [ossimlabs](https://github.com/ossimlabs).
Quick links:
* [What to Get](#relationship-between-repositories)
* [How to Build](#how-to-build)
* [How to Test](#how-to-test)
* [OSSIM Command Line Utility](#ossim-command-line-utility)
* [Doxygen Source Code Documentation](https://trac.osgeo.org/ossim/doxygen)
# Relationship between Repositories (What to Get)
The principal repository is this one (ossim), containing not only the core classes but also the command line utility applications code as well as the cmake build system files and related scripts. This repository must be cloned first before attempting to work with other _ossim-*_ repositories.
The remaining _ossim-*_ repositories are independent of each other and can be cloned in any order. However, it will be necessary to re-run the [build script (linux version)](/scripts/linux/build.sh) or at least regenerate makefiles with the [cmake script (linux version)](/cmake/scripts/ossim-cmake-config-LINUX.sh) before building. This must be done each time a new ossim-* repository is added to the ossimlabs build. See below for detailed build instructions.
# Branching Scheme and Pull Requests
The "master" branches (for all OSSIM family repos) contain the most stable code. It is periodically merged with "dev" branch. If you don't plan on developing code, but want to build from source, this is the branch you want. For bleeding edge development, use the "dev" branch. This branch serves as the parent to all feature branches and is frequently merged with those feature branches once those branches are tested by the developers responsible for them.
If you want to contribute code, you'll need to:
* create your own feature branch from dev,
* test your modification,
* then create a pull request.
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
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 options on customizing the build location.
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.
The following 3rd-party SDKs are needed in order to build the core ossim library:
libtiff-devel (preferably version 4.x for BigTIFF support)
OpenThreads-devel
libjpeg-devel
libgeos-devel (on later Debian / Ubuntu versions, libgeos++-dev)
(Mac users: use [MacPorts](https://github.com/macports/macports-base) to install dependencies)
Plugins will require additional 3rd-party packages.
Building OSSIM and related repos from source is a two-step process: first create the make files using CMake, then run `make` to build the binaries. Scripts are available for Linux/Mac and (soon) Windows to run CMake with default settings. You can run the script from any working directory and default settings will be used for creating the default build environment. It is possible to override specific defaults for your own custom requirements or preferences.
Presently, the default setting is to disable the building of all plugins. If you want specific plugin libraries to be built, you'll need to edit your cmake script at `cmake/scripts/ossim-cmake-config.sh` (or similar `.bat` file for Windows). Scroll down to the "Plugins" section and set the corresponding variables to "ON". Note that you could also define those variables in your shell environment in lieu of editing the script.
## Creating the Makefiles
### Creating a Default Build Environment
The cmake configuration scripts are available in the `cmake/scripts` subdirectory. Assuming no OSSIM environment variables are available to override the defaults, the "out-of-source" `build` directory will be created under the same parent directory *ossim-dev-home* as this repo. The linux/Mac script `ossim/scripts/build.sh`, if run in an interactive shell will query for the build type. If the script is run as part of a batch process, "Release" is assumed. If the build directory does not exist, it will be created.
### Customizing the Build
There are two ways to customize the build: via environment variables and by directly editing the cmake configuration script.
#### Environment Variables
The CMake system will locally define certain environment variables that live for the lifetime of the cmake config script execution. The following shell variables, if defined, are referenced to override the default settings.
The developer has the option to override the default build directory location by setting the environment variable `OSSIM_BUILD_DIR` prior to running the cmake config script. If not present, the `build` directory will be located just under *ossim-dev-home* as described above.
Another defaulted environment variable is `OSSIM_INSTALL_PREFIX`. This variable as two distinct functions. First, it indicates where to install the OSSIM SDK when running `make install`. Second, it serves to specify a path to SDKs that OSSIM depends on. The CMake system will scan `OSSIM_INSTALL_PREFIX` for the presence of dependency packages such as GeoTiff, JPEG, and others. This secondary purpose of `OSSIM_INSTALL_PREFIX` used to be handled by the now obsolete environment variable `OSSIM_DEPENDENCIES`. It is a reasonable consolidation since the OSSIM install will need to include these dependencies if they are not available in their standard installation locations (/usr/lib, /usr/local/lib, etc.), so placing these SDKs in the final OSSIM install directory prior to building OSSIM makes sense. If no override is defined for `OSSIM_INSTALL_PREFIX`, then the cmake config script will default to `$OSSIM_DEV_HOME/install`. You can populate that directory with non-standard installs of the OSSIM dependencies prior to running the script. If the directory does not exist, it is created by the script. Obviously, in that case, all OSSIM dependencies will be expected to be found in standard system install folders.
As already mentioned, you can enable the building of specific plugins by defining the corresponding environment variable: `BUILD__PLUGIN=ON`.
NOTE: For legacy reasons, `OSSIM_DEPENDENCIES` is still scanned for dependency SDKs. New dependencies however should be "installed" in `OSSIM_INSTALL_PREFIX`.
#### Editing the CMake Config Script
The default configuration relies on the presence of the OSSIM repositories under the *ossim-dev-home* to decide whether to include those in the build (with the exception of the plugins, which default to "OFF"). You may want to selectively exclude certain applications from the build without having to hide the workspaces from CMake. The flags enabling those are defined in the script. Simply set the corresponding variable to "OFF" and rerun the script. Likewise, for the plugins, you can modify the default ("OFF") by changing the corresponding variables in the script to "ON".
There are other flags available that direct CMake to generate project files for IDEs such as Eclipse and Visual Studio. You can also specify multi-threaded builds, non-standard output directories, and more. Feel free to experiment, but know that you'll be voiding the warranty.
### _How do I know what dependencies are needed?_
The CMake system will attempt to locate all necessary dependency SDKs in the system's standard install directories. On linux, this includes, but not limited to, /usr and /usr/local. If it cannot find them, the script will exit with an error message indicating the missing library. You can then install the missing library from the third-party repository before trying to run the OSSIM cmake config script again. You may get several dependency errors before CMake succeeds in generating all the Makefiles needed.
Remember, you can provide "sandbox" installations of dependency libraries that you want to link with, even though your system may (or may not) have installed different versions of those libraries. That's achieved by "installing" those SDKs inside the directory indicated by the CMake environment variable `OSSIM_INSTALL_PREFIX` (defaults to *ossim-dev-home*/install, see above).
Eventually, we hope to provide an artifact repository so that CMake itself can access any missing dependencies without the need for the developer to manually install them.
## Building the Binaries
Once the cmake configuration script terminates successfully, you are ready to build the binaries. Build instructions vary slightly between OS's, but generally involve simply running `make` inside the build directory.
First change directory to the build folder created by the cmake config script. There you will find a top-level Makefile that will bootstrap the build. From a terminal, run `make`. The build should proceed normally for a few minutes, longer if the first time through. Upon successful completion, you should find a "lib" and "bin" folder containing the ossim library and executable, respectively.
Developers have different ways of working -- all we're helping you with here is building the OSSIM library and associated plugins and executables. You may choose to then run `make install` to copy the binaries to some standard system location (you'll need to have the appropriate permissions). Alternatively, you can append your `PATH` environment variable to include the `build/bin` folder containing the executables. You also need to update the library path to include `build/lib`. These settings vary by OS so you're on your own here.
## Integrated Development Environments
You may be able to import the build environment into your IDE "as a Makefile project." The Windows cmake configuration script will generate Visual Studio project files for direct import into Visual Studio. You may want to take a look at that script to see if there is a custom setting (or command line argument) you need to tinker with.
### Eclipse Users
For convenience, you can specify "eclipse" as the build-type to the script at `ossim/cmake/scripts/ossim-cmake-config-LINUX.sh` that will generate the Eclipse CDT4 project files along with the makefiles for a debug build. The output build directory will be one level up from *ossim-dev-home* since Eclipse does not support the build directory as sibling of source. Eclipse will properly generate "Subprojects" corresponding to each ossimlabs repo present in your *ossim-dev-home* for indexed navigation of the source files. It is built with debug. To import into your Eclipse workspace, right-click in the Project Explorer and select Import->General->"Existing Project...", then select the root directory by browsing to `/../build` and clicking "OK".
# How to Test
The first check of a successful build is to run the ossim command line utility `ossim-cli --version`. You should get the current version output to the console. More on the `ossim-cli` command below.
Testing is generally divided into unit, functional, and integration tests. At the moment, true unit testing in OSSIM is very limited, and likely to stay that way. There is however a _de facto_ scheme in place that has been used for implementing integration and functional testing using the `ossim-batch-test` command line executable. Much of the functional testing supplied through `ossim-batch-test` configuration files is fairly fine-grained, almost to the unit-test level of granularity. This testing platform lets the developer create any level of test, from top-level integration test to individual class method test. This application spawns other OSSIM utility applications to generate results, including dedicated test utilities, which are then compared against an expected-results dataset. This command-line app reads a configuration file that specifies a test or series of tests to run and possibly compare against expected results. There is an option to accept current results as the new expected results. While not explicitly required, the majority of testing done with `ossim-batch-test` will involve input source data, typically imagery, that the tester must preinstall on the target machine. The expected results will also need to be generated and its location specified on the command line. See the usage for `ossim-batch-test` for more detail.
A rudimentary test suite is encapsulated in this [test script (linux version)](/scripts/test.sh). It defines the locations of the input source data and expected results, and runs the command-line test applications.
The _ossim_ repository contains `test/src` and `test/config` subdirectories which contain items available for testing OSSIM core functionality. At some point when we start including unit tests, there will be a third directory, `test/scripts`, that will contain the commands to run those unit tests.
## test/src
This directory contains the source code for unit and functional testing of core OSSIM objects. It is automatically built by the cmake/make system, assuming `BUILD_OSSIM_TESTS` is set to `ON` (the default). The resulting executables, located in `build/bin`, can be run standalone on the command line. The code in this directory is also a good source of examples for interfacing to many important OSSIM classes. This directory also contains the source code for `ossim-batch-test`.
## test/config
This subdirectory contains, primarily, configuration files for existing `ossim-batch-test` runs.
The input data referenced in the `ossim-batch-test` configuration files are presently hosted on an Amazon S3 storage. Contact the [OSSIM developer list](mailto:ossim-developer@lists.sourceforge.net) if you want access to this public data for your own testing.
# OSSIM Command Line Utility
The executable `ossim-cli` will eventually consolidate the plethora of ossim utility applications currently existing. For now it supports a small subset of utilities though among them is `info` that reproduces the functionality of the ubiquitous `ossim-info`.
The usage is: `ossim-cli [options and parameters]`
With no arguments, the app will give a list of capabilities. Currently those are
* help -- To get help on specific command. Same as " --help"
* bandmerge -- Merges multiple band files into a single RGB image.
* hillshade -- Computes shaded representation of input elevation surface with specified lighting parameters.
* hlz -- Computes bitmap of helicopter landing zones given ROI and DEM.
* info -- Dumps metadata information about input image and OSSIM in general.
* ortho -- Utility for orthorectifying and reprojecting image data.
* potrace -- Computes vector representation of input raster image.
* shoreline -- Computes bitmap of water versus land areas in an input image.
* slope -- Utility for computing the slope at each elevation post and generating a corresponding slope image.
* vertices -- Utility for determining the active image corner vertices inside larger null-filled image rectangle.
* viewshed -- Computes bitmap image representing the viewshed from specified location using only DEM information.
For example, to get projection and image information for an image file, use
`ossim-cli info -p -i `
You can also give a keyword list (KWL) file as the only arg. The KWL must contain the keyword "tool" with one of the supported commands above, along with the keywords expected by that utility. You can even get KWL templates or enter the keyword/values interactively.
ossim-Miami-2.9.1/apps/ 0000775 0000000 0000000 00000000000 13527512531 0014656 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/CMakeLists.txt 0000664 0000000 0000000 00000000741 13527512531 0017420 0 ustar 00root root 0000000 0000000 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)
# 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)
ossim-Miami-2.9.1/apps/curl_apps/ 0000775 0000000 0000000 00000000000 13527512531 0016646 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/curl_apps/CMakeLists.txt 0000664 0000000 0000000 00000003301 13527512531 0021403 0 ustar 00root root 0000000 0000000 message( "************** Begin: CMAKE SETUP FOR ossim curl apps ******************" )
cmake_minimum_required (VERSION 2.8)
project(ossimcore)
set(requiredLibs)
# Get the library suffix for lib or lib64.
get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if(LIB64)
set(LIBSUFFIX 64)
else()
set(LIBSUFFIX "")
endif()
find_package( CURL )
if( CURL_FOUND )
include_directories( ${CURL_INCLUDE_DIR} )
set( requiredLibs ${requiredLibs} ${CURL_LIBRARY} )
else( CURL_FOUND )
message(FATAL_ERROR "Could not find curl")
endif( CURL_FOUND )
# Requires ossim:
find_package(ossim)
if (OSSIM_FOUND)
include_directories( ${OSSIM_INCLUDE_DIR} )
set(requiredLibs ${requiredLibs} ${OSSIM_LIBRARIES} )
else(OSSIM_FOUND)
message(FATAL_ERROR "Could not find ossim")
endif(OSSIM_FOUND)
# Add our include...
include_directories(".")
message( STATUS "CURL_INCLUDE_DIR = ${CURL_INCLUDE_DIR}" )
message( STATUS "CURL_LIBRARY = ${CURL_LIBRARY}" )
message( STATUS "OSSIM_INCLUDE_DIR = ${OSSIM_INCLUDE_DIR}" )
message( STATUS "OSSIM_LIBRARIES = ${OSSIM_LIBRARIES}" )
message( STATUS "Required libs = ${requiredLibs}" )
# ---
# omar-data-mgr app:
# ---
# Add the executable:
add_executable(omar-data-mgr omar-data-mgr.cpp omarDataMgrUtil.cpp )
# Set the output dir:
set_target_properties(omar-data-mgr
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# omar-data-mgr application links with required libs.
target_link_libraries( omar-data-mgr ${requiredLibs} )
# Install app:
install( TARGETS omar-data-mgr
DESTINATION bin )
message( "************** End: CMAKE SETUP FOR ossim curl apps ******************" )
ossim-Miami-2.9.1/apps/curl_apps/omar-data-mgr.cpp 0000664 0000000 0000000 00000003746 13527512531 0022014 0 ustar 00root root 0000000 0000000 //---
// File: omar-data-mrg.cpp
//
// License: See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description: omar-data-mrg application for interfacing with OMAR
// dataManager services, e.g. "add", "remove" raster via libcurl.
//---
#include
#include
#include
#include
#include
#include
#include "omarDataMgrUtil.h"
#include
using namespace std;
int main(int argc, char *argv[])
{
#if OSSIM_HAS_MPI
ossimMpi::instance()->initialize(&argc, &argv);
#endif
int rv = 0; // Return value.
//---
// Get the arg count so we can tell if an arg was consumed by
// ossimInit::instance()->initialize
//---
int originalArgCount = argc;
ossimArgumentParser ap(&argc, argv);
// Initialize ossim stuff, factories, plugin, etc.
ossimInit::instance()->initialize(ap);
//---
// Avoid going on if a global option was consumed by ossimInit::initialize
// like -V or --version option and the arg count is down to 1.
//---
if ( ( ap.argc() > 1 ) || ( ap.argc() == originalArgCount ) )
{
// Make the info object.
ossimRefPtr dm = new omarDataMgrUtil();
try
{
//---
// Initialize will take the options passed in and set things to output
// information for.
//
// omarDataMgrUtil::initialize can throw an exception.
//---
bool continue_after_init = dm->initialize(ap);
if ( continue_after_init )
{
// This does all the work...
rv = (int)dm->execute();
}
}
catch (const ossimException& e)
{
ossimNotify(ossimNotifyLevel_WARN) << e.what() << std::endl;
rv = 1;
}
} // End: if ( ( ap.argc() > 1 ) ...
return rv;
} // End of main...
ossim-Miami-2.9.1/apps/curl_apps/omarDataMgrUtil.cpp 0000664 0000000 0000000 00000070712 13527512531 0022415 0 ustar 00root root 0000000 0000000 //----------------------------------------------------------------------------
// File: omarDataMgrUtil.cpp
//
// License: See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description: omarDataMgrUtil class definition
//
// Utility class for processing images recursively and calling OMAR
// services upon successful open.
//
//----------------------------------------------------------------------------
// $Id$
#include "omarDataMgrUtil.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
static std::string ACCESS_TIME_THRESHOLD_KW = "access_time_threshold";
static std::string CLEAN_KW = "clean";
static std::string DUMP_FILTERED_IMAGES_KW = "dump_filtered_images";
static std::string FALSE_KW = "false";
static std::string FILE_KW = "file";
static std::string OVERRIDE_FILTERED_IMAGES_KW = "override_filtered_images";
static std::string SERVICE_KW = "service";
static std::string THREADS_KW = "threads";
static std::string TRUE_KW = "true";
static std::string URL_KW = "url";
// Static trace for debugging. Use -T omarDataMgrUtil to turn on.
static ossimTrace traceDebug = ossimTrace("omarDataMgrUtil:debug");
omarDataMgrUtil::omarDataMgrUtil()
:
ossimReferenced(),
ossimFileProcessorInterface(),
m_kwl( new ossimKeywordlist() ),
m_fileWalker(0),
m_mutex(),
m_imageUtil(0),
m_errorStatus(0),
m_filteredImages(0)
{
}
omarDataMgrUtil::~omarDataMgrUtil()
{
if ( m_fileWalker )
{
delete m_fileWalker;
m_fileWalker = 0;
}
}
void omarDataMgrUtil::addArguments(ossimArgumentParser& ap)
{
// Set the general usage:
ossimApplicationUsage* au = ap.getApplicationUsage();
ossimString usageString = ap.getApplicationName();
usageString += " [options] ";
au->setCommandLineUsage(usageString);
// Set the command line options:
au->addCommandLineOption("--access-time-threshold", " For \"remove\" action. Only remove if last access is greater than days.");
au->addCommandLineOption("--clean", "Cleans/removes image file and associated files from file system if present.\n\"remove\" option only.\nLooks for associated files of image, e.g. .ovr, .his, .omd, .geom\nCAUTION: This command is irreversible once envoked!");
au->addCommandLineOption("--dump-filtered-image-list", "Outputs list of filtered images.");
au->addCommandLineOption("--override-filtered-images", "Allows processing of file that is in the filtered image list.");
au->addCommandLineOption("--threads", " The number of threads to use. (default=1) Note a default can be set in your ossim preferences file by setting the key \"ossim_threads\".");
au->addCommandLineOption("--preproc", "Enables the use of the preproc utility to build overviews and histograms");
au->addCommandLineOption( "-u", " URL, e.g. \"http://omar.osssim.org/omar\"\n(default= url \"http://localhost:8080/omar\"" );
ossimRefPtr imageUtil = new ossimImageUtil();
imageUtil->addOptions(au);
imageUtil = 0;
} // void omarDataMgrUtil::addArguments(ossimArgumentParser& ap)
bool omarDataMgrUtil::initialize(ossimArgumentParser& ap)
{
static const char M[] = "omarDataMgrUtil::initialize(ossimArgumentParser&)";
if ( traceDebug() )
{
ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\n";
}
bool result = true;
if ( (ap.argc() == 1) || ap.read("-h") || ap.read("--help") )
{
usage(ap);
// continue_after_init to false
result = false;
}
else
{
//---
// Start with clean options keyword list.
//---
m_kwl->clear();
while ( 1 ) // While forever loop...
{
// Used throughout below:
std::string ts1;
ossimArgumentParser::ossimParameter sp1(ts1);
if( ap.read("--access-time-threshold", sp1) )
{
m_kwl->addPair( ACCESS_TIME_THRESHOLD_KW, ts1 );
if ( ap.argc() < 3 )
{
break;
}
}
if( ap.read("--clean") )
{
addOption( CLEAN_KW, TRUE_KW );
if ( ap.argc() < 3 )
{
break;
}
}
if( ap.read("--dump-filtered-image-list") )
{
setDumpFilteredImageListFlag( true );
if ( ap.argc() < 3 )
{
break;
}
}
if( ap.read("--override-filtered-images") )
{
setOverrideFilteredImagesFlag( true );
if ( ap.argc() < 3 )
{
break;
}
}
if( ap.read("--threads", sp1) )
{
m_kwl->addPair( THREADS_KW, ts1 );
if ( ap.argc() < 3 )
{
break;
}
}
if( ap.read("-u", sp1) )
{
m_kwl->addPair( URL_KW, ts1 );
if ( ap.argc() < 3 )
{
break;
}
}
if( ap.read("--preproc"))
{
m_imageUtil = new ossimImageUtil();
if ( getOverrideFilteredImagesFlag() )
{
//---
// User requested override but the arg parser for omarDataMgr has
// stripped the argument for image util so manually set it.
//---
m_imageUtil->setOverrideFilteredImagesFlag( true );
}
m_imageUtil->initialize(ap);
}
if ( ap.argc() < 3 )
{
break;
}
// End of arg parsing.
ap.reportRemainingOptionsAsUnrecognized();
if ( ap.errors() )
{
ap.writeErrorMessages(ossimNotify(ossimNotifyLevel_NOTICE));
std::string errMsg = "Unknown option...";
throw ossimException(errMsg);
}
break; // Break from while forever.
} // End while (forever) loop.
if( ap.argc() > 2 )
{
// First arg should be service, e.g. "add", "remove".
std::string value = ap[1];
m_kwl->addPair( SERVICE_KW, value );
// Check for "clean" used with "add" and issue warning???
if ( getCleanFlag() && ( value == "add" ) )
{
ossimNotify(ossimNotifyLevel_NOTICE)
<< "NOTICE: Using --clean with \"add\" service is illogical!\n";
}
// The remaining args should be files to process.
for (ossim_int32 i = 1; i < (ap.argc()-1); ++i)
{
ossimString kw = "file";
kw += ossimString::toString(i);
std::string value = ap[i+1];
m_kwl->addPair(kw.string(), value, true);
}
}
else
{
if ( getDumpFilterImagesFlag() )
{
// Caller wants to see filtered image names:
dumpFilteredImageList();
}
else
{
usage(ap);
result = false;
}
}
} // not usage
if ( traceDebug() )
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "m_kwl:\n" << *(m_kwl.get()) << "\n"
<< M << " exit result = " << (result?"true":"false")
<< "\n";
}
return result;
}
ossim_int32 omarDataMgrUtil::execute()
{
static const char M[] = "omarDataMgrUtil::execute()";
if ( traceDebug() )
{
ossimNotify(ossimNotifyLevel_DEBUG) << M << " entered...\n";
}
if ( getDumpFilterImagesFlag() )
{
// Caller wants to see filtered image names:
if ( m_filteredImages.empty() )
{
initializeDefaultFilterList();
}
dumpFilteredImageList();
}
// Get the number of "file*" keywords.
ossim_uint32 fileCount = m_kwl->numberOf("file");
if ( fileCount )
{
if ( !m_fileWalker )
{
m_fileWalker = new ossimFileWalker();
}
if ( !getOverrideFilteredImagesFlag() && m_filteredImages.empty() )
{
initializeDefaultFilterList();
m_fileWalker->initializeDefaultFilterList();
}
//---
// Passing getNumberOfThreads() to ossimFileWalker::setNumberOfThreads was
// kicking up a coverity scan error:
// Passing tainted variable "this->getNumberOfThreads()" to a tainted sink.
// drb
//---
ossim_uint32 threads = getNumberOfThreads();
m_fileWalker->setNumberOfThreads( threads );
// Must set this so we can stop recursion on directory based images.
m_fileWalker->setWaitOnDirFlag( true );
// This links the file walker back to our "processFile" method.
m_fileWalker->setFileProcessor( this );
// Wrap in try catch block as excptions can be thrown under the hood.
try
{
// Get the list of files passed to us:
std::vector files;
ossim_uint32 processedFiles = 0;;
ossim_uint32 i = 0;
while ( processedFiles < fileCount )
{
ossimString kw = FILE_KW;
kw += ossimString::toString(i);
std::string lookup = m_kwl->findKey( kw.string() );
if ( lookup.size() )
{
files.push_back( ossimFilename(lookup) );
++processedFiles;
}
++i;
if ( i > (fileCount + 100) ) break;
}
// Process the files:
m_fileWalker->walk( files );
}
catch (const ossimException& e)
{
ossimNotify(ossimNotifyLevel_WARN)
<< "Caught exception: " << e.what() << endl;
setErrorStatus( ossimErrorCodes::OSSIM_ERROR );
}
} // if ( fileCount )
if ( traceDebug() )
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< M << " exit status: " << m_errorStatus << std::endl;
}
// Zero is good, non zero is bad.
return m_errorStatus;
}
//---
// This method is called back by the ossimFileWalker::walk method for each file it finds that it
// deems can be processed.
//---
void omarDataMgrUtil::processFile(const ossimFilename& file)
{
static const char M[] = "omarDataMgrUtil::processFile";
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< M << " entered...\n" << "\nfile: " << file << "\n";
}
if ( file.size() )
{
bool processFileFlag = true;
if ( !getOverrideFilteredImagesFlag() )
{
processFileFlag = !isFiltered( file );
}
if ( processFileFlag )
{
omarDataMgrUtil::OmarDataMgrUtilService service = getService();
if ( service == omarDataMgrUtil::ADD_RASTER )
{
callAddRasterService( file );
}
else if ( service == omarDataMgrUtil::REMOVE_RASTER )
{
callRemoveRasterService( file );
}
else
{
std::string s;
getService( s );
ossimNotify(ossimNotifyLevel_WARN)
<< "Unhandled service: " << s << "\n";
}
}
else
{
ossimNotify(ossimNotifyLevel_NOTICE)
<< "Filtered file, not processing: " << file << std::endl;
}
} // Matches: if ( file.size() )
if(traceDebug())
{
// Since ossimFileWalker is threaded output the file so we know which job exited.
ossimNotify(ossimNotifyLevel_DEBUG) << M << "\nfile: " << file << "\nexited...\n";
}
} // End: omarDataMgrUtil::processFile(const ossimFilename& file)
void omarDataMgrUtil::usage(ossimArgumentParser& ap)
{
// Add global usage options.
ossimInit::instance()->addOptions(ap);
// Set app name.
ap.getApplicationUsage()->setApplicationName(ap.getApplicationName());
// Add options.
addArguments(ap);
// Write usage.
ap.getApplicationUsage()->write(ossimNotify(ossimNotifyLevel_INFO));
ossimNotify(ossimNotifyLevel_INFO)
<< "\nValid services: \"add\" and \"remove\"."
<< "\nExample usage:\n\n"
<< "Using default url \"http://localhost:8080/omar\":\n"
<< ap.getApplicationName()
<< " add 5V090205M0001912264B220000100072M_001508507.ntf\n\n"
<< "Build overviews, histogram, and add to database.\n"
<< ap.getApplicationName()
<< " --preproc --ot ossim_kakadu_nitf_j2k --ch add "
<< "5V090205M0001912264B220000100072M_001508507.ntf\n\n"
<< "Passing in url:\n"
<< ap.getApplicationName()
<< " -u http://your_url/omar add 5V090205M0001912264B220000100072M_001508507.ntf\n\n"
<< "Adding all images in a directory using 32 threads:\n"
<< ap.getApplicationName()
<< " --threads 32 add /data1/imagery/2015/09/28/0000\n\n"
<< "Removing file from database:\n"
<< ap.getApplicationName()
<< " remove 5V090205M0001912264B220000100072M_001508507.ntf\n\n"
<< "Removing file from database and file system:\n"
<< ap.getApplicationName()
<< " --clean remove 5V090205M0001912264B220000100072M_001508507.ntf\n\n"
<< "Removing all images in a directory using 32 threads:\n"
<< ap.getApplicationName()
<< " --clean --threads 32 remove /data1/imagery/2015/09/28/0000\n\n"
<< "Removing all images in a directory using 4 threads that have not been accessed in 30 days:\n"
<< ap.getApplicationName()
<< " --access-time-threshold 30 --clean --threads 4 remove /data1/imagery/2015/09/28/0000\n"
<< std::endl;
}
// Private method:
bool omarDataMgrUtil::isDirectoryBasedImage(const ossimImageHandler* ih) const
{
bool result = false;
if ( ih )
{
// Get the image handler name.
ossimString imageHandlerName = ih->getClassName();
if ( (imageHandlerName == "ossimAdrgTileSource") ||
(imageHandlerName == "ossimCibCadrgTileSource") )
{
result = true;
}
}
return result;
}
bool omarDataMgrUtil::isPastLastAccessedThreshold( const ossimFilename& file ) const
{
// Default to true.
bool result = true;
std::string value = m_kwl->findKey( ACCESS_TIME_THRESHOLD_KW );
if ( value.size() )
{
const ossim_int64 SECONDS_PER_DAY = 86400; // 60 * 60 * 24
ossim_int64 thresholdInDays = ossimString(value).toInt64();
if ( thresholdInDays )
{
// Returns -1 if does not exist.
ossim_int64 secondsSinceAccessed = file.lastAccessed();
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< ACCESS_TIME_THRESHOLD_KW << ": " << thresholdInDays
<< "\nfile_last_accessed: " << secondsSinceAccessed/SECONDS_PER_DAY
<< "\n";
}
if ( secondsSinceAccessed > 0 )
{
if ( secondsSinceAccessed/SECONDS_PER_DAY <= thresholdInDays )
{
result = false;
}
}
}
}
return result;
}
void omarDataMgrUtil::setNumberOfThreads( ossim_uint32 threads )
{
addOption( THREADS_KW, threads );
}
void omarDataMgrUtil::setNumberOfThreads( const std::string& threads )
{
addOption( THREADS_KW, threads );
}
ossim_uint32 omarDataMgrUtil::getNumberOfThreads() const
{
ossim_uint32 result = 1;
std::string lookup = m_kwl->findKey( THREADS_KW );
if ( lookup.size() )
{
result = ossimString(lookup).toUInt32();
}
else
{
result = ossim::getNumberOfThreads();
}
return result;
}
void omarDataMgrUtil::addOption( const std::string& key, ossim_uint32 value )
{
addOption( key, ossimString::toString( value ).string() );
}
void omarDataMgrUtil::addOption( const std::string& key, const std::string& value )
{
m_mutex.lock();
if ( m_kwl.valid() )
{
if ( key.size() && value.size() )
{
m_kwl->addPair( key, value );
}
}
m_mutex.unlock();
}
void omarDataMgrUtil::setErrorStatus( ossim_int32 status )
{
m_mutex.lock();
m_errorStatus = status;
m_mutex.unlock();
}
omarDataMgrUtil::OmarDataMgrUtilService omarDataMgrUtil::getService() const
{
omarDataMgrUtil::OmarDataMgrUtilService service = omarDataMgrUtil::UNKNOWN;
std::string value = m_kwl->findKey( SERVICE_KW );
if ( value.size() )
{
ossimString s = value;
s.downcase();
if ( s == "add" )
{
service = omarDataMgrUtil::ADD_RASTER;
}
else if ( (s == "remove") || (s == "rm") || (s == "delete") || (s == "erase") )
{
service = omarDataMgrUtil::REMOVE_RASTER;
}
}
return service;
}
void omarDataMgrUtil::getService(std::string& serviceString) const
{
omarDataMgrUtil::OmarDataMgrUtilService service = getService();
if ( service == omarDataMgrUtil::ADD_RASTER )
{
serviceString = "/dataManager/addRaster";
}
else if ( service == omarDataMgrUtil::REMOVE_RASTER )
{
serviceString = "/dataManager/removeRaster";
}
else
{
serviceString.clear();
}
}
void omarDataMgrUtil::getUrl( std::string& url ) const
{
url = m_kwl->findKey( URL_KW );
if ( url.empty() )
{
url = "http://localhost:8080/omar"; // default url
}
}
bool omarDataMgrUtil::callAddRasterService( const ossimFilename& file )
{
static const char M[] = "omarDataMgrUtil::callAddRasterService";
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< M << " entered...\n" << "\nfile: " << file << "\n";
}
bool result = false;
// Must be able to open:
m_mutex.lock();
ossimRefPtr ih =
ossimImageHandlerRegistry::instance()->open(file, true, true);
m_mutex.unlock();
if ( ih.valid() && !ih->hasError() )
{
if ( isDirectoryBasedImage( ih.get() ) )
{
// Tell the walker not to recurse this directory.
m_mutex.lock();
m_fileWalker->setRecurseFlag(false);
m_mutex.unlock();
}
// Must have geometry:
ossimRefPtr geom = ih->getImageGeometry();
if( geom.valid() )
{
// Geometry object must have a valid projection:
ossimRefPtr proj = geom->getProjection();
if ( proj.valid() )
{
ossimNotify(ossimNotifyLevel_NOTICE)
<< "Processing file: " << file << std::endl;
if( m_imageUtil.valid() )
{
m_imageUtil->processFile(file);
}
std::string service;
getService( service );
std::string url;
getUrl( url );
if ( service.size() && url.size() )
{
CURL* curl = curl_easy_init();
if ( curl )
{
// Data for POST:
std::string data = std::string("filename=") + file.string();
curl_easy_setopt( curl, CURLOPT_POSTFIELDS, data.c_str() );
// Create the URL string:
std::string urlString = url + service;
curl_easy_setopt( curl, CURLOPT_URL, urlString.c_str() );
ossimNotify(ossimNotifyLevel_INFO)
<< "data: " << data
<< "\nurl: " << urlString.c_str()
<< std::endl;
// Tell libcurl to follow redirection
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
// Run it:
CURLcode res = curl_easy_perform(curl);
// Check for errors:
if ( res == CURLE_OK )
{
// Response code of the http transaction:
long respcode;
res = curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE, &respcode);
if ( res == CURLE_OK )
{
if ( respcode == 200 ) // OK 200 "The request was fulfilled."
{
result = true; // Set return status for caller.
}
}
}
else
{
ossimNotify(ossimNotifyLevel_WARN)
<< "curl_easy_perform() failed: \n"
<< curl_easy_strerror(res)
<< std::endl;
setErrorStatus( (ossim_int32)res );
}
ossimNotify(ossimNotifyLevel_WARN) << std::endl;
// Always cleanup:
curl_easy_cleanup(curl);
}
// Cleanup curl:
curl_global_cleanup();
} // Matches: if ( url.size() )
}
else
{
ossimNotify(ossimNotifyLevel_WARN)
<< M << "\nCould create projection for: " << file << std::endl;
}
}
else
{
ossimNotify(ossimNotifyLevel_WARN)
<< M << "\nCould create geometry for: " << file << std::endl;
}
}
else
{
ossimNotify(ossimNotifyLevel_WARN) << M << "\nCould not open: " << file << std::endl;
}
if(traceDebug())
{
// Since ossimFileWalker is threaded output the file so we know which job exited.
ossimNotify(ossimNotifyLevel_DEBUG) << M << "\nfile: " << file << "\nexited...\n";
}
return result;
} // End: omarDataMgrUtil::callAddRasterService( file )
bool omarDataMgrUtil::callRemoveRasterService( const ossimFilename& file )
{
static const char M[] = "omarDataMgrUtil::callRemoveRasterService";
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< M << " entered...\n" << "\nfile: " << file << "\n";
}
bool result = false;
if ( isPastLastAccessedThreshold( file ) )
{
std::string service;
getService( service );
std::string url;
getUrl( url );
if ( service.size() && url.size() )
{
CURL* curl = curl_easy_init();
if ( curl )
{
// Data for POST:
std::string data = std::string("filename=") + file.string();
curl_easy_setopt( curl, CURLOPT_POSTFIELDS, data.c_str() );
// Create the URL string:
std::string urlString = url + service;
curl_easy_setopt( curl, CURLOPT_URL, urlString.c_str() );
ossimNotify(ossimNotifyLevel_INFO)
<< "data: " << data
<< "\nurl: " << urlString.c_str()
<< std::endl;
// Tell libcurl to follow redirection
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
// Run it:
CURLcode res = curl_easy_perform(curl);
// Check for errors:
if ( res == CURLE_OK )
{
// Response code of the http transaction:
long respcode;
res = curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE, &respcode);
if ( res == CURLE_OK )
{
if ( respcode == 200 ) // OK 200 "The request was fulfilled."
{
result = true; // Set return status for caller.
// Check for clean flag:
if ( getCleanFlag() )
{
clean( file );
}
}
}
}
else
{
ossimNotify(ossimNotifyLevel_WARN)
<< "curl_easy_perform() failed: \n"
<< curl_easy_strerror(res)
<< std::endl;
setErrorStatus( (ossim_int32)res );
}
ossimNotify(ossimNotifyLevel_WARN) << std::endl;
// Always cleanup:
curl_easy_cleanup(curl);
}
// Cleanup curl:
curl_global_cleanup();
} // Matches: if ( service.size() )
} // Matches: if ( isPastLastAccessedThreshold( file ) )
if(traceDebug())
{
// Since ossimFileWalker is threaded output the file so we know which job exited.
ossimNotify(ossimNotifyLevel_DEBUG) << M << "\nfile: " << file << "\nexited...\n";
}
return result;
} // End: omarDataMgrUtil::callRemoveRasterService( file, clean )
void omarDataMgrUtil::clean( const ossimFilename& file ) const
{
// Remove files from disk:
ossimFilename f = file;
// Base image file:
if ( f.exists() )
{
ossimNotify(ossimNotifyLevel_NOTICE) << "\nRemoving file: " << f << "\n";
ossimFilename::remove( f );
}
// Overview:
ossimString e = "ovr";
f.setExtension( e );
if ( f.exists() )
{
ossimNotify(ossimNotifyLevel_NOTICE) << "Removing file: " << f << "\n";
ossimFilename::remove( f );
}
// Histogram:
e = "his";
f.setExtension( e );
if ( f.exists() )
{
ossimNotify(ossimNotifyLevel_NOTICE) << "Removing file: " << f << "\n";
ossimFilename::remove( f );
}
// Omd file:
e = "omd";
f.setExtension( e );
if ( f.exists() )
{
ossimNotify(ossimNotifyLevel_NOTICE) << "Removing file: " << f << "\n";
ossimFilename::remove( f );
}
}
bool omarDataMgrUtil::isFiltered(const ossimFilename& file) const
{
bool result = false;
if ( file.size() )
{
// Strip full path to base name.
std::string baseName = file.file().string();
if ( baseName.size() )
{
std::vector::const_iterator i = m_filteredImages.begin();
while ( i != m_filteredImages.end() )
{
if ( baseName == (*i) )
{
result = true;
break;
}
++i;
}
}
}
#if 0 /* Please leave for debug. (drb) */
if(traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "ossimFileWalker::isFiltered file " << (result?"filtered: ":"not filtered: ")
<< file << "\n";
}
#endif
return result;
}
bool omarDataMgrUtil::keyIsTrue( const std::string& key ) const
{
bool result = false;
if ( m_kwl.valid() )
{
std::string value = m_kwl->findKey( key );
if ( value.size() )
{
result = ossimString(value).toBool();
}
}
return result;
}
const std::vector& omarDataMgrUtil::getFilteredImages() const
{
return m_filteredImages;
}
std::vector& omarDataMgrUtil::getFilteredImages()
{
return m_filteredImages;
}
void omarDataMgrUtil::initializeDefaultFilterList()
{
m_mutex.lock();
// Common images to filter out, put most common first.
m_filteredImages.push_back(std::string("icon.jpg"));
m_filteredImages.push_back(std::string("logo.jpg"));
m_filteredImages.push_back(std::string("preview.jpg"));
m_mutex.unlock();
}
void omarDataMgrUtil::dumpFilteredImageList() const
{
ossimNotify(ossimNotifyLevel_NOTICE) << "Filtered image list:\n";
std::vector::const_iterator i = m_filteredImages.begin();
while ( i != m_filteredImages.end() )
{
ossimNotify(ossimNotifyLevel_NOTICE) << (*i) << "\n";
++i;
}
ossimNotify(ossimNotifyLevel_NOTICE) << std::endl;
}
void omarDataMgrUtil::setDumpFilteredImageListFlag( bool flag )
{
// Add this for hasRequiredOverview method.
std::string key = DUMP_FILTERED_IMAGES_KW;
std::string value = ( flag ? TRUE_KW : FALSE_KW );
addOption( key, value );
}
bool omarDataMgrUtil::getDumpFilterImagesFlag() const
{
return keyIsTrue( DUMP_FILTERED_IMAGES_KW );
}
bool omarDataMgrUtil::getCleanFlag() const
{
return keyIsTrue( CLEAN_KW );
}
void omarDataMgrUtil::setOverrideFilteredImagesFlag( bool flag )
{
std::string key = OVERRIDE_FILTERED_IMAGES_KW;
std::string value = ( flag ? TRUE_KW : FALSE_KW );
addOption( key, value );
}
bool omarDataMgrUtil::getOverrideFilteredImagesFlag() const
{
return keyIsTrue( OVERRIDE_FILTERED_IMAGES_KW );
}
ossim-Miami-2.9.1/apps/curl_apps/omarDataMgrUtil.h 0000664 0000000 0000000 00000017232 13527512531 0022060 0 ustar 00root root 0000000 0000000 //----------------------------------------------------------------------------
// File: omarDataMgrUtil.h
//
// License: See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description: omarDataMgrUtil
//
// See class descriptions below for more.
//
//----------------------------------------------------------------------------
// $Id$
#ifndef omarDataMgrUtil_HEADER
#define omarDataMgrUtil_HEADER 1
#include
#include
#include
#include
#include
#include
#include
#include
#include
class ossimArgumentParser;
class ossimFileWalker;
class ossimGpt;
class ossimImageHandler;
class ossimPropertyInterface;
/**
* @brief omarDataMgrUtil class.
*
* Utility class for processing images recursively and calling OMAR
* dataManager services upon successful open.
*/
class omarDataMgrUtil :
public ossimReferenced, public ossimFileProcessorInterface
{
public:
enum OmarDataMgrUtilService
{
UNKNOWN = 0,
ADD_RASTER = 1,
REMOVE_RASTER = 2
};
/** default constructor */
omarDataMgrUtil();
/** virtual destructor */
virtual ~omarDataMgrUtil();
/**
* @brief Adds application arguments to the argument parser.
* @param ap Parser to add to.
*/
void addArguments(ossimArgumentParser& ap);
/**
* @brief Initial method.
*
* Typically called from application prior to execute. This parses
* all options and put in keyword list m_kwl.
*
* @param ap Arg parser to initialize from.
*
* @return true, indicating process should continue with execute.
*/
bool initialize(ossimArgumentParser& ap);
/**
* @brief Execute method.
*
* This launches file walking mechanism.
*
* @return int, 0 = good, non-zero something happened. Because this can
* process multiple files a non-zero return may indicate just one file
* did not complete, e.g. building overviews.
*
* @note Throws ossimException on error.
*/
ossim_int32 execute();
/**
* @brief ProcessFile method.
*
* Satisfies pure virtual ossimFileProcessorInterface::processFile.
*
* This method is linked to the ossimFileWalker::walk method via a callback
* mechanism. It is called by the ossimFileWalk (caller). In turn this
* class (callee) calls ossimFileWalker::setRecurseFlag and
* ossimFileWalker::setAbortFlag to control the waking process.
*
* @param file to process.
*/
virtual void processFile(const ossimFilename& file);
/**
* @brief Set number of threads to use.
*
* This is only used in execute method if a directory is given to
* application to walk.
*
* @param threads Defaults to 1 if THREADS_KW is not found.
*/
void setNumberOfThreads( ossim_uint32 threads );
void setNumberOfThreads( const std::string& threads );
/** @return The list of filtered out files. */
const std::vector& getFilteredImages() const;
/**
* @brief Non const method to allow access for
* adding or deleting extensions from the list.
*
* The list is used by the private isFiltered method to avoid trying to
* process unwanted files.
*/
std::vector& getFilteredImages();
private:
/** @return service as enumerated type. */
omarDataMgrUtil::OmarDataMgrUtilService getService() const;
/** @brief Gets service string, e.g. /dataManager/addRaster. */
void getService(std::string& serviceString) const;
/** @brief Gets url string, e.g. http://localhost:8080/omar */
void getUrl(std::string& url) const;
/**
* @brief Runs the curl command to call addRaster service.
* @param file Image file.
* @return true if http status code of 200(OK); else, false
*/
bool callAddRasterService( const ossimFilename& file );
/**
* @brief Runs the curl command to call removeRaster service.
* @param file Image file.
* @return true if http status code of 200(OK); else, false
*/
bool callRemoveRasterService( const ossimFilename& file );
/**
* @brief Removes files from disk.
*
* Triggered by the --clean option.
*
* Given:
* base file = foo.ntf
*
* Currently removes:
* foo.ntf
* foo.ovr
* foo.his
* foo.omd
*
* There are no checks for multi-entry images or directory based image
* files.
*/
void clean( const ossimFilename& file ) const;
/**
* @brief Convenience method to check file to see is if file should be
* processed.
*
* @param f File to check.
*
* @return true if f is in filter list, false if not.
*/
bool isFiltered(const ossimFilename& f) const;
/**
* @brief Initializes the filter list with a default set of filtered out
* file names.
*/
void initializeDefaultFilterList();
/** @brief Dumps filtered image list to std out. */
void dumpFilteredImageList() const;
/** @brief Initializes arg parser and outputs usage. */
void usage(ossimArgumentParser& ap);
/**
* @return Threads to use. Defaults to 1 if THREADS_KW is not found.
*/
ossim_uint32 getNumberOfThreads() const;
/**
* @brief Adds option to m_kwl with mutex lock.
* @param key
* @param value
*/
void addOption( const std::string& key, ossim_uint32 value );
void addOption( const std::string& key, const std::string& value );
/**
* @brief Sets the m_errorStatus for return on execute.
*/
void setErrorStatus( ossim_int32 status );
/**
* @brief Sets the dump filteredImageList flag.
* @param flag
*/
void setDumpFilteredImageListFlag( bool flag );
/**
* @return true if DUMP_FILTERED_IMAGES_KW key is found and value is true; else,
* false.
*
* DUMP_FILTERED_IMAGES_KW = "dump_filtered_images"
*/
bool getDumpFilterImagesFlag() const;
/**
* @return true if CLEAN_KW key is found and value is true; else,
* false.
*
* CLEAN_KW = "clean"
*/
bool getCleanFlag() const;
/**
* @brief Sets the override filtered images flag.
* @param flag
*/
void setOverrideFilteredImagesFlag( bool flag );
/**
* @return true if DUMP_FILTERED_IMAGES_KW key is found and value is true; else,
* false.
*
* DUMP_FILTERED_IMAGES_KW = "dump_filtered_images"
*/
bool getOverrideFilteredImagesFlag() const;
/**
* @return true if file is a directory based image and the stager should go
* on to next directory; false if stager should continue with directory.
*/
bool isDirectoryBasedImage(const ossimImageHandler* ih) const;
/**
* @brief Checks file last access time against threshold.
*
* This check for option key "access_time_threshold", value in days. If
* found will return true if files last access time is greater than the
* threshold days. If key is not set the default return is true.
*
* @return true if file is past last accessed threshold.
*/
bool isPastLastAccessedThreshold( const ossimFilename& file ) const;
/** @return true if key is set to true; false, if not. */
bool keyIsTrue( const std::string& key ) const;
/** Holds all options passed into intialize except writer props. */
ossimRefPtr m_kwl;
ossimFileWalker* m_fileWalker;
std::mutex m_mutex;
ossimRefPtr m_imageUtil;
ossim_int32 m_errorStatus;
/** Hold images we never want to process. */
std::vector m_filteredImages;
};
#endif /* #ifndef omarDataMgrUtil_HEADER */
ossim-Miami-2.9.1/apps/ossim-adrg-dump/ 0000775 0000000 0000000 00000000000 13527512531 0017666 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/ossim-adrg-dump/CMakeLists.txt 0000664 0000000 0000000 00000000323 13527512531 0022424 0 ustar 00root root 0000000 0000000 FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
OSSIM_SETUP_APPLICATION(ossim-adrg-dump INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
ossim-Miami-2.9.1/apps/ossim-adrg-dump/ossim-adrg-dump.cpp 0000664 0000000 0000000 00000004624 13527512531 0023410 0 ustar 00root root 0000000 0000000 //*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: Ken Melero
//
//*******************************************************************
// $Id: ossim-adrg-dump.cpp 15122 2009-08-22 15:41:57Z dburken $
#include
#include
#include
using namespace std;
// Common includes.
#include
#include
#include
#include
#include
#include
#include
// Application specfic includes.
// #include "imaging/formats/adrg/ossimAdrgZdr.h"
#include
//***
// Static trace for debugging
//***
static ossimTrace traceDebug("adrg_header_dump:debug");
int main(int argc, char* argv[])
{
ossimArgumentParser argumentParser(&argc, argv);
ossimInit::instance()->addOptions(argumentParser);
ossimInit::instance()->initialize(argumentParser);
argumentParser.getApplicationUsage()->
setApplicationName(argumentParser.getApplicationName());
argumentParser.getApplicationUsage()->
setDescription(argumentParser.getApplicationName()+" This application dumps to screen the contents of an ADRG Header (.gen) file.");
argumentParser.getApplicationUsage()->
setCommandLineUsage(argumentParser.getApplicationName()+" [options] <.imgfile> ");
// Parse command line arguments.
// ossimInit::instance()->initialize(argc, argv);
if (argumentParser.read("-h") ||
argumentParser.read("--help")||(argumentParser.argc() != 2))
{
argumentParser.getApplicationUsage()->write(ossimNotify(ossimNotifyLevel_NOTICE));
exit(0);
}
// ADRG header file.
ossimFilename f = ossimFilename(argv[1]);
if(traceDebug())
cout << "Trying to open header: " << f << endl;
// Instantiate support data class to parse all needed header files.
ossimAdrgHeader* theAdrgHeader = new ossimAdrgHeader(f);
// ossimAdrgZdr* theAdrgHeader = new ossimAdrgZdr(f);
// Check for errors.
if(theAdrgHeader->errorStatus())
{
if (traceDebug())
{
cerr << "Error in ossimAdrg header detected. " << endl;
}
exit(1);
}
// Dump header to stdout.
cout << *theAdrgHeader << endl;
delete theAdrgHeader;
exit(0);
}
ossim-Miami-2.9.1/apps/ossim-applanix2ogeom/ 0000775 0000000 0000000 00000000000 13527512531 0020733 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/ossim-applanix2ogeom/CMakeLists.txt 0000664 0000000 0000000 00000000330 13527512531 0023467 0 ustar 00root root 0000000 0000000 FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
OSSIM_SETUP_APPLICATION(ossim-applanix2ogeom INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
ossim-Miami-2.9.1/apps/ossim-applanix2ogeom/ossim-applanix2ogeom.cpp 0000664 0000000 0000000 00000023557 13527512531 0025530 0 ustar 00root root 0000000 0000000
//----------------------------------------------------------------------------
// Copyright (c) 2005, David Burken, all rights reserved.
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description: Applinix to ossim geometry.
//
// Application to create an ossim geometry file from Applanix
// support data files.
//
//----------------------------------------------------------------------------
// $Id: applanix2ogeom.cpp 13025 2008-06-13 17:06:30Z sbortman $
#include
#include
using namespace std;
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
static const ossimTrace traceDebug(ossimString("applanix2ogeom:debug"));
bool processImage(ossimApplanixEOFile& eo,
const ossimKeywordlist& kwl,
const ossimString& id,
const ossimFilename& outputDir);
int main(int argc, char* argv[])
{
static const char MODULE[] = "applanix2ogeom";
std::string tempString;
ossimArgumentParser::ossimParameter stringParam(tempString);
ossimArgumentParser argumentParser(&argc, argv);
bool outputDirOverrideFlag = false;
ossimInit::instance()->addOptions(argumentParser);
ossimInit::instance()->initialize(argumentParser);
argumentParser.getApplicationUsage()->setApplicationName(
argumentParser.getApplicationName());
argumentParser.getApplicationUsage()->setDescription(
argumentParser.getApplicationName()+
" Creates ossim geometry file from Applannix support data.");
argumentParser.getApplicationUsage()->setCommandLineUsage(
argumentParser.getApplicationName()+
" ");
argumentParser.getApplicationUsage()->addUsageExplanation(
ossimApplicationUsage::OSSIM_COMMAND_LINE_OPTION,
std::string("camera_file"),
std::string("Serial number specific keyword list with camera parameters."));
argumentParser.getApplicationUsage()->addUsageExplanation(
ossimApplicationUsage::OSSIM_COMMAND_LINE_OPTION,
std::string("exterior_orientation_file"),
std::string("Applanix exterior orientation file."));
argumentParser.getApplicationUsage()->addUsageExplanation(
ossimApplicationUsage::OSSIM_COMMAND_LINE_OPTION,
std::string("imageToProcess"),
std::string("Image to create geometry for. If not present then all geometries are created"));
argumentParser.getApplicationUsage()->addUsageExplanation(
ossimApplicationUsage::OSSIM_COMMAND_LINE_OPTION,
std::string("option_output_directory"),
std::string("Option directory to output geometry file(s) to. If not set the imageToProcess directory will be used."));
argumentParser.getApplicationUsage()->addCommandLineOption(
"-h or --help", "Shows help");
//---
// Extract optional arguments.
//---
if(argumentParser.read("-h") || argumentParser.read("--help"))
{
argumentParser.getApplicationUsage()->write(std::cout);
exit(0);
}
argumentParser.reportRemainingOptionsAsUnrecognized();
if (argumentParser.errors())
{
argumentParser.writeErrorMessages(std::cout);
exit(1);
}
// cout << "argc: " << argumentParser.argc() << endl;
if(argumentParser.argc() < 4)
{
argumentParser.getApplicationUsage()->write(std::cout);
exit(1);
}
// if(argumentParser.argc() == 4)
// {
// if(!ossimFilename(argumentParser.argv()[3]).isDir())
// {
// ossimNotify(ossimNotifyLevel_WARN) << "for the 3 argument option the last argument must be a directory" << std::endl;
// exit(0);
// }
// }
ossimFilename cameraFile = argumentParser.argv()[1];
ossimFilename eoFile = argumentParser.argv()[2];
ossimFilename imageToProcess;
ossimFilename outputDir;
ossim_uint32 maxIdx = argumentParser.argc();
if (argumentParser.argc() > 4)
{
outputDir = argumentParser.argv()[argumentParser.argc()-1];
if (outputDir.isDir() == false) // doesn't exist
{
--maxIdx;
if (outputDir.createDirectory() == false)
{
ossimNotify(ossimNotifyLevel_WARN)
<< MODULE << " ERROR:"
<< "\nCould not create directory: " << outputDir
<< endl;
exit(1);
}
}
outputDirOverrideFlag = outputDir.exists();
}
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< MODULE << " DEBUG:"
<< "\ncamera file: " << cameraFile
<< "\neo file: " << eoFile
<< endl;
}
// Keyword list to pass to model loadState.
ossimKeywordlist kwl;
// Open up the exterior orientation file.
ossimApplanixEOFile eo;
if (eo.parseFile(eoFile) == false)
{
ossimNotify(ossimNotifyLevel_WARN)
<< "Could not open: " << eoFile << endl;
exit(1);
}
eo.indexRecordIds();
if(argc >4)
{
ossim_uint32 idx = 0;
for(idx = 3; idx < maxIdx; ++idx)
{
kwl.clear();
// Add the eo_file keyword to the keyword list.
kwl.add("eo_file", eoFile.c_str(), true);
// Add the eo_file keyword to the keyword list.
kwl.add("camera_file", cameraFile.c_str(), true);
kwl.add("compute_gsd_flag", true, true);
// See if the ID is in the eo file.
imageToProcess = argumentParser.argv()[idx];
ossimString id = imageToProcess.fileNoExtension();
ossimRefPtr rec = eo.getRecordGivenId(id);
if (!rec)
{
ossimNotify(ossimNotifyLevel_WARN)
<< "applanix2ogeom ERROR:"
<< "\nMatching id for imageToProcess not found in eo file!"
<< "\nfile: " << imageToProcess
<< "\nid: " << id
<< "\nReturning..." << endl;
exit(1);
}
kwl.add("image_id", id, true);
if (!outputDirOverrideFlag)
{
outputDir = imageToProcess.path();
}
processImage(eo, kwl, id, outputDir);
}
}
else if(argc <=4)
{
outputDir = argumentParser.argv()[argumentParser.argc()-1];
if(!outputDir .isDir())
{
ossimFilename idFile = outputDir.file();
outputDir = outputDir.path();
idFile = idFile.setExtension("");
const ossimRefPtr rec = eo.getRecordGivenId(idFile);
if(rec.valid())
{
// Add the eo_file keyword to the keyword list.
kwl.add("eo_file", eoFile.c_str(), true);
kwl.add("eo_id", idFile.c_str(), true);
// Add the eo_file keyword to the keyword list.
kwl.add("camera_file", cameraFile.c_str(), true);
kwl.add("compute_gsd_flag", true, true);
processImage(eo, kwl, idFile, outputDir);
}
}
else
{
ossim_uint32 idx = 0;
ossim_uint32 nRecords = eo.getNumberOfRecords();
ossim_int32 idIdx = eo.getFieldIdx("ID");
if(idIdx >= 0)
{
for(idx = 0; idx < nRecords; ++idx)
{
const ossimRefPtr rec = eo.getRecord(idx);
if(rec.valid())
{
ossimString id = (*rec)[idIdx];
// Add the eo_file keyword to the keyword list.
kwl.add("eo_file", eoFile.c_str(), true);
kwl.add("eo_id", id.c_str(), true);
// Add the eo_file keyword to the keyword list.
kwl.add("camera_file", cameraFile.c_str(), true);
kwl.add("compute_gsd_flag", true, true);
processImage(eo, kwl, id, outputDir);
}
}
}
else
{
ossimNotify(ossimNotifyLevel_WARN) << "NO ID RECORD FOUND!!" << std::endl;
exit(0);
}
}
}
return 0;
}
bool processImage(ossimApplanixEOFile& eo,
const ossimKeywordlist& kwl,
const ossimString& id,
const ossimFilename& outputDir)
{
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "applanix2ogeom:processImage DEBUG:"
<< "\nkwl:\n"
<< kwl
<< endl;
}
// ossimRefPtr model = new ossimApplanixEcefModel;
ossimRefPtr model;
if(eo.isUtmFrame())
{
model = new ossimApplanixUtmModel;
}
else
{
model = new ossimApplanixEcefModel;
}
if (model->loadState(kwl) == false)
{
ossimNotify(ossimNotifyLevel_WARN)
<< "applanix2ogeom:processImage ERROR:"
<< "\nossimApplanixEcefModel::loadState failded for id: "
<< id
<< endl;
return false;
}
ossimFilename geomFile = id;
geomFile.setExtension(ossimString(".geom"));
if (outputDir != ossimFilename::NIL)
{
geomFile = outputDir.dirCat(geomFile);
}
ossimKeywordlist geomKwl;
model->saveState(geomKwl);
if (geomKwl.write(geomFile.c_str()) == false)
{
ossimNotify(ossimNotifyLevel_WARN)
<< "applanix2ogeom:processImage ERROR:"
<< "\nCould not write file: " << geomFile << endl;
return false;
}
else
{
ossimNotify(ossimNotifyLevel_NOTICE)
<< "Wrote file: " << geomFile << endl;
}
return true;
}
ossim-Miami-2.9.1/apps/ossim-autreg/ 0000775 0000000 0000000 00000000000 13527512531 0017275 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/ossim-autreg/CMakeLists.txt 0000664 0000000 0000000 00000000320 13527512531 0022030 0 ustar 00root root 0000000 0000000 FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
OSSIM_SETUP_APPLICATION(ossim-autreg INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
ossim-Miami-2.9.1/apps/ossim-autreg/ossim-autreg.cpp 0000664 0000000 0000000 00000005106 13527512531 0022422 0 ustar 00root root 0000000 0000000 //----------------------------------------------------------------------------
//
// File: ossim-autreg.cpp
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: David Hicks
//
// Description: Autonomous registration.
//
//----------------------------------------------------------------------------
// $Id$
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
static ossimTrace traceDebug = ossimTrace("ossim-autreg:debug");
int main(int argc, char *argv[])
{
// Start the timer.
ossimTimer::instance()->setStartTick();
//---
// Get the arg count so we can tell if an arg was consumed by
// ossimInit::instance()->initialize
//---
int originalArgCount = argc;
ossimArgumentParser ap(&argc, argv);
// Initialize ossim stuff, factories, plugin, etc.
ossimInit::instance()->initialize(ap);
//---
// Avoid going on if a global option was consumed by ossimInit::initialize
// like -V or --version option and the arg count is down to 1.
//---
if ( ( ap.argc() > 1 ) || ( ap.argc() == originalArgCount ) )
{
ossimRefPtr autreg = new ossimAutRegUtil;
try
{
//---
// NOTE: ossimAutRegUtil::initialize handles the application usage which will
// false, to end things if certain options (e.g. "--help") are provided.
//
// ossimAutRegUtil::initialize can throw an exception.
//---
bool goAhead = autreg->initialize(ap);
if (goAhead)
{
// ossimAutRegUtil::execute can throw an excepion.
autreg->execute();
ossimNotify(ossimNotifyLevel_NOTICE)
<< "elapsed time in seconds: "
<< std::setiosflags(ios::fixed)
<< std::setprecision(3)
<< ossimTimer::instance()->time_s() << endl;
}
}
catch (const ossimException& e)
{
ossimNotify(ossimNotifyLevel_WARN) << e.what() << std::endl;
exit(1);
}
} // End: if ( ( ap.argc() > 1 ) ...
exit(0);
} // End of main...
ossim-Miami-2.9.1/apps/ossim-band-merge/ 0000775 0000000 0000000 00000000000 13527512531 0020007 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/ossim-band-merge/CMakeLists.txt 0000664 0000000 0000000 00000000324 13527512531 0022546 0 ustar 00root root 0000000 0000000 FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
OSSIM_SETUP_APPLICATION(ossim-band-merge INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
ossim-Miami-2.9.1/apps/ossim-band-merge/ossim-band-merge.cpp 0000664 0000000 0000000 00000023250 13527512531 0023646 0 ustar 00root root 0000000 0000000 //*******************************************************************
// Copyright (C) 2002 ImageLinks Inc.
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: Ken Melero
//
// Merges input images together into output image. Images must be of
// same scalar type and same number of bands. If image width is different
// output image will be expanded to the largest input image width.
//
//*******************************************************************
// $Id: band_merge.cpp 10695 2007-04-12 13:56:50Z gpotts $
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
static ossimTrace traceDebug("band_merge:main");
static void usage();
static void outputWriterTypes();
int main(int argc, char* argv[])
{
static const char MODULE[] = "band_merge:main";
std::string tempString;
ossimArgumentParser::ossimParameter stringParam(tempString);
ossimArgumentParser argumentParser(&argc, argv);
ossimInit::instance()->addOptions(argumentParser);
ossimInit::instance()->initialize(argumentParser);
argumentParser.getApplicationUsage()->setApplicationName(argumentParser.getApplicationName());
argumentParser.getApplicationUsage()->setDescription(argumentParser.getApplicationName()+" merges band separate images to one image");
argumentParser.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
argumentParser.getApplicationUsage()->addCommandLineOption("-o or --create-overview", "Creates and overview for the output image");
argumentParser.getApplicationUsage()->addCommandLineOption("-w or --tile-width", "Defines the tile width for the handlers that support tiled output");
if (traceDebug()) CLOG << " Entered..." << std::endl;
if (argumentParser.read("-h") ||
argumentParser.read("--help")||(argumentParser.argc() < 2))
{
argumentParser.getApplicationUsage()->write(std::cout);
usage(); // for writer output types
exit(0);
}
// Keyword list to initialize image writers with.
ossimKeywordlist kwl;
const char* PREFIX = "imagewriter.";
ossim_uint32 tile_width = 32;
bool create_overview = false;
if (argumentParser.read("-o") || argumentParser.read("--crate-overview"))
{
create_overview = true;
std::cout << "\nOutput overview building enabled." << std::endl;
}
if (argumentParser.read("-w", stringParam) ||
argumentParser.read("-tile-width", stringParam))
{
tile_width = ossimString(tempString).toInt();
if ((tile_width % 16) != 0)
{
cerr << MODULE << " NOTICE:"
<< "\nTile width must be a multiple of 16!"
<< "\nDefaulting to 128"
<< std::endl;
tile_width = 0;
}
std::cout << "Tile width set to: " << tile_width << std::endl;
}
argumentParser.reportRemainingOptionsAsUnrecognized();
// Three required args: output_type, input file, and output file.
if (argumentParser.errors())
{
argumentParser.writeErrorMessages(std::cout);
exit(0);
}
if (argumentParser.argc() == 1)
{
argumentParser.getApplicationUsage()->write(std::cout);
usage(); // for writer output types
exit(0);
}
ossim_uint32 number_of_source_images = argumentParser.argc() - 3;
if (traceDebug())
{
CLOG << "DEBUG:"
<< "\nargc: " << argumentParser.argc()
<< "\nnumber_of_source_images: " << number_of_source_images
<< "\ntile_width: " << tile_width
<< "\ncreate_overview: " << (create_overview?"true":"false")
<< std::endl;
}
ossimString output_type = argv[1];
output_type.downcase();
std::cout << "Output type: " << output_type << std::endl;
// Create the vector of image handlers.
ossimConnectableObject::ConnectableObjectList ihs;
for(ossim_uint32 h = 0; h < number_of_source_images; ++h)
{
ossimFilename f = argv[h + 2];
std::cout << "Input_image[" << h << "]: " << f << std::endl;
ihs.push_back(ossimImageHandlerRegistry::instance()->open(f));
}
// Get the output file.
ossimFilename output_file = argv[argumentParser.argc() - 1];
std::cout << "Output file: " << output_file << std::endl;
//---
// Set the output writer type and the image type.
//---
kwl.add(PREFIX, ossimKeywordNames::TYPE_KW, output_type.c_str());
ossimRefPtr bm = new ossimBandMergeSource(ihs);
ossimRefPtr fileWriter =
ossimImageWriterFactoryRegistry::instance()->createWriter(kwl, PREFIX);
if(!fileWriter)
{
bm->disconnect();
bm = 0;
ossimConnectableObject::ConnectableObjectList::iterator i = ihs.begin();
while (i != ihs.end())
{
(*i)->disconnect();
(*i) = 0;
++i;
}
cerr << "Error making an image writer..."
<< "\nExiting application..." << std::endl;
exit(1);
}
// Write out a geometry file for new image.
ossimKeywordlist bm_geom;
ossimRefPtr geom = bm->getImageGeometry();
geom->saveState(bm_geom);
ossimFilename geom_file = output_file;
geom_file.setExtension("geom");
bm_geom.write(geom_file);
fileWriter->connectMyInputTo(0, bm.get());
if (tile_width)
{
// Set the tile size...
fileWriter->setTileSize(ossimIpt(tile_width, tile_width));
}
fileWriter->open(output_file);
ossimStdOutProgress prog(2);
fileWriter->addListener(&prog);
fileWriter->setAreaOfInterest(bm->getBoundingRect());
if( fileWriter->canCastTo("ossimTiffWriter") )
{
// ossimTiffWriter* twriter = PTR_CAST(ossimTiffWriter, fileWriter);
if(fileWriter.valid())
{
try
{
fileWriter->execute();
}
catch(std::exception& e)
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "band_merge: ERROR exception caught:\n"
<< e.what()
<< std::endl;
}
catch (...)
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "band_merge: ERROR - Unknown exception caught!"
<< std::endl;
}
}
}
else if(fileWriter->canCastTo("ossimJpegWriter"))
{
ossimRefPtr remapper = NULL;
if(PTR_CAST(ossimJpegWriter, fileWriter.get()) &&
(bm->getOutputScalarType() != OSSIM_UCHAR))
{
remapper = new ossimScalarRemapper(bm.get(), OSSIM_UCHAR);
remapper->initialize();
fileWriter->connectMyInputTo(0, remapper.get());
}
fileWriter->initialize();
try
{
fileWriter->execute();
}
catch(std::exception& e)
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "band_merge: ERROR exception caught:\n"
<< e.what()
<< std::endl;
}
catch (...)
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "band_merge: ERROR - Unknown exception caught!"
<< std::endl;
}
}
else
{
try
{
fileWriter->execute();
}
catch(std::exception& e)
{
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "band_merge: ERROR exception caught:\n"
<< e.what()
<< std::endl;
}
}
catch (...)
{
if (traceDebug())
{
ossimNotify(ossimNotifyLevel_DEBUG)
<< "band_merge: ERROR - Unknown exception caught!"
<< std::endl;
}
}
}
if (create_overview == true)
{
fileWriter->writeOverviewFile();
}
fileWriter->disconnect();
fileWriter = 0;
bm = 0;
ossimConnectableObject::ConnectableObjectList::iterator it = ihs.begin();
while (it != ihs.end())
{
(*it)->disconnect();
(*it) = 0;
++it;
}
exit(0);
}
void usage()
{
std::cout
<< "band_merge: Band Merge\n"
<< "Usage:\n"
<< "band_merge [-h][-o][-w tile_width] "
<< " ... "
<< "\n\nOptional argument list:"
<< "\n -h -- display Usage/Help"
<< "\n -o -- create an ossim overview file with output file"
<< "\n -w -- tile width (default = 32)"
<< "\n"
<< "\nNOTES:"
<< "\n\"-w\" option only valid with tiff type."
<< "\n\"Tile width must be a multiple of 32."
<< "\nValid output writer types:"
<< "\n";
outputWriterTypes();
}
void outputWriterTypes()
{
ossimImageTypeLut lut;
ossim_uint32 index = 0;
ossimString type = lut.getTableIndexString(index);
while (type.size())
{
std::cout << "\t" << type << std::endl;
++index;
type = lut.getTableIndexString(index);
}
std::cout << std::endl;
}
ossim-Miami-2.9.1/apps/ossim-btoa/ 0000775 0000000 0000000 00000000000 13527512531 0016733 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/ossim-btoa/CMakeLists.txt 0000664 0000000 0000000 00000000316 13527512531 0021473 0 ustar 00root root 0000000 0000000 FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
OSSIM_SETUP_APPLICATION(ossim-btoa INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
ossim-Miami-2.9.1/apps/ossim-btoa/ossim-btoa.cpp 0000664 0000000 0000000 00000014325 13527512531 0021521 0 ustar 00root root 0000000 0000000 //*******************************************************************
// Copyright (C) 2000 ImageLinks Inc.
//
// License: See top level LICENSE.txt file.
//
// Author: Ken Melero
// Originally written by Oscar Kramer.
//
// Description: This app displays a binary file in a nice
// formatted view. Very helpful for finding offsets of
// binary headers.
//
//********************************************************************
// $Id: ossim-btoa.cpp 22209 2013-03-29 13:38:38Z dburken $
#include
#include
#include
#include
#include
using namespace std;
// Regular print with offset, hex, and ascii section.
static void print( FILE* fptr, bool isEbcdic )
{
int offset = 0;
unsigned char bin_data[16];
char asc_data[17];
int hex_data[16];
int nbytes;
int i;
asc_data[16] = '\0';
ossimEbcdicToAscii* e2a = 0;
if ( isEbcdic )
{
e2a = new ossimEbcdicToAscii;
}
while (!feof(fptr))
{
nbytes = (int)fread(bin_data, 16, 1, fptr);
for(i=0; i<16; i++)
{
hex_data[i] = (int) bin_data[i];
if (e2a)
{
bin_data[i] = e2a->ebcdicToAscii(bin_data[i]);
}
if ((bin_data[i] >= 0x20) && (bin_data[i] < 0x7F)) // 0x7F is a DEL
{
asc_data[i] = bin_data[i];
}
else
{
asc_data[i] = '.';
}
}
printf("%06d %02X %02X %02X %02X %02X %02X %02X %02X "
"%02X %02X %02X %02X %02X %02X %02X %02X %16s\n", offset,
hex_data[0], hex_data[1], hex_data[2], hex_data[3],
hex_data[4], hex_data[5], hex_data[6], hex_data[7],
hex_data[8], hex_data[9], hex_data[10], hex_data[11],
hex_data[12], hex_data[13], hex_data[14], hex_data[15],
asc_data);
offset += 16;
}
if (e2a)
{
delete e2a;
e2a = 0;
}
} // End: print(...)
// Wide print offset and ascii section only.
static void printWide( FILE* fptr, bool isEbcdic )
{
const int WIDTH = 64;
int offset = 0;
unsigned char bin_data[WIDTH];
char asc_data[WIDTH+1];
int nbytes;
int i = 0;
asc_data[WIDTH] = '\0';
ossimEbcdicToAscii* e2a = 0;
if ( isEbcdic )
{
e2a = new ossimEbcdicToAscii;
}
while (!feof(fptr))
{
nbytes = (int)fread(bin_data, WIDTH, 1, fptr);
for( i = 0; i < WIDTH; ++i )
{
if (e2a)
{
bin_data[i] = e2a->ebcdicToAscii(bin_data[i]);
}
if ((bin_data[i] >= 0x20) && (bin_data[i] < 0x7F)) // 0x7F is a DEL
{
asc_data[i] = bin_data[i];
}
else
{
asc_data[i] = '.';
}
}
printf("%06d %64s\n", offset, asc_data);
offset += WIDTH;
}
if (e2a)
{
delete e2a;
e2a = 0;
}
} // End printWide( ... )
// Wide print ascii section only.
static void printAscii( FILE* fptr, bool isEbcdic )
{
const int WIDTH = 80;
int offset = 0;
unsigned char bin_data[WIDTH];
char asc_data[WIDTH+1];
int nbytes;
int i = 0;
asc_data[WIDTH] = '\0';
ossimEbcdicToAscii* e2a = 0;
if ( isEbcdic )
{
e2a = new ossimEbcdicToAscii;
}
while (!feof(fptr))
{
nbytes = (int)fread(bin_data, WIDTH, 1, fptr);
for( i = 0; i < WIDTH; ++i )
{
if (e2a)
{
bin_data[i] = e2a->ebcdicToAscii(bin_data[i]);
}
if ((bin_data[i] >= 0x20) && (bin_data[i] < 0x7F)) // 0x7F is a DEL
{
asc_data[i] = bin_data[i];
}
else
{
asc_data[i] = '.';
}
}
printf( "%80s\n", asc_data );
offset += WIDTH;
}
if (e2a)
{
delete e2a;
e2a = 0;
}
} // printAscii
int main(int argc, char** argv)
{
// Parse the args:
ossimArgumentParser argumentParser(&argc, argv);
enum PrintMode
{
ALL = 0, // offsets hex ascii - default
WIDE = 1, // offsets ascii - "-w" option
ASCII = 2 // ascii - "-a" option
};
// Check for options:
bool isEbcdic = false;
PrintMode mode = ALL;
if ( argumentParser.read("-e") )
{
isEbcdic = true;
}
if ( argumentParser.read("-w") )
{
mode = WIDE;
}
if ( argumentParser.read("-a") )
{
if ( mode != ALL )
{
std::cerr << "Cannot use -a and -w options." << std::endl;
return -1;
}
mode = ASCII;
}
if ( argumentParser.read("-h") || argumentParser.read("--help"))
{
std::cout << "\nDisplays a binary file as ASCII/hexadecimal. If no input file is provided, then\n"
<< "input is taken from stdin. Non-ascii characters are printed as dot in ascii output.\n"
<< "Default mode prints offsets, hex and ascii data.\n\n"
<< "Usage: btoa [options] []\n\n"
<< "Options:\n\n"
<< " -e Indicates text characters are ebcdic and should be"
<< " converted to ascii.\n"
<< " -h, --help Shows this usage\n"
<< " -a Ascii mode, prints 64 characters wide with no offset or hex data.\n"
<< " -w Wide mode, prints offset and 64 characters wide with no hex data.\n"
<< std::endl;
return 0;
}
FILE* fptr = 0;
if (argumentParser.argc() > 1)
{
fptr = fopen(argv[argumentParser.argc() - 1], "rb");
if (fptr == 0)
{
std::cout << "\nError opening file " << argv[argumentParser.argc() - 1]
<< std::endl << std::endl;
return -1;
}
}
else
fptr = stdin;
if ( mode == WIDE )
{
printWide( fptr, isEbcdic );
}
else if ( mode == ASCII )
{
printAscii( fptr, isEbcdic );
}
else // default
{
print( fptr, isEbcdic );
}
fclose (fptr);
return 0;
} // End: main( ... )
ossim-Miami-2.9.1/apps/ossim-chgkwval/ 0000775 0000000 0000000 00000000000 13527512531 0017614 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/ossim-chgkwval/CMakeLists.txt 0000664 0000000 0000000 00000000322 13527512531 0022351 0 ustar 00root root 0000000 0000000 FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
OSSIM_SETUP_APPLICATION(ossim-chgkwval INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
ossim-Miami-2.9.1/apps/ossim-chgkwval/ossim-chgkwval.cpp 0000664 0000000 0000000 00000004462 13527512531 0023264 0 ustar 00root root 0000000 0000000 //*******************************************************************
// Copyright (C) 2000 ImageLinks Inc.
//
// License: See top level LICENSE.txt file.
//
// Author: Ken Melero
//
// Description: Changes the value of a keyword within a keyword list to
// value passed in by user.
//
//********************************************************************
// $Id: chgkwval.cpp 13083 2008-06-25 19:45:41Z dburken $
#include
#include
#include
int main(int argc, char* argv[])
{
enum
{
OK = 0,
ERROR = 1
};
int status = OK;
if ( argc == 4 )
{
ossimFilename kwlFile = argv[1];
ossimKeywordlist kwl;
if ( kwlFile.exists() )
{
// Open existing keyword list.
if ( kwl.addFile( kwlFile ) == false )
{
status = ERROR;
std::cerr
<< "Error opening keyword list: " << kwlFile << std::endl;
}
}
if ( status == OK )
{
std::string key = argv[2];
std::string value = argv[3];
// Add or change the value of keyword in the keyword list.
kwl.addPair( key, value, true );
// Create or re-write the file.
kwl.write(kwlFile);
std::cout
<< "Added or changed key: \"" << key << "\" with value: \"" << value
<< "\" in " << kwlFile << std::endl;
}
}
else // Usage:
{
std::cout
<< "Usage: chgkwval \n"
<< "Changes the keyword value within the keyword list to "
<< "value specified.\n"
<< "Example: chgval band1.spec area.size \"pixels 7689 8031\"\n"
<< "Changes the keyword value of area.size to pixels 7689 8031\n\n"
<< "Note 1: Use no colon \":\" after the keyword.\n"
<< "Note 2: If the keyword is present in the keyword list it will\n"
<< " be overwritten.\n"
<< "Note 3: If the keyword is not in the keyword list it will"
<< " be added.\n"
<< "Note 4: Enclose value in double quotes if it is more than one"
<< " string.\n"
<< "Note 5: Will create file if doesn't exists.\n"
<< std::endl;
}
return status;
}
ossim-Miami-2.9.1/apps/ossim-chipper/ 0000775 0000000 0000000 00000000000 13527512531 0017440 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/ossim-chipper/CMakeLists.txt 0000664 0000000 0000000 00000000321 13527512531 0022174 0 ustar 00root root 0000000 0000000 FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
OSSIM_SETUP_APPLICATION(ossim-chipper INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
ossim-Miami-2.9.1/apps/ossim-chipper/ossim-chipper.cpp 0000664 0000000 0000000 00000005355 13527512531 0022736 0 ustar 00root root 0000000 0000000 //----------------------------------------------------------------------------
//
// File: ossim-chipper.cpp
//
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: David Burken
//
// Description: Utility class definition for processing digital elevation models(dems).
//
//----------------------------------------------------------------------------
// $Id$
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include /* for exit */
#include
#include
using namespace std;
static ossimTrace traceDebug = ossimTrace("ossim-chipper:debug");
int main(int argc, char* argv[])
{
ossimTimer timer;
// Start the timer.
ossimTimer::Timer_t tickStart = timer.tick();
//---
// Get the arg count so we can tell if an arg was consumed by
// ossimInit::instance()->initialize
//---
int originalArgCount = argc;
ossimArgumentParser ap(&argc, argv);
// Initialize ossim stuff, factories, plugin, etc.
ossimInit::instance()->initialize(ap);
//---
// Avoid going on if a global option was consumed by ossimInit::initialize
// like -V or --version option and the arg count is down to 1.
//---
if ( ( ap.argc() > 1 ) || ( ap.argc() == originalArgCount ) )
{
// Make the generator.
ossimRefPtr chipper = new ossimChipperUtil;
try
{
//---
// NOTE: ossimChipperUtil::initialize handles the application usage which will
// false, to end things if certain options (e.g. "--help") are provided.
//
// ossimChipperUtil::initialize can throw an exception.
//---
bool continue_after_init = chipper->initialize(ap);
if (continue_after_init)
{
// ossimChipperUtil::execute can throw an excepion.
chipper->execute();
ossimTimer::Timer_t tickEnd = timer.tick();
ossimNotify(ossimNotifyLevel_NOTICE)
<< "elapsed time in seconds: "
<< std::setiosflags(ios::fixed)
<< std::setprecision(3)
<< timer.delta_s(tickStart, tickEnd) << endl;
}
}
catch (const ossimException& e)
{
ossimNotify(ossimNotifyLevel_WARN) << e.what() << std::endl;
exit(1);
}
} // End: if ( ( ap.argc() > 1 ) ...
exit(0);
} // End of main...
ossim-Miami-2.9.1/apps/ossim-cli/ 0000775 0000000 0000000 00000000000 13527512531 0016555 5 ustar 00root root 0000000 0000000 ossim-Miami-2.9.1/apps/ossim-cli/CMakeLists.txt 0000664 0000000 0000000 00000000315 13527512531 0021314 0 ustar 00root root 0000000 0000000 FILE(GLOB SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
OSSIM_SETUP_APPLICATION(ossim-cli INSTALL COMMAND_LINE COMPONENT_NAME ossim SOURCE_FILES ${SOURCE_FILES})
ossim-Miami-2.9.1/apps/ossim-cli/ossim-cli.cpp 0000775 0000000 0000000 00000011304 13527512531 0021162 0 ustar 00root root 0000000 0000000 //**************************************************************************************************
//
// OSSIM Open Source Geospatial Data Processing Library
// See top level LICENSE.txt file for license information
//
//**************************************************************************************************
#include
#include
#include