Interface Camera

All Known Implementing Classes:
DefaultCamera2D

public interface Camera
  • Method Details

    • getViewCenter

      Point3 getViewCenter()
      The view centre (a point in graph units).
      Returns:
      The view centre.
    • setViewCenter

      void setViewCenter​(double x, double y, double z)
      Change the view centre.
      Parameters:
      x - The new abscissa.
      y - The new ordinate.
      z - The new depth.
    • getViewPercent

      double getViewPercent()
      The portion of the graph visible.
      Returns:
      A real for which value 1 means the graph is fully visible and uses the whole view port.
    • setViewPercent

      void setViewPercent​(double percent)
      Zoom the view.
      Parameters:
      percent - Percent of the graph visible.
    • getViewRotation

      double getViewRotation()
      The current rotation angle.
      Returns:
      The rotation angle in degrees.
    • setViewRotation

      void setViewRotation​(double theta)
      Rotate the view around its centre point by a given theta angles (in degrees).
      Parameters:
      theta - The rotation angle in degrees.
    • getGraphDimension

      double getGraphDimension()
      A number in GU that gives the approximate graph size (often the diagonal of the graph). This allows to compute displacements in the graph as percent of its overall size. For example this can be used to move the view centre.
      Returns:
      The graph estimated size in graph units.
    • removeGraphViewport

      void removeGraphViewport()
      Remove the specified graph view port.
      See Also:
      setGraphViewport(double, double, double, double)
    • setGraphViewport

      void setGraphViewport​(double minx, double miny, double maxx, double maxy)
      Specify exactly the minimum and maximum points in GU that are visible (more points may be visible due to aspect-ratio constraints).
      Parameters:
      minx - The minimum abscissa visible.
      miny - The minimum ordinate visible.
      maxx - The maximum abscissa visible.
      maxy - The maximum abscissa visible.
      See Also:
      removeGraphViewport()
    • resetView

      void resetView()
      Reset the view to the automatic mode.
    • setBounds

      void setBounds​(double minx, double miny, double minz, double maxx, double maxy, double maxz)
      Set the bounds of the graphic graph in GU. Called by the Viewer.
      Parameters:
      minx - Lowest abscissa.
      miny - Lowest ordinate.
      minz - Lowest depth.
      maxx - Highest abscissa.
      maxy - Highest ordinate.
      maxz - Highest depth.
    • getMetrics

      GraphMetrics getMetrics()
      Get the org.graphstream.ui.swingViewer.util.GraphMetrics object linked to this Camera. It can be used to convert pixels to graphic units and vice versa.
      Returns:
      a GraphMetrics instance
    • setAutoFitView

      void setAutoFitView​(boolean on)
      Enable or disable automatic adjustment of the view to see the entire graph.
      Parameters:
      on - If true, automatic adjustment is enabled.
    • transformGuToPx

      Point3 transformGuToPx​(double x, double y, double z)
      Transform a point in graph units into pixels.
      Returns:
      The transformed point.
    • transformPxToGu

      Point3 transformPxToGu​(double x, double y)
      Return the given point in pixels converted in graph units (GU) using the inverse transformation of the current projection matrix. The inverse matrix is computed only once each time a new projection matrix is created.
      Parameters:
      x - The source point abscissa in pixels.
      y - The source point ordinate in pixels.
      Returns:
      The resulting points in graph units.
    • isVisible

      boolean isVisible​(GraphicElement element)
      True if the element would be visible on screen. The method used is to transform the center of the element (which is always in graph units) using the camera actual transformation to put it in pixel units. Then to look in the style sheet the size of the element and to test if its enclosing rectangle intersects the view port. For edges, its two nodes are used.
      Parameters:
      element - The element to test.
      Returns:
      True if the element is visible and therefore must be rendered.
    • findGraphicElementAt

      GraphicElement findGraphicElementAt​(GraphicGraph graph, EnumSet<InteractiveElement> types, double x, double y)
    • allGraphicElementsIn

      Collection<GraphicElement> allGraphicElementsIn​(GraphicGraph graph, EnumSet<InteractiveElement> types, double x1, double y1, double x2, double y2)