regionUtils

regionUtils

Region utilities, everything to do with regions or their calculations goes here
Properties:
Name Type Description
regionUtils._isNewRegion Bool if _isNewRegion is true then a new region will start
regionUtils._currentlyDrawing Bool Boolean to specify if a region is currently being drawn
regionUtils._currentRegionId Number Keep then number of drawn regions and also let them be the id,
regionUtils._currentPoints Array.<Object> Array of points for the current region,
regionUtils._colorInactiveHandle String String for a color "#cccccc",
regionUtils._colorActiveHandle String Color of the point in the region,
regionUtils._scaleHandle Number Scale of the point in regions,
regionUtils._polygonStrokeWidth Number Width of the stroke of the polygon,
regionUtils._handleRadius Number Radius of the point of the region,
regionUtils._epsilonDistance Number Distance at which a click from the first point will consider to close the region,
regionUtils._regions Object Object that contains the regions in the viewer,
regionUtils._drawingclass String String that accompanies the classes of the polygons in the interface"drawPoly",
Source:

Methods

(static) addRegion(points)

Create a region object and store it in the regionUtils._regions container

Source:
Parameters:
Name Type Description
points Array.<Number> Array of 2D points in normalized coordinates

(static) addRegionClassUI(regionClass)

Add accordion for a new region class

Source:
Parameters:
Name Type Description
regionClass String Region class

(static) analyzeRegion()

regionUtils
Source:

(static) changeRegion(regionid)

Change the region properties like color, class name or region name

Source:
Parameters:
Name Type Description
regionid String Region identifier

(static) closePolygon()

Close a polygon, adding a region to the viewer and an interface to it in the side panel
Source:

(static) deleteAllRegions(regionid)

Given a region id, deletes this region in the interface

Source:
Parameters:
Name Type Description
regionid String String id of region to delete

(static) deleteRegion(regionid)

Given a region id, deletes this region in the interface

Source:
Parameters:
Name Type Description
regionid String String id of region to delete

(static) distance(p1, p2)

Distance between two points represented as arrays [x1,y1] and [x2,y2]

Source:
Parameters:
Name Type Description
p1 Array.<Number> Array with x and y coords
p2 Array.<Number> Array with x and y coords

(static) exportRegionsToJSON()

regionUtils
Source:

(static) fillAllRegions()

Fill all regions
Source:

(static) fillRegion(regionid)

Given a region id, fill this region in the interface

Source:
Parameters:
Name Type Description
regionid String String id of region to fill

(static) geoJSON2regions(GeoJSON)

When regions are imported, create all objects for it from a region object

Source:
Parameters:
Name Type Description
GeoJSON Object formatted region to import

(static) globalPointInPath(x, y, path, tmpPoint)

Source:
Parameters:
Name Type Description
x * X coordinate of the point to check
y * Y coordinate of the point to check
path * SVG path
tmpPoint * Temporary point to check if in path. This is only for speed.

(static) importRegionsFromJSON()

regionUtils
Source:

(static) manager()

When a region is being drawn, this function takes care of the creation of the region
Source:

(static) oldRegions2GeoJSON(JSON)

This is only for backward compatibility

Source:
Parameters:
Name Type Description
JSON Object formatted region to convert to GeoJSON

(static) pointsToPath(points)

Given points' coordinates, returns a path string

Source:
Parameters:
Name Type Description
points List List of list of list of points representing a path

(static) regions2GeoJSON(GeoJSON)

When regions are imported, create all objects for it from a region object

Source:
Parameters:
Name Type Description
GeoJSON Object formatted region to import

(static) regionsOnOff()

regionUtils
Source:

(static) regionUI(regionid)

Create the whole UI for a region in the side panel

Source:
Parameters:
Name Type Description
regionid String Region identifier to be searched in regionUtils._regions

(static) resetManager()

Reset the drawing of the regions
Source:

(static) searchTreeForPointsInBbox(quadtree, x0, y0, x3, y3, options)

Search for points inside a particular region

Source:
Parameters:
Name Type Description
quadtree Object d3.quadtree where the points are stored
x0 Number X coordinate of one point in a bounding box
y0 Number Y coordinate of one point in a bounding box
x3 Number X coordinate of diagonal point in a bounding box
y3 Number Y coordinate of diagonal point in a bounding box
options Object Tell the function

(static) searchTreeForPointsInRegion(quadtree, x0, y0, x3, y3, options)

Search for points inside a particular region

Source:
Parameters:
Name Type Description
quadtree Object d3.quadtree where the points are stored
x0 Number X coordinate of one point in a bounding box
y0 Number Y coordinate of one point in a bounding box
x3 Number X coordinate of diagonal point in a bounding box
y3 Number Y coordinate of diagonal point in a bounding box
options Object Tell the function

(static) updateRegionDraw(regionid)

Change the region properties like color, class name or region name

Source:
Parameters:
Name Type Description
regionid String Region identifier