Revision 23984

View differences:

tags/tmp_build/libraries/libjni-ecwcompress/src/ncsecwcompressclient_wrapper.c
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     bsb_interfaz.c
5
 * Project:  JGDAL. Interface java to gdal (Frank Warmerdam).
6
 * Purpose:  Interface functions to manage bsb files. This include gdal
7
 * 			code but it doesn't use the gdal API.
8
 * Author:   Nacho Brodin, brodin_ign@gva.es
9
 *
10
 **********************************************************************/
11
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
12
*
13
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
14
*
15
* This program is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU General Public License
17
* as published by the Free Software Foundation; either version 2
18
* of the License, or (at your option) any later version.
19
*
20
* This program is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
* GNU General Public License for more details.
24
*
25
* You should have received a copy of the GNU General Public License
26
* along with this program; if not, write to the Free Software
27
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
28
*
29
* For more information, contact:
30
*
31
*  Generalitat Valenciana
32
*   Conselleria d'Infraestructures i Transport
33
*   Av. Blasco Ib??ez, 50
34
*   46010 VALENCIA
35
*   SPAIN
36
*
37
*      +34 963862235
38
*   gvsig@gva.es
39
*      www.gvsig.gva.es
40
*
41
*    or
42
*
43
*   IVER T.I. S.A
44
*   Salamanca 50
45
*   46005 Valencia
46
*   Spain
47
*
48
*   +34 963163400
49
*   dac@iver.es
50
*/
51

  
52
#include <jni.h>
53
#include <string.h>
54
#include <malloc.h>
55
#include "../include/es_gva_cit_jecwcompress_NCSEcwCompressClient.h"
56
#include "NCSECWCompressClient.h"
57

  
58
typedef struct ReadInfo {
59
	//NCSFileView 	*pNCSFileView;
60
	UINT8 			**ppInputBandBufferArray;
61
	UINT32 			nPercentComplete;
62
	jclass			clase;
63
	jobject			*jclient;
64
	jobject			*jreadcall;
65
	JNIEnv 			*env;
66
	char 			pErrorBuffer[1024];
67
} ReadInfo;
68

  
69
static BOOLEAN 	callBackOn = TRUE;
70

  
71
/******************************************************************************/
72
//								ReadCallback
73
/******************************************************************************/
74

  
75

  
76
static BOOLEAN ReadCallback(NCSEcwCompressClient *pClient,
77
							UINT32 nNextLine,
78
							IEEE4 **ppOutputBandBufferArray)
79
{
80
	ReadInfo *pReadInfo = (ReadInfo *)pClient->pClientData;
81
	UINT32 nBand;
82
	jfieldID fid;
83
	jbyteArray jarray;
84
	JNIEnv *env=pReadInfo->env;
85
	int longitud;
86
	jclass clase_client;
87
	jclass clase_readcall;
88
	jmethodID metodo;
89

  
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		
95
	
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);
103
		
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
		
122
		}
123

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

  
129
/******************************************************************************/
130
//								StatusCallback
131
/******************************************************************************/
132
//Asigna el tanto por cien de imagen que lleva comprimido en una variable de java
133
//Ejecuta la funci?n updatePercent de java despues de actualizar la varible.
134

  
135
static void StatusCallback(NCSEcwCompressClient *pClient,
136
						   UINT32 nCurrentLine)
137
{
138
	ReadInfo 	*pReadInfo = (ReadInfo *)pClient->pClientData;
139
	UINT32 		nPercentComplete = (nCurrentLine * 100) / (pClient->nInOutSizeY - 1);
140
	jclass 		clase_client;
141
	jclass 		clase_readcall;
142
	JNIEnv 		*env=pReadInfo->env;
143
	jfieldID 	fid;
144
	jmethodID 	metodo;
145
	
146
	clase_client = (*env)->GetObjectClass(env, *(pReadInfo->jclient));
147
	clase_readcall = (*env)->GetObjectClass(env, *(pReadInfo->jreadcall));
148
	
149
	if (nPercentComplete != pReadInfo->nPercentComplete) {
150
		fid = (*env)->GetFieldID(env, clase_client, "porcentaje", "I");
151
	  	(*env)->SetIntField(env, *(pReadInfo->jclient), fid, nPercentComplete);
152
  		metodo = (*env)->GetMethodID(env, clase_readcall, "updatePercent", "()V");
153
		(*env)->CallVoidMethod(env, *(pReadInfo->jreadcall), metodo); 
154
		pReadInfo->nPercentComplete = nPercentComplete;
155
	}
156
}
157

  
158
/******************************************************************************/
159
//								NCSEcwCompressClient
160
/******************************************************************************/
161

  
162
JNIEXPORT jlong JNICALL Java_es_gva_cit_jecwcompress_NCSEcwCompressClient_NCSEcwCompressClientNat
163
  (JNIEnv *env, jobject obj){
164
  	
165
  	NCSEcwCompressClient 	*pClient;
166
  	jlong 					jresult = 0 ;
167
  	
168
  	if(pClient = NCSEcwCompressAllocClient()){
169
  		*(NCSEcwCompressClient **)&jresult = pClient;
170
  		return jresult;
171
  	}else
172
  		return -1;
173
  	
174
  }
