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 PopGraph3D instances 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 ColorMap3D instances 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 EvoLudoGWT engine and a Data type describing the quantity to visualize.
  • The class delegates per-module visualization to PopGraph3D and relies on Module, AbstractGeometry and ColorMap helpers 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 ColorMap3D helpers and adapts to the engine's Continuous.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 Network3DGWT and assume compatible WebGL support in the host browser.
Author:
Christoph Hauert
See Also:
  • Field Details

    • projectionMenu

      private ContextMenuCheckBoxItem projectionMenu
      The context menu item for selecting parallel projection of the graph instead of the default perspective projection.
    • anaglyphMenu

      private ContextMenuCheckBoxItem 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

      private ContextMenuCheckBoxItem vrMenu
      The context menu item for selecting stereo projection of the 3D space for a virtual reality representation of the graph.
  • Constructor Details

    • Pop3D

      public Pop3D(EvoLudoGWT engine, Data type)
      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 model
      type - the type of data to display
  • Method Details

    • allocateGraphs

      protected boolean allocateGraphs()
      Description copied from class: AbstractView
      Allocate 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's calcBounds(int, int) is triggered through setBounds(int, int) to properly calculate the layout.
      Specified by:
      allocateGraphs in class AbstractView<PopGraph3D>
      Returns:
      true if 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:
      true if graphs were reallocated
    • allocatePDEGraph

      private boolean allocatePDEGraph()
      Allocate graph for PDE models. Currently restricted to single species.
      Returns:
      true if graphs were reallocated
    • modelSettings

      public void modelSettings()
      Description copied from interface: RunListener
      Called when the settings of the EvoLudo model changed but no reset was necessary.
    • reset

      public void reset(boolean hard)
      Description copied from class: AbstractView
      Called when a module has been reset. All graphs are reset and updated if needed, unless hard is true.
      Overrides:
      reset in class AbstractView<PopGraph3D>
      Parameters:
      hard - the flag to indicate whether to do a hard reset
    • createColorMap

      private ColorMap<MeshLambertMaterial> createColorMap(Module<?> module)
      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

      private ColorMap<MeshLambertMaterial> createTraitColorMapContinuous(Module<?> module)
      Helper for continuous trait color maps.
      Parameters:
      module - module providing trait metadata
      Returns:
      configured color map
    • createTraitColorMapDiscreteOrPDE

      private ColorMap<MeshLambertMaterial> createTraitColorMapDiscreteOrPDE(Module<?> module)
      Helper for discrete and PDE trait color maps.
      Parameters:
      module - module providing trait metadata
      Returns:
      configured color map
    • createFitnessColorMap

      private ColorMap<MeshLambertMaterial> createFitnessColorMap(Module<?> module)
      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: RunListener
      Called after the EvoLudo model got re-initialized.
      Specified by:
      modelDidInit in interface RunListener
      Overrides:
      modelDidInit in class GenericPop<MeshLambertMaterial, Network3DGWT, PopGraph3D>
    • populateContextMenu

      public void populateContextMenu(ContextMenu menu)
      Description copied from class: AbstractView
      Opportunity for the controller to add functionality to the context menu (optional implementation).
      Overrides:
      populateContextMenu in class AbstractView<PopGraph3D>
      Parameters:
      menu - the context menu
    • addProjectionMenu

      private void addProjectionMenu(ContextMenu menu)
      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

      private void addAnaglyphMenu(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.
      Parameters:
      menu - the context menu to which the item is added
    • addVRMenu

      private void addVRMenu(ContextMenu menu)
      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

      protected AbstractView.ExportType[] exportTypes()
      Description copied from class: AbstractView
      Return the list of export types that are acceptable for _all_ graphs in this view.
      Overrides:
      exportTypes in class AbstractView<PopGraph3D>
      Returns:
      the list of viable export types