Revision 17339
trunk/libraries/libjni-addo/makefile.w32 | ||
---|---|---|
13 | 13 |
LIBR = /LIBPATH:"C:\Archivos de programa\Microsoft Visual Studio\VC98\Lib" |
14 | 14 |
DSTNO_LIB = "C:\windows\system32" |
15 | 15 |
PATH_LIBS = ../binaries/w32/raster/gdal |
16 |
LIB_EXTERNAS = $(PATH_LIBS)/gdal.lib $(PATH_LIBS)/gdal_i.lib $(PATH_LIBS)/libtiff.lib
|
|
16 |
LIB_EXTERNAS = $(PATH_LIBS)/gdal.lib $(PATH_LIBS)/libtiff.lib |
|
17 | 17 |
|
18 | 18 |
#Compiladores y Programas |
19 | 19 |
|
... | ... | |
48 | 48 |
|
49 | 49 |
JAR_ADDO = $(JADDO)-$(VER).jar |
50 | 50 |
|
51 |
FLAGS = -c -W3 -D_X86_=1 -DDLL -DWIN32 -GX -MD -Zi -Od |
|
52 |
STAT_LIB = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib $(LIB_EXTERNAS) |
|
53 |
OPC_LINK = /nologo /dll /machine:I386 /incremental:yes /pdb:"$(NOM_LIB).pdb" /debug /out:"$(NOM_LIB).dll" /implib:"$(NOM_LIB).lib" |
|
51 |
#FLAGS = -c -W3 -D_X86_=1 -DDLL -DWIN32 -GX -MD -Zi -Od |
|
52 |
FLAGS = -c -W3 -DDLL -GX -MD -Zi -Od |
|
53 |
STAT_LIB = $(LIB_EXTERNAS) |
|
54 |
#OPC_LINK = /nologo /dll /machine:I386 /incremental:yes /pdb:"$(NOM_LIB).pdb" /debug /out:"$(NOM_LIB).dll" /implib:"$(NOM_LIB).lib" |
|
55 |
OPC_LINK = /dll /debug /out:"$(NOM_LIB).dll" /implib:"$(NOM_LIB).lib" |
|
54 | 56 |
|
55 | 57 |
|
56 | 58 |
#*********************************************************************************** |
... | ... | |
58 | 60 |
default: java jar $(OBJS) libr |
59 | 61 |
|
60 | 62 |
addo_interfaz.obj: |
61 |
$(CC) $(FLAGS) $(INCLUDE) $(SRC)/addo_interfaz.c
|
|
63 |
$(CC) $(CPPFLAGS) -c -W3 -DDLL -GX -MD -Zi -Od $(INCLUDE) $(SRC)/addo_interfaz.cpp
|
|
62 | 64 |
|
63 | 65 |
libr: |
64 |
link $(STAT_LIB) $(OPC_LINK) $(LIBR) $(OBJS)
|
|
66 |
link /dll /debug $(LIBR) $(LIB_EXTERNAS) /out:$(NOM_LIB).dll /implib:$(NOM_LIB).lib $(OBJS)
|
|
65 | 67 |
move $(NOM_LIB).dll dist |
66 | 68 |
move $(NOM_LIB).lib dist |
67 | 69 |
move $(NOM_LIB).ilk dist |
trunk/libraries/libjni-addo/src/addo_interfaz.cpp | ||
---|---|---|
1 |
#include <jni.h> |
|
2 |
#include "org_gvsig_addo_Jaddo.h" |
|
3 |
#include "gdal_priv.h" |
|
4 |
#include "cpl_string.h" |
|
5 |
|
|
6 |
jobject *jni_obj; |
|
7 |
JNIEnv *jni_env; |
|
8 |
|
|
9 |
|
|
10 |
int CPL_STDCALL incrementFnc( double dfComplete, const char *pszMessage, void * pProgressArg ) { |
|
11 |
jclass class_incr; |
|
12 |
jmethodID method; |
|
13 |
int value = 0; |
|
14 |
|
|
15 |
value = (int)(dfComplete * 100); |
|
16 |
class_incr = jni_env->FindClass ("org/gvsig/addo/IOverviewIncrement"); |
|
17 |
|
|
18 |
method = jni_env->GetMethodID( class_incr, "setPercent", "(I)V"); |
|
19 |
jni_env->CallVoidMethod( (*jni_obj), method, value); |
|
20 |
return 1; |
|
21 |
} |
|
22 |
|
|
23 |
JNIEXPORT jint JNICALL Java_org_gvsig_addo_Jaddo_buildOverviewsNative |
|
24 |
(JNIEnv *env, jobject obj, jint method, jstring file, jintArray values) { |
|
25 |
int err = 0; |
|
26 |
jsize lon = 0; |
|
27 |
int i = 0; |
|
28 |
jint *listValues = NULL; |
|
29 |
GDALDataset *poDataset; |
|
30 |
int anLevels[1024]; |
|
31 |
const char * pszResampling = "nearest"; |
|
32 |
const char *filename = env->GetStringUTFChars( file, 0); |
|
33 |
lon = env->GetArrayLength( values); |
|
34 |
|
|
35 |
jni_obj = &obj; |
|
36 |
jni_env = env; |
|
37 |
|
|
38 |
listValues = env->GetIntArrayElements( values, 0); |
|
39 |
|
|
40 |
for (i = 0; i < lon; i++) { |
|
41 |
anLevels[i] = listValues[i]; |
|
42 |
} |
|
43 |
|
|
44 |
switch(method) { |
|
45 |
case 0: pszResampling = "nearest"; break; |
|
46 |
case 1: pszResampling = "average"; break; |
|
47 |
case 2: pszResampling = "average_mp"; break; |
|
48 |
case 3: pszResampling = "average_magphase"; break; |
|
49 |
case 4: pszResampling = "mode"; break; |
|
50 |
} |
|
51 |
|
|
52 |
GDALAllRegister(); |
|
53 |
poDataset = (GDALDataset *) GDALOpen( filename, GA_Update ); |
|
54 |
|
|
55 |
if( poDataset == NULL ) |
|
56 |
poDataset = (GDALDataset *) GDALOpen( filename, GA_ReadOnly ); |
|
57 |
|
|
58 |
if( poDataset == NULL ) { |
|
59 |
env->ReleaseIntArrayElements( values, listValues, 0); |
|
60 |
env->ReleaseStringUTFChars( file, filename); |
|
61 |
return CE_Fatal; |
|
62 |
} |
|
63 |
|
|
64 |
err = poDataset->BuildOverviews( pszResampling, |
|
65 |
lon, anLevels, 0, NULL, |
|
66 |
incrementFnc, NULL ); |
|
67 |
|
|
68 |
if( err != CE_None ) { |
|
69 |
env->ReleaseIntArrayElements( values, listValues, 0); |
|
70 |
env->ReleaseStringUTFChars( file, filename); |
|
71 |
return err; |
|
72 |
} |
|
73 |
|
|
74 |
delete poDataset; |
|
75 |
GDALDestroyDriverManager(); |
|
76 |
|
|
77 |
env->ReleaseIntArrayElements( values, listValues, 0); |
|
78 |
env->ReleaseStringUTFChars( file, filename); |
|
79 |
|
|
80 |
return -1; |
|
81 |
} |
|
82 |
|
|
83 |
|
Also available in: Unified diff