Revision 8460

View differences:

trunk/libraries/libjni-mrsid/include/es_gva_cit_jmrsid_LTIImage.h
71 71
JNIEXPORT void JNICALL Java_es_gva_cit_jmrsid_LTIImage_FreeLTIImageNat
72 72
  (JNIEnv *, jobject, jlong);
73 73

  
74
/*
75
 * Class:     es_gva_cit_jmrsid_LTIImage
76
 * Method:    getMinMagnificationNat
77
 * Signature: (J)D
78
 */
79
JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIImage_getMinMagnificationNat
80
  (JNIEnv *, jobject, jlong);
81

  
82
/*
83
 * Class:     es_gva_cit_jmrsid_LTIImage
84
 * Method:    getMaxMagnificationNat
85
 * Signature: (J)D
86
 */
87
JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIImage_getMaxMagnificationNat
88
  (JNIEnv *, jobject, jlong);
89

  
74 90
#ifdef __cplusplus
75 91
}
76 92
#endif
trunk/libraries/libjni-mrsid/src-test/Overviews.java
73 73
	   		
74 74
	   		//Obtenemos algunos datos
75 75
	   		
76
	   		int overviews=((MrSIDImageReader)img).getNumLevels()-1;
76
	   		int overviews = ((MrSIDImageReader)img).getNumLevels() ;
77 77
	   		System.out.println("Overviews="+overviews);
78 78
	   		System.out.println("Width="+img.getWidth());
79 79
	   		System.out.println("Height="+img.getHeight());
......
85 85
	   		eSampleType=img.getDataType();
86 86
	   		System.out.println("DataType="+eSampleType);
87 87
	   		pixel=new LTIPixel(eColorSpace, nBands, eSampleType);
88
	   		double mag = ((LTIImage)img).getMinMagnification();
89
	   		System.out.println("MinMagnification="+mag);
90

  
91
	   		System.out.println("Levels from min mag: " + ((MrSIDImageReader)img).getNumLevelsFromMinMagnification());	   	
88 92
	   		
89 93
	   		System.out.println("**************Zoom******************");
90 94
	   		
95
	   		for(int i = 0; i < overviews ; i++){
96
		   		double zoom = LTIUtils.levelToMag(i);
97
		   		int[] dims=img.getDimsAtMag(zoom);
98
		   		System.out.println("Dims At overview "+ i +"= "+dims[0]+" "+dims[1]);
99
		   		System.out.println("Zoom="+zoom);
100
	   		}
101
	   		
91 102
	   		double zoom = LTIUtils.levelToMag(overviews);
92 103
	   		int[] dims=img.getDimsAtMag(zoom);
93
	   		System.out.println("Dims At overview "+overviews+"= "+dims[0]+" "+dims[1]);
94
	   		System.out.println("Zoom="+zoom);
95
	   		
96 104
	   		System.out.println("************************************");
97 105
	   		
98 106
	   		//Creamos la escena con el tama?o del overview deseado
trunk/libraries/libjni-mrsid/src/mrsidimagereader.cpp
139 139
   	
140 140
  	const LTFileSpec fileSpec(pszFilename);
141 141
  	poImageReader = new MrSIDImageReader( fileSpec );
142

  
142 143
  	*(LTIImageReader **)&jresult = poImageReader;
143 144
    
144 145
    env->ReleaseByteArrayElements(pszF, (jbyte *)pszFilename, 0);
......
188 189

  
189 190
 
190 191
  
191
  
192
  
trunk/libraries/libjni-mrsid/src/es/gva/cit/jmrsid/LTIImage.java
50 50

  
51 51
package es.gva.cit.jmrsid;
52 52

  
53
import java.io.*;
54 53

  
55 54
/**
56 55
 * Clase base que representa a una im?gen.
......
70 69
	private native long getNoDataPixelNat(long cPtr);
71 70
	private native int getGeoCoordNat(long cPtr, LTIGeoCoord geocoord);
72 71
	private native void FreeLTIImageNat(long cPtr);
72
	private native double getMinMagnificationNat(long cPtr);
73
	private native double getMaxMagnificationNat(long cPtr);
73 74
	
74 75
	LTIGeoCoord geocoord=null;
75 76
	
......
298 299
	 	else return pixel;
299 300

  
300 301
	 }
302
	 
303
	 /**
304
	  * This function returns the minimum magnification of the image. 
305
	  * Images that do not support "zooming out" will return 1.0; images that contain "overviews"
306
	  * 
307
	  * @throws MrSIDException
308
	  * @return the minimum magnification
309
	  */
