Revision 4274

View differences:

trunk/libraries/libjni-ecwcompress/.cvsignore
1
dist
2
bin
3
*.o
0 4

  
trunk/libraries/libjni-ecwcompress/.cdtproject
13 13
<indexEnabled indexValue="true"/>
14 14
<indexerProblemsEnabled indexProblemsValue="0"/>
15 15
</item>
16
<item id="org.eclipse.cdt.make.core.buildtargets">
17
<buildTargets>
18
<target name="all" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path="">
19
<buildCommand>make</buildCommand>
20
<buildTarget>all</buildTarget>
21
<stopOnError>false</stopOnError>
22
<useDefaultCommand>true</useDefaultCommand>
23
</target>
24
<target name="clean" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path="">
25
<buildCommand>make</buildCommand>
26
<buildTarget>clean</buildTarget>
27
<stopOnError>false</stopOnError>
28
<useDefaultCommand>true</useDefaultCommand>
29
</target>
30
</buildTargets>
31
</item>
32 16
</data>
33 17
</cdtproject>
trunk/libraries/libjni-ecwcompress/.classpath
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
4
	<classpathentry kind="src" path="src-test"/>
5
	<classpathentry kind="lib" path="lib/gdal/jgdal.jar"/>
6
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
7
	<classpathentry kind="output" path="bin"/>
8
</classpath>
0 9

  
trunk/libraries/libjni-ecwcompress/include/es_gva_cit_jecwcompress_NCSEcwCompressClient.h
41 41

  
42 42
/*
43 43
 * Class:     es_gva_cit_jecwcompress_NCSEcwCompressClient
44
 * Method:    NCSEcwCompressCancelNat
45
 * Signature: (J)V
46
 */
47
JNIEXPORT void JNICALL Java_es_gva_cit_jecwcompress_NCSEcwCompressClient_NCSEcwCompressCancelNat
48
  (JNIEnv *, jobject, jlong);
49

  
50
/*
51
 * Class:     es_gva_cit_jecwcompress_NCSEcwCompressClient
44 52
 * Method:    finalizeNat
45 53
 * Signature: (J)V
46 54
 */
trunk/libraries/libjni-ecwcompress/.project
10 10
			<arguments>
11 11
				<dictionary>
12 12
					<key>org.eclipse.cdt.core.errorOutputParser</key>
13
					<value>org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
13
					<value>org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.VCErrorParser;</value>
14 14
				</dictionary>
15 15
				<dictionary>
16 16
					<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
trunk/libraries/libjni-ecwcompress/src/ncsecwcompressclient_wrapper.c
66 66
	char 			pErrorBuffer[1024];
67 67
} ReadInfo;
68 68

  
69
static BOOLEAN 	callBackOn = TRUE;
69 70

  
70 71
/******************************************************************************/
71 72
//								ReadCallback
......
86 87
	jclass clase_readcall;
87 88
	jmethodID metodo;
88 89

  
89
	clase_client = (*env)->GetObjectClass(env, *(pReadInfo->jclient));
90
	clase_readcall = (*env)->GetObjectClass(env, *(pReadInfo->jreadcall));
