com.yworks.yfiles.server.tiles.servlet
Class GraphInfoProvider

java.lang.Object
  extended bycom.yworks.yfiles.server.tiles.servlet.GraphInfoProvider

public class GraphInfoProvider
extends Object

This is a helper class which provides information on the currently visible graph elements and the nesting structure of the whole graph. See writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int) and writeHierarchyInfo(PrintWriter, Graph2D).


Field Summary
static int EDGE_LABELS
          Flag used in writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int): write info for edge labels.
static int EDGES
          Flag used in writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int): write info for edges.
static int NODE_LABELS
          Flag used in writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int): write info for node labels.
static int NODES
          Flag used in writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int): write info for nodes.
 
Method Summary
static String getHierarchyInfoJSON(HierarchyManager hierarchyManager)
          returns a JSON string containing information on the given hierarchy.
static String getHitInfoJSON(Graph2D graph, int types, double x, double y, double width, double height)
          returns a JSON string containing information on the bounds of the graph elements.
static void writeHierarchyInfo(PrintWriter out, Graph2D graph)
          writes information on the nesting structure of the nodes of a graph to an output stream.
static void writeViewInfo(PrintWriter out, Graph2D graph, double x, double y, double width, double height, int types)
          writes information on the currently visible graph elements to an output stream in JSON format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NODES

public static final int NODES
Flag used in writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int): write info for nodes.

See Also:
Constant Field Values

EDGES

public static final int EDGES
Flag used in writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int): write info for edges.

See Also:
Constant Field Values

NODE_LABELS

public static final int NODE_LABELS
Flag used in writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int): write info for node labels.

See Also:
Constant Field Values

EDGE_LABELS

public static final int EDGE_LABELS
Flag used in writeViewInfo(PrintWriter, Graph2D, double, double, double, double, int): write info for edge labels.

See Also:
Constant Field Values
Method Detail

writeViewInfo

public static void writeViewInfo(PrintWriter out,
                                 Graph2D graph,
                                 double x,
                                 double y,
                                 double width,
                                 double height,
                                 int types)
writes information on the currently visible graph elements to an output stream in JSON format. If the given width or height is less than 0, the whole graph is considered. This method calls getHitInfoJSON(Graph2D, int, double, double, double, double).

Parameters:
out - the output stream on which to write the information
graph - the graph for which the information is written
x - left edge of the area, for which information should be written (world coordinates)
y - right edge of the area, for which information should be written (world coordinates)
width - width of the area, for which information should be written (world coordinates)
height - height of the area, for which information should be written (world coordinates)
types - types of graph elements, for which information should be written as an ORed combination of the constants defined in this class for this purpose

getHitInfoJSON

public static String getHitInfoJSON(Graph2D graph,
                                    int types,
                                    double x,
                                    double y,
                                    double width,
                                    double height)
returns a JSON string containing information on the bounds of the graph elements. If the given width or height is less than 0, the whole graph is considered.

Parameters:
graph - the graph
types - types of graph elements, for which information should be returned as an ORed combination of the constants defined in this class for this purpose
x - left edge of the area, for which information should be returned (world coordinates)
y - right edge of the area, for which information should be returned (world coordinates)
width - width of the area, for which information should be returned (world coordinates)
height - height of the area, for which information should be returned (world coordinates)
Returns:
a string in JSON format

writeHierarchyInfo

public static void writeHierarchyInfo(PrintWriter out,
                                      Graph2D graph)
writes information on the nesting structure of the nodes of a graph to an output stream. The output format is JSON format.

Parameters:
out - the output stream on which to write the information
graph - the graph for which the information is written

getHierarchyInfoJSON

public static String getHierarchyInfoJSON(HierarchyManager hierarchyManager)
returns a JSON string containing information on the given hierarchy.

Parameters:
hierarchyManager - the manager for the hierarchy
Returns:
a JSON string containing an array with entries for every node


Copyright © 2006-2013 yWorks GmbH. All rights reserved