new IWClusteringUtils()
Singleton constructor
Methods
-
calcConvexHull(cluster)
-
Calculates the convex hull of a cluster (to show it in the map).
Parameters:
Name Type Description cluster
object a cluster Returns:
an array of IWCoordinates- Type
- array
-
defaultMarkerFunction(map, cluster)
-
Default marker function for clusters. Returns a simple marker with the number of entries in two sizes for premium or normal entries.
Parameters:
Name Type Description map
IWMap the map to show the marker on cluster
array an array of objects representing the hits Returns:
the marker- Type
- IWOverlay
-
getBounds(cluster)
-
Returns the bounds of all the coordinates in the specified cluster.
Parameters:
Name Type Description cluster
object a cluster Returns:
the bounds of- Type
- IWBounds
-
getTooltipText(cluster, maxNames)
-
Returns a textual description of the specified cluster to show in a tooltip in the map. The text is based on the name properties of the cluster content: For one entry the name is returned, for up to three hits all names are returned in separate lines, and for more hits just the first is returned with the number of other hits.
Parameters:
Name Type Description cluster
array an array of objects representing the hits maxNames
number the maximum number of names to return (optional, default is 3) Returns:
the text- Type
- IWOverlay
-
hideConvexHull(map)
-
Clears the convex hull polygon from the map.
Parameters:
Name Type Description map
IWMap a map Returns:
- Type
- void
-
parseCoordinate(hit)
-
Parses and returns the coordinate from a single hit in a cluster. If the object does not have a coordinate, null is returned. The hit has to have a coordinate in any of those three forms: 1) An IWCoordinate called coordinate 2) Numeric properties x and y with the coordinate in Mercator (EPSG:3857) 3) Numeric properties lat and lon with the coordinate in WGS84 (EPSG:4326)
Parameters:
Name Type Description hit
object a hit Returns:
the coordinate of the hit- Type
- IWCoordinate
-
parseCoordinates(hits)
-
Parses and returns the coordinates from an array of hits in a cluster. Objects which don't have coordinates are skipped. Coordinates are expected as for parseCoordinate().
Parameters:
Name Type Description hits
Array.<object> an array of hits Returns:
the coordinates of the hits- Type
- Array.<IWCoordinate>
-
showConvexHull(map, cluster)
-
Shows the convex hull of the cluster points as a polygon on the map. If the cluster contains only two points a line is shown instead; for one point nothing is rendered.
Parameters:
Name Type Description map
IWMap a map cluster
object a cluster Returns:
- Type
- void
-
zoomToCluster(map, cluster, offset)
-
Zooms the map to the bounding box of the cluster. If the cluster contains only one point or the zoom level is already maximized nothing is done. The offset can be an object with properties top, right, bottom and left to specify individual offsets for all map borders, or an integer which is used for every border, or null (no borders).
Parameters:
Name Type Description map
IWMap a map cluster
object a cluster offset
object an object as described above, or an integer value Returns:
true if the map is zoomed, false otherwise- Type
- boolean