Mercurial > hg > digilib-old
comparison servlet/src/digilib/io/ImageFileset.java @ 295:90bab835fc25
Servlet version 1.5.0b -- the beginning of the next generation :-)
- code restructuring to improve scaleability
- new Initialiser servlet that must be run first
- image transformation work moved to DigilibImageWorker class
- Maximum number of concurrent threads limited by Semaphore
- old JIMI toolkit implementation removed
author | robcast |
---|---|
date | Sun, 24 Oct 2004 20:23:50 +0200 |
parents | c633e97cac12 |
children | 7958035abec1 |
comparison
equal
deleted
inserted
replaced
294:5b4fbec16a2c | 295:90bab835fc25 |
---|---|
43 | 43 |
44 /** list of files (ImageFile) */ | 44 /** list of files (ImageFile) */ |
45 private ArrayList list = null; | 45 private ArrayList list = null; |
46 | 46 |
47 /** aspect ratio (width/height) */ | 47 /** aspect ratio (width/height) */ |
48 private double aspect = 0; | 48 private float aspect = 0; |
49 | 49 |
50 /** resolution of the biggest image (DPI) */ | 50 /** resolution of the biggest image (DPI) */ |
51 private double resX = 0; | 51 private float resX = 0; |
52 | 52 |
53 /** resolution of the biggest image (DPI) */ | 53 /** resolution of the biggest image (DPI) */ |
54 private double resY = 0; | 54 private float resY = 0; |
55 | 55 |
56 /** | 56 /** |
57 * Creator for empty fileset. | 57 * Creator for empty fileset. |
58 * | 58 * |
59 * | 59 * |
276 // basename doesn't match | 276 // basename doesn't match |
277 continue; | 277 continue; |
278 } | 278 } |
279 } | 279 } |
280 if (FileOps.classForFilename(dirFiles[fileIdx]) == FileOps.CLASS_IMAGE) { | 280 if (FileOps.classForFilename(dirFiles[fileIdx]) == FileOps.CLASS_IMAGE) { |
281 logger.debug("adding file " + dirFiles[fileIdx] | 281 /* logger.debug("adding file " + dirFiles[fileIdx] |
282 + " to Fileset " + this.getName()); | 282 + " to Fileset " + this.getName()); */ |
283 add(new ImageFile(dirFiles[fileIdx], this, dirs[dirIdx])); | 283 add(new ImageFile(dirFiles[fileIdx], this, dirs[dirIdx])); |
284 } | 284 } |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
317 } | 317 } |
318 } | 318 } |
319 } | 319 } |
320 metaChecked = true; | 320 metaChecked = true; |
321 String s; | 321 String s; |
322 double dpi = 0; | 322 float dpi = 0; |
323 double dpix = 0; | 323 float dpix = 0; |
324 double dpiy = 0; | 324 float dpiy = 0; |
325 double sizex = 0; | 325 float sizex = 0; |
326 double sizey = 0; | 326 float sizey = 0; |
327 double pixx = 0; | 327 float pixx = 0; |
328 double pixy = 0; | 328 float pixy = 0; |
329 // DPI is valid for X and Y | 329 // DPI is valid for X and Y |
330 if (fileMeta.containsKey("original-dpi")) { | 330 if (fileMeta.containsKey("original-dpi")) { |
331 try { | 331 try { |
332 dpi = Double.parseDouble((String) fileMeta.get("original-dpi")); | 332 dpi = Float.parseFloat((String) fileMeta.get("original-dpi")); |
333 } catch (NumberFormatException e) { | 333 } catch (NumberFormatException e) { |
334 } | 334 } |
335 if (dpi != 0) { | 335 if (dpi != 0) { |
336 resX = dpi; | 336 resX = dpi; |
337 resY = dpi; | 337 resY = dpi; |
340 } | 340 } |
341 // DPI-X and DPI-Y | 341 // DPI-X and DPI-Y |
342 if (fileMeta.containsKey("original-dpi-x") | 342 if (fileMeta.containsKey("original-dpi-x") |
343 && fileMeta.containsKey("original-dpi-y")) { | 343 && fileMeta.containsKey("original-dpi-y")) { |
344 try { | 344 try { |
345 dpix = Double.parseDouble((String) fileMeta | 345 dpix = Float.parseFloat((String) fileMeta |
346 .get("original-dpi-x")); | 346 .get("original-dpi-x")); |
347 dpiy = Double.parseDouble((String) fileMeta | 347 dpiy = Float.parseFloat((String) fileMeta |
348 .get("original-dpi-y")); | 348 .get("original-dpi-y")); |
349 } catch (NumberFormatException e) { | 349 } catch (NumberFormatException e) { |
350 } | 350 } |
351 if ((dpix != 0) && (dpiy != 0)) { | 351 if ((dpix != 0) && (dpiy != 0)) { |
352 resX = dpix; | 352 resX = dpix; |
358 if (fileMeta.containsKey("original-size-x") | 358 if (fileMeta.containsKey("original-size-x") |
359 && fileMeta.containsKey("original-size-y") | 359 && fileMeta.containsKey("original-size-y") |
360 && fileMeta.containsKey("original-pixel-x") | 360 && fileMeta.containsKey("original-pixel-x") |
361 && fileMeta.containsKey("original-pixel-y")) { | 361 && fileMeta.containsKey("original-pixel-y")) { |
362 try { | 362 try { |
363 sizex = Double.parseDouble((String) fileMeta | 363 sizex = Float.parseFloat((String) fileMeta |
364 .get("original-size-x")); | 364 .get("original-size-x")); |
365 sizey = Double.parseDouble((String) fileMeta | 365 sizey = Float.parseFloat((String) fileMeta |
366 .get("original-size-y")); | 366 .get("original-size-y")); |
367 pixx = Double.parseDouble((String) fileMeta | 367 pixx = Float.parseFloat((String) fileMeta |
368 .get("original-pixel-x")); | 368 .get("original-pixel-x")); |
369 pixy = Double.parseDouble((String) fileMeta | 369 pixy = Float.parseFloat((String) fileMeta |
370 .get("original-pixel-y")); | 370 .get("original-pixel-y")); |
371 } catch (NumberFormatException e) { | 371 } catch (NumberFormatException e) { |
372 } | 372 } |
373 if ((sizex != 0) && (sizey != 0) && (pixx != 0) && (pixy != 0)) { | 373 if ((sizex != 0) && (sizey != 0) && (pixx != 0) && (pixy != 0)) { |
374 resX = pixx / (sizex * 100 / 2.54); | 374 resX = pixx / (sizex * 100 / 2.54f); |
375 resY = pixy / (sizey * 100 / 2.54); | 375 resY = pixy / (sizey * 100 / 2.54f); |
376 return; | 376 return; |
377 } | 377 } |
378 } | 378 } |
379 } | 379 } |
380 | 380 |
381 /** | 381 /** |
382 * @return | 382 * @return |
383 */ | 383 */ |
384 public double getResX() { | 384 public float getResX() { |
385 return resX; | 385 return resX; |
386 } | 386 } |
387 | 387 |
388 /** | 388 /** |
389 * @return | 389 * @return |
390 */ | 390 */ |
391 public double getResY() { | 391 public float getResY() { |
392 return resY; | 392 return resY; |
393 } | 393 } |
394 | 394 |
395 /** | 395 /** |
396 * Sets the aspect ratio from an ImageSize. | 396 * Sets the aspect ratio from an ImageSize. |
409 * landscape. | 409 * landscape. |
410 * | 410 * |
411 * | 411 * |
412 * @return | 412 * @return |
413 */ | 413 */ |
414 public double getAspect() { | 414 public float getAspect() { |
415 return aspect; | 415 return aspect; |
416 } | 416 } |
417 | 417 |
418 } | 418 } |