diff options
| author | Andrea Antonello <andrea.antonello@gmail.com> | 2004-10-25 20:25:48 +0000 |
|---|---|---|
| committer | Andrea Antonello <andrea.antonello@gmail.com> | 2004-10-25 20:25:48 +0000 |
| commit | 1dec4c292e5cac713cb0b96338de0b60932f97ad (patch) | |
| tree | baf6de41bcee8518ce0fccac8bf26bd7ffb145e4 /jniwrap | |
| parent | debb30580d1638639e7b50935664caff7042f9ab (diff) | |
| download | PROJ-1dec4c292e5cac713cb0b96338de0b60932f97ad.tar.gz PROJ-1dec4c292e5cac713cb0b96338de0b60932f97ad.zip | |
deleted the no longer needed native parts that were moved into the proj source
folder and the to them regarding targets in the build file - Andrea A.
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1248 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'jniwrap')
| -rw-r--r-- | jniwrap/Makefile | 131 | ||||
| -rw-r--r-- | jniwrap/README | 13 | ||||
| -rw-r--r-- | jniwrap/build.xml | 9 | ||||
| -rw-r--r-- | jniwrap/native/jniproj.c | 170 | ||||
| -rw-r--r-- | jniwrap/native/org_proj4_Projections.h | 37 |
5 files changed, 16 insertions, 344 deletions
diff --git a/jniwrap/Makefile b/jniwrap/Makefile deleted file mode 100644 index 56f4d72a..00000000 --- a/jniwrap/Makefile +++ /dev/null @@ -1,131 +0,0 @@ -# ===================================================================================== -# -# FILE: Makefile -# -# DESCRIPTION: -# -# NOTES: --- -# AUTHOR: Antonello Andrea -# EMAIL: andrea.antonello@hydrologis.com -# COMPANY: HydroloGIS / Engineering, University of Trento / CUDAM -# COPYRIGHT: Copyright (C) HydroloGIS, GPL -# VERSION: 1.0 -# CREATED: 10/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. - - - -## JAVA related vars -# jdk_home=$(JDK_HOME) -jdk_home=/usr/java/j2sdk1.4.2_05/ - -# -# Windows (no idea on how to do this well) -# -ifeq ($(findstring Windows_, $(OS)), Windows_) - OS_DEFINED = GNUmakefile - ARCH = i386 - OSNAME = WIN32 - COMPILER = VC -else -# -# Linux -# -ifeq ($(findstring inux, $(OSTYPE)), inux) - LIBEXT:=so - # instructs gcc to produce shared library instead of executable module - SO_FLAGS = -shared # Linux 2.x - JNI_H = -I$(jdk_home)/include/linux/ -I$(jdk_home)/include/ - COMPILER= gcc -else - -# -# Solaris (no idea on how to do this well) -# -ifeq ($(OS), Solaris) - COMPILER = CC -else -# -# Mac OS X -# -ifeq ($(findstring darwin, $(OSTYPE)), darwin) - LIBEXT:=a - # instructs gcc to produce shared library instead of executable module - SO_FLAGS = -bundle - framework System # MacOsX - # location of OS dependent JNI headers for C programs - JNI_H = /System/Library/Frameworks/JavaVM.framework/1.3.1/Headers/ # MacOsX - COMPILER = cc -else - COMPILER = baubau -endif -endif -endif -endif - - -#### ###################################################################### -#### -#### Set values of the following variables to match your system ########### - - - -## PROJ-related variables #### -# directory in the PROJ source tree that contains header files -# PROJINCLUDES = -I.. - -# directory in the PROJ source tree that contains the proj libs to be included -# PROJLIBDIR = -L../.libs - -# libraries to include -LIBS = -lproj - -# source directory -SRC_DIR = native - -## other variables #### -DEST = . -DEBUG = -g -DEST_LIB= libs - -## C-related settings #### -CC = $(COMPILER) $(DEBUG) - -#### This is the end of configuration section ############################## -#### -############################################################################ - -# the C sources -SRC = ${SRC_DIR}/jniproj.c - -# Standard Targets - -# makes all libraries and executables with debug option if not unset -# does not make any of documentation -all: libjproj.$(LIBEXT) - -libjproj.$(LIBEXT): ${SRC} - $(CC) $(SO_FLAGS) -o ${DEST_LIB}/$@ $(SRC) ${PROJINCLUDES} ${JNI_H} $(PROJLIBDIR) $(LIBS) diff --git a/jniwrap/README b/jniwrap/README index 05a015f5..0489d450 100644 --- a/jniwrap/README +++ b/jniwrap/README @@ -4,7 +4,7 @@ This is the first release of a JNI wrap of the main proj4 functions. PLEASE read the following information. -For more information on the JPROJ4 maintenance please contact me through the +For more information regarding JPROJ4 please contact me through the web page at: http://www.hydrologis.com @@ -12,6 +12,12 @@ web page at: --------------------------------------------------- +What is JPROJ4: +------------- + +JPROJ is a small library of java classes that wrap a few proj functions by +using the java native interface. + Compilation: ------------- @@ -20,7 +26,7 @@ With the right flag during configuration time (see ./configure --help), the native part of the jproj lib is compiled inside the main proj library and the java part is automatically built into the jproj.jar library. -The java part on it's own part is compiled by running ant inside the "jniwrap" folder. +The java part as standalone is compiled by running ant inside the "jniwrap" folder. This will compile the classes and archive them in a jar library. This applies to Linux, Macos and Windows (and virtually to every system supporting java). @@ -42,6 +48,9 @@ The documentation is held inside the code and can be retrieved by running doxygen inside the folder jniwrap. This will create the html format documentation inside of jniwrap/docs +The standard way to achive this is to use an ant target: +ant do_make_help + License: -------- diff --git a/jniwrap/build.xml b/jniwrap/build.xml index a303cd94..8f181dd8 100644 --- a/jniwrap/build.xml +++ b/jniwrap/build.xml @@ -11,7 +11,7 @@ <!-- ******************************************* --> <!-- start everything (default target) --> <!-- ******************************************* --> - <target name="compile" depends="start, do_javac, do_javah, do_make, do_make_help, jar_it"> + <target name="compile" depends="start, do_javac, jar_it"> <echo>Compilation finished...</echo> </target> @@ -35,9 +35,13 @@ </javac> </target> + + <!-- ******************************************* --> <!-- execute javah for JNI headers --> <!-- ******************************************* --> + <!-- needed if something if new native methods are added --> + <!-- ******************************************* --> <target name="do_javah" depends="do_javac"> <echo>Creating jni headers...</echo> <exec dir="${build}" executable="javah" os="Linux"> @@ -65,9 +69,6 @@ <jar destfile="${libs}/jproj.jar" basedir="${build}/"> <manifest> <attribute name="Built-By" value="the jgrass idealists"/> - <!-- <section name="jgrass.gui.Main.class"> --> - <!-- <attribute name="Sealed" value="false"/> --> - <!-- </section> --> </manifest> </jar> <delete dir="${build}"/> diff --git a/jniwrap/native/jniproj.c b/jniwrap/native/jniproj.c deleted file mode 100644 index 5e180f95..00000000 --- a/jniwrap/native/jniproj.c +++ /dev/null @@ -1,170 +0,0 @@ -/*! -* \file jniproj.c -* -* \brief -* functions used by the java/jni wrappers of jproj4 -* -* -* $Id$ -* -* \author Antonello Andrea -* \date Wed Oct 20 23:10:24 CEST 2004 -*/ -#include <projects.h> -#include "org_proj4_Projections.h" -#include <jni.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); - - jint sizeofdata = (*env)->GetArrayLength(env, firstcoord); - for(i = 0;i<sizeofdata;i++) - { - pj_transform( src_pj, dst_pj, pcount,poffset, xcoord, ycoord, zcoord); - xcoord++; - ycoord++; - zcoord++; - } - xcoord = xcoord - sizeofdata; - ycoord = ycoord - sizeofdata; - zcoord = zcoord - sizeofdata; - - (* env)->ReleaseDoubleArrayElements(env,firstcoord,(jdouble *) xcoord,JNI_COMMIT); - (* env)->ReleaseDoubleArrayElements(env,secondcoord,(jdouble *) ycoord,JNI_COMMIT); - (* env)->ReleaseDoubleArrayElements(env,values,(jdouble *) zcoord,JNI_COMMIT); - - 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); -} diff --git a/jniwrap/native/org_proj4_Projections.h b/jniwrap/native/org_proj4_Projections.h deleted file mode 100644 index 3841e057..00000000 --- a/jniwrap/native/org_proj4_Projections.h +++ /dev/null @@ -1,37 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class org_proj4_Projections */ - -#ifndef _Included_org_proj4_Projections -#define _Included_org_proj4_Projections -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_proj4_Projections - * Method: getProjInfo - * Signature: (Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_org_proj4_Projections_getProjInfo - (JNIEnv *, jobject, jstring); - -/* - * Class: org_proj4_Projections - * Method: getEllipsInfo - * Signature: (Ljava/lang/String;)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_org_proj4_Projections_getEllipsInfo - (JNIEnv *, jobject, jstring); - -/* - * Class: org_proj4_Projections - * Method: transform - * Signature: ([D[D[DLjava/lang/String;Ljava/lang/String;JI)V - */ -JNIEXPORT void JNICALL Java_org_proj4_Projections_transform - (JNIEnv *, jobject, jdoubleArray, jdoubleArray, jdoubleArray, jstring, jstring, jlong, jint); - -#ifdef __cplusplus -} -#endif -#endif |
