Package org.evoludo.graphics
Class Network3DGWT
- All Implemented Interfaces:
Iterable<Node>
,Collection<Node>
,Iterator<Node>
,List<Node>
,SequencedCollection<Node>
Graphical representation of generic population geometries in 3D. A network
corresponds to a (possibly ephemeral) collection and configuration of nodes.
This implementation includes optimizations for GWT when scheduling
computationally intensive tasks.
- Author:
- Christoph Hauert
-
Nested Class Summary
Nested classes/interfaces inherited from class Network
Network.LayoutListener, Network.Status
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Duration
Helper variable to keep track of the time spent layouting the network.(package private) Geometry
The links in the network.protected static final int
The minimum number of links to process in one step.protected static final int
Minimum delay in milliseconds between subsequent updates of the layout in the GUI.protected int
Helper variable to store the index of the node that needs to be processed next.(package private) int
Time when last layout update was processed.(package private) Camera
TheCamera
controlling the view of the network.Fields inherited from class Network3D
nodes, UNIVERSE_RADIUS
Fields inherited from class Network
accuracy, engine, fLinks, geometry, isRunning, layoutTimeout, listener, MAX_LINK_COUNT, nLinks, nNodes, norm, potential, prevAdjust, prevPotential, rng, status, timestamp
Fields inherited from class AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionNetwork3DGWT
(EvoLudo engine, Geometry geometry) Create a new network in 3D for the given engine and geometry with a layouting process optimzed for GWT. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Start the layouting process.protected boolean
Perform a single step in the layouting process by relaxing nodes sequentially.getLinks()
Get the links of this 3D network representation.Get the visual perspective of this network.void
Generate the links for the current configuration of the network.void
reset()
Reset the network (discard any existing layouts).void
setWorldView
(Camera worldView) Set the visual perspective of this network.Methods inherited from class Network3D
attraction, finishLayout, get, initNodes, relax, relax, repulsion, toArray
Methods inherited from class Network
adjustAccuracy, cancelLayout, clear, contains, doLayoutPrep, getAccuracy, getGeometry, getLayoutTimout, getRadius, getStatus, hasNext, indexOf, isEmpty, isStatus, iterator, lastIndexOf, next, scaleRadiusTo, set, setAccuracy, setLayoutListener, setLayoutTimout, setRadius, setStatus, shake, size
Methods inherited from class AbstractList
add, add, addAll, equals, hashCode, listIterator, listIterator, remove, removeRange, subList
Methods inherited from class AbstractCollection
addAll, containsAll, remove, removeAll, retainAll, toArray, toString
Methods inherited from interface Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface Iterator
forEachRemaining, remove
Methods inherited from interface List
addAll, addFirst, addLast, containsAll, getFirst, getLast, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray
-
Field Details
-
worldView
Camera worldViewTheCamera
controlling the view of the network. Needed to exchange the visual perspective of different views. For example the 3D view of strategies and of payoffs should use the same perspective. -
links
Geometry linksThe links in the network. -
layout
Duration layoutHelper variable to keep track of the time spent layouting the network. -
prevLayout
int prevLayoutTime when last layout update was processed. -
MIN_DELAY_ANIMATE_MSEC
protected static final int MIN_DELAY_ANIMATE_MSECMinimum delay in milliseconds between subsequent updates of the layout in the GUI. This is used to throttle the animated layout process to a default of at most 20 updates per second.- See Also:
-
nextLayoutNode
protected int nextLayoutNodeHelper variable to store the index of the node that needs to be processed next. This is to prevent the GUI from becoming unresponsive and allow the layouting process to resume after relaxing a fixed number of nodes.- See Also:
-
MAX_LINKS_PER_STEP
protected static final int MAX_LINKS_PER_STEPThe minimum number of links to process in one step. AfterMAX_LINKS_PER_STEP
links have been processed the next node to continue is stored innextLayoutNode
and control is returned to the event loop, which prevents the GUI from becoming unresponsive. As a welcome side effect, this parcelling resulted in a dramatic speed increase.- See Also:
-
-
Constructor Details
-
Network3DGWT
Create a new network in 3D for the given engine and geometry with a layouting process optimzed for GWT.- Parameters:
engine
- the pacemaker for running the modelgeometry
- the structure of the population
-
-
Method Details
-
reset
public void reset()Description copied from class:Network
Reset the network (discard any existing layouts). -
getWorldView
Get the visual perspective of this network. This can be manipulated by the GUI but must be synchronized between different views (e.g. strategies versus payoffs) to avoid confusing the user.- Returns:
- the perspective of the network
-
getLinks
Get the links of this 3D network representation.- Returns:
- the links of this network
-
linkNodes
public void linkNodes()Description copied from class:Network
Generate the links for the current configuration of the network. -
doLayout
Description copied from class:Network
Start the layouting process. The layout listener (if any) is informed about the progress of the layouting process. Implementations can take advantage of optimizations available for GWT (scheduling) or JRE (multiple threads). -
doLayoutStep
protected boolean doLayoutStep()Perform a single step in the layouting process by relaxing nodes sequentially. Returnsfalse
once the layouting process has completed, i.e. reached the desired accuracy or the time out.- Returns:
true
if the layouting process should continue
-