Java Doc for DeferredPlanarImage.java in  » GIS » GeoTools-2.4.1 » org » geotools » image » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.image 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.geotools.image.DeferredPlanarImage

DeferredPlanarImage
final public class DeferredPlanarImage extends PlanarImage implements WritableRenderedImage,TileObserver,TileComputationListener(Code)
A tiled image to be used by renderer when the actual image may take a while to compute. This image wraps an arbitrary , which may (or may not) be some image expensive to compute. When a tile is requested (through a call to DeferredPlanarImage.getTile but the tile is not available in the wrapped image, then this class returns some default (usually black) tile and start the real tile computation in a background thread. When the actual tile is available, this class fire a TileObserver.tileUpdate tileUpdate event, thus given a chance to a renderer to repaint again this image with the new tiles.

Simple example of use:

 public class Renderer extends JPanel implements TileObserver {
 private DeferredPlanarImage image;
 public Renderer(RenderedImage toPaint) {
 image = new DeferredPlanarImage(toPaint);
 image.addTileObserver(this);
 }
 public void tileUpdate(WritableRenderedImage source,
 int tileX, int tileY, boolean willBeWritable)
 {
 repaint();
 }
 public void paint(Graphics gr) {
 ((Graphics2D) gr).drawRenderedImage(image);
 }
 }
 

since:
   2.3
version:
   $Id: DeferredPlanarImage.java 27862 2007-11-12 19:51:19Z desruisseaux $
author:
   Remi Eve
author:
   Martin Desruisseaux



Constructor Summary
public  DeferredPlanarImage(RenderedImage source)
     Constructs a new instance of DeferredPlanarImage .

Method Summary
public synchronized  voidaddTileObserver(TileObserver observer)
     Adds an observer.
public synchronized  voiddispose()
     Provides a hint that this image will no longer be accessed from a reference in user space.
public synchronized  RastergetTile(int tileX, int tileY)
     Returns the specified tile, or a default one if the requested tile is not yet available. If the requested tile is not immediately available, then an empty tile is returned and a notification will be sent later through TileObserver when the real tile will be available.
Parameters:
  tileX - Tile X index.
Parameters:
  tileY - Tile Y index.
public  WritableRastergetWritableTile(int tileX, int tileY)
     Checks out a tile for writing.
public synchronized  Point[]getWritableTileIndices()
     Returns an array of Point objects indicating which tiles are checked out for writing.
public  booleanhasTileWriters()
     Returns whether any tile is checked out for writing.
public  booleanisTileWritable(int tileX, int tileY)
     Returns whether a tile is currently checked out for writing.
public  voidreleaseWritableTile(int tileX, int tileY)
     Relinquishes the right to write to a tile.
public synchronized  voidremoveTileObserver(TileObserver observer)
     Removes an observer.
public  voidsetData(Raster r)
     Sets a rectangle of the image to the contents of the raster.
public  voidtileCancelled(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY)
     Invoked when a tile computation has been cancelled.
public  voidtileComputationFailure(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY, Throwable cause)
     Invoked when a tile computation failed.
public  voidtileComputed(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY, Raster tile)
     Invoked when a tile has been computed.
public  voidtileUpdate(WritableRenderedImage source, int tileX, int tileY, boolean willBeWritable)
     Invoked if the underlying image is writable and one of its tile changed.


Constructor Detail
DeferredPlanarImage
public DeferredPlanarImage(RenderedImage source)(Code)
Constructs a new instance of DeferredPlanarImage .
Parameters:
  source - The source image.




Method Detail
addTileObserver
public synchronized void addTileObserver(TileObserver observer)(Code)
Adds an observer. This observer will be notified everytime a tile initially empty become available. If the observer is already present, it will receive multiple notifications.



dispose
public synchronized void dispose()(Code)
Provides a hint that this image will no longer be accessed from a reference in user space. NOTE: this method dispose the image given to the constructor as well. This is because DeferredPlanarImage is used as a "view" of an other image, and the user shouldn't know that he is not using directly the other image.



getTile
public synchronized Raster getTile(int tileX, int tileY)(Code)
Returns the specified tile, or a default one if the requested tile is not yet available. If the requested tile is not immediately available, then an empty tile is returned and a notification will be sent later through TileObserver when the real tile will be available.
Parameters:
  tileX - Tile X index.
Parameters:
  tileY - Tile Y index. The requested tile.



getWritableTile
public WritableRaster getWritableTile(int tileX, int tileY)(Code)
Checks out a tile for writing. Since DeferredPlanarImage are not really writable, this method throws an UnsupportedOperationException .



getWritableTileIndices
public synchronized Point[] getWritableTileIndices()(Code)
Returns an array of Point objects indicating which tiles are checked out for writing. Returns null if none are checked out.



hasTileWriters
public boolean hasTileWriters()(Code)
Returns whether any tile is checked out for writing.



isTileWritable
public boolean isTileWritable(int tileX, int tileY)(Code)
Returns whether a tile is currently checked out for writing.



releaseWritableTile
public void releaseWritableTile(int tileX, int tileY)(Code)
Relinquishes the right to write to a tile. Since DeferredPlanarImage are not really writable, this method throws an IllegalStateException (the state is really illegal since DeferredPlanarImage.getWritableTile should never have succeeded).



removeTileObserver
public synchronized void removeTileObserver(TileObserver observer)(Code)
Removes an observer. If the observer was not registered, nothing happens. If the observer was registered for multiple notifications, it will now be registered for one fewer.



setData
public void setData(Raster r)(Code)
Sets a rectangle of the image to the contents of the raster. Since DeferredPlanarImage are not really writable, this method throws an UnsupportedOperationException .



tileCancelled
public void tileCancelled(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY)(Code)
Invoked when a tile computation has been cancelled. The default implementation does nothing.



tileComputationFailure
public void tileComputationFailure(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY, Throwable cause)(Code)
Invoked when a tile computation failed. Default implementation log a warning and lets the program continue as usual. We are not throwing an exception since this failure will alter the visual rendering, but will not otherwise harm the system.



tileComputed
public void tileComputed(Object eventSource, TileRequest[] requests, PlanarImage image, int tileX, int tileY, Raster tile)(Code)
Invoked when a tile has been computed.
Parameters:
  eventSource - The caller of this method.
Parameters:
  requests - The relevant tile computation requests as returned by the methodused to queue the tile.
Parameters:
  image - The image for which tiles are being computed as specified to theTileScheduler.
Parameters:
  tileX - The X index of the tile in the tile array.
Parameters:
  tileY - The Y index of the tile in the tile array.
Parameters:
  tile - The computed tile.



tileUpdate
public void tileUpdate(WritableRenderedImage source, int tileX, int tileY, boolean willBeWritable)(Code)
Invoked if the underlying image is writable and one of its tile changed. This method forward the call to every registered listener.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.