diff options
| -rw-r--r-- | jniwrap/org/proj4/LatLong.java | 74 | ||||
| -rw-r--r-- | jniwrap/org/proj4/Makefile.am | 6 | ||||
| -rw-r--r-- | jniwrap/org/proj4/Makefile.in | 4 | ||||
| -rw-r--r-- | jniwrap/org/proj4/Others.java | 73 | ||||
| -rw-r--r-- | jniwrap/org/proj4/Proj4.java | 189 | ||||
| -rw-r--r-- | jniwrap/org/proj4/Proj4Factory.java | 77 | ||||
| -rw-r--r-- | jniwrap/org/proj4/ProjectionData.java | 78 | ||||
| -rw-r--r-- | jniwrap/org/proj4/Projections.java | 318 | ||||
| -rw-r--r-- | src/jniproj.c | 171 |
9 files changed, 2 insertions, 988 deletions
diff --git a/jniwrap/org/proj4/LatLong.java b/jniwrap/org/proj4/LatLong.java deleted file mode 100644 index 94093837..00000000 --- a/jniwrap/org/proj4/LatLong.java +++ /dev/null @@ -1,74 +0,0 @@ -/**===================================================================================== - - FILE: LatLong.java - - DESCRIPTION: class representing a latitude longitude projection - - NOTES: --- - AUTHOR: Antonello Andrea - EMAIL: andrea.antonello@hydrologis.com - COMPANY: HydroloGIS / Engineering, University of Trento / CUDAM - COPYRIGHT: Copyright (C) 2004 HydroloGIS / University of Trento / CUDAM, ITALY, GPL - VERSION: $version$ - CREATED OR MODIFIED: Oct 15, 2004 - REVISION: --- - =====================================================================================*/ - -/* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - */ -package org.proj4; - -/** - * class representing a latitude longitude projection - * - * @deprecated Replaced by {@link PJ}, which doesn't need special subclass for this case. - * The conversion of angular values, if needed, is performed directly in the {@link PJ} - * native code, because the native code can more easily exploit the information provided - * by Proj.4 about the CRS type. - */ -@Deprecated -public class LatLong extends Projections -{ - - public LatLong(String src) - { - proj = src; - } - - /* (non-Javadoc) - * @see Projections#prepareData(DataToProject) - */ - public void prepareData(ProjectionData dataTP) - { - degreeToRadiant(dataTP.x, dataTP.y); - } - - /* (non-Javadoc) - * @see java.Projections#returnTransformedCoordinates() - */ - public void prepareTransformedData(ProjectionData dataTP) - { - radiantToDegree(dataTP.x, dataTP.y); - } - -} diff --git a/jniwrap/org/proj4/Makefile.am b/jniwrap/org/proj4/Makefile.am index 71429aef..665fc39d 100644 --- a/jniwrap/org/proj4/Makefile.am +++ b/jniwrap/org/proj4/Makefile.am @@ -1,5 +1 @@ -EXTRA_DIST = PJ.java PJException.java package-info.java \ - LatLong.java Others.java Proj4Factory.java Proj4.java \ - ProjectionData.java Projections.java - - +EXTRA_DIST = PJ.java PJException.java package-info.java diff --git a/jniwrap/org/proj4/Makefile.in b/jniwrap/org/proj4/Makefile.in index 08214d60..ad0d4c74 100644 --- a/jniwrap/org/proj4/Makefile.in +++ b/jniwrap/org/proj4/Makefile.in @@ -162,9 +162,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -EXTRA_DIST = PJ.java PJException.java package-info.java \ - LatLong.java Others.java Proj4Factory.java Proj4.java \ - ProjectionData.java Projections.java +EXTRA_DIST = PJ.java PJException.java package-info.java all: all-am diff --git a/jniwrap/org/proj4/Others.java b/jniwrap/org/proj4/Others.java deleted file mode 100644 index d87a9ab1..00000000 --- a/jniwrap/org/proj4/Others.java +++ /dev/null @@ -1,73 +0,0 @@ -/**===================================================================================== - - FILE: Others.java - - DESCRIPTION: class representing a generic projection, i.e. with no particular preprocessing needs. - - NOTES: --- - AUTHOR: Antonello Andrea - EMAIL: andrea.antonello@hydrologis.com - COMPANY: HydroloGIS / Engineering, University of Trento / CUDAM - COPYRIGHT: Copyright (C) 2004 HydroloGIS / University of Trento / CUDAM, ITALY, GPL - VERSION: $version$ - CREATED OR MODIFIED: Oct 15, 2004 - REVISION: --- - =====================================================================================*/ - -/* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - */ -package org.proj4; - -/** - * class representing a generic projection, i.e. with no particular - * preprocessing needs. - * - * @deprecated Replaced by {@link PJ}, which doesn't need special subclass for this case. - * The conversion of angular values, if needed, is performed directly in the {@link PJ} - * native code, because the native code can more easily exploit the information provided - * by Proj.4 about the CRS type. - */ -@Deprecated -public class Others extends Projections -{ - - public Others(String src) - { - proj = src; - } - - /* (non-Javadoc) - * @see Projections#prepareData(DataToProject) - */ - public void prepareData(ProjectionData dataTP) - { - } - - /* (non-Javadoc) - * @see java.Projections#returnTransformedCoordinates() - */ - public void prepareTransformedData(ProjectionData dataTP) - { - } - -} diff --git a/jniwrap/org/proj4/Proj4.java b/jniwrap/org/proj4/Proj4.java deleted file mode 100644 index d2fe8b72..00000000 --- a/jniwrap/org/proj4/Proj4.java +++ /dev/null @@ -1,189 +0,0 @@ -/**===================================================================================== - - FILE: Proj4.java - - DESCRIPTION: - - NOTES: --- - AUTHOR: Antonello Andrea - EMAIL: andrea.antonello@hydrologis.com - COMPANY: HydroloGIS / Engineering, University of Trento / CUDAM - COPYRIGHT: Copyright (C) 2004 HydroloGIS / University of Trento / CUDAM, ITALY, GPL - VERSION: $version$ - CREATED OR MODIFIED: Oct 15, 2004 - REVISION: --- - =====================================================================================*/ - -/* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - */ -package org.proj4; - -import java.util.LinkedHashMap; - -/** - * This is the public - * test class to try the jproj api. Reads data from file. - * The input file has three lines of header:<BR> - * 1) source projection code or option <BR> - * 2) destination projection code or option<BR> - * 3) rows of the data<BR> - * and after the header the data are put in the format: - * x0 y0 z0 - * x1 y1 z1 - * x2 y2 z2 - *...etc etc - * - * example: - * srcProj: +proj=latlong +datum=WGS84 - * destProj: +init=epsg:32632 - * rows: 2 - * ...datatriplets - * - * @deprecated Replaced by {@link PJ}. See package description for usage example. - */ -@Deprecated -public class Proj4 implements Proj4Factory -{ - Projections srcProjection = null; - Projections destProjection = null; - Projections projection = null; - - /** - * constructor used to instatiate a single projection. This is used - * if the goal is to simply get information about a projection definition - * - * @param proj the projection definition - */ - public Proj4(String proj) - { - if (proj.indexOf("latlong") != -1) - { - projection = new LatLong(proj); - } - else - { - projection = new Others(proj); - } - } - - /** - * constructor used to instantiate the object for a further reproiection. - * From the definitions the source and destination projection are - * created. - * - * @param srcProj - * @param destProj - */ - public Proj4(String srcProj, String destProj) - { - if (srcProj.indexOf("latlong") != -1) - { - srcProjection = new LatLong(srcProj); - } - else - { - srcProjection = new Others(srcProj); - } - if (destProj.indexOf("latlong") != -1) - { - destProjection = new LatLong(destProj); - } - else - { - destProjection = new Others(destProj); - } - } - - /** - * method to reproject a dataset from the source projection to the destination - * projection as defined in the constructor - * - * @param dataTP the data set to reproject - * @param point_count - * @param point_offset - */ - public void transform(ProjectionData dataTP, long point_count, int point_offset) - { - srcProjection.prepareData(dataTP); - destProjection.doTheTransform(srcProjection, dataTP, point_count, - point_offset); - destProjection.prepareTransformedData(dataTP); - - System.out.println("Transformed coordinates and values:"); - for (int i = 0; i < dataTP.rows; i++) - { - System.out.println("x = " + dataTP.x[i] + " y = " + dataTP.y[i] + " z = " - + dataTP.z[i]); - } - } - - /** - * @return the projection info as a hashmap - */ - public LinkedHashMap getProjInfo() - { - return projection.mapProjInfo(); - } - - /** - * @return the source projection info as a hashmap - */ - public LinkedHashMap getSrcProjInfo() - { - return srcProjection.mapProjInfo(); - } - - /** - * @return the destination projection info as a hashmap - */ - public LinkedHashMap getDestProjInfo() - { - return destProjection.mapProjInfo(); - } - - - /** - * print the projection info to standard output - */ - public void printProjInfo() - { - projection.printProjInfo(); - } - - /** - * print the source projection info to standard output - */ - public void printSrcProjInfo() - { - srcProjection.printProjInfo(); - } - - /** - * print the destination projection info to standard output - */ - public void printDestProjInfo() - { - destProjection.printProjInfo(); - } - -} diff --git a/jniwrap/org/proj4/Proj4Factory.java b/jniwrap/org/proj4/Proj4Factory.java deleted file mode 100644 index e9998a7b..00000000 --- a/jniwrap/org/proj4/Proj4Factory.java +++ /dev/null @@ -1,77 +0,0 @@ -/**===================================================================================== - - FILE: Proj4Factory.java - - DESCRIPTION: - - NOTES: --- - AUTHOR: Antonello Andrea - EMAIL: andrea.antonello@hydrologis.com - COMPANY: HydroloGIS / Engineering, University of Trento / CUDAM - COPYRIGHT: Copyright (C) 2004 HydroloGIS / University of Trento / CUDAM, ITALY, GPL - VERSION: $version$ - CREATED OR MODIFIED: Oct 21, 2004 - REVISION: --- -=====================================================================================*/ - -/* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -*/ - -package org.proj4; - -import java.util.LinkedHashMap; - - - -/** - * @deprecated Replaced by {@link PJ}. See package description for usage example. - */ -@Deprecated -public interface Proj4Factory -{ - /** - * method to reproject a dataset from the source projection to the destination - * projection as defined in the constructor - * - * @param dataTP the data set to reproject - * @param point_count - * @param point_offset - */ - public void transform(ProjectionData dataTP, long point_count, int point_offset); - - /** - * @return the projection info as a hashmap - */ - public LinkedHashMap getProjInfo(); - - /** - * @return the source projection info as a hashmap - */ - public LinkedHashMap getSrcProjInfo(); - - /** - * @return the destination projection info as a hashmap - */ - public LinkedHashMap getDestProjInfo(); - -} diff --git a/jniwrap/org/proj4/ProjectionData.java b/jniwrap/org/proj4/ProjectionData.java deleted file mode 100644 index 8ee72772..00000000 --- a/jniwrap/org/proj4/ProjectionData.java +++ /dev/null @@ -1,78 +0,0 @@ -/**===================================================================================== - - FILE: DataToProject.java - - DESCRIPTION: class representing the dataset to be reprojected - - NOTES: --- - AUTHOR: Antonello Andrea - EMAIL: andrea.antonello@hydrologis.com - COMPANY: HydroloGIS / Engineering, University of Trento / CUDAM - COPYRIGHT: Copyright (C) 2004 HydroloGIS / University of Trento / CUDAM, ITALY, GPL - VERSION: $version$ - CREATED OR MODIFIED: Oct 18, 2004 - REVISION: --- - =====================================================================================*/ - -/* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - */ -package org.proj4; - -/** - * class representing the dataset to be reprojected - * - * @deprecated The new {@link PJ} class uses a different layout for coordinate values. - * The new layout is the same than the one used by {@link java.awt.geom.AffineTransform} - * in Java2D: tuples of (<var>x</var>,<var>y</var>,<<var>y</var>>) coordinates in - * a single flat array. - */ -@Deprecated -public class ProjectionData -{ - - // the variables are kept public, since they are transformed passing through - // two classes - public double[] x = null; - public double[] y = null; - public double[] z = null; - public int rows = 0; - - /** - * object to hold the data to be transformed. This will be passed from - * the starting projection object to the destinantion projection passing through - * the transformation. - */ - public ProjectionData(double[][] _coord, double[] _values) - { - rows = _coord.length; - x = new double[rows]; - y = new double[rows]; - - for (int i = 0; i < rows; i++) - { - x[i] = _coord[i][0]; - y[i] = _coord[i][1]; - } - z = _values; - } -} diff --git a/jniwrap/org/proj4/Projections.java b/jniwrap/org/proj4/Projections.java deleted file mode 100644 index 61892074..00000000 --- a/jniwrap/org/proj4/Projections.java +++ /dev/null @@ -1,318 +0,0 @@ -/**===================================================================================== - - FILE: Projections.java - - DESCRIPTION: - - NOTES: --- - AUTHOR: Antonello Andrea - EMAIL: andrea.antonello@hydrologis.com - COMPANY: HydroloGIS / Engineering, University of Trento / CUDAM - COPYRIGHT: Copyright (C) 2004 HydroloGIS / University of Trento / CUDAM, ITALY, GPL - VERSION: $version$ - CREATED OR MODIFIED: Oct 15, 2004 - REVISION: --- - =====================================================================================*/ - -/* - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - */ -package org.proj4; - -import java.util.LinkedHashMap; - -/** - * superclass of all the projections the main proj methods are held here - * - * @deprecated Replaced by {@link PJ}. - */ -@Deprecated -public abstract class Projections -{ - - double degtorad = .0174532925199432958; - double radtodeg = 57.29577951308232; - - String proj = null; - /** - * Comment for <code>projParameters</code> - * it is a hashmap that contains all the parameters that - * define the projection. Usually that can be:<BR> - * +init<BR> - * +proj<BR> - * +zone<BR> - * +ellps<BR> - * +datum<BR> - * +units<BR> - * +no_defs<BR> - * +ellps<BR> - * +towgs84<BR> - *<BR> - * ELLIPSOID INFO:<BR> - * name<BR> - * a<BR> - * e<BR> - * es<BR> - * ra<BR> - * one_es<BR> - * rone_es<BR> - * lam0<BR> - * phi0<BR> - * x0<BR> - * y0<BR> - * k0<BR> - * to_meter<BR> - * fr_meter<BR> - */ - private LinkedHashMap projParameters = null; - - static - { - System.loadLibrary("proj"); - } - - /** - * get all the projection informations needed from the - * projection code (reproduces pj_get_def() of the proj api) - * - * @param the proj code or options - * @return the info String - * - * @deprecated Replaced by {@link PJ#getDefinition()}. - */ - @Deprecated - protected native String getProjInfo(String proj); - - /** - * get the ellipsoid parameters from the - * projection code - * - * @param the proj code or options - * @return the info String - * - * @deprecated Replaced by {@link PJ#getSemiMajorAxis()}, {@link PJ#getSemiMinorAxis()}, - * {@link PJ#getEccentricitySquared()} and {@link PJ#getDefinition()}. - */ - @Deprecated - protected native String getEllipsInfo(String proj); - - /** - * native call to the reprojections routines of proj - * - * @param firstCoord array of x - * @param secondCoord array of y - * @param values array of z - * @param srcCodeString source projection code or option - * @param destCodeString destination projection code or option - * @param pointcount - * @param pointoffset - * - * @deprecated Replaced by {@link PJ#transform(PJ, int, double[], int, int)}. - */ - @Deprecated - protected native void transform(double[] firstCoord, double[] secondCoord, - double[] values, String srcCodeString, String destCodeString, - long pointcount, int pointoffset); - - /** - * public method to call the native getProjInfo - * - * @return quoting the proj api:"Returns the PROJ.4 command string that - * would produce this definition expanded as much as possible. For - * instance, +init= calls and +datum= defintions would be expanded" - * - * @deprecated Replaced by {@link PJ#getDefinition()}. - */ - @Deprecated - public String getProjInfo() - { - return getProjInfo(proj); - } - - /** - * public method to call the native getEllispdInfo - * - * @return the list of ellipsoid parameters - * - * @deprecated Replaced by {@link PJ#getSemiMajorAxis()}, {@link PJ#getSemiMinorAxis()}, - * {@link PJ#getEccentricitySquared()} and {@link PJ#getDefinition()}. - */ - @Deprecated - public String getEllipseInfo() - { - return getEllipsInfo(proj); - } - - /** - * print to standard output the proj info in a nice format - * - * @deprecated Replaced by {@link PJ#toString()}. - */ - @Deprecated - public void printProjInfo() - { - String projinfo = getProjInfo(); - - System.out.println(); - System.out - .println("******************************************************"); - System.out.println("* PROJECTION INFO:"); - System.out.println("*"); - String[] infos = projinfo.split("\\+"); - for (int i = 0; i < infos.length - 1; i++) - { - System.out.println("* +" + infos[i + 1].trim()); - } - System.out.println("*"); - System.out.println("* ELLIPSOID INFO:"); - System.out.println("*"); - String ellipsinfo = getEllipseInfo(); - String[] ellipsoid = ellipsinfo.split(";"); - for (int i = 0; i < ellipsoid.length; i++) - { - System.out.println("* " + ellipsoid[i].trim()); - } - - System.out - .println("******************************************************"); - System.out.println(); - } - - /** - * return all the proj info into a Linked Hashmap - */ - public LinkedHashMap mapProjInfo() - { - projParameters = new LinkedHashMap(); - String projinfo = getProjInfo(); - - String[] infos = projinfo.split("\\+"); - for (int i = 0; i < infos.length - 1; i++) - { - String[] pairs = infos[i + 1].split("="); - if (pairs.length == 1 && pairs[0].equals("no_defs")) - { - projParameters.put(pairs[0].trim(), "defined"); - } - else if (pairs.length == 1 && !pairs[0].equals("no_defs")) - { - projParameters.put(pairs[0].trim(), ""); - } - else - { - projParameters.put(pairs[0].trim(), pairs[1].trim()); - } - } - - String ellipsinfo = getEllipseInfo(); - String[] ellipsoid = ellipsinfo.split(";"); - for (int i = 0; i < ellipsoid.length; i++) - { - String[] pairs2 = ellipsoid[i].split(":"); - projParameters.put(pairs2[0].trim(), pairs2[1].trim()); - } - - return projParameters; - } - - /** - * if there is some operation to perform on the input data, this is - * the right moment (ex. latlong from degree to radiant) - * -> i.e. do whatever is needed - * - * @param dataTP - * - * @deprecated The conversion from degrees to radians is now performed directly by - * {@link PJ#transform(PJ, int, double[], int, int)}. - */ - @Deprecated - public abstract void prepareData(ProjectionData dataTP); - - /** - * do the transform. The srcProjection is passed to the destination proj and - * the transformation takes place. Then the resulting transformed data - * are passed to the destProj, so that the destProj in case can take care of - * final transformation of data (ex. if the destProj is latlong, the values - * have to be set beck to degrees - * - * @param srcProj object holding the source projection - * @param dataTP the data set - * @param point_count - * @param point_offset - */ - protected void doTheTransform(Projections srcProj, ProjectionData dataTP, - long point_count, int point_offset) - { - transform(dataTP.x, dataTP.y, dataTP.z, srcProj.proj, proj, point_count, - point_offset); - } - - /** - * this takes care that the reprojected data are in the correct format - * (ex. latlong has to be transformed back to radiant) - * - * @param dataTP the data set - * - * @deprecated The conversion from radians to degrees is now performed directly by - * {@link PJ#transform(PJ, int, double[], int, int)}. - */ - @Deprecated - public abstract void prepareTransformedData(ProjectionData dataTP); - - /** - * transform latitude and longitude from degree to radiant format - * - * @param la - * @param lo - * - * @deprecated The conversion from degrees to radians is now performed directly by - * {@link PJ#transform(PJ, int, double[], int, int)}. - */ - @Deprecated - protected void degreeToRadiant(double[] la, double[] lo) - { - for (int i = 0; i < la.length; i++) - { - la[i] = la[i] * degtorad; - lo[i] = lo[i] * degtorad; - } - } - - /** - * transform latitude and longitude from radiant to degree format - * - * @param la - * @param lo - * - * @deprecated The conversion from radians to degrees is now performed directly by - * {@link PJ#transform(PJ, int, double[], int, int)}. - */ - @Deprecated - protected void radiantToDegree(double[] la, double[] lo) - { - for (int i = 0; i < la.length; i++) - { - la[i] = la[i] * radtodeg; - lo[i] = lo[i] * radtodeg; - } - } -} diff --git a/src/jniproj.c b/src/jniproj.c index a0d9180b..5db64051 100644 --- a/src/jniproj.c +++ b/src/jniproj.c @@ -478,175 +478,4 @@ JNIEXPORT void JNICALL Java_org_proj4_PJ_finalize } } - - - -/* =============================================================================================== - * - * Below this point are the previous JNI bindings that existed in the legacy org.proj4.Projections - * class before the new bindings defined above. We keep those binding for now, but may remove them - * in a future version. There is a few issues with the code below: - * - * 1) Every call to (*env)->GetStringUTFChars(...) shall have a corresponding call to - * (*env)->ReleaseStringUTFChars(...). - * - * 2) Every call to (*env)->GetFoo(...) shall check for NULL return value. If the return - * value is NULL, than a java.lang.OutOfMemoryError has already been thrown in the JVM; - * we just need to return from the C method after releasing allocated objects (if any). - * - * 3) If a Proj.4 method fails to execute, we should invoke (*env)->ThrowNew(...) instead - * than exit(1) in order to throw an exception in the Java program instead than stopping - * the JVM. - * - * 4) We should check the user arguments for null values or index out of bounds, and - * throw the appropriate Java exception if an argument is invalid. - */ - -#include "org_proj4_Projections.h" - -#define arraysize 300 - -/*! - * \brief - * executes reprojection - * - * JNI informations: - * Class: org_proj4_Projections - * Method: transform - * Signature: ([D[D[DLjava/lang/String;Ljava/lang/String;JI)V - * - * - * \param env - parameter used by jni (see JNI specification) - * \param parent - parameter used by jni (see JNI specification) - * \param firstcoord - array of x coordinates - * \param secondcoord - array of y coordinates - * \param values - array of z coordinates - * \param src - definition of the source projection - * \param dest - definition of the destination projection - * \param pcount - * \param poffset -*/ -JNIEXPORT void JNICALL Java_org_proj4_Projections_transform - (JNIEnv * env, jobject parent, jdoubleArray firstcoord, jdoubleArray secondcoord, jdoubleArray values, jstring src, jstring dest, jlong pcount, jint poffset) -{ - int i; - projPJ src_pj, dst_pj; - char * srcproj_def = (char *) (*env)->GetStringUTFChars (env, src, 0); - char * destproj_def = (char *) (*env)->GetStringUTFChars (env, dest, 0); - - if (!(src_pj = pj_init_plus(srcproj_def))) - exit(1); - if (!(dst_pj = pj_init_plus(destproj_def))) - exit(1); - - double *xcoord = (* env)-> GetDoubleArrayElements(env, firstcoord, NULL); - double *ycoord = (* env) -> GetDoubleArrayElements(env, secondcoord, NULL); - double *zcoord = (* env) -> GetDoubleArrayElements(env, values, NULL); - - pj_transform( src_pj, dst_pj, pcount,poffset, xcoord, ycoord, zcoord); - - (* env)->ReleaseDoubleArrayElements(env,firstcoord,(jdouble *) xcoord, 0); - (* env)->ReleaseDoubleArrayElements(env,secondcoord,(jdouble *) ycoord, 0); - (* env)->ReleaseDoubleArrayElements(env,values,(jdouble *) zcoord, 0); - - pj_free( src_pj ); - pj_free( dst_pj ); -} - -/*! - * \brief - * retrieves projection parameters - * - * JNI informations: - * Class: org_proj4_Projections - * Method: getProjInfo - * Signature: (Ljava/lang/String;)Ljava/lang/String; - * - * - * \param env - parameter used by jni (see JNI specification) - * \param parent - parameter used by jni (see JNI specification) - * \param projdefinition - definition of the projection -*/ -JNIEXPORT jstring JNICALL Java_org_proj4_Projections_getProjInfo - (JNIEnv * env, jobject parent, jstring projdefinition) -{ - PJ *pj; - char * pjdesc; - char info[arraysize]; - - char * proj_def = (char *) (*env)->GetStringUTFChars (env, projdefinition, 0); - - if (!(pj = pj_init_plus(proj_def))) - exit(1); - - /* put together all the info of the projection and free the pointer to pjdesc */ - pjdesc = pj_get_def(pj, 0); - strcpy(info,pjdesc); - pj_dalloc(pjdesc); - - return (*env)->NewStringUTF(env,info); -} - - -/*! - * \brief - * retrieves ellipsoid parameters - * - * JNI informations: - * Class: org_proj4_Projections - * Method: getEllipsInfo - * Signature: (Ljava/lang/String;)Ljava/lang/String; - * - * - * \param env - parameter used by jni (see JNI specification) - * \param parent - parameter used by jni (see JNI specification) - * \param projdefinition - definition of the projection -*/ -JNIEXPORT jstring JNICALL Java_org_proj4_Projections_getEllipsInfo - (JNIEnv * env, jobject parent, jstring projdefinition) -{ - PJ *pj; - char * pjdesc; - char ellipseinfo[arraysize]; - char temp[50]; - - char * proj_def = (char *) (*env)->GetStringUTFChars (env, projdefinition, 0); - - if (!(pj = pj_init_plus(proj_def))) - exit(1); - - /* put together all the info of the ellipsoid */ -/* sprintf(temp,"name: %s;", pj->descr); */ - sprintf(temp,"name: not available;"); - strcpy(ellipseinfo,temp); - sprintf(temp,"a: %lf;", pj->a); - strcat(ellipseinfo,temp); - sprintf(temp,"e: %lf;", pj->e); - strcat(ellipseinfo,temp); - sprintf(temp,"es: %lf;", pj->es); - strcat(ellipseinfo,temp); - sprintf(temp,"ra: %lf;", pj->ra); - strcat(ellipseinfo,temp); - sprintf(temp,"one_es: %lf;", pj->one_es); - strcat(ellipseinfo,temp); - sprintf(temp,"rone_es: %lf;", pj->rone_es); - strcat(ellipseinfo,temp); - sprintf(temp,"lam0: %lf;", pj->lam0); - strcat(ellipseinfo,temp); - sprintf(temp,"phi0: %lf;", pj->phi0); - strcat(ellipseinfo,temp); - sprintf(temp,"x0: %lf;", pj->x0); - strcat(ellipseinfo,temp); - sprintf(temp,"y0: %lf;", pj->y0); - strcat(ellipseinfo,temp); - sprintf(temp,"k0: %lf;", pj->k0); - strcat(ellipseinfo,temp); - sprintf(temp,"to_meter: %lf;", pj->to_meter); - strcat(ellipseinfo,temp); - sprintf(temp,"fr_meter: %lf;", pj->fr_meter); - strcat(ellipseinfo,temp); - - return (*env)->NewStringUTF(env,ellipseinfo); -} - #endif |