175

  
176
/******************************************************************************/
177
//								NCSEcwCompressOpen
178
/******************************************************************************/
179

  
180
JNIEXPORT jint JNICALL Java_es_gva_cit_jecwcompress_NCSEcwCompressClient_NCSEcwCompressOpenNat
181
  (JNIEnv *env, jobject obj, jlong cPtr, jboolean bCalculateSizesOnly){
182
  	
183
  	NCSEcwCompressClient 	*pClient = (NCSEcwCompressClient *) 0 ;
184
  	NCSError 				eError;
185
  	jfieldID 				fid;
186
    jobject					obj_str;
187
    const char				*str;
188
    ReadInfo 				*compress_readInfo;
189
    jmethodID 				metodo;
190

  
191
    UINT8 *pReadBuffer,nBand;
192
    
193
  	pClient = *(NCSEcwCompressClient **)&cPtr;
194
  	if(pClient!=NULL){
195
  		
196
  		//Asignamos los valores de los campos de NCSEcwCompress
197
  		
198
  		jclass clase = (*env)->GetObjectClass(env, obj);
199
  		  		
200
  		fid = (*env)->GetFieldID(env, clase, "inputFilename", "Ljava/lang/String;");
201
  		obj_str = (*env)->GetObjectField(env, obj, fid);
202
  		if(obj_str!=NULL){
203
			str = (*env)->GetStringUTFChars(env,obj_str,0);
204
	  		strcpy(pClient->szInputFilename,str);
205
	  		str=NULL;
206
	  		(*env)->ReleaseStringUTFChars(env, obj_str, str);
207
	  		//printf("inputFilename=%s\n",pClient->szInputFilename);
208
  		}
209
  		
210
  		fid = (*env)->GetFieldID(env, clase, "outputFilename", "Ljava/lang/String;");
211
  		obj_str = (*env)->GetObjectField(env, obj, fid);
212
  		if(obj_str!=NULL){
213
			str = (*env)->GetStringUTFChars(env,obj_str,0);
214
	  		strcpy(pClient->szOutputFilename,str);
215
	  		str=NULL;
216
	  		(*env)->ReleaseStringUTFChars(env, obj_str, str);
217
	  		//printf("outputFilename=%s\n",pClient->szOutputFilename);
218
  		}
219
  		  		
220
  		fid = (*env)->GetFieldID(env, clase, "targetCompression", "D");
221
  		pClient->fTargetCompression = (IEEE4)(*env)->GetDoubleField(env, obj, fid);
222
  		//printf("targetCompression=%f\n",pClient->fTargetCompression);
223
  		
224
  		fid = (*env)->GetFieldID(env, clase, "eCompressFormat", "I");
225
  		pClient->eCompressFormat = (*env)->GetIntField(env, obj, fid);
226
  		//printf("eCompressFormat=%d\n",pClient->eCompressFormat);
227
  		  		
228
  		fid = (*env)->GetFieldID(env, clase, "eCompressHint", "I");
229
  		pClient->eCompressHint = (*env)->GetIntField(env, obj, fid);
230
  		//printf("eCompressHint=%d\n",pClient->eCompressHint);
231
  		
232
  		fid = (*env)->GetFieldID(env, clase, "nBlockSizeX", "I");
233
  		pClient->nBlockSizeX = (*env)->GetIntField(env, obj, fid);
234
  		//printf("nBlockSizeX=%d\n",pClient->nBlockSizeX);
235
  		
236
  		fid = (*env)->GetFieldID(env, clase, "nBlockSizeY", "I");
237
  		pClient->nBlockSizeY = (*env)->GetIntField(env, obj, fid);
238
  		//printf("nBlockSizeY=%d\n",pClient->nBlockSizeY);
239
  		
240
  		fid = (*env)->GetFieldID(env, clase, "nInOutSizeX", "I");
241
  		pClient->nInOutSizeX = (*env)->GetIntField(env, obj, fid);
242
  		//printf("nInOutSizeX=%d\n",pClient->nInOutSizeX);
243
  		
244
  		fid = (*env)->GetFieldID(env, clase, "nInOutSizeY", "I");
245
  		pClient->nInOutSizeY = (*env)->GetIntField(env, obj, fid);
246
  		//printf("nInOutSizeY=%d\n",pClient->nInOutSizeY);
247
  		
248
  		fid = (*env)->GetFieldID(env, clase, "nInputBands", "I");
249
  		pClient->nInputBands = (*env)->GetIntField(env, obj, fid);
250
  		//printf("nInputBands=%d\n",pClient->nInputBands);
251
  		
252
  		fid = (*env)->GetFieldID(env, clase, "nOutputBands", "I");
253
  		pClient->nOutputBands = (*env)->GetIntField(env, obj, fid);
254
		//printf("nOutputBands=%d\n",pClient->nOutputBands);
255
		
256
  		fid = (*env)->GetFieldID(env, clase, "nInputSize", "J");
257
  		pClient->nInputSize = (*env)->GetLongField(env, obj, fid);
258
  		//printf("nInputSize=%ld\n",pClient->nInputSize);
259
  		
260
  		fid = (*env)->GetFieldID(env, clase, "fCellIncrementX", "D");
261
  		pClient->fCellIncrementX = (*env)->GetDoubleField(env, obj, fid);
262
  		//printf("fCellIncrementX=%f\n",pClient->fCellIncrementX);
263
  		
264
  		fid = (*env)->GetFieldID(env, clase, "fCellIncrementY", "D");
265
  		pClient->fCellIncrementY = (*env)->GetDoubleField(env, obj, fid);
266
  		//printf("fCellIncrementY=%f\n",pClient->fCellIncrementY);
267
  		
268
  		fid = (*env)->GetFieldID(env, clase, "fOriginX", "D");
269
  		pClient->fOriginX = (*env)->GetDoubleField(env, obj, fid);
270
  		//printf("fOriginX=%f\n",pClient->fOriginX);
271
  		
272
  		fid = (*env)->GetFieldID(env, clase, "fOriginY", "D");
273
  		pClient->fOriginY = (*env)->GetDoubleField(env, obj, fid);
274
  		//printf("fOriginY=%f\n",pClient->fOriginY);
275
  		
276
  		fid = (*env)->GetFieldID(env, clase, "eCellSizeUnits", "I");
277
  		pClient->fActualCompression = (IEEE4)(*env)->GetIntField(env, obj, fid);
278
  		//printf("eCellSizeUnits=%d\n",pClient->fActualCompression);
279
  		
280
  		fid = (*env)->GetFieldID(env, clase, "szDatum", "Ljava/lang/String;");
281
  		obj_str = (*env)->GetObjectField(env, obj, fid);
282
  		if(obj_str!=NULL){
283
			str = (*env)->GetStringUTFChars(env,obj_str,0);
284
	  		strcpy(pClient->szDatum,str);
285
	  		str=NULL;
286
	  		(*env)->ReleaseStringUTFChars(env, obj_str, str);
287
	  		//printf("szDatum=%s\n",pClient->szDatum);
288
  		}
289
  		
290
  		fid = (*env)->GetFieldID(env, clase, "szProjection", "Ljava/lang/String;");
291
  		obj_str = (*env)->GetObjectField(env, obj, fid);
292
  		if(obj_str!=NULL){
293
			str = (*env)->GetStringUTFChars(env,obj_str,0);
294
	  		strcpy(pClient->szProjection,str);
295
	  		str=NULL;
296
	  		(*env)->ReleaseStringUTFChars(env, obj_str, str);
297
	  		//printf("szProjection=%s\n",pClient->szProjection);
298
  		}
299
  		
300
  		fid = (*env)->GetFieldID(env, clase, "fActualCompression", "D");
301
  		pClient->fActualCompression = (IEEE4)(*env)->GetDoubleField(env, obj, fid);
302
  		//printf("fActualCompression=%f\n",pClient->fActualCompression);
303
  		
304
  		fid = (*env)->GetFieldID(env, clase, "fCompressionSeconds", "D");
305
  		pClient->fCompressionSeconds = (*env)->GetDoubleField(env, obj, fid);
306
  		//printf("fCompressionSeconds=%f\n",pClient->fCompressionSeconds);
307
  		
308
  		fid = (*env)->GetFieldID(env, clase, "fCompressionMBSec", "D");
309
  		pClient->fCompressionMBSec = (*env)->GetDoubleField(env, obj, fid);
310
  		//printf("fCompressionMBSec=%f\n",pClient->fCompressionMBSec);
311
  		
312
  		fid = (*env)->GetFieldID(env, clase, "nOutputSize", "J");
313
  		pClient->nOutputSize = (*env)->GetLongField(env, obj, fid);
314
  		//printf("nOutputSize=%ld\n",pClient->nOutputSize);
315
  		
316
  		pClient->pReadCallback = ReadCallback;
317
		pClient->pStatusCallback = StatusCallback;
318
				
319
		//Inicializar el buffer que tendr? una l?nea de entrada x el n?m de bandas
320
		
321
		metodo = (*env)->GetMethodID(env, clase, "initialize", "()V");
322
		(*env)->CallIntMethod(env,obj,metodo);
323
			
324
		compress_readInfo = (ReadInfo *)malloc(sizeof(ReadInfo));
325
		
326
		pReadBuffer = (UINT8 *)malloc(sizeof(UINT8) *
327
								  pClient->nInOutSizeX *
328
								  pClient->nInputBands);
329
		compress_readInfo->ppInputBandBufferArray = (UINT8 **)malloc(sizeof(UINT8 *) *
330
								   pClient->nInputBands);
331
		for (nBand = 0; nBand < pClient->nInputBands; nBand++) {
332
			compress_readInfo->ppInputBandBufferArray[nBand] = pReadBuffer + 
333
			(nBand * pClient->nInOutSizeX * sizeof(UINT8));
334
		}
335
								  
336
		if (compress_readInfo->ppInputBandBufferArray == NULL) return 46;
337
		compress_readInfo->nPercentComplete = 0;
338
				
339
		pClient->pClientData = (void *)compress_readInfo;
340
		
341
	  	eError = NCSEcwCompressOpen(pClient, ((bCalculateSizesOnly==0)? FALSE : TRUE));
342
	  	
343
		return eError;
344
		
345
  	}
346
  	return -1;
347
  }
