Class SpringDrawing

All Implemented Interfaces:
FocusListener, KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, Runnable, EventListener, Accessible, processing.core.PConstants

public class SpringDrawing extends processing.core.PApplet
A program for computing network layouts with the "spring embedder" paradigm examples of input parameters: data/ash85.mtx
Author:
Luca Castelli Aleardi (Ecole Polytechnique, 2021)
See Also:
  • Field Details

    • xmin

      protected double xmin
    • xmax

      protected double xmax
    • ymin

      protected double ymin
    • ymax

      protected double ymax
    • boundaryThickness

      double boundaryThickness
    • backgroundColor

      private int backgroundColor
    • edgeColor

      private int edgeColor
    • edgeOpacity

      private int edgeOpacity
    • runAllIterations

      public boolean runAllIterations
    • selectedNode

      public Node selectedNode
      node selected with mouse click (to show)
    • current

      public Jcg.geometry.Point_2 current
    • layout

      public FR91Layout layout
      Layout algorithm
    • inputGraph

      public static AdjacencyListGraph inputGraph
      input graph to draw
    • sizeX

      public static int sizeX
    • sizeY

      public static int sizeY
    • a

      Jcg.geometry.Point_2 a
    • b

      Jcg.geometry.Point_2 b
  • Constructor Details

    • SpringDrawing

      public SpringDrawing()
  • Method Details

    • setup

      public void setup()
      Initialize the frame
      Overrides:
      setup in class processing.core.PApplet
    • draw

      public void draw()
      Main method for drawing the applet
      Overrides:
      draw in class processing.core.PApplet
    • keyPressed

      public void keyPressed()
      Deal with keyboard events
      Overrides:
      keyPressed in class processing.core.PApplet
    • drawOptions

      public void drawOptions()
    • performOneIteration

      public void performOneIteration()
    • zoom

      public void zoom(double factor)
    • mouseClicked

      public void mouseClicked()
      Overrides:
      mouseClicked in class processing.core.PApplet
    • mousePressed

      public void mousePressed()
      Overrides:
      mousePressed in class processing.core.PApplet
    • mouseReleased

      public void mouseReleased()
      Overrides:
      mouseReleased in class processing.core.PApplet
    • mouseDragged

      public void mouseDragged()
      Overrides:
      mouseDragged in class processing.core.PApplet
    • update

      protected void update(double x, double y)
      Update of the bounding box
    • updateBoundingBox

      public void updateBoundingBox()
      Update the range of the drawing region (defined by corners points 'a' and 'b')
    • boundingBox

      public double[] boundingBox()
      Return the current coordinates of the bounding box
    • getPoint

      public int[] getPoint(Jcg.geometry.Point_2 v)
      Return the integer coordinates of a pixel corresponding to a given point Warning: we must take care of the following parameters: -) the size of the canvas -) the size of bottom and left panels -) the negative direction of y-coordinates (in java drawing)
    • drawSegment

      public void drawSegment(Jcg.geometry.Point_2 u, Jcg.geometry.Point_2 v)
      Draw a gray edge (u, v)
    • drawColoredSegment

      public void drawColoredSegment(Jcg.geometry.Point_2 u, Jcg.geometry.Point_2 v, int r, int g, int b)
      Draw a colored edge (u, v)
    • drawVertex

      public void drawVertex(Node u, double distortion, double maxDistortion)
      Draw a vertex u on the canvas
    • drawVertexLabel

      public void drawVertexLabel(Node u)
      Draw a vertex label on the canvas (close to the node location)
    • selectNode

      public Node selectNode(int i, int j)
      Select the vertex whose 2d projection is the closest to pixel (i, j)
    • display2D

      public void display2D()
      Draw the skeleton of a graph in 2D using a Processing frame
    • getVertexLabel

      public String getVertexLabel(Node u)
      Compute the label of a vertex, from its index, spectral distortion and vertex age
    • main

      public static void main(String[] args)
      For running the PApplet as Java application