[Proj] Re: JNI api for Proj4
Frank Warmerdam
fwarmerdam at gmail.com
Tue Jul 5 12:27:32 EDT 2005
Steffen,
I agree with your analysis and I have committed the suggested
changes in CVS.
On 7/5/05, skoehler at buschjena.de <skoehler at buschjena.de> wrote:
> Hello,
>
> I installed the proj4 version 4.4.9 on my pc using cygwin. After a hard
> work to create an dll with the cygwin I found a small error in
> the jniproj.c
> In function transform the proj4-function pj_transform is called. This
> functions has three double fields, count and offset as parameter.
> So the loop is wrong with the count and offset parameter from the funtion
> parameter. I will send you my modified version:
>
> 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);
>
> jdouble *xcoord = (* env)-> GetDoubleArrayElements(env,
> firstcoord, NULL);
> jdouble *ycoord = (* env) -> GetDoubleArrayElements(env,
> secondcoord, NULL);
> jdouble *zcoord = (* env) -> GetDoubleArrayElements(env,
> values, NULL);
>
> pj_transform( src_pj, dst_pj, pcount,poffset, xcoord, ycoord,
> zcoord);
>
> (* env)->ReleaseDoubleArrayElements(env,firstcoord,xcoord,0);
> (* env)->ReleaseDoubleArrayElements(env,secondcoord,ycoord,0);
> (* env)->ReleaseDoubleArrayElements(env,values,zcoord,0);
>
> pj_free( src_pj );
> pj_free( dst_pj );
> }
>
> with best regards
> Steffen Köhler
>
>
>
> ---------------------------------------------------------------------------
> 3Kon GmbH Informationstechnologie
> Softwareentwicklung
> Fregestrasse 6/8
> D-07747 Jena
> Tel.: +49 3641/30 38-34
> Fax.: +49 3641/30 38-610
> www.buschjena.de
>
>
>
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Proj
mailing list