90
    if(callBackOn){
91
		clase_client = (*env)->GetObjectClass(env, *(pReadInfo->jclient));
92
		clase_readcall = (*env)->GetObjectClass(env, *(pReadInfo->jreadcall));
93
		
94
		//Ponemos el valor de la banda un n?mero de l?nea en el objeto cliente		
91 95
	
92
	//Ponemos el valor de la banda un n?mero de l?nea en el objeto cliente		
93

  
94
  	fid = (*env)->GetFieldID(env, clase_readcall, "nNextLine", "I");
95
  	(*env)->SetIntField(env, *(pReadInfo->jreadcall), fid, nNextLine); 
96
	   	
97
   	//Ejecutamos la funci?n de java que carga el buffer
96
	  	fid = (*env)->GetFieldID(env, clase_readcall, "nNextLine", "I");
97
	  	(*env)->SetIntField(env, *(pReadInfo->jreadcall), fid, nNextLine); 
98
		   	
99
	   	//Ejecutamos la funci?n de java que carga el buffer
100
			
101
		metodo = (*env)->GetMethodID(env, clase_readcall, "loadBuffer", "()V");
102
		(*env)->CallVoidMethod(env, *(pReadInfo->jreadcall), metodo);
98 103
		
99
	metodo = (*env)->GetMethodID(env, clase_readcall, "loadBuffer", "()V");
100
	(*env)->CallVoidMethod(env, *(pReadInfo->jreadcall), metodo);
101
	
102
	//Obtenemos el array de bytes desde java
103
	
104
	fid = (*env)->GetFieldID(env, clase_client, "buffer", "[B");
105
    jarray =(jbyteArray)(*env)->GetObjectField(env, *(pReadInfo->jclient), fid);  
106
    longitud = (*env)->GetArrayLength(env, jarray);
107
    
108
    (*env)->GetByteArrayRegion(env,jarray,0,longitud,(jbyte *)pReadInfo->ppInputBandBufferArray[0]);
109
        
110
	for(nBand = 0; nBand < pClient->nInputBands; nBand++) {
111
		UINT32 nCell;		
112
		UINT8 *pInputValue = pReadInfo->ppInputBandBufferArray[nBand];
113
		IEEE4 *pOutputValue = ppOutputBandBufferArray[nBand];
114
    	
115
		// Compression needs input to be IEEE4
116
		for (nCell = 0; nCell < pClient->nInOutSizeX; nCell++) {
117
			*pOutputValue++ = (IEEE4)*pInputValue++;
104
		//Obtenemos el array de bytes desde java
105
		
106
		fid = (*env)->GetFieldID(env, clase_client, "buffer", "[B");
107
	    jarray =(jbyteArray)(*env)->GetObjectField(env, *(pReadInfo->jclient), fid);  
108
	    longitud = (*env)->GetArrayLength(env, jarray);
109
	    
110
	    (*env)->GetByteArrayRegion(env,jarray,0,longitud,(jbyte *)pReadInfo->ppInputBandBufferArray[0]);
111
	        
112
		for(nBand = 0; nBand < pClient->nInputBands; nBand++) {
113
			UINT32 nCell;		
114
			UINT8 *pInputValue = pReadInfo->ppInputBandBufferArray[nBand];
115
			IEEE4 *pOutputValue = ppOutputBandBufferArray[nBand];
116
	    	
117
			// Compression needs input to be IEEE4
118
			for (nCell = 0; nCell < pClient->nInOutSizeX; nCell++) {
119
				*pOutputValue++ = (IEEE4)*pInputValue++;
120
			}
121
		
118 122
		}
119
	
120
	}
121 123

  
122
	return(TRUE);	
124
		return(TRUE);	
125
    }else
126
    	return(FALSE);
123 127
}
124 128

  
125 129
/******************************************************************************/
......
379 383
  }  
380 384
  
381 385
/******************************************************************************/
386
//								NCSEcwCompressCancel
387
/******************************************************************************/
388
  
389
JNIEXPORT void JNICALL Java_es_gva_cit_jecwcompress_NCSEcwCompressClient_NCSEcwCompressCancelNat
390
  (JNIEnv *env, jobject obj, jlong cPtr){
391
  	callBackOn = FALSE;
392
  }
393
  
394
/******************************************************************************/
382 395
//								finalize
383 396
/******************************************************************************/
384 397
  
trunk/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/NCSEcwCompressClient.java
72 72
	private native int NCSEcwCompressOpenNat(long cPtr, boolean bCalculateSizesOnly);
73 73
	private native int NCSEcwCompressNat(long cPtr,ReadCallBack read);
74 74
	private native int NCSEcwCompressCloseNat(long cPtr);
75
	private native void NCSEcwCompressCancelNat(long cPtr);
75 76
	private native void finalizeNat(long cPtr);
76 77
		
77 78
	private String				inputFilename=null;			
......
198 199
	}
199 200
	
200 201
	/**
202
	 * Cancela la compresi?n
201 203
	 * @throws EcwException Se produce cuando la llamada nativa devuelve un c?digo de error
202 204
	 */
205
	public void NCSEcwCompressCancel()throws EcwException{
206
		
207
		if(cPtr <= 0)
208
			throw new EcwException("Error en NCSEcwCompress(). No hay una referencia v?lida al objeto NCSEcwCompressClient.");
209
		
210
		NCSEcwCompressCancelNat(cPtr);
211
	}
212
	
213
	/**
214
	 * @throws EcwException Se produce cuando la llamada nativa devuelve un c?digo de error
215
	 */
203 216
	public void finalize()throws EcwException{
204 217
		
205 218
		if(cPtr <= 0)
206 219

  

Also available in: Unified diff