Class Pop3D
- All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsRenderable, IsWidget, ProvidesResize, RequiresResize, TooltipProvider, TooltipProvider.Index, ChangeListener, LifecycleListener, RunListener, SampleListener, BasicTooltipProvider
3D population view for the EvoLudo model.
Pop3D renders a three-dimensional population visualization for the
EvoLudo simulation. It orchestrates PopGraph3D subviews that expose
the state of a Module (species) in individual-based spatial (IBS) or PDE
modes using WebGL backed scene graphs.
Responsibilities
- Allocate and position
PopGraph3Dinstances based on the model type (IBS vs PDE), arranging interaction and competition geometries as separate views when required. - Configure geometric layout metadata so each graph reflects the underlying
network topology (lattice, random graph, etc.). Layouts for non-lattice
geometries rely on spring-mass placement provided by
Network3DGWT. - Construct
ColorMap3Dinstances that map model state (traits or fitness) to materials, accounting for continuous, discrete and PDE-specific trait representations. - Reset and refresh graphs when model settings change, ensuring each graph maintains an isolated color map to avoid WebGL resource reuse issues.
- Augment the view's context menu with projection controls—orthographic, anaglyph and VR—so users can toggle alternate render modes at runtime.
Behavior notes
- IBS models may render two graphs per species (interaction and competition). The class arranges them in a grid and synchronizes activation and projection state across graphs.
- PDE models currently produce a single full-size graph with debugging disabled, reflecting the aggregated field dynamics of the module.
- Color mapping:
TRAIT: continuous models select hue or gradient schemes based on trait count; discrete and PDE displays mix indexed palettes and dependent gradients.FITNESS: values are rendered with a 1D gradient, highlighting monomorphic fitness scores (pale colors for discrete traits, blue accents for continuous traits).
- Projection menu entries are mutually aware: orthographic projection disables anaglyph/VR toggles, while anaglyph and VR remain available only when a single graph is visible.
Usage and integration
- Pop3D is constructed with an
EvoLudoGWTengine and aDatatype describing the quantity to visualize. - The class delegates per-module visualization to
PopGraph3Dand relies onModule,AbstractGeometryandColorMaphelpers to retrieve state and styling information. - Callers should drive reset/update lifecycles from the UI thread that owns the GWT/WebGL canvas; Pop3D assumes single-threaded interactions.
Implementation details
- Extends
GenericPop<MeshLambertMaterial, Network3DGWT, PopGraph3D>and honours that contract for activation, deactivation and exporting. - Graph geometry is applied through
setGraphGeometry(...)and mirrors the 2D view's logic for deciding whether interaction and competition neighbourhoods are distinct. - Color map construction uses the
ColorMap3Dhelpers and adapts to the engine'sContinuous.ColorModelType. Each graph keeps its own color map to avoid WebGL material sharing. - Export support is intentionally limited to PNG stills because 3D canvas capture does not yet deliver vector output.
Limitations and assumptions
- PDE rendering is restricted to single-species modules.
- VR and anaglyph projections are only available when a single graph is displayed.
- Network layouts and spring dynamics are provided by
Network3DGWTand assume compatible WebGL support in the host browser.
- Author:
- Christoph Hauert
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractView
AbstractView.ExportCommand, AbstractView.ExportTypeNested classes/interfaces inherited from class UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledNested classes/interfaces inherited from interface ChangeListener
ChangeListener.PendingActionNested classes/interfaces inherited from interface TooltipProvider
TooltipProvider.Index, TooltipProvider.Parametric, TooltipProvider.Simplex -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContextMenuCheckBoxItemThe context menu item for selecting anaglyph projection of the 3D space for a reperesentation of the graph suitable for colored 3D glasses.private ContextMenuCheckBoxItemThe context menu item for selecting parallel projection of the graph instead of the default perspective projection.private ContextMenuCheckBoxItemThe context menu item for selecting stereo projection of the 3D space for a virtual reality representation of the graph.Fields inherited from class GenericPop
hitNodeFields inherited from class AbstractView
engine, exportSubmenu, exportSubmenuTrigger, gCols, graphs, gRows, isActive, isLoaded, logger, MIN_MSEC_BETWEEN_UPDATES, model, options, restoreMenu, timestamp, type, updatetime, wrapperFields inherited from class UIObject
DEBUG_ID_PREFIXFields inherited from interface BasicTooltipProvider
TABLE_CELL_BULLET, TABLE_CELL_NEXT, TABLE_CELL_NEXT_COLOR, TABLE_END, TABLE_ROW_END, TABLE_ROW_START, TABLE_ROW_START_COLOR, TABLE_ROW_START_RIGHT, TABLE_SEPARATOR, TABLE_STYLE -
Constructor Summary
ConstructorsConstructorDescriptionPop3D(EvoLudoGWT engine, Data type) Construct a new view to display the configuration of the current state of the EvoLudo model in 3D. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAnaglyphMenu(ContextMenu menu) Add the menu item to select anaglyph projection of the 3D space for a representation of the graph suitable for colored 3D glasses.private voidaddProjectionMenu(ContextMenu menu) Add the menu item to select parallel projection of the graph instead of the default perspective projection.private voidaddVRMenu(ContextMenu menu) Add the menu item to select stereo projection of the 3D space for a virtual reality representation of the graph.protected booleanAllocate all graphs managed by this view.private booleanAllocate graphs for individual-based spatial models.private booleanAllocate graph for PDE models.private ColorMap<MeshLambertMaterial> createColorMap(Module<?> module) Create the ColorMap for a given module/graph based on the current data type and model settings.private ColorMap<MeshLambertMaterial> createFitnessColorMap(Module<?> module) Helper to create color map for fitness data.private ColorMap<MeshLambertMaterial> createTraitColorMapContinuous(Module<?> module) Helper for continuous trait color maps.private ColorMap<MeshLambertMaterial> createTraitColorMapDiscreteOrPDE(Module<?> module) Helper for discrete and PDE trait color maps.protected AbstractView.ExportType[]Return the list of export types that are acceptable for _all_ graphs in this view.voidCalled after the EvoLudo model got re-initialized.voidCalled when the settings of the EvoLudo model changed but no reset was necessary.voidOpportunity for the controller to add functionality to the context menu (optional implementation).voidreset(boolean hard) Called when a module has been reset.Methods inherited from class GenericPop
destroyGraphs, getName, getTooltipAt, hasLayout, layoutComplete, modelChanged, mouseHitNode, onKeyDown, setGraphGeometry, unload, updateMethods inherited from class AbstractView
activate, deactivate, export, export, exportDataHeader, exportMeanData, exportPNG, exportStatData, exportSVG, exportTrajData, getGraphAt, getLogger, getMode, getModel, getStatus, getStatus, getType, isActive, isRunning, load, modelDidReset, modelStopped, modelUnloaded, moduleRestored, moduleUnloaded, mouseHitNode, onKeyUp, onResize, onUnload, parse, populateContextMenuAt, scheduleUpdate, setBounds, setInitialState, setOptions, shift, update, zoomMethods inherited from class Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetMethods inherited from class Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, removeFromParent, setLayoutData, sinkEvents, unsinkEventsMethods inherited from class UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface BasicTooltipProvider
getTooltipAt, getTooltipAtMethods inherited from interface LifecycleListener
modelLoaded, moduleLoadedMethods inherited from interface RunListener
modelRelaxed, modelRunningMethods inherited from interface SampleListener
modelSample
-
Field Details
-
projectionMenu
The context menu item for selecting parallel projection of the graph instead of the default perspective projection. -
anaglyphMenu
The context menu item for selecting anaglyph projection of the 3D space for a reperesentation of the graph suitable for colored 3D glasses. -
vrMenu
The context menu item for selecting stereo projection of the 3D space for a virtual reality representation of the graph.
-
-
Constructor Details
-
Pop3D
Construct a new view to display the configuration of the current state of the EvoLudo model in 3D.- Parameters:
engine- the pacemaker for running the modeltype- the type of data to display
-
-
Method Details
-
allocateGraphs
protected boolean allocateGraphs()Description copied from class:AbstractViewAllocate all graphs managed by this view. This is called when loading the view. Once all views are attached to the browser DOM a call to the graph'scalcBounds(int, int)is triggered throughsetBounds(int, int)to properly calculate the layout.- Specified by:
allocateGraphsin classAbstractView<PopGraph3D>- Returns:
trueif graphs were (re)allocated- See Also:
-
allocateIBSGraphs
private boolean allocateIBSGraphs()Allocate graphs for individual-based spatial models. This method creates separate graphs for interaction and competition geometries.- Returns:
trueif graphs were reallocated
-
allocatePDEGraph
private boolean allocatePDEGraph()Allocate graph for PDE models. Currently restricted to single species.- Returns:
trueif graphs were reallocated
-
modelSettings
public void modelSettings()Description copied from interface:RunListenerCalled when the settings of the EvoLudo model changed but no reset was necessary. -
reset
public void reset(boolean hard) Description copied from class:AbstractViewCalled when a module has been reset. All graphs are reset and updated if needed, unlesshardistrue.- Overrides:
resetin classAbstractView<PopGraph3D>- Parameters:
hard- the flag to indicate whether to do a hard reset
-
createColorMap
Create the ColorMap for a given module/graph based on the current data type and model settings.- Parameters:
module- module whose data will be visualized- Returns:
- configured color map
-
createTraitColorMapContinuous
Helper for continuous trait color maps.- Parameters:
module- module providing trait metadata- Returns:
- configured color map
-
createTraitColorMapDiscreteOrPDE
Helper for discrete and PDE trait color maps.- Parameters:
module- module providing trait metadata- Returns:
- configured color map
-
createFitnessColorMap
Helper to create color map for fitness data. Marks monomorphic scores for IBS.- Parameters:
module- module providing trait metadata- Returns:
- configured color map
-
modelDidInit
public void modelDidInit()Description copied from interface:RunListenerCalled after the EvoLudo model got re-initialized.- Specified by:
modelDidInitin interfaceRunListener- Overrides:
modelDidInitin classGenericPop<MeshLambertMaterial, Network3DGWT, PopGraph3D>
-
populateContextMenu
Description copied from class:AbstractViewOpportunity for the controller to add functionality to the context menu (optional implementation).- Overrides:
populateContextMenuin classAbstractView<PopGraph3D>- Parameters:
menu- the context menu
-
addProjectionMenu
Add the menu item to select parallel projection of the graph instead of the default perspective projection.- Parameters:
menu- the context menu to which the item is added
-
addAnaglyphMenu
Add the menu item to select anaglyph projection of the 3D space for a representation of the graph suitable for colored 3D glasses.- Parameters:
menu- the context menu to which the item is added
-
addVRMenu
Add the menu item to select stereo projection of the 3D space for a virtual reality representation of the graph.- Parameters:
menu- the context menu to which the item is added
-
exportTypes
Description copied from class:AbstractViewReturn the list of export types that are acceptable for _all_ graphs in this view.- Overrides:
exportTypesin classAbstractView<PopGraph3D>- Returns:
- the list of viable export types
-