310
	  public double getMinMagnification()throws MrSIDException{
311
			
312
		if(cPtr <= 0)
313
		 	throw new MrSIDException("Error en getMinMagnification(). El Open del MrSID no tuvo ?xito");
314
			
315
		return this.getMinMagnificationNat(cPtr);
301 316
	
317
	  }
318
	  
319
	  /**
320
	   * This function returns the minimum magnification of the image. 
321
	   * Images that do not support "zooming out" will return 1.0; images that contain "overviews"
322
	   * 
323
	   * @throws MrSIDException
324
	   * @return the minimum magnification
325
	   */
326
	   public double getMaxMagnification()throws MrSIDException{
327
				
328
		if(cPtr <= 0)
329
		 	throw new MrSIDException("Error en getMaxMagnification(). El Open del MrSID no tuvo ?xito");
330
				
331
		return this.getMaxMagnificationNat(cPtr);
332
		
333
	   }
334
	
302 335

  
303 336
}
trunk/libraries/libjni-mrsid/src/es/gva/cit/jmrsid/MrSIDImageReader.java
103 103
	 * Obtiene el n?mero de niveles
104 104
	 */
105 105
	public int getNumLevels()throws MrSIDException{
106
		String os = System.getProperty("os.name").toLowerCase();
107
		if(os.startsWith("mac os x")){
108
			return getNumLevelsFromMinMagnification();
109
		}else{
110
			String msg1="Error en getNumLevels. No se ha obtenido un puntero valido a LTIImage";
111
			String msg2="La llamada nativa a getNumLevels ha devuelto un c?digo de error";
112
			return baseSimpleFunction(2,msg1,msg2);
113
		}
106 114
		
107
		String msg1="Error en getNumLevels. No se ha obtenido un puntero valido a LTIImage";
108
		String msg2="La llamada nativa a getNumLevels ha devuelto un c?digo de error";
109
		return baseSimpleFunction(2,msg1,msg2);
115
	}
116
	
117
	/**
118
	 * Obtiene el n?mero de niveles s partir de getMinMagnification. 
119
	 * (Funcion creada para Mac sobre Power PC por los problemas con getNumLevels)
120
	 */
121
	public int getNumLevelsFromMinMagnification()throws MrSIDException{
110 122
		
123
		double mag = getMinMagnification();
124
   		
125
   		double aux = getWidth() * mag;
126
   		int cont = 0;
127
   		while(aux < getWidth()){
128
   			aux *= 2;
129
   			cont ++;
130
   		}
131
		return cont;
111 132
	}
112 133
			
113 134
}
trunk/libraries/libjni-mrsid/src/ltiimage.cpp
282 282
  }  
283 283
  
284 284
/******************************************************************************/
285
//						 		getMinMagnification
286
/******************************************************************************/
287

  
288

  
289
JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIImage_getMinMagnificationNat
290
  (JNIEnv *env, jobject obj, jlong cPtr){
291
  	
292
    LTIImage *img  = (LTIImage *) 0 ;
293
  	double res = -1;
294
   	  	
295
    img = *(LTIImage **)&cPtr;
296
    
297
    if(img!=NULL)
298
    	res = img->getMinMagnification();	
299

  
300
    return (jdouble)res;
301
  		
302
  }
303
  
304
/******************************************************************************/
305
//						 		getMaxMagnification
306
/******************************************************************************/
307

  
308

  
309
JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIImage_getMaxMagnificationNat
310
  (JNIEnv *env, jobject obj, jlong cPtr){
311
  	
312
    LTIImage *img  = (LTIImage *) 0 ;
313
  	double res = -1;
314
   	  	
315
    img = *(LTIImage **)&cPtr;
316
    
317
    if(img!=NULL)
318
    	res = img->getMaxMagnification();	
319

  
320
    return (jdouble)res;
321
  		
322
  }
323
  
324
/******************************************************************************/
285 325
//						 		getPixelProps
286 326
/******************************************************************************/
287 327

  
288 328

  
289
JNIEXPORT jlong JNICALL Java_es_gva_cit_jmrsid_LTIImage_getPixelPropsNat
329
/*JNIEXPORT jdouble JNICALL Java_es_gva_cit_jmrsid_LTIImage_getPixelPropsNat
290 330
  (JNIEnv *env, jobject obj, jlong cPtr){
291 331
  	
292
	jlong jresult = 0 ;
332
	jlong jresult = 0 ;*/
293 333
  	/*LTIImage *img  = (LTIImage *) 0 ;
294 334
  	
295 335
  
......
301 341
  
302 342
  	return (jlong)pixelprops;
303 343
  	}*/
304
  	return jresult;
344
  	/*return jresult;
305 345
  		
306
  } 
346
  } */
307 347
  
308 348
/******************************************************************************/
309 349
//						 		getGeoCoord

Also available in: Unified diff