NASA World Wind

gov.nasa.worldwind.util
Class TextureAtlas.AtlasBackingStore

java.lang.Object
  extended by gov.nasa.worldwind.util.TextureAtlas.AtlasBackingStore
All Implemented Interfaces:
BackingStoreManager
Enclosing class:
TextureAtlas

protected class TextureAtlas.AtlasBackingStore
extends Object
implements BackingStoreManager

Implementation of the JOGL BackingStoreManager interface for texture atlas. This is used by the JOGL RectanglePacker, and delegates calls from a JOGL rectangle packer to methods in this texture atlas.


Constructor Summary
protected TextureAtlas.AtlasBackingStore()
           
 
Method Summary
 boolean additionFailed(Rect cause, int attemptNumber)
          

If this texture atlas is configured to evicts old elements, this attempts to remove the oldest one then exits, allowing the caller to attempt the addition again.

 Object allocateBackingStore(int w, int h)
          

Calls TextureAtlas.createBackingImage(int, int) with the specified width and height.

 void beginMovement(Object oldBackingStore, Object newBackingStore)
          

Calls TextureAtlas.beginMoveEntries(java.awt.image.BufferedImage, java.awt.image.BufferedImage), casting the specified backing stores to BufferedImages.

 boolean canCompact()
          

Returns true.

 void deleteBackingStore(Object backingStore)
          

Calls TextureAtlas.disposeBackingImage().

 void endMovement(Object oldBackingStore, Object newBackingStore)
          

Calls TextureAtlas.endMoveEntries(java.awt.image.BufferedImage, java.awt.image.BufferedImage), casting the specified backing stores to BufferedImages.

 void move(Object oldBackingStore, Rect oldLocation, Object newBackingStore, Rect newLocation)
          

Calls TextureAtlas.moveEntry(java.awt.image.BufferedImage, com.jogamp.opengl.util.packrect.Rect, java.awt.image.BufferedImage, com.jogamp.opengl.util.packrect.Rect), casting the specified backing stores to BufferedImages.

 boolean preExpand(Rect cause, int attemptNumber)
          

Returns false, indicating that the rectangle packer should just expand.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextureAtlas.AtlasBackingStore

protected TextureAtlas.AtlasBackingStore()
Method Detail

additionFailed

public boolean additionFailed(Rect cause,
                              int attemptNumber)

If this texture atlas is configured to evicts old elements, this attempts to remove the oldest one then exits, allowing the caller to attempt the addition again. This throws a WWRuntimeException if this texture atlas is not configured to evict old elements, or if there are no more elements to evict.

Specified by:
additionFailed in interface BackingStoreManager
Throws:
WWRuntimeException - if this backing store cannot fit the rectangle in its layout.

allocateBackingStore

public Object allocateBackingStore(int w,
                                   int h)

Calls TextureAtlas.createBackingImage(int, int) with the specified width and height.

Specified by:
allocateBackingStore in interface BackingStoreManager

beginMovement

public void beginMovement(Object oldBackingStore,
                          Object newBackingStore)

Calls TextureAtlas.beginMoveEntries(java.awt.image.BufferedImage, java.awt.image.BufferedImage), casting the specified backing stores to BufferedImages.

Specified by:
beginMovement in interface BackingStoreManager

canCompact

public boolean canCompact()

Returns true. The texture atlas can always attempt to expand or compact.

Specified by:
canCompact in interface BackingStoreManager

deleteBackingStore

public void deleteBackingStore(Object backingStore)

Calls TextureAtlas.disposeBackingImage().

Specified by:
deleteBackingStore in interface BackingStoreManager

endMovement

public void endMovement(Object oldBackingStore,
                        Object newBackingStore)

Calls TextureAtlas.endMoveEntries(java.awt.image.BufferedImage, java.awt.image.BufferedImage), casting the specified backing stores to BufferedImages.

Specified by:
endMovement in interface BackingStoreManager

move

public void move(Object oldBackingStore,
                 Rect oldLocation,
                 Object newBackingStore,
                 Rect newLocation)

Calls TextureAtlas.moveEntry(java.awt.image.BufferedImage, com.jogamp.opengl.util.packrect.Rect, java.awt.image.BufferedImage, com.jogamp.opengl.util.packrect.Rect), casting the specified backing stores to BufferedImages.

Specified by:
move in interface BackingStoreManager

preExpand

public boolean preExpand(Rect cause,
                         int attemptNumber)

Returns false, indicating that the rectangle packer should just expand. When configured to do so, texture atlas evicts old elements in additionFailed if this texture atlas is full and the addition would otherwise fail.

Specified by:
preExpand in interface BackingStoreManager

NASA World Wind