Interface LayoutModel<V>
-
- All Superinterfaces:
Function<V,Point>,LayoutSizeChange.Producer<V>,LayoutStateChange.Producer,LayoutVertexPositionChange.Listener<V>,LayoutVertexPositionChange.Producer<V>,ModelChange.Producer,ViewChange.Producer
- All Known Implementing Classes:
AbstractLayoutModel,AggregateLayoutModel,DefaultLayoutModel
public interface LayoutModel<V> extends Function<V,Point>, ModelChange.Producer, ViewChange.Producer, LayoutVertexPositionChange.Producer<V>, LayoutStateChange.Producer, LayoutVertexPositionChange.Listener<V>, LayoutSizeChange.Producer<V>
two dimensional layout model. Acts as a Mediator between the Graph vertices and their locations in the Cartesian coordinate system.- Author:
- Tom Nelson
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classLayoutModel.Builder<V,T extends DefaultLayoutModel<V>,B extends LayoutModel.Builder<V,T,B>>a builder for LayoutModel instances
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaccept(LayoutAlgorithm<V> layoutAlgorithm)allow the passed LayoutAlgorithm to operate on this LayoutModelvoidappendLayoutModel(LayoutModel<V> layoutModel)static <V> LayoutModel.Builder<V,?,?>builder()Pointget(V vertex)default PointgetCenter()<E> org.jgrapht.Graph<V,E>getGraph()intgetHeight()default Map<V,Point>getLocations()intgetPreferredHeight()intgetPreferredWidth()intgetWidth()booleanisLocked()booleanisLocked(V vertex)booleanisRelaxing()indicates that there is a relaxer thread operating on this LayoutModelvoidlock(boolean locked)voidlock(V vertex, boolean locked)voidresizeToSurroundingRectangle()voidset(V vertex, double x, double y)Changes the layout coordinates ofvertextox, y.voidset(V vertex, Point location)Changes the layout coordinates ofvertextolocation.default voidsetFireEvents(boolean fireEvents)voidsetGraph(org.jgrapht.Graph<V,?> graph)voidsetInitialDimensionFunction(Function<org.jgrapht.Graph<V,?>,Pair<Integer>> initialDimensionFunction)The initialDimensionFunction sets the layout area bounds by evaluating theGraphvoidsetInitializer(Function<V,Point> initializer)voidsetPreferredSize(int width, int helght)voidsetRelaxing(boolean relaxing)indicates that there is a relaxer thread operating on this LayoutModelvoidsetSize(int width, int helght)default voidstop()stop a relaxer Thread from continuing to operate-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutSizeChange.Producer
getLayoutSizeChangeSupport
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutStateChange.Producer
getLayoutStateChangeSupport
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutVertexPositionChange.Listener
layoutVertexPositionChanged, layoutVertexPositionChanged
-
Methods inherited from interface org.jungrapht.visualization.layout.event.LayoutVertexPositionChange.Producer
getLayoutVertexPositionSupport
-
Methods inherited from interface org.jungrapht.visualization.layout.event.ModelChange.Producer
getModelChangeSupport
-
Methods inherited from interface org.jungrapht.visualization.layout.event.ViewChange.Producer
getViewChangeSupport
-
-
-
-
Method Detail
-
builder
static <V> LayoutModel.Builder<V,?,?> builder()
-
getWidth
int getWidth()
- Returns:
- the width of the layout area
-
getHeight
int getHeight()
- Returns:
- the height of the layout area
-
getPreferredWidth
int getPreferredWidth()
-
getPreferredHeight
int getPreferredHeight()
-
getCenter
default Point getCenter()
-
accept
void accept(LayoutAlgorithm<V> layoutAlgorithm)
allow the passed LayoutAlgorithm to operate on this LayoutModel- Parameters:
layoutAlgorithm- the algorithm to apply to this model's Points
-
setInitialDimensionFunction
void setInitialDimensionFunction(Function<org.jgrapht.Graph<V,?>,Pair<Integer>> initialDimensionFunction)
The initialDimensionFunction sets the layout area bounds by evaluating theGraph- Parameters:
initialDimensionFunction-
-
setSize
void setSize(int width, int helght)- Parameters:
width- to sethelght- to set
-
setPreferredSize
void setPreferredSize(int width, int helght)- Parameters:
width- to sethelght- to set
-
stop
default void stop()
stop a relaxer Thread from continuing to operate
-
setRelaxing
void setRelaxing(boolean relaxing)
indicates that there is a relaxer thread operating on this LayoutModel- Parameters:
relaxing- whether there is a relaxer thread
-
isRelaxing
boolean isRelaxing()
indicates that there is a relaxer thread operating on this LayoutModel- Returns:
- relaxing
-
isLocked
boolean isLocked(V vertex)
- Parameters:
vertex- the vertex whose locked state is being queried- Returns:
trueif the position of vertexvis locked
-
set
void set(V vertex, Point location)
Changes the layout coordinates ofvertextolocation.- Parameters:
vertex- the vertex whose location is to be specifiedlocation- the coordinates of the specified location
-
set
void set(V vertex, double x, double y)
Changes the layout coordinates ofvertextox, y.- Parameters:
vertex- the vertex to set location forx- coordinate to sety- coordinate to set
-
get
Point get(V vertex)
- Parameters:
vertex- the vertex of interest- Returns:
- the Point location for vertex
-
getGraph
<E> org.jgrapht.Graph<V,E> getGraph()
- Returns:
- the
Graphthat this model is mediating
-
setGraph
void setGraph(org.jgrapht.Graph<V,?> graph)
- Parameters:
graph- theGraphto set
-
lock
void lock(V vertex, boolean locked)
-
lock
void lock(boolean locked)
-
isLocked
boolean isLocked()
-
resizeToSurroundingRectangle
void resizeToSurroundingRectangle()
-
appendLayoutModel
void appendLayoutModel(LayoutModel<V> layoutModel)
-
setFireEvents
default void setFireEvents(boolean fireEvents)
-
-