348
  
349
/******************************************************************************/
350
//								NCSEcwCompress
351
/******************************************************************************/
352
  
353
JNIEXPORT jint JNICALL Java_es_gva_cit_jecwcompress_NCSEcwCompressClient_NCSEcwCompressNat
354
  (JNIEnv *env, jobject obj, jlong cPtr, jobject obj_read){
355
  	
356
  	NCSEcwCompressClient 	*pClient = (NCSEcwCompressClient *) 0 ;
357
  	ReadInfo 				*compress_readInfo = (ReadInfo *) 0 ;
358
  	NCSError 				eError;
359
   
360
	pClient = *(NCSEcwCompressClient **)&cPtr;
361
	compress_readInfo = (ReadInfo *)pClient->pClientData;
362
	compress_readInfo->jclient=&obj;
363
	compress_readInfo->jreadcall=&obj_read;
364
	compress_readInfo->env=env;	
365
	
366
	eError = NCSEcwCompress(pClient);
367
	return eError;  	
368
  }
369
  
370
/******************************************************************************/
371
//								NCSEcwCompressClose
372
/******************************************************************************/
373
  
374
JNIEXPORT jint JNICALL Java_es_gva_cit_jecwcompress_NCSEcwCompressClient_NCSEcwCompressCloseNat
375
  (JNIEnv *env, jobject obj, jlong cPtr){
376
  	
377
  	NCSEcwCompressClient 	*pClient = (NCSEcwCompressClient *) 0 ;
378
  	NCSError 				eError;
379
    	
380
	pClient = *(NCSEcwCompressClient **)&cPtr;	
381
	eError = NCSEcwCompressClose(pClient);
382
	return eError;  	
383
  }  
384
  
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
/******************************************************************************/
395
//								finalize
396
/******************************************************************************/
397
  
398
JNIEXPORT void JNICALL Java_es_gva_cit_jecwcompress_NCSEcwCompressClient_finalizeNat
399
  (JNIEnv *env, jobject obj, jlong cPtr){
400
  	
401
  	ReadInfo 				*compress_readInfo = (ReadInfo *) 0 ;
402
  	NCSEcwCompressClient 	*pClient = (NCSEcwCompressClient *) 0 ;
403
    int 					nBand;	
404
    
405
	pClient = *(NCSEcwCompressClient **)&cPtr;	
406
   	
407
  	//Liberamos la memoria
408
  	
409
  	compress_readInfo = pClient->pClientData;
410
  	for (nBand = 0; nBand < pClient->nInputBands; nBand++) {
411
			free(compress_readInfo->ppInputBandBufferArray[nBand]);
412
	}
413
  	free(compress_readInfo->ppInputBandBufferArray);
414
  	free(pClient->pClientData);
415
  	pClient->pClientData = NULL;
416
  	NCSEcwCompressFreeClient(pClient);
417
  	
418
  }
419
  
0 420

  
tags/tmp_build/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/ReadCallBack.java
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     ReadCallBack.java
5
 * Project:  
6
 * Purpose:  
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/*Copyright (C) 2004  Nacho Brodin <brodin_ign@gva.es>
11

  
12
 This program is free software; you can redistribute it and/or
13
 modify it under the terms of the GNU General Public License
14
 as published by the Free Software Foundation; either version 2
15
 of the License, or (at your option) any later version.
16

  
17
 This program is d/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
18
*
19
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
20
*
21
* This program is free software; you can redistribute it and/or
22
* modify it under the terms of the GNU General Public License
23
* as published by the Free Software Foundation; either version 2
24
* of the License, or (at your option) any later version.
25
*
26
* This program is distributed in the hope that it will be useful,
27
* but WITHOUT ANY WARRANTY; without even the implied warranty of
28
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
* GNU General Public License for more details.
30
*
31
* You should have received a copy of the GNU General Public License
32
* along with this program; if not, write to the Free Software
33
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
34
*
35
* For more information, contact:
36
*
37
*  Generalitat Valenciana
38
*   Conselleria d'Infraestructures i Transport
39
*   Av. Blasco Ib??ez, 50
40
*   46010 VALENCIA
41
*   SPAIN
42
*
43
*      +34 963862235
44
*   gvsig@gva.es
45
*      www.gvsig.gva.es
46
*
47
*    or
48
*
49
*   IVER T.I. S.A
50
*   Salamanca 50
51
*   46005 Valencia
52
*   Spain
53
*
54
*   +34 963163400
55
*   dac@iver.es
56
*/
57

  
58
package es.gva.cit.jecwcompress;
59

  
60
/**
61
 * Interfaz que debe implementar el cliente de compresi?n para que se pueda hacer llamadas
62
 * a las funciones java  que cargan los buffers, desde el espacio C.
63
 * 
64
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
65
 * @version 0.0
66
 * @link http://www.gvsig.gva.es
67
 */
68
public interface ReadCallBack {
69
	
70
	/**
71
	 * Funci?n para la carga de datos. En cada callback deber? llenarse el buffer
72
	 * dentro de esta funci?n.
73
	 */
74
	void loadBuffer();
75
	
76
	/**
77
	 * Funci?n que es llamada cada uno por cien que sea comprimido. En ella podemos
78
	 * escribir el c?digo necesario para la actualizaci?n del porcentaje que llevamos
79
	 * de compresi?n.
80
	 */
81
	void updatePercent();
82
}
0 83

  
tags/tmp_build/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/JNIBase.java
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     JNIBase.java
5
 * Project:  
6
 * Purpose:  Base class for classes that use JNI.
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
*
12
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
*
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License
16
* as published by the Free Software Foundation; either version 2
17
* of the License, or (at your option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
*
28
* For more information, contact:
29
*
30
*  Generalitat Valenciana
31
*   Conselleria d'Infraestructures i Transport
32
*   Av. Blasco Ib??ez, 50
33
*   46010 VALENCIA
34
*   SPAIN
35
*
36
*      +34 963862235
37
*   gvsig@gva.es
38
*      www.gvsig.gva.es
39
*
40
*    or
41
*
42
*   IVER T.I. S.A
43
*   Salamanca 50
44
*   46005 Valencia
45
*   Spain
46
*
47
*   +34 963163400
48
*   dac@iver.es
49
*/
50

  
51

  
52
package es.gva.cit.jecwcompress;
53

  
54

  
55
/**
56
 * Clase base para todas las funcionalidades jni. Contiene operaciones comunes para todas ellas.
57
 * 
58
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
59
 * @version 0.0
60
 * @link http://www.gvsig.gva.es
61
 */
62
public class JNIBase {
63
	
64
	protected long cPtr;
65
	
66
	//private native int getRasterBandXSizeNat(long cPtr);
67
		
68
	
69
	 /**
70
	 * Funci?n que sirve como base para funcionalidades de gdal que admiten como par?metro un entero y devuelven un entero.
71
	 * 
72
	 * @throws GdalException.
73
	 * @param msg1	Mensaje de error que se muestra cuando el puntero a objeto pasado es vacio.
74
	 * @param msg2	Mensaje de error que se muestra cuando el resultado de la llamada a la funci?n de gdal es menor o igual que 0.
75
	 */
76
	 
77
	 
78
	protected int baseSimpleFunctions(int n,String msg1,String msg2)throws EcwException {
79
			
80
		int res = 0;
81
		if(cPtr == 0)
82
			throw new EcwException(msg1);
83
			
84
		switch(n) {
85
			case 0: /*res = getRasterBandXSizeNat(cPtr);*/break;
86
		}
87
			
88
		if(res < 0)
89
		 	throw new EcwException(msg2);
90
		else return res;
91
	}
92
	
93
	public long getPtro(){return cPtr;}
94
	
95
	static{
96
		
97
		System.loadLibrary("jecwcompress");
98
		
99
	}
100
		
101
}
0 102

  
tags/tmp_build/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/CellSizeUnits.java
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     CellSizeUnits.java
5
 * Project:  
6
 * Purpose:  
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
*
12
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
*
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License
16
* as published by the Free Software Foundation; either version 2
17
* of the License, or (at your option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
*
28
* For more information, contact:
29
*
30
*  Generalitat Valenciana
31
*   Conselleria d'Infraestructures i Transport
32
*   Av. Blasco Ib??ez, 50
33
*   46010 VALENCIA
34
*   SPAIN
35
*
36
*      +34 963862235
37
*   gvsig@gva.es
38
*      www.gvsig.gva.es
39
*
40
*    or
41
*
42
*   IVER T.I. S.A
43
*   Salamanca 50
44
*   46005 Valencia
45
*   Spain
46
*
47
*   +34 963163400
48
*   dac@iver.es
49
*/
50

  
51

  
52
package es.gva.cit.jecwcompress;
53

  
54
/**
55
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
56
 * @version 0.0
57
 * @link http://www.gvsig.gva.es
58
 */
59
public class CellSizeUnits {
60
	
61
	private final static int ECW_CELL_UNITS_INVALID	=	0;
62
	private final static int ECW_CELL_UNITS_METERS		=	1;
63
	private final static int ECW_CELL_UNITS_DEGREES	=	2;
64
	private final static int ECW_CELL_UNITS_FEET		=	3;
65
	private final static int ECW_CELL_UNITS_UNKNOWN	=	4;
66
	
67
}
0 68

  
tags/tmp_build/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/EcwException.java
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     GdalException.java
5
 * Project:  JGDAL. Interface java to gdal (Frank Warmerdam).
6
 * Purpose:  Class for exceptions produced into gdal. 
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
*
12
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
*
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License
16
* as published by the Free Software Foundation; either version 2
17
* of the License, or (at your option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
*
28
* For more information, contact:
29
*
30
*  Generalitat Valenciana
31
*   Conselleria d'Infraestructures i Transport
32
*   Av. Blasco Ib??ez, 50
33
*   46010 VALENCIA
34
*   SPAIN
35
*
36
*      +34 963862235
37
*   gvsig@gva.es
38
*      www.gvsig.gva.es
39
*
40
*    or
41
*
42
*   IVER T.I. S.A
43
*   Salamanca 50
44
*   46005 Valencia
45
*   Spain
46
*
47
*   +34 963163400
48
*   dac@iver.es
49
*/
50
 
51
package es.gva.cit.jecwcompress;
52

  
53
/**
54
 * Es generada cuando los c?digos de retorno de las funciones del compresor de Ecw significan que algo ha ido mal.
55
 * 
56
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
57
 * @version 0.0
58
 * @link http://www.gvsig.gva.es
59
 */
60

  
61

  
62
public class EcwException extends Exception {
63

  
64
	public EcwException(String msg) {
65
		super(msg);
66
	}
67
	
68
	
69
}
0 70

  
tags/tmp_build/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/NCSEcwCompressClient.java
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     NCSEcwCompressClient.java
5
 * Project:  
6
 * Purpose:  
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
*
12
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
*
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License
16
* as published by the Free Software Foundation; either version 2
17
* of the License, or (at your option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
*
28
* For more information, contact:
29
*
30
*  Generalitat Valenciana
31
*   Conselleria d'Infraestructures i Transport
32
*   Av. Blasco Ib??ez, 50
33
*   46010 VALENCIA
34
*   SPAIN
35
*
36
*      +34 963862235
37
*   gvsig@gva.es
38
*      www.gvsig.gva.es
39
*
40
*    or
41
*
42
*   IVER T.I. S.A
43
*   Salamanca 50
44
*   46005 Valencia
45
*   Spain
46
*
47
*   +34 963163400
48
*   dac@iver.es
49
*/
50

  
51
package es.gva.cit.jecwcompress;
52

  
53
/**
54
 * Esta clase contiene las funciones para b?sicas para la compresi?n de Ecw. Para su uso 
55
 * debe seguirse la secuencia de operaciones l?gica:
56
 * <UL>
57
 * <LI>Creaci?n de objeto de esta clase NCSEcwCompressClient</LI> 
58
 * <LI>Asignaci?n de par?metros de compresi?n con las operaciones set</LI>
59
 * <LI>Crear una clase servidora de datos que implemente el interfaz ReadCallBack 
60
 * y herede de JniObject</LI>
61
 * <LI>Hacer un open con NCSEcwCompressOpen</LI> 
62
 * <LI>ejecutar el compresor con NCSEcwCompress y cerrar con NCSEcwCompressClose</LI>
63
 * </UL>
64
 * 
65
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
66
 * @version 0.0
67
 * @link http://www.gvsig.gva.es
68
 */
69
public class NCSEcwCompressClient extends JNIBase{
70

  
71
	private native long NCSEcwCompressClientNat();
72
	private native int NCSEcwCompressOpenNat(long cPtr, boolean bCalculateSizesOnly);
73
	private native int NCSEcwCompressNat(long cPtr,ReadCallBack read);
74
	private native int NCSEcwCompressCloseNat(long cPtr);
75
	private native void NCSEcwCompressCancelNat(long cPtr);
76
	private native void finalizeNat(long cPtr);
77
		
78
	private String				inputFilename=null;			
79
	private	String 				outputFilename=null;	
80
	private double 				targetCompression=0.0;
81
	private int					eCompressFormat=0;
82
	private int					eCompressHint=0;
83
	private int					nBlockSizeX=0;
84
	private int					nBlockSizeY=0;
85
	private int					nInOutSizeX=0;
86
	private int					nInOutSizeY=0;
87
	private int					nInputBands=0;
88
	private int					nOutputBands=0;
89
	private long				nInputSize=0;
90
	private double				fCellIncrementX=0.0;
91
	private double				fCellIncrementY=0.0;
92
	private double				fOriginX=0.0;
93
	private double				fOriginY=0.0;
94
	private int					eCellSizeUnits=0;
95
	private String 				szDatum=null;
96
	private String 				szProjection=null;
97
	private double				fActualCompression=0.0;	
98
	private double				fCompressionSeconds=0.0;
99
	private double				fCompressionMBSec=0.0;
100
	private long				nOutputSize=0;
101
	
102
	public byte[]				buffer;
103
	private long				readInfo;
104
	private int					porcentaje;
105
	
106
	/**
107
	 * Esta funci?n es llamada desde C para inicializar el buffer que contendr? 1 linea de datos
108
	 */
109
	private void initialize() {
110
		buffer = new byte[nInOutSizeX*nInputBands];
111
	}
112
	
113
	/**
114
	 * Esta funci?n es llamada desde C para asignar la direcci?n de memoria de la estructura readInfo
115
	 */
116
	private void setReadInfo(long ptr) {
117
		readInfo = ptr;
118
	}
119
	
120
	/**
121
	 * Esta funci?n es llamada desde C para recuperar la direcci?n de memoria de readInfo
122
	 */
123
	private long getReadInfo() {
124
		return readInfo;
125
	}
126
	
127
	/**
128
	 * Devuelve la cantidad de imagen comprimida en tanto por cien.
129
	 */
130
	public int getPercent() {
131
		return porcentaje;
132
	}
133
	
134
	/**
135
	 * Contructor
136
	 * @throws EcwException Se produce cuando la llamada nativa devuelve un c?digo de error
137
	 */
138
	public NCSEcwCompressClient()throws EcwException {
139
		
140
		cPtr = NCSEcwCompressClientNat();
141
		
142
		if(cPtr == 0)
143
	    	throw new EcwException("Error en la creaci?n del objeto NCSEcwCompressClient");
144
	}
145
	
146
	/**
147
	 * Inicializa el compresor
148
	 * @throws EcwException Se produce cuando la llamada nativa devuelve un c?digo de error
149
	 */
150
	public void NCSEcwCompressOpen(boolean bCalculateSizesOnly)throws EcwException {
151
		
152
		if(cPtr == 0)
153
			throw new EcwException("Error en NCSEcwCompressOpen(). No hay una referencia v?lida al objeto NCSEcwCompressClient.");
154
		
155
		int error = NCSEcwCompressOpenNat(cPtr, bCalculateSizesOnly);
156
		
157
		if(error == -1)
158
			throw new EcwException("Error en NCSEcwCompressOpen(). No se ha podido obtener un objeto NCSEcwCompress valido");
159
		else if(error != 0)
160
			throw new EcwException("Error en NCSEcwCompressOpen(). La llamada nativa ha devuelto un error "+NCSError.ErrorToString(error));
161
		    	
162
	}
163
	
164
	/**
165
	 * Realiza la funci?n de compresi?n
166
	 * @throws EcwException Se produce cuando la llamada nativa devuelve un c?digo de error
167
	 */
168
	public void NCSEcwCompress(ReadCallBack read)throws EcwException {
169
		
170
		if(cPtr == 0)
171
			throw new EcwException("Error en NCSEcwCompress(). No hay una referencia v?lida al objeto NCSEcwCompressClient.");
172
		
173
		if(read == null)
174
			throw new EcwException("Error en NCSEcwCompress(). El par?metro ReadCallBack no puede ser nulo.");
175
		
176
		int error = NCSEcwCompressNat(cPtr, read);
177
		
178
		if(error == -1)
179
			throw new EcwException("Error en NCSEcwCompress(). No se ha podido obtener un objeto NCSEcwCompress valido");
180
		else if(error != 0)
181
			throw new EcwException("Error en NCSEcwCompress(). La llamada nativa ha devuelto un error "+NCSError.ErrorToString(error));
182
	}
183
	
184
	/**
185
	 * Cierra el compresor
186
	 * @throws EcwException Se produce cuando la llamada nativa devuelve un c?digo de error
187
	 */
188
	public void NCSEcwCompressClose()throws EcwException {
189
		
190
		if(cPtr == 0)
191
			throw new EcwException("Error en NCSEcwCompress(). No hay una referencia v?lida al objeto NCSEcwCompressClient.");
192
		
193
		int error = NCSEcwCompressCloseNat(cPtr);
194
		
195
		if(error == -1)
196
			throw new EcwException("Error en NCSEcwCompress(). No se ha podido obtener un objeto NCSEcwCompress valido");
197
		else if(error != 0)
198
			throw new EcwException("Error en NCSEcwCompress(). La llamada nativa ha devuelto un error "+NCSError.ErrorToString(error));
199
	}
200
	
201
	/**
202
	 * Cancela la compresi?n
203
	 * @throws EcwException Se produce cuando la llamada nativa devuelve un c?digo de error
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
	 */
216
	public void finalize()throws EcwException {
217
		
218
		if(cPtr == 0)
219
			throw new EcwException("Error en finalize(). No hay una referencia v?lida al objeto NCSEcwCompressClient y no se ha podido liberar la memoria.");
220
		
221
		//TODO: Temporalmente deshabilitado.
222
		//finalizeNat(cPtr);
223
	}
224
	
225
	/**
226
	 * Asigna el nombre del fichero de entrada
227
	 * @param filename	Nombre del fichero
228
	 */
229
	public void setInputFilename(String filename){inputFilename=filename;};
230
	
231
	/**
232
	 * Asigna el nombre del fichero de salida
233
	 * @param filename	Nombre del fichero
234
	 */
235
	public void setOutputFilename(String filename){outputFilename=filename;};
236
	
237
	/**
238
	 * Asigna el nivel de compresi?n
239
	 * @param compress nivel de compresi?n
240
	 */
241
	public void setTargetCompress(double compress){targetCompression=compress;};
242
	
243
	/**
244
	 * Asigna el formato de compresi?n.
245
	 * @param format	formato de compresi?n. Los valores que puede tomar son:
246
	 * <UL>
247
	 * <LI>COMPRESS_NONE	= NCSCS_NONE</LI>
248
	 * <LI>COMPRESS_UINT8	= NCSCS_GREYSCALE</LI>
249
	 * <LI>COMPRESS_YUV		= NCSCS_YUV</LI>
250
	 * <LI>COMPRESS_MULTI	= NCSCS_MULTIBAND</LI>
251
	 * <LI>COMPRESS_RGB		= NCSCS_sRGB</LI>
252
	 * </UL>
253
	 */
254
	public void setCompressFormat(int format){eCompressFormat=format;};
255
	
256
	/**
257
	 * Asigna el Compress Hint. 
258
	 * @param Compress hint. Los valores que puede tomar son:
259
	 * <UL>
260
	 * <LI>COMPRESS_HINT_NONE	= 0</LI>
261
	 * <LI>COMPRESS_HINT_FAST	= 1</LI>
262
	 * </LI>COMPRESS_HINT_BEST	= 2</LI>
263
	 * <LI>COMPRESS_HINT_INTERNET = 3</LI>
264
	 * </UL>
265
	 */
266
	public void setCompressHint(int hint){eCompressHint=hint;};
267
	
268
	/**
269
	 * Asigna el tama?o de bloque en x
270
	 * @param n	tama?o de bloque en x
271
	 */
272
	public void setBlockSizeX(int n){nBlockSizeX=n;};
273
	
274
	/**
275
	 * Asigna el tama?o de bloque en y
276
	 * @param n	tama?o de bloque en y
277
	 */
278
	public void setBlockSizeY(int n){nBlockSizeY=n;};
279
	
280
	/**
281
	 * Asigna el tama?o de la imagen de salida en x
282
	 * @param n	tama?o de imagen de salida en x
283
	 */
284
	public void setInOutSizeX(int n){nInOutSizeX=n;};
285
	
286
	/**
287
	 * Asigna el tama?o de la imagen de salida en y
288
	 * @param n	tama?o de imagen de salida en y
289
	 */
290
	public void setInOutSizeY(int n){nInOutSizeY=n;};
291
	
292
	/**
293
	 * Asigna el n?mero de bandas de entrada
294
	 * @param n	N?mero de bandas de entrada
295
	 */
296
	public void setInputBands(int n){nInputBands=n;};
297
	
298
	/**
299
	 * Asigna el n?mero de bandas de salida
300
	 * @param n	N?mero de bandas de salida
301
	 */
302
	public void setOutputBands(int n){nOutputBands=n;};
303
	
304
	public void setInputSize(long nis){nInputSize=nis;};
305
	public void setCellIncrementX(double x){fCellIncrementX=x;};
306
	public void setCellIncrementY(double y){fCellIncrementY=y;};
307
	public void setOriginX(double x){fOriginX=x;};
308
	public void setOriginY(double y){fOriginY=y;};
309

  
310
	/**
311
	 * Asigna el tama?o de celda
312
	 * @param cellu	tama?o de celda. Puede tomar un valor entre los siguientes:
313
	 * <UL>
314
	 * <LI>ECW_CELL_UNITS_INVALID	=	0</LI>
315
	 * <LI>ECW_CELL_UNITS_METERS	=	1</LI>
316
	 * <LI>ECW_CELL_UNITS_DEGREES	=	2</LI>
317
	 * <LI>ECW_CELL_UNITS_FEET		=	3</LI>
318
	 * <LI>ECW_CELL_UNITS_UNKNOWN	=	4</LI>
319
	 * </UL>
320
	 */
321
	public void setCellSizeUnits(int cellu){eCellSizeUnits=cellu;};
322
	
323
	/**
324
	 * Asigna el datum
325
	 * @param dat	datum
326
	 */
327
	public void setDatum(String dat){szDatum=dat;};
328
	
329
	/**
330
	 * Asigna la proyecci?n
331
	 * @param proj	Proyecci?n
332
	 */
333
	public void setProjection(String proj){szProjection=proj;};
334
	
335
	public void setActualCompression(double comp){fActualCompression=comp;};
336
	public void setCompressionSeconds(double comp){fCompressionSeconds=comp;};
337
	public void setCompressionMBSec(double comp){fCompressionMBSec=comp;};
338
	public void setOutputSize(long n){nOutputSize=n;};
339
}
340

  
0 341

  
tags/tmp_build/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/NCSError.java
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     NCSError.java
5
 * Project:  
6
 * Purpose:  
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
*
12
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
*
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License
16
* as published by the Free Software Foundation; either version 2
17
* of the License, or (at your option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
*
28
* For more information, contact:
29
*
30
*  Generalitat Valenciana
31
*   Conselleria d'Infraestructures i Transport
32
*   Av. Blasco Ib??ez, 50
33
*   46010 VALENCIA
34
*   SPAIN
35
*
36
*      +34 963862235
37
*   gvsig@gva.es
38
*      www.gvsig.gva.es
39
*
40
*    or
41
*
42
*   IVER T.I. S.A
43
*   Salamanca 50
44
*   46005 Valencia
45
*   Spain
46
*
47
*   +34 963163400
48
*   dac@iver.es
49
*/
50

  
51
package es.gva.cit.jecwcompress;
52

  
53
/**
54
 * Clase que realiza la conversi?n de los c?digos de error que devuelve las funciones C
55
 * en cadenas para que pueda ser mostrado el significado del error al usuario.
56
 * 
57
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
58
 * @version 0.0
59
 * @link http://www.gvsig.gva.es
60
 */
61
public class NCSError {
62
	
63
	/**
64
	 * Conversi?n de un c?digo de error pasado por par?metro a cadena
65
	 * @return cadena que representa el error producido
66
	 */
67
	public static String ErrorToString(int error){
68
	
69
		switch(error){
70
			case 0: return new String("NCS_SUCCESS");
71
			case 1: return new String("NCS_QUEUE_NODE_CREATE_FAILED");			/**< Queue node creation failed */
72
			case 2: return new String("NCS_FILE_OPEN_FAILED");					/**< File open failed */
73
			case 3: return new String("NCS_FILE_LIMIT_REACHED");					/**< The Image Web Server's licensed file limit has been reached */
74
			case 4: return new String("NCS_FILE_SIZE_LIMIT_REACHED");			/**< The requested file is larger than is permitted by the license on this Image Web Server */
75
			case 5: return new String("NCS_FILE_NO_MEMORY");						/**< Not enough memory for new file */
76
			case 6: return new String("NCS_CLIENT_LIMIT_REACHED");				/**< The Image Web Server's licensed client limit has been reached */
77
			case 7: return new String("NCS_DUPLICATE_OPEN");						/**< Detected duplicate open from net layer */
78
			case 8: return new String("NCS_PACKET_REQUEST_NYI");					/**< Packet request type not yet implemented */
79
			case 9: return new String("NCS_PACKET_TYPE_ILLEGAL");				/**< Packet type is illegal */
80
			case 10: return new String("NCS_DESTROY_CLIENT_DANGLING_REQUESTS");	/**< Client closed while requests outstanding */
81
			case 11: return new String("NCS_UNKNOWN_CLIENT_UID");					/**< Client UID unknown */
82
			case 12: return new String("NCS_COULDNT_CREATE_CLIENT");				/**< Could not create new client */
83
			case 13: return new String("NCS_NET_COULDNT_RESOLVE_HOST");			/**< Could not resolve address of Image Web Server */
84
			case 14: return new String("NCS_NET_COULDNT_CONNECT");				/**< Could not connect to host */
85
			case 15: return new String("NCS_NET_RECV_TIMEOUT");					/**< Receive timeout */
86
			case 16: return new String("NCS_NET_HEADER_SEND_FAILURE");			/**< Error sending header */
87
			case 17: return new String("NCS_NET_HEADER_RECV_FAILURE");			/**< Error receiving header */
88
			case 18: return new String("NCS_NET_PACKET_SEND_FAILURE");			/**< Error sending packet */
89
			case 19: return new String("NCS_NET_PACKET_RECV_FAILURE");			/**< Error receiving packet */
90
			case 20: return new String("NCS_NET_401_UNAUTHORISED");				/**< 401 Unauthorised: SDK doesn't do authentication so this suggests a misconfigured server */			
91
			case 21: return new String("NCS_NET_403_FORBIDDEN");					/**< 403 Forbidden: could be a 403.9 from IIS or PWS meaning that the maximum simultaneous request limit has been reached */
92
			case 22: return new String("NCS_NET_404_NOT_FOUND");					/**< 404 Not Found: this error suggests that the server hasn't got Image Web Server installed */
93
			case 23: return new String("NCS_NET_407_PROXYAUTH");					/**< 407 Proxy Authentication: the SDK doesn't do proxy authentication yet either, so this also suggests misconfiguration */
94
			case 24: return new String("NCS_NET_UNEXPECTED_RESPONSE");			/**< Unexpected HTTP response could not be handled */
95
			case 25: return new String("NCS_NET_BAD_RESPONSE");					/**< HTTP response received outside specification */
96
			case 26: return new String("NCS_NET_ALREADY_CONNECTED");				/**< Already connected */
97
			case 27: return new String("NCS_INVALID_CONNECTION");					/**< Connection is invalid */
98
			case 28: return new String("NCS_WINSOCK_FAILURE");					/**< A Windows sockets failure occurred */
99
			case 29: return new String("NCS_SYMBOL_ERROR");			/**< Symbology error */
100
			case 30: return new String("NCS_OPEN_DB_ERROR");			/**< Could not open database */
101
			case 31: return new String("NCS_DB_QUERY_FAILED");		/**< Could not execute the requested query on database */
102
			case 32: return new String("NCS_DB_SQL_ERROR");			/**< SQL statement could not be executed */
103
			case 33: return new String("NCS_GET_LAYER_FAILED");		/**< Open symbol layer failed */
104
			case 34: return new String("NCS_DB_NOT_OPEN");			/**< The database is not open */
105
			case 35: return new String("NCS_QT_TYPE_UNSUPPORTED");	/**< This type of quadtree is not supported */
106
			case 36: return new String("NCS_PREF_INVALID_USER_KEY");		/**< Invalid local user key name specified */
107
			case 37: return new String("NCS_PREF_INVALID_MACHINE_KEY");	/**< Invalid local machine key name specified */
108
			case 38: return new String("NCS_REGKEY_OPENEX_FAILED");		/**< Failed to open registry key */
109
			case 39: return new String("NCS_REGQUERY_VALUE_FAILED");		/**< Registry query failed */
110
			case 40: return new String("NCS_INVALID_REG_TYPE");			/**< Type mismatch in registry variable */
111
			case 41: return new String("NCS_INVALID_ARGUMENTS");		/**< Invalid arguments passed to function */
112
			case 42: return new String("NCS_ECW_ERROR");				/**< ECW error */
113
			case 43: return new String("NCS_SERVER_ERROR");			/**< Server error */
114
			case 44: return new String("NCS_UNKNOWN_ERROR");			/**< Unknown error */
115
			case 45: return new String("NCS_EXTENT_ERROR");			/**< Extent conversion failed */
116
			case 46: return new String("NCS_COULDNT_ALLOC_MEMORY");	/**< Could not allocate enough memory */
117
			case 47: return new String("NCS_INVALID_PARAMETER");		/**< An invalid parameter was used */
118
			case 48: return new String("NCS_FILEIO_ERROR");						/**< Error reading or writing file */
119
			case 49: return new String("NCS_COULDNT_OPEN_COMPRESSION");			/**< Compression task could not be initialised */
120
			case 50: return new String("NCS_COULDNT_PERFORM_COMPRESSION");		/**< Compression task could not be processed */
121
			case 51: return new String("NCS_GENERATED_TOO_MANY_OUTPUT_LINES");	/**< Trying to generate too many output lines */
122
			case 52: return new String("NCS_USER_CANCELLED_COMPRESSION");			/**< Compression task was cancelled by client application */
123
			case 53: return new String("NCS_COULDNT_READ_INPUT_LINE");			/**< Could not read line from input data */
124
			case 54: return new String("NCS_INPUT_SIZE_EXCEEDED");				/**< Input image size was exceeded for this version of the SDK */
125
			case 55: return new String("NCS_REGION_OUTSIDE_FILE");	/**< Specified image region is outside image extents */
126
			case 56: return new String("NCS_NO_SUPERSAMPLE");			/**< Supersampling is not supported by the SDK functions */
127
			case 57: return new String("NCS_ZERO_SIZE");				/**< Specified image region has a zero width or height */
128
			case 58: return new String("NCS_TOO_MANY_BANDS");			/**< More bands specified than exist in the input file */
129
			case 59: return new String("NCS_INVALID_BAND_NR");		/**< An invalid band number has been specified */
130
			case 60: return new String("NCS_INPUT_SIZE_TOO_SMALL");	/**< Input image size is too small to compress - for ECW compression there is a minimum output file size */
131
			case 61: return new String("NCS_INCOMPATIBLE_PROTOCOL_VERSION");	/**< The ECWP client version is incompatible with this server */
132
			case 62: return new String("NCS_WININET_FAILURE");				/**< Windows Internet Client error */
133
			case 63: return new String("NCS_COULDNT_LOAD_WININET");			/**< wininet.dll could not be loaded - usually indicates Internet Explorer should be upgraded */
134
			case 64: return new String("NCS_FILE_INVALID_SETVIEW");			/**< The parameters specified for setting a file view were invalid, or the view was not set */
135
			case 65: return new String("NCS_FILE_NOT_OPEN");					/**< No file is open */
136
			case 66: return new String("NCS_JNI_REFRESH_NOT_IMPLEMENTED");	/**< Class does not implement ECWProgressiveDisplay interface */
137
			case 67: return new String("NCS_INCOMPATIBLE_COORDINATE_SYSTEMS");	/**< Incompatible coordinate systems */
138
			case 68: return new String("NCS_INCOMPATIBLE_COORDINATE_DATUM");		/**< Incompatible coordinate datum types */
139
			case 69: return new String("NCS_INCOMPATIBLE_COORDINATE_PROJECTION");	/**< Incompatible coordinate projection types */
140
			case 70: return new String("NCS_INCOMPATIBLE_COORDINATE_UNITS");		/**< Incompatible coordinate units types */
141
			case 71: return new String("NCS_COORDINATE_CANNOT_BE_TRANSFORMED");	/**< Non-linear coordinate systems not supported */
142
			case 72: return new String("NCS_GDT_ERROR");							/**< Error involving the GDT database */
143
			case 73: return new String("NCS_NET_PACKET_RECV_ZERO_LENGTH");	/**< Zero length packet received */
144
			case 74: return new String("NCS_UNSUPPORTEDLANGUAGE");			/**< Must use Japanese version of the ECW SDK */
145
			case 75: return new String("NCS_CONNECTION_LOST");				/**< Connection to server was lost */
146
			case 76: return new String("NCS_COORD_CONVERT_ERROR");			/**< NCSGDT coordinate conversion failed */
147
			case 77: return new String("NCS_METABASE_OPEN_FAILED");			/**< Failed to open metabase */
148
			case 78: return new String("NCS_METABASE_GET_FAILED");			/**< Failed to get value from metabase */
149
			case 79: return new String("NCS_NET_HEADER_SEND_TIMEOUT");		/**< Timeout sending header */
150
			case 80: return new String("NCS_JNI_ERROR");						/**< Java JNI error */
151
			case 81: return new String("NCS_DB_INVALID_NAME");				/**< No data source passed */
152
			case 82: return new String("NCS_SYMBOL_COULDNT_RESOLVE_HOST");	/**< Could not resolve address of Image Web Server Symbol Server Extension */
153
			case 83: return new String("NCS_INVALID_ERROR_ENUM");			/**< The value of an NCSError error number was invalid! */
154
			case 84: return new String("NCS_FILE_EOF");						/**< End of file reached */
155
			case 85: return new String("NCS_FILE_NOT_FOUND");				/**< File not found */
156
			case 86: return new String("NCS_FILE_INVALID");					/**< File was invalid or corrupt */
157
			case 87: return new String("NCS_FILE_SEEK_ERROR");				/**< Attempted to read, write or seek past file limits */
158
			case 88: return new String("NCS_FILE_NO_PERMISSIONS");			/**< Permissions not available to access file */
159
			case 89: return new String("NCS_FILE_OPEN_ERROR");				/**< Error opengin file */
160
			case 90: return new String("NCS_FILE_CLOSE_ERROR");				/**< Error closing file */
161
			case 91: return new String("NCS_FILE_IO_ERROR");					/**< Miscellaneous error involving file input or output */
162
			case 92: return new String("NCS_SET_EXTENTS_ERROR");				/**< Illegal or invalid world coordinates supplied */
163
			case 93: return new String("NCS_FILE_PROJECTION_MISMATCH");		/**< Image projection does not match that of the controlling layer */
164
			case 94: return new String("NCS_GDT_UNKNOWN_PROJECTION");		/**< Unknown map projection */
165
			case 95: return new String("NCS_GDT_UNKNOWN_DATUM");				/**< Unknown geodetic datum */
166
			case 96: return new String("NCS_GDT_USER_SERVER_FAILED");		/**< User specified Geographic Projection Database data server failed */
167
			case 97: return new String("NCS_GDT_REMOTE_PATH_DISABLED");		/**< Remote Geographic Projection Database file downloading has been disabled and no local GDT data is available */
168
			case 98: return new String("NCS_GDT_BAD_TRANSFORM_MODE");		/**< Invalid mode of transform */
169
			case 99: return new String("NCS_GDT_TRANSFORM_OUT_OF_BOUNDS");	/**< Coordinate to be transformed is out of bounds */
170
			case 100: return new String("NCS_LAYER_DUPLICATE_LAYER_NAME");	/**< A layer already exists with the specified name */
171
			case 101: return new String("NCS_LAYER_INVALID_PARAMETER");		/**< The specified layer does not contain the specified parameter */
172
			case 102: return new String("NCS_PIPE_CREATE_FAILED");			/**< Failed to create pipe */
173
			case 103: return new String("NCS_FILE_MKDIR_EXISTS");				/**< Directory to be created already exists */ /*[20]*/
174
			case 104: return new String("NCS_FILE_MKDIR_PATH_NOT_FOUND");		/**< The path specified for directory creation does not exist */ /*[20]*/
175
			case 105: return new String("NCS_ECW_READ_CANCELLED");			/**< File read was cancelled */
176
			case 106: return new String("NCS_JP2_GEODATA_READ_ERROR");		/**< Error reading geodata from a JPEG 2000 file */ /*[21]*/
177
			case 107: return new String("NCS_JP2_GEODATA_WRITE_ERROR");    	/**< Error writing geodata to a JPEG 2000 file */	/*[21]*/
178
			case 108: return new String("NCS_JP2_GEODATA_NOT_GEOREFERENCED"); /**< JPEG 2000 file not georeferenced */			/*[21]*/
179
			case 109: return new String("NCS_MAX_ERROR_NUMBER");				/**< The maximum error value in this enumerated typ*/
180
		}
181
		return new String("");
182
	}
183
}
0 184

  
tags/tmp_build/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/CompressHint.java
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     CompressHint.java
5
 * Project:  
6
 * Purpose:  
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
*
12
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
*
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License
16
* as published by the Free Software Foundation; either version 2
17
* of the License, or (at your option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
*
28
* For more information, contact:
29
*
30
*  Generalitat Valenciana
31
*   Conselleria d'Infraestructures i Transport
32
*   Av. Blasco Ib??ez, 50
33
*   46010 VALENCIA
34
*   SPAIN
35
*
36
*      +34 963862235
37
*   gvsig@gva.es
38
*      www.gvsig.gva.es
39
*
40
*    or
41
*
42
*   IVER T.I. S.A
43
*   Salamanca 50
44
*   46005 Valencia
45
*   Spain
46
*
47
*   +34 963163400
48
*   dac@iver.es
49
*/
50

  
51
package es.gva.cit.jecwcompress;
52

  
53
/**
54
 * @author Nacho Brodin <brodin_ign@gva.es>.<BR> Equipo de desarrollo gvSIG.<BR> http://www.gvsig.gva.es
55
 * @version 0.0
56
 * @link http://www.gvsig.gva.es
57
 */
58
public class CompressHint {
59
	
60
	public final static int COMPRESS_HINT_NONE		= 0;
61
	public final static int COMPRESS_HINT_FAST		= 1;
62
	public final static int COMPRESS_HINT_BEST		= 2;
63
	public final static int COMPRESS_HINT_INTERNET	= 3;
64
	 
65
}
0 66

  
tags/tmp_build/libraries/libjni-ecwcompress/src/es/gva/cit/jecwcompress/CompressFormat.java
1
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     CompressFormat.java
5
 * Project:  
6
 * Purpose:  
7
 * Author:   Nacho Brodin, brodin_ign@gva.es
8
 *
9
 **********************************************************************/
10
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
11
*
12
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
13
*
14
* This program is free software; you can redistribute it and/or
15
* modify it under the terms of the GNU General Public License
16
* as published by the Free Software Foundation; either version 2
17
* of the License, or (at your option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
27
*
28
* For more information, contact:
29
*
30
*  Generalitat Valenciana
31
*   Conselleria d'Infraestructures i Transport
32
*   Av. Blasco Ib??ez, 50
33
*   46010 VALENCIA
34
*   SPAIN
35
*
36
*      +34 963862235
37
*   gvsig@gva.es
38
*      www.gvsig.gva.es
39
*
40
*    or
41
*
42
*   IVER T.I. S.A
43
*   Salamanca 50
44
*   46005 Valencia
45
*   Spain
46
*
47
*   +34 963163400
48
*   dac@iver.es
49
*/
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff