JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.util.packrect.LevelSet Class Reference

Manages a list of Levels; this is the core data structure contained within the RectanglePacker and encompasses the storage algorithm for the contained Rects. More...

Collaboration diagram for com.jogamp.opengl.util.packrect.LevelSet:

Public Member Functions

 LevelSet (final int w, final int h)
 A LevelSet manages all of the backing store for a region of a specified width and height. More...
 
int w ()
 
int h ()
 
boolean add (final Rect rect)
 Returns true if the given rectangle was successfully added to the LevelSet given its current dimensions, false if not. More...
 
boolean remove (final Rect rect)
 Removes the given Rect from this LevelSet. More...
 
boolean compactAndAdd (final Rect rect, final Object backingStore, final BackingStoreManager manager)
 Allocates the given Rectangle, performing compaction of a Level if necessary. More...
 
boolean canExpand (final Level level, final int height)
 Indicates whether it's legal to trivially increase the height of the given Level. More...
 
void expand (final Level level, final int oldHeight, final int newHeight)
 
int getUsedHeight ()
 Gets the used height of the levels in this LevelSet. More...
 
void setHeight (final int height) throws IllegalArgumentException
 Sets the height of this LevelSet. More...
 
float verticalFragmentationRatio ()
 Returns the vertical fragmentation ratio of this LevelSet. More...
 
Iterator< Leveliterator ()
 
void visit (final RectVisitor visitor)
 Visits all Rects contained in this LevelSet. More...
 
void updateRectangleReferences ()
 Updates the references to the Rect objects in this LevelSet with the "next locations" of those Rects. More...
 
void clear ()
 Clears out all Levels stored in this LevelSet. More...
 

Detailed Description

Manages a list of Levels; this is the core data structure contained within the RectanglePacker and encompasses the storage algorithm for the contained Rects.

Definition at line 48 of file LevelSet.java.

Constructor & Destructor Documentation

◆ LevelSet()

com.jogamp.opengl.util.packrect.LevelSet.LevelSet ( final int  w,
final int  h 
)

A LevelSet manages all of the backing store for a region of a specified width and height.

Definition at line 57 of file LevelSet.java.

Member Function Documentation

◆ add()

boolean com.jogamp.opengl.util.packrect.LevelSet.add ( final Rect  rect)

Returns true if the given rectangle was successfully added to the LevelSet given its current dimensions, false if not.

Caller is responsible for performing compaction, expansion, etc. as a consequence.

Definition at line 69 of file LevelSet.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ canExpand()

boolean com.jogamp.opengl.util.packrect.LevelSet.canExpand ( final Level  level,
final int  height 
)

Indicates whether it's legal to trivially increase the height of the given Level.

This is only possible if it's the last Level added and there's enough room in the backing store.

Definition at line 139 of file LevelSet.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear()

void com.jogamp.opengl.util.packrect.LevelSet.clear ( )

Clears out all Levels stored in this LevelSet.

Definition at line 209 of file LevelSet.java.

Here is the caller graph for this function:

◆ compactAndAdd()

boolean com.jogamp.opengl.util.packrect.LevelSet.compactAndAdd ( final Rect  rect,
final Object  backingStore,
final BackingStoreManager  manager 
)

Allocates the given Rectangle, performing compaction of a Level if necessary.

This is the correct fallback path to add(Rect) above. Returns true if allocated successfully, false otherwise (indicating the need to expand the backing store).

Definition at line 119 of file LevelSet.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ expand()

void com.jogamp.opengl.util.packrect.LevelSet.expand ( final Level  level,
final int  oldHeight,
final int  newHeight 
)

Definition at line 148 of file LevelSet.java.

Here is the caller graph for this function:

◆ getUsedHeight()

int com.jogamp.opengl.util.packrect.LevelSet.getUsedHeight ( )

Gets the used height of the levels in this LevelSet.

Definition at line 153 of file LevelSet.java.

Here is the caller graph for this function:

◆ h()

int com.jogamp.opengl.util.packrect.LevelSet.h ( )

Definition at line 63 of file LevelSet.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iterator()

Iterator< Level > com.jogamp.opengl.util.packrect.LevelSet.iterator ( )

Definition at line 185 of file LevelSet.java.

Here is the caller graph for this function:

◆ remove()

boolean com.jogamp.opengl.util.packrect.LevelSet.remove ( final Rect  rect)

Removes the given Rect from this LevelSet.

Definition at line 105 of file LevelSet.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setHeight()

void com.jogamp.opengl.util.packrect.LevelSet.setHeight ( final int  height) throws IllegalArgumentException

Sets the height of this LevelSet.

It is only legal to reduce the height to greater than or equal to the currently used height.

Definition at line 159 of file LevelSet.java.

Here is the call graph for this function:

◆ updateRectangleReferences()

void com.jogamp.opengl.util.packrect.LevelSet.updateRectangleReferences ( )

Updates the references to the Rect objects in this LevelSet with the "next locations" of those Rects.

This is actually used to update the new Rects in a newly laid-out LevelSet with the original Rects.

Definition at line 201 of file LevelSet.java.

Here is the call graph for this function:

◆ verticalFragmentationRatio()

float com.jogamp.opengl.util.packrect.LevelSet.verticalFragmentationRatio ( )

Returns the vertical fragmentation ratio of this LevelSet.

This is defined as the ratio of the sum of the heights of all completely empty Levels divided by the overall used height of the LevelSet. A high vertical fragmentation ratio indicates that it may be profitable to perform a compaction.

Definition at line 171 of file LevelSet.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ visit()

void com.jogamp.opengl.util.packrect.LevelSet.visit ( final RectVisitor  visitor)

Visits all Rects contained in this LevelSet.

Definition at line 190 of file LevelSet.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ w()

int com.jogamp.opengl.util.packrect.LevelSet.w ( )

Definition at line 62 of file LevelSet.java.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: