Fix conflict
|
|
@ -295,9 +295,7 @@ add_subdirectory(gtsam)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
# Build examples
|
# Build examples
|
||||||
if (GTSAM_BUILD_EXAMPLES)
|
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif(GTSAM_BUILD_EXAMPLES)
|
|
||||||
|
|
||||||
# Matlab toolbox
|
# Matlab toolbox
|
||||||
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
if (GTSAM_INSTALL_MATLAB_TOOLBOX)
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ if(NOT FIRST_PASS_DONE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_TIMING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during timing builds." FORCE)
|
set(CMAKE_EXE_LINKER_FLAGS_TIMING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during timing builds." FORCE)
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_TIMING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during timing builds." FORCE)
|
set(CMAKE_SHARED_LINKER_FLAGS_TIMING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during timing builds." FORCE)
|
||||||
mark_as_advanced(CMAKE_C_FLAGS_TIMING CMAKE_CXX_FLAGS_TIMING CMAKE_EXE_LINKER_FLAGS_TIMING CMAKE_SHARED_LINKER_FLAGS_TIMING)
|
mark_as_advanced(CMAKE_C_FLAGS_TIMING CMAKE_CXX_FLAGS_TIMING CMAKE_EXE_LINKER_FLAGS_TIMING CMAKE_SHARED_LINKER_FLAGS_TIMING)
|
||||||
set(CMAKE_C_FLAGS_PROFILING "-g1 -O3 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE)
|
set(CMAKE_C_FLAGS_PROFILING "-g -O3 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE)
|
||||||
set(CMAKE_CXX_FLAGS_PROFILING "-g1 -O3 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE)
|
set(CMAKE_CXX_FLAGS_PROFILING "-g -O3 -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during profiling builds." FORCE)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_PROFILING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during profiling builds." FORCE)
|
set(CMAKE_EXE_LINKER_FLAGS_PROFILING "${CMAKE_EXE_LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during profiling builds." FORCE)
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "${CMAKE__LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during profiling builds." FORCE)
|
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "${CMAKE__LINKER_FLAGS_RELEASE}" CACHE STRING "Linker flags during profiling builds." FORCE)
|
||||||
mark_as_advanced(CMAKE_C_FLAGS_PROFILING CMAKE_CXX_FLAGS_PROFILING CMAKE_EXE_LINKER_FLAGS_PROFILING CMAKE_SHARED_LINKER_FLAGS_PROFILING)
|
mark_as_advanced(CMAKE_C_FLAGS_PROFILING CMAKE_CXX_FLAGS_PROFILING CMAKE_EXE_LINKER_FLAGS_PROFILING CMAKE_SHARED_LINKER_FLAGS_PROFILING)
|
||||||
|
|
@ -62,7 +62,7 @@ endif()
|
||||||
|
|
||||||
# Set up build type library postfixes
|
# Set up build type library postfixes
|
||||||
if(GTSAM_BUILD_TYPE_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)
|
string(TOUPPER "${build_type}" build_type_toupper)
|
||||||
set(CMAKE_${build_type_toupper}_POSTFIX ${build_type})
|
set(CMAKE_${build_type_toupper}_POSTFIX ${build_type})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ macro(gtsamAddTestsGlob_impl groupName globPatterns excludedFiles linkLibraries)
|
||||||
# Only have a main function in one script - use preprocessor
|
# Only have a main function in one script - use preprocessor
|
||||||
set(rest_script_srcs ${script_srcs})
|
set(rest_script_srcs ${script_srcs})
|
||||||
list(REMOVE_AT rest_script_srcs 0)
|
list(REMOVE_AT rest_script_srcs 0)
|
||||||
set_property(SOURCE ${rest_script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "main=static no_main")
|
set_property(SOURCE ${rest_script_srcs} APPEND PROPERTY COMPILE_DEFINITIONS "main=inline no_main")
|
||||||
|
|
||||||
# Add target dependencies
|
# Add target dependencies
|
||||||
add_test(NAME ${target_name} COMMAND ${target_name})
|
add_test(NAME ${target_name} COMMAND ${target_name})
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ int lastStep;
|
||||||
int nThreads;
|
int nThreads;
|
||||||
int relinSkip;
|
int relinSkip;
|
||||||
bool incremental;
|
bool incremental;
|
||||||
|
bool dogleg;
|
||||||
bool batch;
|
bool batch;
|
||||||
bool compare;
|
bool compare;
|
||||||
bool perturb;
|
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")
|
("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")
|
("relinSkip", po::value<int>(&relinSkip)->default_value(10), "Fluid relinearization check every arg steps")
|
||||||
("incremental", "Run in incremental mode using ISAM2 (default)")
|
("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")
|
("batch", "Run in batch mode, requires an initialization from --read-solution")
|
||||||
("compare", po::value<vector<string> >()->multitoken(), "Compare two solution files")
|
("compare", po::value<vector<string> >()->multitoken(), "Compare two solution files")
|
||||||
("perturb", po::value<double>(&perturbationNoise), "Perturb a solution file with the specified noise")
|
("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);
|
stats = (vm.count("stats") > 0);
|
||||||
const int modesSpecified = int(batch) + int(compare) + int(perturb) + int(stats);
|
const int modesSpecified = int(batch) + int(compare) + int(perturb) + int(stats);
|
||||||
incremental = (vm.count("incremental") > 0 || modesSpecified == 0);
|
incremental = (vm.count("incremental") > 0 || modesSpecified == 0);
|
||||||
|
dogleg = (vm.count("dogleg") > 0);
|
||||||
if(compare) {
|
if(compare) {
|
||||||
const vector<string>& compareFiles = vm["compare"].as<vector<string> >();
|
const vector<string>& compareFiles = vm["compare"].as<vector<string> >();
|
||||||
if(compareFiles.size() != 2) {
|
if(compareFiles.size() != 2) {
|
||||||
|
|
@ -233,6 +236,8 @@ int main(int argc, char *argv[]) {
|
||||||
void runIncremental()
|
void runIncremental()
|
||||||
{
|
{
|
||||||
ISAM2Params params;
|
ISAM2Params params;
|
||||||
|
if(dogleg)
|
||||||
|
params.optimizationParams = ISAM2DoglegParams();
|
||||||
params.relinearizeSkip = relinSkip;
|
params.relinearizeSkip = relinSkip;
|
||||||
params.enablePartialRelinearizationCheck = true;
|
params.enablePartialRelinearizationCheck = true;
|
||||||
ISAM2 isam2(params);
|
ISAM2 isam2(params);
|
||||||
|
|
|
||||||
18
gtsam.h
|
|
@ -563,15 +563,15 @@ virtual class Pose3 : gtsam::Value {
|
||||||
void serialize() const;
|
void serialize() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <gtsam/geometry/Sphere2.h>
|
#include <gtsam/geometry/Unit3.h>
|
||||||
virtual class Sphere2 : gtsam::Value {
|
virtual class Unit3 : gtsam::Value {
|
||||||
// Standard Constructors
|
// Standard Constructors
|
||||||
Sphere2();
|
Unit3();
|
||||||
Sphere2(const gtsam::Point3& pose);
|
Unit3(const gtsam::Point3& pose);
|
||||||
|
|
||||||
// Testable
|
// Testable
|
||||||
void print(string s) const;
|
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
|
// Other functionality
|
||||||
Matrix basis() const;
|
Matrix basis() const;
|
||||||
|
|
@ -580,14 +580,14 @@ virtual class Sphere2 : gtsam::Value {
|
||||||
// Manifold
|
// Manifold
|
||||||
static size_t Dim();
|
static size_t Dim();
|
||||||
size_t dim() const;
|
size_t dim() const;
|
||||||
gtsam::Sphere2 retract(Vector v) const;
|
gtsam::Unit3 retract(Vector v) const;
|
||||||
Vector localCoordinates(const gtsam::Sphere2& s) const;
|
Vector localCoordinates(const gtsam::Unit3& s) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <gtsam/geometry/EssentialMatrix.h>
|
#include <gtsam/geometry/EssentialMatrix.h>
|
||||||
virtual class EssentialMatrix : gtsam::Value {
|
virtual class EssentialMatrix : gtsam::Value {
|
||||||
// Standard Constructors
|
// Standard Constructors
|
||||||
EssentialMatrix(const gtsam::Rot3& aRb, const gtsam::Sphere2& aTb);
|
EssentialMatrix(const gtsam::Rot3& aRb, const gtsam::Unit3& aTb);
|
||||||
|
|
||||||
// Testable
|
// Testable
|
||||||
void print(string s) const;
|
void print(string s) const;
|
||||||
|
|
@ -601,7 +601,7 @@ virtual class EssentialMatrix : gtsam::Value {
|
||||||
|
|
||||||
// Other methods:
|
// Other methods:
|
||||||
gtsam::Rot3 rotation() const;
|
gtsam::Rot3 rotation() const;
|
||||||
gtsam::Sphere2 direction() const;
|
gtsam::Unit3 direction() const;
|
||||||
Matrix matrix() const;
|
Matrix matrix() const;
|
||||||
double error(Vector vA, Vector vB);
|
double error(Vector vA, Vector vB);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,3 +26,11 @@ if(NOT GTSAM_USE_SYSTEM_EIGEN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(metis-5.1.0)
|
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)
|
||||||
|
|
||||||
|
add_subdirectory(GeographicLib)
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -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 ()
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
For installation instructions, open
|
||||||
|
|
||||||
|
http://geographiclib.sourceforge.net/html/install.html
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
include Makefile.mk
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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:
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -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 ()
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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:
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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 ()
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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:
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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:
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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 × 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
|
||||||
|
**********************************************************************/
|
||||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
|
@ -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>.
|
||||||
|
**********************************************************************/
|
||||||
|
|
@ -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>.
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
**********************************************************************/
|
||||||
|
|
@ -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>
|
||||||
|
After Width: | Height: | Size: 7.8 KiB |
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
@ -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–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°30′40.5″S, S20d30'40.5", or
|
||||||
|
-20:30:40.5.) The results are accurate to about
|
||||||
|
15 nanometers (or 0.1 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 “COMPUTE” button.
|
||||||
|
</p>
|
||||||
|
<p>Enter <i>“lat1 lon1 lat2 lon2”</i>:</p>
|
||||||
|
<p>input:
|
||||||
|
<input name="input" size=72 value="-41.32 174.81 40.96 -5.50" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Output format: <label for="ig">
|
||||||
|
<input type="radio" value="g" name="format" id="ig" checked>
|
||||||
|
decimal degrees
|
||||||
|
</label>
|
||||||
|
<label for="id">
|
||||||
|
<input type="radio" value="d" name="format" id="id">
|
||||||
|
degrees minutes seconds
|
||||||
|
</label><br>
|
||||||
|
Output precision: <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 “COMPUTE” button.
|
||||||
|
</p>
|
||||||
|
<p>Enter <i>“lat1 lon1 azi1 s12”</i>:</p>
|
||||||
|
<p>input:
|
||||||
|
<input name="input" size=72 value="40.6 -73.8 45 10000e3" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Output format: <label for="dg">
|
||||||
|
<input type="radio" value="g" name="format" id="dg" checked>
|
||||||
|
decimal degrees
|
||||||
|
</label>
|
||||||
|
<label for="dd">
|
||||||
|
<input type="radio" value="d" name="format" id="dd">
|
||||||
|
degrees minutes seconds
|
||||||
|
</label><br>
|
||||||
|
Output precision: <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 “COMPUTE” button.
|
||||||
|
</p>
|
||||||
|
<p>Enter <i>“lat1 lon1 lat2 lon2 ds12 maxk”</i>:</p>
|
||||||
|
<p>input:
|
||||||
|
<input name="input" size=72 value="40.6 -73.8 1.4 104 1000e3 20" />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Output format: <label for="pg">
|
||||||
|
<input type="radio" value="g" name="format" id="pg" checked>
|
||||||
|
decimal degrees
|
||||||
|
</label>
|
||||||
|
<label for="pd">
|
||||||
|
<input type="radio" value="d" name="format" id="pd">
|
||||||
|
degrees minutes seconds
|
||||||
|
</label><br>
|
||||||
|
Output precision: <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
|
||||||
|
“COMPUTE” button.
|
||||||
|
</p>
|
||||||
|
<p>Enter points, one per line, as <i>“lat lon”</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: <label for="lg">
|
||||||
|
<input type="radio" value="p" name="polyline" id="lg" checked>
|
||||||
|
polygon
|
||||||
|
</label>
|
||||||
|
<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"><charles@karney.com></a>
|
||||||
|
(2011-08-04)</address>
|
||||||
|
<br>
|
||||||
|
<a href="http://geographiclib.sourceforge.net">
|
||||||
|
<img
|
||||||
|
src="http://sourceforge.net/sflogo.php?group_id=283628&type=9"
|
||||||
|
border="0" height="15" width="80" alt="SourceForge.net" />
|
||||||
|
</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -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°30′40.5″S,
|
||||||
|
S20d30'40.5", 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" or 1 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–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"><charles@karney.com></a>
|
||||||
|
(2011-08-02)</address>
|
||||||
|
<br>
|
||||||
|
<a href="http://geographiclib.sourceforge.net">
|
||||||
|
<img
|
||||||
|
src="http://sourceforge.net/sflogo.php?group_id=283628&type=9"
|
||||||
|
border="0" height="15" width="80" alt="SourceForge.net" />
|
||||||
|
</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -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>
|
||||||
|
Direct:
|
||||||
|
<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>
|
||||||
|
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>
|
||||||
|
lat1 lon1 azi1: <input type="text" "readonly" id="p1" size=60>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
lat2 lon2 azi2: <input type="text" "readonly" id="p2" size=60>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
s12: <input type="text" "readonly" id="s12" size=20>
|
||||||
|
status: <input "readonly" id="status" size=30>
|
||||||
|
|
||||||
|
<a href="geod-google-instructions.html"><b>INSTRUCTIONS HERE</b></a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
|
@ -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>
|
||||||
|
|
@ -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 );
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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(); }
|
||||||
|
|
@ -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, γ, 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 γ 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°, and \e k0 = 1)
|
||||||
|
AzimuthalEqualAreaSouth //!< Lambert azimuthal equal area projection (stdlat = −90°, 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 − \e f ) \e a, or \e k0 is
|
||||||
|
* not positive.
|
||||||
|
* @exception GeographicErr if \e stdlat is not in [−90°,
|
||||||
|
* 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
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 − \e f ) \e a, or \e k1 is
|
||||||
|
* not positive.
|
||||||
|
* @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in
|
||||||
|
* [−90°, 90°], 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 − \e f ) \e a, or \e k1 is
|
||||||
|
* not positive.
|
||||||
|
* @exception GeographicErr if \e stdlat1 or \e stdlat2 is not in
|
||||||
|
* [−90°, 90°], 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 − \e lat1) ≤ 160°,
|
||||||
|
* then the error in the latitude of origin is less than 4.5 ×
|
||||||
|
* 10<sup>−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 (−90°,
|
||||||
|
* 90°).
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* [−90°, 90°]; \e lon and \e lon0 should be in the
|
||||||
|
* range [−540°, 540°). 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
|
||||||
|
* [−540°, 540°). The value of \e lon returned is in
|
||||||
|
* the range [−180°, 180°). The value of \e lat
|
||||||
|
* returned is in the range [−90°, 90°]. 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
|
||||||
|
|
@ -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
|
||||||
110
gtsam/3rdparty/GeographicLib/dotnet/NETGeographicLib/AzimuthalEquidistant.cpp
vendored
Normal 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(); }
|
||||||
161
gtsam/3rdparty/GeographicLib/dotnet/NETGeographicLib/AzimuthalEquidistant.h
vendored
Normal 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 [−90°,
|
||||||
|
* 90°] and \e lon0 and \e lon should be in the range
|
||||||
|
* [−540°, 540°). 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 [−90°, 90°] and \e
|
||||||
|
* lon0 should be in the range [−540°, 540°). \e lat
|
||||||
|
* will be in the range [−90°, 90°] and \e lon will
|
||||||
|
* be in the range [−180°, 180°). 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
|
||||||
|
|
@ -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)
|
||||||
|
|
@ -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(); }
|
||||||
|
|
@ -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° 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°. \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 [−90°, 90°] and \e
|
||||||
|
* lon0 should be in the range [−540°, 540°).
|
||||||
|
**********************************************************************/
|
||||||
|
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 [−90°, 90°] and \e
|
||||||
|
* lon0 should be in the range [−540°, 540°).
|
||||||
|
**********************************************************************/
|
||||||
|
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 [−90°, 90°] and \e
|
||||||
|
* lon should be in the range [−540°, 540°). 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
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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), " (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 ° 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 " 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" 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"S, -20°30'40.5, -20d30.675,
|
||||||
|
* N-20d30'40.5", -20:30:40.5
|
||||||
|
* - 4d0'9, 4d9", 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"4', 4::5, 4:5:, :4:5, 4d4.5'4", -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 (°)
|
||||||
|
* - U+00ba masculine ordinal indicator
|
||||||
|
* - U+2070 superscript zero
|
||||||
|
* - U+02da ring above
|
||||||
|
* - minutes:
|
||||||
|
* - ' apostrophe
|
||||||
|
* - U+2032 prime (′)
|
||||||
|
* - U+00b4 acute accent
|
||||||
|
* - U+2019 right single quote (’)
|
||||||
|
* - seconds:
|
||||||
|
* - " quotation mark
|
||||||
|
* - U+2033 double prime (″)
|
||||||
|
* - U+201d right double quote (”)
|
||||||
|
* - ' ' 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 [−180°,
|
||||||
|
* 180°).
|
||||||
|
* @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 [−90°,
|
||||||
|
* 90°].
|
||||||
|
* @exception GeographicErr if decoded longitude is not in
|
||||||
|
* [−540°, 540°).
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* [−540°, 540°).
|
||||||
|
* @return azimuth (degrees) reduced to the range [−180°,
|
||||||
|
* 180°).
|
||||||
|
*
|
||||||
|
* A hemisphere designator E/W can be used; the result is multiplied by
|
||||||
|
* −1 if W is present.
|
||||||
|
**********************************************************************/
|
||||||
|
static double DecodeAzimuth(System::String^ azistr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert angle (in degrees) into a DMS string (using d, ', and ").
|
||||||
|
*
|
||||||
|
* @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, ', " 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°), 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 ") 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, ', " 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". \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
|
||||||
|
|
@ -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(); }
|
||||||
|
|
@ -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 −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 − \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 = (π/2) \e a. The radius
|
||||||
|
* of a sphere with the same meridian length is \e L / (π/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π <i>a</i><sup>2</sup>. The radius of a sphere
|
||||||
|
* with the same area is sqrt(\e A / (4π)).
|
||||||
|
**********************************************************************/
|
||||||
|
property double Area { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e V the total volume of the ellipsoid (meters<sup>3</sup>).
|
||||||
|
* For a sphere \e V = (4π / 3) <i>a</i><sup>3</sup>. The radius of
|
||||||
|
* a sphere with the same volume is cbrt(\e V / (4π/3)).
|
||||||
|
**********************************************************************/
|
||||||
|
property double Volume { double get(); }
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name %Ellipsoid shape
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e f = (\e a − \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 − \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 − \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> −
|
||||||
|
* <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> −
|
||||||
|
* <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> −
|
||||||
|
* <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 β the parametric latitude (degrees).
|
||||||
|
*
|
||||||
|
* The geographic latitude, φ, 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), β,
|
||||||
|
* allows the cartesian coordinated of a meridian to be expressed
|
||||||
|
* conveniently in parametric form as
|
||||||
|
* - \e R = \e a cos β
|
||||||
|
* - \e Z = \e b sin β
|
||||||
|
* .
|
||||||
|
* where \e a and \e b are the equatorial radius and the polar semi-axis.
|
||||||
|
* For a sphere β = φ.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* β lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double ParametricLatitude(double phi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] beta the parametric latitude (degrees).
|
||||||
|
* @return φ the geographic latitude (degrees).
|
||||||
|
*
|
||||||
|
* β must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* φ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double InverseParametricLatitude(double beta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] phi the geographic latitude (degrees).
|
||||||
|
* @return θ the geocentric latitude (degrees).
|
||||||
|
*
|
||||||
|
* The geocentric latitude, θ, 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 θ = φ.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* θ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double GeocentricLatitude(double phi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] theta the geocentric latitude (degrees).
|
||||||
|
* @return φ the geographic latitude (degrees).
|
||||||
|
*
|
||||||
|
* θ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* φ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double InverseGeocentricLatitude(double theta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] phi the geographic latitude (degrees).
|
||||||
|
* @return μ the rectifying latitude (degrees).
|
||||||
|
*
|
||||||
|
* The rectifying latitude, μ, has the property that the distance along
|
||||||
|
* a meridian of the ellipsoid between two points with rectifying latitudes
|
||||||
|
* μ<sub>1</sub> and μ<sub>2</sub> is equal to
|
||||||
|
* (μ<sub>2</sub> - μ<sub>1</sub>) \e L / 90°,
|
||||||
|
* where \e L = QuarterMeridian(). For a sphere μ = φ.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* μ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double RectifyingLatitude(double phi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] mu the rectifying latitude (degrees).
|
||||||
|
* @return φ the geographic latitude (degrees).
|
||||||
|
*
|
||||||
|
* μ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* φ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double InverseRectifyingLatitude(double mu);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] phi the geographic latitude (degrees).
|
||||||
|
* @return ξ the authalic latitude (degrees).
|
||||||
|
*
|
||||||
|
* The authalic latitude, ξ, has the property that the area of the
|
||||||
|
* ellipsoid between two circles with authalic latitudes
|
||||||
|
* ξ<sub>1</sub> and ξ<sub>2</sub> is equal to (sin
|
||||||
|
* ξ<sub>2</sub> - sin ξ<sub>1</sub>) \e A / 2, where \e A
|
||||||
|
* = Area(). For a sphere ξ = φ.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* ξ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double AuthalicLatitude(double phi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] xi the authalic latitude (degrees).
|
||||||
|
* @return φ the geographic latitude (degrees).
|
||||||
|
*
|
||||||
|
* ξ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* φ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double InverseAuthalicLatitude(double xi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] phi the geographic latitude (degrees).
|
||||||
|
* @return χ the conformal latitude (degrees).
|
||||||
|
*
|
||||||
|
* The conformal latitude, χ, 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 χ = φ.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* χ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double ConformalLatitude(double phi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] chi the conformal latitude (degrees).
|
||||||
|
* @return φ the geographic latitude (degrees).
|
||||||
|
*
|
||||||
|
* χ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold. The returned value
|
||||||
|
* φ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double InverseConformalLatitude(double chi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] phi the geographic latitude (degrees).
|
||||||
|
* @return ψ 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 ψ =
|
||||||
|
* sinh<sup>−1</sup> tan φ.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold.
|
||||||
|
**********************************************************************/
|
||||||
|
double IsometricLatitude(double phi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] psi the isometric latitude (degrees).
|
||||||
|
* @return φ the geographic latitude (degrees).
|
||||||
|
*
|
||||||
|
* The returned value φ lies in [−90°, 90°].
|
||||||
|
**********************************************************************/
|
||||||
|
double InverseIsometricLatitude(double psi);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Other quantities.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] phi the geographic latitude (degrees).
|
||||||
|
* @return \e R = \e a cos β the radius of a circle of latitude
|
||||||
|
* φ (meters). \e R (π/180°) gives meters per degree
|
||||||
|
* longitude measured along a circle of latitude.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; 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 β the distance of a circle of latitude
|
||||||
|
* φ from the equator measured parallel to the ellipsoid axis
|
||||||
|
* (meters).
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; 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 φ (meters). \e s is
|
||||||
|
* given by \e s = μ \e L / 90°, where \e L =
|
||||||
|
* QuarterMeridian()).
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold.
|
||||||
|
**********************************************************************/
|
||||||
|
double MeridianDistance(double phi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] phi the geographic latitude (degrees).
|
||||||
|
* @return ρ the meridional radius of curvature of the ellipsoid at
|
||||||
|
* latitude φ (meters); this is the curvature of the meridian. \e
|
||||||
|
* rho is given by ρ = (180°/π) d\e s / dφ,
|
||||||
|
* where \e s = MeridianDistance(); thus ρ (π/180°)
|
||||||
|
* gives meters per degree latitude measured along a meridian.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; the
|
||||||
|
* result is undefined if this condition does not hold.
|
||||||
|
**********************************************************************/
|
||||||
|
double MeridionalCurvatureRadius(double phi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] phi the geographic latitude (degrees).
|
||||||
|
* @return ν the transverse radius of curvature of the ellipsoid at
|
||||||
|
* latitude φ (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. ν is related to \e R = CircleRadius() by \e
|
||||||
|
* R = ν cos φ.
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°]; 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 φ inclined at an angle \e azi to the
|
||||||
|
* meridian (meters).
|
||||||
|
*
|
||||||
|
* φ must lie in the range [−90°, 90°] and \e
|
||||||
|
* azi must lie in the range [−540°, 540°); 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 − \e b) / \e b, the second
|
||||||
|
* flattening.
|
||||||
|
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
*
|
||||||
|
* \e f ' should lie in (−1, ∞).
|
||||||
|
* The returned value \e f lies in (−∞, 1).
|
||||||
|
**********************************************************************/
|
||||||
|
static double SecondFlatteningToFlattening(double fp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
* @return \e f ' = (\e a − \e b) / \e b, the second flattening.
|
||||||
|
*
|
||||||
|
* \e f should lie in (−∞, 1).
|
||||||
|
* The returned value \e f ' lies in (−1, ∞).
|
||||||
|
**********************************************************************/
|
||||||
|
static double FlatteningToSecondFlattening(double f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] n = (\e a − \e b) / (\e a + \e b), the third
|
||||||
|
* flattening.
|
||||||
|
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
*
|
||||||
|
* \e n should lie in (−1, 1).
|
||||||
|
* The returned value \e f lies in (−∞, 1).
|
||||||
|
**********************************************************************/
|
||||||
|
static double ThirdFlatteningToFlattening(double n);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
* @return \e n = (\e a − \e b) / (\e a + \e b), the third
|
||||||
|
* flattening.
|
||||||
|
*
|
||||||
|
* \e f should lie in (−∞, 1).
|
||||||
|
* The returned value \e n lies in (−1, 1).
|
||||||
|
**********************************************************************/
|
||||||
|
static double FlatteningToThirdFlattening(double f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] e2 = <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> −
|
||||||
|
* <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity
|
||||||
|
* squared.
|
||||||
|
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
*
|
||||||
|
* <i>e</i><sup>2</sup> should lie in (−∞, 1).
|
||||||
|
* The returned value \e f lies in (−∞, 1).
|
||||||
|
**********************************************************************/
|
||||||
|
static double EccentricitySqToFlattening(double e2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
* @return <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> −
|
||||||
|
* <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity
|
||||||
|
* squared.
|
||||||
|
*
|
||||||
|
* \e f should lie in (−∞, 1).
|
||||||
|
* The returned value <i>e</i><sup>2</sup> lies in (−∞, 1).
|
||||||
|
**********************************************************************/
|
||||||
|
static double FlatteningToEccentricitySq(double f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] ep2 = <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> −
|
||||||
|
* <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
|
||||||
|
* squared.
|
||||||
|
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
*
|
||||||
|
* <i>e'</i> <sup>2</sup> should lie in (−1, ∞).
|
||||||
|
* The returned value \e f lies in (−∞, 1).
|
||||||
|
**********************************************************************/
|
||||||
|
static double SecondEccentricitySqToFlattening(double ep2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
* @return <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> −
|
||||||
|
* <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
|
||||||
|
* squared.
|
||||||
|
*
|
||||||
|
* \e f should lie in (−∞, 1).
|
||||||
|
* The returned value <i>e'</i> <sup>2</sup> lies in (−1, ∞).
|
||||||
|
**********************************************************************/
|
||||||
|
static double FlatteningToSecondEccentricitySq(double f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] epp2 = <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup>
|
||||||
|
* − <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 − \e b) / \e a, the flattening.
|
||||||
|
*
|
||||||
|
* <i>e''</i> <sup>2</sup> should lie in (−1, 1).
|
||||||
|
* The returned value \e f lies in (−∞, 1).
|
||||||
|
**********************************************************************/
|
||||||
|
static double ThirdEccentricitySqToFlattening(double epp2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
||||||
|
* @return <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup> −
|
||||||
|
* <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 (−∞, 1).
|
||||||
|
* The returned value <i>e''</i> <sup>2</sup> lies in (−1, 1).
|
||||||
|
**********************************************************************/
|
||||||
|
static double FlatteningToThirdEccentricitySq(double f);
|
||||||
|
};
|
||||||
|
} // namespace NETGeographicLib
|
||||||
|
|
@ -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(); }
|
||||||
|
|
@ -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 α<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> < 0). (Confusingly, Abramowitz and
|
||||||
|
* Stegun call \e m = <i>k</i><sup>2</sup> the "parameter" and \e n =
|
||||||
|
* α<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 δ\e E(φ, \e k) is an odd periodic function with period
|
||||||
|
* π.
|
||||||
|
*
|
||||||
|
* 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 (-∞, 1). (No checking is
|
||||||
|
* done.)
|
||||||
|
* @param[in] alpha2 the parameter α<sup>2</sup>.
|
||||||
|
* α<sup>2</sup> must lie in (-∞, 1). (No checking is done.)
|
||||||
|
*
|
||||||
|
* If only elliptic integrals of the first and second kinds are needed,
|
||||||
|
* then set α<sup>2</sup> = 0 (the default value); in this case, we
|
||||||
|
* have Π(φ, 0, \e k) = \e F(φ, \e k), \e G(φ, 0, \e k) = \e
|
||||||
|
* E(φ, \e k), and \e H(φ, 0, \e k) = \e F(φ, \e k) - \e
|
||||||
|
* D(φ, \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 (-∞, 1). (No checking is
|
||||||
|
* done.)
|
||||||
|
* @param[in] alpha2 the parameter α<sup>2</sup>.
|
||||||
|
* α<sup>2</sup> must lie in (-∞, 1). (No checking is done.)
|
||||||
|
* @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> =
|
||||||
|
* 1 − <i>k</i><sup>2</sup>.
|
||||||
|
* @param[in] alphap2 the complementary parameter α'<sup>2</sup> = 1
|
||||||
|
* − α<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 (-∞, 1). (No checking is
|
||||||
|
* done.)
|
||||||
|
* @param[in] alpha2 the new value of parameter α<sup>2</sup>.
|
||||||
|
* α<sup>2</sup> must lie in (-∞, 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 (-∞, 1). (No checking is
|
||||||
|
* done.)
|
||||||
|
* @param[in] alpha2 the parameter α<sup>2</sup>.
|
||||||
|
* α<sup>2</sup> must lie in (-∞, 1). (No checking is done.)
|
||||||
|
* @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> =
|
||||||
|
* 1 − <i>k</i><sup>2</sup>.
|
||||||
|
* @param[in] alphap2 the complementary parameter α'<sup>2</sup> = 1
|
||||||
|
* − α<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 − <i>k</i><sup>2</sup>.
|
||||||
|
**********************************************************************/
|
||||||
|
property double kp2 { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the parameter α<sup>2</sup>.
|
||||||
|
**********************************************************************/
|
||||||
|
property double alpha2 { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the complementary parameter α'<sup>2</sup> = 1 −
|
||||||
|
* α<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) − \e E(\e k).
|
||||||
|
**********************************************************************/
|
||||||
|
double KE();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The complete integral of the third kind.
|
||||||
|
*
|
||||||
|
* @return Π(α<sup>2</sup>, \e k)
|
||||||
|
*
|
||||||
|
* Π(α<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(α<sup>2</sup>, \e k)
|
||||||
|
*
|
||||||
|
* \e G(α<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(α<sup>2</sup>, \e k)
|
||||||
|
*
|
||||||
|
* \e H(α<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(φ, \e k).
|
||||||
|
*
|
||||||
|
* \e F(φ, \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(φ, \e k).
|
||||||
|
*
|
||||||
|
* \e E(φ, \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(π <i>ang</i>/180, \e k).
|
||||||
|
**********************************************************************/
|
||||||
|
double Ed(double ang);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The inverse of the incomplete integral of the second kind.
|
||||||
|
*
|
||||||
|
* @param[in] x
|
||||||
|
* @return φ = <i>E</i><sup>−1</sup>(\e x, \e k); i.e., the
|
||||||
|
* solution of such that \e E(φ, \e k) = \e x.
|
||||||
|
**********************************************************************/
|
||||||
|
double Einv(double x);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The incomplete integral of the third kind.
|
||||||
|
*
|
||||||
|
* @param[in] phi
|
||||||
|
* @return Π(φ, α<sup>2</sup>, \e k).
|
||||||
|
*
|
||||||
|
* Π(φ, α<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(φ, \e k).
|
||||||
|
*
|
||||||
|
* \e D(φ, \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(φ, α<sup>2</sup>, \e k).
|
||||||
|
*
|
||||||
|
* \e G(φ, α<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é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(φ, α<sup>2</sup>, \e k).
|
||||||
|
*
|
||||||
|
* \e H(φ, α<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φ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return \e F(φ, \e k) as though φ ∈ (−π, π].
|
||||||
|
**********************************************************************/
|
||||||
|
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φ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return \e E(φ, \e k) as though φ ∈ (−π, π].
|
||||||
|
**********************************************************************/
|
||||||
|
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φ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return Π(φ, α<sup>2</sup>, \e k) as though φ ∈
|
||||||
|
* (−π, π].
|
||||||
|
**********************************************************************/
|
||||||
|
double Pi(double sn, double cn, double dn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Jahnke's incomplete elliptic integral in terms of Jacobi elliptic
|
||||||
|
* functions.
|
||||||
|
*
|
||||||
|
* @param[in] sn = sinφ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return \e D(φ, \e k) as though φ ∈ (−π, π].
|
||||||
|
**********************************************************************/
|
||||||
|
double D(double sn, double cn, double dn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legendre's geodesic longitude integral in terms of Jacobi elliptic
|
||||||
|
* functions.
|
||||||
|
*
|
||||||
|
* @param[in] sn = sinφ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return \e G(φ, α<sup>2</sup>, \e k) as though φ ∈
|
||||||
|
* (−π, π].
|
||||||
|
**********************************************************************/
|
||||||
|
double G(double sn, double cn, double dn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cayley's geodesic longitude difference integral in terms of Jacobi
|
||||||
|
* elliptic functions.
|
||||||
|
*
|
||||||
|
* @param[in] sn = sinφ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return \e H(φ, α<sup>2</sup>, \e k) as though φ ∈
|
||||||
|
* (−π, π].
|
||||||
|
**********************************************************************/
|
||||||
|
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φ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return the periodic function π \e F(φ, \e k) / (2 \e K(\e k)) -
|
||||||
|
* φ
|
||||||
|
**********************************************************************/
|
||||||
|
double deltaF(double sn, double cn, double dn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The periodic incomplete integral of the second kind.
|
||||||
|
*
|
||||||
|
* @param[in] sn = sinφ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return the periodic function π \e E(φ, \e k) / (2 \e E(\e k)) -
|
||||||
|
* φ
|
||||||
|
**********************************************************************/
|
||||||
|
double deltaE(double sn, double cn, double dn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The periodic inverse of the incomplete integral of the second kind.
|
||||||
|
*
|
||||||
|
* @param[in] stau = sinτ
|
||||||
|
* @param[in] ctau = sinτ
|
||||||
|
* @return the periodic function <i>E</i><sup>−1</sup>(τ (2 \e
|
||||||
|
* E(\e k)/π), \e k) - τ
|
||||||
|
**********************************************************************/
|
||||||
|
double deltaEinv(double stau, double ctau);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The periodic incomplete integral of the third kind.
|
||||||
|
*
|
||||||
|
* @param[in] sn = sinφ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return the periodic function π Π(φ, \e k) / (2 Π(\e k)) -
|
||||||
|
* φ
|
||||||
|
**********************************************************************/
|
||||||
|
double deltaPi(double sn, double cn, double dn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The periodic Jahnke's incomplete elliptic integral.
|
||||||
|
*
|
||||||
|
* @param[in] sn = sinφ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return the periodic function π \e D(φ, \e k) / (2 \e D(\e k)) -
|
||||||
|
* φ
|
||||||
|
**********************************************************************/
|
||||||
|
double deltaD(double sn, double cn, double dn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legendre's periodic geodesic longitude integral.
|
||||||
|
*
|
||||||
|
* @param[in] sn = sinφ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return the periodic function π \e G(φ, \e k) / (2 \e G(\e k)) -
|
||||||
|
* φ
|
||||||
|
**********************************************************************/
|
||||||
|
double deltaG(double sn, double cn, double dn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cayley's periodic geodesic longitude difference integral.
|
||||||
|
*
|
||||||
|
* @param[in] sn = sinφ
|
||||||
|
* @param[in] cn = cosφ
|
||||||
|
* @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
* @return the periodic function π \e H(φ, \e k) / (2 \e H(\e k)) -
|
||||||
|
* φ
|
||||||
|
**********************************************************************/
|
||||||
|
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 Δ amplitude function.
|
||||||
|
*
|
||||||
|
* @param[in] sn sinφ
|
||||||
|
* @param[in] cn cosφ
|
||||||
|
* @return Δ = sqrt(1 − <i>k</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>φ)
|
||||||
|
**********************************************************************/
|
||||||
|
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
|
||||||
|
|
@ -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() );
|
||||||
|
}
|
||||||
|
|
@ -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°,
|
||||||
|
* \e longitude = 0°.
|
||||||
|
**********************************************************************/
|
||||||
|
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"E 33d26'24"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 " 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"
|
||||||
|
* - 40d30'30
|
||||||
|
* - 40°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
|
||||||
|
* [−90°, 90°] and longitudes in the range
|
||||||
|
* [−540°, 540°). Internally longitudes are reduced
|
||||||
|
* to the range [−180°, 180°).
|
||||||
|
*
|
||||||
|
* <b>UTM/UPS parsing</b>: For UTM zones (−80° ≤ Lat <
|
||||||
|
* 84°), 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 [−90°,
|
||||||
|
* 90°].
|
||||||
|
* @exception GeographicErr if \e longitude is not in [−540°,
|
||||||
|
* 540°).
|
||||||
|
* @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 [−90°,
|
||||||
|
* 90°].
|
||||||
|
* @exception GeographicErr if \e longitude is not in [−540°,
|
||||||
|
* 540°).
|
||||||
|
* @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 = −5 (min), 1°
|
||||||
|
* - prec = 0, 10<sup>−5</sup>° (about 1m)
|
||||||
|
* - prec = 3, 10<sup>−8</sup>°
|
||||||
|
* - prec = 9 (max), 10<sup>−14</sup>°
|
||||||
|
**********************************************************************/
|
||||||
|
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, ', " 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 = −5 (min), 1°
|
||||||
|
* - prec = −4, 0.1°
|
||||||
|
* - prec = −3, 1'
|
||||||
|
* - prec = −2, 0.1'
|
||||||
|
* - prec = −1, 1"
|
||||||
|
* - prec = 0, 0.1" (about 3m)
|
||||||
|
* - prec = 1, 0.01"
|
||||||
|
* - prec = 10 (max), 10<sup>−11</sup>"
|
||||||
|
**********************************************************************/
|
||||||
|
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 −2 (100m) is 38SMB441847 and not
|
||||||
|
* 38SMB442848. \e prec specifies the precision of the MGRS string as
|
||||||
|
* follows:
|
||||||
|
* - prec = −5 (min), 100km
|
||||||
|
* - prec = −4, 10km
|
||||||
|
* - prec = −3, 1km
|
||||||
|
* - prec = −2, 100m
|
||||||
|
* - prec = −1, 10m
|
||||||
|
* - prec = 0, 1m
|
||||||
|
* - prec = 1, 0.1m
|
||||||
|
* - prec = 6 (max), 1μ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 = −5 (min), 100km
|
||||||
|
* - prec = −3, 1km
|
||||||
|
* - prec = 0, 1m
|
||||||
|
* - prec = 3, 1mm
|
||||||
|
* - prec = 6, 1μ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
|
||||||
|
|
@ -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(); }
|
||||||
|
|
@ -0,0 +1,227 @@
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/Geocentric.h
|
||||||
|
* \brief Header 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/
|
||||||
|
**********************************************************************/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace NETGeographicLib
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* \brief .NET wrapper for GeographicLib::Geocentric.
|
||||||
|
*
|
||||||
|
* This class allows .NET applications to access GeographicLib::Geocentric.
|
||||||
|
*
|
||||||
|
* Convert between geodetic coordinates latitude = \e lat, longitude = \e
|
||||||
|
* lon, height = \e h (measured vertically from the surface of the ellipsoid)
|
||||||
|
* to geocentric coordinates (\e X, \e Y, \e Z). The origin of geocentric
|
||||||
|
* coordinates is at the center of the earth. The \e Z axis goes thru the
|
||||||
|
* north pole, \e lat = 90°. The \e X axis goes thru \e lat = 0,
|
||||||
|
* \e lon = 0. %Geocentric coordinates are also known as earth centered,
|
||||||
|
* earth fixed (ECEF) coordinates.
|
||||||
|
*
|
||||||
|
* The conversion from geographic to geocentric coordinates is
|
||||||
|
* straightforward. For the reverse transformation we use
|
||||||
|
* - H. Vermeille,
|
||||||
|
* <a href="http://dx.doi.org/10.1007/s00190-002-0273-6"> Direct
|
||||||
|
* transformation from geocentric coordinates to geodetic coordinates</a>,
|
||||||
|
* J. Geodesy 76, 451--454 (2002).
|
||||||
|
* .
|
||||||
|
* Several changes have been made to ensure that the method returns accurate
|
||||||
|
* results for all finite inputs (even if \e h is infinite). The changes are
|
||||||
|
* described in Appendix B of
|
||||||
|
* - C. F. F. Karney,
|
||||||
|
* <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
|
||||||
|
* on an ellipsoid of revolution</a>,
|
||||||
|
* Feb. 2011;
|
||||||
|
* preprint
|
||||||
|
* <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
|
||||||
|
* .
|
||||||
|
* See \ref geocentric for more information.
|
||||||
|
*
|
||||||
|
* The errors in these routines are close to round-off. Specifically, for
|
||||||
|
* points within 5000 km of the surface of the ellipsoid (either inside or
|
||||||
|
* outside the ellipsoid), the error is bounded by 7 nm (7 nanometers) for
|
||||||
|
* the WGS84 ellipsoid. See \ref geocentric for further information on the
|
||||||
|
* errors.
|
||||||
|
*
|
||||||
|
* C# Example:
|
||||||
|
* \include example-Geocentric.cs
|
||||||
|
* Managed C++ Example:
|
||||||
|
* \include example-Geocentric.cpp
|
||||||
|
* Visual Basic Example:
|
||||||
|
* \include example-Geocentric.vb
|
||||||
|
*
|
||||||
|
* <B>INTERFACE DIFFERENCES:</B><BR>
|
||||||
|
* A default constructor is provided that assumes WGS84 parameters.
|
||||||
|
*
|
||||||
|
* The MajorRadius and Flattening functions are implemented as properties.
|
||||||
|
*
|
||||||
|
* The Forward and Reverse functions return rotation matrices as 2D,
|
||||||
|
* 3 × 3 arrays rather than vectors.
|
||||||
|
**********************************************************************/
|
||||||
|
public ref class Geocentric
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// pointer to the unmanaged GeographicLib::Geocentric
|
||||||
|
const GeographicLib::Geocentric* m_pGeocentric;
|
||||||
|
|
||||||
|
// The finalizer frees unmanaged memory when the object is destroyed.
|
||||||
|
!Geocentric();
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* 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 − \e f ) \e a is not
|
||||||
|
* positive.
|
||||||
|
**********************************************************************/
|
||||||
|
Geocentric(double a, double f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A default constructor which assumes WGS84.
|
||||||
|
**********************************************************************/
|
||||||
|
Geocentric();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A constructor that is initialized from an unmanaged
|
||||||
|
* GeographicLib::Geocentric. For internal use only.
|
||||||
|
* @param[in] g An existing GeographicLib::Geocentric.
|
||||||
|
**********************************************************************/
|
||||||
|
Geocentric( const GeographicLib::Geocentric& g );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The destructor calls the finalizer.
|
||||||
|
**********************************************************************/
|
||||||
|
~Geocentric()
|
||||||
|
{ this->!Geocentric(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from geodetic to geocentric coordinates.
|
||||||
|
*
|
||||||
|
* @param[in] lat latitude of point (degrees).
|
||||||
|
* @param[in] lon longitude of point (degrees).
|
||||||
|
* @param[in] h height of point above the ellipsoid (meters).
|
||||||
|
* @param[out] X geocentric coordinate (meters).
|
||||||
|
* @param[out] Y geocentric coordinate (meters).
|
||||||
|
* @param[out] Z geocentric coordinate (meters).
|
||||||
|
*
|
||||||
|
* \e lat should be in the range [−90°, 90°]; \e lon
|
||||||
|
* should be in the range [−540°, 540°).
|
||||||
|
**********************************************************************/
|
||||||
|
void 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from geodetic to geocentric coordinates and return rotation
|
||||||
|
* matrix.
|
||||||
|
*
|
||||||
|
* @param[in] lat latitude of point (degrees).
|
||||||
|
* @param[in] lon longitude of point (degrees).
|
||||||
|
* @param[in] h height of point above the ellipsoid (meters).
|
||||||
|
* @param[out] X geocentric coordinate (meters).
|
||||||
|
* @param[out] Y geocentric coordinate (meters).
|
||||||
|
* @param[out] Z geocentric coordinate (meters).
|
||||||
|
* @param[out] M a 3 × 3 rotation matrix.
|
||||||
|
*
|
||||||
|
* Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can
|
||||||
|
* express \e v as \e column vectors in one of two ways
|
||||||
|
* - in east, north, up coordinates (where the components are relative to a
|
||||||
|
* local coordinate system at (\e lat, \e lon, \e h)); call this
|
||||||
|
* representation \e v1.
|
||||||
|
* - in geocentric \e X, \e Y, \e Z coordinates; call this representation
|
||||||
|
* \e v0.
|
||||||
|
* .
|
||||||
|
* Then we have \e v0 = \e M ⋅ \e v1.
|
||||||
|
**********************************************************************/
|
||||||
|
void 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from geocentric to geodetic to coordinates.
|
||||||
|
*
|
||||||
|
* @param[in] X geocentric coordinate (meters).
|
||||||
|
* @param[in] Y geocentric coordinate (meters).
|
||||||
|
* @param[in] Z geocentric coordinate (meters).
|
||||||
|
* @param[out] lat latitude of point (degrees).
|
||||||
|
* @param[out] lon longitude of point (degrees).
|
||||||
|
* @param[out] h height of point above the ellipsoid (meters).
|
||||||
|
*
|
||||||
|
* In general there are multiple solutions and the result which maximizes
|
||||||
|
* \e h is returned. If there are still multiple solutions with different
|
||||||
|
* latitudes (applies only if \e Z = 0), then the solution with \e lat > 0
|
||||||
|
* is returned. If there are still multiple solutions with different
|
||||||
|
* longitudes (applies only if \e X = \e Y = 0) then \e lon = 0 is
|
||||||
|
* returned. The value of \e h returned satisfies \e h ≥ − \e a
|
||||||
|
* (1 − <i>e</i><sup>2</sup>) / sqrt(1 − <i>e</i><sup>2</sup>
|
||||||
|
* sin<sup>2</sup>\e lat). The value of \e lon returned is in the range
|
||||||
|
* [−180°, 180°).
|
||||||
|
**********************************************************************/
|
||||||
|
void 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);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from geocentric to geodetic to coordinates.
|
||||||
|
*
|
||||||
|
* @param[in] X geocentric coordinate (meters).
|
||||||
|
* @param[in] Y geocentric coordinate (meters).
|
||||||
|
* @param[in] Z geocentric coordinate (meters).
|
||||||
|
* @param[out] lat latitude of point (degrees).
|
||||||
|
* @param[out] lon longitude of point (degrees).
|
||||||
|
* @param[out] h height of point above the ellipsoid (meters).
|
||||||
|
* @param[out] M a 3 × 3 rotation matrix.
|
||||||
|
*
|
||||||
|
* Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can
|
||||||
|
* express \e v as \e column vectors in one of two ways
|
||||||
|
* - in east, north, up coordinates (where the components are relative to a
|
||||||
|
* local coordinate system at (\e lat, \e lon, \e h)); call this
|
||||||
|
* representation \e v1.
|
||||||
|
* - in geocentric \e X, \e Y, \e Z coordinates; call this representation
|
||||||
|
* \e v0.
|
||||||
|
* .
|
||||||
|
* Then we have \e v1 = \e M<sup>T</sup> ⋅ \e v0, where \e
|
||||||
|
* M<sup>T</sup> is the transpose of \e M.
|
||||||
|
**********************************************************************/
|
||||||
|
void 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);
|
||||||
|
|
||||||
|
/** \name Inspector functions
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* @return a pointer to the unmanaged GeographicLib::Geocentric.
|
||||||
|
**********************************************************************/
|
||||||
|
System::IntPtr^ GetUnmanaged();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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(); }
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
} // namespace NETGeographicLib
|
||||||
|
|
@ -0,0 +1,483 @@
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/Geodesic.cpp
|
||||||
|
* \brief Implementation for NETGeographicLib::Geodesic 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/Geodesic.hpp>
|
||||||
|
#include "Geodesic.h"
|
||||||
|
#include "GeodesicLine.h"
|
||||||
|
#include "NETGeographicLib.h"
|
||||||
|
|
||||||
|
using namespace NETGeographicLib;
|
||||||
|
|
||||||
|
const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::Geodesic";
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
Geodesic::!Geodesic()
|
||||||
|
{
|
||||||
|
if ( m_pGeodesic != NULL )
|
||||||
|
{
|
||||||
|
delete m_pGeodesic;
|
||||||
|
m_pGeodesic = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
Geodesic::Geodesic(double a, double f)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeodesic = new GeographicLib::Geodesic( a, f );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( BADALLOC );
|
||||||
|
}
|
||||||
|
catch ( GeographicLib::GeographicErr err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
Geodesic::Geodesic()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeodesic = new GeographicLib::Geodesic( GeographicLib::Geodesic::WGS84 );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( BADALLOC );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2, lm12, lM12, lM21, lS12);
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2)
|
||||||
|
{
|
||||||
|
double llat2, llon2;
|
||||||
|
double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2;
|
||||||
|
double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12;
|
||||||
|
double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2, lm12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lM12, lM21;
|
||||||
|
double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2, lM12, lM21);
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21;
|
||||||
|
double out = m_pGeodesic->Direct(lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2, lm12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
|
||||||
|
m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12);
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2)
|
||||||
|
{
|
||||||
|
double llat2, llon2;
|
||||||
|
m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2;
|
||||||
|
m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12, llat2, llon2, lazi2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12;
|
||||||
|
m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12;
|
||||||
|
m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12, lm12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lM12, lM21;
|
||||||
|
m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geodesic::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21;
|
||||||
|
m_pGeodesic->ArcDirect(lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12, lm12, lM12, lM21);
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
s12 = ls12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::GenDirect(double lat1, double lon1, double azi1,
|
||||||
|
bool arcmode, double s12_a12,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21, ls12, lS12;
|
||||||
|
double out = m_pGeodesic->GenDirect(lat1, lon1, azi1, arcmode, s12_a12,
|
||||||
|
static_cast<unsigned>(outmask),
|
||||||
|
llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12);
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
s12 = ls12;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2, lm12, lM12, lM21, lS12);
|
||||||
|
s12 = ls12;
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12)
|
||||||
|
{
|
||||||
|
double ls12;
|
||||||
|
double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, ls12 );
|
||||||
|
s12 = ls12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double lazi1, lazi2;
|
||||||
|
double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2, lazi1, lazi2);
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2;
|
||||||
|
double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2 );
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lm12;
|
||||||
|
double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2, lm12 );
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lM12, lM21;
|
||||||
|
double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2, lM12, lM21 );
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lm12, lM12, lM21;
|
||||||
|
double out = m_pGeodesic->Inverse(lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2, lm12, lM12, lM21 );
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::GenInverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesic->GenInverse(lat1, lon1, lat2, lon2,
|
||||||
|
static_cast<unsigned>(outmask),
|
||||||
|
ls12, lazi1, lazi2, lm12, lM12, lM21, lS12);
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::IntPtr^ Geodesic::GetUnmanaged()
|
||||||
|
{
|
||||||
|
return gcnew System::IntPtr( const_cast<void*>(reinterpret_cast<const void*>(m_pGeodesic)) );
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicLine^ Geodesic::Line(double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps )
|
||||||
|
{
|
||||||
|
return gcnew GeodesicLine( this, lat1, lon1, azi1, caps );
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::MajorRadius::get() { return m_pGeodesic->MajorRadius(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::Flattening::get() { return m_pGeodesic->Flattening(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geodesic::EllipsoidArea::get() { return m_pGeodesic->EllipsoidArea(); }
|
||||||
|
|
@ -0,0 +1,688 @@
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/Geodesic.h
|
||||||
|
* \brief Header for NETGeographicLib::Geodesic 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 "NETGeographicLib.h"
|
||||||
|
|
||||||
|
namespace NETGeographicLib
|
||||||
|
{
|
||||||
|
ref class GeodesicLine;
|
||||||
|
/**
|
||||||
|
* \brief .NET wrapper for GeographicLib::Geodesic.
|
||||||
|
*
|
||||||
|
* This class allows .NET applications to access GeographicLib::Geodesic.
|
||||||
|
*
|
||||||
|
* The shortest path between two points on a ellipsoid at (\e lat1, \e lon1)
|
||||||
|
* and (\e lat2, \e lon2) is called the geodesic. Its length is \e s12 and
|
||||||
|
* the geodesic from point 1 to point 2 has azimuths \e azi1 and \e azi2 at
|
||||||
|
* the two end points. (The azimuth is the heading measured clockwise from
|
||||||
|
* north. \e azi2 is the "forward" azimuth, i.e., the heading that takes you
|
||||||
|
* beyond point 2 not back to point 1.)
|
||||||
|
*
|
||||||
|
* Given \e lat1, \e lon1, \e azi1, and \e s12, we can determine \e lat2, \e
|
||||||
|
* lon2, and \e azi2. This is the \e direct geodesic problem and its
|
||||||
|
* solution is given by the function Geodesic::Direct. (If \e s12 is
|
||||||
|
* sufficiently large that the geodesic wraps more than halfway around the
|
||||||
|
* earth, there will be another geodesic between the points with a smaller \e
|
||||||
|
* s12.)
|
||||||
|
*
|
||||||
|
* Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi1, \e
|
||||||
|
* azi2, and \e s12. This is the \e inverse geodesic problem, whose solution
|
||||||
|
* is given by Geodesic::Inverse. Usually, the solution to the inverse
|
||||||
|
* problem is unique. In cases where there are multiple solutions (all with
|
||||||
|
* the same \e s12, of course), all the solutions can be easily generated
|
||||||
|
* once a particular solution is provided.
|
||||||
|
*
|
||||||
|
* The standard way of specifying the direct problem is the specify the
|
||||||
|
* distance \e s12 to the second point. However it is sometimes useful
|
||||||
|
* instead to specify the arc length \e a12 (in degrees) on the auxiliary
|
||||||
|
* sphere. This is a mathematical construct used in solving the geodesic
|
||||||
|
* problems. The solution of the direct problem in this form is provided by
|
||||||
|
* Geodesic::ArcDirect. An arc length in excess of 180° indicates that
|
||||||
|
* the geodesic is not a shortest path. In addition, the arc length between
|
||||||
|
* an equatorial crossing and the next extremum of latitude for a geodesic is
|
||||||
|
* 90°.
|
||||||
|
*
|
||||||
|
* This class can also calculate several other quantities related to
|
||||||
|
* geodesics. These are:
|
||||||
|
* - <i>reduced length</i>. If we fix the first point and increase \e azi1
|
||||||
|
* by \e dazi1 (radians), the second point is displaced \e m12 \e dazi1 in
|
||||||
|
* the direction \e azi2 + 90°. The quantity \e m12 is called
|
||||||
|
* the "reduced length" and is symmetric under interchange of the two
|
||||||
|
* points. On a curved surface the reduced length obeys a symmetry
|
||||||
|
* relation, \e m12 + \e m21 = 0. On a flat surface, we have \e m12 = \e
|
||||||
|
* s12. The ratio <i>s12</i>/\e m12 gives the azimuthal scale for an
|
||||||
|
* azimuthal equidistant projection.
|
||||||
|
* - <i>geodesic scale</i>. Consider a reference geodesic and a second
|
||||||
|
* geodesic parallel to this one at point 1 and separated by a small
|
||||||
|
* distance \e dt. The separation of the two geodesics at point 2 is \e
|
||||||
|
* M12 \e dt where \e M12 is called the "geodesic scale". \e M21 is
|
||||||
|
* defined similarly (with the geodesics being parallel at point 2). On a
|
||||||
|
* flat surface, we have \e M12 = \e M21 = 1. The quantity 1/\e M12 gives
|
||||||
|
* the scale of the Cassini-Soldner projection.
|
||||||
|
|
||||||
|
* - <i>area</i>. The area between the geodesic from point 1 to point 2 and
|
||||||
|
* the equation is represented by \e S12; it is the area, measured
|
||||||
|
* counter-clockwise, of the geodesic quadrilateral with corners
|
||||||
|
* (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), (0,<i>lon2</i>), and
|
||||||
|
* (<i>lat2</i>,<i>lon2</i>). It can be used to compute the area of any
|
||||||
|
* simple geodesic polygon.
|
||||||
|
*
|
||||||
|
* Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and
|
||||||
|
* Geodesic::Inverse allow these quantities to be returned. In addition
|
||||||
|
* there are general functions Geodesic::GenDirect, and Geodesic::GenInverse
|
||||||
|
* which allow an arbitrary set of results to be computed. The quantities \e
|
||||||
|
* m12, \e M12, \e M21 which all specify the behavior of nearby geodesics
|
||||||
|
* obey addition rules. If points 1, 2, and 3 all lie on a single geodesic,
|
||||||
|
* then the following rules hold:
|
||||||
|
* - \e s13 = \e s12 + \e s23
|
||||||
|
* - \e a13 = \e a12 + \e a23
|
||||||
|
* - \e S13 = \e S12 + \e S23
|
||||||
|
* - \e m13 = \e m12 \e M23 + \e m23 \e M21
|
||||||
|
* - \e M13 = \e M12 \e M23 − (1 − \e M12 \e M21) \e m23 / \e m12
|
||||||
|
* - \e M31 = \e M32 \e M21 − (1 − \e M23 \e M32) \e m12 / \e m23
|
||||||
|
*
|
||||||
|
* Additional functionality is provided by the GeodesicLine class, which
|
||||||
|
* allows a sequence of points along a geodesic to be computed.
|
||||||
|
*
|
||||||
|
* The shortest distance returned by the solution of the inverse problem is
|
||||||
|
* (obviously) uniquely defined. However, in a few special cases there are
|
||||||
|
* multiple azimuths which yield the same shortest distance. Here is a
|
||||||
|
* catalog of those cases:
|
||||||
|
* - \e lat1 = −\e lat2 (with neither at a pole). If \e azi1 = \e
|
||||||
|
* azi2, the geodesic is unique. Otherwise there are two geodesics and the
|
||||||
|
* second one is obtained by setting [\e azi1, \e azi2] = [\e azi2, \e
|
||||||
|
* azi1], [\e M12, \e M21] = [\e M21, \e M12], \e S12 = −\e S12.
|
||||||
|
* (This occurs when the longitude difference is near ±180° for
|
||||||
|
* oblate ellipsoids.)
|
||||||
|
* - \e lon2 = \e lon1 ± 180° (with neither at a pole). If \e
|
||||||
|
* azi1 = 0° or ±180°, the geodesic is unique. Otherwise
|
||||||
|
* there are two geodesics and the second one is obtained by setting [\e
|
||||||
|
* azi1, \e azi2] = [−\e azi1, −\e azi2], \e S12 = −\e
|
||||||
|
* S12. (This occurs when the \e lat2 is near −\e lat1 for prolate
|
||||||
|
* ellipsoids.)
|
||||||
|
* - Points 1 and 2 at opposite poles. There are infinitely many geodesics
|
||||||
|
* which can be generated by setting [\e azi1, \e azi2] = [\e azi1, \e
|
||||||
|
* azi2] + [\e d, −\e d], for arbitrary \e d. (For spheres, this
|
||||||
|
* prescription applies when points 1 and 2 are antipodal.)
|
||||||
|
* - s12 = 0 (coincident points). There are infinitely many geodesics which
|
||||||
|
* can be generated by setting [\e azi1, \e azi2] = [\e azi1, \e azi2] +
|
||||||
|
* [\e d, \e d], for arbitrary \e d.
|
||||||
|
*
|
||||||
|
* The calculations are accurate to better than 15 nm (15 nanometers) for the
|
||||||
|
* WGS84 ellipsoid. See Sec. 9 of
|
||||||
|
* <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
|
||||||
|
* details. The algorithms used by this class are based on series expansions
|
||||||
|
* using the flattening \e f as a small parameter. These are only accurate
|
||||||
|
* for |<i>f</i>| < 0.02; however reasonably accurate results will be
|
||||||
|
* obtained for |<i>f</i>| < 0.2. Here is a table of the approximate
|
||||||
|
* maximum error (expressed as a distance) for an ellipsoid with the same
|
||||||
|
* major radius as the WGS84 ellipsoid and different values of the
|
||||||
|
* flattening.<pre>
|
||||||
|
* |f| error
|
||||||
|
* 0.01 25 nm
|
||||||
|
* 0.02 30 nm
|
||||||
|
* 0.05 10 um
|
||||||
|
* 0.1 1.5 mm
|
||||||
|
* 0.2 300 mm
|
||||||
|
* </pre>
|
||||||
|
* For very eccentric ellipsoids, use GeodesicExact instead.
|
||||||
|
*
|
||||||
|
* The algorithms are described 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);
|
||||||
|
* DOI: <a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
|
||||||
|
* 10.1007/s00190-012-0578-z</a>;
|
||||||
|
* addenda: <a href="http://geographiclib.sf.net/geod-addenda.html">
|
||||||
|
* geod-addenda.html</a>.
|
||||||
|
* .
|
||||||
|
* For more information on geodesics see \ref geodesic.
|
||||||
|
*
|
||||||
|
* C# Example:
|
||||||
|
* \include example-Geodesic.cs
|
||||||
|
* Managed C++ Example:
|
||||||
|
* \include example-Geodesic.cpp
|
||||||
|
* Visual Basic Example:
|
||||||
|
* \include example-Geodesic.vb
|
||||||
|
*
|
||||||
|
* <B>INTERFACE DIFFERENCES:</B><BR>
|
||||||
|
* A default constructor has been provided that assumes WGS84 parameters.
|
||||||
|
*
|
||||||
|
* The MajorRadius, Flattening, and EllipsoidArea functions are
|
||||||
|
* implemented as properties.
|
||||||
|
*
|
||||||
|
* The GenDirect, GenInverse, and Line functions accept the
|
||||||
|
* "capabilities mask" as a NETGeographicLib::Mask rather than an
|
||||||
|
* unsigned.
|
||||||
|
**********************************************************************/
|
||||||
|
public ref class Geodesic
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// The pointer to the unmanaged GeographicLib::Geodesic.
|
||||||
|
const GeographicLib::Geodesic* m_pGeodesic;
|
||||||
|
|
||||||
|
// Frees the unmanaged memory when this object is destroyed.
|
||||||
|
!Geodesic();
|
||||||
|
public:
|
||||||
|
/** \name Constructor
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* 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 − \e f ) \e a is not
|
||||||
|
* positive.
|
||||||
|
**********************************************************************/
|
||||||
|
Geodesic(double a, double f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for the WGS84 ellipsoid.
|
||||||
|
**********************************************************************/
|
||||||
|
Geodesic();
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief the destructor calls the finalizer.
|
||||||
|
**********************************************************************/
|
||||||
|
~Geodesic() { this->!Geodesic(); }
|
||||||
|
|
||||||
|
/** \name Direct geodesic problem specified in terms of distance.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* Solve the direct geodesic problem where the length of the geodesic
|
||||||
|
* is specified in terms of distance.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] s12 distance between point 1 and point 2 (meters); it can be
|
||||||
|
* negative.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
|
||||||
|
* azi1 should be in the range [−540°, 540°). The values of
|
||||||
|
* \e lon2 and \e azi2 returned are in the range [−180°,
|
||||||
|
* 180°).
|
||||||
|
*
|
||||||
|
* If either point is at a pole, the azimuth is defined by keeping the
|
||||||
|
* longitude fixed, writing \e lat = ±(90° − ε),
|
||||||
|
* and taking the limit ε → 0+. An arc length greater that
|
||||||
|
* 180° signifies a geodesic which is not a shortest path. (For a
|
||||||
|
* prolate ellipsoid, an additional condition is necessary for a shortest
|
||||||
|
* path: the longitudinal extent must not exceed of 180°.)
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of Geodesic::Direct
|
||||||
|
* which omit some of the output parameters. Note, however, that the arc
|
||||||
|
* length is always computed and returned as the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Direct geodesic problem specified in terms of arc length.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* Solve the direct geodesic problem where the length of the geodesic
|
||||||
|
* is specified in terms of arc length.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] a12 arc length between point 1 and point 2 (degrees); it can
|
||||||
|
* be negative.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
*
|
||||||
|
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
|
||||||
|
* azi1 should be in the range [−540°, 540°). The values of
|
||||||
|
* \e lon2 and \e azi2 returned are in the range [−180°,
|
||||||
|
* 180°).
|
||||||
|
*
|
||||||
|
* If either point is at a pole, the azimuth is defined by keeping the
|
||||||
|
* longitude fixed, writing \e lat = ±(90° − ε),
|
||||||
|
* and taking the limit ε → 0+. An arc length greater that
|
||||||
|
* 180° signifies a geodesic which is not a shortest path. (For a
|
||||||
|
* prolate ellipsoid, an additional condition is necessary for a shortest
|
||||||
|
* path: the longitudinal extent must not exceed of 180°.)
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of Geodesic::Direct
|
||||||
|
* which omit some of the output parameters.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name General version of the direct geodesic solution.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The general direct geodesic problem. Geodesic::Direct and
|
||||||
|
* Geodesic::ArcDirect are defined in terms of this function.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] arcmode boolean flag determining the meaning of the \e
|
||||||
|
* s12_a12.
|
||||||
|
* @param[in] s12_a12 if \e arcmode is false, this is the distance between
|
||||||
|
* point 1 and point 2 (meters); otherwise it is the arc length between
|
||||||
|
* point 1 and point 2 (degrees); it can be negative.
|
||||||
|
* @param[in] outmask a bitor'ed combination of NETGeographicLib::Mask values
|
||||||
|
* specifying which of the following parameters should be set.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* The NETGeographicLib::Mask values possible for \e outmask are
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e
|
||||||
|
* m12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e
|
||||||
|
* M12 and \e M21;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AREA for the area \e S12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
* The function value \e a12 is always computed and returned and this
|
||||||
|
* equals \e s12_a12 is \e arcmode is true. If \e outmask includes
|
||||||
|
* NETGeographicLib::Mask::DISTANCE and \e arcmode is false, then
|
||||||
|
* \e s12 = \e s12_a12. It is not necessary to include
|
||||||
|
* NETGeographicLib::Mask::DISTANCE_IN in \e outmask; this is
|
||||||
|
* automatically included is \e arcmode is false.
|
||||||
|
**********************************************************************/
|
||||||
|
double GenDirect(double lat1, double lon1, double azi1,
|
||||||
|
bool arcmode, double s12_a12,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Inverse geodesic problem.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* Solve the inverse geodesic problem.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[in] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters).
|
||||||
|
* @param[out] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* \e lat1 and \e lat2 should be in the range [−90°, 90°]; \e
|
||||||
|
* lon1 and \e lon2 should be in the range [−540°, 540°).
|
||||||
|
* The values of \e azi1 and \e azi2 returned are in the range
|
||||||
|
* [−180°, 180°).
|
||||||
|
*
|
||||||
|
* If either point is at a pole, the azimuth is defined by keeping the
|
||||||
|
* longitude fixed, writing \e lat = ±(90° − ε),
|
||||||
|
* and taking the limit ε → 0+.
|
||||||
|
*
|
||||||
|
* The solution to the inverse problem is found using Newton's method. If
|
||||||
|
* this fails to converge (this is very unlikely in geodetic applications
|
||||||
|
* but does occur for very eccentric ellipsoids), then the bisection method
|
||||||
|
* is used to refine the solution.
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of Geodesic::Inverse
|
||||||
|
* which omit some of the output parameters. Note, however, that the arc
|
||||||
|
* length is always computed and returned as the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for Geodesic::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name General version of inverse geodesic solution.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* The general inverse geodesic calculation. Geodesic::Inverse is defined
|
||||||
|
* in terms of this function.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[in] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[in] outmask a bitor'ed combination of Geodesic::mask values
|
||||||
|
* specifying which of the following parameters should be set.
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters).
|
||||||
|
* @param[out] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* The Geodesic::mask values possible for \e outmask are
|
||||||
|
* - \e outmask |= Geodesic::DISTANCE for the distance \e s12;
|
||||||
|
* - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2;
|
||||||
|
* - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e
|
||||||
|
* m12;
|
||||||
|
* - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e
|
||||||
|
* M12 and \e M21;
|
||||||
|
* - \e outmask |= Geodesic::AREA for the area \e S12;
|
||||||
|
* - \e outmask |= Geodesic::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
* The arc length is always computed and returned as the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double GenInverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Interface to GeodesicLine.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up to compute several points on a single geodesic.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] caps bitor'ed combination of NETGeographicLib::Mask values
|
||||||
|
* specifying the capabilities the GeodesicLine object should possess,
|
||||||
|
* i.e., which quantities can be returned in calls to
|
||||||
|
* GeodesicLine::Position.
|
||||||
|
* @return a GeodesicLine object.
|
||||||
|
*
|
||||||
|
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
|
||||||
|
* azi1 should be in the range [−540°, 540°).
|
||||||
|
*
|
||||||
|
* The NETGeographicLib::Mask values are
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2; this is
|
||||||
|
* added automatically;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::AZIMUTH for the azimuth \e azi2; this is
|
||||||
|
* added automatically;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e m12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e M12
|
||||||
|
* and \e M21;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::DISTANCE_IN permits the length of the
|
||||||
|
* geodesic to be given in terms of \e s12; without this capability the
|
||||||
|
* length can only be specified in terms of arc length;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
*
|
||||||
|
* If the point is at a pole, the azimuth is defined by keeping \e lon1
|
||||||
|
* fixed, writing \e lat1 = ±(90 − ε), and taking the
|
||||||
|
* limit ε → 0+.
|
||||||
|
**********************************************************************/
|
||||||
|
GeodesicLine^ Line(double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps );
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \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 total area of ellipsoid in meters<sup>2</sup>. The area of a
|
||||||
|
* polygon encircling a pole can be found by adding
|
||||||
|
* Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the
|
||||||
|
* polygon.
|
||||||
|
**********************************************************************/
|
||||||
|
property double EllipsoidArea { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* %return The unmanaged pointer to the GeographicLib::Geodesic.
|
||||||
|
*
|
||||||
|
* This function is for internal use only.
|
||||||
|
**********************************************************************/
|
||||||
|
System::IntPtr^ GetUnmanaged();
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
} // namespace NETGeographicLib
|
||||||
|
|
@ -0,0 +1,489 @@
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/GeodesicExact.cpp
|
||||||
|
* \brief Implementation for NETGeographicLib::GeodesicExact 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/GeodesicExact.hpp"
|
||||||
|
#include "GeodesicExact.h"
|
||||||
|
#include "GeodesicLineExact.h"
|
||||||
|
|
||||||
|
using namespace NETGeographicLib;
|
||||||
|
|
||||||
|
const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeodesicExact";
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicExact::!GeodesicExact(void)
|
||||||
|
{
|
||||||
|
if ( m_pGeodesicExact != NULL )
|
||||||
|
{
|
||||||
|
delete m_pGeodesicExact;
|
||||||
|
m_pGeodesicExact = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicExact::GeodesicExact()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeodesicExact = new GeographicLib::GeodesicExact( GeographicLib::GeodesicExact::WGS84 );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( BADALLOC );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicExact::GeodesicExact(double a, double f)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeodesicExact = new GeographicLib::GeodesicExact( a, f );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( BADALLOC );
|
||||||
|
}
|
||||||
|
catch ( GeographicLib::GeographicErr err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2, lm12, lM12, lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2)
|
||||||
|
{
|
||||||
|
double llat2, llon2;
|
||||||
|
double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2;
|
||||||
|
double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12;
|
||||||
|
double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2, lm12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lM12, lM21;
|
||||||
|
double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21;
|
||||||
|
double out = m_pGeodesicExact->Direct( lat1, lon1, azi1, s12,
|
||||||
|
llat2, llon2, lazi2, lm12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
|
||||||
|
m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2)
|
||||||
|
{
|
||||||
|
double llat2, llon2;
|
||||||
|
m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2;
|
||||||
|
m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12;
|
||||||
|
m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12;
|
||||||
|
m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12, lm12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lM12, lM21;
|
||||||
|
m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicExact::ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21;
|
||||||
|
m_pGeodesicExact->ArcDirect( lat1, lon1, azi1, a12,
|
||||||
|
llat2, llon2, lazi2, ls12, lm12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::GenDirect(double lat1, double lon1, double azi1,
|
||||||
|
bool arcmode, double s12_a12,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesicExact->GenDirect( lat1, lon1, azi1, arcmode, s12_a12,
|
||||||
|
static_cast<unsigned>(outmask), llat2, llon2, lazi2, ls12, lm12, lM12,
|
||||||
|
lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2, lm12, lM12, lM21, lS12 );
|
||||||
|
s12 = ls12;
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12)
|
||||||
|
{
|
||||||
|
double ls12;
|
||||||
|
double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2, ls12 );
|
||||||
|
s12 = ls12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double lazi1, lazi2;
|
||||||
|
double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2,
|
||||||
|
lazi1, lazi2 );
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2;
|
||||||
|
double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2 );
|
||||||
|
s12 = ls12;
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lm12;
|
||||||
|
double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2, lm12 );
|
||||||
|
s12 = ls12;
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lM12, lM21;
|
||||||
|
double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2, lM12, lM21 );
|
||||||
|
s12 = ls12;
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lm12, lM12, lM21;
|
||||||
|
double out = m_pGeodesicExact->Inverse( lat1, lon1, lat2, lon2,
|
||||||
|
ls12, lazi1, lazi2, lm12, lM12, lM21 );
|
||||||
|
s12 = ls12;
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::GenInverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double ls12, lazi1, lazi2, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesicExact->GenInverse( lat1, lon1, lat2, lon2,
|
||||||
|
static_cast<unsigned>(outmask), ls12, lazi1, lazi2, lm12, lM12,
|
||||||
|
lM21, lS12 );
|
||||||
|
s12 = ls12;
|
||||||
|
azi1 = lazi1;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::IntPtr^ GeodesicExact::GetUnmanaged()
|
||||||
|
{
|
||||||
|
return gcnew System::IntPtr( const_cast<void*>(
|
||||||
|
reinterpret_cast<const void*>(m_pGeodesicExact) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicLineExact^ GeodesicExact::Line(double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps )
|
||||||
|
{
|
||||||
|
return gcnew GeodesicLineExact( this, lat1, lon1, azi1, caps );
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::MajorRadius::get()
|
||||||
|
{ return m_pGeodesicExact->MajorRadius(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::Flattening::get()
|
||||||
|
{ return m_pGeodesicExact->Flattening(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicExact::EllipsoidArea::get()
|
||||||
|
{ return m_pGeodesicExact->EllipsoidArea(); }
|
||||||
|
|
@ -0,0 +1,603 @@
|
||||||
|
#pragma once
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/GeodesicExact.h
|
||||||
|
* \brief Header for NETGeographicLib::GeodesicExact 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 "NETGeographicLib.h"
|
||||||
|
|
||||||
|
namespace NETGeographicLib
|
||||||
|
{
|
||||||
|
ref class GeodesicLineExact;
|
||||||
|
/*!
|
||||||
|
\brief .NET wrapper for GeographicLib::GeodesicExact.
|
||||||
|
|
||||||
|
This class allows .NET applications to access GeographicLib::GeodesicExact.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* \brief .NET wrapper for GeographicLib::GeodesicExact.
|
||||||
|
*
|
||||||
|
* This class allows .NET applications to access GeographicLib::GeodesicExact.
|
||||||
|
*
|
||||||
|
* The equations for geodesics on an ellipsoid can be expressed in terms of
|
||||||
|
* incomplete elliptic integrals. The Geodesic class expands these integrals
|
||||||
|
* in a series in the flattening \e f and this provides an accurate solution
|
||||||
|
* for \e f &isin [-0.01, 0.01]. The GeodesicExact class computes the
|
||||||
|
* ellitpic integrals directly and so provides a solution which is valid for
|
||||||
|
* all \e f. However, in practice, its use should be limited to about \e
|
||||||
|
* b/\e a ∈ [0.01, 100] or \e f ∈ [-99, 0.99].
|
||||||
|
*
|
||||||
|
* For the WGS84 ellipsoid, these classes are 2--3 times \e slower than the
|
||||||
|
* series solution and 2--3 times \e less \e accurate (because it's less easy
|
||||||
|
* to control round-off errors with the elliptic integral formulation); i.e.,
|
||||||
|
* the error is about 40 nm (40 nanometers) instead of 15 nm. However the
|
||||||
|
* error in the series solution scales as <i>f</i><sup>7</sup> while the
|
||||||
|
* error in the elliptic integral solution depends weakly on \e f. If the
|
||||||
|
* quarter meridian distance is 10000 km and the ratio \e b/\e a = 1 −
|
||||||
|
* \e f is varied then the approximate maximum error (expressed as a
|
||||||
|
* distance) is <pre>
|
||||||
|
* 1 - f error (nm)
|
||||||
|
* 1/128 387
|
||||||
|
* 1/64 345
|
||||||
|
* 1/32 269
|
||||||
|
* 1/16 210
|
||||||
|
* 1/8 115
|
||||||
|
* 1/4 69
|
||||||
|
* 1/2 36
|
||||||
|
* 1 15
|
||||||
|
* 2 25
|
||||||
|
* 4 96
|
||||||
|
* 8 318
|
||||||
|
* 16 985
|
||||||
|
* 32 2352
|
||||||
|
* 64 6008
|
||||||
|
* 128 19024
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* The computation of the area in these classes is via a 30th order series.
|
||||||
|
* This gives accurate results for \e b/\e a ∈ [1/2, 2]; the accuracy is
|
||||||
|
* about 8 decimal digits for \e b/\e a ∈ [1/4, 4].
|
||||||
|
*
|
||||||
|
* See \ref geodellip for the formulation. See the documentation on the
|
||||||
|
* Geodesic class for additional information on the geodesics problems.
|
||||||
|
*
|
||||||
|
* C# Example:
|
||||||
|
* \include example-GeodesicExact.cs
|
||||||
|
* Managed C++ Example:
|
||||||
|
* \include example-GeodesicExact.cpp
|
||||||
|
* Visual Basic Example:
|
||||||
|
* \include example-GeodesicExact.vb
|
||||||
|
*
|
||||||
|
* <B>INTERFACE DIFFERENCES:</B><BR>
|
||||||
|
* A default constructor is provided that assumes WGS84 parameters.
|
||||||
|
*
|
||||||
|
* The MajorRadius, Flattening, and EllipsoidArea functions are
|
||||||
|
* implemented as properties.
|
||||||
|
*
|
||||||
|
* The GenDirect, GenInverse, and Line functions accept the
|
||||||
|
* "capabilities mask" as a NETGeographicLib::Mask rather than an
|
||||||
|
* unsigned.
|
||||||
|
**********************************************************************/
|
||||||
|
public ref class GeodesicExact
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// pointer to the unmanaged GeographicLib::GeodesicExact.
|
||||||
|
const GeographicLib::GeodesicExact* m_pGeodesicExact;
|
||||||
|
|
||||||
|
// the finalizer deletes the unmanaged memory.
|
||||||
|
!GeodesicExact();
|
||||||
|
public:
|
||||||
|
/** \name Constructor
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* Constructor for a WGS84 ellipsoid
|
||||||
|
**********************************************************************/
|
||||||
|
GeodesicExact();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 − \e f ) \e a is not
|
||||||
|
* positive.
|
||||||
|
**********************************************************************/
|
||||||
|
GeodesicExact(double a, double f);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The desstructor calls the finalizer.
|
||||||
|
**********************************************************************/
|
||||||
|
~GeodesicExact()
|
||||||
|
{ this->!GeodesicExact(); }
|
||||||
|
|
||||||
|
/** \name Direct geodesic problem specified in terms of distance.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* Perform the direct geodesic calculation where the length of the geodesic
|
||||||
|
* is specified in terms of distance.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] s12 distance between point 1 and point 2 (meters); it can be
|
||||||
|
* signed.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
|
||||||
|
* azi1 should be in the range [−540°, 540°). The values of
|
||||||
|
* \e lon2 and \e azi2 returned are in the range [−180°,
|
||||||
|
* 180°).
|
||||||
|
*
|
||||||
|
* If either point is at a pole, the azimuth is defined by keeping the
|
||||||
|
* longitude fixed, writing \e lat = ±(90° − ε),
|
||||||
|
* and taking the limit ε → 0+. An arc length greater that
|
||||||
|
* 180° signifies a geodesic which is not a shortest path. (For a
|
||||||
|
* prolate ellipsoid, an additional condition is necessary for a shortest
|
||||||
|
* path: the longitudinal extent must not exceed of 180°.)
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of GeodesicExact::Direct
|
||||||
|
* which omit some of the output parameters. Note, however, that the arc
|
||||||
|
* length is always computed and returned as the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Direct.
|
||||||
|
**********************************************************************/
|
||||||
|
double Direct(double lat1, double lon1, double azi1, double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Direct geodesic problem specified in terms of arc length.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* Perform the direct geodesic calculation where the length of the geodesic
|
||||||
|
* is specified in terms of arc length.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] a12 arc length between point 1 and point 2 (degrees); it can
|
||||||
|
* be signed.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
*
|
||||||
|
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
|
||||||
|
* azi1 should be in the range [−540°, 540°). The values of
|
||||||
|
* \e lon2 and \e azi2 returned are in the range [−180°,
|
||||||
|
* 180°).
|
||||||
|
*
|
||||||
|
* If either point is at a pole, the azimuth is defined by keeping the
|
||||||
|
* longitude fixed, writing \e lat = ±(90° − ε),
|
||||||
|
* and taking the limit ε → 0+. An arc length greater that
|
||||||
|
* 180° signifies a geodesic which is not a shortest path. (For a
|
||||||
|
* prolate ellipsoid, an additional condition is necessary for a shortest
|
||||||
|
* path: the longitudinal extent must not exceed of 180°.)
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of GeodesicExact::Direct
|
||||||
|
* which omit some of the output parameters.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::ArcDirect.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcDirect(double lat1, double lon1, double azi1, double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name General version of the direct geodesic solution.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The general direct geodesic calculation. GeodesicExact::Direct and
|
||||||
|
* GeodesicExact::ArcDirect are defined in terms of this function.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] arcmode boolean flag determining the meaning of the second
|
||||||
|
* parameter.
|
||||||
|
* @param[in] s12_a12 if \e arcmode is false, this is the distance between
|
||||||
|
* point 1 and point 2 (meters); otherwise it is the arc length between
|
||||||
|
* point 1 and point 2 (degrees); it can be signed.
|
||||||
|
* @param[in] outmask a bitor'ed combination of NETGeographicLib::Mask values
|
||||||
|
* specifying which of the following parameters should be set.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* The NETGeographicLib::Mask values possible for \e outmask are
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e
|
||||||
|
* m12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e
|
||||||
|
* M12 and \e M21;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AREA for the area \e S12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
* The function value \e a12 is always computed and returned and this
|
||||||
|
* equals \e s12_a12 is \e arcmode is true. If \e outmask includes
|
||||||
|
* GeodesicExact::DISTANCE and \e arcmode is false, then \e s12 = \e
|
||||||
|
* s12_a12. It is not necessary to include NETGeographicLib::Mask::DISTANCE_IN in
|
||||||
|
* \e outmask; this is automatically included is \e arcmode is false.
|
||||||
|
**********************************************************************/
|
||||||
|
double GenDirect(double lat1, double lon1, double azi1,
|
||||||
|
bool arcmode, double s12_a12, NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Inverse geodesic problem.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* Perform the inverse geodesic calculation.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[in] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters).
|
||||||
|
* @param[out] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* \e lat1 and \e lat2 should be in the range [−90°, 90°]; \e
|
||||||
|
* lon1 and \e lon2 should be in the range [−540°, 540°).
|
||||||
|
* The values of \e azi1 and \e azi2 returned are in the range
|
||||||
|
* [−180°, 180°).
|
||||||
|
*
|
||||||
|
* If either point is at a pole, the azimuth is defined by keeping the
|
||||||
|
* longitude fixed, writing \e lat = ±(90° − ε),
|
||||||
|
* and taking the limit ε → 0+.
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of GeodesicExact::Inverse
|
||||||
|
* which omit some of the output parameters. Note, however, that the arc
|
||||||
|
* length is always computed and returned as the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicExact::Inverse.
|
||||||
|
**********************************************************************/
|
||||||
|
double Inverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name General version of inverse geodesic solution.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* The general inverse geodesic calculation. GeodesicExact::Inverse is
|
||||||
|
* defined in terms of this function.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[in] lon2 longitude of point 2 (degrees).
|
||||||
|
* @param[in] outmask a bitor'ed combination of NETGeographicLib::Mask values
|
||||||
|
* specifying which of the following parameters should be set.
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters).
|
||||||
|
* @param[out] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters).
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless).
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>).
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* The NETGeographicLib::Mask values possible for \e outmask are
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e
|
||||||
|
* m12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e
|
||||||
|
* M12 and \e M21;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AREA for the area \e S12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
* The arc length is always computed and returned as the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double GenInverse(double lat1, double lon1, double lat2, double lon2,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi1,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Interface to GeodesicLineExact.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up to compute several points on a single geodesic.
|
||||||
|
*
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] caps bitor'ed combination of NETGeographicLib::Mask values
|
||||||
|
* specifying the capabilities the GeodesicLineExact object should
|
||||||
|
* possess, i.e., which quantities can be returned in calls to
|
||||||
|
* GeodesicLineExact::Position.
|
||||||
|
* @return a GeodesicLineExact object.
|
||||||
|
*
|
||||||
|
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
|
||||||
|
* azi1 should be in the range [−540°, 540°).
|
||||||
|
*
|
||||||
|
* The GeodesicExact::mask values are
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2; this is
|
||||||
|
* added automatically;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::AZIMUTH for the azimuth \e azi2; this is
|
||||||
|
* added automatically;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e m12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e M12
|
||||||
|
* and \e M21;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::DISTANCE_IN permits the length of the
|
||||||
|
* geodesic to be given in terms of \e s12; without this capability the
|
||||||
|
* length can only be specified in terms of arc length;
|
||||||
|
* - \e caps |= GeodesicExact::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
* The default value of \e caps is GeodesicExact::ALL which turns on all
|
||||||
|
* the capabilities.
|
||||||
|
*
|
||||||
|
* If the point is at a pole, the azimuth is defined by keeping \e lon1
|
||||||
|
* fixed, writing \e lat1 = ±(90 − ε), and taking the
|
||||||
|
* limit ε → 0+.
|
||||||
|
**********************************************************************/
|
||||||
|
GeodesicLineExact^ Line(double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps );
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \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 total area of ellipsoid in meters<sup>2</sup>. The area of a
|
||||||
|
* polygon encircling a pole can be found by adding
|
||||||
|
* GeodesicExact::EllipsoidArea()/2 to the sum of \e S12 for each side of
|
||||||
|
* the polygon.
|
||||||
|
**********************************************************************/
|
||||||
|
property double EllipsoidArea { double get(); }
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return A pointer to the unmanaged GeographicLib::GeodesicExact.
|
||||||
|
*
|
||||||
|
* This function is for internal use only.
|
||||||
|
**********************************************************************/
|
||||||
|
System::IntPtr^ GetUnmanaged();
|
||||||
|
};
|
||||||
|
} // namespace NETGeographicLib
|
||||||
|
|
@ -0,0 +1,350 @@
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/GeodesicLine.cpp
|
||||||
|
* \brief Implementation for NETGeographicLib::GeodesicLine 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/GeodesicLine.hpp"
|
||||||
|
#include "Geodesic.h"
|
||||||
|
#include "GeodesicLine.h"
|
||||||
|
|
||||||
|
using namespace NETGeographicLib;
|
||||||
|
|
||||||
|
const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeodesicLine";
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicLine::!GeodesicLine(void)
|
||||||
|
{
|
||||||
|
if ( m_pGeodesicLine != NULL )
|
||||||
|
{
|
||||||
|
delete m_pGeodesicLine;
|
||||||
|
m_pGeodesicLine = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicLine::GeodesicLine( Geodesic^ g, double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const GeographicLib::Geodesic* pGeodesic =
|
||||||
|
reinterpret_cast<const GeographicLib::Geodesic*>(
|
||||||
|
g->GetUnmanaged()->ToPointer() );
|
||||||
|
m_pGeodesicLine = new GeographicLib::GeodesicLine( *pGeodesic,
|
||||||
|
lat1, lon1, azi1, static_cast<unsigned>(caps) );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( BADALLOC );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicLine::GeodesicLine(double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeodesicLine = new GeographicLib::GeodesicLine(
|
||||||
|
GeographicLib::Geodesic::WGS84, lat1, lon1, azi1,
|
||||||
|
static_cast<unsigned>(caps) );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( BADALLOC );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2, lm12,
|
||||||
|
lM12, lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2)
|
||||||
|
{
|
||||||
|
double llat2, llon2;
|
||||||
|
double out = m_pGeodesicLine->Position( s12, llat2, llon2);
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2;
|
||||||
|
double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12;
|
||||||
|
double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2,
|
||||||
|
lm12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lM12, lM21;
|
||||||
|
double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2,
|
||||||
|
lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21;
|
||||||
|
double out = m_pGeodesicLine->Position( s12, llat2, llon2, lazi2, lm12,
|
||||||
|
lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLine::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
|
||||||
|
m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2,
|
||||||
|
ls12, lm12, lM12, lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLine::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2)
|
||||||
|
{
|
||||||
|
double llat2, llon2;
|
||||||
|
m_pGeodesicLine->ArcPosition( a12, llat2, llon2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLine::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2;
|
||||||
|
m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLine::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12;
|
||||||
|
m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2, ls12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLine::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12;
|
||||||
|
m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2, ls12, lm12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLine::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lM12, lM21;
|
||||||
|
m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2,
|
||||||
|
ls12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLine::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21;
|
||||||
|
m_pGeodesicLine->ArcPosition( a12, llat2, llon2, lazi2,
|
||||||
|
ls12, lm12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::GenPosition(bool arcmode, double s12_a12,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesicLine->GenPosition( arcmode, s12_a12,
|
||||||
|
static_cast<unsigned>(outmask),
|
||||||
|
llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Latitude::get() { return m_pGeodesicLine->Latitude(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Longitude::get() { return m_pGeodesicLine->Longitude(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Azimuth::get() { return m_pGeodesicLine->Azimuth(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::EquatorialAzimuth::get()
|
||||||
|
{ return m_pGeodesicLine->EquatorialAzimuth(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::EquatorialArc::get()
|
||||||
|
{ return m_pGeodesicLine->EquatorialArc(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::MajorRadius::get()
|
||||||
|
{ return m_pGeodesicLine->MajorRadius(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLine::Flattening::get()
|
||||||
|
{ return m_pGeodesicLine->Flattening(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
NETGeographicLib::Mask GeodesicLine::Capabilities()
|
||||||
|
{ return static_cast<NETGeographicLib::Mask>(m_pGeodesicLine->Capabilities()); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
bool GeodesicLine::Capabilities(NETGeographicLib::Mask testcaps)
|
||||||
|
{ return m_pGeodesicLine->Capabilities( static_cast<unsigned>(testcaps) ); }
|
||||||
|
|
@ -0,0 +1,471 @@
|
||||||
|
#pragma once
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/GeodesicLine.h
|
||||||
|
* \brief Header for NETGeographicLib::GeodesicLine 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 "NETGeographicLib.h"
|
||||||
|
|
||||||
|
namespace NETGeographicLib
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* \brief .NET wrapper for GeographicLib::GeodesicLine.
|
||||||
|
*
|
||||||
|
* This class allows .NET applications to access GeographicLib::GeodesicLine.
|
||||||
|
*
|
||||||
|
* GeodesicLine facilitates the determination of a series of points on a
|
||||||
|
* single geodesic. The starting point (\e lat1, \e lon1) and the azimuth \e
|
||||||
|
* azi1 are specified in the constructor. GeodesicLine.Position returns the
|
||||||
|
* location of point 2 a distance \e s12 along the geodesic. Alternatively
|
||||||
|
* GeodesicLine.ArcPosition gives the position of point 2 an arc length \e
|
||||||
|
* a12 along the geodesic.
|
||||||
|
*
|
||||||
|
* The default copy constructor and assignment operators work with this
|
||||||
|
* class. Similarly, a vector can be used to hold GeodesicLine objects.
|
||||||
|
*
|
||||||
|
* The calculations are accurate to better than 15 nm (15 nanometers). See
|
||||||
|
* Sec. 9 of
|
||||||
|
* <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
|
||||||
|
* details. The algorithms used by this class are based on series expansions
|
||||||
|
* using the flattening \e f as a small parameter. These are only accurate
|
||||||
|
* for |<i>f</i>| < 0.02; however reasonably accurate results will be
|
||||||
|
* obtained for |<i>f</i>| < 0.2. For very eccentric ellipsoids, use
|
||||||
|
* GeodesicLineExact instead.
|
||||||
|
*
|
||||||
|
* The algorithms are described 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);
|
||||||
|
* DOI: <a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
|
||||||
|
* 10.1007/s00190-012-0578-z</a>;
|
||||||
|
* addenda: <a href="http://geographiclib.sf.net/geod-addenda.html">
|
||||||
|
* geod-addenda.html</a>.
|
||||||
|
* .
|
||||||
|
* For more information on geodesics see \ref geodesic.
|
||||||
|
*
|
||||||
|
* C# Example:
|
||||||
|
* \include example-GeodesicLine.cs
|
||||||
|
* Managed C++ Example:
|
||||||
|
* \include example-GeodesicLine.cpp
|
||||||
|
* Visual Basic Example:
|
||||||
|
* \include example-GeodesicLine.vb
|
||||||
|
*
|
||||||
|
* <B>INTERFACE DIFFERENCES:</B><BR>
|
||||||
|
* A constructor has been provided which assumes WGS84 parameters.
|
||||||
|
*
|
||||||
|
* The following functions are implemented as properties:
|
||||||
|
* Latitude, Longitude, Azimuth, EquatorialAzimuth, EquatorialArc,
|
||||||
|
* MajorRadius, and Flattening.
|
||||||
|
*
|
||||||
|
* The constructors, Capabilities, and GenPosition functions accept the
|
||||||
|
* "capabilities mask" as a NETGeographicLib::Mask rather than an
|
||||||
|
* unsigned. The Capabilities function returns a NETGeographicLib::Mask
|
||||||
|
* rather than an unsigned.
|
||||||
|
**********************************************************************/
|
||||||
|
public ref class GeodesicLine
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// pointer to the unmanaged GeographicLib::GeodesicLine.
|
||||||
|
const GeographicLib::GeodesicLine* m_pGeodesicLine;
|
||||||
|
|
||||||
|
// The finalizer frees the unmanaged memory when this object is destroyed.
|
||||||
|
!GeodesicLine(void);
|
||||||
|
public:
|
||||||
|
/** \name Constructors
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for a geodesic line staring at latitude \e lat1, longitude
|
||||||
|
* \e lon1, and azimuth \e azi1 (all in degrees).
|
||||||
|
*
|
||||||
|
* @param[in] g A Geodesic object used to compute the necessary information
|
||||||
|
* about the GeodesicLine.
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] caps bitor'ed combination of NETGeographicLib::Mask values
|
||||||
|
* specifying the capabilities the GeodesicLine object should possess,
|
||||||
|
* i.e., which quantities can be returned in calls to
|
||||||
|
* GeodesicLine::Position.
|
||||||
|
*
|
||||||
|
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
|
||||||
|
* azi1 should be in the range [−540°, 540°).
|
||||||
|
*
|
||||||
|
* The NETGeographicLib::Mask values are
|
||||||
|
* - \e caps |= GeodesicLine::LATITUDE for the latitude \e lat2; this is
|
||||||
|
* added automatically;
|
||||||
|
* - \e caps |= GeodesicLine::LONGITUDE for the latitude \e lon2;
|
||||||
|
* - \e caps |= GeodesicLine::AZIMUTH for the latitude \e azi2; this is
|
||||||
|
* added automatically;
|
||||||
|
* - \e caps |= GeodesicLine::DISTANCE for the distance \e s12;
|
||||||
|
* - \e caps |= GeodesicLine::REDUCEDLENGTH for the reduced length \e m12;
|
||||||
|
* - \e caps |= GeodesicLine::GEODESICSCALE for the geodesic scales \e M12
|
||||||
|
* and \e M21;
|
||||||
|
* - \e caps |= GeodesicLine::AREA for the area \e S12;
|
||||||
|
* - \e caps |= GeodesicLine::DISTANCE_IN permits the length of the
|
||||||
|
* geodesic to be given in terms of \e s12; without this capability the
|
||||||
|
* length can only be specified in terms of arc length;
|
||||||
|
* - \e caps |= GeodesicLine::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
* The default value of \e caps is GeodesicLine::ALL.
|
||||||
|
*
|
||||||
|
* If the point is at a pole, the azimuth is defined by keeping \e lon1
|
||||||
|
* fixed, writing \e lat1 = ±(90° − ε), and taking
|
||||||
|
* the limit ε → 0+.
|
||||||
|
**********************************************************************/
|
||||||
|
GeodesicLine( Geodesic^ g, double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A constructor which assumes the WGS84 ellipsoid.
|
||||||
|
**********************************************************************/
|
||||||
|
GeodesicLine(double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The destructor calls the finalizer.
|
||||||
|
**********************************************************************/
|
||||||
|
~GeodesicLine()
|
||||||
|
{ this->!GeodesicLine(); }
|
||||||
|
|
||||||
|
/** \name Position in terms of distance
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the position of point 2 which is a distance \e s12 (meters) from
|
||||||
|
* point 1.
|
||||||
|
*
|
||||||
|
* @param[in] s12 distance between point 1 and point 2 (meters); it can be
|
||||||
|
* negative.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
||||||
|
* GeodesicLine object was constructed with \e caps |=
|
||||||
|
* GeodesicLine::LONGITUDE.
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
||||||
|
* GeodesicLine object was constructed with \e caps |=
|
||||||
|
* GeodesicLine::REDUCEDLENGTH.
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless); requires that the GeodesicLine object was constructed
|
||||||
|
* with \e caps |= GeodesicLine::GEODESICSCALE.
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless); requires that the GeodesicLine object was constructed
|
||||||
|
* with \e caps |= GeodesicLine::GEODESICSCALE.
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
||||||
|
* that the GeodesicLine object was constructed with \e caps |=
|
||||||
|
* GeodesicLine::AREA.
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* The values of \e lon2 and \e azi2 returned are in the range
|
||||||
|
* [−180°, 180°).
|
||||||
|
*
|
||||||
|
* The GeodesicLine object \e must have been constructed with \e caps |=
|
||||||
|
* GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no
|
||||||
|
* parameters are set. Requesting a value which the GeodesicLine object is
|
||||||
|
* not capable of computing is not an error; the corresponding argument
|
||||||
|
* will not be altered.
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of
|
||||||
|
* GeodesicLine::Position which omit some of the output parameters. Note,
|
||||||
|
* however, that the arc length is always computed and returned as the
|
||||||
|
* function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Position in terms of arc length
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the position of point 2 which is an arc length \e a12 (degrees)
|
||||||
|
* from point 1.
|
||||||
|
*
|
||||||
|
* @param[in] a12 arc length between point 1 and point 2 (degrees); it can
|
||||||
|
* be negative.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
||||||
|
* GeodesicLine object was constructed with \e caps |=
|
||||||
|
* NETGeographicLib::Mask::LONGITUDE.
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters); requires
|
||||||
|
* that the GeodesicLine object was constructed with \e caps |=
|
||||||
|
* NETGeographicLib::Mask::DISTANCE.
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
||||||
|
* GeodesicLine object was constructed with \e caps |=
|
||||||
|
* NETGeographicLib::Mask::REDUCEDLENGTH.
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless); requires that the GeodesicLine object was constructed
|
||||||
|
* with \e caps |= NETGeographicLib::Mask::GEODESICSCALE.
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless); requires that the GeodesicLine object was constructed
|
||||||
|
* with \e caps |= NETGeographicLib::Mask::GEODESICSCALE.
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
||||||
|
* that the GeodesicLine object was constructed with \e caps |=
|
||||||
|
* NETGeographicLib::Mask::AREA.
|
||||||
|
*
|
||||||
|
* The values of \e lon2 and \e azi2 returned are in the range
|
||||||
|
* [−180°, 180°).
|
||||||
|
*
|
||||||
|
* Requesting a value which the GeodesicLine object is not capable of
|
||||||
|
* computing is not an error; the corresponding argument will not be
|
||||||
|
* altered.
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of
|
||||||
|
* GeodesicLine::ArcPosition which omit some of the output parameters.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLine::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name The general position function.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The general position function. GeodesicLine::Position and
|
||||||
|
* GeodesicLine::ArcPosition are defined in terms of this function.
|
||||||
|
*
|
||||||
|
* @param[in] arcmode boolean flag determining the meaning of the second
|
||||||
|
* parameter; if arcmode is false, then the GeodesicLine object must have
|
||||||
|
* been constructed with \e caps |= GeodesicLine::DISTANCE_IN.
|
||||||
|
* @param[in] s12_a12 if \e arcmode is false, this is the distance between
|
||||||
|
* point 1 and point 2 (meters); otherwise it is the arc length between
|
||||||
|
* point 1 and point 2 (degrees); it can be negative.
|
||||||
|
* @param[in] outmask a bitor'ed combination of NETGeographicLib::Mask values
|
||||||
|
* specifying which of the following parameters should be set.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
||||||
|
* GeodesicLine object was constructed with \e caps |=
|
||||||
|
* NETGeographicLib::Mask::LONGITUDE.
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters); requires
|
||||||
|
* that the GeodesicLine object was constructed with \e caps |=
|
||||||
|
* NETGeographicLib::Mask::DISTANCE.
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
||||||
|
* GeodesicLine object was constructed with \e caps |=
|
||||||
|
* NETGeographicLib::Mask::REDUCEDLENGTH.
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless); requires that the GeodesicLine object was constructed
|
||||||
|
* with \e caps |= NETGeographicLib::Mask::GEODESICSCALE.
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless); requires that the GeodesicLine object was constructed
|
||||||
|
* with \e caps |= NETGeographicLib::Mask::GEODESICSCALE.
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
||||||
|
* that the GeodesicLine object was constructed with \e caps |=
|
||||||
|
* NETGeographicLib::Mask::AREA.
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* The GeodesicLine::mask values possible for \e outmask are
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e
|
||||||
|
* m12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e
|
||||||
|
* M12 and \e M21;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AREA for the area \e S12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
* Requesting a value which the GeodesicLine object is not capable of
|
||||||
|
* computing is not an error; the corresponding argument will not be
|
||||||
|
* altered. Note, however, that the arc length is always computed and
|
||||||
|
* returned as the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double GenPosition(bool arcmode, double s12_a12,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Inspector functions
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e lat1 the latitude of point 1 (degrees).
|
||||||
|
**********************************************************************/
|
||||||
|
property double Latitude { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e lon1 the longitude of point 1 (degrees).
|
||||||
|
**********************************************************************/
|
||||||
|
property double Longitude { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e azi1 the azimuth (degrees) of the geodesic line at point 1.
|
||||||
|
**********************************************************************/
|
||||||
|
property double Azimuth { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses
|
||||||
|
* the equator in a northward direction.
|
||||||
|
**********************************************************************/
|
||||||
|
property double EquatorialAzimuth { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e a1 the arc length (degrees) between the northward equatorial
|
||||||
|
* crossing and point 1.
|
||||||
|
**********************************************************************/
|
||||||
|
property double EquatorialArc { 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(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e caps the computational capabilities that this object was
|
||||||
|
* constructed with. LATITUDE and AZIMUTH are always included.
|
||||||
|
**********************************************************************/
|
||||||
|
NETGeographicLib::Mask Capabilities();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] testcaps a set of bitor'ed GeodesicLine::mask values.
|
||||||
|
* @return true if the GeodesicLine object has all these capabilities.
|
||||||
|
**********************************************************************/
|
||||||
|
bool Capabilities(NETGeographicLib::Mask testcaps);
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
} // namespace NETGeographicLib
|
||||||
|
|
@ -0,0 +1,354 @@
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/GeodesicLineExact.cpp
|
||||||
|
* \brief Implementation for NETGeographicLib::GeodesicLineExact 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/GeodesicLineExact.hpp"
|
||||||
|
#include "GeodesicLineExact.h"
|
||||||
|
#include "GeodesicExact.h"
|
||||||
|
|
||||||
|
using namespace NETGeographicLib;
|
||||||
|
|
||||||
|
const char BADALLOC[] = "Failed to allocate memory for a GeographicLib::GeodesicLineExact";
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicLineExact::!GeodesicLineExact(void)
|
||||||
|
{
|
||||||
|
if ( m_pGeodesicLineExact != NULL )
|
||||||
|
{
|
||||||
|
delete m_pGeodesicLineExact;
|
||||||
|
m_pGeodesicLineExact = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicLineExact::GeodesicLineExact(GeodesicExact^ g, double lat1,
|
||||||
|
double lon1, double azi1, NETGeographicLib::Mask caps )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
const GeographicLib::GeodesicExact* pGeodesicExact=
|
||||||
|
reinterpret_cast<const GeographicLib::GeodesicExact*>(
|
||||||
|
g->GetUnmanaged()->ToPointer() );
|
||||||
|
m_pGeodesicLineExact = new GeographicLib::GeodesicLineExact(
|
||||||
|
*pGeodesicExact, lat1, lon1, azi1, static_cast<unsigned>(caps) );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( BADALLOC );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
GeodesicLineExact::GeodesicLineExact(double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeodesicLineExact = new GeographicLib::GeodesicLineExact(
|
||||||
|
GeographicLib::GeodesicExact::WGS84, lat1, lon1, azi1,
|
||||||
|
static_cast<unsigned>(caps) );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( BADALLOC );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2,
|
||||||
|
lm12, lM12, lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2)
|
||||||
|
{
|
||||||
|
double llat2, llon2;
|
||||||
|
double out = m_pGeodesicLineExact->Position( s12, llat2, llon2);
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2;
|
||||||
|
double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2);
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12;
|
||||||
|
double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2,
|
||||||
|
lm12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lM12, lM21;
|
||||||
|
double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2,
|
||||||
|
lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, lm12, lM12, lM21;
|
||||||
|
double out = m_pGeodesicLineExact->Position( s12, llat2, llon2, lazi2,
|
||||||
|
lm12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLineExact::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
|
||||||
|
m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12,
|
||||||
|
lm12, lM12, lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLineExact::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2)
|
||||||
|
{
|
||||||
|
double llat2, llon2;
|
||||||
|
m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLineExact::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2;
|
||||||
|
m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLineExact::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12;
|
||||||
|
m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLineExact::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12;
|
||||||
|
m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12,
|
||||||
|
lm12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLineExact::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lM12, lM21;
|
||||||
|
m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12,
|
||||||
|
lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void GeodesicLineExact::ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21;
|
||||||
|
m_pGeodesicLineExact->ArcPosition( a12, llat2, llon2, lazi2, ls12,
|
||||||
|
lm12, lM12, lM21 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::GenPosition(bool arcmode, double s12_a12,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12)
|
||||||
|
{
|
||||||
|
double llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12;
|
||||||
|
double out = m_pGeodesicLineExact->GenPosition( arcmode, s12_a12,
|
||||||
|
static_cast<unsigned>(outmask),
|
||||||
|
llat2, llon2, lazi2, ls12, lm12, lM12, lM21, lS12 );
|
||||||
|
lat2 = llat2;
|
||||||
|
lon2 = llon2;
|
||||||
|
azi2 = lazi2;
|
||||||
|
s12 = ls12;
|
||||||
|
m12 = lm12;
|
||||||
|
M12 = lM12;
|
||||||
|
M21 = lM21;
|
||||||
|
S12 = lS12;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Latitude::get()
|
||||||
|
{ return m_pGeodesicLineExact->Latitude(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Longitude::get()
|
||||||
|
{ return m_pGeodesicLineExact->Longitude(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Azimuth::get()
|
||||||
|
{ return m_pGeodesicLineExact->Azimuth(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::EquatorialAzimuth::get()
|
||||||
|
{ return m_pGeodesicLineExact->EquatorialAzimuth(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::EquatorialArc::get()
|
||||||
|
{ return m_pGeodesicLineExact->EquatorialArc(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::MajorRadius::get()
|
||||||
|
{ return m_pGeodesicLineExact->MajorRadius(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double GeodesicLineExact::Flattening::get()
|
||||||
|
{ return m_pGeodesicLineExact->Flattening(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
NETGeographicLib::Mask GeodesicLineExact::Capabilities()
|
||||||
|
{ return static_cast<NETGeographicLib::Mask>(m_pGeodesicLineExact->Capabilities()); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
bool GeodesicLineExact::Capabilities(NETGeographicLib::Mask testcaps)
|
||||||
|
{ return m_pGeodesicLineExact->Capabilities(static_cast<unsigned>(testcaps)); }
|
||||||
|
|
@ -0,0 +1,448 @@
|
||||||
|
#pragma once
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/GeodesicLineExact.h
|
||||||
|
* \brief Header for NETGeographicLib::GeodesicLineExact 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 "NETGeographicLib.h"
|
||||||
|
|
||||||
|
namespace NETGeographicLib
|
||||||
|
{
|
||||||
|
ref class GeodesicExact;
|
||||||
|
/**
|
||||||
|
* \brief .NET wrapper for GeographicLib::GeodesicLineExact.
|
||||||
|
*
|
||||||
|
* This class allows .NET applications to access GeographicLib::GeodesicLineExact.
|
||||||
|
*
|
||||||
|
* GeodesicLineExact facilitates the determination of a series of points on a
|
||||||
|
* single geodesic. This is a companion to the GeodesicExact class. For
|
||||||
|
* additional information on this class see the documentation on the
|
||||||
|
* GeodesicLine class.
|
||||||
|
*
|
||||||
|
* C# Example:
|
||||||
|
* \include example-GeodesicLineExact.cs
|
||||||
|
* Managed C++ Example:
|
||||||
|
* \include example-GeodesicLineExact.cpp
|
||||||
|
* Visual Basic Example:
|
||||||
|
* \include example-GeodesicLineExact.vb
|
||||||
|
*
|
||||||
|
* <B>INTERFACE DIFFERENCES:</B><BR>
|
||||||
|
* A constructor has been provided that assumes WGS84 parameters.
|
||||||
|
*
|
||||||
|
* The following functions are implemented as properties:
|
||||||
|
* Latitude, Longitude, Azimuth, EquatorialAzimuth, EquatorialArc,
|
||||||
|
* MajorRadius, and Flattening.
|
||||||
|
*
|
||||||
|
* The constructors, GenPosition, and Capabilities functions accept the
|
||||||
|
* "capabilities mask" as a NETGeographicLib::Mask rather than an
|
||||||
|
* unsigned. The Capabilities function returns a NETGeographicLib::Mask
|
||||||
|
* rather than an unsigned.
|
||||||
|
**********************************************************************/
|
||||||
|
public ref class GeodesicLineExact
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// a pointer to the GeographicLib::GeodesicLineExact.
|
||||||
|
const GeographicLib::GeodesicLineExact* m_pGeodesicLineExact;
|
||||||
|
|
||||||
|
// the finalizer frees the unmanaged memory when the object is destroyed.
|
||||||
|
!GeodesicLineExact(void);
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** \name Constructors
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for a geodesic line staring at latitude \e lat1, longitude
|
||||||
|
* \e lon1, and azimuth \e azi1 (all in degrees).
|
||||||
|
*
|
||||||
|
* @param[in] g A GeodesicExact object used to compute the necessary
|
||||||
|
* information about the GeodesicLineExact.
|
||||||
|
* @param[in] lat1 latitude of point 1 (degrees).
|
||||||
|
* @param[in] lon1 longitude of point 1 (degrees).
|
||||||
|
* @param[in] azi1 azimuth at point 1 (degrees).
|
||||||
|
* @param[in] caps bitor'ed combination of NETGeographicLib::Mask values
|
||||||
|
* specifying the capabilities the GeodesicLineExact object should
|
||||||
|
* possess, i.e., which quantities can be returned in calls to
|
||||||
|
* GeodesicLine::Position.
|
||||||
|
*
|
||||||
|
* \e lat1 should be in the range [−90°, 90°]; \e lon1 and \e
|
||||||
|
* azi1 should be in the range [−540°, 540°).
|
||||||
|
*
|
||||||
|
* The NETGeographicLib::Mask values are
|
||||||
|
* - \e caps |= GeodesicLineExact::LATITUDE for the latitude \e lat2; this
|
||||||
|
* is added automatically;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2; this is
|
||||||
|
* added automatically;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length \e
|
||||||
|
m12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales \e
|
||||||
|
* M12 and \e M21;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::AREA for the area \e S12;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::DISTANCE_IN permits the length of the
|
||||||
|
* geodesic to be given in terms of \e s12; without this capability the
|
||||||
|
* length can only be specified in terms of arc length;
|
||||||
|
* - \e caps |= NETGeographicLib::Mask::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
*
|
||||||
|
* If the point is at a pole, the azimuth is defined by keeping \e lon1
|
||||||
|
* fixed, writing \e lat1 = ±(90° − ε), and taking
|
||||||
|
* the limit ε → 0+.
|
||||||
|
**********************************************************************/
|
||||||
|
GeodesicLineExact(GeodesicExact^ g, double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A default constructor which assumes the WGS84 ellipsoid. See
|
||||||
|
* constructor comments for details.
|
||||||
|
**********************************************************************/
|
||||||
|
GeodesicLineExact(double lat1, double lon1, double azi1,
|
||||||
|
NETGeographicLib::Mask caps);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The destructor calls the finalizer
|
||||||
|
**********************************************************************/
|
||||||
|
~GeodesicLineExact()
|
||||||
|
{ this->!GeodesicLineExact(); }
|
||||||
|
|
||||||
|
/** \name Position in terms of distance
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the position of point 2 which is a distance \e s12 (meters)
|
||||||
|
* from point 1.
|
||||||
|
*
|
||||||
|
* @param[in] s12 distance between point 1 and point 2 (meters); it can be
|
||||||
|
* signed.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
||||||
|
* GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::LONGITUDE.
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
||||||
|
* GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::REDUCEDLENGTH.
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless); requires that the GeodesicLineExact object was
|
||||||
|
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless); requires that the GeodesicLineExact object was
|
||||||
|
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
||||||
|
* that the GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::AREA.
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* The values of \e lon2 and \e azi2 returned are in the range
|
||||||
|
* [−180°, 180°).
|
||||||
|
*
|
||||||
|
* The GeodesicLineExact object \e must have been constructed with \e caps
|
||||||
|
* |= GeodesicLineExact::DISTANCE_IN; otherwise Math::NaN() is returned and
|
||||||
|
* no parameters are set. Requesting a value which the GeodesicLineExact
|
||||||
|
* object is not capable of computing is not an error; the corresponding
|
||||||
|
* argument will not be altered.
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of
|
||||||
|
* GeodesicLineExact::Position which omit some of the output parameters.
|
||||||
|
* Note, however, that the arc length is always computed and returned as
|
||||||
|
* the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::Position.
|
||||||
|
**********************************************************************/
|
||||||
|
double Position(double s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Position in terms of arc length
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the position of point 2 which is an arc length \e a12 (degrees)
|
||||||
|
* from point 1.
|
||||||
|
*
|
||||||
|
* @param[in] a12 arc length between point 1 and point 2 (degrees); it can
|
||||||
|
* be signed.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
||||||
|
* GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::LONGITUDE.
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters); requires
|
||||||
|
* that the GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::DISTANCE.
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
||||||
|
* GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::REDUCEDLENGTH.
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless); requires that the GeodesicLineExact object was
|
||||||
|
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless); requires that the GeodesicLineExact object was
|
||||||
|
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
||||||
|
* that the GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::AREA.
|
||||||
|
*
|
||||||
|
* The values of \e lon2 and \e azi2 returned are in the range
|
||||||
|
* [−180°, 180°).
|
||||||
|
*
|
||||||
|
* Requesting a value which the GeodesicLineExact object is not capable of
|
||||||
|
* computing is not an error; the corresponding argument will not be
|
||||||
|
* altered.
|
||||||
|
*
|
||||||
|
* The following functions are overloaded versions of
|
||||||
|
* GeodesicLineExact::ArcPosition which omit some of the output parameters.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See the documentation for GeodesicLineExact::ArcPosition.
|
||||||
|
**********************************************************************/
|
||||||
|
void ArcPosition(double a12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21);
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name The general position function.
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The general position function. GeodesicLineExact::Position and
|
||||||
|
* GeodesicLineExact::ArcPosition are defined in terms of this function.
|
||||||
|
*
|
||||||
|
* @param[in] arcmode boolean flag determining the meaning of the second
|
||||||
|
* parameter; if arcmode is false, then the GeodesicLineExact object must
|
||||||
|
* have been constructed with \e caps |= GeodesicLineExact::DISTANCE_IN.
|
||||||
|
* @param[in] s12_a12 if \e arcmode is false, this is the distance between
|
||||||
|
* point 1 and point 2 (meters); otherwise it is the arc length between
|
||||||
|
* point 1 and point 2 (degrees); it can be signed.
|
||||||
|
* @param[in] outmask a bitor'ed combination of NETGeographicLib::Mask
|
||||||
|
* values specifying which of the following parameters should be set.
|
||||||
|
* @param[out] lat2 latitude of point 2 (degrees).
|
||||||
|
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
||||||
|
* GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::LONGITUDE.
|
||||||
|
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
||||||
|
* @param[out] s12 distance between point 1 and point 2 (meters); requires
|
||||||
|
* that the GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::DISTANCE.
|
||||||
|
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
||||||
|
* GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::REDUCEDLENGTH.
|
||||||
|
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
||||||
|
* (dimensionless); requires that the GeodesicLineExact object was
|
||||||
|
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
||||||
|
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
||||||
|
* (dimensionless); requires that the GeodesicLineExact object was
|
||||||
|
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
||||||
|
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
||||||
|
* that the GeodesicLineExact object was constructed with \e caps |=
|
||||||
|
* GeodesicLineExact::AREA.
|
||||||
|
* @return \e a12 arc length of between point 1 and point 2 (degrees).
|
||||||
|
*
|
||||||
|
* The NETGeographicLib::Mask values possible for \e outmask are
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::LATITUDE for the latitude \e lat2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::LONGITUDE for the latitude \e lon2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AZIMUTH for the latitude \e azi2;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::DISTANCE for the distance \e s12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::REDUCEDLENGTH for the reduced length
|
||||||
|
* \e m12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::GEODESICSCALE for the geodesic scales
|
||||||
|
* \e M12 and \e M21;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::AREA for the area \e S12;
|
||||||
|
* - \e outmask |= NETGeographicLib::Mask::ALL for all of the above.
|
||||||
|
* .
|
||||||
|
* Requesting a value which the GeodesicLineExact object is not capable of
|
||||||
|
* computing is not an error; the corresponding argument will not be
|
||||||
|
* altered. Note, however, that the arc length is always computed and
|
||||||
|
* returned as the function value.
|
||||||
|
**********************************************************************/
|
||||||
|
double GenPosition(bool arcmode, double s12_a12,
|
||||||
|
NETGeographicLib::Mask outmask,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% azi2,
|
||||||
|
[System::Runtime::InteropServices::Out] double% s12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% m12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M12,
|
||||||
|
[System::Runtime::InteropServices::Out] double% M21,
|
||||||
|
[System::Runtime::InteropServices::Out] double% S12);
|
||||||
|
|
||||||
|
///@}
|
||||||
|
|
||||||
|
/** \name Inspector functions
|
||||||
|
**********************************************************************/
|
||||||
|
///@{
|
||||||
|
/**
|
||||||
|
* @return \e lat1 the latitude of point 1 (degrees).
|
||||||
|
**********************************************************************/
|
||||||
|
property double Latitude { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e lon1 the longitude of point 1 (degrees).
|
||||||
|
**********************************************************************/
|
||||||
|
property double Longitude { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e azi1 the azimuth (degrees) of the geodesic line at point 1.
|
||||||
|
**********************************************************************/
|
||||||
|
property double Azimuth { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses
|
||||||
|
* the equator in a northward direction.
|
||||||
|
**********************************************************************/
|
||||||
|
property double EquatorialAzimuth { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e a1 the arc length (degrees) between the northward equatorial
|
||||||
|
* crossing and point 1.
|
||||||
|
**********************************************************************/
|
||||||
|
property double EquatorialArc { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e a the equatorial radius of the ellipsoid (meters). This is
|
||||||
|
* the value inherited from the GeodesicExact 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 GeodesicExact object used in the constructor.
|
||||||
|
**********************************************************************/
|
||||||
|
property double Flattening { double get(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \e caps the computational capabilities that this object was
|
||||||
|
* constructed with. LATITUDE and AZIMUTH are always included.
|
||||||
|
**********************************************************************/
|
||||||
|
NETGeographicLib::Mask Capabilities();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param[in] testcaps a set of bitor'ed GeodesicLineExact::mask values.
|
||||||
|
* @return true if the GeodesicLineExact object has all these capabilities.
|
||||||
|
**********************************************************************/
|
||||||
|
bool Capabilities(NETGeographicLib::Mask testcaps);
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
} // namespace NETGeographicLib
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/Geohash.cpp
|
||||||
|
* \brief Implementation for NETGeographicLib::Geohash 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/Geohash.hpp"
|
||||||
|
#include "Geohash.h"
|
||||||
|
#include "NETGeographicLib.h"
|
||||||
|
|
||||||
|
using namespace NETGeographicLib;
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geohash::Forward(double lat, double lon, int len, System::String^% geohash)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::string l;
|
||||||
|
GeographicLib::Geohash::Forward( lat, lon, len, l );
|
||||||
|
geohash = gcnew System::String( l.c_str() );
|
||||||
|
}
|
||||||
|
catch ( const std::exception& xcpt )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( xcpt.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geohash::Reverse(System::String^ geohash,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon,
|
||||||
|
[System::Runtime::InteropServices::Out] int% len,
|
||||||
|
bool centerp )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
double llat, llon;
|
||||||
|
int llen;
|
||||||
|
GeographicLib::Geohash::Reverse( StringConvert::ManagedToUnmanaged( geohash ),
|
||||||
|
llat, llon, llen, centerp );
|
||||||
|
lat = llat;
|
||||||
|
lon = llon;
|
||||||
|
len = llen;
|
||||||
|
}
|
||||||
|
catch ( const std::exception& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geohash::LatitudeResolution(int len)
|
||||||
|
{
|
||||||
|
return GeographicLib::Geohash::LatitudeResolution( len );
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geohash::LongitudeResolution(int len)
|
||||||
|
{
|
||||||
|
return GeographicLib::Geohash::LongitudeResolution( len );
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
int Geohash::GeohashLength(double res)
|
||||||
|
{
|
||||||
|
return GeographicLib::Geohash::GeohashLength( res );
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
int Geohash::GeohashLength(double latres, double lonres)
|
||||||
|
{
|
||||||
|
return GeographicLib::Geohash::GeohashLength( latres, lonres );
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
int Geohash::DecimalPrecision(int len)
|
||||||
|
{
|
||||||
|
return GeographicLib::Geohash::DecimalPrecision( len );
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,139 @@
|
||||||
|
#pragma once
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/Geohash.h
|
||||||
|
* \brief Header for NETGeographicLib::Geohash 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::Geohash.
|
||||||
|
*
|
||||||
|
* Geohashes are described in
|
||||||
|
* - http://en.wikipedia.org/wiki/Geohash
|
||||||
|
* - http://geohash.org/
|
||||||
|
* .
|
||||||
|
* They provide a compact string representation of a particular geographic
|
||||||
|
* location (expressed as latitude and longitude), with the property that if
|
||||||
|
* trailing characters are dropped from the string the geographic location
|
||||||
|
* remains nearby.
|
||||||
|
*
|
||||||
|
* C# Example:
|
||||||
|
* \include example-Geohash.cs
|
||||||
|
* Managed C++ Example:
|
||||||
|
* \include example-Geohash.cpp
|
||||||
|
* Visual Basic Example:
|
||||||
|
* \include example-Geohash.vb
|
||||||
|
**********************************************************************/
|
||||||
|
public ref class Geohash
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// hide the constructor since all members of this class are static.
|
||||||
|
Geohash() {}
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from geographic coordinates to a geohash.
|
||||||
|
*
|
||||||
|
* @param[in] lat latitude of point (degrees).
|
||||||
|
* @param[in] lon longitude of point (degrees).
|
||||||
|
* @param[in] len the length of the resulting geohash.
|
||||||
|
* @param[out] geohash the geohash.
|
||||||
|
* @exception GeographicErr if \e la is not in [−90°,
|
||||||
|
* 90°].
|
||||||
|
* @exception GeographicErr if \e lon is not in [−540°,
|
||||||
|
* 540°).
|
||||||
|
* @exception std::bad_alloc if memory for \e geohash can't be allocated.
|
||||||
|
*
|
||||||
|
* Internally, \e len is first put in the range [0, 18].
|
||||||
|
*
|
||||||
|
* If \e lat or \e lon is NaN, the returned geohash is "nan".
|
||||||
|
**********************************************************************/
|
||||||
|
static void Forward(double lat, double lon, int len,
|
||||||
|
[System::Runtime::InteropServices::Out] System::String^% geohash);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert from a geohash to geographic coordinates.
|
||||||
|
*
|
||||||
|
* @param[in] geohash the geohash.
|
||||||
|
* @param[out] lat latitude of point (degrees).
|
||||||
|
* @param[out] lon longitude of point (degrees).
|
||||||
|
* @param[out] len the length of the geohash.
|
||||||
|
* @param[in] centerp if true (the default) return the center of the
|
||||||
|
* geohash location, otherwise return the south-west corner.
|
||||||
|
* @exception GeographicErr if \e geohash contains illegal characters.
|
||||||
|
*
|
||||||
|
* Only the first 18 characters for \e geohash are considered. The case of
|
||||||
|
* the letters in \e geohash is ignored.
|
||||||
|
*
|
||||||
|
* If the first three characters in \e geohash are "nan", then \e lat and
|
||||||
|
* \e lon are set to NaN.
|
||||||
|
**********************************************************************/
|
||||||
|
static void Reverse(System::String^ geohash,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lat,
|
||||||
|
[System::Runtime::InteropServices::Out] double% lon,
|
||||||
|
[System::Runtime::InteropServices::Out] int% len,
|
||||||
|
bool centerp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The latitude resolution of a geohash.
|
||||||
|
*
|
||||||
|
* @param[in] len the length of the geohash.
|
||||||
|
* @return the latitude resolution (degrees).
|
||||||
|
*
|
||||||
|
* Internally, \e len is first put in the range [0, 18].
|
||||||
|
**********************************************************************/
|
||||||
|
static double LatitudeResolution(int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The longitude resolution of a geohash.
|
||||||
|
*
|
||||||
|
* @param[in] len the length of the geohash.
|
||||||
|
* @return the longitude resolution (degrees).
|
||||||
|
*
|
||||||
|
* Internally, \e len is first put in the range [0, 18].
|
||||||
|
**********************************************************************/
|
||||||
|
static double LongitudeResolution(int len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The geohash length required to meet a given geographic resolution.
|
||||||
|
*
|
||||||
|
* @param[in] res the minimum of resolution in latitude and longitude
|
||||||
|
* (degrees).
|
||||||
|
* @return geohash length.
|
||||||
|
*
|
||||||
|
* The returned length is in the range [0, 18].
|
||||||
|
**********************************************************************/
|
||||||
|
static int GeohashLength(double res);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The geohash length required to meet a given geographic resolution.
|
||||||
|
*
|
||||||
|
* @param[in] latres the resolution in latitude (degrees).
|
||||||
|
* @param[in] lonres the resolution in longitude (degrees).
|
||||||
|
* @return geohash length.
|
||||||
|
*
|
||||||
|
* The returned length is in the range [0, 18].
|
||||||
|
**********************************************************************/
|
||||||
|
static int GeohashLength(double latres, double lonres);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The decimal geographic precision required to match a given geohash
|
||||||
|
* length. This is the number of digits needed after decimal point in a
|
||||||
|
* decimal degrees representation.
|
||||||
|
*
|
||||||
|
* @param[in] len the length of the geohash.
|
||||||
|
* @return the decimal precision (may be negative).
|
||||||
|
*
|
||||||
|
* Internally, \e len is first put in the range [0, 18]. The returned
|
||||||
|
* decimal precision is in the range [−2, 12].
|
||||||
|
**********************************************************************/
|
||||||
|
static int DecimalPrecision(int len);
|
||||||
|
};
|
||||||
|
} // namespace NETGeographicLib
|
||||||
|
|
@ -0,0 +1,215 @@
|
||||||
|
/**
|
||||||
|
* \file NETGeographicLib/Geoid.cpp
|
||||||
|
* \brief Implementation for NETGeographicLib::Geoid 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/Geoid.hpp"
|
||||||
|
#include "Geoid.h"
|
||||||
|
#include "NETGeographicLib.h"
|
||||||
|
|
||||||
|
using namespace NETGeographicLib;
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
Geoid::!Geoid(void)
|
||||||
|
{
|
||||||
|
if ( m_pGeoid != NULL )
|
||||||
|
{
|
||||||
|
delete m_pGeoid;
|
||||||
|
m_pGeoid = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
Geoid::Geoid(System::String^ name, System::String^ path,
|
||||||
|
bool cubic, bool threadsafe)
|
||||||
|
{
|
||||||
|
if ( name == nullptr ) throw gcnew GeographicErr("name cannot be a null pointer.");
|
||||||
|
if ( path == nullptr ) throw gcnew GeographicErr("path cannot be a null pointer.");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeoid = new GeographicLib::Geoid(
|
||||||
|
StringConvert::ManagedToUnmanaged( name ),
|
||||||
|
StringConvert::ManagedToUnmanaged( path ),
|
||||||
|
cubic, threadsafe );
|
||||||
|
}
|
||||||
|
catch ( std::bad_alloc )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( "Failed to allocate memory for a GeographicLib::Geoid" );
|
||||||
|
}
|
||||||
|
catch ( const GeographicLib::GeographicErr& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geoid::CacheArea(double south, double west, double north, double east)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeoid->CacheArea( south, west, north, east );
|
||||||
|
}
|
||||||
|
catch ( const std::exception& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geoid::CacheAll()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_pGeoid->CacheAll();
|
||||||
|
}
|
||||||
|
catch ( const std::exception& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
void Geoid::CacheClear()
|
||||||
|
{
|
||||||
|
m_pGeoid->CacheClear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::Height(double lat, double lon)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return m_pGeoid->operator()( lat, lon );
|
||||||
|
}
|
||||||
|
catch ( const std::exception& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::Height(double lat, double lon,
|
||||||
|
[System::Runtime::InteropServices::Out] double% gradn,
|
||||||
|
[System::Runtime::InteropServices::Out] double% grade)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
double lgradn, lgrade;
|
||||||
|
double out = m_pGeoid->operator()( lat, lon, lgradn, lgrade );
|
||||||
|
gradn = lgradn;
|
||||||
|
grade = lgrade;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
catch ( const std::exception& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::ConvertHeight(double lat, double lon, double h,
|
||||||
|
ConvertFlag d)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return m_pGeoid->ConvertHeight( lat, lon, h,
|
||||||
|
static_cast<GeographicLib::Geoid::convertflag>(d) );
|
||||||
|
}
|
||||||
|
catch ( const std::exception& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::String^ Geoid::DefaultGeoidPath()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return StringConvert::UnmanagedToManaged(
|
||||||
|
GeographicLib::Geoid::DefaultGeoidPath() );
|
||||||
|
}
|
||||||
|
catch ( const std::exception& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::String^ Geoid::DefaultGeoidName()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return StringConvert::UnmanagedToManaged(
|
||||||
|
GeographicLib::Geoid::DefaultGeoidName() );
|
||||||
|
}
|
||||||
|
catch ( const std::exception& err )
|
||||||
|
{
|
||||||
|
throw gcnew GeographicErr( err.what() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::String^ Geoid::Description::get()
|
||||||
|
{ return StringConvert::UnmanagedToManaged(m_pGeoid->Description()); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::String^ Geoid::DateTime::get()
|
||||||
|
{ return StringConvert::UnmanagedToManaged(m_pGeoid->DateTime()); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::String^ Geoid::GeoidFile::get()
|
||||||
|
{ return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidFile()); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::String^ Geoid::GeoidName::get()
|
||||||
|
{ return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidName()); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::String^ Geoid::GeoidDirectory::get()
|
||||||
|
{ return StringConvert::UnmanagedToManaged(m_pGeoid->GeoidDirectory()); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
System::String^ Geoid::Interpolation::get()
|
||||||
|
{ return StringConvert::UnmanagedToManaged(m_pGeoid->Interpolation()); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::MaxError::get() { return m_pGeoid->MaxError(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::RMSError::get() { return m_pGeoid->RMSError(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::Offset::get() { return m_pGeoid->Offset(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::Scale::get() { return m_pGeoid->Scale(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
bool Geoid::ThreadSafe::get() { return m_pGeoid->ThreadSafe(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
bool Geoid::Cache::get() { return m_pGeoid->Cache(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::CacheWest::get() { return m_pGeoid->CacheWest(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::CacheEast::get() { return m_pGeoid->CacheEast(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::CacheNorth::get() { return m_pGeoid->CacheNorth(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::CacheSouth::get() { return m_pGeoid->CacheSouth(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::MajorRadius::get() { return m_pGeoid->MajorRadius(); }
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
double Geoid::Flattening::get() { return m_pGeoid->Flattening(); }
|
||||||