Merge branch 'develop'

Conflicts:
	gtsam/base/SymmetricBlockMatrix.cpp
	gtsam/linear/JacobianFactor-inl.h
	gtsam_unstable/geometry/tests/testTriangulation.cpp
release/4.3a0
Luca 2014-03-12 12:57:59 -04:00
commit 6f692b1547
927 changed files with 571162 additions and 1500 deletions

View File

@ -46,14 +46,11 @@ endif()
# Set up options
# Configurable Options
option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" OFF) # These do not currently work
option(GTSAM_BUILD_EXAMPLES "Enable/Disable building of examples" ON)
if(GTSAM_UNSTABLE_AVAILABLE)
option(GTSAM_BUILD_UNSTABLE "Enable/Disable libgtsam_unstable" ON)
endif()
option(GTSAM_BUILD_SHARED_LIBRARY "Enable/Disable building of a shared version of gtsam" ON)
option(GTSAM_BUILD_STATIC_LIBRARY "Enable/Disable building of a static version of gtsam" OFF)
option(GTSAM_BUILD_STATIC_LIBRARY "Build a static gtsam library, instead of shared" OFF)
option(GTSAM_USE_QUATERNIONS "Enable/Disable using an internal Quaternion representation for rotations instead of rotation matrices. If enable, Rot3::EXPMAP is enforced by default." OFF)
option(GTSAM_POSE3_EXPMAP "Enable/Disable using Pose3::EXPMAP as the default mode. If disabled, Pose3::FIRST_ORDER will be used." OFF)
option(GTSAM_ROT3_EXPMAP "Ignore if GTSAM_USE_QUATERNIONS is OFF (Rot3::EXPMAP by default). Otherwise, enable Rot3::EXPMAP, or if disabled, use Rot3::CAYLEY." OFF)
@ -76,27 +73,14 @@ if(GTSAM_INSTALL_WRAP AND NOT GTSAM_BUILD_WRAP)
message(FATAL_ERROR "GTSAM_INSTALL_WRAP is enabled, please also enable GTSAM_BUILD_WRAP")
endif()
if(GTSAM_INSTALL_MATLAB_TOOLBOX AND GTSAM_BUILD_STATIC_LIBRARY)
message(FATAL_ERROR "GTSAM_INSTALL_MATLAB_TOOLBOX and GTSAM_BUILD_STATIC_LIBRARY are both enabled. The MATLAB wrapper cannot be compiled with a static GTSAM library because mex modules are themselves shared libraries. If you want a self-contained mex module, enable GTSAM_MEX_BUILD_STATIC_MODULE instead of GTSAM_BUILD_STATIC_LIBRARY.")
endif()
# Flags for choosing default packaging tools
set(CPACK_SOURCE_GENERATOR "TGZ" CACHE STRING "CPack Default Source Generator")
set(CPACK_GENERATOR "TGZ" CACHE STRING "CPack Default Binary Generator")
# Sanity check building of libraries
if (NOT GTSAM_BUILD_SHARED_LIBRARY AND NOT GTSAM_BUILD_STATIC_LIBRARY)
message(FATAL_ERROR "Both shared and static version of GTSAM library disabled - need to choose at least one!")
endif()
# Flags to determine whether tests and examples are build during 'make install'
# Note that these remove the targets from the 'all'
option(GTSAM_DISABLE_TESTS_ON_INSTALL "Disables building tests during install" ON)
option(GTSAM_DISABLE_EXAMPLES_ON_INSTALL "Disables building examples during install" OFF)
# Pull in infrastructure
if (GTSAM_BUILD_TESTS)
enable_testing()
include(Dart)
include(CTest)
endif()
###############################################################################
# Find boost
@ -134,6 +118,7 @@ else()
if(Boost_TIMER_LIBRARY)
list(APPEND GTSAM_BOOST_LIBRARIES ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY})
else()
list(APPEND GTSAM_BOOST_LIBRARIES rt) # When using the header-only boost timer library, need -lrt
message("WARNING: GTSAM timing instrumentation will use the older, less accurate, Boost timer library because boost older than 1.48 was found.")
endif()
endif()
@ -171,23 +156,27 @@ find_package(GooglePerfTools)
###############################################################################
# Find MKL
find_package(MKL)
if(GTSAM_USE_EIGEN_MKL)
find_package(MKL)
if(MKL_FOUND AND GTSAM_WITH_EIGEN_MKL)
set(GTSAM_USE_EIGEN_MKL 1) # This will go into config.h
set(EIGEN_USE_MKL_ALL 1) # This will go into config.h - it makes Eigen use MKL
include_directories(${MKL_INCLUDE_DIR})
list(APPEND GTSAM_ADDITIONAL_LIBRARIES ${MKL_LIBRARIES})
if(MKL_FOUND AND GTSAM_WITH_EIGEN_MKL)
set(GTSAM_USE_EIGEN_MKL 1) # This will go into config.h
set(EIGEN_USE_MKL_ALL 1) # This will go into config.h - it makes Eigen use MKL
include_directories(${MKL_INCLUDE_DIR})
list(APPEND GTSAM_ADDITIONAL_LIBRARIES ${MKL_LIBRARIES})
endif()
endif()
###############################################################################
# Find OpenMP
find_package(OpenMP)
# Find OpenMP (if we're also using MKL)
if(GTSAM_USE_EIGEN_MKL AND GTSAM_USE_EIGEN_MKL_OPENMP AND GTSAM_USE_EIGEN_MKL)
find_package(OpenMP)
if(OPENMP_FOUND AND GTSAM_USE_EIGEN_MKL AND GTSAM_WITH_EIGEN_MKL_OPENMP)
set(GTSAM_USE_EIGEN_MKL_OPENMP 1) # This will go into config.h
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
if(OPENMP_FOUND AND GTSAM_USE_EIGEN_MKL AND GTSAM_WITH_EIGEN_MKL_OPENMP)
set(GTSAM_USE_EIGEN_MKL_OPENMP 1) # This will go into config.h
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif()
@ -286,24 +275,11 @@ endif()
if(GTSAM_ENABLE_CONSISTENCY_CHECKS)
add_definitions(-DGTSAM_EXTRA_CONSISTENCY_CHECKS)
endif()
endif()
###############################################################################
# Add components
# Set default library - static or shared, before adding subdirectories
if(GTSAM_BUILD_SHARED_LIBRARY)
set(gtsam-default gtsam-shared)
if(GTSAM_BUILD_UNSTABLE)
set(gtsam_unstable-default gtsam_unstable-shared)
endif()
else()
set(gtsam-default gtsam-static)
if(GTSAM_BUILD_UNSTABLE)
set(gtsam_unstable-default gtsam_unstable-static)
endif()
endif()
# Build CppUnitLite
add_subdirectory(CppUnitLite)
@ -319,9 +295,7 @@ add_subdirectory(gtsam)
add_subdirectory(tests)
# Build examples
if (GTSAM_BUILD_EXAMPLES)
add_subdirectory(examples)
endif(GTSAM_BUILD_EXAMPLES)
add_subdirectory(examples)
# Matlab toolbox
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
@ -345,13 +319,16 @@ if (DOXYGEN_FOUND)
add_subdirectory(doc)
endif()
# CMake Tools
add_subdirectory(cmake)
###############################################################################
# Set up CPack
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTSAM")
set(CPACK_PACKAGE_VENDOR "Frank Dellaert, Georgia Institute of Technology")
set(CPACK_PACKAGE_CONTACT "Frank Dellaert, dellaert@cc.gatech.edu")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${GTSAM_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${GTSAM_VERSION_MINOR})
@ -375,24 +352,23 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-dev (>= 1.43)") #Example: "libc6 (>=
message(STATUS "===============================================================")
message(STATUS "================ Configuration Options ======================")
message(STATUS "Build flags ")
print_config_flag(${GTSAM_BUILD_TIMING} "Build Timing scripts ")
print_config_flag(${GTSAM_BUILD_EXAMPLES} "Build Examples ")
print_config_flag(${GTSAM_BUILD_TESTS} "Build Tests ")
print_config_flag(${GTSAM_BUILD_EXAMPLES_ALWAYS} "Build examples with 'make all' ")
print_config_flag(${GTSAM_BUILD_TIMING} "Build Timing scripts ")
if (DOXYGEN_FOUND)
print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ")
print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ")
endif()
print_config_flag(${GTSAM_BUILD_SHARED_LIBRARY} "Build shared GTSAM Library ")
print_config_flag(${GTSAM_BUILD_STATIC_LIBRARY} "Build static GTSAM Library ")
print_config_flag(${GTSAM_BUILD_STATIC_LIBRARY} "Build static GTSAM library instead of shared")
print_config_flag(${GTSAM_BUILD_TYPE_POSTFIXES} "Put build type in library name ")
if(GTSAM_UNSTABLE_AVAILABLE)
print_config_flag(${GTSAM_BUILD_UNSTABLE} "Build libgtsam_unstable ")
print_config_flag(${GTSAM_BUILD_UNSTABLE} "Build libgtsam_unstable ")
endif()
print_config_flag(${GTSAM_DISABLE_TESTS_ON_INSTALL} "No tests in all or install ")
print_config_flag(${GTSAM_DISABLE_EXAMPLES_ON_INSTALL} "No examples in all or install ")
string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper)
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS " C compilation flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${cmake_build_type_toupper}}")
message(STATUS " C++ compilation flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${cmake_build_type_toupper}}")
if(NOT MSVC AND NOT XCODE_VERSION)
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS " C compilation flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${cmake_build_type_toupper}}")
message(STATUS " C++ compilation flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${cmake_build_type_toupper}}")
endif()
if(GTSAM_USE_TBB)
message(STATUS " Use Intel TBB : Yes")
elseif(TBB_FOUND)

View File

@ -1,6 +1,3 @@
README - Georgia Tech Smoothing and Mapping library
---------------------------------------------------
Quickstart
In the root library folder execute:
@ -11,42 +8,6 @@ $] cmake ..
$] make check (optional, runs unit tests)
$] make install
---------------------------------------------------
What is GTSAM?
GTSAM is a library of C++ classes that implement smoothing and
mapping (SAM) in robotics and vision, using factor graphs and Bayes
networks as the underlying computing paradigm rather than sparse
matrices.
GTSAM is not (yet) open source: See COPYING & LICENSE
Please see USAGE for an example on how to use GTSAM.
The library is organized according to the following directory structure:
3rdparty local copies of third party libraries - Eigen3 and CCOLAMD
base provides some base Math and data structures, as well as test-related utilities
geometry points, poses, tensors, etc
inference core graphical model inference such as factor graphs, junction trees, Bayes nets, Bayes trees
linear inference specialized to Gaussian linear case, GaussianFactorGraph etc...
nonlinear non-linear factor graphs and non-linear optimization
slam SLAM and visual SLAM application code
This library contains unchanged copies of two third party libraries, with documentation
of licensing as follows:
- CCOLAMD 2.73: Tim Davis' constrained column approximate minimum degree ordering library
- http://www.cise.ufl.edu/research/sparse
- Licenced under LGPL v2.1, provided in gtsam/3rdparty/CCOLAMD/Doc/lesser.txt
- Eigen 3.2: General C++ matrix and linear algebra library
- Licenced under MPL2, provided in gtsam/3rdparty/Eigen/COPYING.README (some code that is 3rd-party to
Eigen is BSD and LGPL)
There are two supporting libraries:
CppUnitLite unit test library customized for use with gtsam
wrap code generation utility for the Matlab interface to gtsam
Important Installation Notes
----------------------------
@ -64,15 +25,17 @@ Optional dependent libraries:
may be downloaded from https://www.threadingbuildingblocks.org/
Tested compilers
- GCC 4.2-4.7
- Clang 2.9-3.2
- OSX GCC 4.2
- MSVC 2010, 2012
- GCC 4.2-4.7
- OSX Clang 2.9-5.0
- OSX GCC 4.2
- MSVC 2010, 2012
Tested systems:
- Ubuntu 11.04, 11.10, 12.04, 12.10, 13.04
- MacOS 10.6, 10.7
- Windows 7
- Ubuntu 11.04 - 13.10
- MacOS 10.6 - 10.9
- Windows 7, 8
2)
GTSAM makes extensive use of debug assertions, and we highly recommend you work

43
LICENSE
View File

@ -1,29 +1,18 @@
Copyright (c) 2010, Georgia Tech Research Corporation
Atlanta, Georgia 30332-0415
All Rights Reserved
GTSAM is released under the simplified BSD license, reproduced in the file
LICENSE.BSD in this directory.
See also README for licensing of 3rd-party code included in GTSAM.
GTSAM contains two third party libraries, with documentation of licensing and
modifications as follows:
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holders nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- CCOLAMD 2.73: Tim Davis' constrained column approximate minimum degree
ordering library
- Included unmodified in gtsam/3rdparty/CCOLAMD and gtsam/3rdparty/UFconfig
- http://www.cise.ufl.edu/research/sparse
- Licenced under LGPL v2.1, provided in gtsam/3rdparty/CCOLAMD/Doc/lesser.txt
- Eigen 3.2: General C++ matrix and linear algebra library
- Modified with 3 patches that have been contributed back to the Eigen team:
- http://eigen.tuxfamily.org/bz/show_bug.cgi?id=704 (Householder QR MKL selection)
- http://eigen.tuxfamily.org/bz/show_bug.cgi?id=705 (Fix MKL LLT return code)
- http://eigen.tuxfamily.org/bz/show_bug.cgi?id=716 (Improved comma initialization)
- Licenced under MPL2, provided in gtsam/3rdparty/Eigen/COPYING.README
- Some code that is 3rd-party to Eigen is BSD and LGPL

View File

@ -2,28 +2,12 @@ Copyright (c) 2010, Georgia Tech Research Corporation
Atlanta, Georgia 30332-0415
All Rights Reserved
See also README for licensing of 3rd-party code included in GTSAM.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
* Neither the name of the copyright holders nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,7 +1,20 @@
README - Georgia Tech Smoothing and Mapping library
===================================================
What is GTSAM?
--------------
GTSAM is a library of C++ classes that implement smoothing and
mapping (SAM) in robotics and vision, using factor graphs and Bayes
networks as the underlying computing paradigm rather than sparse
matrices.
On top of the C++ library, GTSAM includes a MATLAB interface (enable
GTSAM_INSTALL_MATLAB_TOOLBOX in CMake to build it). A Python interface
is under development.
Quickstart
----------
In the root library folder execute:
@ -24,52 +37,11 @@ Optional prerequisites - used automatically if findable by CMake:
- [Intel Threaded Building Blocks (TBB)](http://www.threadingbuildingblocks.org/) (Ubuntu: `sudo apt-get install libtbb-dev`)
- [Intel Math Kernel Library (MKL)](http://software.intel.com/en-us/intel-mkl)
Tested compilers
Additional Information
----------------------
- GCC 4.2-4.7
- OSX Clang 2.9-5.0
- OSX GCC 4.2
- MSVC 2010, 2012
See the [`INSTALL`](https://bitbucket.org/gtborg/gtsam/src/develop/INSTALL) file for more detailed installation instructions.
Tested systems:
GTSAM is open source under the BSD license, see the [`LICENSE`](https://bitbucket.org/gtborg/gtsam/src/develop/LICENSE) and [`LICENSE.BSD`](https://bitbucket.org/gtborg/gtsam/src/develop/LICENSE.BSD) files.
- Ubuntu 11.04 - 13.10
- MacOS 10.6 - 10.9
- Windows 7, 8
See the `INSTALL` file for more detailed installation instructions.
What is GTSAM?
==============
GTSAM is a library of C++ classes that implement smoothing and
mapping (SAM) in robotics and vision, using factor graphs and Bayes
networks as the underlying computing paradigm rather than sparse
matrices.
On top of the C++ library, GTSAM includes a MATLAB interface (enable
GTSAM_INSTALL_MATLAB_TOOLBOX in CMake to build it). A Python interface
is under development.
GTSAM is open source under the BSD license, see the `LICENSE.BSD` file.
Please see the `examples/` directory and the `USAGE` file for examples on how to use GTSAM.
The library is organized according to the following directory structure:
3rdparty local copies of third party libraries - Eigen3 and CCOLAMD
base provides some base Math and data structures, as well as test-related utilities
geometry points, poses, tensors, etc
inference core graphical model inference such as factor graphs, junction trees, Bayes nets, Bayes trees
linear inference specialized to Gaussian linear case, GaussianFactorGraph etc...
nonlinear non-linear factor graphs and non-linear optimization
slam SLAM and visual SLAM application code
This library contains unchanged copies of two third party libraries, with documentation
of licensing as follows:
- CCOLAMD 2.73: Tim Davis' constrained column approximate minimum degree ordering library
- http://www.cise.ufl.edu/research/sparse
- Licenced under LGPL v2.1, provided in gtsam/3rdparty/CCOLAMD/Doc/lesser.txt
- Eigen 3.2: General C++ matrix and linear algebra library
- Licenced under MPL2, provided in gtsam/3rdparty/Eigen/COPYING.README (some code that is 3rd-party to Eigen is BSD and LGPL)
Please see the [`examples/`](https://bitbucket.org/gtborg/gtsam/src/develop/examples) directory and the [`USAGE`](https://bitbucket.org/gtborg/gtsam/src/develop/USAGE) file for examples on how to use GTSAM.

11
USAGE
View File

@ -47,6 +47,17 @@ Factors:
SLAM example, is a measurement such as a visual reading on a landmark or
odometry.
The library is organized according to the following directory structure:
3rdparty local copies of third party libraries - Eigen3 and CCOLAMD
base provides some base Math and data structures, as well as test-related utilities
geometry points, poses, tensors, etc
inference core graphical model inference such as factor graphs, junction trees, Bayes nets, Bayes trees
linear inference specialized to Gaussian linear case, GaussianFactorGraph etc...
nonlinear non-linear factor graphs and non-linear optimization
slam SLAM and visual SLAM application code
VSLAM Example
---------------------------------------------------

26
cmake/CMakeLists.txt Normal file
View File

@ -0,0 +1,26 @@
# This file installs the scripts from this directory that may be used in other
# projects. See README.txt in this directory for documentation.
# Set the install directory depending on the platform so it will be found by
# find_package(GTSAMCMakeTools)
if(WIN32 AND NOT CYGWIN)
set(SCRIPT_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/CMake")
else()
set(SCRIPT_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/cmake")
endif()
# Install scripts
install(FILES
GTSAMCMakeToolsConfig.cmake
Config.cmake.in
dllexport.h.in
GtsamBuildTypes.cmake
GtsamMakeConfigFile.cmake
GtsamMatlabWrap.cmake
GtsamPythonWrap.cmake
GtsamTesting.cmake
GtsamTestingObsolete.cmake
README.html
DESTINATION "${SCRIPT_INSTALL_DIR}/GTSAMCMakeTools")

View File

@ -0,0 +1,3 @@
# This config file modifies CMAKE_MODULE_PATH so that the GTSAM-CMakeTools files may be included
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

View File

@ -10,11 +10,7 @@ if(NOT FIRST_PASS_DONE AND NOT CMAKE_BUILD_TYPE AND NOT MSVC AND NOT XCODE_VERSI
endif()
# Add option for using build type postfixes to allow installing multiple build modes
if(MSVC OR XCODE_VERSION)
option(GTSAM_BUILD_TYPE_POSTFIXES "Enable/Disable appending the build type to the name of compiled libraries" ON)
else()
option(GTSAM_BUILD_TYPE_POSTFIXES "Enable/Disable appending the build type to the name of compiled libraries" OFF)
endif()
option(GTSAM_BUILD_TYPE_POSTFIXES "Enable/Disable appending the build type to the name of compiled libraries" ON)
# Add debugging flags but only on the first pass
if(NOT FIRST_PASS_DONE)
@ -66,7 +62,7 @@ endif()
# Set up build type library postfixes
if(GTSAM_BUILD_TYPE_POSTFIXES)
foreach(build_type Debug Timing RelWithDebInfo MinSizeRel)
foreach(build_type Debug Timing Profiling RelWithDebInfo MinSizeRel)
string(TOUPPER "${build_type}" build_type_toupper)
set(CMAKE_${build_type_toupper}_POSTFIX ${build_type})
endforeach()
@ -106,7 +102,7 @@ if( NOT cmake_build_type_tolower STREQUAL ""
endif()
# Mark that first pass is done
set(FIRST_PASS_DONE TRUE CACHE BOOL "Internally used to mark whether cmake has been run multiple times" FORCE)
set(FIRST_PASS_DONE TRUE CACHE INTERNAL "Internally used to mark whether cmake has been run multiple times")
mark_as_advanced(FIRST_PASS_DONE)
# Enable Visual Studio solution folders

View File

@ -40,19 +40,28 @@ set(MATLAB_ROOT "${MATLAB_ROOT}" CACHE PATH "Path to MATLAB installation root (e
# User-friendly wrapping function. Builds a mex module from the provided
# interfaceHeader. For example, for the interface header /path/to/gtsam.h,
# interfaceHeader. For example, for the interface header gtsam.h,
# this will build the wrap module 'gtsam'.
# Params:
# interfaceHeader : Absolute or relative path to the interface definition file
# linkLibraries : All dependent CMake target names, library names, or full library paths
# extraIncludeDirs : Extra include directories, in addition to those already passed to include_directories(...)
# extraMexFlags : Any additional compiler flags
#
# Arguments:
#
# interfaceHeader: The relative path to the wrapper interface definition file.
# linkLibraries: Any *additional* libraries to link. Your project library
# (e.g. `lba`), libraries it depends on, and any necessary
# MATLAB libraries will be linked automatically. So normally,
# leave this empty.
# extraIncludeDirs: Any *additional* include paths required by dependent
# libraries that have not already been added by
# include_directories. Again, normally, leave this empty.
# extraMexFlags: Any *additional* flags to pass to the compiler when building
# the wrap code. Normally, leave this empty.
function(wrap_and_install_library interfaceHeader linkLibraries extraIncludeDirs extraMexFlags)
wrap_library_internal("${interfaceHeader}" "${otherLibraries}" "${extraIncludeDirs}" "${mexFlags}")
wrap_library_internal("${interfaceHeader}" "${linkLibraries}" "${extraIncludeDirs}" "${mexFlags}")
install_wrapped_library_internal("${interfaceHeader}")
endfunction()
# Internal function that wraps a library and compiles the wrapper
function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs extraMexFlags)
if(UNIX AND NOT APPLE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@ -103,7 +112,8 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex
# Add -shared or -static suffix to targets
set(correctedOtherLibraries "")
set(otherLibraryTargets "")
foreach(lib ${moduleName} ${otherLibraries})
set(otherLibraryNontargets "")
foreach(lib ${moduleName} ${linkLibraries})
if(TARGET ${lib})
list(APPEND correctedOtherLibraries ${lib})
list(APPEND otherLibraryTargets ${lib})
@ -115,8 +125,20 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex
list(APPEND otherLibraryTargets ${lib}-static)
else()
list(APPEND correctedOtherLibraries ${lib})
list(APPEND otherLibraryNontargets ${lib})
endif()
endforeach()
# Check libraries for conflicting versions built-in to MATLAB
set(dependentLibraries "")
if(NOT "${otherLibraryTargets}" STREQUAL "")
foreach(target ${otherLibraryTargets})
get_target_property(dependentLibrariesOne ${target} INTERFACE_LINK_LIBRARIES)
list(APPEND dependentLibraries ${dependentLibrariesOne})
endforeach()
endif()
list(APPEND dependentLibraries ${otherLibraryNontargets})
check_conflicting_libraries_internal("${dependentLibraries}")
# Set up generation of module source file
file(MAKE_DIRECTORY "${generated_files_path}")
@ -174,6 +196,7 @@ function(wrap_library_internal interfaceHeader linkLibraries extraIncludeDirs ex
COMMAND cmake -E remove_directory ${compiled_mex_modules_root})
endfunction()
# Internal function that installs a wrap toolbox
function(install_wrapped_library_internal interfaceHeader)
get_filename_component(moduleName "${interfaceHeader}" NAME_WE)
set(generated_files_path "${PROJECT_BINARY_DIR}/wrap/${moduleName}")
@ -205,53 +228,77 @@ function(install_wrapped_library_internal interfaceHeader)
endif()
endfunction()
# Function to setup codegen and building of the wrap toolbox
#
# params:
# moduleName : the name of the module, interface file must be called moduleName.h
# mexFlags : Compilation flags to be passed to the mex compiler
# modulePath : relative path to module markup header file (called moduleName.h)
# otherLibraries : list of library targets this should depend on
# toolboxPath : the directory in which to generate/build wrappers
# wrap_header_path : path to the installed wrap header
function(wrap_library_generic moduleName mexFlags modulePath otherLibraries toolbox_path wrap_header_path)
if(NOT "${CMAKE_PROJECT_NAME}" STREQUAL "GTSAM")
message("Your project uses wrap_library or wrap_library_generic - this is deprecated, please use the more user-friendly function wrap_and_install_library")
endif()
# Append module name to link libraries to keep original behavior
list(APPEND otherLibraries ${moduleName})
# Set up arguments
set(interfaceHeader ${modulePath}/${moduleName}.h)
# Call internal function
wrap_library_internal("${interfaceHeader}" "${otherLibraries}" "" "${mexFlags}")
endfunction(wrap_library_generic)
# Function to setup codegen, building and installation of the wrap toolbox
# This wrap setup function assumes that the toolbox will be installed directly,
# with predictable matlab.h sourcing. Use this version when the toolbox will be used
# from the installed version, rather than in place.
# Assumes variable GTSAM_WRAP_HEADER_PATH has been set
# params:
# moduleName : the name of the module, interface file must be called moduleName.h
# mexFlags : Compilation flags to be passed to the mex compiler
# modulePath : relative path to module markup header file (called moduleName.h)
# otherLibraries : list of library targets this should depend on
function(wrap_library moduleName mexFlags modulePath otherLibraries)
# Toolbox generation path goes in build folder
set(toolbox_base_path ${PROJECT_BINARY_DIR}/wrap)
set(toolbox_path ${toolbox_base_path}/${moduleName})
# Call generic version of function
wrap_library_generic("${moduleName}" "${mexFlags}" "${modulePath}" "${otherLibraries}" "${toolbox_path}" "${GTSAM_WRAP_HEADER_PATH}")
install_wrapped_library_internal("${modulePath}/${moduleName}.h")
endfunction(wrap_library)
# Internal function to check for libraries installed with MATLAB that may conflict
# and prints a warning to move them if problems occur.
function(check_conflicting_libraries_internal libraries)
if(UNIX)
# Set path for matlab's built-in libraries
if(APPLE)
set(mxLibPath "${MATLAB_ROOT}/bin/maci64")
else()
if(CMAKE_CL_64)
set(mxLibPath "${MATLAB_ROOT}/bin/glnxa64")
else()
set(mxLibPath "${MATLAB_ROOT}/bin/glnx86")
endif()
endif()
# List matlab's built-in libraries
file(GLOB matlabLibs RELATIVE "${mxLibPath}" "${mxLibPath}/lib*")
# Convert to base names
set(matlabLibNames "")
foreach(lib ${matlabLibs})
get_filename_component(libName "${lib}" NAME_WE)
list(APPEND matlabLibNames "${libName}")
endforeach()
# Get names of link libraries
set(linkLibNames "")
foreach(lib ${libraries})
string(FIND "${lib}" "/" slashPos)
if(NOT slashPos EQUAL -1)
# If the name is a path, just get the library name
get_filename_component(libName "${lib}" NAME_WE)
list(APPEND linkLibNames "${libName}")
else()
# It's not a path, so see if it looks like a filename
get_filename_component(ext "${lib}" EXT)
if(NOT "${ext}" STREQUAL "")
# It's a filename, so get the base name
get_filename_component(libName "${lib}" NAME_WE)
list(APPEND linkLibNames "${libName}")
else()
# It's not a filename so it must be a short name, add the "lib" prefix
list(APPEND linkLibNames "lib${lib}")
endif()
endif()
endforeach()
# Remove duplicates
list(REMOVE_DUPLICATES linkLibNames)
set(conflictingLibs "")
foreach(lib ${linkLibNames})
list(FIND matlabLibNames "${lib}" libPos)
if(NOT libPos EQUAL -1)
if(NOT conflictingLibs STREQUAL "")
set(conflictingLibs "${conflictingLibs}, ")
endif()
set(conflictingLibs "${conflictingLibs}${lib}")
endif()
endforeach()
if(NOT "${conflictingLibs}" STREQUAL "")
message(WARNING "GTSAM links to the libraries [ ${conflictingLibs} ] on your system, but "
"MATLAB is distributed with its own versions of these libraries which may conflict. "
"If you get strange errors or crashes with the GTSAM MATLAB wrapper, move these "
"libraries out of MATLAB's built-in library directory, which is ${mxLibPath} on "
"your system. MATLAB will usually still work with these libraries moved away, but "
"if not, you'll have to compile the static GTSAM MATLAB wrapper module.")
endif()
endif()
endfunction()
# Helper function to install MATLAB scripts and handle multiple build types where the scripts
# should be installed to all build type toolboxes

View File

@ -1,111 +1,204 @@
# Build macros for using tests
# This file defines the two macros below for easily adding groups of unit tests and scripts,
# as well as sets up unit testing and defines several cache options used to control how
# tests and scripts are built and run.
###############################################################################
# Macro:
#
# gtsamAddTestsGlob(groupName globPatterns excludedFiles linkLibraries)
#
# Add a group of unit tests. A list of unit test .cpp files or glob patterns specifies the
# tests to create. Tests are assigned into a group name so they can easily by run
# independently with a make target. Running 'make check' builds and runs all tests.
#
# Usage example:
# gtsamAddTestsGlob(basic "test*.cpp" "testBroken.cpp" "gtsam;GeographicLib")
#
# Arguments:
# groupName: A name that will allow this group of tests to be run independently, e.g.
# 'basic' causes a 'check.basic' target to be created to run this test
# group.
# globPatterns: The list of files or glob patterns from which to create unit tests, with
# one test created for each cpp file. e.g. "test*.cpp", or
# "testA*.cpp;testB*.cpp;testOneThing.cpp".
# excludedFiles: A list of files or globs to exclude, e.g. "testC*.cpp;testBroken.cpp".
# Pass an empty string "" if nothing needs to be excluded.
# linkLibraries: The list of libraries to link to in addition to CppUnitLite.
macro(gtsamAddTestsGlob groupName globPatterns excludedFiles linkLibraries)
gtsamAddTestsGlob_impl("${groupName}" "${globPatterns}" "${excludedFiles}" "${linkLibraries}")
endmacro()
###############################################################################
# Macro:
#
# gtsamAddExamplesGlob(globPatterns excludedFiles linkLibraries)
#
# Add scripts that will serve as examples of how to use the library. A list of files or
# glob patterns is specified, and one executable will be created for each matching .cpp
# file. These executables will not be installed. They are build with 'make all' if
# GTSAM_BUILD_EXAMPLES_ALWAYS is enabled. They may also be built with 'make examples'.
#
# Usage example:
# gtsamAddExamplesGlob("*.cpp" "BrokenExample.cpp" "gtsam;GeographicLib")
#
# Arguments:
# globPatterns: The list of files or glob patterns from which to create unit tests, with
# one test created for each cpp file. e.g. "*.cpp", or
# "A*.cpp;B*.cpp;MyExample.cpp".
# excludedFiles: A list of files or globs to exclude, e.g. "C*.cpp;BrokenExample.cpp". Pass
# an empty string "" if nothing needs to be excluded.
# linkLibraries: The list of libraries to link to.
macro(gtsamAddExamplesGlob globPatterns excludedFiles linkLibraries)
gtsamAddExamplesGlob_impl("${globPatterns}" "${excludedFiles}" "${linkLibraries}")
endmacro()
# Implementation follows:
# Build macros for using tests
enable_testing()
# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --output-on-failure)
add_custom_target(timing)
option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON)
option(GTSAM_BUILD_EXAMPLES_ALWAYS "Build examples with 'make all' (build with 'make examples' if not)" ON)
# Add option for combining unit tests
if(MSVC)
if(MSVC OR XCODE_VERSION)
option(GTSAM_SINGLE_TEST_EXE "Combine unit tests into single executable (faster compile)" ON)
else()
option(GTSAM_SINGLE_TEST_EXE "Combine unit tests into single executable (faster compile)" OFF)
endif()
mark_as_advanced(GTSAM_SINGLE_TEST_EXE)
# Macro for adding categorized tests in a "tests" folder, with
# optional exclusion of tests and convenience library linking options
#
# By default, all tests are linked with CppUnitLite and boost
# Arguments:
# - subdir The name of the category for this test
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
# - full_libs The main library to link against if not using convenience libraries
# - excluded_tests A list of test files that should not be compiled - use for debugging
function(gtsam_add_subdir_tests subdir local_libs full_libs excluded_tests)
# Subdirectory target for tests
add_custom_target(check.${subdir} COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --output-on-failure)
set(is_test TRUE)
# Enable make check (http://www.cmake.org/Wiki/CMakeEmulateMakeCheck)
if(GTSAM_BUILD_TESTS)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --output-on-failure)
endif()
# Put check target in Visual Studio solution folder
file(RELATIVE_PATH relative_path "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TARGET check.${subdir} PROPERTY FOLDER "${relative_path}")
# Link with CppUnitLite - pulled from gtsam installation
list(APPEND local_libs CppUnitLite)
list(APPEND full_libs CppUnitLite)
# Add examples target
add_custom_target(examples)
# Build grouped tests
gtsam_add_grouped_scripts("${subdir}" # Use subdirectory as group label
"tests/test*.cpp" check "Test" # Standard for all tests
"${local_libs}"
"${full_libs}" "${excluded_tests}" # Pass in linking and exclusion lists
${is_test}) # Set all as tests
endfunction()
# Include obsolete macros - will be removed in the near future
include(GtsamTestingObsolete)
# Macro for adding categorized timing scripts in a "tests" folder, with
# optional exclusion of tests and convenience library linking options
#
# By default, all tests are linked with boost
# Arguments:
# - subdir The name of the category for this timing script
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
# - full_libs The main library to link against if not using convenience libraries
# - excluded_srcs A list of timing files that should not be compiled - use for debugging
macro(gtsam_add_subdir_timing subdir local_libs full_libs excluded_srcs)
# Subdirectory target for timing - does not actually execute the scripts
add_custom_target(timing.${subdir})
set(is_test FALSE)
# Build grouped benchmarks
gtsam_add_grouped_scripts("${subdir}" # Use subdirectory as group label
"tests/time*.cpp" timing "Timing Benchmark" # Standard for all timing scripts
"${local_libs}" "${full_libs}" "${excluded_srcs}" # Pass in linking and exclusion lists
${is_test}) # Treat as not a test
# Implementations of this file's macros:
macro(gtsamAddTestsGlob_impl groupName globPatterns excludedFiles linkLibraries)
if(GTSAM_BUILD_TESTS)
# Add group target if it doesn't already exist
if(NOT TARGET check.${groupName})
add_custom_target(check.${groupName} COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --output-on-failure)
endif()
# Get all script files
file(GLOB script_files ${globPatterns})
# Remove excluded scripts from the list
if(NOT "${excludedFiles}" STREQUAL "")
file(GLOB excludedFilePaths ${excludedFiles})
if("${excludedFilePaths}" STREQUAL "")
message(WARNING "The pattern '${excludedFiles}' for excluding tests from group ${groupName} did not match any files")
else()
list(REMOVE_ITEM script_files ${excludedFilePaths})
endif()
endif()
# Separate into source files and headers (allows for adding headers to show up in
# MSVC and Xcode projects).
set(script_srcs "")
set(script_headers "")
foreach(script_file IN ITEMS ${script_files})
get_filename_component(script_ext ${script_file} EXT)
if(script_ext MATCHES "(h|H)")
list(APPEND script_headers ${script_file})
else()
list(APPEND script_srcs ${script_file})
endif()
endforeach()
# Don't put test files in folders in MSVC and Xcode because they're already grouped
source_group("" FILES ${script_srcs} ${script_headers})
if(NOT GTSAM_SINGLE_TEST_EXE)
# Default for Makefiles - each test in its own executable
foreach(script_src IN ITEMS ${script_srcs})
# Get test base name
get_filename_component(script_name ${script_src} NAME_WE)
# Add executable
add_executable(${script_name} ${script_src} ${script_headers})
target_link_libraries(${script_name} CppUnitLite ${linkLibraries})
# Add target dependencies
add_test(NAME ${script_name} COMMAND ${script_name})
add_dependencies(check.${groupName} ${script_name})
add_dependencies(check ${script_name})
if(NOT MSVC AND NOT XCODE_VERSION)
add_custom_target(${script_name}.run ${EXECUTABLE_OUTPUT_PATH}${script_name})
endif()
# Add TOPSRCDIR
set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
# Exclude from 'make all' and 'make install'
set_target_properties(${script_name} PROPERTIES EXCLUDE_FROM_ALL ON)
# Configure target folder (for MSVC and Xcode)
set_property(TARGET ${script_name} PROPERTY FOLDER "Unit tests/${groupName}")
endforeach()
else()
# Default on MSVC and XCode - combine test group into a single exectuable
set(target_name check_${groupName}_program)
# Add executable
add_executable(${target_name} ${script_srcs} ${script_headers})
target_link_libraries(${target_name} CppUnitLite ${linkLibraries})
# Only have a main function in one script - use preprocessor
set(rest_script_srcs ${script_srcs})
list(REMOVE_AT rest_script_srcs 0)
set_property(SOURCE ${rest_script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "main=inline no_main")
# Add target dependencies
add_test(NAME ${target_name} COMMAND ${target_name})
add_dependencies(check.${groupName} ${target_name})
add_dependencies(check ${target_name})
# Add TOPSRCDIR
set_property(SOURCE ${script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
# Exclude from 'make all' and 'make install'
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL ON)
# Configure target folder (for MSVC and Xcode)
set_property(TARGET ${script_name} PROPERTY FOLDER "Unit tests")
endif()
endif()
endmacro()
# Macro for adding executables matching a pattern - builds one executable for
# each file matching the pattern. These exectuables are automatically linked
# with boost.
# Arguments:
# - pattern The glob pattern to match source files
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
# - full_libs The main library to link against if not using convenience libraries
# - excluded_srcs A list of timing files that should not be compiled - use for debugging
function(gtsam_add_executables pattern local_libs full_libs excluded_srcs)
set(is_test FALSE)
if(NOT excluded_srcs)
set(excluded_srcs "")
endif()
# Build executables
gtsam_add_grouped_scripts("" "${pattern}" "" "Executable" "${local_libs}" "${full_libs}" "${excluded_srcs}" ${is_test})
endfunction()
# General-purpose script for adding tests with categories and linking options
macro(gtsam_add_grouped_scripts group pattern target_prefix pretty_prefix_name local_libs full_libs excluded_srcs is_test)
macro(gtsamAddExamplesGlob_impl globPatterns excludedFiles linkLibraries)
# Get all script files
set(script_files "")
foreach(one_pattern ${pattern})
file(GLOB one_script_files "${one_pattern}")
list(APPEND script_files "${one_script_files}")
endforeach()
file(GLOB script_files ${globPatterns})
# Remove excluded scripts from the list
set(exclusions "") # Need to copy out exclusion list for logic to work
foreach(one_exclusion ${excluded_srcs})
file(GLOB one_exclusion_srcs "${one_exclusion}")
list(APPEND exclusions "${one_exclusion_srcs}")
endforeach()
if(exclusions)
list(REMOVE_ITEM script_files ${exclusions})
endif(exclusions)
if(NOT "${excludedFiles}" STREQUAL "")
file(GLOB excludedFilePaths ${excludedFiles})
if("${excludedFilePaths}" STREQUAL "")
message(WARNING "The script exclusion pattern '${excludedFiles}' did not match any files")
else()
list(REMOVE_ITEM script_files ${excludedFilePaths})
endif()
endif()
# Separate into source files and headers
# Separate into source files and headers (allows for adding headers to show up in
# MSVC and Xcode projects).
set(script_srcs "")
set(script_headers "")
foreach(script_file ${script_files})
foreach(script_file IN ITEMS ${script_files})
get_filename_component(script_ext ${script_file} EXT)
if(script_ext MATCHES "(h|H)")
list(APPEND script_headers ${script_file})
@ -113,94 +206,34 @@ macro(gtsam_add_grouped_scripts group pattern target_prefix pretty_prefix_name l
list(APPEND script_srcs ${script_file})
endif()
endforeach()
# Add targets and dependencies for each script
if(NOT "${group}" STREQUAL "")
message(STATUS "Adding ${pretty_prefix_name}s in ${group}")
endif()
# Create exe's for each script, unless we're in SINGLE_TEST_EXE mode
if(NOT is_test OR NOT GTSAM_SINGLE_TEST_EXE)
foreach(script_src ${script_srcs})
get_filename_component(script_base ${script_src} NAME_WE)
if (script_base) # Check for null filenames and headers
set( script_bin ${script_base} )
message(STATUS "Adding ${pretty_prefix_name} ${script_bin}")
add_executable(${script_bin} ${script_src} ${script_headers})
if(NOT "${target_prefix}" STREQUAL "")
if(NOT "${group}" STREQUAL "")
add_dependencies(${target_prefix}.${group} ${script_bin})
endif()
add_dependencies(${target_prefix} ${script_bin})
endif()
# Add TOPSRCDIR
set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
# Disable building during make all/install
if (GTSAM_DISABLE_TESTS_ON_INSTALL)
set_target_properties(${script_bin} PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
if (is_test)
add_test(NAME ${script_base} COMMAND ${script_bin})
endif()
# Linking and dependendencies
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
target_link_libraries(${script_bin} ${local_libs} ${GTSAM_BOOST_LIBRARIES})
else()
target_link_libraries(${script_bin} ${full_libs} ${GTSAM_BOOST_LIBRARIES})
endif()
# Add .run target
if(NOT MSVC)
add_custom_target(${script_bin}.run ${EXECUTABLE_OUTPUT_PATH}${script_bin} ${ARGN})
endif()
# Set up Visual Studio folders
file(RELATIVE_PATH relative_path "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TARGET ${script_bin} PROPERTY FOLDER "${relative_path}")
endif()
endforeach(script_src)
if(MSVC)
source_group("" FILES ${script_srcs} ${script_headers})
# Don't put test files in folders in MSVC and Xcode because they're already grouped
source_group("" FILES ${script_srcs} ${script_headers})
# Create executables
foreach(script_src IN ITEMS ${script_srcs})
# Get script base name
get_filename_component(script_name ${script_src} NAME_WE)
# Add executable
add_executable(${script_name} ${script_src} ${script_headers})
target_link_libraries(${script_name} ${linkLibraries})
# Add target dependencies
add_dependencies(examples ${script_name})
if(NOT MSVC AND NOT XCODE_VERSION)
add_custom_target(${script_name}.run ${EXECUTABLE_OUTPUT_PATH}${script_name})
endif()
else()
# Create single unit test exe from all test scripts
set(script_bin ${target_prefix}_${group}_prog)
add_executable(${script_bin} ${script_srcs} ${script_headers})
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
target_link_libraries(${script_bin} ${local_libs} ${Boost_LIBRARIES})
else()
target_link_libraries(${script_bin} ${Boost_LIBRARIES} ${full_libs})
endif()
# Only have a main function in one script
set(rest_script_srcs ${script_srcs})
list(REMOVE_AT rest_script_srcs 0)
set_property(SOURCE ${rest_script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "main=static no_main")
# Add TOPSRCDIR
set_property(SOURCE ${script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
# Add test
add_dependencies(${target_prefix}.${group} ${script_bin})
add_dependencies(${target_prefix} ${script_bin})
add_test(NAME ${target_prefix}.${group} COMMAND ${script_bin})
# Disable building during make all/install
if (GTSAM_DISABLE_TESTS_ON_INSTALL)
set_target_properties(${script_bin} PROPERTIES EXCLUDE_FROM_ALL ON)
set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
if(NOT GTSAM_BUILD_EXAMPLES_ALWAYS)
# Exclude from 'make all' and 'make install'
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
# Set up Visual Studio folders
if(MSVC)
file(RELATIVE_PATH relative_path "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TARGET ${script_bin} PROPERTY FOLDER "${relative_path}")
source_group("" FILES ${script_srcs} ${script_headers})
endif()
endif()
# Configure target folder (for MSVC and Xcode)
set_property(TARGET ${script_name} PROPERTY FOLDER "Examples")
endforeach()
endmacro()

View File

@ -0,0 +1,195 @@
# Macro for adding categorized tests in a "tests" folder, with
# optional exclusion of tests and convenience library linking options
#
# By default, all tests are linked with CppUnitLite and boost
# Arguments:
# - subdir The name of the category for this test
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
# - full_libs The main library to link against if not using convenience libraries
# - excluded_tests A list of test files that should not be compiled - use for debugging
function(gtsam_add_subdir_tests subdir local_libs full_libs excluded_tests)
# Subdirectory target for tests
add_custom_target(check.${subdir} COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --output-on-failure)
set(is_test TRUE)
# Put check target in Visual Studio solution folder
file(RELATIVE_PATH relative_path "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TARGET check.${subdir} PROPERTY FOLDER "${relative_path}")
# Link with CppUnitLite - pulled from gtsam installation
list(APPEND local_libs CppUnitLite)
list(APPEND full_libs CppUnitLite)
# Build grouped tests
gtsam_add_grouped_scripts("${subdir}" # Use subdirectory as group label
"tests/test*.cpp" check "Test" # Standard for all tests
"${local_libs}"
"${full_libs}" "${excluded_tests}" # Pass in linking and exclusion lists
${is_test}) # Set all as tests
endfunction()
# Macro for adding categorized timing scripts in a "tests" folder, with
# optional exclusion of tests and convenience library linking options
#
# By default, all tests are linked with boost
# Arguments:
# - subdir The name of the category for this timing script
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
# - full_libs The main library to link against if not using convenience libraries
# - excluded_srcs A list of timing files that should not be compiled - use for debugging
macro(gtsam_add_subdir_timing subdir local_libs full_libs excluded_srcs)
# Subdirectory target for timing - does not actually execute the scripts
add_custom_target(timing.${subdir})
set(is_test FALSE)
# Build grouped benchmarks
gtsam_add_grouped_scripts("${subdir}" # Use subdirectory as group label
"tests/time*.cpp" timing "Timing Benchmark" # Standard for all timing scripts
"${local_libs}" "${full_libs}" "${excluded_srcs}" # Pass in linking and exclusion lists
${is_test}) # Treat as not a test
endmacro()
# Macro for adding executables matching a pattern - builds one executable for
# each file matching the pattern. These exectuables are automatically linked
# with boost.
# Arguments:
# - pattern The glob pattern to match source files
# - local_libs A list of convenience libraries to use (if GTSAM_BUILD_CONVENIENCE_LIBRARIES is true)
# - full_libs The main library to link against if not using convenience libraries
# - excluded_srcs A list of timing files that should not be compiled - use for debugging
function(gtsam_add_executables pattern local_libs full_libs excluded_srcs)
set(is_test FALSE)
if(NOT excluded_srcs)
set(excluded_srcs "")
endif()
# Build executables
gtsam_add_grouped_scripts("" "${pattern}" "" "Executable" "${local_libs}" "${full_libs}" "${excluded_srcs}" ${is_test})
endfunction()
# General-purpose script for adding tests with categories and linking options
macro(gtsam_add_grouped_scripts group pattern target_prefix pretty_prefix_name local_libs full_libs excluded_srcs is_test)
# Print warning about using this obsolete function
message(AUTHOR_WARNING "Warning: Please see GtsamTesting.cmake - obsolete cmake cmake macro for creating unit tests, examples, and scripts was called. This will be removed in the future. The new macros are much easier anyway!!")
# Get all script files
set(script_files "")
foreach(one_pattern ${pattern})
file(GLOB one_script_files "${one_pattern}")
list(APPEND script_files "${one_script_files}")
endforeach()
# Remove excluded scripts from the list
set(exclusions "") # Need to copy out exclusion list for logic to work
foreach(one_exclusion ${excluded_srcs})
file(GLOB one_exclusion_srcs "${one_exclusion}")
list(APPEND exclusions "${one_exclusion_srcs}")
endforeach()
if(exclusions)
list(REMOVE_ITEM script_files ${exclusions})
endif(exclusions)
# Separate into source files and headers
set(script_srcs "")
set(script_headers "")
foreach(script_file ${script_files})
get_filename_component(script_ext ${script_file} EXT)
if(script_ext MATCHES "(h|H)")
list(APPEND script_headers ${script_file})
else()
list(APPEND script_srcs ${script_file})
endif()
endforeach()
# Add targets and dependencies for each script
if(NOT "${group}" STREQUAL "")
message(STATUS "Adding ${pretty_prefix_name}s in ${group}")
endif()
# Create exe's for each script, unless we're in SINGLE_TEST_EXE mode
if(NOT is_test OR NOT GTSAM_SINGLE_TEST_EXE)
foreach(script_src ${script_srcs})
get_filename_component(script_base ${script_src} NAME_WE)
if (script_base) # Check for null filenames and headers
set( script_bin ${script_base} )
message(STATUS "Adding ${pretty_prefix_name} ${script_bin}")
add_executable(${script_bin} ${script_src} ${script_headers})
if(NOT "${target_prefix}" STREQUAL "")
if(NOT "${group}" STREQUAL "")
add_dependencies(${target_prefix}.${group} ${script_bin})
endif()
add_dependencies(${target_prefix} ${script_bin})
endif()
# Add TOPSRCDIR
set_property(SOURCE ${script_src} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
# Disable building during make all/install
if (GTSAM_DISABLE_TESTS_ON_INSTALL)
set_target_properties(${script_bin} PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
if (is_test)
add_test(NAME ${script_base} COMMAND ${script_bin})
endif()
# Linking and dependendencies
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
target_link_libraries(${script_bin} ${local_libs} ${GTSAM_BOOST_LIBRARIES})
else()
target_link_libraries(${script_bin} ${full_libs} ${GTSAM_BOOST_LIBRARIES})
endif()
# Add .run target
if(NOT MSVC AND NOT XCODE_VERSION)
add_custom_target(${script_bin}.run ${EXECUTABLE_OUTPUT_PATH}${script_bin} ${ARGN})
endif()
# Set up Visual Studio folders
file(RELATIVE_PATH relative_path "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TARGET ${script_bin} PROPERTY FOLDER "${relative_path}")
endif()
endforeach(script_src)
if(MSVC)
source_group("" FILES ${script_srcs} ${script_headers})
endif()
else()
# Create single unit test exe from all test scripts
set(script_bin ${target_prefix}_${group}_prog)
add_executable(${script_bin} ${script_srcs} ${script_headers})
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
target_link_libraries(${script_bin} ${local_libs} ${Boost_LIBRARIES})
else()
target_link_libraries(${script_bin} ${Boost_LIBRARIES} ${full_libs})
endif()
# Only have a main function in one script
set(rest_script_srcs ${script_srcs})
list(REMOVE_AT rest_script_srcs 0)
set_property(SOURCE ${rest_script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "main=static no_main")
# Add TOPSRCDIR
set_property(SOURCE ${script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "TOPSRCDIR=\"${PROJECT_SOURCE_DIR}\"")
# Add test
add_dependencies(${target_prefix}.${group} ${script_bin})
add_dependencies(${target_prefix} ${script_bin})
add_test(NAME ${target_prefix}.${group} COMMAND ${script_bin})
# Disable building during make all/install
if (GTSAM_DISABLE_TESTS_ON_INSTALL)
set_target_properties(${script_bin} PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
# Set up Visual Studio folders
if(MSVC)
file(RELATIVE_PATH relative_path "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TARGET ${script_bin} PROPERTY FOLDER "${relative_path}")
source_group("" FILES ${script_srcs} ${script_headers})
endif()
endif()
endmacro()

92
cmake/README.html Normal file
View File

@ -0,0 +1,92 @@
<h1>GTSAMCMakeTools</h1>
<p>This is the collection of GTSAM CMake tools that may be useful in external projects. The way to use this collection is by first making a find_package call:</p>
<pre><code>find_package(GTSAMCMakeTools)
</code></pre>
<p>which will add a directory containing the GTSAM CMake tools to the CMAKE_MODULE_PATH variable. After that, you may include the files you would like to use. These files and the functions they define are explained below.</p>
<h2>GtsamBuildTypes</h2>
<pre><code>include(GtsamBuildTypes)
</code></pre>
<p>Including this file immediately sets up the following build types and a drop-down list in cmake-gui:</p>
<ul>
<li><code>Debug</code></li>
<li><code>Release</code></li>
<li><code>RelWithDebInfo</code></li>
<li><code>Profiling</code>: All optimizations enabled and minimal debug symbols</li>
<li><code>Timing</code>: Defines the symbol GTSAM_ENABLE_TIMING for using GTSAM timing instrumentation</li>
</ul>
<p>It also configures several minor details, as follows:</p>
<ul>
<li>The compile flag <code>-ftemplate-depth=1024</code> is set for newer versions of Clang to handle complex templates.</li>
<li>On Windows, executable and dll output paths are set to <code>${CMAKE_BINARY_DIR}/bin</code> and import library output to <code>${CMAKE_BINARY_DIR}/bin</code>.</li>
</ul>
<p>It defines the following functions:</p>
<ul>
<li><code>gtsam_assign_source_folders( [files] )</code> Organizes files in the IDE into folders to reflect the actual directory structure of those files. Folders will be determined relative to the current source folder when this function is called.</li>
<li><code>gtsam_assign_all_source_folders()</code> Calls <code>gtsam_assign_source_folders</code> on all cpp, c, and h files recursively in the current source folder.</li>
</ul>
<h2>GtsamTesting</h2>
<pre><code>include(GtsamTesting)
</code></pre>
<p>Defines two useful functions for creating CTest unit tests. Also immediately creates a <code>check</code> target that builds and runs all unit tests.</p>
<ul>
<li>
<p><code>gtsamAddTestsGlob(groupName globPatterns excludedFiles linkLibraries)</code> Add a group of unit tests. A list of unit test .cpp files or glob patterns specifies the tests to create. Tests are assigned into a group name so they can easily by run independently with a make target. Running 'make check' builds and runs all tests.</p>
<p>Usage example:</p>
<pre><code>gtsamAddTestsGlob(basic "test*.cpp" "testBroken.cpp" "gtsam;GeographicLib")
</code></pre>
<p>Arguments:</p>
<pre><code>groupName: A name that will allow this group of tests to be run independently, e.g.
'basic' causes a 'check.basic' target to be created to run this test
group.
globPatterns: The list of files or glob patterns from which to create unit tests, with
one test created for each cpp file. e.g. "test*.cpp", or
"testA*.cpp;testB*.cpp;testOneThing.cpp".
excludedFiles: A list of files or globs to exclude, e.g. "testC*.cpp;testBroken.cpp".
Pass an empty string "" if nothing needs to be excluded.
linkLibraries: The list of libraries to link to in addition to CppUnitLite.
</code></pre>
</li>
<li>
<p><code>gtsamAddExamplesGlob(globPatterns excludedFiles linkLibraries)</code> Add scripts that will serve as examples of how to use the library. A list of files or glob patterns is specified, and one executable will be created for each matching .cpp file. These executables will not be installed. They are build with 'make all' if GTSAM_BUILD_EXAMPLES_ALWAYS is enabled. They may also be built with 'make examples'.</p>
<p>Usage example:</p>
<pre><code>gtsamAddExamplesGlob("*.cpp" "BrokenExample.cpp" "gtsam;GeographicLib")
</code></pre>
<p>Arguments:</p>
<pre><code>globPatterns: The list of files or glob patterns from which to create unit tests, with
one test created for each cpp file. e.g. "*.cpp", or
"A*.cpp;B*.cpp;MyExample.cpp".
excludedFiles: A list of files or globs to exclude, e.g. "C*.cpp;BrokenExample.cpp". Pass
an empty string "" if nothing needs to be excluded.
linkLibraries: The list of libraries to link to.
</code></pre>
</li>
</ul>
<h2>GtsamMatlabWrap</h2>
<pre><code>include(GtsamMatlabWrap)
</code></pre>
<p>Defines functions for generating MATLAB wrappers. Also immediately creates several CMake options for configuring the wrapper.</p>
<ul>
<li>
<p><code>wrap_and_install_library(interfaceHeader linkLibraries extraIncludeDirs extraMexFlags)</code> Generates wrap code and compiles the wrapper.</p>
<p>Usage example:</p>
<pre><code>`wrap_and_install_library("lba.h" "" "" "")`
</code></pre>
<p>Arguments:</p>
<pre><code>interfaceHeader: The relative or absolute path to the wrapper interface
definition file.
linkLibraries: Any *additional* libraries to link. Your project library
(e.g. `lba`), libraries it depends on, and any necessary
MATLAB libraries will be linked automatically. So normally,
leave this empty.
extraIncludeDirs: Any *additional* include paths required by dependent
libraries that have not already been added by
include_directories. Again, normally, leave this empty.
extraMexFlags: Any *additional* flags to pass to the compiler when building
the wrap code. Normally, leave this empty.
</code></pre>
</li>
</ul>
<h2>GtsamMakeConfigFile</h2>
<pre><code>include(GtsamMakeConfigFile)
</code></pre>
<p>Defines a function for generating a config file so your project may be found with the CMake <code>find_package</code> function. TODO: Write documentation.</p>

105
cmake/README.md Normal file
View File

@ -0,0 +1,105 @@
GTSAMCMakeTools
===============
This is the collection of GTSAM CMake tools that may be useful in external projects. The way to use this collection is by first making a find_package call:
find_package(GTSAMCMakeTools)
which will add a directory containing the GTSAM CMake tools to the CMAKE_MODULE_PATH variable. After that, you may include the files you would like to use. These files and the functions they define are explained below.
GtsamBuildTypes
---------------
include(GtsamBuildTypes)
Including this file immediately sets up the following build types and a drop-down list in cmake-gui:
* `Debug`
* `Release`
* `RelWithDebInfo`
* `Profiling`: All optimizations enabled and minimal debug symbols
* `Timing`: Defines the symbol GTSAM_ENABLE_TIMING for using GTSAM timing instrumentation
It also configures several minor details, as follows:
* The compile flag `-ftemplate-depth=1024` is set for newer versions of Clang to handle complex templates.
* On Windows, executable and dll output paths are set to `${CMAKE_BINARY_DIR}/bin` and import library output to `${CMAKE_BINARY_DIR}/lib`.
It defines the following functions:
* `gtsam_assign_source_folders( [files] )` Organizes files in the IDE into folders to reflect the actual directory structure of those files. Folders will be determined relative to the current source folder when this function is called.
* `gtsam_assign_all_source_folders()` Calls `gtsam_assign_source_folders` on all cpp, c, and h files recursively in the current source folder.
GtsamTesting
------------
include(GtsamTesting)
Defines two useful functions for creating CTest unit tests. Also immediately creates a `check` target that builds and runs all unit tests.
* `gtsamAddTestsGlob(groupName globPatterns excludedFiles linkLibraries)` Add a group of unit tests. A list of unit test .cpp files or glob patterns specifies the tests to create. Tests are assigned into a group name so they can easily by run independently with a make target. Running 'make check' builds and runs all tests.
Usage example:
gtsamAddTestsGlob(basic "test*.cpp" "testBroken.cpp" "gtsam;GeographicLib")
Arguments:
groupName: A name that will allow this group of tests to be run independently, e.g.
'basic' causes a 'check.basic' target to be created to run this test
group.
globPatterns: The list of files or glob patterns from which to create unit tests, with
one test created for each cpp file. e.g. "test*.cpp", or
"testA*.cpp;testB*.cpp;testOneThing.cpp".
excludedFiles: A list of files or globs to exclude, e.g. "testC*.cpp;testBroken.cpp".
Pass an empty string "" if nothing needs to be excluded.
linkLibraries: The list of libraries to link to in addition to CppUnitLite.
* `gtsamAddExamplesGlob(globPatterns excludedFiles linkLibraries)` Add scripts that will serve as examples of how to use the library. A list of files or glob patterns is specified, and one executable will be created for each matching .cpp file. These executables will not be installed. They are build with 'make all' if GTSAM_BUILD_EXAMPLES_ALWAYS is enabled. They may also be built with 'make examples'.
Usage example:
gtsamAddExamplesGlob("*.cpp" "BrokenExample.cpp" "gtsam;GeographicLib")
Arguments:
globPatterns: The list of files or glob patterns from which to create unit tests, with
one test created for each cpp file. e.g. "*.cpp", or
"A*.cpp;B*.cpp;MyExample.cpp".
excludedFiles: A list of files or globs to exclude, e.g. "C*.cpp;BrokenExample.cpp". Pass
an empty string "" if nothing needs to be excluded.
linkLibraries: The list of libraries to link to.
GtsamMatlabWrap
---------------
include(GtsamMatlabWrap)
Defines functions for generating MATLAB wrappers. Also immediately creates several CMake options for configuring the wrapper.
* `wrap_and_install_library(interfaceHeader linkLibraries extraIncludeDirs extraMexFlags)` Generates wrap code and compiles the wrapper.
Usage example:
`wrap_and_install_library("lba.h" "" "" "")`
Arguments:
interfaceHeader: The relative or absolute path to the wrapper interface
definition file.
linkLibraries: Any *additional* libraries to link. Your project library
(e.g. `lba`), libraries it depends on, and any necessary
MATLAB libraries will be linked automatically. So normally,
leave this empty.
extraIncludeDirs: Any *additional* include paths required by dependent
libraries that have not already been added by
include_directories. Again, normally, leave this empty.
extraMexFlags: Any *additional* flags to pass to the compiler when building
the wrap code. Normally, leave this empty.
GtsamMakeConfigFile
-------------------
include(GtsamMakeConfigFile)
Defines a function for generating a config file so your project may be found with the CMake `find_package` function. TODO: Write documentation.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,42 +1,8 @@
if(NOT MSVC)
add_custom_target(examples)
endif()
# Build example executables
FILE(GLOB example_srcs "*.cpp")
set (excluded_examples #"")
"${CMAKE_CURRENT_SOURCE_DIR}/DiscreteBayesNet_FG.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/UGM_chain.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/UGM_small.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/elaboratePoint2KalmanFilter.cpp"
set (excluded_examples
DiscreteBayesNet_FG.cpp
UGM_chain.cpp
UGM_small.cpp
elaboratePoint2KalmanFilter.cpp
)
list(REMOVE_ITEM example_srcs ${excluded_examples})
foreach(example_src ${example_srcs} )
get_filename_component(example_base ${example_src} NAME_WE)
set( example_bin ${example_base} )
message(STATUS "Adding Example ${example_bin}")
if(NOT MSVC)
add_dependencies(examples ${example_bin})
endif()
add_executable(${example_bin} ${example_src})
# Disable building during make all/install
if (GTSAM_DISABLE_EXAMPLES_ON_INSTALL)
set_target_properties(${example_bin} PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
target_link_libraries(${example_bin} ${gtsam-default} ${Boost_PROGRAM_OPTIONS_LIBRARY})
if(NOT MSVC)
add_custom_target(${example_bin}.run ${EXECUTABLE_OUTPUT_PATH}${example_bin} ${ARGN})
endif()
# Set up Visual Studio folder
if(MSVC)
set_property(TARGET ${example_bin} PROPERTY FOLDER "Examples")
endif()
endforeach(example_src)
gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam;${Boost_PROGRAM_OPTIONS_LIBRARY}")

View File

@ -95,6 +95,7 @@ int lastStep;
int nThreads;
int relinSkip;
bool incremental;
bool dogleg;
bool batch;
bool compare;
bool perturb;
@ -126,6 +127,7 @@ int main(int argc, char *argv[]) {
("threads", po::value<int>(&nThreads)->default_value(-1), "Number of threads, or -1 to use all processors")
("relinSkip", po::value<int>(&relinSkip)->default_value(10), "Fluid relinearization check every arg steps")
("incremental", "Run in incremental mode using ISAM2 (default)")
("dogleg", "When in incremental mode, solve with Dogleg instead of Gauss-Newton in iSAM2")
("batch", "Run in batch mode, requires an initialization from --read-solution")
("compare", po::value<vector<string> >()->multitoken(), "Compare two solution files")
("perturb", po::value<double>(&perturbationNoise), "Perturb a solution file with the specified noise")
@ -141,6 +143,7 @@ int main(int argc, char *argv[]) {
stats = (vm.count("stats") > 0);
const int modesSpecified = int(batch) + int(compare) + int(perturb) + int(stats);
incremental = (vm.count("incremental") > 0 || modesSpecified == 0);
dogleg = (vm.count("dogleg") > 0);
if(compare) {
const vector<string>& compareFiles = vm["compare"].as<vector<string> >();
if(compareFiles.size() != 2) {
@ -233,6 +236,8 @@ int main(int argc, char *argv[]) {
void runIncremental()
{
ISAM2Params params;
if(dogleg)
params.optimizationParams = ISAM2DoglegParams();
params.relinearizeSkip = relinSkip;
params.enablePartialRelinearizationCheck = true;
ISAM2 isam2(params);
@ -536,8 +541,8 @@ void runCompare()
void runPerturb()
{
// Set up random number generator
boost::random::mt19937 rng;
boost::random::normal_distribution<double> normal(0.0, perturbationNoise);
boost::mt19937 rng;
boost::normal_distribution<double> normal(0.0, perturbationNoise);
// Perturb values
VectorValues noise;

18
gtsam.h
View File

@ -563,15 +563,15 @@ virtual class Pose3 : gtsam::Value {
void serialize() const;
};
#include <gtsam/geometry/Sphere2.h>
virtual class Sphere2 : gtsam::Value {
#include <gtsam/geometry/Unit3.h>
virtual class Unit3 : gtsam::Value {
// Standard Constructors
Sphere2();
Sphere2(const gtsam::Point3& pose);
Unit3();
Unit3(const gtsam::Point3& pose);
// Testable
void print(string s) const;
bool equals(const gtsam::Sphere2& pose, double tol) const;
bool equals(const gtsam::Unit3& pose, double tol) const;
// Other functionality
Matrix basis() const;
@ -580,14 +580,14 @@ virtual class Sphere2 : gtsam::Value {
// Manifold
static size_t Dim();
size_t dim() const;
gtsam::Sphere2 retract(Vector v) const;
Vector localCoordinates(const gtsam::Sphere2& s) const;
gtsam::Unit3 retract(Vector v) const;
Vector localCoordinates(const gtsam::Unit3& s) const;
};
#include <gtsam/geometry/EssentialMatrix.h>
virtual class EssentialMatrix : gtsam::Value {
// Standard Constructors
EssentialMatrix(const gtsam::Rot3& aRb, const gtsam::Sphere2& aTb);
EssentialMatrix(const gtsam::Rot3& aRb, const gtsam::Unit3& aTb);
// Testable
void print(string s) const;
@ -601,7 +601,7 @@ virtual class EssentialMatrix : gtsam::Value {
// Other methods:
gtsam::Rot3 rotation() const;
gtsam::Sphere2 direction() const;
gtsam::Unit3 direction() const;
Matrix matrix() const;
double error(Vector vA, Vector vB);
};

View File

@ -24,3 +24,31 @@ if(NOT GTSAM_USE_SYSTEM_EIGEN)
DESTINATION include/gtsam/3rdparty/Eigen
FILES_MATCHING PATTERN "*.h")
endif()
add_subdirectory(metis-5.1.0)
############ NOTE: When updating GeographicLib be sure to disable building their examples
############ and unit tests by commenting out their lines:
# add_subdirectory (examples)
# set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert GeodSolve
# GeoidEval Gravity MagneticField Planimeter TransverseMercatorProj)
# add_subdirectory (tools)
# Find GeographicLib using the find script distributed with it
include(GeographicLib/cmake/FindGeographicLib.cmake)
# Set up the option to install GeographicLib
if(GEOGRAPHICLIB_FOUND)
set(install_geographiclib_default OFF)
else()
set(install_geographiclib_default ON)
endif()
option(GTSAM_INSTALL_GEOGRAPHICLIB "Build and install the 3rd-party library GeographicLib" ${install_geographiclib_default})
# Print warning if we'll overwrite GeographicLib
if(GEOGRAPHICLIB_FOUND AND GTSAM_INSTALL_GEOGRAPHICLIB)
message(WARNING "GeographicLib is installed on your system and GTSAM_INSTALL_GEOGRAPHICLIB is enabled. Installing gtsam will either overwrite the installed GeographicLib or install a second version that may conflict. You may want to disable GTSAM_INSTALL_GEOGRAPHICLIB if the installed version was not installed by GTSAM.")
endif()
if(GTSAM_INSTALL_GEOGRAPHICLIB)
add_subdirectory(GeographicLib)
endif()

View File

@ -0,0 +1,143 @@
A library for geographic projections.
Written by Charles Karney <charles@karney.com> and licensed under
the MIT/X11 License. For more information, see
http://geographiclib.sourceforge.net/
Files
00README.txt -- this file
AUTHORS -- the authors of the library
LICENSE.txt -- the MIT/X11 License
INSTALL -- brief installation instructions
NEWS -- a history of changes
include/GeographicLib/ and src/
Config.h.in, Config.h -- system dependent configuration
Constants.hpp -- WGS84 constants
Math.hpp -- math routines
Utility.hpp -- I/O and date routines
Accumulator.[ch]pp -- quad precision adder
PolarStereographic.[ch]pp -- polar stereographic projection
TransverseMercator.[ch]pp -- transverse Mercator projection
UTMUPS.[ch]pp -- UTM and UPS
MGRS.[ch]pp -- MGRS
TransverseMercatorExact.[ch]pp -- exact TM projection
EllipticFunction.[ch]pp -- elliptic functions
GeoCoords.[ch]pp -- hold geographic location
DMS.[ch]pp -- handle degrees minutes seconds
Geocentric.[ch]pp -- geocentric coordinates
LocalCartesian.[ch]pp -- local cartesian coordinates
Geodesic.[ch]pp -- geodesic calculations
GeodesicLine.[ch]pp -- calculations on a single geodesic
PolygonArea.[ch]pp -- polygon area
AzimuthalEquidistant.[ch]pp -- azimuthal equidistant projection
Gnomonic.[ch]pp -- gnomonic projection
CassiniSoldner.[ch]pp -- Cassini-Soldner equidistant projection
Geoid.[ch]pp -- geoid heights
Gravity{Model,Circle}.[ch]pp -- gravity models
Magnetic{Model,Circle}.[ch]pp -- geomagentic models
{Spherical,Circular}Engine.[ch]pp -- spherical harmonic sums
SphericalHarmonic{,1,2}.hpp -- frontend for spherical harmonics
LambertConformalConic.[ch]pp -- Lambert conformal conic projection
AlbersEqualArea.[ch]pp -- Albers equal area projection
Gnomonic.[ch]pp -- Ellipsoidal gnomonic projection
OSGB.[ch]pp -- Ordnance Survey grid system
Geohash.[ch]pp -- conversions for geohashes
Ellipsoid.[ch]pp -- ellipsoid properties
examples/
example-*.cpp -- simple usage examples for all the classes
GeoidToGTX.cpp -- a parallelization example
tools/
GeoConvert.cpp -- geographic conversion utility
TransverseMercatorTest.cpp -- TM tester
GeodSolve.cpp -- geodesic utility
CartConvert.cpp -- convert to geocentric and local cartesian
EquidistantTest.cpp -- exercise AzimuthalEquidistant and CassiniSoldner
GeoidEval.cpp -- evaluate geoid heights
Gravity.cpp -- evaluate gravity
MagneticField.cpp -- evaluate magnetic field
Planimeter.cpp -- computer polygon areas
geographiclib-get-geoids -- download geoid datasets
geographiclib-get-magnetic -- download geomagnetic models
windows/
GeographicLib-vc9.sln -- MS Studio 2008 solution
Geographic-vc9.vcproj -- project for library
GeoConvert-vc9.vcproj -- project for GeoConvert
TransverseMercatorTest-vc9.vcproj -- project for TransverseMercatorTest
Geod-vc9.vcproj -- project for Geod
Planimeter-vc9.vcproj -- project for Planimeter
CartConvert-vc9.vcproj -- project for CartConvert
EquidistantTest-vc9.vcproj -- project for EquidistantTest
GeoidEval-vc9.vcproj -- project for GeoidEval
Gravity-vc9.vcproj -- project for Gravity
MagneticField-vc9.vcproj -- project for MagneticField
also files for MS Studio 2005 (with vc8)
also files for MS Studio 2010 (with vc10)
NETGeographic-vc10.vcxproj -- project for .NET wrapper
maxima/
tm.mac -- Maxima code for high precision TM
ellint.mac -- Maxima code for elliptic functions needed by tm.mac
tmseries.mac -- Maxima code for series approximations for TM
geod.mac -- Maxima code for series approximations for Geodesic
geodesic.mac -- Maxima code for geodesic problems
matlab/
geographiclibinterface.m -- Matlab code to compile Matlab interfaces
utmupsforward.{cpp,m} -- Matlab code to convert geographic to UTM/UPS
utmupsreverse.{cpp,m} -- Matlab code to convert UTM/UPS to geographic
mgrsforward.{cpp,m} -- Matlab code to convert UTM/UPS to MGRS
mgrsreverse.{cpp,m} -- Matlab code to convert MGRS to UTM/UPS
geodesicdirect.{cpp,m} -- Matlab code for the direct geodesic problem
geodesicinverse.{cpp,m} -- Matlab code for the inverse geodesic problem
geodesicline.{cpp,m} -- Matlab code for geodesic lines
geoidheight.{cpp,m} -- Matlab code to look up geoid heights
polygonarea.{cpp,m} -- Matlab code for polygon areas
geoddoc.m -- documentation for native Matlab geodesic routines
geodreckon.m -- native Matlab implementation of direct geodesic problem
geoddistance.m -- native Matlab implementation of inverse geodesic problem
geodarea.m -- native Matlab implementation of polygon area
defaultellipsoid.m, ecc2flat.m, flat2ecc.m -- auxiliary functions
geodproj.m -- documentation for geodesic projections
*_{fwd,inv}.m -- native Matlab implementation of geodesic projections
private/*.m -- internal functions for geodesic routines
doc/
doxyfile.in -- Doxygen config file
Geographic.dox -- main page of Doxygen documentation
geodseries30.html -- geodesic series to 30th order
tmseries30.html -- transverse Mercator series to 30th order
html/* -- directory with built documentation
scripts/*.html -- demonstrations of the JavaScript interface
scripts/GeographicLib/*.js -- JavaScript implementation of geodesics
man/
*.pod -- plain old documentation
*.1 -- man pages in nroff format
*.1.html -- man pages in html format
*.usage -- documentation for incorporation into executables
python/GeographicLib/*.py -- Python implementation of geodesic routines
java/.../*.java -- Java implementation of geodesic routines
dotnet/NETGeographicLib/*.{cpp,h} -- .NET wrapper for GeographicLib
dotnet/examples/CS/*.cs -- simple C# examples for each class
dotnet/examples/ManagedCPP/*.cpp -- Managed C++ examples for each class
dotnet/examples/VB/*.vb -- simple Visual Basic examples for each class
dotnet/Projection/* -- a more complex C# application
legacy/C/* -- C implementation of geodesic routines
legacy/Fortran/* -- Fortran implementation of geodesic routines
Makefile.mk -- Unix/Linux makefiles
configure -- autoconf configuration script
CMakeLists.txt -- cmake configuration files
cmake/
FindGeographicLib.cmake -- cmake find script
*.cmake.in -- cmake config templates

6
gtsam/3rdparty/GeographicLib/AUTHORS vendored Normal file
View File

@ -0,0 +1,6 @@
Charles Karney <charles@karney.com>
Francesco Paolo Lovergine <frankie@debian.org> (autoconfiscation)
Mathieu Peyréga <mathieu.peyrega@gmail.com> (help with gravity models)
Andrew MacIntyre <Andrew.MacIntyre@acma.gov.au> (python/setup.py)
Skip Breidbach <skip.breidbach@sri.com> (maven support for Java)
Scott Heiman <mrmtdew2@outlook.com> (.NET wrappers + C# examples)

View File

@ -0,0 +1,489 @@
project (GeographicLib)
# Version information
set (PROJECT_VERSION_MAJOR 1)
set (PROJECT_VERSION_MINOR 34)
set (PROJECT_VERSION_PATCH 0)
set (PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
if (PROJECT_VERSION_PATCH GREATER 0)
set (PROJECT_VERSION "${PROJECT_VERSION}.${PROJECT_VERSION_PATCH}")
endif ()
set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
# The library version tracks the numbering given by libtool in the
# autoconf set up.
set (LIBVERSION 10)
set (LIBVERSIONFULL 10.1.1)
string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
cmake_minimum_required (VERSION 2.8.4) # This version was released 2011-02-16
# User-settable variables
# (1) COMMON_INSTALL_PATH governs the installation convention. If it
# is on ON (the Linux default), the installation is to a common
# directory, e.g., /usr/local. If it is OFF (the Windows default),
# the installation directory contains the package name, e.g.,
# c:/pkg/GeographicLib-1.22. The installation directories for the
# documentation, cmake configuration, python and matlab interfaces all
# depend on the variable with deeper paths relative to
# CMAKE_INSTALL_PREFIX being used when it's ON.
if (WIN32)
option (COMMON_INSTALL_PATH "Use a common installation path for packages" OFF)
else ()
option (COMMON_INSTALL_PATH "Use a common installation path for packages" ON)
endif ()
# The use of PACKAGE_PATH and INSTALL_PATH is now DEPRECATED.
# (2) PACKAGE_PATH and INSTALL_PATH govern the find_package search
# path and the installation directory. (find_package is not used by
# GeographicLib since it doesn't depend on other packages. However
# PACKAGE_PATH is used here for uniformity with other packages which
# adopt the same conventions.)
#
# If PACKAGE_PATH is defined, it is prepended to CMAKE_PREFIX_PATH.
#
# If INSTALL_PATH is not specified but PACKAGE_PATH is, then
# INSTALL_PATH is set to
# ${PACKAGE_PATH}, if COMMON_INSTALL_PATH is ON;
# ${PACKAGE_PATH}/${PROJECT_NAME}-${PROJECT_VERSION}, otherwise.
#
# If INSTALL_PATH is now defined, then set CMAKE_INSTALL_PREFIX to
# INSTALL_PATH.
#
# Typically, only PACKAGE_PATH needs to be specified, e.g.,
# cmake -D PACKAGE_PATH=/opt .. (on Linux)
# => CMAKE_PREFIX_PATH=/opt CMAKE_INSTALL_PREFIX=/opt
# cmake -D PACKAGE_PATH=C:/pkg .. (on Windows)
# => CMAKE_PREFIX_PATH=C:/pkg CMAKE_INSTALL_PREFIX=C:/pkg/GeographicLib-1.22
if (PACKAGE_PATH)
set (CMAKE_PREFIX_PATH ${PACKAGE_PATH} ${CMAKE_PREFIX_PATH})
message (STATUS "CMAKE_PREFIX_PATH set to ${CMAKE_PREFIX_PATH}")
endif ()
if (NOT INSTALL_PATH AND PACKAGE_PATH)
if (COMMON_INSTALL_PATH)
set (INSTALL_PATH ${PACKAGE_PATH} CACHE PATH "Installation directory" FORCE)
else ()
set (INSTALL_PATH ${PACKAGE_PATH}/${PROJECT_NAME}-${PROJECT_VERSION}
CACHE PATH "Installation directory" FORCE)
endif ()
endif ()
if (INSTALL_PATH)
file (TO_CMAKE_PATH ${INSTALL_PATH} CMAKE_INSTALL_PREFIX)
message (STATUS "CMAKE_INSTALL_PREFIX set to ${CMAKE_INSTALL_PREFIX}")
endif ()
# (3) Where to look for data files. Various classes look in the geoids,
# gravity, magnetic, subdirectories of ${GEOGRAPHICLIB_DATA}.
if (WIN32)
# The binary installers for the data files for Windows are created
# with Inno Setup which uses {commonappdata}. On most Windows
# systems this is
# "C:/Documents and Settings/All Users/Application Data", while on
# newer systems (Windows 7), it is C:/ProgramData. However the
# longer name "works" on all Windows systems.
set (GEOGRAPHICLIB_DATA
"C:/Documents and Settings/All Users/Application Data/GeographicLib"
CACHE PATH "Location for data for GeographicLib")
else ()
set (GEOGRAPHICLIB_DATA
"/usr/local/share/GeographicLib"
CACHE PATH "Location for data for GeographicLib")
endif ()
# (4) Build which libraries? Possible values are SHARED, STATIC, BOTH.
if (MSVC)
set (GEOGRAPHICLIB_LIB_TYPE STATIC CACHE STRING
"Types of library generated: SHARED, STATIC (default), or BOTH")
else ()
set (GEOGRAPHICLIB_LIB_TYPE SHARED CACHE STRING
"Types of library generated: SHARED (default), STATIC, or BOTH")
endif ()
set_property (CACHE GEOGRAPHICLIB_LIB_TYPE
PROPERTY STRINGS "SHARED" "STATIC" "BOTH")
if ("${GEOGRAPHICLIB_LIB_TYPE}" STREQUAL "BOTH")
set (GEOGRAPHICLIB_SHARED_LIB ON)
set (GEOGRAPHICLIB_STATIC_LIB ON)
set (GEOGRAPHICLIB_LIB_TYPE_VAL 2)
elseif ("${GEOGRAPHICLIB_LIB_TYPE}" STREQUAL "SHARED")
set (GEOGRAPHICLIB_SHARED_LIB ON)
set (GEOGRAPHICLIB_STATIC_LIB OFF)
set (GEOGRAPHICLIB_LIB_TYPE_VAL 1)
elseif ("${GEOGRAPHICLIB_LIB_TYPE}" STREQUAL "STATIC")
set (GEOGRAPHICLIB_SHARED_LIB OFF)
set (GEOGRAPHICLIB_STATIC_LIB ON)
set (GEOGRAPHICLIB_LIB_TYPE_VAL 0)
else ()
message (FATAL_ERROR
"Bad value of GEOGRAPHICLIB_LIB_TYPE, \"${GEOGRAPHICLIB_LIB_TYPE}\" "
"(should be SHARED, STATIC or BOTH)")
endif ()
if (GEOGRAPHICLIB_STATIC_LIB)
set (PROJECT_STATIC_LIBRARIES GeographicLib_STATIC)
set (PROJECT_STATIC_DEFINITIONS -DGEOGRAPHICLIB_SHARED_LIB=0)
else ()
set (PROJECT_STATIC_LIBRARIES)
set (PROJECT_STATIC_DEFINITIONS)
endif ()
if (GEOGRAPHICLIB_SHARED_LIB)
set (PROJECT_SHARED_LIBRARIES GeographicLib)
set (PROJECT_LIBRARIES ${PROJECT_SHARED_LIBRARIES})
set (PROJECT_SHARED_DEFINITIONS -DGEOGRAPHICLIB_SHARED_LIB=1)
set (PROJECT_DEFINITIONS ${PROJECT_SHARED_DEFINITIONS})
else ()
set (PROJECT_SHARED_LIBRARIES)
set (PROJECT_LIBRARIES ${PROJECT_STATIC_LIBRARIES})
set (PROJECT_SHARED_DEFINITIONS)
set (PROJECT_DEFINITIONS ${PROJECT_STATIC_DEFINITIONS})
endif ()
# (5) Compile the Matlab interfaces? Skip Matlab compilation if OFF
set (MATLAB_COMPILER OFF CACHE STRING
"Compiler for matlab/octave interface: mex or mkoctfile or OFF")
set_property (CACHE MATLAB_COMPILER PROPERTY STRINGS "mex" "mkoctfile" OFF)
# (6) Create the documentation? This depends on whether doxygen can be
# found. If this is OFF, then links will be provided to the online
# documentation on Sourceforge.
option (GEOGRAPHICLIB_DOCUMENTATION
"Use doxygen to create the documentation" OFF)
# (7) Build .NET wrapper library NETGeographicLib. This only applies to
# Windows. Default is OFF, because, currently, most people don't use
# this interface.
option (BUILD_NETGEOGRAPHICLIB "Build NETGeographicLib library" OFF)
# (8) Set the default "real" precision. This should probably be left
# at 2 (double).
set (GEOGRAPHICLIB_PRECISION 2 CACHE STRING
"Default real precision: 1 = float, 2 = double, 3 = long double")
set_property (CACHE GEOGRAPHICLIB_PRECISION PROPERTY STRINGS 1 2 3)
# (9) When making a binary package, should we include the debug version
# of the library? This applies to MSVC only, because that's the
# platform where debug and release compilations do not inter-operate.
# It requires building as follows:
# cmake --build . --config Debug --target ALL_BUILD
# cmake --build . --config Release --target ALL_BUILD
# cmake --build . --config Release --target PACKAGE
option (PACKAGE_DEBUG_LIBS
"Include debug versions of library in binary package" OFF)
set (LIBNAME Geographic)
if (MSVC OR CMAKE_CONFIGURATION_TYPES)
# For multi-config systems and for Visual Studio, the debug version of
# the library is called Geographic_d.
set (CMAKE_DEBUG_POSTFIX _d)
endif ()
if (NOT MSVC)
# Set the run time path for shared libraries for non-Windows machines.
# (1) include link path for external packages (not needed with
# GeographicLib because there are no external packages).
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# (2) include installed path for GeographicLib.
if (NOT APPLE)
# Use relative path so that package is relocatable
set (CMAKE_INSTALL_RPATH "\$ORIGIN/../lib${LIB_SUFFIX}")
else ()
# Need absolute path with MacOSx
set (CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
endif ()
endif ()
if (NOT CYGWIN)
# cygwin has a long double but the support for ::cbrtl etc is missing
include (CheckTypeSize)
check_type_size ("long double" LONG_DOUBLE BUILTIN_TYPES_ONLY)
endif ()
include (TestBigEndian)
test_big_endian (WORDS_BIGENDIAN)
# Create a Config.h to expose system information to the compiler
configure_file (
include/GeographicLib/Config.h.in
include/GeographicLib/Config.h )
# The documentation depends on doxygen. Need version 1.8.1.2 or later
# for support of greek letters and math symbols.
if (GEOGRAPHICLIB_DOCUMENTATION)
set (DOXYGEN_SKIP_DOT ON)
find_package (Doxygen 1.8.1.2)
if (DOXYGEN_FOUND)
execute_process (COMMAND ${DOXYGEN_EXECUTABLE} --version
OUTPUT_VARIABLE DOXYGEN_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
if (DOXYGEN_VERSION VERSION_LESS 1.4.0)
set (DOXYGEN_FOUND FALSE)
message (STATUS "Doxygen version found, ${DOXYGEN_VERSION}, is too old")
endif ()
endif ()
endif ()
# The man pages are written as pod files and converted to nroff format,
# C++ code, and html. Because this require tools that may not be
# available on an end-user's system, the creation of the final
# documentation is therefore only done in "MAINTAINER" mode. The
# maintainer runs "make distrib-all" which installs the transformed
# documentation files into the source tree.
if (NOT WIN32 AND NOT APPLE)
find_program (HAVE_POD2MAN pod2man)
find_program (HAVE_POD2HTML pod2html)
find_program (HAVE_COL col)
endif ()
if (HAVE_POD2MAN AND HAVE_POD2HTML AND HAVE_COL)
set (MAINTAINER ON)
else ()
set (MAINTAINER OFF)
endif ()
if (MAINTAINER)
add_custom_target (distrib-all)
add_dependencies (distrib-all distrib-man)
endif ()
# Look for the tool to compile the Matlab interfaces.
if (MATLAB_COMPILER)
if (WIN32)
set (MATLAB_COMPILER_EXT ".bat")
else ()
set (MATLAB_COMPILER_EXT "")
endif ()
find_program (MEX "${MATLAB_COMPILER}${MATLAB_COMPILER_EXT}")
if (MATLAB_COMPILER MATCHES "mex")
get_filename_component (MATLABDIR "${MEX}" REALPATH)
get_filename_component (MATLABDIR "${MATLABDIR}" PATH)
find_program (MEXEXTPROG "mexext${MATLAB_COMPILER_EXT}"
PATHS "${MATLABDIR}")
execute_process (COMMAND "${MEXEXTPROG}"
OUTPUT_VARIABLE MEXEXT OUTPUT_STRIP_TRAILING_WHITESPACE)
set (MEXOPTIONS "-largeArrayDims")
else ()
set (MEXEXT "mex")
set (MEXOPTIONS "--mex")
endif ()
if (NOT MSVC)
# mex files are shared objects => require static lib to be built with
# position independent code
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
endif ()
if (NOT MEX)
message (WARNING
"Cannot find Matlab compiler ${MATLAB_COMPILER}${MATLAB_COMPILER_EXT}")
elseif (NOT MEXEXT)
set (MEX OFF)
message (WARNING "Cannot determine extension for Matlab compiled code")
endif ()
endif ()
# Set a default build type for single-configuration cmake generators if
# no build type is set.
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release)
endif ()
# Make the compiler more picky.
if (MSVC)
string (REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else ()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
# check for C++11 support
include (CheckCXXCompilerFlag)
set (CXX11FLAG "-std=c++11")
check_cxx_compiler_flag (${CXX11FLAG} CXX11TEST1)
if (NOT CXX11TEST1)
set (CXX11FLAG "-std=c++0x")
check_cxx_compiler_flag (${CXX11FLAG} CXX11TEST2)
if (NOT CXX11TEST2)
unset (CXX11FLAG)
endif ()
endif ()
if (CXX11FLAG)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11FLAG}")
endif ()
endif ()
if (APPLE)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "i.86" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "amd64" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
set (CMAKE_OSX_ARCHITECTURES "i386 -arch x86_64")
endif ()
endif ()
# The list of tools (to be installed into, e.g., /usr/local/bin)
#set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert GeodSolve
# GeoidEval Gravity MagneticField Planimeter TransverseMercatorProj)
# The list of scripts (to be installed into, e.g., /usr/local/sbin)
set (SCRIPTS
geographiclib-get-geoids geographiclib-get-gravity geographiclib-get-magnetic)
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
# Set the include directories. Look in ${PROJECT_BINARY_DIR}/include
# first because that's where Config.h will be
include_directories ("${PROJECT_BINARY_DIR}/include" include)
# The list of subdirectories to process
add_subdirectory (src)
add_subdirectory (include/GeographicLib)
# add_subdirectory (tools)
add_subdirectory (man)
add_subdirectory (doc)
add_subdirectory (matlab)
add_subdirectory (python/geographiclib)
# if (GEOGRAPHICLIB_PRECISION EQUAL 2)
# # The examples assume double precision
# add_subdirectory (examples)
# endif ()
if (BUILD_NETGEOGRAPHICLIB)
set (NETGEOGRAPHICLIB_LIBRARIES NETGeographicLib)
set (NETLIBNAME NETGeographic)
add_subdirectory (dotnet/NETGeographicLib)
if (GEOGRAPHICLIB_PRECISION EQUAL 2)
add_subdirectory (dotnet/examples/ManagedCPP)
endif ()
endif ()
add_subdirectory (cmake)
if (EXISTS ${PROJECT_SOURCE_DIR}/tests/CMakeLists.txt)
add_subdirectory (tests)
endif ()
# Packaging support; we deal with
# (1) a source distribution: cmake make a tar.gz file and the zip file
# is created from this. Only the maintainer can do this, because of
# the need to generate additional documentation files.
# (2) a binary distribution: code is included for Linux, Apple, and
# Windows, but only the Windows distribution has been exercised.
# Need to ensure that system dlls get included in a binary distribution
if (NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
# Visual Studio Express does include redistributable components so
# squelch the warning.
set (CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
endif ()
set (CMAKE_INSTALL_DEBUG_LIBRARIES ON)
include (InstallRequiredSystemLibraries)
# The configuration of CPack is via variable that need to be set before
# the include (CPack).
set (CPACK_PACKAGE_CONTACT charles@karney.com)
set (CPACK_PACKAGE_VENDOR "GeographicLib")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY
"GeographicLib library, utilities, and documentation")
# The list of files to be excluded from the source distribution.
set (CPACK_SOURCE_IGNORE_FILES
"#"
"~\$"
"/\\\\.git"
"${PROJECT_SOURCE_DIR}/BUILD"
"${PROJECT_SOURCE_DIR}/(tests|testdata|cgi-bin|.*\\\\.cache)/"
"${PROJECT_SOURCE_DIR}/(distrib|.*-distrib|.*-installer|geodesic-papers)/"
"${PROJECT_SOURCE_DIR}/[^/]*\\\\.(html|kmz|pdf|xml)\$"
"${PROJECT_SOURCE_DIR}/(autogen|biblio|js-compress)\\\\.sh\$"
"${PROJECT_SOURCE_DIR}/(geodesic-biblio.txt|makefile-admin|[^/]*\\\\.png)\$"
"${PROJECT_SOURCE_DIR}/matlab/matlab-.*blurb.txt\$" )
set (CPACK_SOURCE_GENERATOR TGZ)
set (CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE.txt)
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_VERSION}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
if (WIN32)
# The Windows binary packager is NSIS. Set the necessary variables
# for this.
set (CPACK_NSIS_CONTACT "charles@karney.com")
set (CPACK_NSIS_URL_INFO_ABOUT "http://geographiclib.sf.net")
set (CPACK_NSIS_HELP_LINK "mailto:charles@karney.com")
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Hardcode the prefix for Visual Studio 10
set (CPACK_NSIS_INSTALL_ROOT "C:\\\\pkg-vc10-x64")
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-win64")
set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} x64 ${PROJECT_VERSION}")
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY
"${PROJECT_NAME}-x64-${PROJECT_VERSION}")
else ()
# Hardcode the prefix for Visual Studio 10
set (CPACK_NSIS_INSTALL_ROOT "C:\\\\pkg-vc10")
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-win32")
set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} ${PROJECT_VERSION}")
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY
"${PROJECT_NAME}-${PROJECT_VERSION}")
endif ()
set (CPACK_NSIS_DISPLAY_NAME ${CPACK_NSIS_PACKAGE_NAME})
set (CPACK_NSIS_MENU_LINKS
"http://geographiclib.sf.net/${PROJECT_VERSION}/index.html"
"Library documentation"
"http://geographiclib.sf.net/${PROJECT_VERSION}/utilities.html"
"Utilities documentation"
"http://geographiclib.sf.net" "GeographicLib home page"
"http://sf.net/projects/geographiclib/" "Main project page")
set (CPACK_NSIS_MODIFY_PATH ON)
elseif (APPLE)
# Not tested
set (CPACK_GENERATOR Bundle)
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-darwin")
else ()
# Not tested
set (CPACK_GENERATOR TGZ)
endif ()
include (CPack)
# Another maintainer-specific target is building the source distribution
# via the target dist. This calls package_source to make a tar.gz file.
# However this needs to be touched up to support the vanilla Makefiles
# provided with GeographicLib. This entails
# (1) creating Makefile (which includes Makefile.mk);
# (2) creating a bare-bones Config.h (with just the version information);
# (3) making sure that make thinks the generated documentation files are
# up-to-date.
# Then a new tar.gz file and zip file are created. To avoid potential
# problems with directory permissions, tar and zip are told only to
# archive the files.
if (MAINTAINER)
add_custom_target (dist
COMMAND ${CMAKE_MAKE_PROGRAM} package_source
COMMAND
cd _CPack_Packages/Linux-Source/TGZ/${CPACK_SOURCE_PACKAGE_FILE_NAME} &&
echo include Makefile.mk > Makefile &&
sed -e "s/Unconfigured/${PROJECT_VERSION}/"
-e "s/MAJOR .*/MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}/"
-e "s/MINOR .*/MINOR ${CPACK_PACKAGE_VERSION_MINOR}/"
-e "s/PATCH .*/PATCH ${CPACK_PACKAGE_VERSION_PATCH}/"
include/GeographicLib/Config.h > include/GeographicLib/Config.h.new &&
mv include/GeographicLib/Config.h.new include/GeographicLib/Config.h
COMMAND
cd _CPack_Packages/Linux-Source/TGZ/${CPACK_SOURCE_PACKAGE_FILE_NAME} &&
touch man/[A-Za-z]*.usage man/[A-Za-z]*.1 man/[A-Za-z]*.1.html &&
chmod -R g-w .
COMMAND
cd _CPack_Packages/Linux-Source/TGZ &&
find ${CPACK_SOURCE_PACKAGE_FILE_NAME} -type f |
tar cfzT ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.gz -
COMMAND
rm -f ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}.zip &&
rsync -a --delete
_CPack_Packages/Linux-Source/TGZ/${CPACK_SOURCE_PACKAGE_FILE_NAME}
_CPack_Packages/Linux-Source/TGZ.DOS/ &&
cd _CPack_Packages/Linux-Source/TGZ.DOS &&
find . -type f |
egrep '/\(doxyfile.*\\.in|MANIFEST.in|NEWS|AUTHORS|INSTALL|pom\\.xml|dummy.*\\.in|.*\\.\(cpp|hpp|h\\.in|txt|pro|usage|pod|py|m|mac|cmake\\.in|cmake|h|js|c|for|dox|cs|vb|inc|java|html\\.in\)\)$$' |
xargs unix2dos -q -k &&
find ${CPACK_SOURCE_PACKAGE_FILE_NAME} -type f |
zip -q ${CMAKE_BINARY_DIR}/${CPACK_SOURCE_PACKAGE_FILE_NAME}.zip -@
)
add_dependencies (dist distrib-all)
endif ()
# Add a test target; the tests are in tools.
enable_testing ()

3
gtsam/3rdparty/GeographicLib/INSTALL vendored Normal file
View File

@ -0,0 +1,3 @@
For installation instructions, open
http://geographiclib.sourceforge.net/html/install.html

View File

@ -0,0 +1,23 @@
This license applies to GeographicLib, versions 1.12 and later.
Copyright (c) 2008-2013, Charles Karney
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.

1
gtsam/3rdparty/GeographicLib/Makefile vendored Normal file
View File

@ -0,0 +1 @@
include Makefile.mk

View File

@ -0,0 +1,51 @@
#
# Makefile.am
#
# Copyright (C) 2009, Francesco P. Lovergine <frankie@debian.org>
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src man tools doc include matlab python cmake examples
EXTRA_DIST = AUTHORS 00README.txt LICENSE.txt NEWS INSTALL \
Makefile.mk CMakeLists.txt windows maxima doc legacy java dotnet
dist-hook:
rm -rf $(distdir)/doc/html $(distdir)/doc/manpages ; \
find $(distdir)/maxima -type f -name '*.lsp' | xargs rm -rf ; \
rm -rf $(distdir)/java/targets ; \
find $(distdir)/java -type f -name '*.class' | xargs rm -rf ; \
find $(distdir)/windows -mindepth 1 -type d | xargs rm -rf ; \
find $(distdir)/windows -type f \
! \( -name '*.sln' -o -name '*.vc*proj' -o -name '*.mk' \)| \
xargs rm -f ; \
find $(distdir) \
\( -name .svn -o -name '.git*' -o -name CVS -o -name Makefile -o -name '*~' -o -name '*#*' -o -name 'CMakeFiles' -o -name '*.log' -o -name '*.tmp' -o -name '*.pyc' -o -name '*.bak' -o -name '*.BAK' -o -name geographiclib.js \)| \
xargs rm -rf ; \
echo include Makefile.mk > $(distdir)/Makefile ; \
sed -e "s/Unconfigured/$(PACKAGE_VERSION)/" \
-e "s/MAJOR .*/MAJOR ${GEOGRAPHICLIB_VERSION_MAJOR}/" \
-e "s/MINOR .*/MINOR ${GEOGRAPHICLIB_VERSION_MINOR}/" \
-e "s/PATCH .*/PATCH ${GEOGRAPHICLIB_VERSION_PATCH}/" \
$(top_srcdir)/include/GeographicLib/Config.h > \
$(distdir)/include/GeographicLib/Config.h
# Custom rules
all-local: man doc
install-data-local: install-doc # install-matlab
doc: man
$(MAKE) -C doc doc
install-doc:
$(MAKE) -C doc install-doc
man:
$(MAKE) -C man man
# install-matlab:
# $(MAKE) -C matlab install-matlab
.PHONY: doc install-doc man install-matlab install-python

832
gtsam/3rdparty/GeographicLib/Makefile.in vendored Normal file
View File

@ -0,0 +1,832 @@
# Makefile.in generated by automake 1.12.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
#
# Makefile.am
#
# Copyright (C) 2009, Francesco P. Lovergine <frankie@debian.org>
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = .
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/configure \
$(top_srcdir)/include/GeographicLib/Config-ac.h.in AUTHORS \
INSTALL NEWS config.guess config.sub depcomp install-sh \
ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
cscope distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COL = @COL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@
GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@
GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_REVISION = @LT_REVISION@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POD2HTML = @POD2HTML@
POD2MAN = @POD2MAN@
POW_LIB = @POW_LIB@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src man tools doc include matlab python cmake examples
EXTRA_DIST = AUTHORS 00README.txt LICENSE.txt NEWS INSTALL \
Makefile.mk CMakeLists.txt windows maxima doc legacy java dotnet
all: all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
include/GeographicLib/Config-ac.h: include/GeographicLib/stamp-h1
@if test ! -f $@; then rm -f include/GeographicLib/stamp-h1; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) include/GeographicLib/stamp-h1; else :; fi
include/GeographicLib/stamp-h1: $(top_srcdir)/include/GeographicLib/Config-ac.h.in $(top_builddir)/config.status
@rm -f include/GeographicLib/stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status include/GeographicLib/Config-ac.h
$(top_srcdir)/include/GeographicLib/Config-ac.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f include/GeographicLib/stamp-h1
touch $@
distclean-hdr:
-rm -f include/GeographicLib/Config-ac.h include/GeographicLib/stamp-h1
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
cscopelist-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist-recursive cscopelist
cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
$(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__post_remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod u+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile all-local
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr \
distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-data-local
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
cscopelist-recursive ctags-recursive install-am install-strip \
tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am all-local am--refresh check check-am clean \
clean-cscope clean-generic clean-libtool cscope cscopelist \
cscopelist-recursive ctags ctags-recursive dist dist-all \
dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-generic \
distclean-hdr distclean-libtool distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-data-local install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am
dist-hook:
rm -rf $(distdir)/doc/html $(distdir)/doc/manpages ; \
find $(distdir)/maxima -type f -name '*.lsp' | xargs rm -rf ; \
rm -rf $(distdir)/java/targets ; \
find $(distdir)/java -type f -name '*.class' | xargs rm -rf ; \
find $(distdir)/windows -mindepth 1 -type d | xargs rm -rf ; \
find $(distdir)/windows -type f \
! \( -name '*.sln' -o -name '*.vc*proj' -o -name '*.mk' \)| \
xargs rm -f ; \
find $(distdir) \
\( -name .svn -o -name '.git*' -o -name CVS -o -name Makefile -o -name '*~' -o -name '*#*' -o -name 'CMakeFiles' -o -name '*.log' -o -name '*.tmp' -o -name '*.pyc' -o -name '*.bak' -o -name '*.BAK' -o -name geographiclib.js \)| \
xargs rm -rf ; \
echo include Makefile.mk > $(distdir)/Makefile ; \
sed -e "s/Unconfigured/$(PACKAGE_VERSION)/" \
-e "s/MAJOR .*/MAJOR ${GEOGRAPHICLIB_VERSION_MAJOR}/" \
-e "s/MINOR .*/MINOR ${GEOGRAPHICLIB_VERSION_MINOR}/" \
-e "s/PATCH .*/PATCH ${GEOGRAPHICLIB_VERSION_PATCH}/" \
$(top_srcdir)/include/GeographicLib/Config.h > \
$(distdir)/include/GeographicLib/Config.h
# Custom rules
all-local: man doc
install-data-local: install-doc # install-matlab
doc: man
$(MAKE) -C doc doc
install-doc:
$(MAKE) -C doc install-doc
man:
$(MAKE) -C man man
# install-matlab:
# $(MAKE) -C matlab install-matlab
.PHONY: doc install-doc man install-matlab install-python
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,51 @@
MAKEFILE := $(lastword $(MAKEFILE_LIST))
MAKE := $(MAKE) -f $(MAKEFILE)
SUBDIRS = src man tools doc
ALLDIRS = include $(SUBDIRS) maxima matlab python cmake
all: src man tools
$(SUBDIRS):
$(MAKE) -C $@
tools: src
install: install-headers install-lib install-tools install-man install-cmake \
install-doc install-matlab install-python
clean: clean-src clean-tools clean-doc clean-man clean-matlab clean-python
install-headers:
$(MAKE) -C include install
install-lib:
$(MAKE) -C src install
install-tools: src
$(MAKE) -C tools install
install-cmake:
$(MAKE) -C cmake install
install-doc: doc
$(MAKE) -C doc install
install-man: man
$(MAKE) -C man install
install-matlab: matlab
$(MAKE) -C matlab install
install-python: python
$(MAKE) -C python install
clean-src:
$(MAKE) -C src clean
clean-tools:
$(MAKE) -C tools clean
clean-doc:
$(MAKE) -C doc clean
clean-man:
$(MAKE) -C man clean
clean-matlab: matlab
$(MAKE) -C matlab clean
clean-python: python
$(MAKE) -C python clean
VERSION:=$(shell grep '\bVERSION=' configure | cut -f2 -d\' | head -1)
.PHONY: all $(SUBDIRS) install \
install-headers install-lib install-tools install-cmake install-man \
install-matlab install-python \
clean clean-src clean-tools clean-doc clean-man clean-matlab \
clean-python

886
gtsam/3rdparty/GeographicLib/NEWS vendored Normal file
View File

@ -0,0 +1,886 @@
A reverse chronological list of changes to GeographicLib
For more information, see
http://geographiclib.sourceforge.net/
The current version of the library is 1.34.
Changes between 1.34 (released 2013-12-11) and 1.33 versions:
* Many changes in cmake support:
+ minimum version of cmake needed increased to 2.8.4 (which was
released in 2011-02);
+ allow building both shared and static librarys with
-D GEOGRAPHICLIB_LIB_TYPE=BOTH;
+ both shared and static libraries (Release plus Debug) included in
binary installer;
+ find_package uses COMPONENTS and GeographicLib_USE_STATIC_LIBS to
select the library to use;
+ find_package version checking allows nmake and Visual Studio
generators to interoperate on Windows;
+ find_package (GeographicLib ...) requires that GeographicLib be
capitalized correctly;
+ on Unix/Linux, don't include the version number in directory for
the cmake configuration files;
+ defaults for GEOGRAPHICLIB_DOCUMENTATION and
BUILD_NETGEOGRAPHICLIB are now OFF;
+ the GEOGRAPHICLIB_EXAMPLES configuration parameter is no longer
used; cmake always configures to build the examples, but they are
not built by default (instead build targets: exampleprograms and
netexamples);
+ matlab-all target renamed to matlabinterface;
+ the configuration parameters PACKAGE_PATH and INSTALL_PATH are
now deprecated (use CMAKE_INSTALL_PREFIX instead);
+ on Linux, the installed package is relocatable;
+ on MacOSX, the installed utilities can find the shared library.
* Use a more precise value for OSGB::CentralScale().
* Add Arc routines to python interface.
* The Geod utility has been removed; the same functionality lives on
with GeodSolve (introduced in version 1.30).
Changes between 1.33 (released 2013-10-08) and 1.32 versions:
* Add NETGeographic .NET wrapper library (courtesy of Scott Heiman).
* Make inspector functions in GeographicLib::Ellipsoid const.
* Add Accumulator.cpp to instantiate GeographicLib::Accumulator.
* Defer some of the initialization of GeographicLib::OSGB to when it
is first called.
* Fix bug in autoconf builds under MacOS.
Changes between 1.32 (released 2013-07-12) and 1.31 versions:
* Generalize C interface for polygon areas to allow vertices to be
specified incrementally.
* Fix way flags for C++11 support are determined.
Changes between 1.31 (released 2013-07-01) and 1.30 versions:
* Changes breaking binary compatibility (source compatibility is
maintained):
+ overloaded versions of DMS::Encode,
EllipticFunction::EllipticFunction, and
GeoCoords::DMSRepresentation, have been eliminated by the use of
optional arguments;
+ correct the declaration of first arg to UTMUPS::DecodeEPSG.
* FIX BUG in GeographicLib::GravityCircle constructor (found by
Mathieu Peyréga) which caused bogus results for the gravity
disturbance and gravity anomaly vectors. (This only affected
calculations using GravityCircle. GravityModel calculations did not
suffer from this bug.)
* Improvements to the build:
+ add macros GEOGRAPHICLIB_VERSION_{MAJOR,MINOR,PATCH} to Config.h;
+ fix documentation for new version of perlpod;
+ improving setting of runtime path for Unix-like systems with
cmake;
+ install PDB files when compiling with Visual Studio to aid
debugging;
+ Windows binary release now uses Matlab R2013a (64-bit) and uses
the -largeArrayDims option.
* Changes to the geodesic routines:
+ add Java implementation of the geodesic routines (thanks to Skip
Breidbach for the maven support);
+ FIX BUG: avoid altering input args in Fortran implementation;
+ more systematic treatment of very short geodesic;
+ fixes to python port so that they work with version 3.x, in
addition to 2.x (courtesy of Amato);
+ accumulate the perimeter and area of polygons via a double-wide
accumulator in Fortran, C, and Matlab implementations (this is
already included in the other implementations);
+ port PolygonArea::AddEdge and PolygonArea::TestEdge to JavaScript
and python interfaces;
+ include documentation on short geodesics.
* Unix scripts for downloading datasets,
geographiclib-get-{geoids,gravity,magnetic}, skip already download
models by default, unless the -f flag is given.
* FIX BUGS: meridian convergence and scale returned by
TransverseMercatorExact was wrong at a pole.
* Improve efficiency of MGRS::Forward by avoiding the calculation of
the latitude if possible (adapting an idea of Craig Rollins).
* Fixes to the way the Matlab interface routines are built (thanks to
Phil Miller and Chris F.).
Changes between 1.30 (released 2013-02-27) and 1.29 versions:
* Changes to geodesic routines:
+ fix BUG in fail-safe mechanisms in Geodesic::Inverse;
+ the command line utility Geod is now called GeodSolve;
+ allow addition of polygon edges in PolygonArea;
+ add full Maxima implementation of geodesic algorithms.
Changes between 1.29 (released 2013-01-16) and 1.28 versions:
* Changes to allow compilation with libc++ (courtesy of Kal Conley).
* Add description of geodesics on triaxial ellipsoid to
documentation.
* Update journal reference for "Algorithms for geodesics".
Changes between 1.28 (released 2012-12-11) and 1.27 versions:
* Changes to geodesic routines:
+ compute longitude difference exactly;
+ hence fix BUG in area calculations for polygons with vertices very
close to the prime meridian;
+ fix BUG is geoddistance.m where the value of m12 was wrong for
meridional geodesics;
+ add Matlab implementations of the geodesic projections;
+ remove unneeded special code for geodesics which start at a pole;
+ include polygon area routine in C and Fortran implementations;
+ add doxygen documentation for C and Fortran libraries.
Changes between 1.27 (released 2012-11-29) and 1.26 versions:
* Changes to geodesic routines:
+ add native Matlab implementations: geoddistance.m, geodreckon.m,
geodarea.m;
+ add C and Fortran implementations;
+ improve the solution of the direct problem so that the series
solution is accurate to round off for |f| < 1/50;
+ tighten up the convergence criteria for solution of the inverse
problem;
+ no longer signal failures of convergence with NaNs (a slightly
less accurate answer is returned instead).
* Fix DMS::Decode double rounding BUG.
* On MacOSX platforms with the cmake configuration, universal
binaries are built.
Changes between 1.26 (released 2012-10-22) and 1.25 versions:
* Replace the series used for geodesic areas by one with better
convergence (this only makes an appreciable difference if |f| >
1/150).
Changes between 1.25 (released 2012-10-16) and 1.24 versions:
* Changes to geodesic calculations:
+ restart Newton's method in Geodesic::Inverse when it goes awry;
+ back up Newton's method with the bisection method;
+ Geodesic::Inverse now converges for any value of f;
+ add GeodesicExact and GeodesicLineExact which are formulated in
terms of elliptic integrals and thus yield accurate results
even for very eccentric ellipsoids.
+ the -E option to Geod invokes these exact classes.
* Add functionality to EllipticFunction:
+ add all the traditional elliptic integrals;
+ remove restrictions on argument range for incomplete elliptic
integrals;
+ allow imaginary modulus for elliptic integrals and elliptic
functions;
+ make interface to the symmetric elliptic integrals public.
* Allow GeographicLib::Ellipsoid to be copied.
* Changes to the build tools:
+ cmake uses folders in Visual Studio to reduce clutter;
+ allow precision of reals to be set in cmake;
+ fail gracefully in the absence of pod documentation tools;
+ remove support for maintainer tasks in Makefile.mk.
Changes between 1.24 (released 2012-09-22) and 1.23 versions:
* Allow the specification of the hemisphere in UTM coordinates in
order to provide continuity across the equator:
+ add UTMUPS::Transfer;
+ add GeoCoords::UTMUPSRepresentation(bool, int) and
GeoCoords::AltUTMUPSRepresentation(bool, int);
+ use the hemisphere letter in, e.g., GeoConvert -u -z 31N.
* Add UTMUPS::DecodeEPSG and UTMUPS::EncodeEPSG.
* cmake changes:
+ restore support for cmake 2.4.x;
+ explicitly check version of doxygen.
* Fix building under cygwin.
* Document restrictions on f in the Introduction.
* Fix python interface to work with version 2.6.x.
Changes between 1.23 (released 2012-07-17) and 1.22 versions:
* Documentation changes:
+ remove html documentation from distribution and use web links if
doxygen is not available;
+ use doxygen tags to document exceptions;
+ begin migrating the documentation to using Greek letters where
appropriate (requires doxygen 1.8.1.2 or later).
* Add Math::AngNormalize and Math::AngNormalize2; the allowed range
for longitudes and azimuths widened to [-540d, 540d).
* DMS::Decode understands more unicode symbols.
* Geohash uses geohash code "nan" to stand for not a number.
* Add Ellipsoid::NormalCurvatureRadius.
* Various fixes in LambertConformalConic, TransverseMercator,
PolarStereographic, and Ellipsoid to handle reverse projections of
points near infinity.
* Fix programming blunder in LambertConformalConic::Forward (incorrect
results were returned if the tangent latitude was negative).
Changes between 1.22 (released 2012-05-27) and 1.21 versions:
* Add Geohash and Ellipsoid classes.
* Fix bug in AlbersEqualArea of very prolate ellipsoids (b^2 > 2
a^2).
* cmake changes:
+ optionally use PACKAGE_PATH and INSTALL_PATH to determine
CMAKE_INSTALL_PREFIX;
+ use COMMON_INSTALL_PATH to determine layout of installation
directories;
+ as a consequence, the installation paths for the documentation,
and python and matlab interfaces are shortened for Windows;
+ zip source distribution now uses DOS line endings;
+ the tests work in debug mode for Windows;
+ default setting of GEOGRAPHICLIB_DATA does not depend on
CMAKE_INSTALL_PREFIX;
+ add a cmake configuration for build tree.
Changes between 1.21 (released 2012-04-25) and 1.20 versions:
* Support colon-separated DMS output:
+ DMS::Encode and GeoCoords::DMSRepresentation generalized;
+ GeoConvert and Geod now accept a -: option.
* GeoidEval does not print the gradient of the geoid height by default
(because it's subject to large errors); give the -g option to get
the gradient printed.
* Work around optimization BUG in GeographicLib::Geodesic::Inverse
with tdm mingw g++ version 4.6.1.
* autoconf fixed to ensure that that out-of-sources builds work;
document this as the preferred method of using autoconf.
* cmake tweaks:
+ simplify the configuration of doxygen;
+ allow the Matlab compiler to be specified with the MATLAB_COMPILER option.
Changes between 1.20 (released 2012-03-23) and 1.19 versions:
* cmake tweaks:
+ improve find_package's matching of compiler versions;
+ CMAKE_INSTALL_PREFIX set from CMAKE_PREFIX_PATH if available;
+ add "x64" to the package name for the 64-bit binary installer;
+ fix cmake warning with Visual Studio Express.
* Fix SphericalEngine to deal with aggessive iterator checking by
Visual Studio.
* Fix transcription BUG is Geodesic.js.
Changes between 1.19 (released 2012-03-13) and 1.18 versions:
* Slight improvement in Geodesic::Inverse for very short lines.
* Fix argument checking tests in MGRS::Forward.
* Add --comment-delimiter and --line-separator options to the utility
programs.
* Add installer for 64-bit Windows; the compiled Matlab interface is
supplied with the Windows 64-bit installer only.
Changes between 1.18 (released 2012-02-18) and 1.17 versions:
* Improve documentation on configuration with cmake.
* cmake's find_package ensures that the compiler versions match on Windows.
* Improve documentation on compiling Matlab interface.
* Binary installer for Windows installs under C:/pkg-vc10 by default.
Changes between 1.17 (released 2012-01-21) and 1.16 versions:
* Work around optimization BUG in Geodesic::Inverse with g++ version
4.4.0 (mingw).
* Fix BUG in argument checking with OSGB::GridReference.
* Fix missing include file in SphericalHarmonic2.
* Add simple examples of usage for each class.
* Add internal documenation to the cmake configuration files.
Changes between 1.16 (released 2011-12-07) and 1.15 versions:
* Add calculation of the earth's gravitational field:
+ add NormalGravity GravityModel and GravityCircle classes;
+ add command line utility Gravity;
+ add Gravity models;
+ add Constants::WGS84_GM(), Constants::WGS84_omega(), and similarly
for GRS80.
* Build uses GEOGRAPHICLIB_DATA to specify a common parent directory
for geoid, gravity, and magnetic data (instead of
GEOGRAPHICLIB_GEOID_PATH, etc.); similarly, GeoidEval, Gravity, and
MagneticField, look at the environment variable GEOGRAPHICLIB_DATA
to locate the data.
* Spherical harmonic software changes:
+ capitalize enums SphericalHarmonic::FULL and
SphericalHarmonic::SCHMIDT (the lower case names are retained but
deprecated);
+ optimize the sum by using a static table of square roots which is
updated by SphericalEngine::RootTable;
+ avoid overflow for high degree models.
* Magnetic software fixes:
+ fix documentation BUG in MagneticModel::Circle;
+ make MagneticModel constructor explicit;
+ provide default MagneticCircle constructor;
+ add additional inspector functions to MagneticCircle;
+ add -c option to MagneticField;
+ default height to zero in MagneticField.
Changes between 1.15 (released 2011-11-08) and 1.14 versions:
* Add calculation of the earth's magnetic field:
+ add MagneticModel and MagneticCircle classes;
+ add command line utility MagneticField;
+ add Magnetic models;
+ add Installing the magnetic field models;
+ add The format of the magnetic model files;
+ add classes SphericalEngine, CircularEngine, SphericalHarmonic,
SphericalHarmonic1, and SphericalHarmonic2. which sum spherical
harmonic series.
* Add Utility class to support I/O and date manipulation.
* Cmake configuration includes a _d suffix on the library built in
debug mode.
* For the Python package, include manifest and readme files; don't
install setup.py for non-Windows systems.
* Include Doxygen tag file in distribution as doc/html/Geographic.tag.
Changes between 1.14 (released 2011-09-30) and 1.13 versions:
* Ensure that geographiclib-config.cmake is relocatable.
* Allow more unicode symbols to be used in DMS::Decode.
* Modify GeoidEval so that it can be used to convert the height datum
for LIDAR data.
* Modest speed-up of Geodesic::Inverse.
* Changes in python interface:
+ FIX BUG in transcription of Geodesic::Inverse;
+ include setup.py for easy installation;
+ python only distribution is available at
http://pypi.python.org/pypi/geographiclib
* Supply a minimal Qt qmake project file for library
src/Geographic.pro.
Changes between 1.13 (released 2011-08-13) and 1.12 versions:
* Changes to I/O:
+ allow : (colon) to be used as a DMS separator in DMS::Decode;
+ also accept Unicode symbols for degrees, minutes, and seconds
(coded as UTF-8);
+ provide optional swaplatlong argument to various DMS and GeoCoords
functions to make longitude precede latitude;
+ GeoConvert now has a -w option to make longitude precede latitude
on input and output;
+ include a JavaScript version of DMS.
* Slight improvement in starting guess for solution of geographic
latitude in terms of conformal latitude in TransverseMercator,
TransverseMercatorExact, and LambertConformalConic.
* For most classes, get rid of const member variables so that the
default copy assignment works.
* Put Math and Accumulator in their own header files.
* Remove unused "fast" GeographicLib::Accumulator method.
* Reorganize the Python interface.
* Withdraw some deprecated routines.
* cmake changes:
+ include FindGeographic.cmake in distribution;
+ building with cmake creates and installs
geographiclib-config.cmake;
+ better support for building a shared library under Windows.
Changes between 1.12 (released 2011-07-21) and 1.11 versions:
* Change license to MIT/X11.
* Add GeographicLib::PolygonArea class and equivalent Matlab function.
* Provide JavaScript and Python implementations of geodesic routines.
* Fix Windows installer to include runtime dlls for Matlab.
* Fix (innocuous) unassigned variable in Geodesic::GenInverse.
* Geodesic routines in Matlab return a12 as first column of aux return
value (incompatible change).
* A couple of code changes to enable compilation with Visual Studio
2003.
Changes between 1.11 (released 2011-06-27) and 1.10 versions:
* Changes to Planimeter:
+ add -l flag to Planimeter for polyline calculations;
+ trim precision of area to 3 decimal places;
+ FIX BUG with pole crossing edges (due to compiler optimization).
* Geod no longer reports the reduced length by default; however the -f
flag still reports this and in addition gives the geodesic scales
and the geodesic area.
* FIX BUGS (compiler-specific) in inverse geodesic calculations.
* FIX BUG: accommodate tellg() returning -1 at end of string.
* Change way flattening of the ellipsoid is specified:
+ constructors take f argument which is taken to be the flattening
if f < 1 and the inverse flattening otherwise (this is a
compatible change for spheres and oblate ellipsoids, but it is an
INCOMPATIBLE change for prolate ellipsoids);
+ the -e arguments to the Utility Programs are handled similarly; in
addition, simple fractions, e.g., 1/297, can be used for the
flattening;
+ introduce Constants::WGS84_f() for the WGS84 flattening (and
deprecate Constants::WGS84_r() for the inverse flattening);
+ most classes have a Flattening() member function;
+ InverseFlattening() has been deprecated (and now returns inf for a
sphere, instead of 0).
Changes between 1.10 (released 2011-06-11) and 1.9 versions:
* Improvements to Matlab/Octave interface:
+ add {geocentric,localcartesian}{forward,reverse};
+ make geographiclibinterface more general;
+ install the source for the interface;
+ cmake compiles the interface if ENABLE_MATLAB=ON;
+ include compiled interface with Windows binary installer.
* Fix various configuration issues
+ autoconf did not install Config.h;
+ cmake installed in man/man1 instead of share/man/man1;
+ cmake did not set the rpath on the tools.
Changes between 1.9 (released 2011-05-28) and 1.8 versions:
* FIX BUG in area returned by Planimeter for pole encircling polygons.
* FIX BUG in error message reported when DMS::Decode reads the string
"5d.".
* FIX BUG in AlbersEqualArea::Reverse (lon0 not being used).
* Ensure that all exceptions thrown in the Utility Programs are
caught.
* Avoid using catch within GeographicLib::DMS.
* Move Accumulator class from Planimeter.cpp to Constants.hpp.
* Add Math::sq<T>.
* Simplify Installing the geoid datasets
+ add geographiclib-get-geoids for Unix-like systems;
+ add installers for Windows.
* Provide cmake support:
+ build binary installer for Windows;
+ include regression tests;
+ add --input-string, --input-file, --output-file options to the
Utility Programs to support tests.
* Rename utility EquidistantTest as GeodesicProj and
TransverseMercatorTest as TransverseMercatorProj.
* Add ConicProj.
* Reverse the initial sense of the -s option for Planimeter.
* Migrate source from subversion to git.
Changes between 1.8 (released 2011-02-22) and 1.7 versions:
* Optionally return rotation matrix from GeographicLib::Geocentric and
GeographicLib::LocalCartesian.
* For the Utility Programs, supply man pages, -h prints the synopsis,
--help prints the man page, --version prints the version.
* Use accurate summation in Planimeter.
* Add 64-bit targets for Visual Studio 2010.
* Use templates for defining math functions and some constants.
* GeographicLib::Geoid updates
+ Add GeographicLib::Geoid::DefaultGeoidPath and
GeographicLib::Geoid::DefaultGeoidName;
+ GeoidEval uses environment variable GEOID_NAME as the default
geoid;
+ Add --msltohae and --haetomsl as GeoidEval options (and don't
document the single hyphen versions).
* Remove documentation that duplicates papers on transverse Mercator
and geodesics.
Changes between 1.7 (released 2010-12-21) and 1.6 versions:
* FIX BUG in scale returned by GeographicLib::LambertConformalConic::Reverse.
* Add GeographicLib::AlbersEqualArea projection.
* Library created by Visual Studio is Geographic.lib instead of
GeographicLib.lib (compatible with makefiles).
* Make classes NaN aware.
* Use cell arrays for MGRS strings in Matlab.
* Add solution/project files for Visual Studio 2010 (32-bit only).
* Use C++11 static_assert and math functions, if available.
Change between 1.6 (released 2010-11-23) and 1.5 versions:
* FIX BUG introduced in GeographicLib::Geoid in version 1.5 (found by
Dave Edwards).
Changes between 1.5 (released 2010-11-19) and 1.4 versions:
* Improve area calculations for small polygons.
* Add -s and -r flags to Planimeter utility.
* Improve the accuracy of GeographicLib::LambertConformalConic using
divided differences.
* FIX BUG in meridian convergence returned by
LambertConformalConic::Forward.
* Add optional threadsafe parameter to GeographicLib::Geoid
constructor. WARNING: This changes may break binary compatibility
with previous versions of GeographicLib. However, the library is
source compatible.
* Add GeographicLib::OSGB.
* Matlab and Octave interfaces to GeographicLib::UTMUPS,
GeographicLib::MGRS, GeographicLib::Geoid, GeographicLib::Geodesic
provided.
* Minor changes
+ explicitly turn on optimization in Visual Studio 2008 projects;
+ add missing dependencies in some Makefiles;
+ move pi() and degree() from GeographicLib::Constants to
GeographicLib::Math;
+ introduce GeographicLib::Math::extended type to aid testing;
+ add GeographicLib::Math::epi() and GeographicLib::Math::edegree().
+ fixes to compile under cygwin;
+ tweak expression used to find latitude from conformal latitude.
Changes between 1.4 (released 2010-09-12) and 1.3 versions:
* Changes to GeographicLib::Geodesic and GeographicLib::GeodesicLine:
+ FIX BUG in Geodesic::Inverse with prolate ellipsoids;
+ add area computations to Geodesic::Direct and Geodesic::Inverse;
+ add geodesic areas to geodesic test set;
+ make GeodesicLine constructor public;
+ change longitude series in Geodesic into Helmert-like form;
+ ensure that equatorial geodesics have cos(alpha0) = 0 identically;
+ generalize interface for Geodesic and GeodesicLine;
+ split GeodesicLine and Geodesic into different files;
+ signal convergence failure in Geodesic::Inverse with NaNs;
+ deprecate one function in Geodesic and two functions in
GeodesicLine;
+ deprecate -n option for Geod.
WARNING: These changes may break binary compatibility with previous
versions of GeographicLib. However, the library is source
compatible (with the proviso that GeographicLib/GeodesicLine.hpp may
now need to be included).
* Add the Planimeter utility for computing the areas of
geodesic polygons.
* Improve iterative solution of GeographicLib::Gnomonic::Reverse.
* Add GeographicLib::Geoid::ConvertHeight.
* Add -msltohae, -haetomsl, and -z options to \ref geoideval.
* Constructors check that minor radius is positive.
* Add overloaded Forward and Reverse functions to the projection
classes which don't return the convergence (or azimuth) and scale.
* Document function parameters and return values consistently.
Changes between 1.3 (released 2010-07-21) and 1.2 versions:
* Add GeographicLib::Gnomonic, the ellipsoid generalization of the
gnomonic projection.
* Add -g and -e options to Equidistanttest.
* Use fixed-point notation for output from Cartconvert,
Equidistanttest, Transversemercatortest.
* PolarStereographic:
+ Improved conversion to conformal coordinates;
+ Fix bug with scale at opposite pole;
+ Complain if latitude out of range in SetScale.
* Add GeographicLib::Math::NaN().
* Add long double version of hypot for Windows.
* Add EllipticFunction::E(real).
* Update references to Geotrans in MGRS documentation.
* Speed up tmseries.mac.
Changes between 1.2 (released 2010-05-21) and 1.1 versions:
* FIX BUGS in GeographicLib::Geodesic,
+ wrong azimuth returned by Direct if point 2 is on a pole;
+ Inverse sometimes fails with very close points.
* Improve calculation of scale in GeographicLib::CassiniSoldner,
+ add GeodesicLine::Scale, GeodesicLine::EquatorialAzimuth, and
GeodesicLine::EquatorialArc;
+ break friend connection between CassiniSoldner and Geodesic.
* Add DMS::DecodeAngle and DMS::DecodeAzimuth. Extend DMS::Decode and
DMS::Encode to deal with distances.
* Code and documentation changes in Geodesic and Geocentric for
consistency with the forthcoming paper on geodesics.
* Increase order of series using in Geodesic to 6 (full accuracy
maintained for ellipsoid flattening < 0.01).
* Macro __NO_LONG_DOUBLE_MATH to disable use of long double.
* Correct declaration of Math::isfinite to return a bool.
* Changes in the Utility Programs,
+ improve error reporting when parsing command line arguments;
+ accept latitudes and longitudes in decimal degrees or degrees,
minutes, and seconds, with optional hemisphere designators;
+ GeoConvert -z accepts zone or zone+hemisphere;
+ GeoidEval accepts any of the input formats used by GeoConvert;
+ CartConvert allows the ellipsoid to be specified with -e.
Changes between 1.1 (released 2010-02-09) and 1.0 versions:
* FIX BUG (introduced in 2009-03) in EllipticFunction::E(sn,cn,dn).
* Increase accuracy of scale calculation in TransverseMercator and
TransverseMercatorExact.
* Code and documentation changes for consistency with arXiv:1002.1417
Changes between 1.0 (released 2010-01-07) and 2009-11 versions:
* Add autoconf configuration files.
* BUG FIX: Improve initial guess for Newton's method in
PolarStereographic::Reverse. (Previously this failed to converge
when the co-latitude exceeded about 130 deg.)
* Constructors for TransverseMercator, TransverseMercatorExact,
PolarStereographic, Geocentric, and Geodesic now check for obvious
problems with their arguments and throw an exception if necessary.
* Most classes now include inspector functions such as MajorRadius()
so that you can determine how instances were constructed.
* Add GeographicLib::LambertConformalConic class.
* Add GeographicLib::PolarStereographic::SetScale to allow the
latitude of true scale to be specified.
* Add solution and project files for Visual Studio 2008.
* Add GeographicLib::GeographicErr for exceptions.
* GeographicLib::Geoid changes:
+ BUG FIX: fix typo in GeographicLib::Geoid::Cache which could cause
a segmentation fault in some cases when the cached area spanned
the prime meridian.
+ Include sufficient edge data to allow heights to be returned for
cached area without disk reads;
+ Add inspector functions to query the extent of the cache.
Changes between 2009-11 and 2009-10 versions:
* Allow specification of "closest UTM zone" in GeographicLib::UTMUPS
and GeoConvert (via -t option).
* Utilities now complain is there are too many tokens on input lines.
* Include real-to-real versions of GeographicLib::DMS::Decode and
GeographicLib::DMS::Encode.
* More house-cleaning changes:
+ Ensure that functions which return results through reference
arguments do not alter the arguments when an exception is thrown.
+ Improve accuracy of GeographicLib::MGRS::Forward.
+ Include more information in some error messages.
+ Improve accuracy of inverse hyperbolic functions.
+ Fix the way GeographicLib::Math functions handle different
precisions.
Changes between 2009-10 and 2009-09 versions:
* Change web site to http://geographiclib.sourceforge.net
* Several house-cleaning changes:
+ Change from the a flat directory structure to a more easily
maintained one.
+ Introduce Math class for common mathematical functions (in
Constants.hpp).
+ Use Math::real as the type for all real quantities. By default this
is typedef'ed to double; and the library should be installed this
way.
+ Eliminate const reference members of AzimuthalEquidistant,
CassiniSoldner and LocalCartesian so that they may be copied.
+ Make several constructors explicit. Disallow some constructors.
Disallow copy constructor/assignment for Geoid.
+ Document least square formulas in Geoid.cpp.
+ Use unsigned long long for files positions of geoid files in Geoid.
+ Introduce optional mgrslimits argument in UTMUPS::Forward and
UTMUPS::Reverse to enforce stricter MGRS limits on eastings and
northings.in
+ Add 64-bit targets in Visual Studio project files.
Changes between 2009-09 and 2009-08 versions:
* Add GeographicLib::Geoid and GeoidEval utility.
Changes between 2009-08 and 2009-07 versions:
* Add GeographicLib::CassiniSoldner class and EquidistantTest utility.
* Fix bug in GeographicLib::Geodesic::Inverse where NaNs were
sometimes returned.
* INCOMPATIBLE CHANGE: AzimuthalEquidistant now returns the reciprocal
of the azimuthal scale instead of the reduced length.
* Add -n option to GeoConvert.
Changes between 2009-07 and 2009-06 versions:
* Speed up the series inversion code in tmseries.mac and geod.mac.
* Reference Borkowski in section on Geocentric coordinates.
Changes between 2009-06 and 2009-05 versions:
* Add routines to decode and encode zone+hemisphere to GeographicLib::UTMUPS.
* Clean up code in GeographicLib::Geodesic.
Changes between 2009-05 and 2009-04 versions:
* Improvements to GeographicLib::Geodesic:
+ more economical series expansions,
+ return reduced length (as does the Geod utility),
+ improved calculation of starting point for inverse method,
+ use reduced length to give derivative for Newton's method.
* Add AzimuthalEquidistant class.
+ Make GeographicLib::Geocentric, GeographicLib::TransverseMercator,
and GeographicLib::PolarStereographic classes work with prolate
ellipsoids.
* CartConvert checks its inputs more carefully.
* Remove reference to defunct Constants.cpp from GeographicLib.vcproj.
Changes between 2009-04 and 2009-03 versions:
* Use compile-time constants to select the order of series in
GeographicLib::TransverseMercator.
* 2x unroll of Clenshaw summation to avoid data shuffling.
* Simplification of GeographicLib::EllipticFunction::E.
* Use STATIC_ASSERT for compile-time checking of constants.
* Improvements to GeographicLib::Geodesic:
+ compile-time option to change order of series used,
+ post maxima code for generating the series,
+ tune the order of series for double,
+ improvements in the selection of starting points for Newton's
method,
+ accept and return spherical arc lengths,
+ works with both oblate and prolate spheroids,
+ add -a, -e, -b options to the Geod utility.
Changes between 2009-03 and 2009-02 versions:
* Add GeographicLib::Geodesic and the Geod utility.
* Declare when no exceptions are thrown by functions.
* Minor changes to GeographicLib::DMS class.
* Use invf = 0 to mean a sphere in constructors to some classes.
* The makefile creates a library and includes an install target.
* Rename GeographicLib::ECEF to GeographicLib::Geocentric, ECEFConvert
to CartConvert.
* Use inline functions to define constant doubles in Constants.hpp.
Changes between 2009-02 and 2009-01 versions:
* Fix documentation of constructors (flattening -> inverse
flattening).
* Use std versions of math functions.
* Add ECEF and LocalCartesian classes and ECEFConvert utility.
* Gather the documentation on the utility programs onto one page.

1018
gtsam/3rdparty/GeographicLib/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,52 @@
# config file support for find_package (GeographicLib). This needs to
# deal with two environments: (1) finding the build tree and (2)
# finding the install tree. geographiclib-config.cmake detects which
# situation it is handing by looking at @PROJECT_ROOT_DIR@. If
# this is an absolute path, it's in the build tree; otherwise, it's in the
# install tree. (Note that the whole install tree can be relocated.)
# geographiclib-config.cmake for the build tree
set (PROJECT_ROOT_DIR "${PROJECT_BINARY_DIR}")
set (PROJECT_INCLUDE_DIRS
"${PROJECT_BINARY_DIR}/include" "${PROJECT_SOURCE_DIR}/include" )
configure_file (project-config.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake" @ONLY)
configure_file (project-config-version.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" @ONLY)
export (TARGETS ${PROJECT_SHARED_LIBRARIES} ${PROJECT_STATIC_LIBRARIES} ${TOOLS}
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-depends.cmake")
# geographiclib-config.cmake for the install tree. It's installed in
# ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative
# path to the root from there. (Note that the whole install tree can
# be relocated.)
if (COMMON_INSTALL_PATH)
set (INSTALL_CMAKE_DIR "share/cmake/${PROJECT_NAME}")
set (PROJECT_ROOT_DIR "../../..")
else ()
set (INSTALL_CMAKE_DIR "cmake")
set (PROJECT_ROOT_DIR "..")
endif ()
# @PROJECT_INCLUDE_DIRS@ is not used in the install tree; reset
# it to prevent the source and build paths appearing in the installed
# config files
set (PROJECT_INCLUDE_DIRS)
configure_file (project-config.cmake.in
${PROJECT_NAME_LOWER}-config.cmake @ONLY)
configure_file (project-config-version.cmake.in
${PROJECT_NAME_LOWER}-config-version.cmake @ONLY)
install (FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}")
# Make information about the cmake targets (the library and the tools)
# available.
install (EXPORT depends
FILE ${PROJECT_NAME_LOWER}-depends.cmake
DESTINATION "${INSTALL_CMAKE_DIR}")
if (MSVC AND PACKAGE_DEBUG_LIBS)
install (FILES
"${PROJECT_BINARY_DIR}/cmake/CMakeFiles/Export/cmake/${PROJECT_NAME_LOWER}-depends-debug.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}" CONFIGURATIONS Release)
endif ()

View File

@ -0,0 +1,31 @@
# Look for GeographicLib
#
# Set
# GEOGRAPHICLIB_FOUND = TRUE
# GeographicLib_INCLUDE_DIRS = /usr/local/include
# GeographicLib_LIBRARIES = /usr/local/lib/libGeographic.so
# GeographicLib_LIBRARY_DIRS = /usr/local/lib
find_library (GeographicLib_LIBRARIES Geographic
PATHS "${CMAKE_INSTALL_PREFIX}/../GeographicLib/lib")
if (GeographicLib_LIBRARIES)
get_filename_component (GeographicLib_LIBRARY_DIRS
"${GeographicLib_LIBRARIES}" PATH)
get_filename_component (_ROOT_DIR "${GeographicLib_LIBRARY_DIRS}" PATH)
set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include")
set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin")
unset (_ROOT_DIR)
if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h")
unset (GeographicLib_INCLUDE_DIRS)
unset (GeographicLib_LIBRARIES)
unset (GeographicLib_LIBRARY_DIRS)
unset (GeographicLib_BINARY_DIRS)
endif ()
endif ()
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (GeographicLib DEFAULT_MSG
GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES GeographicLib_INCLUDE_DIRS)
mark_as_advanced (GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES
GeographicLib_INCLUDE_DIRS)

View File

@ -0,0 +1,14 @@
#
# Makefile.am
#
# Copyright (C) 2011, Charles Karney <charles@karney.com>
cmakedir=$(datadir)/cmake/GeographicLib
install:
$(INSTALL) -d $(DESTDIR)$(cmakedir)
$(INSTALL) -m 644 $(srcdir)/FindGeographicLib.cmake \
$(DESTDIR)$(cmakedir)
EXTRA_DIST = Makefile.mk CMakeLists.txt FindGeographicLib.cmake \
project-config-version.cmake.in project-config.cmake.in

View File

@ -0,0 +1,415 @@
# Makefile.in generated by automake 1.12.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
#
# Makefile.am
#
# Copyright (C) 2011, Charles Karney <charles@karney.com>
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = cmake
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COL = @COL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@
GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@
GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_REVISION = @LT_REVISION@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POD2HTML = @POD2HTML@
POD2MAN = @POD2MAN@
POW_LIB = @POW_LIB@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
cmakedir = $(datadir)/cmake/GeographicLib
EXTRA_DIST = Makefile.mk CMakeLists.txt FindGeographicLib.cmake \
project-config-version.cmake.in project-config.cmake.in
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cmake/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu cmake/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
install:
$(INSTALL) -d $(DESTDIR)$(cmakedir)
$(INSTALL) -m 644 $(srcdir)/FindGeographicLib.cmake \
$(DESTDIR)$(cmakedir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,13 @@
DEST = $(PREFIX)/share/cmake/GeographicLib
INSTALL=install -b
all:
@:
install:
test -d $(DEST) || mkdir -p $(DEST)
$(INSTALL) -m 644 FindGeographicLib.cmake $(DEST)
clean:
@:
.PHONY: all install clean

View File

@ -0,0 +1,54 @@
# Version checking for @PROJECT_NAME@
set (PACKAGE_VERSION "@PROJECT_VERSION@")
set (PACKAGE_VERSION_MAJOR "@PROJECT_VERSION_MAJOR@")
set (PACKAGE_VERSION_MINOR "@PROJECT_VERSION_MINOR@")
set (PACKAGE_VERSION_PATCH "@PROJECT_VERSION_PATCH@")
if (NOT PACKAGE_FIND_NAME STREQUAL "@PROJECT_NAME@")
# Check package name (in particular, because of the way cmake finds
# package config files, the capitalization could easily be "wrong").
# This is necessary to ensure that the automatically generated
# variables, e.g., <package>_FOUND, are consistently spelled. Make
# this a WARNING, because this is a user error that needs to be fixed.
message (WARNING
"Mismatched package names: use find_package(@PROJECT_NAME@ ...) instead"
" of find_package(${PACKAGE_FIND_NAME} ...)")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (NOT (APPLE OR CMAKE_SIZEOF_VOID_P EQUAL @CMAKE_SIZEOF_VOID_P@))
# Reject if there's a 32-bit/64-bit mismatch (not necessary with Apple
# since a multi-architecture library is built for that platform).
message (STATUS
"${CMAKE_CURRENT_LIST_FILE} unsuitable because package built with "
"sizeof(*void) = @CMAKE_SIZEOF_VOID_P@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (MSVC AND NOT MSVC_VERSION STREQUAL "@MSVC_VERSION@")
# Reject if there's a mismatch in MSVC compiler versions
message (STATUS
"${CMAKE_CURRENT_LIST_FILE} unsuitable because package built with "
"_MSC_VER = @MSVC_VERSION@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (PACKAGE_FIND_VERSION)
if (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set (PACKAGE_VERSION_EXACT TRUE)
elseif (PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION
AND PACKAGE_FIND_VERSION_MAJOR EQUAL PACKAGE_VERSION_MAJOR)
set (PACKAGE_VERSION_COMPATIBLE TRUE)
endif ()
endif ()
set (@PROJECT_NAME@_SHARED_FOUND @GEOGRAPHICLIB_SHARED_LIB@)
set (@PROJECT_NAME@_STATIC_FOUND @GEOGRAPHICLIB_STATIC_LIB@)
set (@PROJECT_NAME@_NETGeographicLib_FOUND @BUILD_NETGEOGRAPHICLIB@)
# Check for the components requested. The convention is that
# GeographicLib_${comp}_FOUND should be true for all the required
# components.
if (@PROJECT_NAME@_FIND_COMPONENTS)
foreach (comp ${@PROJECT_NAME@_FIND_COMPONENTS})
if (@PROJECT_NAME@_FIND_REQUIRED_${comp} AND
NOT @PROJECT_NAME@_${comp}_FOUND)
set (PACKAGE_VERSION_UNSUITABLE TRUE)
endif ()
endforeach ()
endif ()

View File

@ -0,0 +1,82 @@
# Configure @PROJECT_NAME@
#
# Set
# @PROJECT_NAME@_FOUND = @PROJECT_NAME_UPPER@_FOUND = 1
# @PROJECT_NAME@_INCLUDE_DIRS = /usr/local/include
# @PROJECT_NAME@_SHARED_LIBRARIES = GeographicLib (or empty)
# @PROJECT_NAME@_STATIC_LIBRARIES = GeographicLib_STATIC (or empty)
# @PROJECT_NAME@_SHARED_DEFINITIONS = GEOGRAPHICLIB_SHARED_LIB=1
# @PROJECT_NAME@_STATIC_DEFINITIONS = GEOGRAPHICLIB_SHARED_LIB=0
# @PROJECT_NAME@_LIBRARY_DIRS = /usr/local/lib
# @PROJECT_NAME@_BINARY_DIRS = /usr/local/bin
# @PROJECT_NAME@_VERSION = 1.9 (for example)
# Depending on @PROJECT_NAME@_USE_STATIC_LIBS
# @PROJECT_NAME@_LIBRARIES = ${@PROJECT_NAME@_SHARED_LIBRARIES}, if OFF
# @PROJECT_NAME@_LIBRARIES = ${@PROJECT_NAME@_STATIC_LIBRARIES}, if ON
# @PROJECT_NAME@_DEFINITIONS = ${@PROJECT_NAME@_SHARED_DEFINITIONS}, if OFF
# @PROJECT_NAME@_DEFINITIONS = ${@PROJECT_NAME@_STATIC_DEFINITIONS}, if ON
# If only one of the libraries is provided, then
# @PROJECT_NAME@_USE_STATIC_LIBS is ignored.
message (STATUS "Reading ${CMAKE_CURRENT_LIST_FILE}")
set (@PROJECT_NAME@_VERSION "@PROJECT_VERSION@")
message (STATUS
"@PROJECT_NAME@ configuration, version ${@PROJECT_NAME@_VERSION}")
# Tell the user project where to find our headers and libraries
get_filename_component (_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
if (IS_ABSOLUTE "@PROJECT_ROOT_DIR@")
# This is an uninstalled package (still in the build tree)
set (_ROOT "@PROJECT_ROOT_DIR@")
set (@PROJECT_NAME@_INCLUDE_DIRS "@PROJECT_INCLUDE_DIRS@")
set (@PROJECT_NAME@_LIBRARY_DIRS "${_ROOT}/src")
set (@PROJECT_NAME@_BINARY_DIRS "${_ROOT}/src")
else ()
# This is an installed package; figure out the paths relative to the
# current directory.
get_filename_component (_ROOT "${_DIR}/@PROJECT_ROOT_DIR@" ABSOLUTE)
set (@PROJECT_NAME@_INCLUDE_DIRS "${_ROOT}/include")
set (@PROJECT_NAME@_LIBRARY_DIRS "${_ROOT}/lib")
set (@PROJECT_NAME@_BINARY_DIRS "${_ROOT}/bin")
endif ()
message (STATUS " include directory: \${@PROJECT_NAME@_INCLUDE_DIRS}")
set (@PROJECT_NAME@_SHARED_LIBRARIES @PROJECT_SHARED_LIBRARIES@)
set (@PROJECT_NAME@_STATIC_LIBRARIES @PROJECT_STATIC_LIBRARIES@)
set (@PROJECT_NAME@_SHARED_DEFINITIONS @PROJECT_SHARED_DEFINITIONS@)
set (@PROJECT_NAME@_STATIC_DEFINITIONS @PROJECT_STATIC_DEFINITIONS@)
# Read in the exported definition of the library
include ("${_DIR}/@PROJECT_NAME_LOWER@-depends.cmake")
if ((NOT @PROJECT_NAME@_SHARED_LIBRARIES) OR
(@PROJECT_NAME@_USE_STATIC_LIBS AND @PROJECT_NAME@_STATIC_LIBRARIES))
set (@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_STATIC_LIBRARIES})
set (@PROJECT_NAME@_DEFINITIONS ${@PROJECT_NAME@_STATIC_DEFINITIONS})
message (STATUS " \${@PROJECT_NAME@_LIBRARIES} set to static library")
else ()
set (@PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_SHARED_LIBRARIES})
set (@PROJECT_NAME@_DEFINITIONS ${@PROJECT_NAME@_SHARED_DEFINITIONS})
message (STATUS " \${@PROJECT_NAME@_LIBRARIES} set to shared library")
endif ()
set (@PROJECT_NAME@_NETGeographicLib_LIBRARIES @NETGEOGRAPHICLIB_LIBRARIES@)
# Check for the components requested. This only supports components
# STATIC, SHARED, and NETGeographicLib by checking the value of
# @PROJECT_NAME@_${comp}_LIBRARIES. No need to check if the component
# is required or not--the version file took care of that.
# @PROJECT_NAME@_${comp}_FOUND is set appropriately for each component.
if (@PROJECT_NAME@_FIND_COMPONENTS)
foreach (comp ${@PROJECT_NAME@_FIND_COMPONENTS})
if (@PROJECT_NAME@_${comp}_LIBRARIES)
set (@PROJECT_NAME@_${comp}_FOUND 1)
message (STATUS "@PROJECT_NAME@ component ${comp} found")
else ()
set (@PROJECT_NAME@_${comp}_FOUND 0)
message (WARNING "@PROJECT_NAME@ component ${comp} not found")
endif ()
endforeach ()
endif ()
# @PROJECT_NAME@_FOUND is set to 1 automatically
set (@PROJECT_NAME_UPPER@_FOUND 1) # for backwards compatibility

1530
gtsam/3rdparty/GeographicLib/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1782
gtsam/3rdparty/GeographicLib/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

18780
gtsam/3rdparty/GeographicLib/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
dnl
dnl Copyright (C) 2009, Francesco P. Lovergine <frankie@debian.org>
AC_INIT([GeographicLib],[1.34],[charles@karney.com])
AC_CANONICAL_SYSTEM
AC_PREREQ(2.61)
AC_CONFIG_SRCDIR(src/Geodesic.cpp)
AC_CONFIG_MACRO_DIR(m4)
AM_INIT_AUTOMAKE
GEOGRAPHICLIB_VERSION_MAJOR=1
GEOGRAPHICLIB_VERSION_MINOR=34
GEOGRAPHICLIB_VERSION_PATCH=0
AC_DEFINE_UNQUOTED([GEOGRAPHICLIB_VERSION_MAJOR],
[$GEOGRAPHICLIB_VERSION_MAJOR],[major version number])
AC_DEFINE_UNQUOTED([GEOGRAPHICLIB_VERSION_MINOR],
[$GEOGRAPHICLIB_VERSION_MINOR],[minor version number])
AC_DEFINE_UNQUOTED([GEOGRAPHICLIB_VERSION_PATCH],
[$GEOGRAPHICLIB_VERSION_PATCH],[patch number])
AC_SUBST(GEOGRAPHICLIB_VERSION_MAJOR)
AC_SUBST(GEOGRAPHICLIB_VERSION_MINOR)
AC_SUBST(GEOGRAPHICLIB_VERSION_PATCH)
dnl
dnl This directive is deprecated by someone, but I prefer to avoid
dnl running autotools if not required explicitly. The reason is
dnl the need to be in sync with autoconf/automake.
dnl
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS(include/GeographicLib/Config-ac.h)
dnl Library code modified: REVISION++
dnl Interfaces changed/added/removed: CURRENT++ REVISION=0
dnl Interfaces added: AGE++
dnl Interfaces removed: AGE=0
LT_CURRENT=11
LT_REVISION=1
LT_AGE=1
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_ARG_PROGRAM
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_CXX
AC_PROG_LIBTOOL
# Checks for header files.
AC_CHECK_HEADERS([float.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_LONG_DOUBLE
# Checks for library functions.
AC_FUNC_STRTOD
AC_CHECK_FUNCS([strtol])
AC_SEARCH_LIBS([floor],[m])
AC_SEARCH_LIBS([pow],[m])
AC_SEARCH_LIBS([sqrt],[m])
# Check endianness
AC_C_BIGENDIAN
# Check for doxygen.
# Need version 1.8.1.2 or later for greek and math symbols.
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AM_CONDITIONAL([HAVE_DOXYGEN],
[test "$DOXYGEN" && test `"$DOXYGEN" --version |
sed 's/^\([[0-9]]\)\.\([[0-9]]\)\./\1.0\2./'` '>' 1.08.1.1])
AC_CHECK_PROGS([POD2MAN], [pod2man])
AC_CHECK_PROGS([POD2HTML], [pod2html])
AC_CHECK_PROGS([COL], [col])
AM_CONDITIONAL([HAVE_PODPROGS], [test "$POD2MAN" -a "$POD2HTML" -a "$COL"])
dnl
dnl Add here new file to be generated
dnl
AC_CONFIG_FILES([
Makefile
src/Makefile
include/Makefile
tools/Makefile
doc/Makefile
man/Makefile
matlab/Makefile
python/Makefile
cmake/Makefile
examples/Makefile
])
AC_OUTPUT

707
gtsam/3rdparty/GeographicLib/depcomp vendored Executable file
View File

@ -0,0 +1,707 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2012-03-27.16; # UTC
# Copyright (C) 1999-2012 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# A tabulation character.
tab=' '
# A newline character.
nl='
'
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' "$nl" < "$tmpdepfile" |
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependent.h'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
# However on
# $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\':
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
# tcc 0.9.26 (FIXME still under development at the moment of writing)
# will emit a similar output, but also prepend the continuation lines
# with horizontal tabulation characters.
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form 'foo.o: dependent.h',
# or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
< "$tmpdepfile" > "$depfile"
sed '
s/[ '"$tab"'][ '"$tab"']*/ /g
s/^ *//
s/ *\\*$//
s/^[^:]*: *//
/^$/d
/:$/d
s/$/ :/
' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test "$stat" = 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' "$nl" < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -0,0 +1,83 @@
# Where the html versions of the man pages (extension .1.html) are
# found.
set (MANDIR ${PROJECT_BINARY_DIR}/man)
# Build up a list of the .1.html files.
set (HTMLMAN)
foreach (TOOL ${TOOLS})
set (HTMLMAN ${HTMLMAN} ${MANDIR}/${TOOL}.1.html)
endforeach ()
if (COMMON_INSTALL_PATH)
set (INSTALL_DOC_DIR "share/doc/GeographicLib")
else ()
set (INSTALL_DOC_DIR "doc")
endif ()
# Run doxygen, if available
# First assemble a list of all the files the documentation uses. Add a
# dependency on htmlman (from man/CMakeLists.txt). Use html/index.html
# as the make target. To make this target, copy the non-doxygen
# generated files into html/. Run doxfile.in thru cmake's config
# process so that absolute path names are used and so that the pathnames
# are properly stripped by doxygen (via STRIP_FROM_PATH). The
# distrib-doc target copies the html directory into the source tree.
# If doxygen is not available, only the install step (from the source
# tree) is done.
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html-stage)
if (DOXYGEN_FOUND)
configure_file (doxyfile.in doxyfile)
configure_file (doxyfile-c.in doxyfile-c)
configure_file (doxyfile-for.in doxyfile-for)
configure_file (doxyfile-net.in doxyfile-net)
file (GLOB SOURCES
../src/[A-Za-z]*.cpp ../include/GeographicLib/[A-Za-z]*.hpp
../tools/[A-Za-z]*.cpp ../examples/[A-Za-z]*.cpp
../legacy/C/*.[ch] ../legacy/Fortran/*.for ../legacy/Fortran/*.inc
../dotnet/NETGeographicLib/*.cpp ../dotnet/NETGeographicLib/*.h
../dotnet/examples/CS/*.cs ../dotnet/examples/ManagedCPP/*.cpp
../dotnet/examples/VB/*.vb)
file (GLOB EXTRA_FILES ../maxima/[A-Za-z]*.mac
tmseries30.html geodseries30.html ../LICENSE.txt)
file (GLOB FIGURES *.png)
file (COPY ${EXTRA_FILES} DESTINATION html-stage)
add_custom_target (doc ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
add_dependencies (doc htmlman)
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxyfile
${CMAKE_CURRENT_BINARY_DIR}/doxyfile-c
${CMAKE_CURRENT_BINARY_DIR}/doxyfile-for
${CMAKE_CURRENT_BINARY_DIR}/doxyfile-net
GeographicLib.dox geodesic-c.dox geodesic-for.dox NETGeographicLib.dox
${SOURCES} ${EXTRA_FILES} ${FIGURES} ${HTMLMAN}
COMMAND ${CMAKE_COMMAND} -E remove_directory html
COMMAND ${CMAKE_COMMAND} -E copy_directory html-stage html
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile > doxygen.log
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile-c > doxygen-c.log
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile-for > doxygen-for.log
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile-net > doxygen-net.log
COMMENT "Generating html documentation tree")
install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
DESTINATION ${INSTALL_DOC_DIR})
else ()
file (COPY ../LICENSE.txt DESTINATION html)
# Need to absolute path on destination to support old versions of cmake
configure_file (index.html.in html/index.html)
configure_file (utilities.html.in html/utilities.html)
install (FILES
${CMAKE_CURRENT_BINARY_DIR}/html/LICENSE.txt
${CMAKE_CURRENT_BINARY_DIR}/html/index.html
${CMAKE_CURRENT_BINARY_DIR}/html/utilities.html
DESTINATION ${INSTALL_DOC_DIR}/html)
endif ()
# Finally install the JavaScript files
file (GLOB SCRIPTDRIVERS scripts/[A-Za-z]*.html)
file (GLOB JSSCRIPTS scripts/GeographicLib/[A-Za-z]*.js)
install (FILES ${SCRIPTDRIVERS} DESTINATION ${INSTALL_DOC_DIR}/scripts)
install (FILES ${JSSCRIPTS}
DESTINATION ${INSTALL_DOC_DIR}/scripts/GeographicLib)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,160 @@
EXTRAFILES = $(srcdir)/tmseries30.html $(srcdir)/geodseries30.html
FIGURES = $(srcdir)/gauss-krueger-graticule.png \
$(srcdir)/thompson-tm-graticule.png \
$(srcdir)/gauss-krueger-convergence-scale.png \
$(srcdir)/gauss-schreiber-graticule-a.png \
$(srcdir)/gauss-krueger-graticule-a.png \
$(srcdir)/thompson-tm-graticule-a.png \
$(srcdir)/gauss-krueger-error.png \
$(srcdir)/meridian-measures.png
SCRIPTDRIVERS = \
$(srcdir)/scripts/geod-calc.html \
$(srcdir)/scripts/geod-google.html \
$(srcdir)/scripts/geod-google-instructions.html
JSSCRIPTS = \
$(srcdir)/scripts/GeographicLib/Math.js \
$(srcdir)/scripts/GeographicLib/Geodesic.js \
$(srcdir)/scripts/GeographicLib/GeodesicLine.js \
$(srcdir)/scripts/GeographicLib/PolygonArea.js \
$(srcdir)/scripts/GeographicLib/DMS.js \
$(srcdir)/scripts/GeographicLib/Interface.js
HPPFILES = \
$(top_srcdir)/include/GeographicLib/Accumulator.hpp \
$(top_srcdir)/include/GeographicLib/AlbersEqualArea.hpp \
$(top_srcdir)/include/GeographicLib/AzimuthalEquidistant.hpp \
$(top_srcdir)/include/GeographicLib/CassiniSoldner.hpp \
$(top_srcdir)/include/GeographicLib/Constants.hpp \
$(top_srcdir)/include/GeographicLib/DMS.hpp \
$(top_srcdir)/include/GeographicLib/Ellipsoid.hpp \
$(top_srcdir)/include/GeographicLib/EllipticFunction.hpp \
$(top_srcdir)/include/GeographicLib/Geocentric.hpp \
$(top_srcdir)/include/GeographicLib/GeoCoords.hpp \
$(top_srcdir)/include/GeographicLib/Geodesic.hpp \
$(top_srcdir)/include/GeographicLib/GeodesicExact.hpp \
$(top_srcdir)/include/GeographicLib/GeodesicLine.hpp \
$(top_srcdir)/include/GeographicLib/GeodesicLineExact.hpp \
$(top_srcdir)/include/GeographicLib/Geohash.hpp \
$(top_srcdir)/include/GeographicLib/Geoid.hpp \
$(top_srcdir)/include/GeographicLib/Gnomonic.hpp \
$(top_srcdir)/include/GeographicLib/LambertConformalConic.hpp \
$(top_srcdir)/include/GeographicLib/LocalCartesian.hpp \
$(top_srcdir)/include/GeographicLib/Math.hpp \
$(top_srcdir)/include/GeographicLib/MGRS.hpp \
$(top_srcdir)/include/GeographicLib/OSGB.hpp \
$(top_srcdir)/include/GeographicLib/PolarStereographic.hpp \
$(top_srcdir)/include/GeographicLib/PolygonArea.hpp \
$(top_srcdir)/include/GeographicLib/TransverseMercatorExact.hpp \
$(top_srcdir)/include/GeographicLib/TransverseMercator.hpp \
$(top_srcdir)/include/GeographicLib/UTMUPS.hpp
ALLSOURCES = \
$(top_srcdir)/src/AlbersEqualArea.cpp \
$(top_srcdir)/src/AzimuthalEquidistant.cpp \
$(top_srcdir)/src/CassiniSoldner.cpp \
$(top_srcdir)/src/DMS.cpp \
$(top_srcdir)/src/Ellipsoid.cpp \
$(top_srcdir)/src/EllipticFunction.cpp \
$(top_srcdir)/src/Geocentric.cpp \
$(top_srcdir)/src/GeoCoords.cpp \
$(top_srcdir)/src/Geodesic.cpp \
$(top_srcdir)/src/GeodesicLine.cpp \
$(top_srcdir)/src/Geohash.cpp \
$(top_srcdir)/src/Geoid.cpp \
$(top_srcdir)/src/Gnomonic.cpp \
$(top_srcdir)/src/LambertConformalConic.cpp \
$(top_srcdir)/src/LocalCartesian.cpp \
$(top_srcdir)/src/MGRS.cpp \
$(top_srcdir)/src/OSGB.cpp \
$(top_srcdir)/src/PolarStereographic.cpp \
$(top_srcdir)/src/PolygonArea.cpp \
$(top_srcdir)/src/TransverseMercator.cpp \
$(top_srcdir)/src/TransverseMercatorExact.cpp \
$(top_srcdir)/src/UTMUPS.cpp \
$(top_srcdir)/tools/CartConvert.cpp \
$(top_srcdir)/tools/ConicProj.cpp \
$(top_srcdir)/tools/GeodesicProj.cpp \
$(top_srcdir)/tools/GeoConvert.cpp \
$(top_srcdir)/tools/GeodSolve.cpp \
$(top_srcdir)/tools/GeoidEval.cpp \
$(top_srcdir)/tools/Gravity.cpp \
$(top_srcdir)/tools/Planimeter.cpp \
$(top_srcdir)/tools/TransverseMercatorProj.cpp
MANPAGES = \
../man/CartConvert.1.html \
../man/ConicProj.1.html \
../man/GeodesicProj.1.html \
../man/GeoConvert.1.html \
../man/GeodSolve.1.html \
../man/GeoidEval.1.html \
../man/Gravity.1.html \
../man/MagneticField.1.html \
../man/Planimeter.1.html \
../man/TransverseMercatorProj.1.html
LEGACYFILES = \
$(top_srcdir)/legacy/C/geodesic.c \
$(top_srcdir)/legacy/C/geodesic.h \
$(top_srcdir)/legacy/C/direct.c \
$(top_srcdir)/legacy/C/inverse.c \
$(top_srcdir)/legacy/C/planimeter.c \
$(top_srcdir)/legacy/Fortran/geodesic.for \
$(top_srcdir)/legacy/Fortran/geodesic.inc \
$(top_srcdir)/legacy/Fortran/geoddirect.for \
$(top_srcdir)/legacy/Fortran/geodinverse.for \
$(top_srcdir)/legacy/Fortran/planimeter.for
doc: html/index.html
if HAVE_DOXYGEN
manpages: $(MANPAGES)
if test -d html; then rm -rf html/*; else mkdir html; fi
cp $^ html/
touch $@
html/index.html: manpages doxyfile.in GeographicLib.dox \
$(HPPFILES) $(ALLSOURCES) $(EXTRAFILES) $(FIGURES) \
doxyfile-c.in geodesic-c.dox doxyfile-for.in geodesic-for.dox \
$(LEGACYFILES)
cp -p $(EXTRAFILES) $(top_srcdir)/maxima/*.mac \
$(top_srcdir)/LICENSE.txt html/
sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \
-e "s%@PROJECT_VERSION@%$(VERSION)%g" \
$(srcdir)/doxyfile.in | $(DOXYGEN) -
sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \
-e "s%@PROJECT_VERSION@%$(VERSION)%g" \
$(srcdir)/doxyfile-c.in | $(DOXYGEN) -
sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \
-e "s%@PROJECT_VERSION@%$(VERSION)%g" \
$(srcdir)/doxyfile-for.in | $(DOXYGEN) -
else
html/index.html: index.html.in utilities.html.in
if test -d html; then rm -rf html/*; else mkdir html; fi
cp $(top_srcdir)/LICENSE.txt html/
sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
$(srcdir)/utilities.html.in > html/utilities.html
sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
$(srcdir)/index.html.in > html/index.html
endif
maintainer-clean-local:
rm -rf html manpages
install-doc: html/index.html
$(INSTALL) -d $(DESTDIR)$(docdir)/html
$(INSTALL) -m 644 `dirname $<`/*.* $(DESTDIR)$(docdir)/html
-test -f `dirname $<`/C/index.html && \
$(INSTALL) -d $(DESTDIR)$(docdir)/html/C && \
$(INSTALL) -m 644 `dirname $<`/C/*.* $(DESTDIR)$(docdir)/html/C
-test -f `dirname $<`/Fortran/index.html && \
$(INSTALL) -d $(DESTDIR)$(docdir)/html/Fortran && \
$(INSTALL) -m 644 `dirname $<`/Fortran/*.* \
$(DESTDIR)$(docdir)/html/Fortran
$(INSTALL) -d $(DESTDIR)$(docdir)/scripts
$(INSTALL) -m 644 $(SCRIPTDRIVERS) $(DESTDIR)$(docdir)/scripts
$(INSTALL) -d $(DESTDIR)$(docdir)/scripts/GeographicLib
$(INSTALL) -m 644 $(JSSCRIPTS) $(DESTDIR)$(docdir)/scripts/GeographicLib

View File

@ -0,0 +1,561 @@
# Makefile.in generated by automake 1.12.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
COL = @COL@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GEOGRAPHICLIB_VERSION_MAJOR = @GEOGRAPHICLIB_VERSION_MAJOR@
GEOGRAPHICLIB_VERSION_MINOR = @GEOGRAPHICLIB_VERSION_MINOR@
GEOGRAPHICLIB_VERSION_PATCH = @GEOGRAPHICLIB_VERSION_PATCH@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_REVISION = @LT_REVISION@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POD2HTML = @POD2HTML@
POD2MAN = @POD2MAN@
POW_LIB = @POW_LIB@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRAFILES = $(srcdir)/tmseries30.html $(srcdir)/geodseries30.html
FIGURES = $(srcdir)/gauss-krueger-graticule.png \
$(srcdir)/thompson-tm-graticule.png \
$(srcdir)/gauss-krueger-convergence-scale.png \
$(srcdir)/gauss-schreiber-graticule-a.png \
$(srcdir)/gauss-krueger-graticule-a.png \
$(srcdir)/thompson-tm-graticule-a.png \
$(srcdir)/gauss-krueger-error.png \
$(srcdir)/meridian-measures.png
SCRIPTDRIVERS = \
$(srcdir)/scripts/geod-calc.html \
$(srcdir)/scripts/geod-google.html \
$(srcdir)/scripts/geod-google-instructions.html
JSSCRIPTS = \
$(srcdir)/scripts/GeographicLib/Math.js \
$(srcdir)/scripts/GeographicLib/Geodesic.js \
$(srcdir)/scripts/GeographicLib/GeodesicLine.js \
$(srcdir)/scripts/GeographicLib/PolygonArea.js \
$(srcdir)/scripts/GeographicLib/DMS.js \
$(srcdir)/scripts/GeographicLib/Interface.js
HPPFILES = \
$(top_srcdir)/include/GeographicLib/Accumulator.hpp \
$(top_srcdir)/include/GeographicLib/AlbersEqualArea.hpp \
$(top_srcdir)/include/GeographicLib/AzimuthalEquidistant.hpp \
$(top_srcdir)/include/GeographicLib/CassiniSoldner.hpp \
$(top_srcdir)/include/GeographicLib/Constants.hpp \
$(top_srcdir)/include/GeographicLib/DMS.hpp \
$(top_srcdir)/include/GeographicLib/Ellipsoid.hpp \
$(top_srcdir)/include/GeographicLib/EllipticFunction.hpp \
$(top_srcdir)/include/GeographicLib/Geocentric.hpp \
$(top_srcdir)/include/GeographicLib/GeoCoords.hpp \
$(top_srcdir)/include/GeographicLib/Geodesic.hpp \
$(top_srcdir)/include/GeographicLib/GeodesicExact.hpp \
$(top_srcdir)/include/GeographicLib/GeodesicLine.hpp \
$(top_srcdir)/include/GeographicLib/GeodesicLineExact.hpp \
$(top_srcdir)/include/GeographicLib/Geohash.hpp \
$(top_srcdir)/include/GeographicLib/Geoid.hpp \
$(top_srcdir)/include/GeographicLib/Gnomonic.hpp \
$(top_srcdir)/include/GeographicLib/LambertConformalConic.hpp \
$(top_srcdir)/include/GeographicLib/LocalCartesian.hpp \
$(top_srcdir)/include/GeographicLib/Math.hpp \
$(top_srcdir)/include/GeographicLib/MGRS.hpp \
$(top_srcdir)/include/GeographicLib/OSGB.hpp \
$(top_srcdir)/include/GeographicLib/PolarStereographic.hpp \
$(top_srcdir)/include/GeographicLib/PolygonArea.hpp \
$(top_srcdir)/include/GeographicLib/TransverseMercatorExact.hpp \
$(top_srcdir)/include/GeographicLib/TransverseMercator.hpp \
$(top_srcdir)/include/GeographicLib/UTMUPS.hpp
ALLSOURCES = \
$(top_srcdir)/src/AlbersEqualArea.cpp \
$(top_srcdir)/src/AzimuthalEquidistant.cpp \
$(top_srcdir)/src/CassiniSoldner.cpp \
$(top_srcdir)/src/DMS.cpp \
$(top_srcdir)/src/Ellipsoid.cpp \
$(top_srcdir)/src/EllipticFunction.cpp \
$(top_srcdir)/src/Geocentric.cpp \
$(top_srcdir)/src/GeoCoords.cpp \
$(top_srcdir)/src/Geodesic.cpp \
$(top_srcdir)/src/GeodesicLine.cpp \
$(top_srcdir)/src/Geohash.cpp \
$(top_srcdir)/src/Geoid.cpp \
$(top_srcdir)/src/Gnomonic.cpp \
$(top_srcdir)/src/LambertConformalConic.cpp \
$(top_srcdir)/src/LocalCartesian.cpp \
$(top_srcdir)/src/MGRS.cpp \
$(top_srcdir)/src/OSGB.cpp \
$(top_srcdir)/src/PolarStereographic.cpp \
$(top_srcdir)/src/PolygonArea.cpp \
$(top_srcdir)/src/TransverseMercator.cpp \
$(top_srcdir)/src/TransverseMercatorExact.cpp \
$(top_srcdir)/src/UTMUPS.cpp \
$(top_srcdir)/tools/CartConvert.cpp \
$(top_srcdir)/tools/ConicProj.cpp \
$(top_srcdir)/tools/GeodesicProj.cpp \
$(top_srcdir)/tools/GeoConvert.cpp \
$(top_srcdir)/tools/GeodSolve.cpp \
$(top_srcdir)/tools/GeoidEval.cpp \
$(top_srcdir)/tools/Gravity.cpp \
$(top_srcdir)/tools/Planimeter.cpp \
$(top_srcdir)/tools/TransverseMercatorProj.cpp
MANPAGES = \
../man/CartConvert.1.html \
../man/ConicProj.1.html \
../man/GeodesicProj.1.html \
../man/GeoConvert.1.html \
../man/GeodSolve.1.html \
../man/GeoidEval.1.html \
../man/Gravity.1.html \
../man/MagneticField.1.html \
../man/Planimeter.1.html \
../man/TransverseMercatorProj.1.html
LEGACYFILES = \
$(top_srcdir)/legacy/C/geodesic.c \
$(top_srcdir)/legacy/C/geodesic.h \
$(top_srcdir)/legacy/C/direct.c \
$(top_srcdir)/legacy/C/inverse.c \
$(top_srcdir)/legacy/C/planimeter.c \
$(top_srcdir)/legacy/Fortran/geodesic.for \
$(top_srcdir)/legacy/Fortran/geodesic.inc \
$(top_srcdir)/legacy/Fortran/geoddirect.for \
$(top_srcdir)/legacy/Fortran/geodinverse.for \
$(top_srcdir)/legacy/Fortran/planimeter.for
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
cscope cscopelist:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic \
maintainer-clean-local
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic maintainer-clean-local mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am
doc: html/index.html
@HAVE_DOXYGEN_TRUE@manpages: $(MANPAGES)
@HAVE_DOXYGEN_TRUE@ if test -d html; then rm -rf html/*; else mkdir html; fi
@HAVE_DOXYGEN_TRUE@ cp $^ html/
@HAVE_DOXYGEN_TRUE@ touch $@
@HAVE_DOXYGEN_TRUE@html/index.html: manpages doxyfile.in GeographicLib.dox \
@HAVE_DOXYGEN_TRUE@ $(HPPFILES) $(ALLSOURCES) $(EXTRAFILES) $(FIGURES) \
@HAVE_DOXYGEN_TRUE@ doxyfile-c.in geodesic-c.dox doxyfile-for.in geodesic-for.dox \
@HAVE_DOXYGEN_TRUE@ $(LEGACYFILES)
@HAVE_DOXYGEN_TRUE@ cp -p $(EXTRAFILES) $(top_srcdir)/maxima/*.mac \
@HAVE_DOXYGEN_TRUE@ $(top_srcdir)/LICENSE.txt html/
@HAVE_DOXYGEN_TRUE@ sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \
@HAVE_DOXYGEN_TRUE@ -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
@HAVE_DOXYGEN_TRUE@ $(srcdir)/doxyfile.in | $(DOXYGEN) -
@HAVE_DOXYGEN_TRUE@ sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \
@HAVE_DOXYGEN_TRUE@ -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
@HAVE_DOXYGEN_TRUE@ $(srcdir)/doxyfile-c.in | $(DOXYGEN) -
@HAVE_DOXYGEN_TRUE@ sed -e "s%@PROJECT_SOURCE_DIR@%$(top_srcdir)%g" \
@HAVE_DOXYGEN_TRUE@ -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
@HAVE_DOXYGEN_TRUE@ $(srcdir)/doxyfile-for.in | $(DOXYGEN) -
@HAVE_DOXYGEN_FALSE@html/index.html: index.html.in utilities.html.in
@HAVE_DOXYGEN_FALSE@ if test -d html; then rm -rf html/*; else mkdir html; fi
@HAVE_DOXYGEN_FALSE@ cp $(top_srcdir)/LICENSE.txt html/
@HAVE_DOXYGEN_FALSE@ sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
@HAVE_DOXYGEN_FALSE@ $(srcdir)/utilities.html.in > html/utilities.html
@HAVE_DOXYGEN_FALSE@ sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
@HAVE_DOXYGEN_FALSE@ $(srcdir)/index.html.in > html/index.html
maintainer-clean-local:
rm -rf html manpages
install-doc: html/index.html
$(INSTALL) -d $(DESTDIR)$(docdir)/html
$(INSTALL) -m 644 `dirname $<`/*.* $(DESTDIR)$(docdir)/html
-test -f `dirname $<`/C/index.html && \
$(INSTALL) -d $(DESTDIR)$(docdir)/html/C && \
$(INSTALL) -m 644 `dirname $<`/C/*.* $(DESTDIR)$(docdir)/html/C
-test -f `dirname $<`/Fortran/index.html && \
$(INSTALL) -d $(DESTDIR)$(docdir)/html/Fortran && \
$(INSTALL) -m 644 `dirname $<`/Fortran/*.* \
$(DESTDIR)$(docdir)/html/Fortran
$(INSTALL) -d $(DESTDIR)$(docdir)/scripts
$(INSTALL) -m 644 $(SCRIPTDRIVERS) $(DESTDIR)$(docdir)/scripts
$(INSTALL) -d $(DESTDIR)$(docdir)/scripts/GeographicLib
$(INSTALL) -m 644 $(JSSCRIPTS) $(DESTDIR)$(docdir)/scripts/GeographicLib
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,30 @@
SCRIPTDRIVERS = $(wildcard scripts/[A-Za-z]*.html)
JSSCRIPTS = $(wildcard scripts/GeographicLib/[A-Za-z]*.js)
VERSION:=$(shell grep '\bVERSION=' ../configure | cut -f2 -d\' | head -1)
doc: html/index.html
html/index.html: index.html.in utilities.html.in
if test -d html; then rm -rf html/*; else mkdir html; fi
cp ../LICENSE.txt html/
sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
utilities.html.in > html/utilities.html
sed -e "s%@PROJECT_VERSION@%$(VERSION)%g" \
index.html.in > html/index.html
PREFIX = /usr/local
DEST = $(PREFIX)/share/doc/GeographicLib
DOCDEST = $(DEST)/html
SCRIPTDEST = $(DEST)/scripts
INSTALL = install -b
install: html/index.html
test -d $(DOCDEST) || mkdir -p $(DOCDEST)
$(INSTALL) -m 644 html/* $(DOCDEST)/
test -d $(SCRIPTDEST)/GeographicLib || \
mkdir -p $(SCRIPTDEST)/GeographicLib
$(INSTALL) -m 644 $(SCRIPTDRIVERS) $(SCRIPTDEST)/
$(INSTALL) -m 644 $(JSSCRIPTS) $(SCRIPTDEST)/GeographicLib/
.PHONY: doc install clean

View File

@ -0,0 +1,241 @@
// -*- text -*-
/**
* \file NETGeographicLib.dox
* \brief Documentation for NETGeographicLib
*
* Written by Scott Heiman <mrmtdew2@outlook.com> and licensed under the
* MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
/**
\mainpage NETGeographicLib library
\author Scott Heiman (mrmtdew2@outlook.com)
\version 1.34
\date 2013-12-11
\section abstract Abstract
%NETGeographicLib is a .NET wrapper for GeographicLib. It allows
.NET developers to access GeographicLib classes within C#, Visual
Basic, Managed C++, and other Microsoft .NET languages.
NETGeographicLib is written in Managed C++. It IS NOT a reimplementation
of the GeographicLib software. It is a container that provides interfaces
to the GeographicLib classes. GeographicLib and NETGeographicLib is an
integrated product.
The NETGeographic project in the GeographicLib-vc10.sln file located in
\<install folder\>/GeographicLib-1.34/windows will create the NETGeographicLib
DLL. The source code for NETGeographicLib is located in
\<install folder\>/GeographicLib-1.34/dotnet/NETGeographicLib. NETGeographicLib
is not available for older versions of Microsoft Visual Studio.
NETGeographicLib has been tested with C#, Managed C++, and Visual Basic.
Sample code snippets can be found in
\<install folder\>/GeographicLib-1.34/dotnet/examples.
\section differences Differences between NETGeographicLib and GeographicLib
The NETGeographicLib class names are identical to the GeographicLib class names.
All NETGeographicLib classes are in the NETGeographicLib namespace.
NETGeographicLib exposes most of the GeographicLib classes. The exceptions
are SphericalEngine, GeographicLib::Math, and GeographicLib::Utility. The
SphericalEngine class is a template class which (according to the comments in
the SphericalEngine.h file) is not usually accessible to developers. The
GeographicLib::Math class contains several specialized functions required by
GeographicLib classes. They have limited use outside GeographicLib. This class
may be exposed in a future release if there is demand for it. The functions
provided by GeographicLib::Utility duplicate functions provided by existing .NET
controls (DateTime).
The SphericalCoefficients class replaces the SphericalEngine::coeff class.
The NETGeographicLib class function interfaces are similar, and in many cases,
identical to the GeographicLib interfaces. There are differences because of
limitations in .NET and other differences that are discretionary. The comments
in the header files contain a section labeled "INTERFACE DIFFERENCES" that detail
the differences between the NETGeographicLib interfaces and the GeographicLib
interfaces. The differences are summarized in the text that follows.
Default values for function parameters are not supported in .NET.
Several GeographicLib class functions accept or return a "capabilities mask" as
an unsigned integer. The NETGeographicLib classes accept and return the capabilities
mask as an enumeration.
The Geocentric and LocalCartesian classes have functions that return a rotation matrix.
The NETGeographicLib versions return a two-dimensional, 3 &times; 3 array rather than a vector.
A lot of GeographicLib classes have inspector functions (MajorRadius,
Flattening, etc.). These inspector functions are implemented as
properties in NETGeographicLib.
NETGeographicLib classes do not implement constructors that create "uninitialized" objects.
Many NETGeographicLib classes implement a default constructor that assumes WGS84 parameters.
Several GeographicLib classes implement the () operator. NETGeographicLib classes
replace the () operator with a specific function. Managed C++ allows developers to
overload the () operator; however, the () operator is not 'elegantly' supported in
other .NET languages. For example, if the () operator was implemented in the
NETGeographicLib::Geoid class, then C# code would look like
\code
Geoid geoid = new Geoid();
double h = geoid.op_FuncCall(latitude,longitude); // if () operator was implemented.
h = geoid.Height(latitude,longitude); // with () operator replaced with Height
\endcode
The author felt that the op_FuncCall syntax did not appropriately define the purpose
of the function call.
.NET does not allow developers to overload the assignment operators (=,+=,-=,*=).
These operators have been replaced with functions in the NETGeographicLib::Accumulator class.
\section library Using NETGeographicLib in a .NET Application
If you have access to the NETGeographicLib and GeographicLib projects then
-# Create a new solution.
-# Create a new project using any .NET language. For this example, call it MyApp.
-# Add the NETGeographic and Geographic projects to the solution. Verify that NETGeographicLib depends upon GeographicLib.
-# Right-Click MyApp in the Solution View and select "Add Reference..." (C#/VB) or "References..." (Managed C++) in the pop-up menu.
-# (Managed C++) Click the "Add New Reference..." button in the Properties dialog.
\image html NETGeographicLib3.png
-# Click the Projects Tab and select NETGeographic.
\image html NETGeographicLib1.png
-# Click OK.
If you only have access to the NETGeographic.dll then
-# Create a new solution.
-# Create a new project using any .NET language. For this example, call it MyApp.
-# Right-Click MyApp in the Solution View and select "Add Reference..." in the popup menu.
-# Right-Click MyApp in the Solution View and select "Add Reference..." (C#/VB) or "References..." (Managed C++) in the pop-up menu.
-# (Managed C++) Click the "Add New Reference..." button in the Properties dialog.
\image html NETGeographicLib3.png
-# Click the Browse Tab and navigate to the folder containing NETGeographic.dll.
\image html NETGeographicLib2.png
-# Select NETGeographic.dll and click OK.
The MyApp project will have access to all public NETGeographicLib classes after the
NETGeographic reference is added to MyApp.
C# developers should add
\code using NETGeographicLib; \endcode
to any C# source file that uses NETGeographicLib.
Managed C++ developers should add
\code using namespace NETGeographicLib; \endcode
to any C++ source that uses NETGeographicLib classes.
Visual Basic developers should add
\code Imports NETGeographicLib \endcode
to any Visual Basic source that uses NETGeographicLib classes.
\section sample C# Sample Application
A C# sample application is provided that demonstrates NETGeographicLib classes.
The source code for the sample application is located in
\<install folder\>/GeographicLib-1.34/dotnet/Projections. The sample
application creates a tabbed dialog. Each tab provides data entry fields that
allow the user to exercise one or more NETGeographicLib classes.
The following table lists the source code that demonstrates specific classes.
<center>
<TABLE>
<TR><TH>Source File</TH><TH>Classes</TH></TR>
<TR><TD>AccumPanel.cs</TD><TD>Accumulator</TD></TR>
<TR><TD>AlbersPanel.cs</TD><TD>AlbersEqualArea, LambertConformalConic, TransverseMercator, TransverseMercatorExact</TD></TR>
<TR><TD>EllipsoidPanel.cs</TD><TD>Ellipsoid</TD></TR>
<TR><TD>EllipticPanel.cs</TD><TD>EllipticFunction</TD></TR>
<TR><TD>GeocentricPanel.cs</TD><TD>Geocentric</TD></TR>
<TR><TD>GeodesicPanel.cs</TD><TD>Geodesic, GeodesicLine, GeodesicExact, GeodesicLineExact</TD></TR>
<TR><TD>GeoidPanel.cs</TD><TD>Geoid</TD></TR>
<TR><TD>GravityPanel.cs</TD><TD>NormalGravity, GravityModel, GravityCircle</TD></TR>
<TR><TD>LocalCartesianPanel.cs</TD><TD>LocalCartesian</TD></TR>
<TR><TD>MagneticPanel.cs</TD><TD>MagneticModel, MagneticCircle</TD></TR>
<TR><TD>MiscPanel.cs</TD><TD>DMS, Geohash</TD></TR>
<TR><TD>PolarStereoPanel.cs</TD><TD>PolarStereographic</TD></TR>
<TR><TD>PolyPanel.cs</TD><TD>PolygonArea</TD></TR>
<TR><TD>ProjectionsPanel.cs</TD><TD>AzimuthalEquidistant, CassiniSoldner, Gnomonic</TD></TR>
<TR><TD>SphericalHarmonicsPanel.cs</TD><TD>SphericalHarmonic, SphericalHarmonic1, SphericalHarmonic2, CircularEngine, SphericalCoefficients</TD></TR>
<TR><TD>TypeIIIProjPanel.cs</TD><TD>UTMUPS, MGRS, OSGB</TD></TR>
</TABLE>
</center>
\section netcmake Using cmake to build a Managed C++ Application
The following assumes that you have installed %GeographicLib in one of
two ways:
- you have built and installed %GeographicLib using cmake with
<code>-D BUILD_NETGEOGRAPHICLIB=ON</code> (see
\ref cmake "Installation with cmake" in the %GeographicLib
documentation). You can use any version of Visual Studio to build
%GeographicLib and should use the same version to build your
application. You can build %GeographicLib as a shared library using
<code>-D GEOGRAPHICLIB_LIB_TYPE=SHARED</code> or <code>BOTH</code>.
- you have installed %GeographicLib using one of the binary installers (see
\ref windowsbin "Using a binary installer for Windows" in the
%GeographicLib documentation). In this case, you are restricted to using
Visual Studio 10.
The minimum recommended version of cmake for use with NETGeographicLib
is 2.8.7. In order to build an application that uses NETGeographicLib
with cmake, ask for the NETGeographicLib "component" of %GeographicLib
using \verbatim
find_package(GeographicLib COMPONENTS NETGeographicLib) \endverbatim
If NETGeographicLib is found, then
<code>GeographicLib_NETGeographicLib_FOUND</code> will be set to true and
<code>GeographicLib_NETGeographicLib_LIBRARIES</code> will be set to the
NETGeographic shared library. This is the name of the cmake target from
which the pathname of the dll can be obtained.
Here is a very simple test code, which uses the
NETGeographicLib::Geodesic class:
\include example-Geodesic-small.cpp
This example is
<code>dotnet/examples/ManagedCPP/example-Geodesic-small.cpp</code>.
Here is a complete CMakeList.txt files you can use to build this test
code using the installed library: \verbatim
project (geodesictest)
cmake_minimum_required (VERSION 2.8.7) # required for VS_DOTNET_REFERENCES
find_package (GeographicLib 1.34 REQUIRED COMPONENTS NETGeographicLib)
add_executable (${PROJECT_NAME} example-Geodesic-small.cpp)
set_target_properties (${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/clr")
string (REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string (REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# This is set up for Release builds only. Change RELEASE to DEBUG for
# Debug builds.
get_target_property (_LOC "${GeographicLib_NETGeographicLib_LIBRARIES}"
IMPORTED_LOCATION_RELEASE)
set_target_properties (${PROJECT_NAME} PROPERTIES VS_DOTNET_REFERENCES ${_LOC})
get_target_property (_LIB "${GeographicLib_NETGeographicLib_LIBRARIES}"
IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE)
get_target_property (_LIBTYPE ${_LIB} TYPE)
if (_LIBTYPE STREQUAL "SHARED_LIBRARY")
# On Windows systems, copy the shared library to build directory
add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy $<TARGET_FILE:${_LIB}> ${CMAKE_CFG_INTDIR}
COMMENT "Copying shared library for GeographicLib")
endif () \endverbatim
The typical invocation of cmake is \verbatim
mkdir BUILD
cd BUILD
cmake -G "Visual Studio 10" -D CMAKE_PREFIX_PATH=C:/pkg-vc10 ..
cmake --build . --config Release \endverbatim
The version of Visual Studio should match that used to build
NETGeographicLib. <b>NOTE:</b> With Visual Studio 10, this results in
warnings such as \verbatim
warning C4945: 'ExtensionAttribute' : cannot import symbol from ... \endverbatim
which can be safely(?) ignored.
Running the example with \verbatim
Release\geodesictest.exe \endverbatim
should give \verbatim
5551.75940031868 km \endverbatim
**********************************************************************/

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -0,0 +1,118 @@
// -*- text -*-
/**
* \file geodesic-c.dox
* \brief Documentation for geodesic routines implemented in C
*
* Written by Charles Karney <charles@karney.com> and licensed under the
* MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
/**
\mainpage Geodesic routines implemented in C
\author Charles F. F. Karney (charles@karney.com)
\version 1.32
\section abstract Abstract
This is a C implementation of the geodesic algorithms from <a
href="http://geographiclib.sf.net">GeographicLib</a>. This is a
self-contained library (requiring only the standard C math library)
which makes it easy to do geodesic computations for an ellipsoid of
revolution in a C program. It uses ANSI C as described in
B. W. Kernigan and D. M. Ritchie, The C Programming Language, 2nd
Ed. (Prentice Hall, 1988), and so should compile correctly with just
about any C compiler.
\section download Downloading the source
The C library is part of %GeographicLib which available for download at
- <a href="http://sf.net/projects/geographiclib/files/distrib/GeographicLib-1.32.tar.gz">
GeographicLib-1.32.tar.gz</a>
- <a href="http://sf.net/projects/geographiclib/files/distrib/GeographicLib-1.32.zip">
GeographicLib-1.32.zip</a>
.
as either a compressed tar file (tar.gz) or a zip file. After unpacking
the source, the C library can be found in GeographicLib-1.32/legacy/C.
The library consists of two files geodesic.c and geodesic.h.
The library is also included as part of
<a href="http://trac.osgeo.org/proj/">proj.4</a> starting with version
4.9.0, where is used as the computational backend for
<a href="http://trac.osgeo.org/proj/wiki/man_geod">geod(1)</a>.
Instructions for how to use the library via proj.4 are given below.
\section doc Library documentation
The interface to the library is documented via doxygen in the header
file. To access this, see geodesic.h.
\section samples Sample programs
Also included are 3 small test programs:
- direct.c is a simple command line utility for solving the
direct geodesic problem;
- inverse.c is a simple command line utility for solving the
inverse geodesic problem;
- planimeter.c is a simple command line utility for computing the
area of a geodesic polygon given its vertices.
.
Here, for example, is inverse.c
\include inverse.c
To compile, link, and run this, you would typically use \verbatim
cc -o inverse inverse.c geodesic.c -lm
echo 30 0 29.5 179.5 | ./inverse \endverbatim
These sample programs can also be built with the supplied cmake file,
CMakeLists.txt, as follows \verbatim
mkdir BUILD
cd BUILD
cmake ..
make
echo 30 0 29.5 179.5 | ./inverse \endverbatim
Alternatively, if you have proj.4 installed, you can compile and link
with \verbatim
cc -c inverse.c
cc -o inverse inverse.o -lproj
echo 30 0 29.5 179.5 | ./inverse \endverbatim
If proj.4 is installed, e.g., in /usr/local, you might have to use
\verbatim
cc -c -I/usr/local/include inverse.c
cc -o inverse inverse.o -lproj -L/usr/local/lib -Wl,-rpath=/usr/local/lib
echo 30 0 29.5 179.5 | ./inverse \endverbatim
\section library Using the library
- Put @verbatim
#include "geodesic.h" @endverbatim
in your source code. If you are using the library via proj.4, change
this to @verbatim
#include <geodesic.h> @endverbatim
- make calls to the geodesic routines from your code. The interface to
the library is documented in geodesic.h.
- Compile and link as described above.
\section external External links
- These algorithms are derived in C. F. F. Karney,
<a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
Algorithms for geodesics</a>,
J. Geodesy <b>87</b>, 43--55 (2013)
(<a href="http://geographiclib.sf.net/geod-addenda.html"> addenda</a>).
- A longer paper on geodesics: C. F. F. Karney,
<a href="http://arxiv.org/abs/1102.1215v1">Geodesics
on an ellipsoid of revolution</a>,
Feb. 2011
(<a href="http://geographiclib.sf.net/geod-addenda.html#geod-errata">
errata</a>).
- <a href="http://geographiclib.sf.net">The GeographicLib web site</a>.
- <a href="../index.html">The C++ library</a>.
- <a href="../java/index.html">The Java library</a>.
- <a href="../Fortran/index.html">The Fortran library</a>.
- Documentation on the C++ classes: GeographicLib::Geodesic,
GeographicLib::GeodesicLine, GeographicLib::PolygonArea.
- The section in the %GeographicLib documentation on geodesics: \ref
geodesic.
- <a href="http://geographiclib.sf.net/geodesic-papers/biblio.html">
An online geodesic bibliography</a>.
**********************************************************************/

View File

@ -0,0 +1,100 @@
// -*- text -*-
/**
* \file geodesic-for.dox
* \brief Documentation for geodesic routines implemented in Fortran
*
* Written by Charles Karney <charles@karney.com> and licensed under the
* MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
/**
\mainpage Geodesic routines implemented in Fortran
\author Charles F. F. Karney (charles@karney.com)
\version 1.31
\section abstract Abstract
This is a Fortran implementation of the geodesic algorithms from <a
href="http://geographiclib.sf.net">GeographicLib</a>. This is a
self-contained library which makes it easy to do geodesic computations
for an ellipsoid of revolution in a Fortran program. It is written in
Fortran 77 (avoiding features which are now deprecated) and should
compile correctly with just about any Fortran compiler.
\section download Downloading the source
The Fortran library is part of %GeographicLib which available for download at
- <a href="http://sf.net/projects/geographiclib/files/distrib/GeographicLib-1.31.tar.gz">
GeographicLib-1.31.tar.gz</a>
- <a href="http://sf.net/projects/geographiclib/files/distrib/GeographicLib-1.31.zip">
GeographicLib-1.31.zip</a>
.
as either a compressed tar file (tar.gz) or a zip file. After unpacking
the source, the Fortran library can be found in
GeographicLib-1.31/legacy/Fortran. The library consists of the file
geodesic.for.
\section doc Library documentation
The interface to the library is documented via doxygen in the source
file. To access this, see geodesic.for.
\section samples Sample programs
Also included are 3 small test programs:
- geoddirect.for is a simple command line utility for solving the
direct geodesic problem;
- geodinverse.for is a simple command line utility for solving the
inverse geodesic problem;
- planimeter.for is a simple command line utility for computing the
area of a geodesic polygon given its vertices.
.
Here, for example, is geodinverse.for
\include geodinverse.for
To compile, link, and run this, you would typically use \verbatim
f95 -o geodinverse geodinverse.for geodesic.for
echo 30 0 29.5 179.5 | ./geodinverse \endverbatim
These sample programs can also be built with the supplied cmake file,
CMakeLists.txt, as follows \verbatim
mkdir BUILD
cd BUILD
cmake ..
make
echo 30 0 29.5 179.5 | ./geodinverse \endverbatim
\section library Using the library
- Optionall put @verbatim
include "geodesic.inc" @endverbatim
in declaration section of your subroutines.
- make calls to the geodesic routines from your code. The interface to
the library is documented in geodesic.for.
- Compile and link as described above.
\section external External links
- These algorithms are derived in C. F. F. Karney,
<a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
Algorithms for geodesics</a>,
J. Geodesy <b>87</b>, 43--55 (2013)
(<a href="http://geographiclib.sf.net/geod-addenda.html"> addenda</a>).
- A longer paper on geodesics: C. F. F. Karney,
<a href="http://arxiv.org/abs/1102.1215v1">Geodesics
on an ellipsoid of revolution</a>,
Feb. 2011
(<a href="http://geographiclib.sf.net/geod-addenda.html#geod-errata">
errata</a>).
- <a href="http://geographiclib.sf.net">The GeographicLib web site</a>.
- <a href="../index.html">The C++ library</a>.
- <a href="../C/index.html">The C library</a>.
- <a href="../java/index.html">The Java library</a>.
- Documentation on the C++ classes: GeographicLib::Geodesic,
GeographicLib::GeodesicLine, GeographicLib::PolygonArea.
- The section in the %GeographicLib documentation on geodesics: \ref
geodesic.
- <a href="http://geographiclib.sf.net/geodesic-papers/biblio.html">
An online geodesic bibliography</a>.
**********************************************************************/
**********************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
<html>
<head>
<title>GeographicLib-@PROJECT_VERSION@ documentation</title>
<meta HTTP-EQUIV="Refresh"
CONTENT="0; URL=http://geographiclib.sourceforge.net/@PROJECT_VERSION@/index.html">
</head>
<body topmargin=10 leftmargin=10>
<h3>
<blockquote>
<em>
Online documentation for GeographicLib version
@PROJECT_VERSION@ is available at
<center>
<a href="http://geographiclib.sourceforge.net/@PROJECT_VERSION@/index.html">
http://geographiclib.sourceforge.net/@PROJECT_VERSION@/index.html</a>.
</center>
<br>
You will be redirected there. Click on the link to go there
directly.
</em>
</blockquote>
</h3>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -0,0 +1,364 @@
/**
* DMS.js
* Transcription of DMS.[ch]pp into JavaScript.
*
* See the documentation for the C++ class. The conversion is a literal
* conversion from C++.
*
* Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed
* under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
GeographicLib.DMS = {};
(function() {
var d = GeographicLib.DMS;
var m = GeographicLib.Math;
d.lookup = function(s, c) {
return s.indexOf(c.toUpperCase());
}
d.zerofill = function(s, n) {
return String("0000").substr(0, Math.max(0, Math.min(4, n-s.length))) +
s;
}
d.hemispheres_ = "SNWE";
d.signs_ = "-+";
d.digits_ = "0123456789";
d.dmsindicators_ = "D'\":";
// d.dmsindicatorsu_ = "\u00b0\u2032\u2033"; // Unicode variants
d.dmsindicatorsu_ = "\u00b0'\""; // Use degree symbol
d.components_ = ["degrees", "minutes", "seconds"];
d.NONE = 0;
d.LATITUDE = 1;
d.LONGITUDE = 2;
d.AZIMUTH = 3;
d.NUMBER = 4;
d.DEGREE = 0;
d.MINUTE = 1;
d.SECOND = 2;
// return val, ind
d.Decode = function(dms) {
var vals = {};
var errormsg = new String("");
var dmsa = dms;
dmsa = dmsa.replace(/\u00b0/g, 'd');
dmsa = dmsa.replace(/\u00ba/g, 'd');
dmsa = dmsa.replace(/\u2070/g, 'd');
dmsa = dmsa.replace(/\u02da/g, 'd');
dmsa = dmsa.replace(/\u2032/g, '\'');
dmsa = dmsa.replace(/\u00b4/g, '\'');
dmsa = dmsa.replace(/\u2019/g, '\'');
dmsa = dmsa.replace(/\u2033/g, '"');
dmsa = dmsa.replace(/\u201d/g, '"');
dmsa = dmsa.replace(/''/g, '"');
dmsa = dmsa.replace(/^\s+/, "");
dmsa = dmsa.replace(/\s+$/, "");
do { // Executed once (provides the ability to break)
var sign = 1;
var beg = 0, end = dmsa.length;
var ind1 = d.NONE;
var k = -1;
if (end > beg && (k = d.lookup(d.hemispheres_, dmsa.charAt(beg))) >= 0) {
ind1 = (k & 2) ? d.LONGITUDE : d.LATITUDE;
sign = (k & 1) ? 1 : -1;
++beg;
}
if (end > beg &&
(k = d.lookup(d.hemispheres_, dmsa.charAt(end-1))) >= 0) {
if (k >= 0) {
if (ind1 != d.NONE) {
if (dmsa.charAt(beg - 1).toUpperCase() ==
dmsa.charAt(end - 1).toUpperCase())
errormsg = "Repeated hemisphere indicators " +
dmsa.charAt(beg - 1) + " in " +
dmsa.substr(beg - 1, end - beg + 1);
else
errormsg = "Contradictory hemisphere indicators " +
dmsa.charAt(beg - 1) + " and " + dmsa.charAt(end - 1) + " in " +
dmsa.substr(beg - 1, end - beg + 1);
break;
}
ind1 = (k & 2) ? d.LONGITUDE : d.LATITUDE;
sign = (k & 1) ? 1 : -1;
--end;
}
}
if (end > beg && (k = d.lookup(d.signs_, dmsa.charAt(beg))) >= 0) {
if (k >= 0) {
sign *= k ? 1 : -1;
++beg;
}
}
if (end == beg) {
errormsg = "Empty or incomplete DMS string " + dmsa;
break;
}
var ipieces = [0, 0, 0];
var fpieces = [0, 0, 0];
var npiece = 0;
var icurrent = 0;
var fcurrent = 0;
var ncurrent = 0, p = beg;
var pointseen = false;
var digcount = 0;
var intcount = 0;
while (p < end) {
var x = dmsa.charAt(p++);
if ((k = d.lookup(d.digits_, x)) >= 0) {
++ncurrent;
if (digcount > 0)
++digcount; // Count of decimal digits
else {
icurrent = 10 * icurrent + k;
++intcount;
}
} else if (x == '.') {
if (pointseen) {
errormsg = "Multiple decimal points in "
+ dmsa.substr(beg, end - beg);
break;
}
pointseen = true;
digcount = 1;
} else if ((k = d.lookup(d.dmsindicators_, x)) >= 0) {
if (k >= 3) {
if (p == end) {
errormsg = "Illegal for : to appear at the end of " +
dmsa.substr(beg, end - beg);
break;
}
k = npiece;
}
if (k == npiece - 1) {
errormsg = "Repeated " + d.components_[k] +
" component in " + dmsa.substr(beg, end - beg);
break;
} else if (k < npiece) {
errormsg = d.components_[k] + " component follows "
+ d.components_[npiece - 1] + " component in "
+ dmsa.substr(beg, end - beg);
break;
}
if (ncurrent == 0) {
errormsg = "Missing numbers in " + d.components_[k] +
" component of " + dmsa.substr(beg, end - beg);
break;
}
if (digcount > 1) {
fcurrent = parseFloat(dmsa.substr(p - intcount - digcount - 1,
intcount + digcount));
icurrent = 0;
}
ipieces[k] = icurrent;
fpieces[k] = icurrent + fcurrent;
if (p < end) {
npiece = k + 1;
icurrent = fcurrent = 0;
ncurrent = digcount = intcount = 0;
}
} else if (d.lookup(d.signs_, x) >= 0) {
errormsg = "Internal sign in DMS string "
+ dmsa.substr(beg, end - beg);
break;
} else {
errormsg = "Illegal character " + x + " in DMS string "
+ dmsa.substr(beg, end - beg);
break;
}
}
if (errormsg.length)
break;
if (d.lookup(d.dmsindicators_, dmsa.charAt(p - 1)) < 0) {
if (npiece >= 3) {
errormsg = "Extra text following seconds in DMS string "
+ dmsa.substr(beg, end - beg);
break;
}
if (ncurrent == 0) {
errormsg = "Missing numbers in trailing component of "
+ dmsa.substr(beg, end - beg);
break;
}
if (digcount > 1) {
fcurrent = parseFloat(dmsa.substr(p - intcount - digcount,
intcount + digcount));
icurrent = 0;
}
ipieces[npiece] = icurrent;
fpieces[npiece] = icurrent + fcurrent;
}
if (pointseen && digcount == 0) {
errormsg = "Decimal point in non-terminal component of "
+ dmsa.substr(beg, end - beg);
break;
}
// Note that we accept 59.999999... even though it rounds to 60.
if (ipieces[1] >= 60) {
errormsg = "Minutes " + fpieces[1] + " not in range [0, 60)";
break;
}
if (ipieces[2] >= 60) {
errormsg = "Seconds " + fpieces[2] + " not in range [0, 60)";
break;
}
vals.ind = ind1;
// Assume check on range of result is made by calling routine (which
// might be able to offer a better diagnostic).
vals.val = sign * (fpieces[0] + (fpieces[1] + fpieces[2] / 60) / 60);
return vals;
} while (false);
vals.val = d.NumMatch(dmsa);
if (vals.val == 0)
throw new Error(errormsg);
else
vals.ind = d.NONE;
return vals;
}
d.NumMatch = function(s) {
if (s.length < 3)
return 0;
var t = s.toUpperCase().replace(/0+$/,"");
var sign = t.charAt(0) == '-' ? -1 : 1;
var p0 = t.charAt(0) == '-' || t.charAt(0) == '+' ? 1 : 0;
var p1 = t.length - 1;
if (p1 + 1 < p0 + 3)
return 0;
// Strip off sign and trailing 0s
t = t.substr(p0, p1 + 1 - p0); // Length at least 3
if (t == "NAN" || t == "1.#QNAN" || t == "1.#SNAN" || t == "1.#IND" ||
t == "1.#R")
return sign * Number.NaN;
else if (t == "INF" || t == "1.#INF")
return sign * Number.POSITIVE_INFINITY;
return 0;
}
// return lat, lon
d.DecodeLatLon = function(stra, strb, swaplatlong) {
var vals = {};
if (!swaplatlong) swaplatlong = false;
var valsa = d.Decode(stra);
var valsb = d.Decode(strb);
var a = valsa.val, ia = valsa.ind;
var b = valsb.val, ib = valsb.ind;
if (ia == d.NONE && ib == d.NONE) {
// Default to lat, long unless swaplatlong
ia = swaplatlong ? d.LONGITUDE : d.LATITUDE;
ib = swaplatlong ? d.LATITUDE : d.LONGITUDE;
} else if (ia == d.NONE)
ia = d.LATITUDE + d.LONGITUDE - ib;
else if (ib == d.NONE)
ib = d.LATITUDE + d.LONGITUDE - ia;
if (ia == ib)
throw new Error("Both " + stra + " and "
+ strb + " interpreted as "
+ (ia == d.LATITUDE ? "latitudes" : "longitudes"));
var lat = ia == d.LATITUDE ? a : b, lon = ia == d.LATITUDE ? b : a;
if (Math.abs(lat) > 90)
throw new Error("Latitude " + lat + "d not in [-90d, 90d]");
if (lon < -540 || lon >= 540)
throw new Error("Latitude " + lon + "d not in [-540d, 540d)");
lon = m.AngNormalize(lon);
vals.lat = lat;
vals.lon = lon;
return vals;
}
d.DecodeAngle = function(angstr) {
var vals = d.Decode(angstr);
var ang = vals.val, ind = vals.ind;
if (ind != d.NONE)
throw new Error("Arc angle " + angstr
+ " includes a hemisphere, N/E/W/S");
return ang;
}
d.DecodeAzimuth = function(azistr) {
var vals = d.Decode(azistr);
var azi = vals.val, ind = vals.ind;
if (ind == d.LATITUDE)
throw new Error("Azimuth " + azistr
+ " has a latitude hemisphere, N/S");
if (azi < -540 || azi >= 540)
throw new Error("Azimuth " + azistr + " not in range [-540d, 540d)");
azi = m.AngNormalize(azi);
return azi;
}
d.Encode = function(angle, trailing, prec, ind) {
// Assume check on range of input angle has been made by calling
// routine (which might be able to offer a better diagnostic).
if (!ind) ind = d.NONE;
if (!isFinite(angle))
return angle < 0 ? String("-inf") :
(angle > 0 ? String("inf") : String("nan"));
// 15 - 2 * trailing = ceiling(log10(2^53/90/60^trailing)).
// This suffices to give full real precision for numbers in [-90,90]
prec = Math.min(15 - 2 * trailing, prec);
var scale = 1, i;
for (i = 0; i < trailing; ++i)
scale *= 60;
for (i = 0; i < prec; ++i)
scale *= 10;
if (ind == d.AZIMUTH)
angle -= Math.floor(angle/360) * 360;
var sign = angle < 0 ? -1 : 1;
angle *= sign;
// Break off integer part to preserve precision in manipulation of
// fractional part.
var
idegree = Math.floor(angle),
fdegree = Math.floor((angle - idegree) * scale + 0.5) / scale;
if (fdegree >= 1) {
idegree += 1;
fdegree -= 1;
}
var pieces = [fdegree, 0, 0];
for (i = 1; i <= trailing; ++i) {
var
ip = Math.floor(pieces[i - 1]),
fp = pieces[i - 1] - ip;
pieces[i] = fp * 60;
pieces[i - 1] = ip;
}
pieces[0] += idegree;
var s = new String("");
if (ind == d.NONE && sign < 0)
s += '-';
switch (trailing) {
case d.DEGREE:
s += d.zerofill(pieces[0].toFixed(prec),
ind == d.NONE ? 0 :
1 + Math.min(ind, 2) + prec + (prec ? 1 : 0)) +
d.dmsindicatorsu_.charAt(0);
break;
default:
s += d.zerofill(pieces[0].toFixed(0),
ind == d.NONE ? 0 : 1 + Math.min(ind, 2)) +
d.dmsindicatorsu_.charAt(0);
switch (trailing) {
case d.MINUTE:
s += d.zerofill(pieces[1].toFixed(prec), 2 + prec + (prec ? 1 : 0)) +
d.dmsindicatorsu_.charAt(1);
break;
case d.SECOND:
s += d.zerofill(pieces[1].toFixed(0), 2) + d.dmsindicatorsu_.charAt(1);
s += d.zerofill(pieces[2].toFixed(prec), 2 + prec + (prec ? 1 : 0)) +
d.dmsindicatorsu_.charAt(2);
break;
default:
break;
}
}
if (ind != d.NONE && ind != d.AZIMUTH)
s += d.hemispheres_.charAt((ind == d.LATITUDE ? 0 : 2) +
(sign < 0 ? 0 : 1));
return s;
}
})();

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,294 @@
/**
* GeodesicLine.js
* Transcription of GeodesicLine.[ch]pp into JavaScript.
*
* See the documentation for the C++ class. The conversion is a literal
* conversion from C++.
*
* The algorithms are derived in
*
* Charles F. F. Karney,
* Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);
* http://dx.doi.org/10.1007/s00190-012-0578-z
* Addenda: http://geographiclib.sf.net/geod-addenda.html
*
* Copyright (c) Charles Karney (2011-2012) <charles@karney.com> and licensed
* under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
// Load AFTER GeographicLib/Math.js and GeographicLib/Geodesic.js
(function() {
var g = GeographicLib.Geodesic;
var l = GeographicLib.GeodesicLine;
var m = GeographicLib.Math;
l.GeodesicLine = function(geod, lat1, lon1, azi1, caps) {
this._a = geod._a;
this._f = geod._f;
this._b = geod._b;
this._c2 = geod._c2;
this._f1 = geod._f1;
this._caps = !caps ? g.ALL : (caps | g.LATITUDE | g.AZIMUTH);
azi1 = g.AngRound(m.AngNormalize(azi1));
lon1 = m.AngNormalize(lon1);
this._lat1 = lat1;
this._lon1 = lon1;
this._azi1 = azi1;
// alp1 is in [0, pi]
var alp1 = azi1 * m.degree;
// Enforce sin(pi) == 0 and cos(pi/2) == 0. Better to face the ensuing
// problems directly than to skirt them.
this._salp1 = azi1 == -180 ? 0 : Math.sin(alp1);
this._calp1 = Math.abs(azi1) == 90 ? 0 : Math.cos(alp1);
var cbet1, sbet1, phi;
phi = lat1 * m.degree;
// Ensure cbet1 = +epsilon at poles
sbet1 = this._f1 * Math.sin(phi);
cbet1 = Math.abs(lat1) == 90 ? g.tiny_ : Math.cos(phi);
// SinCosNorm(sbet1, cbet1);
var t = m.hypot(sbet1, cbet1); sbet1 /= t; cbet1 /= t;
this._dn1 = Math.sqrt(1 + geod._ep2 * m.sq(sbet1));
// Evaluate alp0 from sin(alp1) * cos(bet1) = sin(alp0),
this._salp0 = this._salp1 * cbet1; // alp0 in [0, pi/2 - |bet1|]
// Alt: calp0 = hypot(sbet1, calp1 * cbet1). The following
// is slightly better (consider the case salp1 = 0).
this._calp0 = m.hypot(this._calp1, this._salp1 * sbet1);
// Evaluate sig with tan(bet1) = tan(sig1) * cos(alp1).
// sig = 0 is nearest northward crossing of equator.
// With bet1 = 0, alp1 = pi/2, we have sig1 = 0 (equatorial line).
// With bet1 = pi/2, alp1 = -pi, sig1 = pi/2
// With bet1 = -pi/2, alp1 = 0 , sig1 = -pi/2
// Evaluate omg1 with tan(omg1) = sin(alp0) * tan(sig1).
// With alp0 in (0, pi/2], quadrants for sig and omg coincide.
// No atan2(0,0) ambiguity at poles since cbet1 = +epsilon.
// With alp0 = 0, omg1 = 0 for alp1 = 0, omg1 = pi for alp1 = pi.
this._ssig1 = sbet1; this._somg1 = this._salp0 * sbet1;
this._csig1 = this._comg1 =
sbet1 != 0 || this._calp1 != 0 ? cbet1 * this._calp1 : 1;
// SinCosNorm(this._ssig1, this._csig1); // sig1 in (-pi, pi]
var t = m.hypot(this._ssig1, this._csig1);
this._ssig1 /= t; this._csig1 /= t;
// SinCosNorm(this._somg1, this._comg1); -- don't need to normalize!
this._k2 = m.sq(this._calp0) * geod._ep2;
var eps = this._k2 / (2 * (1 + Math.sqrt(1 + this._k2)) + this._k2);
if (this._caps & g.CAP_C1) {
this._A1m1 = g.A1m1f(eps);
this._C1a = new Array(g.nC1_ + 1);
g.C1f(eps, this._C1a);
this._B11 = g.SinCosSeries(true, this._ssig1, this._csig1,
this._C1a, g.nC1_);
var s = Math.sin(this._B11), c = Math.cos(this._B11);
// tau1 = sig1 + B11
this._stau1 = this._ssig1 * c + this._csig1 * s;
this._ctau1 = this._csig1 * c - this._ssig1 * s;
// Not necessary because C1pa reverts C1a
// _B11 = -SinCosSeries(true, _stau1, _ctau1, _C1pa, nC1p_);
}
if (this._caps & g.CAP_C1p) {
this._C1pa = new Array(g.nC1p_ + 1),
g.C1pf(eps, this._C1pa);
}
if (this._caps & g.CAP_C2) {
this._A2m1 = g.A2m1f(eps);
this._C2a = new Array(g.nC2_ + 1);
g.C2f(eps, this._C2a);
this._B21 = g.SinCosSeries(true, this._ssig1, this._csig1,
this._C2a, g.nC2_);
}
if (this._caps & g.CAP_C3) {
this._C3a = new Array(g.nC3_);
geod.C3f(eps, this._C3a);
this._A3c = -this._f * this._salp0 * geod.A3f(eps);
this._B31 = g.SinCosSeries(true, this._ssig1, this._csig1,
this._C3a, g.nC3_-1);
}
if (this._caps & g.CAP_C4) {
this._C4a = new Array(g.nC4_); // all the elements of _C4a are used
geod.C4f(eps, this._C4a);
// Multiplier = a^2 * e^2 * cos(alpha0) * sin(alpha0)
this._A4 = m.sq(this._a) * this._calp0 * this._salp0 * geod._e2;
this._B41 = g.SinCosSeries(false, this._ssig1, this._csig1,
this._C4a, g.nC4_);
}
}
// return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12
l.GeodesicLine.prototype.GenPosition = function(arcmode, s12_a12,
outmask) {
var vals = {};
outmask &= this._caps & g.OUT_ALL;
if (!( arcmode || (this._caps & g.DISTANCE_IN & g.OUT_ALL) )) {
// Uninitialized or impossible distance calculation requested
vals.a12 = Number.NaN;
return vals;
}
// Avoid warning about uninitialized B12.
var sig12, ssig12, csig12, B12 = 0, AB1 = 0;
if (arcmode) {
// Interpret s12_a12 as spherical arc length
sig12 = s12_a12 * m.degree;
var s12a = Math.abs(s12_a12);
s12a -= 180 * Math.floor(s12a / 180);
ssig12 = s12a == 0 ? 0 : Math.sin(sig12);
csig12 = s12a == 90 ? 0 : Math.cos(sig12);
} else {
// Interpret s12_a12 as distance
var
tau12 = s12_a12 / (this._b * (1 + this._A1m1)),
s = Math.sin(tau12),
c = Math.cos(tau12);
// tau2 = tau1 + tau12
B12 = - g.SinCosSeries(true,
this._stau1 * c + this._ctau1 * s,
this._ctau1 * c - this._stau1 * s,
this._C1pa, g.nC1p_);
sig12 = tau12 - (B12 - this._B11);
ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12);
if (Math.abs(this._f) > 0.01) {
// Reverted distance series is inaccurate for |f| > 1/100, so correct
// sig12 with 1 Newton iteration. The following table shows the
// approximate maximum error for a = WGS_a() and various f relative to
// GeodesicExact.
// erri = the error in the inverse solution (nm)
// errd = the error in the direct solution (series only) (nm)
// errda = the error in the direct solution (series + 1 Newton) (nm)
//
// f erri errd errda
// -1/5 12e6 1.2e9 69e6
// -1/10 123e3 12e6 765e3
// -1/20 1110 108e3 7155
// -1/50 18.63 200.9 27.12
// -1/100 18.63 23.78 23.37
// -1/150 18.63 21.05 20.26
// 1/150 22.35 24.73 25.83
// 1/100 22.35 25.03 25.31
// 1/50 29.80 231.9 30.44
// 1/20 5376 146e3 10e3
// 1/10 829e3 22e6 1.5e6
// 1/5 157e6 3.8e9 280e6
var
ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12,
csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a, g.nC1_);
var serr = (1 + this._A1m1) * (sig12 + (B12 - this._B11)) -
s12_a12 / this._b;
sig12 = sig12 - serr / Math.sqrt(1 + this._k2 * m.sq(ssig2));
ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12);
// Update B12 below
}
}
var omg12, lam12, lon12;
var ssig2, csig2, sbet2, cbet2, somg2, comg2, salp2, calp2;
// sig2 = sig1 + sig12
ssig2 = this._ssig1 * csig12 + this._csig1 * ssig12;
csig2 = this._csig1 * csig12 - this._ssig1 * ssig12;
var dn2 = Math.sqrt(1 + this._k2 * m.sq(ssig2));
if (outmask & (g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE)) {
if (arcmode || Math.abs(this._f) > 0.01)
B12 = g.SinCosSeries(true, ssig2, csig2, this._C1a, g.nC1_);
AB1 = (1 + this._A1m1) * (B12 - this._B11);
}
// sin(bet2) = cos(alp0) * sin(sig2)
sbet2 = this._calp0 * ssig2;
// Alt: cbet2 = hypot(csig2, salp0 * ssig2);
cbet2 = m.hypot(this._salp0, this._calp0 * csig2);
if (cbet2 == 0)
// I.e., salp0 = 0, csig2 = 0. Break the degeneracy in this case
cbet2 = csig2 = g.tiny_;
// tan(omg2) = sin(alp0) * tan(sig2)
somg2 = this._salp0 * ssig2; comg2 = csig2; // No need to normalize
// tan(alp0) = cos(sig2)*tan(alp2)
salp2 = this._salp0; calp2 = this._calp0 * csig2; // No need to normalize
// omg12 = omg2 - omg1
omg12 = Math.atan2(somg2 * this._comg1 - comg2 * this._somg1,
comg2 * this._comg1 + somg2 * this._somg1);
if (outmask & g.DISTANCE)
vals.s12 = arcmode ? this._b * ((1 + this._A1m1) * sig12 + AB1) : s12_a12;
if (outmask & g.LONGITUDE) {
lam12 = omg12 + this._A3c *
( sig12 + (g.SinCosSeries(true, ssig2, csig2, this._C3a, g.nC3_-1)
- this._B31));
lon12 = lam12 / m.degree;
// Use AngNormalize2 because longitude might have wrapped multiple times.
lon12 = m.AngNormalize2(lon12);
vals.lon2 = m.AngNormalize(this._lon1 + lon12);
}
if (outmask & g.LATITUDE)
vals.lat2 = Math.atan2(sbet2, this._f1 * cbet2) / m.degree;
if (outmask & g.AZIMUTH)
// minus signs give range [-180, 180). 0- converts -0 to +0.
vals.azi2 = 0 - Math.atan2(-salp2, calp2) / m.degree;
if (outmask & (g.REDUCEDLENGTH | g.GEODESICSCALE)) {
var
B22 = g.SinCosSeries(true, ssig2, csig2, this._C2a, g.nC2_),
AB2 = (1 + this._A2m1) * (B22 - this._B21),
J12 = (this._A1m1 - this._A2m1) * sig12 + (AB1 - AB2);
if (outmask & g.REDUCEDLENGTH)
// Add parens around (_csig1 * ssig2) and (_ssig1 * csig2) to ensure
// accurate cancellation in the case of coincident points.
vals.m12 = this._b * (( dn2 * (this._csig1 * ssig2) -
this._dn1 * (this._ssig1 * csig2))
- this._csig1 * csig2 * J12);
if (outmask & g.GEODESICSCALE) {
var t = this._k2 * (ssig2 - this._ssig1) * (ssig2 + this._ssig1) /
(this._dn1 + dn2);
vals.M12 = csig12 + (t * ssig2 - csig2 * J12) * this._ssig1 / this._dn1;
vals.M21 = csig12 - (t * this._ssig1 - this._csig1 * J12) * ssig2 / dn2;
}
}
if (outmask & g.AREA) {
var
B42 = g.SinCosSeries(false, ssig2, csig2, this._C4a, g.nC4_);
var salp12, calp12;
if (this._calp0 == 0 || this._salp0 == 0) {
// alp12 = alp2 - alp1, used in atan2 so no need to normalized
salp12 = salp2 * this._calp1 - calp2 * this._salp1;
calp12 = calp2 * this._calp1 + salp2 * this._salp1;
// The right thing appears to happen if alp1 = +/-180 and alp2 = 0, viz
// salp12 = -0 and alp12 = -180. However this depends on the sign being
// attached to 0 correctly. The following ensures the correct behavior.
if (salp12 == 0 && calp12 < 0) {
salp12 = g.tiny_ * this._calp1;
calp12 = -1;
}
} else {
// tan(alp) = tan(alp0) * sec(sig)
// tan(alp2-alp1) = (tan(alp2) -tan(alp1)) / (tan(alp2)*tan(alp1)+1)
// = calp0 * salp0 * (csig1-csig2) / (salp0^2 + calp0^2 * csig1*csig2)
// If csig12 > 0, write
// csig1 - csig2 = ssig12 * (csig1 * ssig12 / (1 + csig12) + ssig1)
// else
// csig1 - csig2 = csig1 * (1 - csig12) + ssig12 * ssig1
// No need to normalize
salp12 = this._calp0 * this._salp0 *
(csig12 <= 0 ? this._csig1 * (1 - csig12) + ssig12 * this._ssig1 :
ssig12 * (this._csig1 * ssig12 / (1 + csig12) + this._ssig1));
calp12 = m.sq(this._salp0) + m.sq(this._calp0) * this._csig1 * csig2;
}
vals.S12 = this._c2 * Math.atan2(salp12, calp12) +
this._A4 * (B42 - this._B41);
}
vals.a12 = arcmode ? s12_a12 : sig12 / m.degree;
return vals;
}
})();

View File

@ -0,0 +1,257 @@
/**
* Interface.js
* JavaScript interface routines for the geodesic routines GeographicLib.
*
* This provides JavaScript-style interfaces to Math.js, Geodesic.js,
* GeodesicLine.js, and PolygonArea.js which, in turn, are rather
* literal translations of the following classes from GeographicLib:
* Math, Accumulator, Geodesic, GeodesicLine, PolygonArea. See the
* documentation for the C++ class for more information at
*
* http://geographiclib.sourceforge.net/html/annotated.html
*
* The algorithms are derived in
*
* Charles F. F. Karney,
* Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);
* http://dx.doi.org/10.1007/s00190-012-0578-z
* Addenda: http://geographiclib.sf.net/geod-addenda.html
*
* Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed
* under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************
* GeographicLib.Geodesic.WGS84.Inverse(lat1, lon1, lat2, lon2, outmask);
* GeographicLib.Geodesic.WGS84.Direct(lat1, lon1, azi1, s12, outmask);
*
* perform the basic geodesic calculations. These return an object with
* (some) of the following fields:
*
* lat1 latitude of point 1
* lon1 longitude of point 1
* azi1 azimuth of line at point 1
* lat2 latitude of point 2
* lon2 longitude of point 2
* azi2 azimuth of line at point 2
* s12 distance from 1 to 2
* a12 arc length on auxiliary sphere from 1 to 2
* m12 reduced length of geodesic
* M12 geodesic scale 2 relative to 1
* M21 geodesic scale 1 relative to 2
* S12 area between geodesic and equator
*
* outmask determines which fields get included and if outmask is
* omitted, then only the basic geodesic fields are computed. The mask
* is an or'ed combination of the following values
*
* GeographicLib.Geodesic.LATITUDE
* GeographicLib.Geodesic.LONGITUDE
* GeographicLib.Geodesic.AZIMUTH
* GeographicLib.Geodesic.DISTANCE
* GeographicLib.Geodesic.REDUCEDLENGTH
* GeographicLib.Geodesic.GEODESICSCALE
* GeographicLib.Geodesic.AREA
* GeographicLib.Geodesic.ALL
*
**********************************************************************
* GeographicLib.Geodesic.WGS84.InversePath(lat1, lon1, lat2, lon2, ds12, maxk);
* GeographicLib.Geodesic.WGS84.DirectPath(lat1, lon1, azi1, s12, ds12, maxk);
*
* splits a geodesic line into k equal pieces which are no longer than
* about ds12 (but k cannot exceed maxk, default 20), and returns an
* array of length k + 1 of objects with fields
*
* lat, lon, azi
*
**********************************************************************
* GeographicLib.Geodesic.Envelope(lat1, lon1, azi1, s12, k)
*
* return the geodesic circle of radius s12 centered on the point lat1,
* lon1. k equally spaced azimuths starting at azi1 are computed. This
* returns an array of k + 1 points with fields lat and lon (with the
* first and last points matching).
*
**********************************************************************
* GeographicLib.Geodesic.Envelope(lat1, lon1, k, ord);
*
* returns the ord'th order envelope for geodesics emanating from lat1,
* lon1. This is located approximately circumference * ord/2 from the
* point. Thus odd numbered envelopes are centered at the antipodal
* point and even number envelopes are centered on the point itself.
* This returns an array of k + 1 points with fields lat and lon (with
* the first and last points matching).
*
**********************************************************************
* GeographicLib.Geodesic.WGS84.Area(points, polyline);
*
* computes the area of a polygon with vertices given by an array
* points, each of whose elements contains lat and lon fields. The
* function returns an object with fields.
*
* number, perimeter, area
*
* There is no need to "close" the polygon. If polyline (default =
* false) is true, then the points denote a polyline and its length is
* returned as the perimeter (and the area is not calculated).
**********************************************************************/
(function() {
var m = GeographicLib.Math;
var g = GeographicLib.Geodesic;
var l = GeographicLib.GeodesicLine;
g.Geodesic.CheckPosition = function(lat, lon) {
if (!(Math.abs(lat) <= 90))
throw new Error("latitude " + lat + " not in [-90, 90]");
if (!(lon >= -540 && lon < 540))
throw new Error("longitude " + lon + " not in [-540, 540)");
return m.AngNormalize(lon);
}
g.Geodesic.CheckAzimuth = function(azi) {
if (!(azi >= -540 && azi < 540))
throw new Error("longitude " + azi + " not in [-540, 540)");
return m.AngNormalize(azi);
}
g.Geodesic.CheckDistance = function(s) {
if (!(isFinite(s)))
throw new Error("distance " + s + " not a finite number");
}
g.Geodesic.prototype.Inverse = function(lat1, lon1, lat2, lon2, outmask) {
if (!outmask) outmask = g.DISTANCE | g.AZIMUTH;
lon1 = g.Geodesic.CheckPosition(lat1, lon1);
lon2 = g.Geodesic.CheckPosition(lat2, lon2);
var result = this.GenInverse(lat1, lon1, lat2, lon2, outmask);
result.lat1 = lat1; result.lon1 = lon1;
result.lat2 = lat2; result.lon2 = lon2;
return result;
}
g.Geodesic.prototype.Direct = function(lat1, lon1, azi1, s12, outmask) {
if (!outmask) outmask = g.LATITUDE | g.LONGITUDE | g.AZIMUTH;
lon1 = g.Geodesic.CheckPosition(lat1, lon1);
azi1 = g.Geodesic.CheckAzimuth(azi1);
g.Geodesic.CheckDistance(s12);
var result = this.GenDirect(lat1, lon1, azi1, false, s12, outmask);
result.lat1 = lat1; result.lon1 = lon1;
result.azi1 = azi1; result.s12 = s12;
return result;
}
g.Geodesic.prototype.InversePath =
function(lat1, lon1, lat2, lon2, ds12, maxk) {
var t = this.Inverse(lat1, lon1, lat2, lon2);
if (!maxk) maxk = 20;
if (!(ds12 > 0))
throw new Error("ds12 must be a positive number")
var
k = Math.max(1, Math.min(maxk, Math.ceil(t.s12/ds12))),
points = new Array(k + 1);
points[0] = {lat: t.lat1, lon: t.lon1, azi: t.azi1};
points[k] = {lat: t.lat2, lon: t.lon2, azi: t.azi2};
if (k > 1) {
var line = new l.GeodesicLine(this, t.lat1, t.lon1, t.azi1,
g.LATITUDE | g.LONGITUDE | g.AZIMUTH),
da12 = t.a12/k;
var vals;
for (var i = 1; i < k; ++i) {
vals =
line.GenPosition(true, i * da12, g.LATITUDE | g.LONGITUDE | g.AZIMUTH);
points[i] = {lat: vals.lat2, lon: vals.lon2, azi: vals.azi2};
}
}
return points;
}
g.Geodesic.prototype.DirectPath =
function(lat1, lon1, azi1, s12, ds12, maxk) {
var t = this.Direct(lat1, lon1, azi1, s12);
if (!maxk) maxk = 20;
if (!(ds12 > 0))
throw new Error("ds12 must be a positive number")
var
k = Math.max(1, Math.min(maxk, Math.ceil(Math.abs(t.s12)/ds12))),
points = new Array(k + 1);
points[0] = {lat: t.lat1, lon: t.lon1, azi: t.azi1};
points[k] = {lat: t.lat2, lon: t.lon2, azi: t.azi2};
if (k > 1) {
var line = new l.GeodesicLine(this, t.lat1, t.lon1, t.azi1,
g.LATITUDE | g.LONGITUDE | g.AZIMUTH),
da12 = t.a12/k;
var vals;
for (var i = 1; i < k; ++i) {
vals =
line.GenPosition(true, i * da12, g.LATITUDE | g.LONGITUDE | g.AZIMUTH);
points[i] = {lat: vals.lat2, lon: vals.lon2, azi: vals.azi2};
}
}
return points;
}
g.Geodesic.prototype.Circle = function(lat1, lon1, azi1, s12, k) {
if (!(Math.abs(lat1) <= 90))
throw new Error("lat1 must be in [-90, 90]");
if (!(lon1 >= -540 && lon1 < 540))
throw new Error("lon1 must be in [-540, 540)");
if (!(azi1 >= -540 && azi1 < 540))
throw new Error("azi1 must be in [-540, 540)");
if (!(isFinite(s12)))
throw new Error("s12 must be a finite number");
lon1 = m.AngNormalize(lon1);
azi1 = m.AngNormalize(azi1);
if (!k || k < 4) k = 24;
var points = new Array(k + 1);
var vals;
for (var i = 0; i <= k; ++i) {
var azi1a = azi1 + (k - i) * 360 / k; // Traverse circle counter-clocwise
if (azi1a >= 180) azi1a -= 360;
vals =
this.GenDirect(lat1, lon1, azi1a, false, s12, g.LATITUDE | g.LONGITUDE);
points[i] = {lat: vals.lat2, lon: vals.lon2};
}
return points;
}
g.Geodesic.prototype.Envelope = function(lat1, lon1, k, ord) {
if (!(Math.abs(lat1) <= 90))
throw new Error("lat1 must be in [-90, 90]");
if (!(lon1 >= -540 && lon1 < 540))
throw new Error("lon1 must be in [-540, 540)");
lon1 = m.AngNormalize(lon1);
if (!k || k < 4) k = 24;
if (!ord) ord = 1;
var points = new Array(k + 1);
var vals, line, s12, j;
for (var i = 0; i <= k; ++i) {
var azi1 = -180 + i * 360 / k;
line = new l.GeodesicLine(this, lat1, lon1, azi1,
g.LATITUDE | g.LONGITUDE | g.DISTANCE_IN |
g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE);
vals = line.GenPosition(true, 180 * ord,
g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE);
j = 0;
while (true) {
// Solve m12(s12) = 0 by Newton's method using dm12/ds12 = M21
s12 = vals.s12 - vals.m12/vals.M21;
if (Math.abs(vals.m12) < line._a * g.tol2_ * 0.1 || ++j > 10)
break;
vals = line.GenPosition(false, s12,
g.DISTANCE | g.REDUCEDLENGTH | g.GEODESICSCALE);
}
vals = line.GenPosition(false, s12, g.LATITUDE | g.LONGITUDE);
points[i] = {lat: vals.lat2, lon: vals.lon2};
}
return points;
}
g.Geodesic.prototype.Area = function(points, polyline) {
return GeographicLib.PolygonArea.Area(this, points, polyline);
}
})();

View File

@ -0,0 +1,172 @@
/**
* Math.js
* Transcription of Math.hpp, Constants.hpp, and Accumulator.hpp into
* JavaScript.
*
* Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed
* under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
var GeographicLib; if (!GeographicLib) GeographicLib = {};
GeographicLib.Math = {};
GeographicLib.Math.sq = function(x) { return x * x; }
GeographicLib.Math.hypot = function(x, y) {
x = Math.abs(x);
y = Math.abs(y);
var a = Math.max(x, y), b = Math.min(x, y) / (a ? a : 1);
return a * Math.sqrt(1 + b * b);
}
GeographicLib.Math.cbrt = function(x) {
var y = Math.pow(Math.abs(x), 1/3);
return x < 0 ? -y : y;
}
GeographicLib.Math.log1p = function(x) {
var
y = 1 + x,
z = y - 1;
// Here's the explanation for this magic: y = 1 + z, exactly, and z
// approx x, thus log(y)/z (which is nearly constant near z = 0) returns
// a good approximation to the true log(1 + x)/x. The multiplication x *
// (log(y)/z) introduces little additional error.
return z == 0 ? x : x * Math.log(y) / z;
}
GeographicLib.Math.atanh = function(x) {
var y = Math.abs(x); // Enforce odd parity
y = GeographicLib.Math.log1p(2 * y/(1 - y))/2;
return x < 0 ? -y : y;
}
GeographicLib.Math.sum = function(u, v) {
var
s = u + v,
up = s - v,
vpp = s - up;
up -= u;
vpp -= v;
t = -(up + vpp);
// u + v = s + t
// = round(u + v) + t
return {s: s, t: t};
}
GeographicLib.Math.AngNormalize = function(x) {
// Place angle in [-180, 180). Assumes x is in [-540, 540).
return x >= 180 ? x - 360 : (x < -180 ? x + 360 : x);
}
GeographicLib.Math.AngNormalize2 = function(x) {
// Place arbitrary angle in [-180, 180).
return GeographicLib.Math.AngNormalize(x % 360);
}
GeographicLib.Math.AngDiff = function(x, y) {
// Compute y - x and reduce to [-180,180] accurately.
// This is the same logic as the Accumulator class uses.
var
d = y - x,
yp = d + x,
xpp = yp - d;
yp -= y;
xpp -= x;
var t = xpp - yp;
// y - x = d + t
// = round(y - x) + t
if ((d - 180) + t > 0) // y - x > 180
d -= 360; // exact
else if ((d + 180) + t <= 0) // y - x <= -180
d += 360; // exact
return d + t;
}
GeographicLib.Math.epsilon = Math.pow(0.5, 52);
GeographicLib.Math.degree = Math.PI/180;
GeographicLib.Math.digits = 53;
GeographicLib.Constants = {};
GeographicLib.Constants.WGS84 = { a: 6378137, f: 1/298.257223563 };
GeographicLib.Accumulator = {};
(function() {
a = GeographicLib.Accumulator;
var m = GeographicLib.Math;
a.Accumulator = function(y) {
this.Set(y);
}
a.Accumulator.prototype.Set = function(y) {
if (!y) y = 0;
if (y.constructor == a.Accumulator) {
this._s = y._s;
this._t = y._t;
} else {
this._s = y;
this._t = 0;
}
}
a.Accumulator.prototype.Add = function(y) {
// Here's Shewchuk's solution...
// Accumulate starting at least significant end
var u = m.sum(y, this._t);
var v = m.sum(u.s, this._s);
u = u.t;
this._s = v.s;
this._t = v.t;
// Start is _s, _t decreasing and non-adjacent. Sum is now (s + t + u)
// exactly with s, t, u non-adjacent and in decreasing order (except
// for possible zeros). The following code tries to normalize the
// result. Ideally, we want _s = round(s+t+u) and _u = round(s+t+u -
// _s). The follow does an approximate job (and maintains the
// decreasing non-adjacent property). Here are two "failures" using
// 3-bit floats:
//
// Case 1: _s is not equal to round(s+t+u) -- off by 1 ulp
// [12, -1] - 8 -> [4, 0, -1] -> [4, -1] = 3 should be [3, 0] = 3
//
// Case 2: _s+_t is not as close to s+t+u as it shold be
// [64, 5] + 4 -> [64, 8, 1] -> [64, 8] = 72 (off by 1)
// should be [80, -7] = 73 (exact)
//
// "Fixing" these problems is probably not worth the expense. The
// representation inevitably leads to small errors in the accumulated
// values. The additional errors illustrated here amount to 1 ulp of
// the less significant word during each addition to the Accumulator
// and an additional possible error of 1 ulp in the reported sum.
//
// Incidentally, the "ideal" representation described above is not
// canonical, because _s = round(_s + _t) may not be true. For
// example, with 3-bit floats:
//
// [128, 16] + 1 -> [160, -16] -- 160 = round(145).
// But [160, 0] - 16 -> [128, 16] -- 128 = round(144).
//
if (this._s == 0) // This implies t == 0,
this._s = u; // so result is u
else
this._t += u; // otherwise just accumulate u to t.
}
a.Accumulator.prototype.Sum = function(y) {
if (!y)
return this._s;
else {
var b = new a.Accumulator(this);
b.Add(y);
return b._s;
}
}
a.Accumulator.prototype.Negate = function() {
this._s *= -1;
this._t *= -1;
}
})();

View File

@ -0,0 +1,241 @@
/**
* PolygonArea.js
* Transcription of PolygonArea.[ch]pp into JavaScript.
*
* See the documentation for the C++ class. The conversion is a literal
* conversion from C++.
*
* The algorithms are derived in
*
* Charles F. F. Karney,
* Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);
* http://dx.doi.org/10.1007/s00190-012-0578-z
* Addenda: http://geographiclib.sf.net/geod-addenda.html
*
* Copyright (c) Charles Karney (2011-2013) <charles@karney.com> and licensed
* under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
// Load AFTER GeographicLib/Math.js and GeographicLib/Geodesic.js
GeographicLib.PolygonArea = {};
(function() {
var m = GeographicLib.Math;
var a = GeographicLib.Accumulator;
var g = GeographicLib.Geodesic;
var p = GeographicLib.PolygonArea;
p.transit = function(lon1, lon2) {
// Return 1 or -1 if crossing prime meridian in east or west direction.
// Otherwise return zero.
// Compute lon12 the same way as Geodesic::Inverse.
lon1 = m.AngNormalize(lon1);
lon2 = m.AngNormalize(lon2);
var lon12 = m.AngDiff(lon1, lon2);
var cross =
lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 :
(lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0);
return cross;
}
p.PolygonArea = function(earth, polyline) {
this._earth = earth;
this._area0 = 4 * Math.PI * earth._c2;
this._polyline = !polyline ? false : polyline;
this._mask = g.LATITUDE | g.LONGITUDE | g.DISTANCE |
(this._polyline ? g.NONE : g.AREA);
if (!this._polyline)
this._areasum = new a.Accumulator(0);
this._perimetersum = new a.Accumulator(0);
this.Clear();
}
p.PolygonArea.prototype.Clear = function() {
this._num = 0;
this._crossings = 0;
if (!this._polyline)
this._areasum.Set(0);
this._perimetersum.Set(0);
this._lat0 = this._lon0 = this._lat1 = this._lon1 = Number.NaN;
}
p.PolygonArea.prototype.AddPoint = function(lat, lon) {
if (this._num == 0) {
this._lat0 = this._lat1 = lat;
this._lon0 = this._lon1 = lon;
} else {
var t = this._earth.Inverse(this._lat1, this._lon1, lat, lon, this._mask);
this._perimetersum.Add(t.s12);
if (!this._polyline) {
this._areasum.Add(t.S12);
this._crossings += p.transit(this._lon1, lon);
}
this._lat1 = lat;
this._lon1 = lon;
}
++this._num;
}
p.PolygonArea.prototype.AddEdge = function(azi, s) {
if (this._num) {
var t = this._earth.Direct(this._lat1, this._lon1, azi, s, this._mask);
this._perimetersum.Add(s);
if (!this._polyline) {
this._areasum.Add(t.S12);
this._crossings += p.transit(this._lon1, t.lon2);
}
this._lat1 = t.lat2;
this._lon1 = t.lon2;
}
++this._num;
}
// return number, perimeter, area
p.PolygonArea.prototype.Compute = function(reverse, sign) {
var vals = {number: this._num};
if (this._num < 2) {
vals.perimeter = 0;
if (!this._polyline)
vals.area = 0;
return vals;
}
if (this._polyline) {
vals.perimeter = this._perimetersum.Sum();
return vals;
}
var t = this._earth.Inverse(this._lat1, this._lon1, this._lat0, this._lon0,
this._mask);
vals.perimeter = this._perimetersum.Sum(t.s12);
var tempsum = new a.Accumulator(this._areasum);
tempsum.Add(t.S12);
var crossings = this._crossings + p.transit(this._lon1, this._lon0);
if (crossings & 1)
tempsum.Add( (tempsum.Sum() < 0 ? 1 : -1) * this._area0/2 );
// area is with the clockwise sense. If !reverse convert to
// counter-clockwise convention.
if (!reverse)
tempsum.Negate();
// If sign put area in (-area0/2, area0/2], else put area in [0, area0)
if (sign) {
if (tempsum.Sum() > this._area0/2)
tempsum.Add( -this._area0 );
else if (tempsum.Sum() <= -this._area0/2)
tempsum.Add( +this._area0 );
} else {
if (tempsum.Sum() >= this._area0)
tempsum.Add( -this._area0 );
else if (tempsum < 0)
tempsum.Add( -this._area0 );
}
vals.area = tempsum.Sum();
return vals;
}
// return number, perimeter, area
p.PolygonArea.prototype.TestPoint = function(lat, lon, reverse, sign) {
var vals = {number: this._num + 1};
if (this._num == 0) {
vals.perimeter = 0;
if (!this._polyline)
vals.area = 0;
return vals;
}
vals.perimeter = this._perimetersum.Sum();
var tempsum = this._polyline ? 0 : this._areasum.Sum();
var crossings = this._crossings;
var t;
for (var i = 0; i < (this._polyline ? 1 : 2); ++i) {
t = this._earth.Inverse
(i == 0 ? this._lat1 : lat, i == 0 ? this._lon1 : lon,
i != 0 ? this._lat0 : lat, i != 0 ? this._lon0 : lon,
this._mask);
vals.perimeter += t.s12;
if (!this._polyline) {
tempsum += t.S12;
crossings += p.transit(i == 0 ? this._lon1 : lon,
i != 0 ? this._lon0 : lon);
}
}
if (this._polyline)
return vals;
if (crossings & 1)
tempsum += (tempsum < 0 ? 1 : -1) * this._area0/2;
// area is with the clockwise sense. If !reverse convert to
// counter-clockwise convention.
if (!reverse)
tempsum *= -1;
// If sign put area in (-area0/2, area0/2], else put area in [0, area0)
if (sign) {
if (tempsum > this._area0/2)
tempsum -= this._area0;
else if (tempsum <= -this._area0/2)
tempsum += this._area0;
} else {
if (tempsum >= this._area0)
tempsum -= this._area0;
else if (tempsum < 0)
tempsum += this._area0;
}
vals.area = tempsum;
return vals;
}
// return number, perimeter, area
p.PolygonArea.prototype.TestEdge = function(azi, s, reverse, sign) {
var vals = {number: this._num ? this._num + 1 : 0};
if (this._num == 0)
return vals;
vals.perimeter = this._perimetersum.Sum() + s;
if (this._polyline)
return vals;
var tempsum = this._areasum.Sum();
var crossings = this._crossings;
var t;
t = this._earth.Direct(this._lat1, this._lon1, azi, s, this._mask);
tempsum += t.S12;
crossings += p.transit(this._lon1, t.lon2);
t = this._earth(t.lat2, t.lon2, this._lat0, this._lon0, this._mask);
perimeter += t.s12;
tempsum += t.S12;
crossings += p.transit(t.lon2, this._lon0);
if (crossings & 1)
tempsum += (tempsum < 0 ? 1 : -1) * this._area0/2;
// area is with the clockwise sense. If !reverse convert to
// counter-clockwise convention.
if (!reverse)
tempsum *= -1;
// If sign put area in (-area0/2, area0/2], else put area in [0, area0)
if (sign) {
if (tempsum > this._area0/2)
tempsum -= this._area0;
else if (tempsum <= -this._area0/2)
tempsum += this._area0;
} else {
if (tempsum >= this._area0)
tempsum -= this._area0;
else if (tempsum < 0)
tempsum += this._area0;
}
vals.area = tempsum;
return vals;
}
p.PolygonArea.prototype.CurrentPoint = function() {
var vals = {lat: this._lat1, lon: this._lon1};
return vals;
}
p.Area = function(earth, points, polyline) {
var poly = new p.PolygonArea(earth, polyline);
for (var i = 0; i < points.length; ++i)
poly.AddPoint(points[i].lat, points[i].lon);
return poly.Compute(false, true);
}
})();

View File

@ -0,0 +1,471 @@
<!DOCTYPE html>
<html>
<head>
<title>Geodesic calculations for an ellipsoid done right</title>
<meta name="description"
content="Geodesic calculations for an ellipsoid done right" />
<meta name="author" content="Charles F. F. Karney">
<meta name="keywords"
content="geodesics,
geodesic distance,
geographic distance,
shortest path,
direct geodesic problem,
inverse geodesic problem,
distance and azimuth,
distance and heading,
range and bearing,
geographic area,
geodesic polygon,
spheroidal triangle,
latitude and longitude,
online calculator,
WGS84 ellipsoid,
GeographicLib" />
<script type="text/javascript"
src="http://geographiclib.sf.net/scripts/geographiclib.js">
</script>
<script type="text/javascript">
<!--
var geod = GeographicLib.Geodesic.WGS84;
var dms = GeographicLib.DMS;
function formatpoint(lat, lon, azi, dmsformat, prec) {
prec += 5;
if (dmsformat) {
var trail = prec < 2 ? dms.DEGREE :
(prec < 4 ? dms.MINUTE : dms.SECOND);
prec = prec < 2 ? prec : (prec < 4 ? prec - 2 : prec - 4);
return (dms.Encode(lat, trail, prec, dms.LATITUDE) + " " +
dms.Encode(lon, trail, prec, dms.LONGITUDE) + " " +
dms.Encode(azi, trail, prec, dms.AZIMUTH));
} else {
return (lat.toFixed(prec) + " " +
lon.toFixed(prec) + " " +
azi .toFixed(prec));
}
}
function GeodesicInverse(input, dmsformat, prec) {
var result = {};
try {
// Input is a blank-delimited line: lat1 lon1 lat2 lon2
var t = new String(input);
t = t.replace(/^\s+/,"").replace(/\s+$/,"").split(/[\s,]+/,6);
if (t.length != 4)
throw new Error("Need 4 input items");
var p1 = GeographicLib.DMS.DecodeLatLon(t[0], t[1]);
var p2 = GeographicLib.DMS.DecodeLatLon(t[2], t[3]);
t = geod.Inverse(p1.lat, p1.lon, p2.lat, p2.lon);
result.status = "OK";
result.p1 = formatpoint(t.lat1, t.lon1, t.azi1, dmsformat, prec);
result.p2 = formatpoint(t.lat2, t.lon2, t.azi2, dmsformat, prec);
result.s12 = t.s12.toFixed(prec);
}
catch (e) {
result.status = "ERROR: " + e.message;
result.p1 = "";
result.p2 = "";
result.s12 = "";
}
return result;
}
function GeodesicDirect(input, dmsformat, prec) {
var result = {};
try {
// Input is a blank-delimited line: lat1 lon1 azi1 s12
var t = new String(input);
t = t.replace(/^\s+/,"").replace(/\s+$/,"").split(/[\s,]+/,6);
if (t.length != 4)
throw new Error("Need 4 input items");
var p1 = GeographicLib.DMS.DecodeLatLon(t[0], t[1]);
var azi1 = GeographicLib.DMS.DecodeAzimuth(t[2]);
var s12 = parseFloat(t[3]);
t = geod.Direct(p1.lat, p1.lon, azi1, s12);
result.status = "OK";
result.p1 = formatpoint(t.lat1, t.lon1, t.azi1, dmsformat, prec);
result.p2 = formatpoint(t.lat2, t.lon2, t.azi2, dmsformat, prec);
result.s12 = t.s12.toFixed(prec);
}
catch (e) {
result.status = "ERROR: " + e.message;
result.p1 = "";
result.p2 = "";
result.s12 = "";
}
return result;
}
function GeodesicInversePath(input, dmsformat, prec) {
var result = {};
try {
// Input is a blank-delimited line: lat1 lon1 lat2 lon2 ds12 maxnum
var t = new String(input);
t = t.replace(/^\s+/,"").replace(/\s+$/,"").split(/[\s,]+/,8);
if (t.length != 6)
throw new Error("Need 6 input items");
var p1 = GeographicLib.DMS.DecodeLatLon(t[0], t[1]);
var p2 = GeographicLib.DMS.DecodeLatLon(t[2], t[3]);
var ds12 = parseFloat(t[4]);
var maxnum = parseInt(t[5]);
var t = new String(input);
t = t.split(/[\s,]+/,8);
if (t[0] == "") t.shift();
t = geod.InversePath(p1.lat, p1.lon, p2.lat, p2.lon, ds12, maxnum);
result.status = "OK";
result.points = ""
for (var i = 0; i < t.length; ++i)
result.points +=
formatpoint(t[i].lat, t[i].lon, t[i].azi, dmsformat, prec) + "\n";
}
catch (e) {
result.status = "ERROR: " + e.message;
result.points = "";
}
return result;
}
function GeodesicArea(input, polyline) {
var result = {};
try {
// Input is a newline-delimited points;
// each point is blank-delimited: lat lon
var t = new String(input);
t = t.split(/[\r\n]/);
if (t[0] == "") t.shift();
if (t[t.length-1] == "") t.pop();
for (var i = 0; i < t.length; ++i) {
var pos = t[i].replace(/^\s+/,"").replace(/\s+$/,"").split(/[\s,]+/,4);
if (pos.length != 2)
throw new Error("Need 2 items on each line");
t[i] = dms.DecodeLatLon(pos[0], pos[1]);
}
t = geod.Area(t, polyline);
result.status = "OK";
result.area = t.number + " " +
t.perimeter.toFixed(8);
if (!polyline)
result.area += " " + t.area.toFixed(2);
}
catch (e) {
result.status = "ERROR: " + e.message;
result.area = "";
}
return result;
}
//-->
</script>
</head>
<body>
<div>
<h2>Geodesic calculations for an ellipsoid done right</h2>
</div>
<p>
This page illustrates the geodesic routines available in
<a href="http://geographiclib.sourceforge.net">GeographicLib</a>.
The C++ code has been converted to JavaScript so the calculations
are carried out on the client. The algorithms are considerably
more accurate than Vincenty's method, and offer more functionality
(an inverse method which never fails to converge, differential
properties of the geodesic, and the area under a geodesic). The
algorithms are derived in
<blockquote>
Charles F. F. Karney,<br>
<a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
<i>Algorithms for geodesics</i></a>,<br>
J. Geodesy <b>87</b>(1), 43&ndash;55 (Jan. 2013);<br>
DOI:
<a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
10.1007/s00190-012-0578-z</a>
(<a href="http://dx.doi.org/10.1007/s00190-012-0578-z">pdf</a>);
addenda: <a href="http://geographiclib.sf.net/geod-addenda.html">
geod-addenda.html</a>.
</blockquote>
This page just provides a basic interface. Enter latitudes,
longitudes, and azimuths as degrees and distances as meters using
spaces or commas as separators. (Angles may be entered as decimal
degrees or as degrees, minutes, and seconds, e.g. -20.51125,
20&deg;30&prime;40.5&Prime;S, S20d30'40.5&quot;, or
-20:30:40.5.) The results are accurate to about
15&nbsp;nanometers (or 0.1&nbsp;m<sup>2</sup> per vertex for
areas). A slicker page where the geodesics are incorporated into
Google Maps is given <a href="geod-google.html">here</a>.
<p>
Jump to:
<ul>
<li><a href="#inverse">Inverse problem</a></li>
<li><a href="#direct">Direct problem</a></li>
<li><a href="#path">Geodesic path</a></li>
<li><a href="#area">Polygon area</a></li>
<li><a href="geod-google.html">Geodesic lines, circles, and
envelopes in Google Maps</a></li>
</ul>
</p>
<hr>
<form name="inverse" >
<h3><a class="anchor" id="inverse">Inverse problem</h3>
<p>
Find the shortest path between two points on the earth. The
path is characterized by its length <i>s12</i> and its azimuth
at the two ends <i>azi1</i> and <i>azi2</i>. The sample
calculation finds the shortest path between Wellington, New
Zealand, and Salamanca, Spain. (For this example, the
<a href="http://www.ngs.noaa.gov/">NGS</a>
<a href="http://www.ngs.noaa.gov/cgi-bin/Inv_Fwd/inverse2.prl">
inverse geodesic calculator</a> returns a result which is 1.2 km
too long with an azimuth which is off by 3 degrees.) To perform
the calculation, press the &ldquo;COMPUTE&rdquo; button.
</p>
<p>Enter <i>&ldquo;lat1 lon1 lat2 lon2&rdquo;</i>:</p>
<p>input:
<input name="input" size=72 value="-41.32 174.81 40.96 -5.50" />
</p>
<p>
Output format:&nbsp;&nbsp;<label for="ig">
<input type="radio" value="g" name="format" id="ig" checked>
decimal degrees
</label>&nbsp;
<label for="id">
<input type="radio" value="d" name="format" id="id">
degrees minutes seconds
</label><br>
Output precision:&nbsp;&nbsp;<select name="prec" size=1>
<option value='0'> 1m 0.00001d 0.1"</option>
<option value='1'> 100mm 0.01"</option>
<option value='2'> 10mm 0.001"</option>
<option value='3' selected> 1mm 0.0001"</option>
<option value='4'> 100um 0.00001"</option>
<option value='5'> 10um 0.000001"</option>
<option value='6'> 1um 0.0000001"</option>
<option value='7'> 100nm 0.00000001"</option>
<option value='8'> 10nm 0.000000001"</option>
<option value='9'> 1nm 0.0000000001"</option>
</select>
</p>
<p>
<input type="button" value="COMPUTE"
onclick="var t = GeodesicInverse(document.inverse.input.value,
document.inverse.format[1].checked,
document.inverse.prec.selectedIndex);
document.inverse.status.value = t.status;
document.inverse.p1.value = t.p1;
document.inverse.p2.value = t.p2;
document.inverse.s12.value = t.s12;" />
</p>
<p>
status:
<input name="status" size=50 readonly />
</p>
<p>
lat1 lon1 <font color='blue'>azi1</font>:
<input name="p1" size=75 readonly />
</p>
<p>
lat2 lon2 <font color='blue'>azi2</font>:
<input name="p2" size=75 readonly />
</p>
<p>
<font color='blue'>s12</font>:
<input name="s12" size=25 readonly />
</p>
</form>
<hr>
<form name="direct">
<h3><a class="anchor" id="direct">Direct problem</h3>
<p>
Find the destination traveling a given distance along a geodesic
with a given azimuth at the starting point. The destination is
characterized by its position <i>lat2, lon2</i> and its azimuth
at the destination <i>azi2</i>. The sample calculation shows
the result of travelling 10000 km NE from JFK airport. To perform
the calculation, press the &ldquo;COMPUTE&rdquo; button.
</p>
<p>Enter <i>&ldquo;lat1 lon1 azi1 s12&rdquo;</i>:</p>
<p>input:
<input name="input" size=72 value="40.6 -73.8 45 10000e3" />
</p>
<p>
Output format:&nbsp;&nbsp;<label for="dg">
<input type="radio" value="g" name="format" id="dg" checked>
decimal degrees
</label>&nbsp;
<label for="dd">
<input type="radio" value="d" name="format" id="dd">
degrees minutes seconds
</label><br>
Output precision:&nbsp;&nbsp;<select name="prec" size=1>
<option value='0'> 1m 0.00001d 0.1"</option>
<option value='1'> 100mm 0.01"</option>
<option value='2'> 10mm 0.001"</option>
<option value='3' selected> 1mm 0.0001"</option>
<option value='4'> 100um 0.00001"</option>
<option value='5'> 10um 0.000001"</option>
<option value='6'> 1um 0.0000001"</option>
<option value='7'> 100nm 0.00000001"</option>
<option value='8'> 10nm 0.000000001"</option>
<option value='9'> 1nm 0.0000000001"</option>
</select>
</p>
<p>
<input type="button" value="COMPUTE"
onclick="var t = GeodesicDirect(document.direct.input.value,
document.direct.format[1].checked,
document.direct.prec.selectedIndex);
document.direct.status.value = t.status;
document.direct.p1.value = t.p1;
document.direct.p2.value = t.p2;
document.direct.s12.value = t.s12;" />
</p>
<p>
status:
<input name="status" size=50 readonly />
</p>
<p>
lat1 lon1 azi1:
<input name="p1" size=75 readonly />
</p>
<p>
<font color='blue'>lat2 lon2 azi2</font>:
<input name="p2" size=75 readonly />
</p>
<p>
s12:
<input name="s12" size=25 readonly />
</p>
</form>
<hr>
<form name="path">
<h3><a class="anchor" id="path">Geodesic path</h3>
<p>
Find intermediate points along a geodesic. In addition to
specifying the endpoints, give <i>ds12</i>, the maximum distance
between the intermediate points and <i>maxk</i>, the maximum
number of intervals the geodesic is broken into. The output
gives a sequence of positions <i>lat, lon</i> together with the
corresponding azimuths <i>azi</i>. The sample shows the path
from JFK to Singapore's Changi Airport at about 1000 km
intervals. (In this example, the path taken by Google Earth
deviates from the shortest path by about 2.9 km.) To perform
the calculation, press the &ldquo;COMPUTE&rdquo; button.
</p>
<p>Enter <i>&ldquo;lat1 lon1 lat2 lon2 ds12 maxk&rdquo;</i>:</p>
<p>input:
<input name="input" size=72 value="40.6 -73.8 1.4 104 1000e3 20" />
</p>
<p>
Output format:&nbsp;&nbsp;<label for="pg">
<input type="radio" value="g" name="format" id="pg" checked>
decimal degrees
</label>&nbsp;
<label for="pd">
<input type="radio" value="d" name="format" id="pd">
degrees minutes seconds
</label><br>
Output precision:&nbsp;&nbsp;<select name="prec" size=1>
<option value='0' selected> 1m 0.00001d 0.1"</option>
<option value='1'> 100mm 0.01"</option>
<option value='2'> 10mm 0.001"</option>
<option value='3'> 1mm 0.0001"</option>
<option value='4'> 100um 0.00001"</option>
<option value='5'> 10um 0.000001"</option>
<option value='6'> 1um 0.0000001"</option>
<option value='7'> 100nm 0.00000001"</option>
<option value='8'> 10nm 0.000000001"</option>
<option value='9'> 1nm 0.0000000001"</option>
</select>
</p>
<p>
<input type="button" value="COMPUTE"
onclick="var t = GeodesicInversePath(document.path.input.value,
document.path.format[1].checked,
document.path.prec.selectedIndex);
document.path.status.value = t.status;
document.path.points.value = t.points;" />
</p>
<p>
status:
<input name="status" size=50 readonly />
</p>
<p>
points (lat lon azi):<br>
<textarea name="points" cols=70 rows=21 readonly></textarea>
</p>
</form>
<hr>
<form name="area">
<h3><a class="anchor" id="area">Polygon area</h3>
<p>
Find the perimeter and area of a polygon whose sides are
geodesics. The polygon must be simple (i.e., must not intersect
itself). (There's no need to ensure that the polygon is
closed.) Counter-clockwise traversal of the polygon results in
a positive area. The polygon can encircle one or both poles.
The sample gives the approximate perimeter (in m) and area (in
m<sup>2</sup>) of Antarctica. (For this example, Google Earth
Pro returns an area which is 30 times too large! However this
is a little unfair, since Google Earth has no concept of
polygons which encircle a pole.) If the <i>polyline</i> option
is selected then just the length of the line joining the points
is is returned. To perform the calculation, press the
&ldquo;COMPUTE&rdquo; button.
</p>
<p>Enter points, one per line, as <i>&ldquo;lat lon&rdquo;</i>:</p>
<p>points (lat lon):<br>
<textarea name="input" cols=36 rows=13>-63.1 -58
-72.9 -74
-71.9 -102
-74.9 -102
-74.3 -131
-77.5 -163
-77.4 163
-71.7 172
-65.9 140
-65.7 113
-66.6 88
-66.9 59
-69.8 25
-70.0 -4
-71.0 -14
-77.3 -33
-77.9 -46
-74.7 -61
</textarea>
</p>
<p>
Treat points as:&nbsp;&nbsp;<label for="lg">
<input type="radio" value="p" name="polyline" id="lg" checked>
polygon
</label>&nbsp;
<label for="ll">
<input type="radio" value="l" name="polyline" id="ll">
polyline
</label>
</p>
<p>
<input type="button" value="COMPUTE"
onclick="var t = GeodesicArea(document.area.input.value,
document.area.polyline[1].checked);
document.area.status.value = t.status;
document.area.area.value = t.area;" />
</p>
<p>
status:
<input name="status" size=50 readonly />
</p>
<p>
number perimeter area:
<input name="area" size=55 readonly />
</p>
</form>
<hr>
<address>Charles Karney
<a href="mailto:charles@karney.com">&lt;charles@karney.com&gt;</a>
(2011-08-04)</address>
<br>
<a href="http://geographiclib.sourceforge.net">
<img
src="http://sourceforge.net/sflogo.php?group_id=283628&amp;type=9"
border="0" height="15" width="80" alt="SourceForge.net" />
</a>
</body>
</html>

View File

@ -0,0 +1,118 @@
<!DOCTYPE html>
<html>
<head>
<title>
Geodesic lines, circles, envelopes in Google Maps (instructions)
</title>
<meta name="description"
content="Geodesic lines, circles,
envelopes in Google Maps (instructions)" />
<meta name="author" content="Charles F. F. Karney">
<meta name="keywords"
content="geodesics,
geodesic distance,
geographic distance,
shortest path,
direct geodesic problem,
inverse geodesic problem,
distance and azimuth,
distance and heading,
range and bearing,
geographic circle,
geodesic envelope,
geodesic astroid,
latitude and longitude,
Google Maps,
WGS84 ellipsoid,
GeographicLib" />
</head>
<body>
<h2>
Geodesic lines, circles, envelopes in Google Maps (instructions)
</h2>
<p>
The <a href="geod-google.html">page</a> allows you to draw
accurate ellipsoidal geodesics on Google Maps. You can specify the
geodesic in one of two forms:
<ul>
<li>
The <b>direct</b> problem: specify a starting point, an
azimuth and a distance as <i>lat1 lon1 azi1 s12</i> as degrees
and meters.
<li>
The <b>inverse</b> problem: specify the two end points
as <i>lat1 lon1 lat2 lon2</i> as degrees; this finds the
shortest path between the two points.
</ul>
(Angles may be entered as decimal degrees or as degrees, minutes,
and seconds, e.g. -20.51125, 20&deg;30&prime;40.5&Prime;S,
S20d30'40.5&quot;, or -20:30:40.5.) Click on the
corresponding "compute" button. The display then shows
<ul>
<li>The requested geodesic as a <font color="blue">blue
line</font>; the WGS84 ellipsoid model is used.
<li>The geodesic circle as a <font color="green">green
curve</font>; this shows the locus of points a
distance <i>s12</i> from <i>lat1, lon1</i>.
<li>The geodesic envelopes as <font color="red">red
curves</font>; all the geodesics emanating from <i>lat1,
lon1</i> are tangent to the envelopes (providing they are
extended far enough). The number of solutions to the inverse
problem changes depending on whether <i>lat2, lon2</i> lies
inside the envelopes. For example, there are four (resp. two)
approximately hemispheroidal geodesics if this point lies
inside (resp. outside) the inner envelope (only one of which
is a shortest path).
</ul>
</p>
<p>
The sample data has <i>lat1, lon1</i> in Wellington, New
Zealand, <i>lat2, lon2</i> in Salamanca, Spain, and <i>s12</i>
about 1.5 times the earth's circumference. Try clicking on the
"compute" button next to the "Direct:" input box when the page
first loads. You can navigate around the map using the normal
Google Map controls.
</p>
<p>
The precision of output for the geodesic is 0.1&quot; or 1&nbsp;m.
A text-only <a href="geod-calc.html">geodesic calculator</a> based
on the same JavaScript library is also available; this calculator
solves the inverse and direct geodesic problems, computes
intermediate points on a geodesic, and finds the area of a
geodesic polygon; it allows you to specify the precision of the
output and choose between decimal degrees and degress, minutes,
and seconds.
<p>
The Javascipt code for computing the geodesic lines, circles, and
envelopes is part of
<a href="http://geographiclib.sourceforge.net/">GeographicLib</a>.
The algorithms are derived in
<blockquote>
Charles F. F. Karney,<br>
<a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
<i>Algorithms for geodesics</i></a>,<br>
J. Geodesy <b>87</b>(1), 43&ndash;55 (Jan. 2013);<br>
DOI:
<a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
10.1007/s00190-012-0578-z</a>
(<a href="http://dx.doi.org/10.1007/s00190-012-0578-z">pdf</a>);<br>
addenda: <a href="http://geographiclib.sf.net/geod-addenda.html">
geod-addenda.html</a>.
</blockquote>
In putting together this Google Maps demonstration, I started with
the sample code
<a href="http://code.google.com/apis/maps/documentation/javascript/examples/geometry-headings.html">
geometry-headings.html</a>.
</p>
<hr>
<address>Charles Karney
<a href="mailto:charles@karney.com">&lt;charles@karney.com&gt;</a>
(2011-08-02)</address>
<br>
<a href="http://geographiclib.sourceforge.net">
<img
src="http://sourceforge.net/sflogo.php?group_id=283628&amp;type=9"
border="0" height="15" width="80" alt="SourceForge.net" />
</a>
</body>
</html>

View File

@ -0,0 +1,221 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Geodesic lines, circles, envelopes in Google Maps</title>
<meta name="description"
content="Geodesic lines, circles, envelopes in Google Maps" />
<meta name="author" content="Charles F. F. Karney">
<meta name="keywords"
content="geodesics,
geodesic distance,
geographic distance,
shortest path,
direct geodesic problem,
inverse geodesic problem,
distance and azimuth,
distance and heading,
range and bearing,
geographic circle,
geodesic envelope,
geodesic astroid,
latitude and longitude,
Google Maps,
WGS84 ellipsoid,
GeographicLib" />
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript"
src="http://geographiclib.sf.net/scripts/geographiclib.js">
</script>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var geod = GeographicLib.Geodesic.WGS84;
var dms = GeographicLib.DMS;
var geodesic, circle, envelope;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(41.3, -5.5),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
var geodesicOptions = {
strokeColor: '#0000FF',
strokeOpacity: 1,
strokeWeight: 3,
geodesic: true
}
geodesic = new google.maps.Polyline(geodesicOptions);
geodesic.setMap(map);
var circleOptions = {
strokeColor: '#00FF00',
strokeOpacity: 1,
strokeWeight: 3,
geodesic: true
}
circle = new google.maps.Polyline(circleOptions);
circle.setMap(map);
var envelopeOptions = {
strokeColor: '#FF0000',
strokeOpacity: 1,
strokeWeight: 3,
geodesic: true
}
envelope = new Array(4);
for (var i = 0; i < 4; ++i) {
envelope[i] = new google.maps.Polyline(envelopeOptions);
envelope[i].setMap(map);
}
}
function formatpoint(lat, lon, azi, dmsformat, prec) {
prec += 5;
if (dmsformat) {
var trail = prec < 2 ? dms.DEGREE :
(prec < 4 ? dms.MINUTE : dms.SECOND);
prec = prec < 2 ? prec : (prec < 4 ? prec - 2 : prec - 4);
return (dms.Encode(lat, trail, prec, dms.LATITUDE) + " " +
dms.Encode(lon, trail, prec, dms.LONGITUDE) + " " +
dms.Encode(azi, trail, prec, dms.AZIMUTH));
} else {
return (lat.toFixed(prec) + " " +
lon.toFixed(prec) + " " +
azi .toFixed(prec));
}
}
function GeodesicInverse(input) {
var result = {};
try {
// Input is a blank-delimited line: lat1 lon1 lat2 lon2
var t = new String(input);
t = t.replace(/^\s+/,"").replace(/\s+$/,"").split(/[\s,]+/,6);
if (t.length != 4)
throw new Error("Need 4 input items");
var p1 = GeographicLib.DMS.DecodeLatLon(t[0], t[1]);
var p2 = GeographicLib.DMS.DecodeLatLon(t[2], t[3]);
var v = geod.Inverse(p1.lat, p1.lon, p2.lat, p2.lon);
result.status = "OK";
result.p1 = formatpoint(v.lat1, v.lon1, v.azi1, true, 0);
result.p2 = formatpoint(v.lat2, v.lon2, v.azi2, true, 0);
result.s12 = v.s12.toFixed(0);
draw(v);
}
catch (e) {
result.status = "ERROR: " + e.message;
result.p1 = "";
result.p2 = "";
result.s12 = "";
}
return result;
}
function GeodesicDirect(input) {
var result = {};
try {
// Input is a blank-delimited line: lat1 lon1 azi1 s12
var t = new String(input);
t = t.replace(/^\s+/,"").replace(/\s+$/,"").split(/[\s,]+/,6);
if (t.length != 4)
throw new Error("Need 4 input items");
var p1 = GeographicLib.DMS.DecodeLatLon(t[0], t[1]);
var azi1 = GeographicLib.DMS.DecodeAzimuth(t[2]);
var s12 = parseFloat(t[3]);
var v = geod.Direct(p1.lat, p1.lon, azi1, s12);
result.status = "OK";
result.p1 = formatpoint(v.lat1, v.lon1, v.azi1, true, 0);
result.p2 = formatpoint(v.lat2, v.lon2, v.azi2, true, 0);
result.s12 = v.s12.toFixed(0);
draw(v);
}
catch (e) {
result.status = "ERROR: " + e.message;
result.p1 = "";
result.p2 = "";
result.s12 = "";
}
return result;
}
function draw(v) {
var points = geod.DirectPath(v.lat1, v.lon1, v.azi1, v.s12,
100000, 100);
clearPaths();
var i, k, path;
path = geodesic.getPath();
for (k = 0; k < points.length; ++k)
path.push(new google.maps.LatLng(points[k].lat, points[k].lon));
points = geod.Circle(v.lat1, v.lon1, v.azi1, v.s12, 72);
path = circle.getPath();
for (k = 0; k < points.length; ++k)
path.push(new google.maps.LatLng(points[k].lat, points[k].lon));
for (i = 0; i < 4; ++i) {
points = geod.Envelope(v.lat1, v.lon1, 72, i+1);
path = envelope[i].getPath();
for (k = 0; k < points.length; ++k)
path.push(new google.maps.LatLng(points[k].lat, points[k].lon));
}
map.panTo(new google.maps.LatLng(v.lat2, v.lon2));
}
function clearPaths() {
cPath = geodesic.getPath();
while (cPath.getLength()) cPath.pop();
cPath = circle.getPath();
while (cPath.getLength()) cPath.pop();
for (var i = 0; i < 4; ++i) {
cPath = envelope[i].getPath();
while (cPath.getLength()) cPath.pop();
}
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas"
style="position:relative; border: 1px solid black; width:99.5%;
height:72%;">
</div>
<div>
<p>
&nbsp;Direct:&nbsp;&nbsp;
<input id="inputb" size=60 value="41°19'S 174°49'E 135° 60000e3" />
<input type="button" value="compute"
onclick="var t = GeodesicDirect(document.getElementById('inputb').value);
document.getElementById('status').value = t.status;
document.getElementById('p1').value = t.p1;
document.getElementById('p2').value = t.p2;
document.getElementById('s12').value = t.s12;" />
</p>
<p>
&nbsp;Inverse:
<input id="inputa" size=60 value="41°19'S 174°49'E 40°58'N 5°30'W" />
<input type="button" value="compute"
onclick="var t = GeodesicInverse(document.getElementById('inputa').value);
document.getElementById('status').value = t.status;
document.getElementById('p1').value = t.p1;
document.getElementById('p2').value = t.p2;
document.getElementById('s12').value = t.s12;" />
</p>
<p>
&nbsp;lat1 lon1 azi1: <input type="text" "readonly" id="p1" size=60>
</p>
<p>
&nbsp;lat2 lon2 azi2: <input type="text" "readonly" id="p2" size=60>
</p>
<p>
&nbsp;s12: <input type="text" "readonly" id="s12" size=20>
&nbsp;&nbsp; status: <input "readonly" id="status" size=30>
&nbsp;&nbsp;
<a href="geod-google-instructions.html"><b>INSTRUCTIONS HERE</b></a>
</p>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
<html>
<head>
<title>GeographicLib-@PROJECT_VERSION@ utilities</title>
<meta HTTP-EQUIV="Refresh"
CONTENT="0; URL=http://geographiclib.sourceforge.net/@PROJECT_VERSION@/utilities.html">
</head>
<body topmargin=10 leftmargin=10>
<h3>
<blockquote>
<em>
Online documentation for utilities for GeographicLib version
@PROJECT_VERSION@ is available at
<center>
<a href="http://geographiclib.sourceforge.net/@PROJECT_VERSION@/utilities.html">
http://geographiclib.sourceforge.net/@PROJECT_VERSION@/utilities.html</a>.
</center>
<br>
You will be redirected there. Click on the link to go there
directly.
</em>
</blockquote>
</h3>
</body>
</html>

View File

@ -0,0 +1,99 @@
/**
* \file NETGeographicLib/Accumulator.cpp
* \brief Implementation for NETGeographicLib::Accumulator class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/Accumulator.hpp"
#include "Accumulator.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
//*****************************************************************************
Accumulator::!Accumulator(void)
{
if ( m_pAccumulator != NULL )
{
delete m_pAccumulator;
m_pAccumulator = NULL;
}
}
//*****************************************************************************
Accumulator::Accumulator(void)
{
try
{
m_pAccumulator = new GeographicLib::Accumulator<double>();
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr("Failed to allocate memory for a GeogrpicLib::Accumulator");
}
}
//*****************************************************************************
void Accumulator::Assign( double a )
{
m_pAccumulator->operator=( a);
}
//*****************************************************************************
double Accumulator::Result()
{
return m_pAccumulator->operator()();
}
//*****************************************************************************
void Accumulator::Sum( double a )
{
m_pAccumulator->operator+=( a );
}
//*****************************************************************************
void Accumulator::Multiply( int i )
{
m_pAccumulator->operator*=( i );
}
//*****************************************************************************
bool Accumulator::operator == ( Accumulator^ lhs, double a )
{
return lhs->m_pAccumulator->operator==( a );
}
//*****************************************************************************
bool Accumulator::operator != ( Accumulator^ lhs, double a )
{
return lhs->m_pAccumulator->operator!=( a );
}
//*****************************************************************************
bool Accumulator::operator < ( Accumulator^ lhs, double a )
{
return lhs->m_pAccumulator->operator<( a );
}
//*****************************************************************************
bool Accumulator::operator <= ( Accumulator^ lhs, double a )
{
return lhs->m_pAccumulator->operator<=( a );
}
//*****************************************************************************
bool Accumulator::operator > ( Accumulator^ lhs, double a )
{
return lhs->m_pAccumulator->operator>( a );
}
//*****************************************************************************
bool Accumulator::operator >= ( Accumulator^ lhs, double a )
{
return lhs->m_pAccumulator->operator>=( a );
}

View File

@ -0,0 +1,116 @@
#pragma once
/**
* \file NETGeographicLib/Accumulator.h
* \brief Header for NETGeographicLib::Accumulator class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
namespace NETGeographicLib
{
/*!
\brief .NET wrapper for GeographicLib::Accumulator.
This class allows .NET applications to access GeographicLib::Accumulator<double>.
This allow many numbers of floating point type \e double to be added together
with twice the normal precision. The effective
precision of the sum is 106 bits or about 32 decimal places.
The implementation follows J. R. Shewchuk,
<a href="http://dx.doi.org/10.1007/PL00009321"> Adaptive Precision
Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>,
Discrete & Computational Geometry 18(3) 305--363 (1997).
C# Example:
\include example-Accumulator.cs
Managed C++ Example:
\include example-Accumulator.cpp
Visual Basic Example:
\include example-Accumulator.vb
<B>INTERFACE DIFFERENCES:</B><BR>
Since assignment operators (=,+=,-=,*=) are not supported in managed classes;
- the Assign() method replaces the = operator,
- the Sum() method replaces the += and -= operators, and
- the Multiply() method replaces the *= operator,
Use Result() instead of the () operator to obtain the summed value from the accumulator.
*/
public ref class Accumulator
{
private:
// Pointer to the unmanaged GeographicLib::Accumulator.
GeographicLib::Accumulator<double>* m_pAccumulator;
// The finalizer releases the unmanaged object when this class is destroyrd.
!Accumulator(void);
public:
//! \brief Constructor.
Accumulator(void);
//! \brief Destructor calls the finalizer.
~Accumulator() { this->!Accumulator(); }
/*!
\brief Assigns a value to an accumulator.
\param[in] a The value to be assigned.
*/
void Assign( double a );
//! \brief Returns the accumulated value.
double Result();
/*!
\brief Adds a value to the accumulator.
\param[in] a The value to be added.
*/
void Sum( double a );
/*!
\brief Multiplication by an integer
\param[in] i The multiplier.
*/
void Multiply( int i );
/*!
\brief Equality operator.
\param[in] lhs The accumulator.
\param[in] a The value to be compared to.
\return true if the accumulated value is equal to a.
*/
static bool operator == ( Accumulator^ lhs, double a );
/*!
\brief Inequality operator.
\param[in] lhs The accumulator.
\param[in] a The value to be compared to.
\return true if the accumulated value is not equal to a.
*/
static bool operator != ( Accumulator^ lhs, double a );
/*!
\brief Less than operator.
\param[in] lhs The accumulator.
\param[in] a The value to be compared to.
\return true if the accumulated value is less than a.
*/
static bool operator < ( Accumulator^ lhs, double a );
/*!
\brief Less than or equal to operator.
\param[in] lhs The accumulator.
\param[in] a The value to be compared to.
\return true if the accumulated value is less than or equal to a.
*/
static bool operator <= ( Accumulator^ lhs, double a );
/*!
\brief Greater than operator.
\param[in] lhs The accumulator.
\param[in] a The value to be compared to.
\return true if the accumulated value is greater than a.
*/
static bool operator > ( Accumulator^ lhs, double a );
/*!
\brief Greater than or equal to operator.
\param[in] lhs The accumulator.
\param[in] a The value to be compared to.
\return true if the accumulated value is greater than or equal to a.
*/
static bool operator >= ( Accumulator^ lhs, double a );
};
} //namespace NETGeographicLib

View File

@ -0,0 +1,186 @@
/**
* \file NETGeographicLib/AlbersEqualArea.cpp
* \brief Implementation for NETGeographicLib::AlbersEqualArea class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/AlbersEqualArea.hpp"
#include "AlbersEqualArea.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
//*****************************************************************************
AlbersEqualArea::!AlbersEqualArea()
{
if ( m_pAlbersEqualArea != NULL )
{
delete m_pAlbersEqualArea;
m_pAlbersEqualArea = NULL;
}
}
//*****************************************************************************
AlbersEqualArea::AlbersEqualArea( StandardTypes type )
{
try
{
switch ( type )
{
case StandardTypes::CylindricalEqualArea:
m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( GeographicLib::AlbersEqualArea::CylindricalEqualArea );
break;
case StandardTypes::AzimuthalEqualAreaNorth:
m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( GeographicLib::AlbersEqualArea::AzimuthalEqualAreaNorth );
break;
case StandardTypes::AzimuthalEqualAreaSouth:
m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( GeographicLib::AlbersEqualArea::AzimuthalEqualAreaSouth );
break;
}
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" );
}
}
//*****************************************************************************
AlbersEqualArea::AlbersEqualArea(double a, double f, double stdlat1, double stdlat2, double k1)
{
try
{
m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( a, f, stdlat1, stdlat2, k1 );
}
catch ( GeographicLib::GeographicErr err )
{
throw gcnew GeographicErr( err.what() );
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" );
}
}
//*****************************************************************************
AlbersEqualArea::AlbersEqualArea(double a, double f, double stdlat, double k0)
{
try
{
m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea( a, f, stdlat, k0 );
}
catch ( GeographicLib::GeographicErr err )
{
throw gcnew GeographicErr( err.what() );
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" );
}
}
//*****************************************************************************
AlbersEqualArea::AlbersEqualArea(double a, double f,
double sinlat1, double coslat1,
double sinlat2, double coslat2,
double k1)
{
try
{
m_pAlbersEqualArea = new GeographicLib::AlbersEqualArea(
a, f, sinlat1, coslat1, sinlat2, coslat2, k1 );
}
catch ( GeographicLib::GeographicErr err )
{
throw gcnew GeographicErr( err.what() );
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::AlbersEqualArea" );
}
}
//*****************************************************************************
void AlbersEqualArea::SetScale(double lat, double k)
{
try
{
m_pAlbersEqualArea->SetScale( lat, k );
}
catch ( const std::exception& xcpt )
{
throw gcnew GeographicErr( xcpt.what() );
}
}
//*****************************************************************************
void AlbersEqualArea::Forward(double lon0, double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y,
[System::Runtime::InteropServices::Out] double% gamma,
[System::Runtime::InteropServices::Out] double% k)
{
double lx, ly, lgamma, lk;
m_pAlbersEqualArea->Forward( lon0, lat, lon, lx, ly, lgamma, lk );
x = lx;
y = ly;
gamma = lgamma;
k = lk;
}
//*****************************************************************************
void AlbersEqualArea::Reverse(double lon0, double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
[System::Runtime::InteropServices::Out] double% gamma,
[System::Runtime::InteropServices::Out] double% k)
{
double llat, llon, lgamma, lk;
m_pAlbersEqualArea->Reverse( lon0, x, y, llat, llon, lgamma, lk );
lat = llat;
lon = llon;
gamma = lgamma;
k = lk;
}
//*****************************************************************************
void AlbersEqualArea::Forward(double lon0, double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y)
{
double lx, ly, lgamma, lk;
m_pAlbersEqualArea->Forward( lon0, lat, lon, lx, ly, lgamma, lk );
x = lx;
y = ly;
}
//*****************************************************************************
void AlbersEqualArea::Reverse(double lon0, double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon)
{
double llat, llon, lgamma, lk;
m_pAlbersEqualArea->Reverse( lon0, x, y, llat, llon, lgamma, lk );
lat = llat;
lon = llon;
}
//*****************************************************************************
double AlbersEqualArea::MajorRadius::get()
{ return m_pAlbersEqualArea->MajorRadius(); }
//*****************************************************************************
double AlbersEqualArea::Flattening::get()
{ return m_pAlbersEqualArea->Flattening(); }
//*****************************************************************************
double AlbersEqualArea::OriginLatitude::get()
{ return m_pAlbersEqualArea->OriginLatitude(); }
//*****************************************************************************
double AlbersEqualArea::CentralScale::get()
{ return m_pAlbersEqualArea->CentralScale(); }

View File

@ -0,0 +1,269 @@
#pragma once
/**
* \file NETGeographicLib/AlbersEqualArea.h
* \brief Header for NETGeographicLib::AlbersEqualArea class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
namespace NETGeographicLib
{
/**
* \brief .NET Wrapper for GeographicLib::AlbersEqualArea.
*
* This class allows .NET applications to access
* GeographicLib::AlbersEqualArea
*
* Implementation taken from the report,
* - J. P. Snyder,
* <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projections: A
* Working Manual</a>, USGS Professional Paper 1395 (1987),
* pp. 101--102.
*
* This is a implementation of the equations in Snyder except that divided
* differences will be [have been] used to transform the expressions into
* ones which may be evaluated accurately. [In this implementation, the
* projection correctly becomes the cylindrical equal area or the azimuthal
* equal area projection when the standard latitude is the equator or a
* pole.]
*
* The ellipsoid parameters, the standard parallels, and the scale on the
* standard parallels are set in the constructor. Internally, the case with
* two standard parallels is converted into a single standard parallel, the
* latitude of minimum azimuthal scale, with an azimuthal scale specified on
* this parallel. This latitude is also used as the latitude of origin which
* is returned by AlbersEqualArea::OriginLatitude. The azimuthal scale on
* the latitude of origin is given by AlbersEqualArea::CentralScale. The
* case with two standard parallels at opposite poles is singular and is
* disallowed. The central meridian (which is a trivial shift of the
* longitude) is specified as the \e lon0 argument of the
* AlbersEqualArea::Forward and AlbersEqualArea::Reverse functions.
* AlbersEqualArea::Forward and AlbersEqualArea::Reverse also return the
* meridian convergence, &gamma;, and azimuthal scale, \e k. A small square
* aligned with the cardinal directions is projected to a rectangle with
* dimensions \e k (in the E-W direction) and 1/\e k (in the N-S direction).
* The E-W sides of the rectangle are oriented &gamma; degrees
* counter-clockwise from the \e x axis. There is no provision in this class
* for specifying a false easting or false northing or a different latitude
* of origin.
*
* C# Example:
* \include example-AlbersEqualArea.cs
* Managed C++ Example:
* \include example-AlbersEqualArea.cpp
* Visual Basic Example:
* \include example-AlbersEqualArea.vb
*
* <B>INTERFACE DIFFERENCES:</B><BR>
* A constructor has been provided that creates the standard projections.
*
* The MajorRadius, Flattening, OriginLatitude, and CentralScale functions
* are implemented as properties.
**********************************************************************/
public ref class AlbersEqualArea
{
private:
// pointer to the unmanaged GeographicLib::AlbersEqualArea
GeographicLib::AlbersEqualArea* m_pAlbersEqualArea;
// Frees the unmanaged m_pAlbersEqualArea when object is destroyed.
!AlbersEqualArea();
public:
/**
Standard AlbersEqualAreaProjections that assume the WGS84 ellipsoid.
*********************************************************************/
enum class StandardTypes
{
CylindricalEqualArea, //!< cylindrical equal area projection (stdlat = 0, and \e k0 = 1)
AzimuthalEqualAreaNorth, //!< Lambert azimuthal equal area projection (stdlat = 90&deg;, and \e k0 = 1)
AzimuthalEqualAreaSouth //!< Lambert azimuthal equal area projection (stdlat = &minus;90&deg;, and \e k0 = 1)
};
//! \brief Destructor
~AlbersEqualArea() { this->!AlbersEqualArea(); }
/**!
* Constructor for one of the standard types.
* @param[in] type The desired standard type.
**********************************************************************/
AlbersEqualArea( StandardTypes type );
/**
* Constructor with a single standard parallel.
*
* @param[in] a equatorial radius of ellipsoid (meters).
* @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
* Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening
* to 1/\e f.
* @param[in] stdlat standard parallel (degrees), the circle of tangency.
* @param[in] k0 azimuthal scale on the standard parallel.
* @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k0 is
* not positive.
* @exception GeographicErr if \e stdlat is not in [&minus;90&deg;,
* 90&deg;].
**********************************************************************/
AlbersEqualArea(double a, double f, double stdlat, double k0);
/**
* Constructor with two standard parallels.
*
* @param[in] a equatorial radius of ellipsoid (meters).
* @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
* Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening
* to 1/\e f.
* @param[in] stdlat1 first standard parallel (degrees).
* @param[in] stdlat2 second standard parallel (degrees).
* @param[in] k1 azimuthal scale on the standard parallels.
* @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k1 is
* not positive.
* @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in
* [&minus;90&deg;, 90&deg;], or if \e stdlat1 and \e stdlat2 are
* opposite poles.
**********************************************************************/
AlbersEqualArea(double a, double f, double stdlat1, double stdlat2, double k1);
/**
* Constructor with two standard parallels specified by sines and cosines.
*
* @param[in] a equatorial radius of ellipsoid (meters).
* @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
* Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening
* to 1/\e f.
* @param[in] sinlat1 sine of first standard parallel.
* @param[in] coslat1 cosine of first standard parallel.
* @param[in] sinlat2 sine of second standard parallel.
* @param[in] coslat2 cosine of second standard parallel.
* @param[in] k1 azimuthal scale on the standard parallels.
* @exception GeographicErr if \e a, (1 &minus; \e f ) \e a, or \e k1 is
* not positive.
* @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in
* [&minus;90&deg;, 90&deg;], or if \e stdlat1 and \e stdlat2 are
* opposite poles.
*
* This allows parallels close to the poles to be specified accurately.
* This routine computes the latitude of origin and the azimuthal scale at
* this latitude. If \e dlat = abs(\e lat2 &minus; \e lat1) &le; 160&deg;,
* then the error in the latitude of origin is less than 4.5 &times;
* 10<sup>&minus;14</sup>d;.
**********************************************************************/
AlbersEqualArea(double a, double f,
double sinlat1, double coslat1,
double sinlat2, double coslat2,
double k1);
/**
* Set the azimuthal scale for the projection.
*
* @param[in] lat (degrees).
* @param[in] k azimuthal scale at latitude \e lat (default 1).
* @exception GeographicErr \e k is not positive.
* @exception GeographicErr if \e lat is not in (&minus;90&deg;,
* 90&deg;).
*
* This allows a "latitude of conformality" to be specified.
**********************************************************************/
void SetScale(double lat, double k);
/**
* Forward projection, from geographic to Lambert conformal conic.
*
* @param[in] lon0 central meridian longitude (degrees).
* @param[in] lat latitude of point (degrees).
* @param[in] lon longitude of point (degrees).
* @param[out] x easting of point (meters).
* @param[out] y northing of point (meters).
* @param[out] gamma meridian convergence at point (degrees).
* @param[out] k azimuthal scale of projection at point; the radial
* scale is the 1/\e k.
*
* The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No
* false easting or northing is added and \e lat should be in the range
* [&minus;90&deg;, 90&deg;]; \e lon and \e lon0 should be in the
* range [&minus;540&deg;, 540&deg;). The values of \e x and \e y
* returned for points which project to infinity (i.e., one or both of the
* poles) will be large but finite.
**********************************************************************/
void Forward(double lon0, double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y,
[System::Runtime::InteropServices::Out] double% gamma,
[System::Runtime::InteropServices::Out] double% k);
/**
* Reverse projection, from Lambert conformal conic to geographic.
*
* @param[in] lon0 central meridian longitude (degrees).
* @param[in] x easting of point (meters).
* @param[in] y northing of point (meters).
* @param[out] lat latitude of point (degrees).
* @param[out] lon longitude of point (degrees).
* @param[out] gamma meridian convergence at point (degrees).
* @param[out] k azimuthal scale of projection at point; the radial
* scale is the 1/\e k.
*
* The latitude origin is given by AlbersEqualArea::LatitudeOrigin(). No
* false easting or northing is added. \e lon0 should be in the range
* [&minus;540&deg;, 540&deg;). The value of \e lon returned is in
* the range [&minus;180&deg;, 180&deg;). The value of \e lat
* returned is in the range [&minus;90&deg;, 90&deg;]. If the
* input point is outside the legal projected space the nearest pole is
* returned.
**********************************************************************/
void Reverse(double lon0, double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
[System::Runtime::InteropServices::Out] double% gamma,
[System::Runtime::InteropServices::Out] double% k);
/**
* AlbersEqualArea::Forward without returning the convergence and
* scale.
**********************************************************************/
void Forward(double lon0, double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y);
/**
* AlbersEqualArea::Reverse without returning the convergence and
* scale.
**********************************************************************/
void Reverse(double lon0, double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon);
/** \name Inspector functions
**********************************************************************/
///@{
/**
* @return \e a the equatorial radius of the ellipsoid (meters). This is
* the value used in the constructor.
**********************************************************************/
property double MajorRadius { double get(); }
/**
* @return \e f the flattening of the ellipsoid. This is the value used in
* the constructor.
**********************************************************************/
property double Flattening { double get(); }
/**
* @return latitude of the origin for the projection (degrees).
*
* This is the latitude of minimum azimuthal scale and equals the \e stdlat
* in the 1-parallel constructor and lies between \e stdlat1 and \e stdlat2
* in the 2-parallel constructors.
**********************************************************************/
property double OriginLatitude { double get(); }
/**
* @return central scale for the projection. This is the azimuthal scale
* on the latitude of origin.
**********************************************************************/
property double CentralScale { double get(); }
///@}
};
} // namespace NETGeographic

View File

@ -0,0 +1,43 @@
#include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("NETGeographic")];
[assembly:AssemblyDescriptionAttribute(".NET Interface for GeographicLib")];
[assembly:AssemblyConfigurationAttribute("1.33")];
[assembly:AssemblyCompanyAttribute("Open Source")];
[assembly:AssemblyProductAttribute("NETGeographic")];
[assembly:AssemblyCopyrightAttribute("GeographicLib copyright (c) Charles Karney 2013\nNETGeographicLib copyright (c) Scott Heiman 2013")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.33.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
#if _MSC_VER < 1800
// RequestMinium marked as obsolete in Visual Studio 12 (2013)
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
#endif

View File

@ -0,0 +1,110 @@
/**
* \file NETGeographicLib/AzimuthalEquidistant.cpp
* \brief Implementation for NETGeographicLib::AzimuthalEquidistant class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/AzimuthalEquidistant.hpp"
#include "AzimuthalEquidistant.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::AzimuthalEquidistant";
//*****************************************************************************
AzimuthalEquidistant::!AzimuthalEquidistant()
{
if ( m_pAzimuthalEquidistant != NULL )
{
delete m_pAzimuthalEquidistant;
m_pAzimuthalEquidistant = NULL;
}
}
//*****************************************************************************
AzimuthalEquidistant::AzimuthalEquidistant(void)
{
try
{
m_pAzimuthalEquidistant = new GeographicLib::AzimuthalEquidistant( GeographicLib::Geodesic::WGS84 );
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
AzimuthalEquidistant::AzimuthalEquidistant( Geodesic^ g )
{
try
{
const GeographicLib::Geodesic* pGeodesic =
reinterpret_cast<const GeographicLib::Geodesic*>(
g->GetUnmanaged()->ToPointer() );
m_pAzimuthalEquidistant = new GeographicLib::AzimuthalEquidistant( *pGeodesic );
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
void AzimuthalEquidistant::Forward(double lat0, double lon0, double lat, double lon,
double% x, double% y, double% azi, double% rk)
{
double lx, ly, lazi, lrk;
m_pAzimuthalEquidistant->Forward( lat0, lon0, lat, lon,
lx, ly, lazi, lrk );
x = lx;
y = ly;
azi = lazi;
rk = lrk;
}
//*****************************************************************************
void AzimuthalEquidistant::Reverse(double lat0, double lon0, double x, double y,
double% lat, double% lon, double% azi, double% rk)
{
double llat, llon, lazi, lrk;
m_pAzimuthalEquidistant->Reverse(lat0, lon0, x, y,
llat, llon, lazi, lrk);
lat = llat;
lon = llon;
azi = lazi;
rk = lrk;
}
//*****************************************************************************
void AzimuthalEquidistant::Forward(double lat0, double lon0, double lat, double lon,
double% x, double% y)
{
double azi, rk, lx, ly;
m_pAzimuthalEquidistant->Forward(lat0, lon0, lat, lon, lx, ly, azi, rk);
x = lx;
y = ly;
}
//*****************************************************************************
void AzimuthalEquidistant::Reverse(double lat0, double lon0, double x, double y,
double% lat, double% lon)
{
double azi, rk, llat, llon;
m_pAzimuthalEquidistant->Reverse(lat0, lon0, x, y, llat, llon, azi, rk);
lat = llat;
lon = llon;
}
//*****************************************************************************
double AzimuthalEquidistant::MajorRadius::get()
{ return m_pAzimuthalEquidistant->MajorRadius(); }
//*****************************************************************************
double AzimuthalEquidistant::Flattening::get()
{ return m_pAzimuthalEquidistant->Flattening(); }

View File

@ -0,0 +1,161 @@
/**
* \file NETGeographicLib/AzimuthalEquidistant.h
* \brief Header for NETGeographicLib::AzimuthalEquidistant class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#pragma once
#include "Geodesic.h"
namespace NETGeographicLib
{
/**
* \brief .NET wrapper for GeographicLib::AzimuthalEquidistant.
*
* This class allows .NET applications to access GeographicLib::AzimuthalEquidistant.
*
* Azimuthal equidistant projection centered at an arbitrary position on the
* ellipsoid. For a point in projected space (\e x, \e y), the geodesic
* distance from the center position is hypot(\e x, \e y) and the azimuth of
* the geodesic from the center point is atan2(\e x, \e y). The Forward and
* Reverse methods also return the azimuth \e azi of the geodesic at (\e x,
* \e y) and reciprocal scale \e rk in the azimuthal direction which,
* together with the basic properties of the projection, serve to specify
* completely the local affine transformation between geographic and
* projected coordinates.
*
* The conversions all take place using a Geodesic object (by default
* Geodesic::WGS84). For more information on geodesics see \ref geodesic.
*
* C# Example:
* \include example-AzimuthalEquidistant.cs
* Managed C++ Example:
* \include example-AzimuthalEquidistant.cpp
* Visual Basic Example:
* \include example-AzimuthalEquidistant.vb
*
* <B>INTERFACE DIFFERENCES:</B><BR>
* A default constructor is provided that assumes a WGS84 ellipsoid.
*
* The MajorRadius and Flattening functions are implemented as
* properties.
**********************************************************************/
public ref class AzimuthalEquidistant
{
private:
// Pointer to the unmanaged GeographicLib::AzimuthalEquidistant
const GeographicLib::AzimuthalEquidistant* m_pAzimuthalEquidistant;
// Frees the unmanaged memory when the object is destroyed.
!AzimuthalEquidistant();
public:
/**
* Default Constructor for AzimuthalEquidistant.
* Assumes WGS84 Geodesic
**********************************************************************/
AzimuthalEquidistant(void);
/**
* Constructor for AzimuthalEquidistant.
*
* @param[in] earth the Geodesic object to use for geodesic calculations.
**********************************************************************/
AzimuthalEquidistant( Geodesic^ earth );
/**
* Destructor
*
* frees unmanaged memory.
**********************************************************************/
~AzimuthalEquidistant()
{ this->!AzimuthalEquidistant(); }
/**
* Forward projection, from geographic to azimuthal equidistant.
*
* @param[in] lat0 latitude of center point of projection (degrees).
* @param[in] lon0 longitude of center point of projection (degrees).
* @param[in] lat latitude of point (degrees).
* @param[in] lon longitude of point (degrees).
* @param[out] x easting of point (meters).
* @param[out] y northing of point (meters).
* @param[out] azi azimuth of geodesic at point (degrees).
* @param[out] rk reciprocal of azimuthal scale at point.
*
* \e lat0 and \e lat should be in the range [&minus;90&deg;,
* 90&deg;] and \e lon0 and \e lon should be in the range
* [&minus;540&deg;, 540&deg;). The scale of the projection is 1
* in the "radial" direction, \e azi clockwise from true north, and is 1/\e
* rk in the direction perpendicular to this. A call to Forward followed
* by a call to Reverse will return the original (\e lat, \e lon) (to
* within roundoff).
**********************************************************************/
void Forward(double lat0, double lon0, double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y,
[System::Runtime::InteropServices::Out] double% azi,
[System::Runtime::InteropServices::Out] double% rk);
/**
* Reverse projection, from azimuthal equidistant to geographic.
*
* @param[in] lat0 latitude of center point of projection (degrees).
* @param[in] lon0 longitude of center point of projection (degrees).
* @param[in] x easting of point (meters).
* @param[in] y northing of point (meters).
* @param[out] lat latitude of point (degrees).
* @param[out] lon longitude of point (degrees).
* @param[out] azi azimuth of geodesic at point (degrees).
* @param[out] rk reciprocal of azimuthal scale at point.
*
* \e lat0 should be in the range [&minus;90&deg;, 90&deg;] and \e
* lon0 should be in the range [&minus;540&deg;, 540&deg;). \e lat
* will be in the range [&minus;90&deg;, 90&deg;] and \e lon will
* be in the range [&minus;180&deg;, 180&deg;). The scale of the
* projection is 1 in the "radial" direction, \e azi clockwise from true
* north, and is 1/\e rk in the direction perpendicular to this. A call to
* Reverse followed by a call to Forward will return the original (\e x, \e
* y) (to roundoff) only if the geodesic to (\e x, \e y) is a shortest
* path.
**********************************************************************/
void Reverse(double lat0, double lon0, double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
[System::Runtime::InteropServices::Out] double% azi,
[System::Runtime::InteropServices::Out] double% rk);
/**
* AzimuthalEquidistant::Forward without returning the azimuth and scale.
**********************************************************************/
void Forward(double lat0, double lon0, double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y);
/**
* AzimuthalEquidistant::Reverse without returning the azimuth and scale.
**********************************************************************/
void Reverse(double lat0, double lon0, double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon);
/** \name Inspector functions
**********************************************************************/
///@{
/**
* @return \e a the equatorial radius of the ellipsoid (meters). This is
* the value inherited from the Geodesic object used in the constructor.
**********************************************************************/
property double MajorRadius { double get(); }
/**
* @return \e f the flattening of the ellipsoid. This is the value
* inherited from the Geodesic object used in the constructor.
**********************************************************************/
property double Flattening { double get(); }
///@}
};
} // namespace NETGeographicLib

View File

@ -0,0 +1,42 @@
# Build the .NET library...
# Include all the .cpp files in the library.
file (GLOB SOURCES [A-Za-z]*.cpp)
file (GLOB HEADERS [A-Za-z]*.h)
add_library (${NETGEOGRAPHICLIB_LIBRARIES} SHARED ${SOURCES} ${HEADERS})
set_target_properties (${NETGEOGRAPHICLIB_LIBRARIES}
PROPERTIES COMPILE_FLAGS "/clr")
string (REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string (REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_definitions (${PROJECT_DEFINITIONS})
target_link_libraries (${NETGEOGRAPHICLIB_LIBRARIES} ${PROJECT_LIBRARIES})
# Set the version number on the library
set_target_properties (${NETGEOGRAPHICLIB_LIBRARIES} PROPERTIES
VERSION "${LIBVERSIONFULL}" OUTPUT_NAME ${NETLIBNAME}
PDB_NAME ${NETLIBNAME}${CMAKE_DEBUG_POSTFIX})
# Specify where the library is installed, adding it to the export depends
install (TARGETS ${NETGEOGRAPHICLIB_LIBRARIES}
EXPORT depends
RUNTIME DESTINATION bin)
if (PACKAGE_DEBUG_LIBS)
install (PROGRAMS
"${CMAKE_CURRENT_BINARY_DIR}/Debug/${NETLIBNAME}${CMAKE_DEBUG_POSTFIX}.dll"
DESTINATION bin CONFIGURATIONS Release)
endif ()
# Install pdb file in debug mode.
get_target_property (_P ${NETGEOGRAPHICLIB_LIBRARIES} LOCATION_DEBUG)
get_filename_component (_P ${_P} PATH)
get_target_property (_N ${NETGEOGRAPHICLIB_LIBRARIES} PDB_NAME)
set (_PDB ${_P}/${_N}.pdb)
install (FILES ${_PDB} DESTINATION bin
RENAME ${NETLIBNAME}${CMAKE_DEBUG_POSTFIX}.pdb CONFIGURATIONS Debug)
# Put all the library into a folder in the IDE
set_property (TARGET ${NETGEOGRAPHICLIB_LIBRARIES} PROPERTY FOLDER library)

View File

@ -0,0 +1,134 @@
/**
* \file NETGeographicLib/CassiniSoldner.cpp
* \brief Implementation for NETGeographicLib::CassiniSoldner class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/CassiniSoldner.hpp"
#include "Geodesic.h"
#include "CassiniSoldner.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::CassiniSoldner";
//*****************************************************************************
CassiniSoldner::!CassiniSoldner()
{
if ( m_pCassiniSoldner != NULL )
{
delete m_pCassiniSoldner;
m_pCassiniSoldner = NULL;
}
}
//*****************************************************************************
CassiniSoldner::CassiniSoldner(double lat0, double lon0)
{
try
{
m_pCassiniSoldner = new GeographicLib::CassiniSoldner( GeographicLib::Geodesic::WGS84 );
m_pCassiniSoldner->Reset(lat0, lon0);
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
CassiniSoldner::CassiniSoldner(double lat0, double lon0,
Geodesic^ earth )
{
try
{
const GeographicLib::Geodesic* pGeodesic =
reinterpret_cast<const GeographicLib::Geodesic*>(
earth->GetUnmanaged()->ToPointer() );
m_pCassiniSoldner = new GeographicLib::CassiniSoldner( *pGeodesic );
m_pCassiniSoldner->Reset(lat0, lon0);
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
void CassiniSoldner::Reset(double lat0, double lon0)
{
m_pCassiniSoldner->Reset(lat0, lon0);
}
//*****************************************************************************
void CassiniSoldner::Forward(double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y,
[System::Runtime::InteropServices::Out] double% azi,
[System::Runtime::InteropServices::Out] double% rk)
{
double lx, ly, lazi, lrk;
m_pCassiniSoldner->Forward(lat, lon, lx, ly, lazi, lrk);
x = lx;
y = ly;
azi = lazi;
rk = lrk;
}
//*****************************************************************************
void CassiniSoldner::Reverse(double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
[System::Runtime::InteropServices::Out] double% azi,
[System::Runtime::InteropServices::Out] double% rk)
{
double llat, llon, lazi, lrk;
m_pCassiniSoldner->Reverse( x, y, llat, llon, lazi, lrk );
lat = llat;
lon = llon;
azi = lazi;
rk = lrk;
}
//*****************************************************************************
void CassiniSoldner::Forward(double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y)
{
double lx, ly, azi, rk;
m_pCassiniSoldner->Forward(lat, lon, lx, ly, azi, rk);
x = lx;
y = ly;
}
//*****************************************************************************
void CassiniSoldner::Reverse(double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon)
{
double llat, llon, lazi, lrk;
m_pCassiniSoldner->Reverse( x, y, llat, llon, lazi, lrk );
lat = llat;
lon = llon;
}
//*****************************************************************************
double CassiniSoldner::LatitudeOrigin::get()
{ return m_pCassiniSoldner->LatitudeOrigin(); }
//*****************************************************************************
double CassiniSoldner::LongitudeOrigin::get()
{ return m_pCassiniSoldner->LongitudeOrigin(); }
//*****************************************************************************
double CassiniSoldner::MajorRadius::get()
{ return m_pCassiniSoldner->MajorRadius(); }
//*****************************************************************************
double CassiniSoldner::Flattening::get()
{ return m_pCassiniSoldner->Flattening(); }

View File

@ -0,0 +1,201 @@
/**
* \file NETGeographicLib/CassiniSoldner.h
* \brief Header for NETGeographicLib::CassiniSoldner class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#pragma once
namespace NETGeographicLib
{
/**
* \brief .NET wrapper for GeographicLib::CassiniSoldner.
*
* This class allows .NET applications to access GeographicLib::CassiniSoldner.
*
* Cassini-Soldner projection centered at an arbitrary position, \e lat0, \e
* lon0, on the ellipsoid. This projection is a transverse cylindrical
* equidistant projection. The projection from (\e lat, \e lon) to easting
* and northing (\e x, \e y) is defined by geodesics as follows. Go north
* along a geodesic a distance \e y from the central point; then turn
* clockwise 90&deg; and go a distance \e x along a geodesic.
* (Although the initial heading is north, this changes to south if the pole
* is crossed.) This procedure uniquely defines the reverse projection. The
* forward projection is constructed as follows. Find the point (\e lat1, \e
* lon1) on the meridian closest to (\e lat, \e lon). Here we consider the
* full meridian so that \e lon1 may be either \e lon0 or \e lon0 +
* 180&deg;. \e x is the geodesic distance from (\e lat1, \e lon1) to
* (\e lat, \e lon), appropriately signed according to which side of the
* central meridian (\e lat, \e lon) lies. \e y is the shortest distance
* along the meridian from (\e lat0, \e lon0) to (\e lat1, \e lon1), again,
* appropriately signed according to the initial heading. [Note that, in the
* case of prolate ellipsoids, the shortest meridional path from (\e lat0, \e
* lon0) to (\e lat1, \e lon1) may not be the shortest path.] This procedure
* uniquely defines the forward projection except for a small class of points
* for which there may be two equally short routes for either leg of the
* path.
*
* Because of the properties of geodesics, the (\e x, \e y) grid is
* orthogonal. The scale in the easting direction is unity. The scale, \e
* k, in the northing direction is unity on the central meridian and
* increases away from the central meridian. The projection routines return
* \e azi, the true bearing of the easting direction, and \e rk = 1/\e k, the
* reciprocal of the scale in the northing direction.
*
* The conversions all take place using a Geodesic object (by default
* Geodesic::WGS84). For more information on geodesics see \ref geodesic.
* The determination of (\e lat1, \e lon1) in the forward projection is by
* solving the inverse geodesic problem for (\e lat, \e lon) and its twin
* obtained by reflection in the meridional plane. The scale is found by
* determining where two neighboring geodesics intersecting the central
* meridian at \e lat1 and \e lat1 + \e dlat1 intersect and taking the ratio
* of the reduced lengths for the two geodesics between that point and,
* respectively, (\e lat1, \e lon1) and (\e lat, \e lon).
*
* C# Example:
* \include example-CassiniSoldner.cs
* Managed C++ Example:
* \include example-CassiniSoldner.cpp
* Visual Basic Example:
* \include example-CassiniSoldner.vb
*
* <B>INTERFACE DIFFERENCES:</B><BR>
* The LatitudeOrigin, LongitudeOrigin, MajorRadius and Flattening
* functions are implimented as properties.
**********************************************************************/
public ref class CassiniSoldner
{
private:
// A pointer to the unmanaged GeographicLib::CassiniSoldner
GeographicLib::CassiniSoldner* m_pCassiniSoldner;
// The finalizer frees the unmanaged memory when the object is destroyed.
!CassiniSoldner();
public:
/**
* Constructor for CassiniSoldner specifying a center point and
* assuming the WGS84 ellipsoid.
*
* @param[in] lat0 latitude of center point of projection (degrees).
* @param[in] lon0 longitude of center point of projection (degrees).
**********************************************************************/
CassiniSoldner(double lat0, double lon0);
/**
* Constructor for CassiniSoldner specifying a center point.
*
* @param[in] lat0 latitude of center point of projection (degrees).
* @param[in] lon0 longitude of center point of projection (degrees).
* @param[in] earth the Geodesic object to use for geodesic calculations.
* By default this uses the WGS84 ellipsoid.
*
* \e lat0 should be in the range [&minus;90&deg;, 90&deg;] and \e
* lon0 should be in the range [&minus;540&deg;, 540&deg;).
**********************************************************************/
CassiniSoldner(double lat0, double lon0, Geodesic^ earth );
/**
* The destructor calls the finalizer.
**********************************************************************/
~CassiniSoldner()
{ this->!CassiniSoldner(); }
/**
* Set the central point of the projection
*
* @param[in] lat0 latitude of center point of projection (degrees).
* @param[in] lon0 longitude of center point of projection (degrees).
*
* \e lat0 should be in the range [&minus;90&deg;, 90&deg;] and \e
* lon0 should be in the range [&minus;540&deg;, 540&deg;).
**********************************************************************/
void Reset(double lat0, double lon0);
/**
* Forward projection, from geographic to Cassini-Soldner.
*
* @param[in] lat latitude of point (degrees).
* @param[in] lon longitude of point (degrees).
* @param[out] x easting of point (meters).
* @param[out] y northing of point (meters).
* @param[out] azi azimuth of easting direction at point (degrees).
* @param[out] rk reciprocal of azimuthal northing scale at point.
*
* \e lat should be in the range [&minus;90&deg;, 90&deg;] and \e
* lon should be in the range [&minus;540&deg;, 540&deg;). A call
* to Forward followed by a call to Reverse will return the original (\e
* lat, \e lon) (to within roundoff). The routine does nothing if the
* origin has not been set.
**********************************************************************/
void Forward(double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y,
[System::Runtime::InteropServices::Out] double% azi,
[System::Runtime::InteropServices::Out] double% rk);
/**
* Reverse projection, from Cassini-Soldner to geographic.
*
* @param[in] x easting of point (meters).
* @param[in] y northing of point (meters).
* @param[out] lat latitude of point (degrees).
* @param[out] lon longitude of point (degrees).
* @param[out] azi azimuth of easting direction at point (degrees).
* @param[out] rk reciprocal of azimuthal northing scale at point.
*
* A call to Reverse followed by a call to Forward will return the original
* (\e x, \e y) (to within roundoff), provided that \e x and \e y are
* sufficiently small not to "wrap around" the earth. The routine does
* nothing if the origin has not been set.
**********************************************************************/
void Reverse(double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
[System::Runtime::InteropServices::Out] double% azi,
[System::Runtime::InteropServices::Out] double% rk);
/**
* CassiniSoldner::Forward without returning the azimuth and scale.
**********************************************************************/
void Forward(double lat, double lon,
[System::Runtime::InteropServices::Out] double% x,
[System::Runtime::InteropServices::Out] double% y);
/**
* CassiniSoldner::Reverse without returning the azimuth and scale.
**********************************************************************/
void Reverse(double x, double y,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon);
/** \name Inspector functions
**********************************************************************/
///@{
/**
* @return \e lat0 the latitude of origin (degrees).
**********************************************************************/
property double LatitudeOrigin { double get(); }
/**
* @return \e lon0 the longitude of origin (degrees).
**********************************************************************/
property double LongitudeOrigin { double get(); }
/**
* @return \e a the equatorial radius of the ellipsoid (meters). This is
* the value inherited from the Geodesic object used in the constructor.
**********************************************************************/
property double MajorRadius { double get(); }
/**
* @return \e f the flattening of the ellipsoid. This is the value
* inherited from the Geodesic object used in the constructor.
**********************************************************************/
property double Flattening { double get(); }
///@}
};
} // namespace NETGeographicLib

View File

@ -0,0 +1,83 @@
/**
* \file NETGeographicLib/CircularEngine.cpp
* \brief Implementation for NETGeographicLib::CircularEngine class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/CircularEngine.hpp"
#include "CircularEngine.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
//*****************************************************************************
CircularEngine::CircularEngine(const GeographicLib::CircularEngine& c)
{
try
{
m_pCircularEngine = new GeographicLib::CircularEngine( c );
}
catch ( GeographicLib::GeographicErr err )
{
throw gcnew GeographicErr( err.what() );
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::CircularEngine" );
}
}
//*****************************************************************************
CircularEngine::!CircularEngine()
{
if ( m_pCircularEngine != NULL )
{
delete m_pCircularEngine;
m_pCircularEngine = NULL;
}
}
//*****************************************************************************
double CircularEngine::LongitudeSum(double coslon, double sinlon)
{
return m_pCircularEngine->operator()( coslon, sinlon );
}
//*****************************************************************************
double CircularEngine::LongitudeSum(double lon)
{
return m_pCircularEngine->operator()( lon );
}
//*****************************************************************************
double CircularEngine::LongitudeSum(double coslon, double sinlon,
[System::Runtime::InteropServices::Out] double% gradx,
[System::Runtime::InteropServices::Out] double% grady,
[System::Runtime::InteropServices::Out] double% gradz)
{
double lgradx, lgrady, lgradz;
double output = m_pCircularEngine->operator()( coslon, sinlon, lgradx, lgrady, lgradz );
gradx = lgradx;
grady = lgrady;
gradz = lgradz;
return output;
}
//*****************************************************************************
double CircularEngine::LongitudeSum(double lon,
[System::Runtime::InteropServices::Out] double% gradx,
[System::Runtime::InteropServices::Out] double% grady,
[System::Runtime::InteropServices::Out] double% gradz)
{
double lgradx, lgrady, lgradz;
double output = m_pCircularEngine->operator()( lon, lgradx, lgrady, lgradz );
gradx = lgradx;
grady = lgrady;
gradz = lgradz;
return output;
}

View File

@ -0,0 +1,142 @@
/**
* \file NETGeographicLib/CircularEngine.h
* \brief Header for NETGeographicLib::CircularEngine class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#pragma once
namespace NETGeographicLib
{
/**
* \brief .NET wrapper for GeographicLib::CircularEngine.
*
* This class allows .NET applications to access GeographicLib::CircularEngine.
*
* The class is a companion to SphericalEngine. If the results of a
* spherical harmonic sum are needed for several points on a circle of
* constant latitude \e lat and height \e h, then SphericalEngine::Circle can
* compute the inner sum, which is independent of longitude \e lon, and
* produce a CircularEngine object. CircularEngine::LongitudeSum() can
* then be used to perform the outer sum for particular values of \e lon.
* This can lead to substantial improvements in computational speed for high
* degree sum (approximately by a factor of \e N / 2 where \e N is the
* maximum degree).
*
* CircularEngine is tightly linked to the internals of SphericalEngine. For
* that reason, the constructor for this class is for internal use only. Use
* SphericalHarmonic::Circle, SphericalHarmonic1::Circle, and
* SphericalHarmonic2::Circle to create instances of this class.
*
* CircularEngine stores the coefficients needed to allow the summation over
* order to be performed in 2 or 6 vectors of length \e M + 1 (depending on
* whether gradients are to be calculated). For this reason the constructor
* may throw a GeographicErr exception.
*
* C# Example:
* \include example-CircularEngine.cs
* Managed C++ Example:
* \include example-CircularEngine.cpp
* Visual Basic Example:
* \include example-CircularEngine.vb
*
* <B>INTERFACE DIFFERENCES:</B><BR>
* The () operator has been replaced with with LongitudeSum.
*
* This class does not have a constructor that can be used in a .NET
* application. Use SphericalHarmonic::Circle, SphericalHarmonic1::Circle or
* SphericalHarmonic2::Circle to create instances of this class.
**********************************************************************/
public ref class CircularEngine
{
private:
// pointer to the unmanaged GeographicLib::CircularEngine
const GeographicLib::CircularEngine* m_pCircularEngine;
// The finalizer frees the unmanaged memory when the object is destroyed.
!CircularEngine();
public:
/**
* The constructor.
*
* This constructor should not be used in .NET applications.
* Use SphericalHarmonic::Circle, SphericalHarmonic1::Circle or
* SphericalHarmonic2::Circle to create instances of this class.
*
* @param[in] c The unmanaged CircularEngine to be copied.
**********************************************************************/
CircularEngine( const GeographicLib::CircularEngine& c );
/**
* The destructor calls the finalizer
**********************************************************************/
~CircularEngine()
{ this->!CircularEngine(); }
/**
* Evaluate the sum for a particular longitude given in terms of its
* cosine and sine.
*
* @param[in] coslon the cosine of the longitude.
* @param[in] sinlon the sine of the longitude.
* @return \e V the value of the sum.
*
* The arguments must satisfy <i>coslon</i><sup>2</sup> +
* <i>sinlon</i><sup>2</sup> = 1.
**********************************************************************/
double LongitudeSum(double coslon, double sinlon);
/**
* Evaluate the sum for a particular longitude.
*
* @param[in] lon the longitude (degrees).
* @return \e V the value of the sum.
**********************************************************************/
double LongitudeSum(double lon);
/**
* Evaluate the sum and its gradient for a particular longitude given in
* terms of its cosine and sine.
*
* @param[in] coslon the cosine of the longitude.
* @param[in] sinlon the sine of the longitude.
* @param[out] gradx \e x component of the gradient.
* @param[out] grady \e y component of the gradient.
* @param[out] gradz \e z component of the gradient.
* @return \e V the value of the sum.
*
* The gradients will only be computed if the CircularEngine object was
* created with this capability (e.g., via \e gradp = true in
* SphericalHarmonic::Circle). If not, \e gradx, etc., will not be
* touched. The arguments must satisfy <i>coslon</i><sup>2</sup> +
* <i>sinlon</i><sup>2</sup> = 1.
**********************************************************************/
double LongitudeSum(double coslon, double sinlon,
[System::Runtime::InteropServices::Out] double% gradx,
[System::Runtime::InteropServices::Out] double% grady,
[System::Runtime::InteropServices::Out] double% gradz);
/**
* Evaluate the sum and its gradient for a particular longitude.
*
* @param[in] lon the longitude (degrees).
* @param[out] gradx \e x component of the gradient.
* @param[out] grady \e y component of the gradient.
* @param[out] gradz \e z component of the gradient.
* @return \e V the value of the sum.
*
* The gradients will only be computed if the CircularEngine object was
* created with this capability (e.g., via \e gradp = true in
* SphericalHarmonic::Circle). If not, \e gradx, etc., will not be
* touched.
**********************************************************************/
double LongitudeSum(double lon,
[System::Runtime::InteropServices::Out] double% gradx,
[System::Runtime::InteropServices::Out] double% grady,
[System::Runtime::InteropServices::Out] double% gradz);
};
} //namespace NETGeographicLib

View File

@ -0,0 +1,130 @@
/**
* \file NETGeographicLib/DMS.cpp
* \brief Implementation for NETGeographicLib::DMS class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/DMS.hpp"
#include "DMS.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
//*****************************************************************************
double DMS::Decode( System::String^ dms,
[System::Runtime::InteropServices::Out] Flag% ind)
{
try
{
GeographicLib::DMS::flag lind;
double out = GeographicLib::DMS::Decode( StringConvert::ManagedToUnmanaged(dms), lind );
ind = static_cast<Flag>(lind);
return out;
}
catch ( const std::exception& xcpt )
{
throw gcnew GeographicErr( xcpt.what() );
}
}
//*****************************************************************************
double DMS::Decode(System::String^ str)
{
try
{
return GeographicLib::DMS::Decode(StringConvert::ManagedToUnmanaged(str));
}
catch ( const std::exception& xcpt )
{
throw gcnew GeographicErr( xcpt.what() );
}
}
//*****************************************************************************
void DMS::DecodeLatLon(System::String^ dmsa, System::String^ dmsb,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
bool swaplatlong )
{
try
{
double llat, llon;
GeographicLib::DMS::DecodeLatLon( StringConvert::ManagedToUnmanaged( dmsa ),
StringConvert::ManagedToUnmanaged( dmsb ), llat, llon, swaplatlong );
lat = llat;
lon = llon;
}
catch ( const std::exception& xcpt )
{
throw gcnew GeographicErr( xcpt.what() );
}
}
//*****************************************************************************
double DMS::DecodeAngle(System::String^ angstr)
{
try
{
return GeographicLib::DMS::DecodeAngle(StringConvert::ManagedToUnmanaged( angstr ));
}
catch ( const std::exception& xcpt )
{
throw gcnew GeographicErr( xcpt.what() );
}
}
//*****************************************************************************
double DMS::DecodeAzimuth(System::String^ azistr)
{
try
{
return GeographicLib::DMS::DecodeAzimuth(StringConvert::ManagedToUnmanaged( azistr ));
}
catch ( const std::exception& xcpt )
{
throw gcnew GeographicErr( xcpt.what() );
}
}
//*****************************************************************************
System::String^ DMS::Encode(double angle, Component trailing, unsigned prec,
Flag ind, char dmssep)
{
try
{
return StringConvert::UnmanagedToManaged(
GeographicLib::DMS::Encode( angle,
static_cast<GeographicLib::DMS::component>(trailing),
prec,
static_cast<GeographicLib::DMS::flag>(ind),
dmssep )
);
}
catch ( const std::exception& xcpt )
{
throw gcnew GeographicErr( xcpt.what() );
}
}
//*****************************************************************************
System::String^ DMS::Encode(double angle, unsigned prec, Flag ind,
char dmssep )
{
try
{
return StringConvert::UnmanagedToManaged(
GeographicLib::DMS::Encode( angle,
prec,
static_cast<GeographicLib::DMS::flag>(ind),
dmssep )
);
}
catch ( const std::exception& xcpt )
{
throw gcnew GeographicErr( xcpt.what() );
}
}

View File

@ -0,0 +1,326 @@
/**
* \file NETGeographicLib/DMS.h
* \brief Header for NETGeographicLib::DMS class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#pragma once
namespace NETGeographicLib
{
/**
* \brief .NET wrapper for GeographicLib::DMS.
*
* Parse a string representing degree, minutes, and seconds and return the
* angle in degrees and format an angle in degrees as degree, minutes, and
* seconds. In addition, handle NANs and infinities on input and output.
*
* C# Example:
* \include example-DMS.cs
* Managed C++ Example:
* \include example-DMS.cpp
* Visual Basic Example:
* \include example-DMS.vb
**********************************************************************/
public ref class DMS
{
public:
/**
* Indicator for presence of hemisphere indicator (N/S/E/W) on latitudes
* and longitudes.
**********************************************************************/
enum class Flag {
/**
* No indicator present.
* @hideinitializer
**********************************************************************/
NONE = 0,
/**
* Latitude indicator (N/S) present.
* @hideinitializer
**********************************************************************/
LATITUDE = 1,
/**
* Longitude indicator (E/W) present.
* @hideinitializer
**********************************************************************/
LONGITUDE = 2,
/**
* Used in Encode to indicate output of an azimuth in [000, 360) with no
* letter indicator.
* @hideinitializer
**********************************************************************/
AZIMUTH = 3,
/**
* Used in Encode to indicate output of a plain number.
* @hideinitializer
**********************************************************************/
NUMBER = 4,
};
/**
* Indicator for trailing units on an angle.
**********************************************************************/
enum class Component {
/**
* Trailing unit is degrees.
* @hideinitializer
**********************************************************************/
DEGREE = 0,
/**
* Trailing unit is arc minutes.
* @hideinitializer
**********************************************************************/
MINUTE = 1,
/**
* Trailing unit is arc seconds.
* @hideinitializer
**********************************************************************/
SECOND = 2,
};
/**
* Convert a string in DMS to an angle.
*
* @param[in] dms string input.
* @param[out] ind a DMS::flag value signaling the presence of a
* hemisphere indicator.
* @exception GeographicErr if \e dms is malformed (see below).
* @return angle (degrees).
*
* Degrees, minutes, and seconds are indicated by the characters d, '
* (single quote), &quot; (double quote), and these components may only be
* given in this order. Any (but not all) components may be omitted and
* other symbols (e.g., the &deg; symbol for degrees and the unicode
* prime and double prime symbols for minutes and seconds) may be
* substituted. The last component indicator may be omitted and is assumed
* to be the next smallest unit (thus 33d10 is interpreted as 33d10'). The
* final component may be a decimal fraction but the non-final components
* must be integers. Instead of using d, ', and &quot; to indicate
* degrees, minutes, and seconds, : (colon) may be used to <i>separate</i>
* these components (numbers must appear before and after each colon); thus
* 50d30'10.3&quot; may be written as 50:30:10.3, 5.5' may be written
* 0:5.5, and so on. The integer parts of the minutes and seconds
* components must be less than 60. A single leading sign is permitted. A
* hemisphere designator (N, E, W, S) may be added to the beginning or end
* of the string. The result is multiplied by the implied sign of the
* hemisphere designator (negative for S and W). In addition \e ind is set
* to DMS::LATITUDE if N or S is present, to DMS::LONGITUDE if E or W is
* present, and to DMS::NONE otherwise. Throws an error on a malformed
* string. No check is performed on the range of the result. Examples of
* legal and illegal strings are
* - <i>LEGAL</i> (all the entries on each line are equivalent)
* - -20.51125, 20d30'40.5&quot;S, -20&deg;30'40.5, -20d30.675,
* N-20d30'40.5&quot;, -20:30:40.5
* - 4d0'9, 4d9&quot;, 4d9'', 4:0:9, 004:00:09, 4.0025, 4.0025d, 4d0.15,
* 04:.15
* - <i>ILLEGAL</i> (the exception thrown explains the problem)
* - 4d5&quot;4', 4::5, 4:5:, :4:5, 4d4.5'4&quot;, -N20.5, 1.8e2d, 4:60,
* 4d-5'
*
* <b>NOTE:</b> At present, all the string handling in the C++
* implementation %GeographicLib is with 8-bit characters. The support for
* unicode symbols for degrees, minutes, and seconds is therefore via the
* <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> encoding. (The
* JavaScript implementation of this class uses unicode natively, of
* course.)
*
* Here is the list of Unicode symbols supported for degrees, minutes,
* seconds:
* - degrees:
* - d, D lower and upper case letters
* - U+00b0 degree symbol (&deg;)
* - U+00ba masculine ordinal indicator
* - U+2070 superscript zero
* - U+02da ring above
* - minutes:
* - ' apostrophe
* - U+2032 prime (&prime;)
* - U+00b4 acute accent
* - U+2019 right single quote (&rsquo;)
* - seconds:
* - &quot; quotation mark
* - U+2033 double prime (&Prime;)
* - U+201d right double quote (&rdquo;)
* - '&nbsp;' any two consecutive symbols for minutes
* .
* The codes with a leading zero byte, e.g., U+00b0, are accepted in their
* UTF-8 coded form 0xc2 0xb0 and as a single byte 0xb0.
**********************************************************************/
static double Decode(System::String^ dms,
[System::Runtime::InteropServices::Out] Flag% ind);
/**
* Convert DMS to an angle.
*
* @param[in] d degrees.
* @param[in] m arc minutes.
* @param[in] s arc seconds.
* @return angle (degrees)
*
* This does not propagate the sign on \e d to the other components, so
* -3d20' would need to be represented as - DMS::Decode(3.0, 20.0) or
* DMS::Decode(-3.0, -20.0).
**********************************************************************/
static double Decode(double d, double m, double s )
{ return d + (m + s/double(60))/double(60); }
/// \cond SKIP
/**
* <b>DEPRECATED</b> (use Utility::num, instead).
* Convert a string to a double number.
*
* @param[in] str string input.
* @exception GeographicErr if \e str is malformed.
* @return decoded number.
**********************************************************************/
static double Decode(System::String^ str);
/// \endcond
/**
* Convert a pair of strings to latitude and longitude.
*
* @param[in] dmsa first string.
* @param[in] dmsb second string.
* @param[out] lat latitude.
* @param[out] lon longitude reduced to the range [&minus;180&deg;,
* 180&deg;).
* @param[in] swaplatlong if true assume longitude is given before latitude
* in the absence of hemisphere designators (default false).
* @exception GeographicErr if \e dmsa or \e dmsb is malformed.
* @exception GeographicErr if \e dmsa and \e dmsb are both interpreted as
* latitudes.
* @exception GeographicErr if \e dmsa and \e dmsb are both interpreted as
* longitudes.
* @exception GeographicErr if decoded latitude is not in [&minus;90&deg;,
* 90&deg;].
* @exception GeographicErr if decoded longitude is not in
* [&minus;540&deg;, 540&deg;).
*
* By default, the \e lat (resp., \e lon) is assigned to the results of
* decoding \e dmsa (resp., \e dmsb). However this is overridden if either
* \e dmsa or \e dmsb contain a latitude or longitude hemisphere designator
* (N, S, E, W). If an exception is thrown, \e lat and \e lon are
* unchanged.
**********************************************************************/
static void DecodeLatLon(System::String^ dmsa, System::String^ dmsb,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
bool swaplatlong );
/**
* Convert a string to an angle in degrees.
*
* @param[in] angstr input string.
* @exception GeographicErr if \e angstr is malformed.
* @exception GeographicErr if \e angstr includes a hemisphere designator.
* @return angle (degrees)
*
* No hemisphere designator is allowed and no check is done on the range of
* the result.
**********************************************************************/
static double DecodeAngle(System::String^ angstr);
/**
* Convert a string to an azimuth in degrees.
*
* @param[in] azistr input string.
* @exception GeographicErr if \e azistr is malformed.
* @exception GeographicErr if \e azistr includes a N/S designator.
* @exception GeographicErr if decoded azimuth is not in
* [&minus;540&deg;, 540&deg;).
* @return azimuth (degrees) reduced to the range [&minus;180&deg;,
* 180&deg;).
*
* A hemisphere designator E/W can be used; the result is multiplied by
* &minus;1 if W is present.
**********************************************************************/
static double DecodeAzimuth(System::String^ azistr);
/**
* Convert angle (in degrees) into a DMS string (using d, ', and &quot;).
*
* @param[in] angle input angle (degrees)
* @param[in] trailing DMS::component value indicating the trailing units
* on the string and this is given as a decimal number if necessary.
* @param[in] prec the number of digits after the decimal point for the
* trailing component.
* @param[in] ind DMS::flag value indicated additional formatting.
* @param[in] dmssep if non-null, use as the DMS separator character
* (instead of d, ', &quot; delimiters).
* @exception GeographicErr if memory for the string can't be allocated.
* @return formatted string
*
* The interpretation of \e ind is as follows:
* - ind == DMS::NONE, signed result no leading zeros on degrees except in
* the units place, e.g., -8d03'.
* - ind == DMS::LATITUDE, trailing N or S hemisphere designator, no sign,
* pad degrees to 2 digits, e.g., 08d03'S.
* - ind == DMS::LONGITUDE, trailing E or W hemisphere designator, no
* sign, pad degrees to 3 digits, e.g., 008d03'W.
* - ind == DMS::AZIMUTH, convert to the range [0, 360&deg;), no
* sign, pad degrees to 3 digits, , e.g., 351d57'.
* .
* The integer parts of the minutes and seconds components are always given
* with 2 digits.
**********************************************************************/
static System::String^ Encode(double angle, Component trailing, unsigned prec,
Flag ind, char dmssep );
/**
* Convert angle into a DMS string (using d, ', and &quot;) selecting the
* trailing component based on the precision.
*
* @param[in] angle input angle (degrees)
* @param[in] prec the precision relative to 1 degree.
* @param[in] ind DMS::flag value indicated additional formatting.
* @param[in] dmssep if non-null, use as the DMS separator character
* (instead of d, ', &quot; delimiters).
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return formatted string
*
* \e prec indicates the precision relative to 1 degree, e.g., \e prec = 3
* gives a result accurate to 0.1' and \e prec = 4 gives a result accurate
* to 1&quot;. \e ind is interpreted as in DMS::Encode with the additional
* facility that DMS::NUMBER represents \e angle as a number in fixed
* format with precision \e prec.
**********************************************************************/
static System::String^ Encode(double angle, unsigned prec, Flag ind,
char dmssep );
/**
* Split angle into degrees and minutes
*
* @param[in] ang angle (degrees)
* @param[out] d degrees (an integer returned as a double)
* @param[out] m arc minutes.
**********************************************************************/
static void Encode(double ang,
[System::Runtime::InteropServices::Out] double% d,
[System::Runtime::InteropServices::Out] double% m)
{
d = int(ang); m = 60 * (ang - d);
}
/**
* Split angle into degrees and minutes and seconds.
*
* @param[in] ang angle (degrees)
* @param[out] d degrees (an integer returned as a double)
* @param[out] m arc minutes (an integer returned as a double)
* @param[out] s arc seconds.
**********************************************************************/
static void Encode(double ang,
[System::Runtime::InteropServices::Out] double% d,
[System::Runtime::InteropServices::Out] double% m,
[System::Runtime::InteropServices::Out] double% s)
{
d = int(ang); ang = 60 * (ang - d);
m = int(ang); s = 60 * (ang - m);
}
};
} // namespace NETGeographicLib

View File

@ -0,0 +1,270 @@
/**
* \file NETGeographicLib/Ellipsoid.cpp
* \brief Implementation for NETGeographicLib::Ellipsoid class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/Ellipsoid.hpp"
#include "Ellipsoid.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::Ellipsoid";
//*****************************************************************************
Ellipsoid::!Ellipsoid(void)
{
if ( m_pEllipsoid != NULL )
{
delete m_pEllipsoid;
m_pEllipsoid = NULL;
}
}
//*****************************************************************************
Ellipsoid::Ellipsoid()
{
try
{
m_pEllipsoid = new GeographicLib::Ellipsoid( GeographicLib::Ellipsoid::WGS84 );
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
Ellipsoid::Ellipsoid(double a, double f)
{
try
{
m_pEllipsoid = new GeographicLib::Ellipsoid( a, f );
}
catch ( std::bad_alloc err )
{
throw gcnew GeographicErr( BADALLOC );
}
catch ( const std::exception& err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
double Ellipsoid::ParametricLatitude(double phi)
{
return m_pEllipsoid->ParametricLatitude( phi );
}
//*****************************************************************************
double Ellipsoid::InverseParametricLatitude(double beta)
{
return m_pEllipsoid->InverseParametricLatitude( beta );
}
//*****************************************************************************
double Ellipsoid::GeocentricLatitude(double phi)
{
return m_pEllipsoid->GeocentricLatitude( phi );
}
//*****************************************************************************
double Ellipsoid::InverseGeocentricLatitude(double theta)
{
return m_pEllipsoid->InverseGeocentricLatitude( theta );
}
//*****************************************************************************
double Ellipsoid::RectifyingLatitude(double phi)
{
return m_pEllipsoid->RectifyingLatitude( phi );
}
//*****************************************************************************
double Ellipsoid::InverseRectifyingLatitude(double mu)
{
return m_pEllipsoid->InverseRectifyingLatitude( mu );
}
//*****************************************************************************
double Ellipsoid::AuthalicLatitude(double phi)
{
return m_pEllipsoid->AuthalicLatitude( phi );
}
//*****************************************************************************
double Ellipsoid::InverseAuthalicLatitude(double xi)
{
return m_pEllipsoid->InverseAuthalicLatitude( xi );
}
//*****************************************************************************
double Ellipsoid::ConformalLatitude(double phi)
{
return m_pEllipsoid->ConformalLatitude( phi );
}
//*****************************************************************************
double Ellipsoid::InverseConformalLatitude(double chi)
{
return m_pEllipsoid->InverseConformalLatitude( chi );
}
//*****************************************************************************
double Ellipsoid::IsometricLatitude(double phi)
{
return m_pEllipsoid->IsometricLatitude( phi );
}
//*****************************************************************************
double Ellipsoid::InverseIsometricLatitude(double psi)
{
return m_pEllipsoid->InverseIsometricLatitude( psi );
}
//*****************************************************************************
double Ellipsoid::CircleRadius(double phi)
{
return m_pEllipsoid->CircleRadius( phi );
}
//*****************************************************************************
double Ellipsoid::CircleHeight(double phi)
{
return m_pEllipsoid->CircleHeight( phi );
}
//*****************************************************************************
double Ellipsoid::MeridianDistance(double phi)
{
return m_pEllipsoid->MeridianDistance( phi );
}
//*****************************************************************************
double Ellipsoid::MeridionalCurvatureRadius(double phi)
{
return m_pEllipsoid->MeridionalCurvatureRadius( phi );
}
//*****************************************************************************
double Ellipsoid::TransverseCurvatureRadius(double phi)
{
return m_pEllipsoid->TransverseCurvatureRadius( phi );
}
//*****************************************************************************
double Ellipsoid::NormalCurvatureRadius(double phi, double azi)
{
return m_pEllipsoid->NormalCurvatureRadius( phi, azi );
}
//*****************************************************************************
double Ellipsoid::SecondFlatteningToFlattening(double fp)
{
return GeographicLib::Ellipsoid::SecondFlatteningToFlattening( fp );
}
//*****************************************************************************
double Ellipsoid::FlatteningToSecondFlattening(double f)
{
return GeographicLib::Ellipsoid::FlatteningToSecondFlattening( f );
}
//*****************************************************************************
double Ellipsoid::ThirdFlatteningToFlattening(double n)
{
return GeographicLib::Ellipsoid::ThirdFlatteningToFlattening( n );
}
//*****************************************************************************
double Ellipsoid::FlatteningToThirdFlattening(double f)
{
return GeographicLib::Ellipsoid::FlatteningToThirdFlattening( f );
}
//*****************************************************************************
double Ellipsoid::EccentricitySqToFlattening(double e2)
{
return GeographicLib::Ellipsoid::EccentricitySqToFlattening( e2 );
}
//*****************************************************************************
double Ellipsoid::FlatteningToEccentricitySq(double f)
{
return GeographicLib::Ellipsoid::FlatteningToEccentricitySq( f );
}
//*****************************************************************************
double Ellipsoid::SecondEccentricitySqToFlattening(double ep2)
{
return GeographicLib::Ellipsoid::SecondEccentricitySqToFlattening( ep2 );
}
//*****************************************************************************
double Ellipsoid::FlatteningToSecondEccentricitySq(double f)
{
return GeographicLib::Ellipsoid::FlatteningToSecondEccentricitySq( f );
}
//*****************************************************************************
double Ellipsoid::ThirdEccentricitySqToFlattening(double epp2)
{
return GeographicLib::Ellipsoid::ThirdEccentricitySqToFlattening( epp2 );
}
//*****************************************************************************
double Ellipsoid::FlatteningToThirdEccentricitySq(double f)
{
return GeographicLib::Ellipsoid::FlatteningToThirdEccentricitySq( f );
}
//*****************************************************************************
double Ellipsoid::MajorRadius::get()
{ return m_pEllipsoid->MajorRadius(); }
//*****************************************************************************
double Ellipsoid::MinorRadius::get()
{ return m_pEllipsoid->MinorRadius(); }
//*****************************************************************************
double Ellipsoid::QuarterMeridian::get()
{ return m_pEllipsoid->QuarterMeridian(); }
//*****************************************************************************
double Ellipsoid::Area::get()
{ return m_pEllipsoid->Area(); }
//*****************************************************************************
double Ellipsoid::Volume::get()
{ return m_pEllipsoid->Volume(); }
//*****************************************************************************
double Ellipsoid::Flattening::get()
{ return m_pEllipsoid->Flattening(); }
//*****************************************************************************
double Ellipsoid::SecondFlattening::get()
{ return m_pEllipsoid->SecondFlattening(); }
//*****************************************************************************
double Ellipsoid::ThirdFlattening::get()
{ return m_pEllipsoid->ThirdFlattening(); }
//*****************************************************************************
double Ellipsoid::EccentricitySq::get()
{ return m_pEllipsoid->EccentricitySq(); }
//*****************************************************************************
double Ellipsoid::SecondEccentricitySq::get()
{ return m_pEllipsoid->SecondEccentricitySq(); }
//*****************************************************************************
double Ellipsoid::ThirdEccentricitySq::get()
{ return m_pEllipsoid->ThirdEccentricitySq(); }

View File

@ -0,0 +1,521 @@
/**
* \file NETGeographicLib/Ellipsoid.h
* \brief Header for NETGeographicLib::Ellipsoid class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#pragma once
namespace NETGeographicLib
{
/**
* \brief .NET wrapper for GeographicLib::Ellipsoid.
*
* This class allows .NET applications to access GeographicLib::Ellipsoid.
*
* This class returns various properties of the ellipsoid and converts
* between various types of latitudes. The latitude conversions are also
* possible using the various projections supported by %GeographicLib; but
* Ellipsoid provides more direct access (sometimes using private functions
* of the projection classes). Ellipsoid::RectifyingLatitude,
* Ellipsoid::InverseRectifyingLatitude, and Ellipsoid::MeridianDistance
* provide functionality which can be provided by the Geodesic class.
* However Geodesic uses a series approximation (valid for abs \e f < 1/150),
* whereas Ellipsoid computes these quantities using EllipticFunction which
* provides accurate results even when \e f is large. Use of this class
* should be limited to &minus;3 < \e f < 3/4 (i.e., 1/4 < b/a < 4).
*
* C# Example:
* \include example-Ellipsoid.cs
* Managed C++ Example:
* \include example-Ellipsoid.cpp
* Visual Basic Example:
* \include example-Ellipsoid.vb
*
* <B>INTERFACE DIFFERENCES:</B><BR>
* A default constructor has been provided that assumes a WGS84 ellipsoid.
*
* The following functions are implemented as properties:
* MajorRadius, MinorRadius, QuarterMeridian, Area, Volume, Flattening,
* SecondFlattening, ThirdFlattening, EccentricitySq, SecondEccentricitySq,
* and ThirdEccentricitySq.
**********************************************************************/
public ref class Ellipsoid
{
private:
// A pointer to the unmanaged GeographicLib::Ellipsoid
GeographicLib::Ellipsoid* m_pEllipsoid;
// Th efinalizer frees the unmanaged memory when the object is destroyed.
!Ellipsoid();
public:
/** \name Constructor
**********************************************************************/
///@{
/**
* Constructor for a WGS84 ellipsoid
**********************************************************************/
Ellipsoid();
/**
* Constructor for a ellipsoid with
*
* @param[in] a equatorial radius (meters).
* @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
* Negative \e f gives a prolate ellipsoid. If \e f > 1, set flattening
* to 1/\e f.
* @exception GeographicErr if \e a or (1 &minus; \e f ) \e a is not
* positive.
**********************************************************************/
Ellipsoid(double a, double f);
///@}
/** The destructor calls the finalizer.
**********************************************************************/
~Ellipsoid()
{ this->!Ellipsoid(); }
/** \name %Ellipsoid dimensions.
**********************************************************************/
///@{
/**
* @return \e a the equatorial radius of the ellipsoid (meters). This is
* the value used in the constructor.
**********************************************************************/
property double MajorRadius { double get(); }
/**
* @return \e b the polar semi-axis (meters).
**********************************************************************/
property double MinorRadius { double get(); }
/**
* @return \e L the distance between the equator and a pole along a
* meridian (meters). For a sphere \e L = (&pi;/2) \e a. The radius
* of a sphere with the same meridian length is \e L / (&pi;/2).
**********************************************************************/
property double QuarterMeridian { double get(); }
/**
* @return \e A the total area of the ellipsoid (meters<sup>2</sup>). For
* a sphere \e A = 4&pi; <i>a</i><sup>2</sup>. The radius of a sphere
* with the same area is sqrt(\e A / (4&pi;)).
**********************************************************************/
property double Area { double get(); }
/**
* @return \e V the total volume of the ellipsoid (meters<sup>3</sup>).
* For a sphere \e V = (4&pi; / 3) <i>a</i><sup>3</sup>. The radius of
* a sphere with the same volume is cbrt(\e V / (4&pi;/3)).
**********************************************************************/
property double Volume { double get(); }
///@}
/** \name %Ellipsoid shape
**********************************************************************/
///@{
/**
* @return \e f = (\e a &minus; \e b) / \e a, the flattening of the
* ellipsoid. This is the value used in the constructor. This is zero,
* positive, or negative for a sphere, oblate ellipsoid, or prolate
* ellipsoid.
**********************************************************************/
property double Flattening { double get(); }
/**
* @return \e f ' = (\e a &minus; \e b) / \e b, the second flattening of
* the ellipsoid. This is zero, positive, or negative for a sphere,
* oblate ellipsoid, or prolate ellipsoid.
**********************************************************************/
property double SecondFlattening { double get(); }
/**
* @return \e n = (\e a &minus; \e b) / (\e a + \e b), the third flattening
* of the ellipsoid. This is zero, positive, or negative for a sphere,
* oblate ellipsoid, or prolate ellipsoid.
**********************************************************************/
property double ThirdFlattening { double get(); }
/**
* @return <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
* <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity squared
* of the ellipsoid. This is zero, positive, or negative for a sphere,
* oblate ellipsoid, or prolate ellipsoid.
**********************************************************************/
property double EccentricitySq { double get(); }
/**
* @return <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
* <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
* squared of the ellipsoid. This is zero, positive, or negative for a
* sphere, oblate ellipsoid, or prolate ellipsoid.
**********************************************************************/
property double SecondEccentricitySq { double get(); }
/**
* @return <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
* <i>b</i><sup>2</sup>) / (<i>a</i><sup>2</sup> + <i>b</i><sup>2</sup>),
* the third eccentricity squared of the ellipsoid. This is zero,
* positive, or negative for a sphere, oblate ellipsoid, or prolate
* ellipsoid.
**********************************************************************/
property double ThirdEccentricitySq { double get(); }
///@}
/** \name Latitude conversion.
**********************************************************************/
///@{
/**
* @param[in] phi the geographic latitude (degrees).
* @return &beta; the parametric latitude (degrees).
*
* The geographic latitude, &phi;, is the angle beween the equatorial
* plane and a vector normal to the surface of the ellipsoid.
*
* The parametric latitude (also called the reduced latitude), &beta;,
* allows the cartesian coordinated of a meridian to be expressed
* conveniently in parametric form as
* - \e R = \e a cos &beta;
* - \e Z = \e b sin &beta;
* .
* where \e a and \e b are the equatorial radius and the polar semi-axis.
* For a sphere &beta; = &phi;.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &beta; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double ParametricLatitude(double phi);
/**
* @param[in] beta the parametric latitude (degrees).
* @return &phi; the geographic latitude (degrees).
*
* &beta; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &phi; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double InverseParametricLatitude(double beta);
/**
* @param[in] phi the geographic latitude (degrees).
* @return &theta; the geocentric latitude (degrees).
*
* The geocentric latitude, &theta;, is the angle beween the equatorial
* plane and a line between the center of the ellipsoid and a point on the
* ellipsoid. For a sphere &theta; = &phi;.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &theta; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double GeocentricLatitude(double phi);
/**
* @param[in] theta the geocentric latitude (degrees).
* @return &phi; the geographic latitude (degrees).
*
* &theta; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &phi; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double InverseGeocentricLatitude(double theta);
/**
* @param[in] phi the geographic latitude (degrees).
* @return &mu; the rectifying latitude (degrees).
*
* The rectifying latitude, &mu;, has the property that the distance along
* a meridian of the ellipsoid between two points with rectifying latitudes
* &mu;<sub>1</sub> and &mu;<sub>2</sub> is equal to
* (&mu;<sub>2</sub> - &mu;<sub>1</sub>) \e L / 90&deg;,
* where \e L = QuarterMeridian(). For a sphere &mu; = &phi;.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &mu; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double RectifyingLatitude(double phi);
/**
* @param[in] mu the rectifying latitude (degrees).
* @return &phi; the geographic latitude (degrees).
*
* &mu; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &phi; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double InverseRectifyingLatitude(double mu);
/**
* @param[in] phi the geographic latitude (degrees).
* @return &xi; the authalic latitude (degrees).
*
* The authalic latitude, &xi;, has the property that the area of the
* ellipsoid between two circles with authalic latitudes
* &xi;<sub>1</sub> and &xi;<sub>2</sub> is equal to (sin
* &xi;<sub>2</sub> - sin &xi;<sub>1</sub>) \e A / 2, where \e A
* = Area(). For a sphere &xi; = &phi;.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &xi; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double AuthalicLatitude(double phi);
/**
* @param[in] xi the authalic latitude (degrees).
* @return &phi; the geographic latitude (degrees).
*
* &xi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &phi; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double InverseAuthalicLatitude(double xi);
/**
* @param[in] phi the geographic latitude (degrees).
* @return &chi; the conformal latitude (degrees).
*
* The conformal latitude, &chi;, gives the mapping of the ellipsoid to a
* sphere which which is conformal (angles are preserved) and in which the
* equator of the ellipsoid maps to the equator of the sphere. For a
* sphere &chi; = &phi;.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &chi; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double ConformalLatitude(double phi);
/**
* @param[in] chi the conformal latitude (degrees).
* @return &phi; the geographic latitude (degrees).
*
* &chi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold. The returned value
* &phi; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double InverseConformalLatitude(double chi);
/**
* @param[in] phi the geographic latitude (degrees).
* @return &psi; the isometric latitude (degrees).
*
* The isometric latitude gives the mapping of the ellipsoid to a plane
* which which is conformal (angles are preserved) and in which the equator
* of the ellipsoid maps to a straight line of constant scale; this mapping
* defines the Mercator projection. For a sphere &psi; =
* sinh<sup>&minus;1</sup> tan &phi;.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold.
**********************************************************************/
double IsometricLatitude(double phi);
/**
* @param[in] psi the isometric latitude (degrees).
* @return &phi; the geographic latitude (degrees).
*
* The returned value &phi; lies in [&minus;90&deg;, 90&deg;].
**********************************************************************/
double InverseIsometricLatitude(double psi);
///@}
/** \name Other quantities.
**********************************************************************/
///@{
/**
* @param[in] phi the geographic latitude (degrees).
* @return \e R = \e a cos &beta; the radius of a circle of latitude
* &phi; (meters). \e R (&pi;/180&deg;) gives meters per degree
* longitude measured along a circle of latitude.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold.
**********************************************************************/
double CircleRadius(double phi);
/**
* @param[in] phi the geographic latitude (degrees).
* @return \e Z = \e b sin &beta; the distance of a circle of latitude
* &phi; from the equator measured parallel to the ellipsoid axis
* (meters).
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold.
**********************************************************************/
double CircleHeight(double phi);
/**
* @param[in] phi the geographic latitude (degrees).
* @return \e s the distance along a meridian
* between the equator and a point of latitude &phi; (meters). \e s is
* given by \e s = &mu; \e L / 90&deg;, where \e L =
* QuarterMeridian()).
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold.
**********************************************************************/
double MeridianDistance(double phi);
/**
* @param[in] phi the geographic latitude (degrees).
* @return &rho; the meridional radius of curvature of the ellipsoid at
* latitude &phi; (meters); this is the curvature of the meridian. \e
* rho is given by &rho; = (180&deg;/&pi;) d\e s / d&phi;,
* where \e s = MeridianDistance(); thus &rho; (&pi;/180&deg;)
* gives meters per degree latitude measured along a meridian.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold.
**********************************************************************/
double MeridionalCurvatureRadius(double phi);
/**
* @param[in] phi the geographic latitude (degrees).
* @return &nu; the transverse radius of curvature of the ellipsoid at
* latitude &phi; (meters); this is the curvature of a curve on the
* ellipsoid which also lies in a plane perpendicular to the ellipsoid
* and to the meridian. &nu; is related to \e R = CircleRadius() by \e
* R = &nu; cos &phi;.
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
* result is undefined if this condition does not hold.
**********************************************************************/
double TransverseCurvatureRadius(double phi);
/**
* @param[in] phi the geographic latitude (degrees).
* @param[in] azi the angle between the meridian and the normal section
* (degrees).
* @return the radius of curvature of the ellipsoid in the normal
* section at latitude &phi; inclined at an angle \e azi to the
* meridian (meters).
*
* &phi; must lie in the range [&minus;90&deg;, 90&deg;] and \e
* azi must lie in the range [&minus;540&deg;, 540&deg;); the
* result is undefined if either of conditions does not hold.
**********************************************************************/
double NormalCurvatureRadius(double phi, double azi);
///@}
/** \name Eccentricity conversions.
**********************************************************************/
///@{
/**
* @param[in] fp = \e f ' = (\e a &minus; \e b) / \e b, the second
* flattening.
* @return \e f = (\e a &minus; \e b) / \e a, the flattening.
*
* \e f ' should lie in (&minus;1, &infin;).
* The returned value \e f lies in (&minus;&infin;, 1).
**********************************************************************/
static double SecondFlatteningToFlattening(double fp);
/**
* @param[in] f = (\e a &minus; \e b) / \e a, the flattening.
* @return \e f ' = (\e a &minus; \e b) / \e b, the second flattening.
*
* \e f should lie in (&minus;&infin;, 1).
* The returned value \e f ' lies in (&minus;1, &infin;).
**********************************************************************/
static double FlatteningToSecondFlattening(double f);
/**
* @param[in] n = (\e a &minus; \e b) / (\e a + \e b), the third
* flattening.
* @return \e f = (\e a &minus; \e b) / \e a, the flattening.
*
* \e n should lie in (&minus;1, 1).
* The returned value \e f lies in (&minus;&infin;, 1).
**********************************************************************/
static double ThirdFlatteningToFlattening(double n);
/**
* @param[in] f = (\e a &minus; \e b) / \e a, the flattening.
* @return \e n = (\e a &minus; \e b) / (\e a + \e b), the third
* flattening.
*
* \e f should lie in (&minus;&infin;, 1).
* The returned value \e n lies in (&minus;1, 1).
**********************************************************************/
static double FlatteningToThirdFlattening(double f);
/**
* @param[in] e2 = <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
* <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity
* squared.
* @return \e f = (\e a &minus; \e b) / \e a, the flattening.
*
* <i>e</i><sup>2</sup> should lie in (&minus;&infin;, 1).
* The returned value \e f lies in (&minus;&infin;, 1).
**********************************************************************/
static double EccentricitySqToFlattening(double e2);
/**
* @param[in] f = (\e a &minus; \e b) / \e a, the flattening.
* @return <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
* <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity
* squared.
*
* \e f should lie in (&minus;&infin;, 1).
* The returned value <i>e</i><sup>2</sup> lies in (&minus;&infin;, 1).
**********************************************************************/
static double FlatteningToEccentricitySq(double f);
/**
* @param[in] ep2 = <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
* <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
* squared.
* @return \e f = (\e a &minus; \e b) / \e a, the flattening.
*
* <i>e'</i> <sup>2</sup> should lie in (&minus;1, &infin;).
* The returned value \e f lies in (&minus;&infin;, 1).
**********************************************************************/
static double SecondEccentricitySqToFlattening(double ep2);
/**
* @param[in] f = (\e a &minus; \e b) / \e a, the flattening.
* @return <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
* <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
* squared.
*
* \e f should lie in (&minus;&infin;, 1).
* The returned value <i>e'</i> <sup>2</sup> lies in (&minus;1, &infin;).
**********************************************************************/
static double FlatteningToSecondEccentricitySq(double f);
/**
* @param[in] epp2 = <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup>
* &minus; <i>b</i><sup>2</sup>) / (<i>a</i><sup>2</sup> +
* <i>b</i><sup>2</sup>), the third eccentricity squared.
* @return \e f = (\e a &minus; \e b) / \e a, the flattening.
*
* <i>e''</i> <sup>2</sup> should lie in (&minus;1, 1).
* The returned value \e f lies in (&minus;&infin;, 1).
**********************************************************************/
static double ThirdEccentricitySqToFlattening(double epp2);
/**
* @param[in] f = (\e a &minus; \e b) / \e a, the flattening.
* @return <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
* <i>b</i><sup>2</sup>) / (<i>a</i><sup>2</sup> + <i>b</i><sup>2</sup>),
* the third eccentricity squared.
*
* \e f should lie in (&minus;&infin;, 1).
* The returned value <i>e''</i> <sup>2</sup> lies in (&minus;1, 1).
**********************************************************************/
static double FlatteningToThirdEccentricitySq(double f);
};
} // namespace NETGeographicLib

View File

@ -0,0 +1,311 @@
/**
* \file NETGeographicLib/EllipticFunction.cpp
* \brief Implementation for NETGeographicLib::EllipticFunction class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/EllipticFunction.hpp"
#include "EllipticFunction.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
const char BADALLOC[] = "Failed to allocate memory for the GeographicLib::EllipticFunction.";
//*****************************************************************************
EllipticFunction::EllipticFunction(double k2, double alpha2)
{
try
{
m_pEllipticFunction = new GeographicLib::EllipticFunction( k2, alpha2 );
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
EllipticFunction::EllipticFunction(double k2, double alpha2, double kp2, double alphap2)
{
try
{
m_pEllipticFunction = new GeographicLib::EllipticFunction( k2, alpha2, kp2, alphap2 );
}
catch ( std::bad_alloc err )
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
EllipticFunction::!EllipticFunction()
{
if ( m_pEllipticFunction != NULL )
{
delete m_pEllipticFunction;
m_pEllipticFunction = NULL;
}
}
//*****************************************************************************
void EllipticFunction::Reset(double k2, double alpha2 )
{
m_pEllipticFunction->Reset( k2, alpha2 );
}
//*****************************************************************************
void EllipticFunction::Reset(double k2, double alpha2, double kp2, double alphap2)
{
m_pEllipticFunction->Reset( k2, alpha2, kp2, alphap2 );
}
//*****************************************************************************
double EllipticFunction::K()
{
return m_pEllipticFunction->K();
}
//*****************************************************************************
double EllipticFunction::E()
{
return m_pEllipticFunction->E();
}
//*****************************************************************************
double EllipticFunction::D()
{
return m_pEllipticFunction->D();
}
//*****************************************************************************
double EllipticFunction::KE()
{
return m_pEllipticFunction->KE();
}
//*****************************************************************************
double EllipticFunction::Pi()
{
return m_pEllipticFunction->Pi();
}
//*****************************************************************************
double EllipticFunction::G()
{
return m_pEllipticFunction->G();
}
//*****************************************************************************
double EllipticFunction::H()
{
return m_pEllipticFunction->H();
}
//*****************************************************************************
double EllipticFunction::F(double phi)
{
return m_pEllipticFunction->F( phi );
}
//*****************************************************************************
double EllipticFunction::E(double phi)
{
return m_pEllipticFunction->E( phi );
}
//*****************************************************************************
double EllipticFunction::Ed(double ang)
{
return m_pEllipticFunction->Ed(ang);
}
//*****************************************************************************
double EllipticFunction::Einv(double x)
{
return m_pEllipticFunction->Einv(x);
}
//*****************************************************************************
double EllipticFunction::Pi(double phi)
{
return m_pEllipticFunction->Pi(phi);
}
//*****************************************************************************
double EllipticFunction::D(double phi)
{
return m_pEllipticFunction->D(phi);
}
//*****************************************************************************
double EllipticFunction::G(double phi)
{
return m_pEllipticFunction->G(phi);
}
//*****************************************************************************
double EllipticFunction::H(double phi)
{
return m_pEllipticFunction->H(phi);
}
//*****************************************************************************
double EllipticFunction::F(double sn, double cn, double dn)
{
return m_pEllipticFunction->F( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::E(double sn, double cn, double dn)
{
return m_pEllipticFunction->E( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::Pi(double sn, double cn, double dn)
{
return m_pEllipticFunction->Pi( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::D(double sn, double cn, double dn)
{
return m_pEllipticFunction->D( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::G(double sn, double cn, double dn)
{
return m_pEllipticFunction->G( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::H(double sn, double cn, double dn)
{
return m_pEllipticFunction->H( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::deltaF(double sn, double cn, double dn)
{
return m_pEllipticFunction->deltaF( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::deltaE(double sn, double cn, double dn)
{
return m_pEllipticFunction->deltaE( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::deltaEinv(double stau, double ctau)
{
return m_pEllipticFunction->deltaEinv( stau, ctau );
}
//*****************************************************************************
double EllipticFunction::deltaPi(double sn, double cn, double dn)
{
return m_pEllipticFunction->deltaPi( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::deltaD(double sn, double cn, double dn)
{
return m_pEllipticFunction->deltaD( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::deltaG(double sn, double cn, double dn)
{
return m_pEllipticFunction->deltaG( sn, cn, dn );
}
//*****************************************************************************
double EllipticFunction::deltaH(double sn, double cn, double dn)
{
return m_pEllipticFunction->deltaH( sn, cn, dn );
}
//*****************************************************************************
void EllipticFunction::sncndn(double x,
[System::Runtime::InteropServices::Out] double% sn,
[System::Runtime::InteropServices::Out] double% cn,
[System::Runtime::InteropServices::Out] double% dn)
{
double lsn, lcn, ldn;
m_pEllipticFunction->sncndn( x, lsn, lcn, ldn );
sn = lsn;
cn = lcn;
dn = ldn;
}
//*****************************************************************************
double EllipticFunction::Delta(double sn, double cn)
{
return m_pEllipticFunction->Delta( sn, cn );
}
//*****************************************************************************
double EllipticFunction::RF(double x, double y, double z)
{
return GeographicLib::EllipticFunction::RF( x, y, z );
}
//*****************************************************************************
double EllipticFunction::RF(double x, double y)
{
return GeographicLib::EllipticFunction::RF( x, y );
}
//*****************************************************************************
double EllipticFunction::RC(double x, double y)
{
return GeographicLib::EllipticFunction::RC( x, y );
}
//*****************************************************************************
double EllipticFunction::RG(double x, double y, double z)
{
return GeographicLib::EllipticFunction::RG( x, y, z );
}
//*****************************************************************************
double EllipticFunction::RG(double x, double y)
{
return GeographicLib::EllipticFunction::RG( x, y );
}
//*****************************************************************************
double EllipticFunction::RJ(double x, double y, double z, double p)
{
return GeographicLib::EllipticFunction::RJ( x, y, z, p );
}
//*****************************************************************************
double EllipticFunction::RD(double x, double y, double z)
{
return GeographicLib::EllipticFunction::RD( x, y, z );
}
//*****************************************************************************
double EllipticFunction::k2::get()
{ return m_pEllipticFunction->k2(); }
//*****************************************************************************
double EllipticFunction::kp2::get()
{ return m_pEllipticFunction->kp2(); }
//*****************************************************************************
double EllipticFunction::alpha2::get()
{ return m_pEllipticFunction->alpha2(); }
//*****************************************************************************
double EllipticFunction::alphap2::get()
{ return m_pEllipticFunction->alpha2(); }

View File

@ -0,0 +1,698 @@
/**
* \file NETGeographicLib/EllipticFunction.h
* \brief Header for NETGeographicLib::EllipticFunction class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#pragma once
namespace NETGeographicLib
{
/**
* \brief .NET wrapper for GeographicLib::EllipticFunction.
*
* This class allows .NET applications to access GeographicLib::EllipticFunction.
*
* This provides the elliptic functions and integrals needed for Ellipsoid,
* GeodesicExact, and TransverseMercatorExact. Two categories of function
* are provided:
* - \e static functions to compute symmetric elliptic integrals
* (http://dlmf.nist.gov/19.16.i)
* - \e member functions to compute Legrendre's elliptic
* integrals (http://dlmf.nist.gov/19.2.ii) and the
* Jacobi elliptic functions (http://dlmf.nist.gov/22.2).
* .
* In the latter case, an object is constructed giving the modulus \e k (and
* optionally the parameter &alpha;<sup>2</sup>). The modulus is always
* passed as its square <i>k</i><sup>2</sup> which allows \e k to be pure
* imaginary (<i>k</i><sup>2</sup> &lt; 0). (Confusingly, Abramowitz and
* Stegun call \e m = <i>k</i><sup>2</sup> the "parameter" and \e n =
* &alpha;<sup>2</sup> the "characteristic".)
*
* In geodesic applications, it is convenient to separate the incomplete
* integrals into secular and periodic components, e.g.,
* \f[
* E(\phi, k) = (2 E(\phi) / \pi) [ \phi + \delta E(\phi, k) ]
* \f]
* where &delta;\e E(&phi;, \e k) is an odd periodic function with period
* &pi;.
*
* The computation of the elliptic integrals uses the algorithms given in
* - B. C. Carlson,
* <a href="http://dx.doi.org/10.1007/BF02198293"> Computation of real or
* complex elliptic integrals</a>, Numerical Algorithms 10, 13--26 (1995)
* .
* with the additional optimizations given in http://dlmf.nist.gov/19.36.i.
* The computation of the Jacobi elliptic functions uses the algorithm given
* in
* - R. Bulirsch,
* <a href="http://dx.doi.org/10.1007/BF01397975"> Numerical Calculation of
* Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik 7,
* 78--90 (1965).
* .
* The notation follows http://dlmf.nist.gov/19 and http://dlmf.nist.gov/22
*
* C# Example:
* \include example-EllipticFunction.cs
* Managed C++ Example:
* \include example-EllipticFunction.cpp
* Visual Basic Example:
* \include example-EllipticFunction.vb
*
* <B>INTERFACE DIFFERENCES:</B><BR>
* The k2, kp2, alpha2, and alphap2 functions are implemented as properties.
**********************************************************************/
public ref class EllipticFunction
{
private:
// a pointer to the unmanaged GeographicLib::EllipticFunction.
GeographicLib::EllipticFunction* m_pEllipticFunction;
// The finalizer frees the unmanaged memory.
!EllipticFunction();
public:
/** \name Constructor
**********************************************************************/
///@{
/**
* Constructor specifying the modulus and parameter.
*
* @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
* <i>k</i><sup>2</sup> must lie in (-&infin;, 1). (No checking is
* done.)
* @param[in] alpha2 the parameter &alpha;<sup>2</sup>.
* &alpha;<sup>2</sup> must lie in (-&infin;, 1). (No checking is done.)
*
* If only elliptic integrals of the first and second kinds are needed,
* then set &alpha;<sup>2</sup> = 0 (the default value); in this case, we
* have &Pi;(&phi;, 0, \e k) = \e F(&phi;, \e k), \e G(&phi;, 0, \e k) = \e
* E(&phi;, \e k), and \e H(&phi;, 0, \e k) = \e F(&phi;, \e k) - \e
* D(&phi;, \e k).
**********************************************************************/
EllipticFunction(double k2, double alpha2 );
/**
* Constructor specifying the modulus and parameter and their complements.
*
* @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
* <i>k</i><sup>2</sup> must lie in (-&infin;, 1). (No checking is
* done.)
* @param[in] alpha2 the parameter &alpha;<sup>2</sup>.
* &alpha;<sup>2</sup> must lie in (-&infin;, 1). (No checking is done.)
* @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> =
* 1 &minus; <i>k</i><sup>2</sup>.
* @param[in] alphap2 the complementary parameter &alpha;'<sup>2</sup> = 1
* &minus; &alpha;<sup>2</sup>.
*
* The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2
* = 1. (No checking is done that these conditions are met.) This
* constructor is provided to enable accuracy to be maintained, e.g., when
* \e k is very close to unity.
**********************************************************************/
EllipticFunction(double k2, double alpha2, double kp2, double alphap2);
/**
* Destructor calls the finalizer.
**********************************************************************/
~EllipticFunction()
{ this->!EllipticFunction(); }
/**
* Reset the modulus and parameter.
*
* @param[in] k2 the new value of square of the modulus
* <i>k</i><sup>2</sup> which must lie in (-&infin;, 1). (No checking is
* done.)
* @param[in] alpha2 the new value of parameter &alpha;<sup>2</sup>.
* &alpha;<sup>2</sup> must lie in (-&infin;, 1). (No checking is done.)
**********************************************************************/
void Reset(double k2, double alpha2 );
/**
* Reset the modulus and parameter supplying also their complements.
*
* @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
* <i>k</i><sup>2</sup> must lie in (-&infin;, 1). (No checking is
* done.)
* @param[in] alpha2 the parameter &alpha;<sup>2</sup>.
* &alpha;<sup>2</sup> must lie in (-&infin;, 1). (No checking is done.)
* @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> =
* 1 &minus; <i>k</i><sup>2</sup>.
* @param[in] alphap2 the complementary parameter &alpha;'<sup>2</sup> = 1
* &minus; &alpha;<sup>2</sup>.
*
* The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2
* = 1. (No checking is done that these conditions are met.) This
* constructor is provided to enable accuracy to be maintained, e.g., when
* is very small.
**********************************************************************/
void Reset(double k2, double alpha2, double kp2, double alphap2);
///@}
/** \name Inspector functions.
**********************************************************************/
///@{
/**
* @return the square of the modulus <i>k</i><sup>2</sup>.
**********************************************************************/
property double k2 { double get(); }
/**
* @return the square of the complementary modulus <i>k'</i><sup>2</sup> =
* 1 &minus; <i>k</i><sup>2</sup>.
**********************************************************************/
property double kp2 { double get(); }
/**
* @return the parameter &alpha;<sup>2</sup>.
**********************************************************************/
property double alpha2 { double get(); }
/**
* @return the complementary parameter &alpha;'<sup>2</sup> = 1 &minus;
* &alpha;<sup>2</sup>.
**********************************************************************/
property double alphap2 { double get(); }
///@}
/** \name Complete elliptic integrals.
**********************************************************************/
///@{
/**
* The complete integral of the first kind.
*
* @return \e K(\e k).
*
* \e K(\e k) is defined in http://dlmf.nist.gov/19.2.E4
* \f[
* K(k) = \int_0^{\pi/2} \frac1{\sqrt{1-k^2\sin^2\phi}}\,d\phi.
* \f]
**********************************************************************/
double K();
/**
* The complete integral of the second kind.
*
* @return \e E(\e k)
*
* \e E(\e k) is defined in http://dlmf.nist.gov/19.2.E5
* \f[
* E(k) = \int_0^{\pi/2} \sqrt{1-k^2\sin^2\phi}\,d\phi.
* \f]
**********************************************************************/
double E();
/**
* Jahnke's complete integral.
*
* @return \e D(\e k).
*
* \e D(\e k) is defined in http://dlmf.nist.gov/19.2.E6
* \f[
* D(k) = \int_0^{\pi/2} \frac{\sin^2\phi}{\sqrt{1-k^2\sin^2\phi}}\,d\phi.
* \f]
**********************************************************************/
double D();
/**
* The difference between the complete integrals of the first and second
* kinds.
*
* @return \e K(\e k) &minus; \e E(\e k).
**********************************************************************/
double KE();
/**
* The complete integral of the third kind.
*
* @return &Pi;(&alpha;<sup>2</sup>, \e k)
*
* &Pi;(&alpha;<sup>2</sup>, \e k) is defined in
* http://dlmf.nist.gov/19.2.E7
* \f[
* \Pi(\alpha^2, k) = \int_0^{\pi/2}
* \frac1{\sqrt{1-k^2\sin^2\phi}(1 - \alpha^2\sin^2\phi_)}\,d\phi.
* \f]
**********************************************************************/
double Pi();
/**
* Legendre's complete geodesic longitude integral.
*
* @return \e G(&alpha;<sup>2</sup>, \e k)
*
* \e G(&alpha;<sup>2</sup>, \e k) is given by
* \f[
* G(\alpha^2, k) = \int_0^{\pi/2}
* \frac{\sqrt{1-k^2\sin^2\phi}}{1 - \alpha^2\sin^2\phi}\,d\phi.
* \f]
**********************************************************************/
double G();
/**
* Cayley's complete geodesic longitude difference integral.
*
* @return \e H(&alpha;<sup>2</sup>, \e k)
*
* \e H(&alpha;<sup>2</sup>, \e k) is given by
* \f[
* H(\alpha^2, k) = \int_0^{\pi/2}
* \frac{\cos^2\phi}{(1-\alpha^2\sin^2\phi)\sqrt{1-k^2\sin^2\phi}}
* \,d\phi.
* \f]
**********************************************************************/
double H();
///@}
/** \name Incomplete elliptic integrals.
**********************************************************************/
///@{
/**
* The incomplete integral of the first kind.
*
* @param[in] phi
* @return \e F(&phi;, \e k).
*
* \e F(&phi;, \e k) is defined in http://dlmf.nist.gov/19.2.E4
* \f[
* F(\phi, k) = \int_0^\phi \frac1{\sqrt{1-k^2\sin^2\theta}}\,d\theta.
* \f]
**********************************************************************/
double F(double phi);
/**
* The incomplete integral of the second kind.
*
* @param[in] phi
* @return \e E(&phi;, \e k).
*
* \e E(&phi;, \e k) is defined in http://dlmf.nist.gov/19.2.E5
* \f[
* E(\phi, k) = \int_0^\phi \sqrt{1-k^2\sin^2\theta}\,d\theta.
* \f]
**********************************************************************/
double E(double phi);
/**
* The incomplete integral of the second kind with the argument given in
* degrees.
*
* @param[in] ang in <i>degrees</i>.
* @return \e E(&pi; <i>ang</i>/180, \e k).
**********************************************************************/
double Ed(double ang);
/**
* The inverse of the incomplete integral of the second kind.
*
* @param[in] x
* @return &phi; = <i>E</i><sup>&minus;1</sup>(\e x, \e k); i.e., the
* solution of such that \e E(&phi;, \e k) = \e x.
**********************************************************************/
double Einv(double x);
/**
* The incomplete integral of the third kind.
*
* @param[in] phi
* @return &Pi;(&phi;, &alpha;<sup>2</sup>, \e k).
*
* &Pi;(&phi;, &alpha;<sup>2</sup>, \e k) is defined in
* http://dlmf.nist.gov/19.2.E7
* \f[
* \Pi(\phi, \alpha^2, k) = \int_0^\phi
* \frac1{\sqrt{1-k^2\sin^2\theta}(1 - \alpha^2\sin^2\theta_)}\,d\theta.
* \f]
**********************************************************************/
double Pi(double phi);
/**
* Jahnke's incomplete elliptic integral.
*
* @param[in] phi
* @return \e D(&phi;, \e k).
*
* \e D(&phi;, \e k) is defined in http://dlmf.nist.gov/19.2.E4
* \f[
* D(\phi, k) = \int_0^\phi
* \frac{\sin^2\theta}{\sqrt{1-k^2\sin^2\theta}}\,d\theta.
* \f]
**********************************************************************/
double D(double phi);
/**
* Legendre's geodesic longitude integral.
*
* @param[in] phi
* @return \e G(&phi;, &alpha;<sup>2</sup>, \e k).
*
* \e G(&phi;, &alpha;<sup>2</sup>, \e k) is defined by
* \f[
* \begin{aligned}
* G(\phi, \alpha^2, k) &=
* \frac{k^2}{\alpha^2} F(\phi, k) +
* \biggl(1 - \frac{k^2}{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\
* &= \int_0^\phi
* \frac{\sqrt{1-k^2\sin^2\theta}}{1 - \alpha^2\sin^2\theta}\,d\theta.
* \end{aligned}
* \f]
*
* Legendre expresses the longitude of a point on the geodesic in terms of
* this combination of elliptic integrals in Exercices de Calcul
* Int&eacute;gral, Vol. 1 (1811), p. 181,
* http://books.google.com/books?id=riIOAAAAQAAJ&pg=PA181.
*
* See \ref geodellip for the expression for the longitude in terms of this
* function.
**********************************************************************/
double G(double phi);
/**
* Cayley's geodesic longitude difference integral.
*
* @param[in] phi
* @return \e H(&phi;, &alpha;<sup>2</sup>, \e k).
*
* \e H(&phi;, &alpha;<sup>2</sup>, \e k) is defined by
* \f[
* \begin{aligned}
* H(\phi, \alpha^2, k) &=
* \frac1{\alpha^2} F(\phi, k) +
* \biggl(1 - \frac1{\alpha^2}\biggr) \Pi(\phi, \alpha^2, k) \\
* &= \int_0^\phi
* \frac{\cos^2\theta}{(1-\alpha^2\sin^2\theta)\sqrt{1-k^2\sin^2\theta}}
* \,d\theta.
* \end{aligned}
* \f]
*
* Cayley expresses the longitude difference of a point on the geodesic in
* terms of this combination of elliptic integrals in Phil. Mag. <b>40</b>
* (1870), p. 333, http://books.google.com/books?id=Zk0wAAAAIAAJ&pg=PA333.
*
* See \ref geodellip for the expression for the longitude in terms of this
* function.
**********************************************************************/
double H(double phi);
///@}
/** \name Incomplete integrals in terms of Jacobi elliptic functions.
**********************************************************************/
/**
* The incomplete integral of the first kind in terms of Jacobi elliptic
* functions.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return \e F(&phi;, \e k) as though &phi; &isin; (&minus;&pi;, &pi;].
**********************************************************************/
double F(double sn, double cn, double dn);
/**
* The incomplete integral of the second kind in terms of Jacobi elliptic
* functions.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return \e E(&phi;, \e k) as though &phi; &isin; (&minus;&pi;, &pi;].
**********************************************************************/
double E(double sn, double cn, double dn);
/**
* The incomplete integral of the third kind in terms of Jacobi elliptic
* functions.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return &Pi;(&phi;, &alpha;<sup>2</sup>, \e k) as though &phi; &isin;
* (&minus;&pi;, &pi;].
**********************************************************************/
double Pi(double sn, double cn, double dn);
/**
* Jahnke's incomplete elliptic integral in terms of Jacobi elliptic
* functions.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return \e D(&phi;, \e k) as though &phi; &isin; (&minus;&pi;, &pi;].
**********************************************************************/
double D(double sn, double cn, double dn);
/**
* Legendre's geodesic longitude integral in terms of Jacobi elliptic
* functions.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return \e G(&phi;, &alpha;<sup>2</sup>, \e k) as though &phi; &isin;
* (&minus;&pi;, &pi;].
**********************************************************************/
double G(double sn, double cn, double dn);
/**
* Cayley's geodesic longitude difference integral in terms of Jacobi
* elliptic functions.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return \e H(&phi;, &alpha;<sup>2</sup>, \e k) as though &phi; &isin;
* (&minus;&pi;, &pi;].
**********************************************************************/
double H(double sn, double cn, double dn);
///@}
/** \name Periodic versions of incomplete elliptic integrals.
**********************************************************************/
///@{
/**
* The periodic incomplete integral of the first kind.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return the periodic function &pi; \e F(&phi;, \e k) / (2 \e K(\e k)) -
* &phi;
**********************************************************************/
double deltaF(double sn, double cn, double dn);
/**
* The periodic incomplete integral of the second kind.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return the periodic function &pi; \e E(&phi;, \e k) / (2 \e E(\e k)) -
* &phi;
**********************************************************************/
double deltaE(double sn, double cn, double dn);
/**
* The periodic inverse of the incomplete integral of the second kind.
*
* @param[in] stau = sin&tau;
* @param[in] ctau = sin&tau;
* @return the periodic function <i>E</i><sup>&minus;1</sup>(&tau; (2 \e
* E(\e k)/&pi;), \e k) - &tau;
**********************************************************************/
double deltaEinv(double stau, double ctau);
/**
* The periodic incomplete integral of the third kind.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return the periodic function &pi; &Pi;(&phi;, \e k) / (2 &Pi;(\e k)) -
* &phi;
**********************************************************************/
double deltaPi(double sn, double cn, double dn);
/**
* The periodic Jahnke's incomplete elliptic integral.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return the periodic function &pi; \e D(&phi;, \e k) / (2 \e D(\e k)) -
* &phi;
**********************************************************************/
double deltaD(double sn, double cn, double dn);
/**
* Legendre's periodic geodesic longitude integral.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return the periodic function &pi; \e G(&phi;, \e k) / (2 \e G(\e k)) -
* &phi;
**********************************************************************/
double deltaG(double sn, double cn, double dn);
/**
* Cayley's periodic geodesic longitude difference integral.
*
* @param[in] sn = sin&phi;
* @param[in] cn = cos&phi;
* @param[in] dn = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
* @return the periodic function &pi; \e H(&phi;, \e k) / (2 \e H(\e k)) -
* &phi;
**********************************************************************/
double deltaH(double sn, double cn, double dn);
///@}
/** \name Elliptic functions.
**********************************************************************/
///@{
/**
* The Jacobi elliptic functions.
*
* @param[in] x the argument.
* @param[out] sn sn(\e x, \e k).
* @param[out] cn cn(\e x, \e k).
* @param[out] dn dn(\e x, \e k).
**********************************************************************/
void sncndn(double x,
[System::Runtime::InteropServices::Out] double% sn,
[System::Runtime::InteropServices::Out] double% cn,
[System::Runtime::InteropServices::Out] double% dn);
/**
* The &Delta; amplitude function.
*
* @param[in] sn sin&phi;
* @param[in] cn cos&phi;
* @return &Delta; = sqrt(1 &minus; <i>k</i><sup>2</sup>
* sin<sup>2</sup>&phi;)
**********************************************************************/
double Delta(double sn, double cn);
///@}
/** \name Symmetric elliptic integrals.
**********************************************************************/
///@{
/**
* Symmetric integral of the first kind <i>R<sub>F</sub></i>.
*
* @param[in] x
* @param[in] y
* @param[in] z
* @return <i>R<sub>F</sub></i>(\e x, \e y, \e z)
*
* <i>R<sub>F</sub></i> is defined in http://dlmf.nist.gov/19.16.E1
* \f[ R_F(x, y, z) = \frac12
* \int_0^\infty\frac1{\sqrt{(t + x) (t + y) (t + z)}}\, dt \f]
* If one of the arguments is zero, it is more efficient to call the
* two-argument version of this function with the non-zero arguments.
**********************************************************************/
static double RF(double x, double y, double z);
/**
* Complete symmetric integral of the first kind, <i>R<sub>F</sub></i> with
* one argument zero.
*
* @param[in] x
* @param[in] y
* @return <i>R<sub>F</sub></i>(\e x, \e y, 0)
**********************************************************************/
static double RF(double x, double y);
/**
* Degenerate symmetric integral of the first kind <i>R<sub>C</sub></i>.
*
* @param[in] x
* @param[in] y
* @return <i>R<sub>C</sub></i>(\e x, \e y) = <i>R<sub>F</sub></i>(\e x, \e
* y, \e y)
*
* <i>R<sub>C</sub></i> is defined in http://dlmf.nist.gov/19.2.E17
* \f[ R_C(x, y) = \frac12
* \int_0^\infty\frac1{\sqrt{t + x}(t + y)}\,dt \f]
**********************************************************************/
static double RC(double x, double y);
/**
* Symmetric integral of the second kind <i>R<sub>G</sub></i>.
*
* @param[in] x
* @param[in] y
* @param[in] z
* @return <i>R<sub>G</sub></i>(\e x, \e y, \e z)
*
* <i>R<sub>G</sub></i> is defined in Carlson, eq 1.5
* \f[ R_G(x, y, z) = \frac14
* \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2}
* \biggl(
* \frac x{t + x} + \frac y{t + y} + \frac z{t + z}
* \biggr)t\,dt \f]
* See also http://dlmf.nist.gov/19.16.E3.
* If one of the arguments is zero, it is more efficient to call the
* two-argument version of this function with the non-zero arguments.
**********************************************************************/
static double RG(double x, double y, double z);
/**
* Complete symmetric integral of the second kind, <i>R<sub>G</sub></i>
* with one argument zero.
*
* @param[in] x
* @param[in] y
* @return <i>R<sub>G</sub></i>(\e x, \e y, 0)
**********************************************************************/
static double RG(double x, double y);
/**
* Symmetric integral of the third kind <i>R<sub>J</sub></i>.
*
* @param[in] x
* @param[in] y
* @param[in] z
* @param[in] p
* @return <i>R<sub>J</sub></i>(\e x, \e y, \e z, \e p)
*
* <i>R<sub>J</sub></i> is defined in http://dlmf.nist.gov/19.16.E2
* \f[ R_J(x, y, z, p) = \frac32
* \int_0^\infty[(t + x) (t + y) (t + z)]^{-1/2} (t + p)^{-1}\, dt \f]
**********************************************************************/
static double RJ(double x, double y, double z, double p);
/**
* Degenerate symmetric integral of the third kind <i>R<sub>D</sub></i>.
*
* @param[in] x
* @param[in] y
* @param[in] z
* @return <i>R<sub>D</sub></i>(\e x, \e y, \e z) = <i>R<sub>J</sub></i>(\e
* x, \e y, \e z, \e z)
*
* <i>R<sub>D</sub></i> is defined in http://dlmf.nist.gov/19.16.E5
* \f[ R_D(x, y, z) = \frac32
* \int_0^\infty[(t + x) (t + y)]^{-1/2} (t + z)^{-3/2}\, dt \f]
**********************************************************************/
static double RD(double x, double y, double z);
///@}
};
} // namespace NETGeographicLib

View File

@ -0,0 +1,243 @@
/**
* \file NETGeographicLib/GeoCoords.cpp
* \brief Implementation for NETGeographicLib::GeoCoords class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/GeoCoords.hpp"
#include "GeoCoords.h"
#include "UTMUPS.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeoCoords";
//*****************************************************************************
GeoCoords::!GeoCoords(void)
{
if ( m_pGeoCoords != NULL )
{
delete m_pGeoCoords;
m_pGeoCoords = NULL;
}
}
//*****************************************************************************
GeoCoords::GeoCoords()
{
try
{
m_pGeoCoords = new GeographicLib::GeoCoords();
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
GeoCoords::GeoCoords(System::String^ s, bool centerp, bool swaplatlong )
{
try
{
m_pGeoCoords = new GeographicLib::GeoCoords(StringConvert::ManagedToUnmanaged(s), centerp, swaplatlong);
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
catch ( const std::exception& err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
GeoCoords::GeoCoords(double latitude, double longitude, int zone )
{
try
{
m_pGeoCoords = new GeographicLib::GeoCoords(latitude, longitude, zone);
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
catch ( const std::exception& err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
GeoCoords::GeoCoords(int zone, bool northp, double easting, double northing)
{
try
{
m_pGeoCoords = new GeographicLib::GeoCoords(zone, northp, easting, northing);
}
catch ( std::bad_alloc )
{
throw gcnew GeographicErr( BADALLOC );
}
catch ( const std::exception& err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
void GeoCoords::Reset( System::String^ s, bool centerp, bool swaplatlong )
{
try
{
m_pGeoCoords->Reset(StringConvert::ManagedToUnmanaged(s), centerp, swaplatlong);
}
catch ( const std::exception& err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
void GeoCoords::Reset(double latitude, double longitude, int zone)
{
try
{
m_pGeoCoords->Reset(latitude, longitude, zone);
}
catch ( const std::exception& err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
void GeoCoords::Reset(int zone, bool northp, double easting, double northing)
{
try
{
m_pGeoCoords->Reset(zone, northp, easting, northing);
}
catch ( const std::exception& err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
void GeoCoords::AltZone::set( int zone )
{
try
{
m_pGeoCoords->SetAltZone(zone);
}
catch ( GeographicLib::GeographicErr err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
int GeoCoords::AltZone::get() { return m_pGeoCoords->AltZone(); }
//*****************************************************************************
double GeoCoords::Latitude::get() { return m_pGeoCoords->Latitude(); }
//*****************************************************************************
double GeoCoords::Longitude::get() { return m_pGeoCoords->Longitude(); }
//*****************************************************************************
double GeoCoords::Easting::get() { return m_pGeoCoords->Easting(); }
//*****************************************************************************
double GeoCoords::Northing::get() { return m_pGeoCoords->Northing(); }
//*****************************************************************************
double GeoCoords::Convergence::get() { return m_pGeoCoords->Convergence(); }
//*****************************************************************************
double GeoCoords::Scale::get() { return m_pGeoCoords->Scale(); }
//*****************************************************************************
bool GeoCoords::Northp::get() { return m_pGeoCoords->Northp(); }
//*****************************************************************************
char GeoCoords::Hemisphere::get() { return m_pGeoCoords->Hemisphere(); }
//*****************************************************************************
int GeoCoords::Zone::get() { return m_pGeoCoords->Zone(); }
//*****************************************************************************
double GeoCoords::AltEasting::get() { return m_pGeoCoords->AltEasting(); }
//*****************************************************************************
double GeoCoords::AltNorthing::get() { return m_pGeoCoords->AltNorthing(); }
//*****************************************************************************
double GeoCoords::AltConvergence::get()
{ return m_pGeoCoords->AltConvergence(); }
//*****************************************************************************
double GeoCoords::AltScale::get() { return m_pGeoCoords->AltScale(); }
//*****************************************************************************
double GeoCoords::MajorRadius::get() { return UTMUPS::MajorRadius(); }
//*****************************************************************************
double GeoCoords::Flattening::get() { return UTMUPS::Flattening(); }
//*****************************************************************************
System::String^ GeoCoords::GeoRepresentation(int prec, bool swaplatlong )
{
return gcnew System::String( m_pGeoCoords->GeoRepresentation(prec, swaplatlong).c_str() );
}
//*****************************************************************************
System::String^ GeoCoords::DMSRepresentation(int prec, bool swaplatlong,
char dmssep )
{
return gcnew System::String( m_pGeoCoords->DMSRepresentation(prec, swaplatlong, dmssep).c_str() );
}
//*****************************************************************************
System::String^ GeoCoords::MGRSRepresentation(int prec)
{
return gcnew System::String( m_pGeoCoords->MGRSRepresentation(prec).c_str() );
}
//*****************************************************************************
System::String^ GeoCoords::UTMUPSRepresentation(int prec)
{
return gcnew System::String( m_pGeoCoords->UTMUPSRepresentation(prec).c_str() );
}
//*****************************************************************************
System::String^ GeoCoords::UTMUPSRepresentation(bool northp, int prec)
{
return gcnew System::String( m_pGeoCoords->UTMUPSRepresentation(northp, prec).c_str() );
}
//*****************************************************************************
System::String^ GeoCoords::AltMGRSRepresentation(int prec)
{
return gcnew System::String( m_pGeoCoords->AltMGRSRepresentation(prec).c_str() );
}
//*****************************************************************************
System::String^ GeoCoords::AltUTMUPSRepresentation(int prec)
{
return gcnew System::String( m_pGeoCoords->AltUTMUPSRepresentation(prec).c_str() );
}
//*****************************************************************************
System::String^ GeoCoords::AltUTMUPSRepresentation(bool northp, int prec)
{
return gcnew System::String( m_pGeoCoords->AltUTMUPSRepresentation(northp, prec).c_str() );
}

View File

@ -0,0 +1,474 @@
/**
* \file NETGeographicLib/GeoCoords.h
* \brief Header for NETGeographicLib::GeoCoords class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#pragma once
namespace NETGeographicLib
{
/**
* \brief .NET wrapper for GeographicLib::GeoCoords.
*
* This class allows .NET applications to access GeographicLib::GeoCoords.
*
* This class stores a geographic position which may be set via the
* constructors or Reset via
* - latitude and longitude
* - UTM or UPS coordinates
* - a string representation of these or an MGRS coordinate string
*
* The state consists of the latitude and longitude and the supplied UTM or
* UPS coordinates (possibly derived from the MGRS coordinates). If latitude
* and longitude were given then the UTM/UPS coordinates follows the standard
* conventions.
*
* The mutable state consists of the UTM or UPS coordinates for a alternate
* zone. A method SetAltZone is provided to set the alternate UPS/UTM zone.
*
* Methods are provided to return the geographic coordinates, the input UTM
* or UPS coordinates (and associated meridian convergence and scale), or
* alternate UTM or UPS coordinates (and their associated meridian
* convergence and scale).
*
* Once the input string has been parsed, you can print the result out in any
* of the formats, decimal degrees, degrees minutes seconds, MGRS, UTM/UPS.
*
* C# Example:
* \include example-GeoCoords.cs
* Managed C++ Example:
* \include example-GeoCoords.cpp
* Visual Basic Example:
* \include example-GeoCoords.vb
*
* <B>INTERFACE DIFFERENCES:</B><BR>
* The following functions are implemented as properties: MajorRadius,
* Flattening, Latitude, Longitude, Easting, Northing, Convergence,
* Scale, Northp, Hemisphere, Zone, AltZone, AltEasting, AltNorthing,
* AltConvergence, and AltScale.
**********************************************************************/
public ref class GeoCoords
{
private:
// pointer to the unmanaged GeographicLib::GeoCoords
GeographicLib::GeoCoords* m_pGeoCoords;
// The finalizer frees unmanaged memory when the object is destroyed.
!GeoCoords();
public:
/** \name Initializing the GeoCoords object
**********************************************************************/
///@{
/**
* The default constructor is equivalent to \e latitude = 90&deg;,
* \e longitude = 0&deg;.
**********************************************************************/
GeoCoords();
/**
* Construct from a string.
*
* @param[in] s 1-element, 2-element, or 3-element string representation of
* the position.
* @param[in] centerp governs the interpretation of MGRS coordinates (see
* below).
* @param[in] swaplatlong governs the interpretation of geographic
* coordinates (see below).
* @exception GeographicErr if the \e s is malformed (see below).
*
* Parse as a string and interpret it as a geographic position. The input
* string is broken into space (or comma) separated pieces and Basic
* decision on which format is based on number of components
* -# MGRS
* -# "Lat Long" or "Long Lat"
* -# "Zone Easting Northing" or "Easting Northing Zone"
*
* The following inputs are approximately the same (Ar Ramadi Bridge, Iraq)
* - Latitude and Longitude
* - 33.44 43.27
* - N33d26.4' E43d16.2'
* - 43d16'12&quot;E 33d26'24&quot;N
* - 43:16:12E 33:26:24
* - MGRS
* - 38SLC301
* - 38SLC391014
* - 38SLC3918701405
* - 37SHT9708
* - UTM
* - 38N 339188 3701405
* - 897039 3708229 37N
*
* <b>Latitude and Longitude parsing</b>: Latitude precedes longitude,
* unless a N, S, E, W hemisphere designator is used on one or both
* coordinates. If \e swaplatlong = true (default is false), then
* longitude precedes latitude in the absence of a hemisphere designator.
* Thus (with \e swaplatlong = false)
* - 40 -75
* - N40 W75
* - -75 N40
* - 75W 40N
* - E-75 -40S
* .
* are all the same position. The coordinates may be given in
* decimal degrees, degrees and decimal minutes, degrees, minutes,
* seconds, etc. Use d, ', and &quot; to mark off the degrees,
* minutes and seconds. Various alternative symbols for degrees, minutes,
* and seconds are allowed. Alternatively, use : to separate these
* components. (See DMS::Decode for details.) Thus
* - 40d30'30&quot;
* - 40d30'30
* - 40&deg;30'30
* - 40d30.5'
* - 40d30.5
* - 40:30:30
* - 40:30.5
* - 40.508333333
* .
* all specify the same angle. The leading sign applies to all components
* so -1d30 is -(1+30/60) = -1.5. Latitudes must be in the range
* [&minus;90&deg;, 90&deg;] and longitudes in the range
* [&minus;540&deg;, 540&deg;). Internally longitudes are reduced
* to the range [&minus;180&deg;, 180&deg;).
*
* <b>UTM/UPS parsing</b>: For UTM zones (&minus;80&deg; &le; Lat <
* 84&deg;), the zone designator is made up of a zone number (for 1 to 60)
* and a hemisphere letter (N or S), e.g., 38N. The latitude zone designer
* ([C--M] in the southern hemisphere and [N--X] in the northern) should
* NOT be used. (This is part of the MGRS coordinate.) The zone
* designator for the poles (where UPS is employed) is a hemisphere letter
* by itself, i.e., N or S.
*
* <b>MGRS parsing</b> interprets the grid references as square area at the
* specified precision (1m, 10m, 100m, etc.). If \e centerp = true (the
* default), the center of this square is then taken to be the precise
* position; thus:
* - 38SMB = 38N 450000 3650000
* - 38SMB4484 = 38N 444500 3684500
* - 38SMB44148470 = 38N 444145 3684705
* .
* Otherwise, the "south-west" corner of the square is used, i.e.,
* - 38SMB = 38N 400000 3600000
* - 38SMB4484 = 38N 444000 3684000
* - 38SMB44148470 = 38N 444140 3684700
**********************************************************************/
GeoCoords(System::String^ s, bool centerp, bool swaplatlong );
/**
* Construct from geographic coordinates.
*
* @param[in] latitude (degrees).
* @param[in] longitude (degrees).
* @param[in] zone if specified, force the UTM/UPS representation to use a
* specified zone using the rules given in UTMUPS::zonespec.
* @exception GeographicErr if \e latitude is not in [&minus;90&deg;,
* 90&deg;].
* @exception GeographicErr if \e longitude is not in [&minus;540&deg;,
* 540&deg;).
* @exception GeographicErr if \e zone cannot be used for this location.
**********************************************************************/
GeoCoords(double latitude, double longitude, int zone );
/**
* Construct from UTM/UPS coordinates.
*
* @param[in] zone UTM zone (zero means UPS).
* @param[in] northp hemisphere (true means north, false means south).
* @param[in] easting (meters).
* @param[in] northing (meters).
* @exception GeographicErr if \e zone, \e easting, or \e northing is
* outside its allowed range.
**********************************************************************/
GeoCoords(int zone, bool northp, double easting, double northing);
/**
* The destructor calls the finalizer.
**********************************************************************/
~GeoCoords() { this->!GeoCoords(); }
/**
* Reset the location from a string. See
* GeoCoords(const std::string& s, bool centerp, bool swaplatlong).
*
* @param[in] s 1-element, 2-element, or 3-element string representation of
* the position.
* @param[in] centerp governs the interpretation of MGRS coordinates.
* @param[in] swaplatlong governs the interpretation of geographic
* coordinates.
* @exception GeographicErr if the \e s is malformed.
**********************************************************************/
void Reset( System::String^ s, bool centerp, bool swaplatlong);
/**
* Reset the location in terms of geographic coordinates. See
* GeoCoords(double latitude, double longitude, int zone).
*
* @param[in] latitude (degrees).
* @param[in] longitude (degrees).
* @param[in] zone if specified, force the UTM/UPS representation to use a
* specified zone using the rules given in UTMUPS::zonespec.
* @exception GeographicErr if \e latitude is not in [&minus;90&deg;,
* 90&deg;].
* @exception GeographicErr if \e longitude is not in [&minus;540&deg;,
* 540&deg;).
* @exception GeographicErr if \e zone cannot be used for this location.
**********************************************************************/
void Reset(double latitude, double longitude, int zone ) ;
/**
* Reset the location in terms of UPS/UPS coordinates. See
* GeoCoords(int zone, bool northp, double easting, double northing).
*
* @param[in] zone UTM zone (zero means UPS).
* @param[in] northp hemisphere (true means north, false means south).
* @param[in] easting (meters).
* @param[in] northing (meters).
* @exception GeographicErr if \e zone, \e easting, or \e northing is
* outside its allowed range.
**********************************************************************/
void Reset(int zone, bool northp, double easting, double northing);
///@}
/** \name Querying the GeoCoords object
**********************************************************************/
///@{
/**
* @return latitude (degrees)
**********************************************************************/
property double Latitude { double get(); }
/**
* @return longitude (degrees)
**********************************************************************/
property double Longitude { double get(); }
/**
* @return easting (meters)
**********************************************************************/
property double Easting { double get(); }
/**
* @return northing (meters)
**********************************************************************/
property double Northing { double get(); }
/**
* @return meridian convergence (degrees) for the UTM/UPS projection.
**********************************************************************/
property double Convergence { double get(); }
/**
* @return scale for the UTM/UPS projection.
**********************************************************************/
property double Scale { double get(); }
/**
* @return hemisphere (false means south, true means north).
**********************************************************************/
property bool Northp { bool get(); }
/**
* @return hemisphere letter N or S.
**********************************************************************/
property char Hemisphere { char get(); }
/**
* @return the zone corresponding to the input (return 0 for UPS).
**********************************************************************/
property int Zone { int get(); }
/**
* Gets/Sets the current alternate zone (0 = UPS).
* @exception GeographicErr if \e zone cannot be used for this location.
*
* See UTMUPS::zonespec for more information on the interpretation of \e
* zone. Note that \e zone == UTMUPS::STANDARD (the default) use the
* standard UPS or UTM zone, UTMUPS::MATCH does nothing retaining the
* existing alternate representation. Before this is called the alternate
* zone is the input zone.
**********************************************************************/
property int AltZone
{
int get();
void set( int zone );
}
///@}
/**
* @return easting (meters) for alternate zone.
**********************************************************************/
property double AltEasting { double get(); }
/**
* @return northing (meters) for alternate zone.
**********************************************************************/
property double AltNorthing { double get(); }
/**
* @return meridian convergence (degrees) for alternate zone.
**********************************************************************/
property double AltConvergence { double get(); }
/**
* @return scale for alternate zone.
**********************************************************************/
property double AltScale { double get(); }
///@}
/** \name String representations of the GeoCoords object
**********************************************************************/
///@{
/**
* String representation with latitude and longitude as signed decimal
* degrees.
*
* @param[in] prec precision (relative to about 1m).
* @param[in] swaplatlong if true give longitude first (default = false)
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return decimal latitude/longitude string representation.
*
* Precision specifies accuracy of representation as follows:
* - prec = &minus;5 (min), 1&deg;
* - prec = 0, 10<sup>&minus;5</sup>&deg; (about 1m)
* - prec = 3, 10<sup>&minus;8</sup>&deg;
* - prec = 9 (max), 10<sup>&minus;14</sup>&deg;
**********************************************************************/
System::String^ GeoRepresentation(int prec, bool swaplatlong );
/**
* String representation with latitude and longitude as degrees, minutes,
* seconds, and hemisphere.
*
* @param[in] prec precision (relative to about 1m)
* @param[in] swaplatlong if true give longitude first (default = false)
* @param[in] dmssep if non-null, use as the DMS separator character
* (instead of d, ', &quot; delimiters).
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return DMS latitude/longitude string representation.
*
* Precision specifies accuracy of representation as follows:
* - prec = &minus;5 (min), 1&deg;
* - prec = &minus;4, 0.1&deg;
* - prec = &minus;3, 1'
* - prec = &minus;2, 0.1'
* - prec = &minus;1, 1&quot;
* - prec = 0, 0.1&quot; (about 3m)
* - prec = 1, 0.01&quot;
* - prec = 10 (max), 10<sup>&minus;11</sup>&quot;
**********************************************************************/
System::String^ DMSRepresentation(int prec, bool swaplatlong,
char dmssep );
/**
* MGRS string.
*
* @param[in] prec precision (relative to about 1m).
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return MGRS string.
*
* This gives the coordinates of the enclosing grid square with size given
* by the precision. Thus 38N 444180 3684790 converted to a MGRS
* coordinate at precision &minus;2 (100m) is 38SMB441847 and not
* 38SMB442848. \e prec specifies the precision of the MGRS string as
* follows:
* - prec = &minus;5 (min), 100km
* - prec = &minus;4, 10km
* - prec = &minus;3, 1km
* - prec = &minus;2, 100m
* - prec = &minus;1, 10m
* - prec = 0, 1m
* - prec = 1, 0.1m
* - prec = 6 (max), 1&mu;m
**********************************************************************/
System::String^ MGRSRepresentation(int prec);
/**
* UTM/UPS string.
*
* @param[in] prec precision (relative to about 1m)
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return UTM/UPS string representation: zone designator, easting, and
* northing.
*
* Precision specifies accuracy of representation as follows:
* - prec = &minus;5 (min), 100km
* - prec = &minus;3, 1km
* - prec = 0, 1m
* - prec = 3, 1mm
* - prec = 6, 1&mu;m
* - prec = 9 (max), 1nm
**********************************************************************/
System::String^ UTMUPSRepresentation(int prec);
/**
* UTM/UPS string with hemisphere override.
*
* @param[in] prec precision (relative to about 1m)
* @param[in] northp hemisphere override
* @exception GeographicErr if the hemisphere override attempts to change
* UPS N to UPS S or vice verse.
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return UTM/UPS string representation: zone designator, easting, and
* northing.
**********************************************************************/
System::String^ UTMUPSRepresentation(bool northp, int prec);
/**
* MGRS string for the alternate zone. See GeoCoords::MGRSRepresentation.
*
* @param[in] prec precision (relative to about 1m).
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return MGRS string.
**********************************************************************/
System::String^ AltMGRSRepresentation(int prec);
/**
* UTM/UPS string for the alternate zone. See
* GeoCoords::UTMUPSRepresentation.
*
* @param[in] prec precision (relative to about 1m)
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return UTM/UPS string representation: zone designator, easting, and
* northing.
**********************************************************************/
System::String^ AltUTMUPSRepresentation(int prec);
/**
* UTM/UPS string for the alternate zone, with hemisphere override.
*
* @param[in] prec precision (relative to about 1m)
* @param[in] northp hemisphere override
* @exception GeographicErr if the hemisphere override attempts to change
* UPS N to UPS S or vice verse.
* @exception std::bad_alloc if memory for the string can't be allocated.
* @return UTM/UPS string representation: zone designator, easting, and
* northing.
**********************************************************************/
System::String^ AltUTMUPSRepresentation(bool northp, int prec);
///@}
/** \name Inspector functions
**********************************************************************/
///@{
/**
* @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
*
* (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.)
**********************************************************************/
property double MajorRadius { double get(); }
/**
* @return \e f the flattening of the WGS84 ellipsoid.
*
* (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.)
**********************************************************************/
property double Flattening { double get(); }
///@}
};
} //namespace NETGeographicLib

View File

@ -0,0 +1,151 @@
/**
* \file NETGeographicLib/Geocentric.cpp
* \brief Implementation for NETGeographicLib::Geocentric class
*
* NETGeographicLib is copyright (c) Scott Heiman (2013)
* GeographicLib is Copyright (c) Charles Karney (2010-2012)
* <charles@karney.com> and licensed under the MIT/X11 License.
* For more information, see
* http://geographiclib.sourceforge.net/
**********************************************************************/
#include "stdafx.h"
#include "GeographicLib/Geocentric.hpp"
#include "Geocentric.h"
#include "NETGeographicLib.h"
using namespace NETGeographicLib;
const char BADALLOC[] = "Unable to allocate memory for a GeographicLib::Geocentric";
//*****************************************************************************
Geocentric::!Geocentric()
{
if ( m_pGeocentric != NULL )
{
delete m_pGeocentric;
m_pGeocentric = NULL;
}
}
//*****************************************************************************
Geocentric::Geocentric(void)
{
try
{
m_pGeocentric = new GeographicLib::Geocentric(
GeographicLib::Geocentric::WGS84 );
}
catch (std::bad_alloc)
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
Geocentric::Geocentric(double a, double f)
{
try
{
m_pGeocentric = new GeographicLib::Geocentric( a, f );
}
catch (std::bad_alloc)
{
throw gcnew GeographicErr( BADALLOC );
}
catch (std::exception err )
{
throw gcnew GeographicErr( err.what() );
}
}
//*****************************************************************************
Geocentric::Geocentric( const GeographicLib::Geocentric& g )
{
try
{
m_pGeocentric = new GeographicLib::Geocentric( g );
}
catch (std::bad_alloc)
{
throw gcnew GeographicErr( BADALLOC );
}
}
//*****************************************************************************
void Geocentric::Forward(double lat, double lon, double h,
[System::Runtime::InteropServices::Out] double% X,
[System::Runtime::InteropServices::Out] double% Y,
[System::Runtime::InteropServices::Out] double% Z)
{
double lX, lY, lZ;
m_pGeocentric->Forward( lat, lon, h, lX, lY, lZ);
X = lX;
Y = lY;
Z = lZ;
}
//*****************************************************************************
void Geocentric::Forward(double lat, double lon, double h,
[System::Runtime::InteropServices::Out] double% X,
[System::Runtime::InteropServices::Out] double% Y,
[System::Runtime::InteropServices::Out] double% Z,
[System::Runtime::InteropServices::Out] array<double,2>^% M)
{
double lX, lY, lZ;
std::vector<double> lM(9);
m_pGeocentric->Forward( lat, lon, h, lX, lY, lZ, lM);
X = lX;
Y = lY;
Z = lZ;
M = gcnew array<double,2>( 3, 3 );
for ( int i = 0; i < 3; i++ )
for ( int j = 0; j < 3; j++ )
M[i,j] = lM[3*i+j];
}
//*****************************************************************************
void Geocentric::Reverse(double X, double Y, double Z,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
[System::Runtime::InteropServices::Out] double% h)
{
double llat, llon, lh;
m_pGeocentric->Reverse(X, Y, Z, llat, llon, lh);
lat = llat;
lon = llon;
h = lh;
}
//*****************************************************************************
void Geocentric::Reverse(double X, double Y, double Z,
[System::Runtime::InteropServices::Out] double% lat,
[System::Runtime::InteropServices::Out] double% lon,
[System::Runtime::InteropServices::Out] double% h,
[System::Runtime::InteropServices::Out] array<double,2>^% M)
{
std::vector<double> lM(9);
double llat, llon, lh;
m_pGeocentric->Reverse(X, Y, Z, llat, llon, lh, lM);
lat = llat;
lon = llon;
h = lh;
M = gcnew array<double,2>( 3, 3 );
for ( int i = 0; i < 3; i++ )
for ( int j = 0; j < 3; j++ )
M[i,j] = lM[3*i+j];
}
//*****************************************************************************
System::IntPtr^ Geocentric::GetUnmanaged()
{
return gcnew System::IntPtr( const_cast<void*>(
reinterpret_cast<const void*>(m_pGeocentric) ) );
}
//*****************************************************************************
double Geocentric::MajorRadius::get()
{ return m_pGeocentric->MajorRadius(); }
//*****************************************************************************
double Geocentric::Flattening::get()
{ return m_pGeocentric->Flattening(); }

Some files were not shown because too many files have changed in this diff Show More