de.grogra.imp3d
Class PolygonizationCache

java.lang.Object
  extended by de.grogra.graph.Cache
      extended by de.grogra.imp3d.PolygonizationCache

public class PolygonizationCache
extends Cache

This class can be used to cache the result of polygonization of Polygonizable shapes.

Author:
Ole Kniemeyer

Nested Class Summary
 
Nested classes/interfaces inherited from class de.grogra.graph.Cache
Cache.Entry
 
Field Summary
 
Fields inherited from class de.grogra.graph.Cache
gs
 
Constructor Summary
PolygonizationCache(GraphState gs, int flags, float flatness, boolean shareLists)
          Constructs a new cache.
 
Method Summary
protected  Cache.Entry createEntry(java.lang.Object obj, boolean node, ContextDependent dep, java.lang.Object strategy)
           
 PolygonArray get(java.lang.Object object, boolean asNode, Polygonizable p)
          Returns the PolygonArray of a Polygonizable in the given object context.
 
Methods inherited from class de.grogra.graph.Cache
clear, clearUnused, getGraphState, getValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolygonizationCache

public PolygonizationCache(GraphState gs,
                           int flags,
                           float flatness,
                           boolean shareLists)
Constructs a new cache. The parameters will be passed to Polygonization.polygonize(de.grogra.graph.ContextDependent, de.grogra.graph.GraphState, de.grogra.imp3d.PolygonArray, int, float) when a cache entry is to be computed.

Parameters:
gs - the graph state within which the cache will be used
flags - the flags to pass to polygonize
flatness - the flatness to pass to polygonize
shareLists - shall the returned PolygonArrays share their lists (vertices, normals etc.)? This is useful where the returned data is copied into another representation and no longer needed
Method Detail

createEntry

protected Cache.Entry createEntry(java.lang.Object obj,
                                  boolean node,
                                  ContextDependent dep,
                                  java.lang.Object strategy)
Specified by:
createEntry in class Cache

get

public PolygonArray get(java.lang.Object object,
                        boolean asNode,
                        Polygonizable p)
Returns the PolygonArray of a Polygonizable in the given object context.

Parameters:
object - the context
asNode - true if object is a node, false if object is an edge
p - the polygonizable
Returns:
a PolygonArray, computed by p