Class PolygonizationCache

  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.

Ole Kniemeyer

Nested Class Summary
Nested classes/interfaces inherited from class de.grogra.graph.Cache
Field Summary
Fields inherited from class de.grogra.graph.Cache
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


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.

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


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


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

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