Search for all the nodes and sprites contained inside the rectangle (x1,y1)-(x2,y2).
Search for all the nodes and sprites contained inside the rectangle (x1,y1)-(x2,y2).
The graph to search for.
The rectangle lowest point abscissa.
The rectangle lowest point ordinate.
The rectangle highest point abscissa.
The rectangle highest point ordinate.
The set of sprites and nodes in the given rectangle.
Automatic centring of the view.
Automatic centring of the view.
Compute a transformation matrix that pass from graph units (user space) to pixel units (device space) so that the whole graph is visible.
Compute a transformation matrix that pass from graph units (user space) to pixel units (device space) so that the whole graph is visible.
The transformation modified.
The rendering back-end.
The rendering back-end.
The camera centre of view.
The camera centre of view.
Process each node to check if it is in the actual view port, and mark invisible nodes.
Process each node to check if it is in the actual view port, and mark invisible nodes. This method allows for fast node, sprite and edge visibility checking when drawing. This must be called before each rendering (if the view port changed). Called in pushView.
Search for the first node or sprite (in that order) that contains the point at coordinates (x, y).
Search for the first node or sprite (in that order) that contains the point at coordinates (x, y).
The graph to search for.
The point abscissa.
The point ordinate.
The first node or sprite at the given coordinates or null if nothing found.
Compute the real position of a sprite according to its eventual attachment in graph units.
Compute the real position of a sprite according to its eventual attachment in graph units.
The sprite.
Receiver for the sprite 2D position, can be null.
The units in which the position must be computed (the sprite already contains units).
The same instance as the one given by parameter pos or a new one if pos was null, containing the computed position in the given units.
Compute the position of a sprite if attached to an edge.
Compute the position of a sprite if attached to an edge.
The sprite.
The units the computed position must be given into.
The same instance as pos, or a new one if pos was null.
Compute the position of a sprite if it is not attached.
Compute the position of a sprite if it is not attached.
The sprite.
Where to stored the computed position, if null, the position is created.
The units the computed position must be given into.
The same instance as pos, or a new one if pos was null.
Compute the position of a sprite if attached to a node.
Compute the position of a sprite if attached to a node.
The sprite.
The units the computed position must be given into.
The same instance as pos, or a new one if pos was null.
The graph view port, if any.
The graph view port, if any. The graph view port is a view inside the graph space. It allows to compute the view according to a specified area of the graph space instead of the graph dimensions.
Return the given point in pixels converted in graph units (GU) using the inverse transformation of the current projection matrix.
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.
The source point abscissa in pixels.
The source point ordinate in pixels.
The resulting points in graph units.
Check if an edge is visible in the current view port.
Check if an edge is visible in the current view port.
The edge to check.
True if visible.
Is the given node visible in the given area.
Is the given node visible in the given area.
The node to check.
The min abscissa of the area.
The min ordinate of the area.
The max abscissa of the area.
The max ordinate of the area.
True if the node lies in the given area.
Is the given sprite visible in the given area.
Is the given sprite visible in the given area.
The sprite to check.
The min abscissa of the area.
The min ordinate of the area.
The max abscissa of the area.
The max ordinate of the area.
True if the node lies in the given area.
Check if a sprite is visible in the current view port.
Check if a sprite is visible in the current view port.
The sprite to check.
True if visible.
True if the element would be visible on screen.
True if the element would be visible on screen. The method used is to transform the centre 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.
The element to test.
True if the element is visible and therefore must be rendered.
Information on the graph overall dimension and position.
Check if a node contains the given point (x,y).
Check if a node contains the given point (x,y).
The node.
The point abscissa.
The point ordinate.
True if (x,y) is in the given element.
Which node is visible.
Which node is visible. This allows to mark invisible nodes to fasten visibility tests for nodes, attached sprites and edges. The visibility test is heavy, and we often need to test for nodes visibility. This allows to do it only once per rendering step. Hence the storage of the invisible nodes here.
Padding around the graph.
Padding around the graph.
Restore the transform that was used before #pushView(Graphics2D)
is used.
Set the camera view in the given graphics and backup the previous transform of the graphics.
Set the camera view in the given graphics and backup the previous transform of the graphics.
Call #popView(Graphics2D)
to restore the saved transform. You can only push one time
the view.
The graphic graph (used to check element visibility).
The rotation angle.
The rotation angle.
Enable or disable automatic adjustment of the view to see the entire graph.
Enable or disable automatic adjustment of the view to see the entire graph.
If true, automatic adjustment is enabled.
Set the graphic graph bounds from the graphic graph.
Set the graphic graph bounds (the lowest and highest points).
Set the graphic graph bounds (the lowest and highest points).
Lowest abscissa.
Lowest ordinate.
Lowest depth.
Highest abscissa.
Highest ordinate.
Highest depth.
Set the graph padding.
Set the graph padding. Called in pushView.
The graphic graph.
Set the centre of the view (the looked at point).
Set the centre of the view (the looked at point). As the viewer is only 2D, the z value is not required.
The new position abscissa.
The new position ordinate.
Set the output view port size in pixels.
Set the output view port size in pixels.
The width in pixels of the view port.
The width in pixels of the view port.
Check if a sprite contains the given point (x,y).
Check if a sprite contains the given point (x,y).
The sprite.
The point abscissa.
The point ordinate.
True if (x,y) is in the given element.
Transform a point in graph units into pixels.
Transform a point in graph units into pixels.
The transformed point.
Compute a transformation that pass from graph units (user space) to a pixel units (device space) so that the view (zoom and centre) requested by the user is produced.
Compute a transformation that pass from graph units (user space) to a pixel units (device space) so that the view (zoom and centre) requested by the user is produced.
The transformation modified.
The view centre (a point in graph units).
The view centre (a point in graph units).
The view centre.
The visible portion of the graph.
The visible portion of the graph.
A real for which value 1 means the graph is fully visible and uses the whole view port.
Set the zoom (or percent of the graph visible), 1 means the graph is fully visible.
Set the zoom (or percent of the graph visible), 1 means the graph is fully visible.
The zoom.
The rotation angle in degrees.
The rotation angle in degrees.
The rotation angle in degrees.
Set the rotation angle around the centre.
Set the rotation angle around the centre.
The rotation angle in degrees.
The camera zoom.
The camera zoom.
Define how the graph is viewed.
The camera is in charge of projecting the graph elements in graph units (GU) into user spaces (often in pixels). It defines the transformation (an affine matrix) to pass from the first to the second. It also contains the graph metrics, a set of values that give the overall dimensions of the graph in graph units, as well as the view port, the area on the screen (or any rendering surface) that will receive the results in pixels (or rendering units). The two mains methods for this operation are
#pushView(Graphics2D,GraphicGraph)
and#popView()
.The user of the camera must set both the view port and the graph bounds in order for the camera to correctly project the graph view. The camera also defines a centre at which it always points. It can zoom on the graph, pan in any direction and rotate along two axes.
There are two modes : an "auto-fit" mode where the camera always show the whole graph even if it changes in size, and a "user" mode where the camera centre (looked-at point), zoom and panning are specified.
Knowing the transformation also allows to provide services like "what element is visible ?" (in the camera view) or "on what element is the mouse cursor actually ?".
The camera is also able to compute sprite positions according to their attachment, as well as maintaining a list of all elements out of the view, so that it is not needed to render them.