|
|||||
| SUMMARY: FIELD | CONSTR | METHOD| EVENT | DETAIL: FIELD | CONSTR | METHOD| EVENT | ||||
This is a client side hit test.
The main functions are getHitInfo() and getOverlaps(). Both return a hit info object. There are some "static" methods like yfiles.client.tiles.HitTest.getHitIds() which return specific information contained in a hit info. An instance of this class is initialized for a specific graph a set of interesting graph elements. These parameters can be changed later on using setEventTypes() and setGraphParameters(). An instance of this class fetches the data for answering hit test queries from the server. Answering the queries is performed on the basis of this data on the client side.
| Constructor Summary | |
|---|---|
HitTest(/*String*/ baseURL, /*String*/ path, /*GraphBounds*/ worldBounds, /*Boolean*/ nodeEvents, /*Boolean*/ edgeEvents, /*Boolean*/ nodeLabelEvents, /*Boolean*/ edgeLabelEvents, /*Boolean*/ paperEvents)
This is a client side hit test. |
|
| Method Summary | |
|---|---|
|
clear()
clears the hit test data. |
GraphBounds |
getBounds(/*Object*/ hitInfo)
returns the bounds of the first hit for the given hit info. |
GraphBounds |
getBoundsForId(/*String*/ id)
returns the bounds of the graph element with the given id. |
Object[] |
getControlPoints(/*String*/ edgeId)
returns the path of the edge with the given edgeId as an array of objects with x and y attributes. |
String |
getDescription(/*Object*/ hitInfo)
returns the URL of the first hit of the given hit info. |
String |
getElementType(/*Object*/ hitInfoOrId)
returns the type of graph element for the first hit of the given hit info or the given id. |
HitInfo |
getEmptyHitInfo(/*Number*/ worldX, /*Number*/ worldY)
returns an empty hit info structure for the given world coordinates. |
Number |
getEventMask()
returns an integer which encodes the types of elements considered by this hit test. |
String |
getGraphName()
returns the symbolic name of the graph. |
Number |
getHitCount(/*Object*/ hitInfo)
returns the number of hits for the given hit info. |
String |
getHitId(/*Object*/ hitInfo)
returns the id of the first hit for the given hit info or null. |
String[] |
getHitIds(/*Object*/ hitInfo)
returns an array with all hit ids for the given graph info. |
HitInfo |
getHitInfo(/*Number*/ worldX, /*Number*/ worldY, /*Boolean*/ firstHitOnly)
returns a hit info structure for the given world coordinates. |
Object |
getLabelInfo(/*String*/ labelId)
returns information on the label with the given id. |
HitInfo |
getOverlaps(/*Number*/ x1, /*Number*/ y1, /*Number*/ x2, /*Number*/ y2)
returns a hit info structure for the graph elements overlapping the rectangular region with upper left corner (x1,y1) and lower right corner (x2,y2). |
String |
getUrl(/*Object*/ hitInfo)
returns the URL of the first hit of the given hit info. |
boolean |
isActive()
returns true, if at least one kind of graph elements is marked as relevant (see setEventTypes()). |
|
refresh()
refreshes the hit test data for the current graph by means of a server call. |
|
setCoords(/*Object*/ info, /*float*/ x, /*float*/ y)
sets the coordinates for the given hit info. |
|
setData(/*Object*/ hitTestData, /*Function*/ callback, /*String*/ baseURL, /*String*/ path, /*GraphBounds*/ worldBounds)
sets new hit test data for this hit test and optionally changes parameters. |
|
setEdgeTestSensitivity(/*Number*/ sensitivity)
sets the edge test sensitivity in world units. |
|
setEventTypes(/*Boolean*/ nodeEvents, /*Boolean*/ edgeEvents, /*Boolean*/ nodeLabelEvents, /*Boolean*/ edgeLabelEvents, /*Boolean*/ paperEvents)
changes the set of relevant graph elements for this hit test. |
|
setGraphParameters(/*String*/ baseURL, /*String*/ path, /*GraphBounds*/ worldBounds, /*Function*/ callback)
changes some parameters for this hit test. |
| Event Summary | |
|---|---|
|
onNewData()
is called, if new hit test data for the current graph has been loaded. |
| Constructor Detail |
|---|
HitTest(/*String*/ baseURL, /*String*/ path, /*GraphBounds*/ worldBounds, /*Boolean*/ nodeEvents, /*Boolean*/ edgeEvents, /*Boolean*/ nodeLabelEvents, /*Boolean*/ edgeLabelEvents, /*Boolean*/ paperEvents)
baseURL - the base path for server requests (possibly relative to the current page, default ".")
path - the symbolic name of the graph
worldBounds - the bounds for which to answer hit queries in world coordinates
nodeEvents - whether nodes are relevant for this hit test
edgeEvents - whether edges are relevant for this hit test
nodeLabelEvents - whether node labels are relevant for this hit test
edgeLabelEvents - whether edge labels are relevant for this hit test
paperEvents - whether paper clicks are relevant for this hit test
| Method Detail |
|---|
clear()
GraphBounds getBounds(/*Object*/ hitInfo)
hitInfo - The hit info object whose bounds are requested.
GraphBounds getBoundsForId(/*String*/ id)
id - The id of the node, edge, node label or edge label whose bounds are requested.
Object[] getControlPoints(/*String*/ edgeId)
edgeId - The edge whose control points are requested.
String getDescription(/*Object*/ hitInfo)
hitInfo - The hit info object whose description is requested.
String getElementType(/*Object*/ hitInfoOrId)
hitInfoOrId - Can be either a string or a hit info object. If it is a string, then it is the id of the element
whose type is requested.
HitInfo getEmptyHitInfo(/*Number*/ worldX, /*Number*/ worldY)
worldX - The x world coordinate.
worldY - The y world coordinate.
Number getEventMask()
String getGraphName()
Number getHitCount(/*Object*/ hitInfo)
hitInfo - The hit info object whose hit count is requested.
String getHitId(/*Object*/ hitInfo)
hitInfo - The hit info object whose first id is requested.
String[] getHitIds(/*Object*/ hitInfo)
hitInfo - The hit info object whose ids are requested.
HitInfo getHitInfo(/*Number*/ worldX, /*Number*/ worldY, /*Boolean*/ firstHitOnly)
worldX - x-coordinate of the hit test point in world coordinates
worldY - y-coordinate of the hit test point in world coordinates
firstHitOnly - whether to stop the hit test after the first hit has been found
Object getLabelInfo(/*String*/ labelId)
labelId - the id of a node label or an edge label
HitInfo getOverlaps(/*Number*/ x1, /*Number*/ y1, /*Number*/ x2, /*Number*/ y2)
x1 - left side of the rectangle.
y1 - upper side of the rectangle.
x2 - right side of the rectangle.
y2 - lower side of the rectangle.
String getUrl(/*Object*/ hitInfo)
hitInfo - The hit info object whose url is requested.
boolean isActive()
refresh()
setCoords(/*Object*/ info, /*float*/ x, /*float*/ y)
info - The hit info object whose coordinates should be set.
x - The x coordinate of the hit info.
y - The y coordinate of the hit info.
setData(/*Object*/ hitTestData, /*Function*/ callback, /*String*/ baseURL, /*String*/ path, /*GraphBounds*/ worldBounds)
hitTestData - an object with hit test data in the same format as the hit test data returned by the server
callback - is called with the new baseURL, path and bounds when setting the the new data is done
baseURL - the base path for server requests
path - the symbolic name of the graph
worldBounds - the bounds for which to answer hit queries in world coordinates
setEdgeTestSensitivity(/*Number*/ sensitivity)
sensitivity - the new edge test sensitivity in world units.
setEventTypes(/*Boolean*/ nodeEvents, /*Boolean*/ edgeEvents, /*Boolean*/ nodeLabelEvents, /*Boolean*/ edgeLabelEvents, /*Boolean*/ paperEvents)
nodeEvents - whether nodes are relevant for this hit test
edgeEvents - whether edges are relevant for this hit test
nodeLabelEvents - whether node labels are relevant for this hit test
edgeLabelEvents - whether edge labels are relevant for this hit test
paperEvents - whether paper clicks are relevant for this hit test
setGraphParameters(/*String*/ baseURL, /*String*/ path, /*GraphBounds*/ worldBounds, /*Function*/ callback)
baseURL - the base path for server requests
path - the symbolic name of the graph
worldBounds - the bounds for which to answer hit queries in world coordinates
callback - is called with the new baseURL, path and bounds when setting the parameters
and loading new data if necessary is done
| Event Detail |
|---|
onNewData()