aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2020-01-07 16:14:23 +0100
committerGitHub <noreply@github.com>2020-01-07 16:14:23 +0100
commite55bb1933c4319d1a3146612613f31ed3bba82f6 (patch)
tree70dbef9ad3c97b23d13bda468a9a073caddc8142
parent679987ee356c79ce5525bd4ce3b6792f4c84d664 (diff)
parentff15ab6c2d709e6ac230fd0815431d2618e0faef (diff)
downloadPROJ-e55bb1933c4319d1a3146612613f31ed3bba82f6.tar.gz
PROJ-e55bb1933c4319d1a3146612613f31ed3bba82f6.zip
Remove deprecated JNI bindings (#1825)
Remove deprecated JNI bindings
-rw-r--r--Makefile.am4
-rw-r--r--cmake/ProjConfig.cmake1
-rw-r--r--cmake/proj_config.cmake.in6
-rw-r--r--configure.ac57
-rw-r--r--jniwrap/Makefile.am8
-rw-r--r--jniwrap/README.md146
-rw-r--r--jniwrap/build.xml67
-rw-r--r--jniwrap/org.osgeo.proj/Makefile.am4
-rw-r--r--jniwrap/org.osgeo.proj/module-info.java29
-rw-r--r--jniwrap/org.osgeo.proj/org/Makefile.am2
-rw-r--r--jniwrap/org.osgeo.proj/org/proj4/Makefile.am1
-rw-r--r--jniwrap/org.osgeo.proj/org/proj4/PJ.java291
-rw-r--r--jniwrap/org.osgeo.proj/org/proj4/PJException.java59
-rw-r--r--jniwrap/org.osgeo.proj/org/proj4/package-info.java39
-rw-r--r--src/Makefile.am6
-rw-r--r--src/jniproj.cpp469
-rw-r--r--src/lib_proj.cmake21
-rw-r--r--src/org_proj4_PJ.h135
-rwxr-xr-xtravis/install.sh6
19 files changed, 7 insertions, 1344 deletions
diff --git a/Makefile.am b/Makefile.am
index 57707f64..2f48dd7c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
-SUBDIRS = include src man data jniwrap cmake
-DIST_SUBDIRS = include src man data jniwrap cmake test
+SUBDIRS = include src man data cmake
+DIST_SUBDIRS = include src man data cmake test
EXTRA_DIST = CMakeLists.txt CITATION README.md
diff --git a/cmake/ProjConfig.cmake b/cmake/ProjConfig.cmake
index 3f0b3d2e..9f1b4e44 100644
--- a/cmake/ProjConfig.cmake
+++ b/cmake/ProjConfig.cmake
@@ -14,7 +14,6 @@ include(CheckFunctionExists)
# check needed include file
check_include_files(dlfcn.h HAVE_DLFCN_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
-check_include_files(jni.h HAVE_JNI_H)
check_include_files(memory.h HAVE_MEMORY_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
diff --git a/cmake/proj_config.cmake.in b/cmake/proj_config.cmake.in
index caeb0934..d8385ce9 100644
--- a/cmake/proj_config.cmake.in
+++ b/cmake/proj_config.cmake.in
@@ -4,9 +4,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
-/* Define to 1 if you have the <jni.h> header file. */
-#cmakedefine HAVE_JNI_H 1
-
/* Define to 1 if you have the `m' library (-lm). */
#cmakedefine HAVE_LIBM 1
@@ -40,9 +37,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
-/* Enabled for Java/JNI Support */
-#cmakedefine JNI_ENABLED 1
-
/* Name of package */
#cmakedefine PACKAGE "${PACKAGE}"
diff --git a/configure.ac b/configure.ac
index e9274621..715ce3a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -191,60 +191,6 @@ AC_CHECK_FUNC(localeconv, [AC_DEFINE(HAVE_LOCALECONV,1,[Define to 1 if you have
AC_CHECK_FUNCS([strerror])
dnl ---------------------------------------------------------------------------
-dnl Check for JNI support.
-dnl ---------------------------------------------------------------------------
-
-JNI_INCLUDE=
-export JNI_INCLUDE
-
-AC_ARG_WITH(jni,
- [AS_HELP_STRING([--with-jni=dir],
- [Include Java/JNI support, add optional include dir])
- ],,)
-
-if test "$with_jni" = "yes" ; then
-
- AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])
-
- AC_MSG_CHECKING(whether to enable Java/JNI support)
-
- AC_MSG_RESULT([enabled])
-
-elif test "$with_jni" != "no" -a "$with_jni" != "" ; then
-
- AC_MSG_CHECKING(whether to enable Java/JNI support)
-
- if test \! -r "$with_jni/jni.h" ; then
- AC_MSG_ERROR(Did not find $with_jni/jni.h)
- fi
-
- AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])
-
- AC_MSG_RESULT([enabled])
-
- JNI_INCLUDE="-I$with_jni"
-
-elif test "$with_jni" = "" ; then
- AC_CHECK_HEADERS(jni.h)
-
- AC_MSG_CHECKING(whether to enable Java/JNI support)
-
- if test "$ac_cv_header_jni_h" = "no" ; then
- AC_MSG_RESULT([disabled])
- else
- AC_MSG_RESULT([enabled])
- AC_DEFINE(JNI_ENABLED,1,[Enabled for Java/JNI Support])
- fi
-
-else
- AC_MSG_CHECKING(whether to enable Java/JNI support)
-
- AC_MSG_RESULT([disabled])
-fi
-
-AC_SUBST(JNI_INCLUDE,$JNI_INCLUDE)
-
-dnl ---------------------------------------------------------------------------
dnl Provide a mechanism to disable real mutex support (if lacking win32 or
dnl posix mutexes for instance).
dnl ---------------------------------------------------------------------------
@@ -321,8 +267,7 @@ dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES([Makefile cmake/Makefile src/Makefile include/Makefile include/proj/Makefile include/proj/internal/Makefile
include/proj/internal/nlohmann/Makefile
test/Makefile test/cli/Makefile test/gie/Makefile test/gigs/Makefile test/unit/Makefile
- man/Makefile man/man1/Makefile man/man3/Makefile data/Makefile
- jniwrap/Makefile jniwrap/org.osgeo.proj/Makefile jniwrap/org.osgeo.proj/org/Makefile jniwrap/org.osgeo.proj/org/proj4/Makefile])
+ man/Makefile man/man1/Makefile man/man3/Makefile data/Makefile])
if ! test "x$with_external_gtest" = "xyes" ; then
AC_CONFIG_FILES([test/googletest/Makefile test/googletest/include/Makefile
test/googletest/include/gtest/Makefile
diff --git a/jniwrap/Makefile.am b/jniwrap/Makefile.am
deleted file mode 100644
index 2d33809a..00000000
--- a/jniwrap/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-EXTRA_DIST = build.xml README.md
-
-SUBDIRS = org.osgeo.proj
-
-install-data-local:
- echo In jniwrap
-
-
diff --git a/jniwrap/README.md b/jniwrap/README.md
deleted file mode 100644
index 9cc97dac..00000000
--- a/jniwrap/README.md
+++ /dev/null
@@ -1,146 +0,0 @@
-# PROJ bridge to Java
-
-This is the third release of JNI wrappers for the main PROJ functions.
-The first release of JNI wrappers were created by http://www.hydrologis.com.
-The second release of JNI wrappers were created by http://www.geoapi.org.
-This release is compatible with any PROJ versions from 4.8 to 5
-provided that PROJ has been compiled as described below.
-
-
-
-## What is "PROJ bridge to Java"
-
-_PROJ bridge to Java_ is a small library of Java classes that wrap a few PROJ functions
-by using the Java Native Interface (JNI). The main Java class is `org.proj4.PJ`.
-A Java code example is given in the _Usage & a fast example_ section below.
-
-
-
-### Versions
-
-The PROJ bridge to Java does not follow the same version numbers than the main PROJ library
-since the same JAR file can be compatible with a range of PROJ versions.
-Version compatibility is given below:
-
-
-Java bridge | Compatible with PROJ library
------------ | ----------------------------
-2.0 and 3.0 | 4.8 to 5+
-1.0 | 4.4.9 to 4.8 inclusive
-
-
-
-### Compilation
-
-To compile the native part, `configure` has to be run in the PROJ directory like this:
-
- CFLAGS=-Iinclude2 ./configure --with-jni=include1
-
-where
-
-* `include1` = folder in which the header file `jni.h` resides (usually `$JAVA_HOME/include`)
-* `include2` = folder in which the header file `jni_md.h` resides (usually `$JAVA_HOME/include/linux` or whatever)
-
-On MacOS, those two folders are `/Library/Java/JavaVirtualMachines/.../Contents/Home/include/`.
-
-
-The java part is compiled by running Ant inside the `jniwrap` folder.
-This will compile the classes and archive them in a JAR file.
-It applies to Linux, MacOS and Windows (and virtually to every system supporting java).
-
-
-
-### Requirements
-
-Beyond the ones already put by PROJ, you need:
-
-* For compilation:
- * Java 9+, the Java standard development kit version 9 or above
- * Ant 1.10+, to run the build.
-* For execution:
- * If a Java version less than the current version on the local machine is desired,
- add a `release` attribute in the `javac` task of `build.xml` before to compile.
- * Proj version 4.8 or more recent compiled with the `--with-jni` option.
-
-
-
-### Documentation
-
-The documentation is held inside the code and can be retrieved by running
-`ant javadoc` inside the folder `jniwrap`. This will create the HTML format
-documentation inside of `jniwrap/out/apidocs`
-
-
-
-### License
-
-GPL for the first release.
-Proj.4 license for the second release.
-
-
-
-### Authors
-
-* Andrea Antonello (andrea.antonello@hydrologis.com)
-* Martin Desruisseaux (martin.desruisseaux@geomatys.com)
-
-
-
-## Usage & a fast example:
-
-The `proj.jar` is all is needed to implement PROJ support in java applications.
-The whole job is done by the PROJ library, so there are just a couple of functions that be used.
-
-The best way is to see everything through an example.
-In the following example we create two Coordinate Reference System and transform 3 points.
-The Coordinate Reference Systems and the points are hard-coded for simplicity.
-Of course, real applications would read them from a file or other data source.
-
- import org.proj4.*;
- import java.util.Arrays;
-
- /**
- * Converts coordinates from EPSG:32632 (WGS 84 / UTM zone 32N) to WGS84,
- * then prints the result to the standard output stream.
- */
- public class Main {
- public static void main(String[] args) throws PJException {
- PJ sourcePJ = new PJ("+init=epsg:32632"); // (x,y) axis order
- PJ targetPJ = new PJ("+proj=latlong +datum=WGS84"); // (λ,φ) axis order
- double[] coordinates = {
- 500000, 0, // First coordinate
- 400000, 100000, // Second coordinate
- 600000, -100000 // Third coordinate
- };
- sourcePJ.transform(targetPJ, 2, coordinates, 0, 3);
- System.out.println(Arrays.toString(coordinates));
- }
- }
-
-
-
-### Compile the Main code
-
-We assume that PROJ was compiled with the right flag to support the bridge to Java.
-Therefore we have a library called `proj.jar`.
-Thus we compile the `Main.java` with the command:
-
- javac --class-path <path to the jar library>/proj.jar Main.java
-
-and execute the created test case with (replace `:` by `;` on the Windows platform):
-
- java --class-path <path to the jar library>/proj.jar:. Main
-
-
-
-### Troubleshooting
-
-If an `java.lang.UnsatisfiedLinkError` is thrown at execution time, add the following line in the Java code:
-
- System.out.println(System.getProperty("java.library.path"));
-
-Then verify that the `libproj.so` (Linux), `libproj.dylib` (MacOS) or `libproj.dll` (Windows) file is located
-in one of the directories listed by above code. If this is not the case, then try configuring the
-`LD_LIBRARY_PATH` (Linux), `DYLD_LIBRARY_PATH` (MacOS) or `PATH` (Windows) environment variable.
-Alternatively, a `-Djava.library.path=<path to the libproj>` option can be added to above `java` command.
-If the problem persist, adding the `-verbose:jni` option to the `java` command may help more advanced diagnostics.
diff --git a/jniwrap/build.xml b/jniwrap/build.xml
deleted file mode 100644
index 11aef091..00000000
--- a/jniwrap/build.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<project name="PROJ bridge to Java" default="compile" basedir=".">
-
- <!-- *******************************************
- Set directory paths and versions.
- ******************************************* -->
- <property name="src" value="."/>
- <property name="out" value="out"/>
- <property name="classes" value="${out}/classes"/>
- <property name="javadoc" value="${out}/apidocs"/>
- <property name="module" value="org.osgeo.proj"/>
- <property name="version" value="3.0"/> <!-- See "Versions" section in README.md -->
-
- <!-- *******************************************
- Compile (default target).
- Include generation of JNI header.
- ******************************************* -->
- <target name="compile">
- <mkdir dir="${out}"/>
- <mkdir dir="${classes}"/>
- <javac modulesourcepath="${src}" destdir="${classes}" encoding="UTF-8" nativeheaderdir="${src}"
- createMissingPackageInfoClass = "false"
- includeAntRuntime = "false">
- <compilerarg line="--module-version ${version}"/>
- </javac>
-
- <!-- Move the .h files generated by javac. -->
- <move todir="../src">
- <fileset dir="${src}/${module}">
- <include name="org_*.h"/>
- </fileset>
- </move>
-
- <jar destfile="${out}/proj.jar" basedir="${classes}/${module}" level="9" strict="fail">
- <manifest>
- <attribute name="Implementation-Title" value="PROJ bridge to Java"/>
- <attribute name="Implementation-Version" value="${version}"/>
- <attribute name="Implementation-Vendor" value="Proj.4 project"/>
- <attribute name="Implementation-URL" value="https://proj.org/"/>
- </manifest>
- </jar>
- </target>
-
- <!-- **********************************************************
- Build and create documentation.
- ********************************************************** -->
- <target name="javadoc" depends="compile">
- <javadoc classpath="${classes}/${module}" destdir="${javadoc}"
- encoding="UTF-8" noqualifier="all" windowtitle="PROJ bridge to Java" author="false" version="true"
- link="http://www.geoapi.org/3.0/javadoc/" additionalparam="-html5">
- <sourcefiles>
- <fileset dir="${src}/${module}">
- <include name="org/**/*.java"/>
- <exclude name="module-info.java"/>
- </fileset>
- </sourcefiles>
- </javadoc>
- </target>
-
- <!-- *******************************************
- Clean up everything.
- ******************************************* -->
- <target name="clean">
- <delete dir="${out}"/>
- </target>
-
-</project>
diff --git a/jniwrap/org.osgeo.proj/Makefile.am b/jniwrap/org.osgeo.proj/Makefile.am
deleted file mode 100644
index 6c02a743..00000000
--- a/jniwrap/org.osgeo.proj/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-EXTRA_DIST = module-info.java
-
-SUBDIRS = org
-
diff --git a/jniwrap/org.osgeo.proj/module-info.java b/jniwrap/org.osgeo.proj/module-info.java
deleted file mode 100644
index ea8a623a..00000000
--- a/jniwrap/org.osgeo.proj/module-info.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/******************************************************************************
- * Project: PROJ.4
- * Purpose: Java/JNI wrappers for PROJ API.
- * Author: Martin Desruisseaux
- *
- ******************************************************************************
- * Copyright (c) 2018, Open Geospatial Consortium, Inc.
- *
- * 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.
- */
-module org.osgeo.proj {
- exports org.proj4;
-}
diff --git a/jniwrap/org.osgeo.proj/org/Makefile.am b/jniwrap/org.osgeo.proj/org/Makefile.am
deleted file mode 100644
index f07adff1..00000000
--- a/jniwrap/org.osgeo.proj/org/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-SUBDIRS = proj4
-
diff --git a/jniwrap/org.osgeo.proj/org/proj4/Makefile.am b/jniwrap/org.osgeo.proj/org/proj4/Makefile.am
deleted file mode 100644
index 665fc39d..00000000
--- a/jniwrap/org.osgeo.proj/org/proj4/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_DIST = PJ.java PJException.java package-info.java
diff --git a/jniwrap/org.osgeo.proj/org/proj4/PJ.java b/jniwrap/org.osgeo.proj/org/proj4/PJ.java
deleted file mode 100644
index e33c9aae..00000000
--- a/jniwrap/org.osgeo.proj/org/proj4/PJ.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/******************************************************************************
- * Project: PROJ.4
- * Purpose: Java/JNI wrappers for PROJ API.
- * Author: Martin Desruisseaux
- *
- ******************************************************************************
- * Copyright (c) 2011-2018, Open Geospatial Consortium, Inc.
- *
- * 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.
- ******************************************************************************
- */
-package org.proj4;
-
-import java.util.Objects;
-import java.lang.annotation.Native;
-
-
-/**
- * Wraps the <a href="https://proj.org/">PROJ</a> {@code PJ} native data structure.
- * Almost every methods defined in this class are native methods delegating the work to the PROJ library.
- * This class is the only place where such native methods are defined.
- *
- * <p>In the PROJ library, the {@code PJ} structure aggregates in a single place information usually
- * splitted in many different ISO 19111 interfaces: {@link org.opengis.referencing.datum.Ellipsoid},
- * {@link org.opengis.referencing.datum.Datum}, {@link org.opengis.referencing.datum.PrimeMeridian},
- * {@link org.opengis.referencing.cs.CoordinateSystem}, {@link org.opengis.referencing.crs.CoordinateReferenceSystem}
- * and their sub-interfaces. The relationship with the GeoAPI methods is indicated in the
- * "See" tags when appropriate.</p>
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 5.1
- * @since 4.8
- */
-public class PJ {
- /**
- * The maximal number of dimension accepted by the {@link #transform(PJ, int, double[], int, int)} method.
- * This upper limit is actually somewhat arbitrary. This limit exists mostly as a safety against potential misuse.
- */
- @Native
- public static final int DIMENSION_MAX = 100;
-
- /**
- * Loads the PROJ library.
- */
- static {
- System.loadLibrary("proj");
- }
-
- /**
- * The pointer to {@code PJ} structure allocated in the C/C++ heap. This value has no meaning in Java code.
- * <strong>Do not modify</strong>, since this value is used by PROJ. Do not rename neither, unless you update
- * accordingly the C code in JNI wrappers.
- */
- private final long ptr;
-
- /**
- * Creates a new {@code PJ} structure from the given PROJ definition string.
- *
- * @param definition the PROJ definition string.
- * @throws IllegalArgumentException if the PJ structure can not be created from the given string.
- */
- public PJ(final String definition) throws IllegalArgumentException {
- Objects.requireNonNull(definition);
- ptr = allocatePJ(definition);
- if (ptr == 0) {
- throw new IllegalArgumentException(definition);
- }
- }
-
- /**
- * Creates a new {@code PJ} structure derived from an existing {@code PJ} object.
- * This constructor is usually for getting the
- * {@linkplain org.opengis.referencing.crs.ProjectedCRS#getBaseCRS() base geographic CRS}
- * from a {@linkplain org.opengis.referencing.crs.ProjectedCRS projected CRS}.
- *
- * @param crs the CRS (usually projected) from which to derive a new CRS.
- * @param type the type of the new CRS. Currently, only {@link Type#GEOGRAPHIC} is supported.
- * @throws IllegalArgumentException if the PJ structure can not be created.
- */
- public PJ(final PJ crs, final Type type) throws IllegalArgumentException {
- Objects.requireNonNull(crs, "The CRS must be non-null.");
- if (type != Type.GEOGRAPHIC) {
- throw new IllegalArgumentException("Can not derive the " + type + " type.");
- }
- ptr = allocateGeoPJ(crs);
- if (ptr == 0) {
- throw new IllegalArgumentException(crs.getLastError());
- }
- }
-
- /**
- * Allocates a PJ native data structure and returns the pointer to it. This method should be
- * invoked by the constructor only, and the return value <strong>must</strong> be assigned
- * to the {@link #ptr} field. The allocated structure is released by the {@link #finalize()}
- * method.
- *
- * @param definition the PROJ definition string.
- * @return a pointer to the PJ native data structure, or 0 if the operation failed.
- */
- private static native long allocatePJ(String definition);
-
- /**
- * Allocates a PJ native data structure for the base geographic CRS of the given CRS, and
- * returns the pointer to it. This method should be invoked by the constructor only, and
- * the return value <strong>must</strong> be assigned to the {@link #ptr} field.
- * The allocated structure is released by the {@link #finalize()} method.
- *
- * @param projected the CRS from which to derive the base geographic CRS.
- * @return a pointer to the PJ native data structure, or 0 if the operation failed.
- */
- private static native long allocateGeoPJ(PJ projected);
-
- /**
- * Returns the version number of the PROJ library.
- *
- * @return the PROJ release string.
- */
- public static native String getVersion();
-
- /**
- * Returns the PROJ definition string. This is the string given to the constructor,
- * expanded with as much information as possible.
- *
- * @return the PROJ definition string.
- */
- public native String getDefinition();
-
- /**
- * Returns the Coordinate Reference System type.
- *
- * @return the CRS type.
- */
- public native Type getType();
-
- /**
- * The coordinate reference system (CRS) type returned by {@link PJ#getType()}.
- * In the PROJ library, a CRS can only be geographic, geocentric or projected,
- * without distinction between 2D and 3D CRS.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 5.1
- * @since 4.8
- */
- public static enum Type {
- /*
- * IMPLEMENTATION NOTE: Do not rename those fields, unless you update the
- * native C code accordingly.
- */
-
- /**
- * The CRS is of type {@link org.opengis.referencing.crs.GeographicCRS}.
- * The CRS can be two-dimensional or three-dimensional.
- */
- GEOGRAPHIC,
-
- /**
- * The CRS is of type {@link org.opengis.referencing.crs.GeocentricCRS}.
- * The CRS can only be three-dimensional.
- */
- GEOCENTRIC,
-
- /**
- * The CRS is of type {@link org.opengis.referencing.crs.ProjectedCRS}.
- * The CRS can be two-dimensional or three-dimensional.
- */
- PROJECTED
- }
-
- /**
- * Returns the value stored in the {@code a_orig} PJ field.
- *
- * @return the axis length stored in {@code a_orig}.
- *
- * @see org.opengis.referencing.datum.Ellipsoid#getSemiMajorAxis()
- */
- public native double getSemiMajorAxis();
-
- /**
- * Returns the value computed from PJ fields by {@code √((a_orig)² × (1 - es_orig))}.
- *
- * @return the axis length computed by {@code √((a_orig)² × (1 - es_orig))}.
- *
- * @see org.opengis.referencing.datum.Ellipsoid#getSemiMinorAxis()
- */
- public native double getSemiMinorAxis();
-
- /**
- * Returns the square of the ellipsoid eccentricity (ε²). The eccentricity
- * is related to axis length by ε=√(1-(<var>b</var>/<var>a</var>)²). The
- * eccentricity of a sphere is zero.
- *
- * @return the eccentricity.
- *
- * @see org.opengis.referencing.datum.Ellipsoid#isSphere()
- * @see org.opengis.referencing.datum.Ellipsoid#getInverseFlattening()
- */
- public native double getEccentricitySquared();
-
- /**
- * Returns an array of character indicating the direction of each axis. Directions are
- * characters like {@code 'e'} for East, {@code 'n'} for North and {@code 'u'} for Up.
- *
- * @return the axis directions.
- *
- * @see org.opengis.referencing.cs.CoordinateSystemAxis#getDirection()
- */
- public native char[] getAxisDirections();
-
- /**
- * Longitude of the prime meridian measured from the Greenwich meridian, positive eastward.
- *
- * @return the prime meridian longitude, in degrees.
- *
- * @see org.opengis.referencing.datum.PrimeMeridian#getGreenwichLongitude()
- */
- public native double getGreenwichLongitude();
-
- /**
- * Returns the conversion factor from the linear units to metres.
- *
- * @param vertical {@code false} for the conversion factor of horizontal axes,
- * or {@code true} for the conversion factor of the vertical axis.
- * @return the conversion factor to metres for the given axis.
- */
- public native double getLinearUnitToMetre(boolean vertical);
-
- /**
- * Transforms in-place the coordinates in the given array.
- * The coordinates array shall contain (<var>x</var>,<var>y</var>,<var>z</var>,…) tuples,
- * where the <var>z</var> and any additional dimensions are optional.
- * Note that any dimension after the <var>z</var> value are ignored.
- *
- * <p>Input and output units:</p>
- * <ul>
- * <li>Angular units (as in longitude and latitudes) are decimal degrees.</li>
- * <li>Linear units are usually metres, but this is actually projection-dependent.</li>
- * </ul>
- *
- * @param target the target CRS.
- * @param dimension the dimension of each coordinate value. Must be in the [2-{@value #DIMENSION_MAX}] range.
- * @param coordinates the coordinates to transform, as a sequence of (<var>x</var>,<var>y</var>,&lt;<var>z</var>&gt;,…) tuples.
- * @param offset offset of the first coordinate in the given array.
- * @param numPts number of points to transform.
- * @throws NullPointerException if the {@code target} or {@code coordinates} argument is null.
- * @throws IndexOutOfBoundsException if the {@code offset} or {@code numPts} arguments are invalid.
- * @throws PJException if the operation failed for another reason (provided by PROJ).
- *
- * @see org.opengis.referencing.operation.MathTransform#transform(double[], int, double[], int, int)
- */
- public native void transform(PJ target, int dimension, double[] coordinates, int offset, int numPts)
- throws PJException;
-
- /**
- * Returns a description of the last error that occurred, or {@code null} if none.
- *
- * @return the last error that occurred, or {@code null}.
- */
- public native String getLastError();
-
- /**
- * Returns the string representation of the PJ structure.
- *
- * @return the string representation.
- */
- @Override
- public native String toString();
-
- /**
- * Deallocates the native PJ data structure.
- * This method should be invoked exactly once, only by the garbage collector,
- */
- @Override
- @SuppressWarnings({"deprecation", "FinalizeDeclaration"})
- protected final native void finalize();
-}
diff --git a/jniwrap/org.osgeo.proj/org/proj4/PJException.java b/jniwrap/org.osgeo.proj/org/proj4/PJException.java
deleted file mode 100644
index 4b465e6a..00000000
--- a/jniwrap/org.osgeo.proj/org/proj4/PJException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/******************************************************************************
- * Project: PROJ.4
- * Purpose: Java/JNI wrappers for PROJ API.
- * Author: Martin Desruisseaux
- *
- ******************************************************************************
- * Copyright (c) 2011-2018, Open Geospatial Consortium, Inc.
- *
- * 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.
- ******************************************************************************
- */
-package org.proj4;
-
-
-/**
- * Exception thrown when a call to {@link PJ#transform(PJ, int, double[], int, int)} failed.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 5.1
- * @since 4.8
- */
-public class PJException extends Exception {
- /**
- * For cross-version compatibility.
- */
- private static final long serialVersionUID = -2580747577812829763L;
-
- /**
- * Constructs a new exception with no message.
- */
- public PJException() {
- super();
- }
-
- /**
- * Constructs a new exception with the given message.
- *
- * @param message a message that describe the cause for the failure.
- */
- public PJException(final String message) {
- super(message);
- }
-}
diff --git a/jniwrap/org.osgeo.proj/org/proj4/package-info.java b/jniwrap/org.osgeo.proj/org/proj4/package-info.java
deleted file mode 100644
index dc38e762..00000000
--- a/jniwrap/org.osgeo.proj/org/proj4/package-info.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/******************************************************************************
- * Project: PROJ.4
- * Purpose: Java/JNI wrappers for PROJ API.
- * Author: Martin Desruisseaux
- *
- ******************************************************************************
- * Copyright (c) 2011-2018, Open Geospatial Consortium, Inc.
- *
- * 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.
- ******************************************************************************
- */
-
-/**
- * Wrappers for the <a href="https://proj.org/">PROJ</a> library.
- * The {@link org.proj4.PJ} class contains only native methods delegating their work to the PROJ library.
- * For higher-level methods making use of those native methods, see for example the
- * <a href="http://www.geoapi.org/geoapi-proj4/index.html">GeoAPI bindings for PROJ</a>.
- *
- * @author Martin Desruisseaux (Geomatys)
- * @version 5.1
- * @since 4.8
- */
-package org.proj4;
diff --git a/src/Makefile.am b/src/Makefile.am
index 79ef17d1..62821ff9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,11 +7,11 @@ TESTS = geodtest
check_PROGRAMS = geodtest
AM_CPPFLAGS = -DPROJ_LIB=\"$(pkgdatadir)\" \
- -DMUTEX_@MUTEX_SETTING@ @JNI_INCLUDE@ -I$(top_srcdir)/include @SQLITE3_CFLAGS@
+ -DMUTEX_@MUTEX_SETTING@ -I$(top_srcdir)/include @SQLITE3_CFLAGS@
AM_CXXFLAGS = @CXX_WFLAGS@ @FLTO_FLAG@
include_HEADERS = proj.h proj_experimental.h proj_constants.h proj_api.h geodesic.h \
- org_proj4_PJ.h proj_symbol_rename.h
+ proj_symbol_rename.h
EXTRA_DIST = bin_cct.cmake bin_gie.cmake bin_cs2cs.cmake \
bin_geod.cmake bin_proj.cmake bin_projinfo.cmake \
@@ -199,7 +199,7 @@ libproj_la_SOURCES = \
nad_cvt.cpp nad_init.cpp nad_intr.cpp \
apply_gridshift.cpp datums.cpp datum_set.cpp transform.cpp \
geocent.cpp geocent.h utils.cpp gridinfo.cpp gridlist.cpp \
- jniproj.cpp mutex.cpp initcache.cpp apply_vgridshift.cpp geodesic.c \
+ mutex.cpp initcache.cpp apply_vgridshift.cpp geodesic.c \
strtod.cpp \
\
4D_api.cpp pipeline.cpp \
diff --git a/src/jniproj.cpp b/src/jniproj.cpp
deleted file mode 100644
index 6f441529..00000000
--- a/src/jniproj.cpp
+++ /dev/null
@@ -1,469 +0,0 @@
-/******************************************************************************
- * Project: PROJ.4
- * Purpose: Java/JNI wrappers for PROJ API.
- * Author: Antonello Andrea
- * Martin Desruisseaux
- *
- ******************************************************************************
- * Copyright (c) 2005, Andrea Antonello
- * Copyright (c) 2011, Martin Desruisseaux
- * Copyright (c) 2018, Even Rouault
- *
- * 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.
- *****************************************************************************/
-
-/*!
- * \file jniproj.c
- *
- * \brief
- * Functions used by the Java Native Interface (JNI) wrappers of PROJ.
- *
- *
- * \author Antonello Andrea
- * \date Wed Oct 20 23:10:24 CEST 2004
- *
- * \author Martin Desruisseaux
- * \date August 2011
- */
-
-#include "proj_config.h"
-
-#ifdef JNI_ENABLED
-
-#include <math.h>
-#include <string.h>
-#include "proj_internal.h"
-#include "org_proj4_PJ.h"
-#include <jni.h>
-
-#define PJ_FIELD_NAME "ptr"
-#define PJ_FIELD_TYPE "J"
-
-/*!
- * \brief
- * Internal method returning the address of the PJ structure wrapped by the given Java object.
- * This function looks for a field named "ptr" and of type "long" (Java signature "J") in the
- * given object.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The address of the PJ structure, or nullptr if the operation fails (for example
- * because the "ptr" field was not found).
- */
-static PJ *getPJ(JNIEnv *env, jobject object)
-{
- jfieldID id = env->GetFieldID(env->GetObjectClass(object), PJ_FIELD_NAME, PJ_FIELD_TYPE);
- return (id) ? (PJ*) env->GetLongField(object, id) : nullptr;
-}
-
-/*!
- * \brief
- * Internal method returning the java.lang.Double.NaN constant value.
- * Efficiency is no a high concern for this particular method, because it
- * is used mostly when the user wrongly attempt to use a disposed PJ object.
- *
- * \param env - The JNI environment.
- * \return The java.lang.Double.NaN constant value.
- */
-static jdouble javaNaN(JNIEnv *env)
-{
- jclass c = env->FindClass("java/lang/Double");
- if (c) { // Should never be nullptr, but let be paranoiac.
- jfieldID id = env->GetStaticFieldID(c, "NaN", "D");
- if (id) { // Should never be nullptr, but let be paranoiac.
- return env->GetStaticDoubleField(c, id);
- }
- }
- return 0.0; // Should never happen.
-}
-
-/*!
- * \brief
- * Returns the Proj4 release number.
- *
- * \param env - The JNI environment.
- * \return The Proj4 release number, or nullptr.
- */
-JNIEXPORT jstring JNICALL Java_org_proj4_PJ_getVersion
- (JNIEnv *env, jclass)
-{
- const char *desc = pj_get_release();
- return (desc) ? env->NewStringUTF(desc) : nullptr;
-}
-
-/*!
- * \brief
- * Allocates a new PJ structure from a definition string.
- *
- * \param env - The JNI environment.
- * \param definition - The string definition to be given to Proj4.
- * \return The address of the new PJ structure, or 0 in case of failure.
- */
-JNIEXPORT jlong JNICALL Java_org_proj4_PJ_allocatePJ
- (JNIEnv *env, jclass, jstring definition)
-{
- const char *def_utf = env->GetStringUTFChars(definition, nullptr);
- if (!def_utf) return 0; /* OutOfMemoryError already thrown. */
- PJ *pj = pj_init_plus(def_utf);
- env->ReleaseStringUTFChars(definition, def_utf);
- return (jlong) pj;
-}
-
-/*!
- * \brief
- * Allocates a new geographic PJ structure from an existing one.
- *
- * \param env - The JNI environment.
- * \param projected - The PJ object from which to derive a new one.
- * \return The address of the new PJ structure, or 0 in case of failure.
- */
-JNIEXPORT jlong JNICALL Java_org_proj4_PJ_allocateGeoPJ
- (JNIEnv *env, jclass, jobject projected)
-{
- PJ *pj = getPJ(env, projected);
- return (pj) ? (jlong) pj_latlong_from_proj(pj) : 0;
-}
-
-/*!
- * \brief
- * Returns the definition string.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The definition string.
- */
-JNIEXPORT jstring JNICALL Java_org_proj4_PJ_getDefinition
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- if (pj) {
- char *desc = pj_get_def(pj, 0);
- if (desc) {
- jstring str = env->NewStringUTF(desc);
- pj_dalloc(desc);
- return str;
- }
- }
- return nullptr;
-}
-
-/*!
- * \brief
- * Returns the description associated to the PJ structure.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The description associated to the PJ structure.
- */
-JNIEXPORT jstring JNICALL Java_org_proj4_PJ_toString
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- if (pj) {
- const char *desc = pj->descr;
- if (desc) {
- return env->NewStringUTF(desc);
- }
- }
- return nullptr;
-}
-
-/*!
- * \brief
- * Returns the CRS type as one of the PJ.Type enum: GEOGRAPHIC, GEOCENTRIC or PROJECTED.
- * This function should never return nullptr, unless class or fields have been renamed in
- * such a way that we can not find anymore the expected enum values.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The CRS type as one of the PJ.Type enum.
- */
-JNIEXPORT jobject JNICALL Java_org_proj4_PJ_getType
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- if (pj) {
- const char *type;
- if (pj_is_latlong(pj)) {
- type = "GEOGRAPHIC";
- } else if (pj_is_geocent(pj)) {
- type = "GEOCENTRIC";
- } else {
- type = "PROJECTED";
- }
- jclass c = env->FindClass("org/proj4/PJ$Type");
- if (c) {
- jfieldID id = env->GetStaticFieldID(c, type, "Lorg/proj4/PJ$Type;");
- if (id) {
- return env->GetStaticObjectField(c, id);
- }
- }
- }
- return nullptr;
-}
-
-/*!
- * \brief
- * Returns the semi-major axis length.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The semi-major axis length.
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getSemiMajorAxis
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- return pj ? pj->a_orig : javaNaN(env);
-}
-
-/*!
- * \brief
- * Computes the semi-minor axis length from the semi-major axis length and the eccentricity
- * squared.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The semi-minor axis length.
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getSemiMinorAxis
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- if (!pj) return javaNaN(env);
- double a = pj->a_orig;
- return sqrt(a*a * (1.0 - pj->es_orig));
-}
-
-/*!
- * \brief
- * Returns the eccentricity squared.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The eccentricity.
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getEccentricitySquared
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- return pj ? pj->es_orig : javaNaN(env);
-}
-
-/*!
- * \brief
- * Returns an array of character indicating the direction of each axis.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The axis directions.
- */
-JNIEXPORT jcharArray JNICALL Java_org_proj4_PJ_getAxisDirections
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- if (pj) {
- int length = static_cast<int>(strlen(pj->axis));
- jcharArray array = env->NewCharArray(length);
- if (array) {
- jchar* axis = env->GetCharArrayElements(array, nullptr);
- if (axis) {
- /* Don't use memcp because the type may not be the same. */
- int i;
- for (i=0; i<length; i++) {
- axis[i] = pj->axis[i];
- }
- env->ReleaseCharArrayElements(array, axis, 0);
- }
- return array;
- }
- }
- return nullptr;
-}
-
-/*!
- * \brief
- * Longitude of the prime meridian measured from the Greenwich meridian, positive eastward.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The prime meridian longitude, in degrees.
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getGreenwichLongitude
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- return (pj) ? (pj->from_greenwich)*(180/M_PI) : javaNaN(env);
-}
-
-/*!
- * \brief
- * Returns the conversion factor from linear units to metres.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \param vertical - JNI_FALSE for horizontal axes, or JNI_TRUE for the vertical axis.
- * \return The conversion factor to metres.
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getLinearUnitToMetre
- (JNIEnv *env, jobject object, jboolean vertical)
-{
- PJ *pj = getPJ(env, object);
- if (pj) {
- return (vertical) ? pj->vto_meter : pj->to_meter;
- }
- return javaNaN(env);
-}
-
-/*!
- * \brief
- * Converts input values from degrees to radians before coordinate operation, or the output
- * values from radians to degrees after the coordinate operation.
- *
- * \param pj - The PROJ.4 PJ structure.
- * \param data - The coordinate array to transform.
- * \param numPts - Number of points to transform.
- * \param dimension - Dimension of points in the coordinate array.
- * \param factor - The scale factor to apply: M_PI/180 for inputs or 180/M_PI for outputs.
- */
-static void convertAngularOrdinates(PJ *pj, double* data, jint numPts, int dimension, double factor) {
- int dimToSkip;
- if (pj_is_latlong(pj)) {
- /* Convert only the 2 first ordinates and skip all the other dimensions. */
- dimToSkip = dimension - 2;
- } else {
- /* Not a geographic CRS: nothing to convert. */
- return;
- }
- double *stop = data + dimension*numPts;
- if (dimToSkip > 0) {
- while (data != stop) {
- (*data++) *= factor;
- (*data++) *= factor;
- data += dimToSkip;
- }
- } else {
- while (data != stop) {
- (*data++) *= factor;
- }
- }
-}
-
-/*!
- * \brief
- * Transforms in-place the coordinates in the given array.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \param target - The target CRS.
- * \param dimension - The dimension of each coordinate value. Must be equals or greater than 2.
- * \param coordinates - The coordinates to transform, as a sequence of (x,y,<z>,...) tuples.
- * \param offset - Offset of the first coordinate in the given array.
- * \param numPts - Number of points to transform.
- */
-JNIEXPORT void JNICALL Java_org_proj4_PJ_transform
- (JNIEnv *env, jobject object, jobject target, jint dimension, jdoubleArray coordinates, jint offset, jint numPts)
-{
- if (!target || !coordinates) {
- jclass c = env->FindClass("java/lang/NullPointerException");
- if (c) env->ThrowNew(c, "The target CRS and the coordinates array can not be null.");
- return;
- }
- if (dimension < 2 || dimension > org_proj4_PJ_DIMENSION_MAX) { /* Arbitrary upper value for catching potential misuse. */
- jclass c = env->FindClass("java/lang/IllegalArgumentException");
- if (c) env->ThrowNew(c, "Illegal number of dimensions.");
- return;
- }
- if ((offset < 0) || (numPts < 0) || (offset + dimension*numPts) > env->GetArrayLength(coordinates)) {
- jclass c = env->FindClass("java/lang/ArrayIndexOutOfBoundsException");
- if (c) env->ThrowNew(c, "Illegal offset or illegal number of points.");
- return;
- }
- PJ *src_pj = getPJ(env, object);
- PJ *dst_pj = getPJ(env, target);
- if (src_pj && dst_pj) {
- /* Using GetPrimitiveArrayCritical/ReleasePrimitiveArrayCritical rather than
- GetDoubleArrayElements/ReleaseDoubleArrayElements increase the chances that
- the JVM returns direct reference to its internal array without copying data.
- However we must promise to run the "critical" code fast, to not make any
- system call that may wait for the JVM and to not invoke any other JNI method. */
- double *data = static_cast<double*>(env->GetPrimitiveArrayCritical(coordinates, nullptr));
- if (data) {
- double *x = data + offset;
- double *y = x + 1;
- double *z = (dimension >= 3) ? y+1 : nullptr;
- convertAngularOrdinates(src_pj, x, numPts, dimension, M_PI/180);
- int err = pj_transform(src_pj, dst_pj, numPts, dimension, x, y, z);
- convertAngularOrdinates(dst_pj, x, numPts, dimension, 180/M_PI);
- env->ReleasePrimitiveArrayCritical(coordinates, data, 0);
- if (err) {
- jclass c = env->FindClass("org/proj4/PJException");
- if (c) env->ThrowNew(c, pj_strerrno(err));
- }
- }
- }
-}
-
-/*!
- * \brief
- * Returns a description of the last error that occurred, or nullptr if none.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- * \return The last error, or nullptr.
- */
-JNIEXPORT jstring JNICALL Java_org_proj4_PJ_getLastError
- (JNIEnv *env, jobject object)
-{
- PJ *pj = getPJ(env, object);
- if (pj) {
- int err = pj_ctx_get_errno(pj->ctx);
- if (err) {
- return env->NewStringUTF(pj_strerrno(err));
- }
- }
- return nullptr;
-}
-
-/*!
- * \brief
- * Deallocate the PJ structure. This method is invoked by the garbage collector exactly once.
- * This method will also set the Java "ptr" final field to 0 as a safety. In theory we are not
- * supposed to change the value of a final field. But no Java code should use this field, and
- * the PJ object is being garbage collected anyway. We set the field to 0 as a safety in case
- * some user invoked the finalize() method explicitly despite our warning in the Javadoc to
- * never do such thing.
- *
- * \param env - The JNI environment.
- * \param object - The Java object wrapping the PJ structure (not allowed to be nullptr).
- */
-JNIEXPORT void JNICALL Java_org_proj4_PJ_finalize
- (JNIEnv *env, jobject object)
-{
- jfieldID id = env->GetFieldID(env->GetObjectClass(object), PJ_FIELD_NAME, PJ_FIELD_TYPE);
- if (id) {
- PJ *pj = (PJ*) env->GetLongField(object, id);
- if (pj) {
- env->SetLongField(object, id, (jlong) 0);
- pj_free(pj);
- }
- }
-}
-
-#endif
diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake
index bc27bafe..2e470683 100644
--- a/src/lib_proj.cmake
+++ b/src/lib_proj.cmake
@@ -245,7 +245,6 @@ set(SRC_LIBPROJ_CORE
initcache.cpp
internal.cpp
inv.cpp
- jniproj.cpp
list.cpp
log.cpp
malloc.cpp
@@ -321,26 +320,6 @@ source_group("CMake Files" FILES CMakeLists.txt)
add_definitions(-DPROJ_LIB="${CMAKE_INSTALL_PREFIX}/${DATADIR}")
#################################################
-## java wrapping with jni
-#################################################
-option(JNI_SUPPORT "Build support of java/jni wrapping for proj library" OFF)
-find_package(JNI QUIET)
-if(JNI_SUPPORT AND NOT JNI_FOUND)
- message(FATAL_ERROR "jni support is required but jni is not found")
-endif()
-boost_report_value(JNI_SUPPORT)
-if(JNI_SUPPORT)
- set(SRC_LIBPROJ_CORE
- ${SRC_LIBPROJ_CORE} jniproj.cpp)
- set(HEADERS_LIBPROJ
- ${HEADERS_LIBPROJ} org_proj4_PJ.h)
- source_group("Source Files\\JNI" FILES ${SRC_LIBPROJ_JNI})
- add_definitions(-DJNI_ENABLED)
- include_directories(${JNI_INCLUDE_DIRS})
- boost_report_value(JNI_INCLUDE_DIRS)
-endif()
-
-#################################################
## targets: libproj and proj_config.h
#################################################
set(ALL_LIBPROJ_SOURCES
diff --git a/src/org_proj4_PJ.h b/src/org_proj4_PJ.h
deleted file mode 100644
index be5d3f58..00000000
--- a/src/org_proj4_PJ.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_proj4_PJ */
-
-#ifndef _Included_org_proj4_PJ
-#define _Included_org_proj4_PJ
-#ifdef __cplusplus
-extern "C" {
-#endif
-#undef org_proj4_PJ_DIMENSION_MAX
-#define org_proj4_PJ_DIMENSION_MAX 100L
-/*
- * Class: org_proj4_PJ
- * Method: allocatePJ
- * Signature: (Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_org_proj4_PJ_allocatePJ
- (JNIEnv *, jclass, jstring);
-
-/*
- * Class: org_proj4_PJ
- * Method: allocateGeoPJ
- * Signature: (Lorg/proj4/PJ;)J
- */
-JNIEXPORT jlong JNICALL Java_org_proj4_PJ_allocateGeoPJ
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: getVersion
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_proj4_PJ_getVersion
- (JNIEnv *, jclass);
-
-/*
- * Class: org_proj4_PJ
- * Method: getDefinition
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_proj4_PJ_getDefinition
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: getType
- * Signature: ()Lorg/proj4/PJ/Type;
- */
-JNIEXPORT jobject JNICALL Java_org_proj4_PJ_getType
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: getSemiMajorAxis
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getSemiMajorAxis
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: getSemiMinorAxis
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getSemiMinorAxis
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: getEccentricitySquared
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getEccentricitySquared
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: getAxisDirections
- * Signature: ()[C
- */
-JNIEXPORT jcharArray JNICALL Java_org_proj4_PJ_getAxisDirections
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: getGreenwichLongitude
- * Signature: ()D
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getGreenwichLongitude
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: getLinearUnitToMetre
- * Signature: (Z)D
- */
-JNIEXPORT jdouble JNICALL Java_org_proj4_PJ_getLinearUnitToMetre
- (JNIEnv *, jobject, jboolean);
-
-/*
- * Class: org_proj4_PJ
- * Method: transform
- * Signature: (Lorg/proj4/PJ;I[DII)V
- */
-JNIEXPORT void JNICALL Java_org_proj4_PJ_transform
- (JNIEnv *, jobject, jobject, jint, jdoubleArray, jint, jint);
-
-/*
- * Class: org_proj4_PJ
- * Method: getLastError
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_proj4_PJ_getLastError
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: toString
- * Signature: ()Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL Java_org_proj4_PJ_toString
- (JNIEnv *, jobject);
-
-/*
- * Class: org_proj4_PJ
- * Method: finalize
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_proj4_PJ_finalize
- (JNIEnv *, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/travis/install.sh b/travis/install.sh
index 020c38f0..a8b98f98 100755
--- a/travis/install.sh
+++ b/travis/install.sh
@@ -38,11 +38,7 @@ CXXFLAGS="-DCS=do_not_use_CS_for_solaris_compat $CXXFLAGS"
# autoconf build from generated tarball
mkdir build_autoconf
cd build_autoconf
-if [ -f $JAVA_HOME/include/jni.h ]; then
- CXXFLAGS="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux $CXXFLAGS" ../configure --prefix=/tmp/proj_autoconf_install_from_dist_all --with-jni
-else
- ../configure --prefix=/tmp/proj_autoconf_install_from_dist_all
-fi
+../configure --prefix=/tmp/proj_autoconf_install_from_dist_all
make -j${NPROC}