Telogis.GeoBase.Canvas.Util |
Contains useful functions for manipulating the array of pixel points prior to rendering.
Name | Description |
---|---|
clipPath (Array poly, Point ul, Point lr, Boolean closed) | Clips a polygon to a rectangular viewport by the Sutherland-Hodgeman algorithm, edge-by-edge. If the Canvas.Util.clipPath.closed is set to false (i.e. the path being clipped is a polyline), the resulting path may contain some line segments along the edges of the viewport. To remove these and produce a set of properly clipped polylines, a call to Canvas.Util.splitPath should be made. Note that since this clipping operation is performed in-place, the result is saved in the array passed as a parameter. Arguments
|
pathsEqual (Array path1, Array path2, Number tolerance) | Determines whether two lists of points have per-element equivalence and hence represent equivalent paths. Note that repeated points qualify a path as being distinct. Arguments
Boolean - True if Canvas.Util.pathsEqual.path1 and Canvas.Util.pathsEqual.path2 are equivalent within Canvas.Util.pathsEqual.tolerance pixels; false otherwise. |
polysEqual (Array poly1, Array poly2, Number tolerance) | Determines whether the two polygons described by a pair of arrays are equivalent. This is essentially the same as Canvas.Util.pathsEqual, except that one of the arguments may be a cyclic shift of the other. Note that repeated points qualify a polygon as being distinct. Arguments
Boolean - True if Canvas.Util.polysEqual.poly1 and Canvas.Util.polysEqual.poly2 are equivalent within Canvas.Util.polysEqual.tolerance pixels; false otherwise. |
reducePath (Array points, Number factor, Number threshold) | A dynamic simplification method that produces accurate simplifications for a reduce factor above a certain threshold, or fast simplifications first and accurate simplifications next for a reduce factor below this threshold. The simplification is performed in-place, so the result will be saved in the array passed as a parameter (although a reference to it is returned for convenience). Arguments
Array - A reference to the reduced array of polyline points. |
removeRepeatedPoints (Array path, Boolean closed, Number tolerance) | Removes repeated points from a sequence of Points, for minor drawing-time optimization. This operation is performed in-place, so that the result will be saved in the array passed as a parameter (although a reference to it is returned, for convenience). Arguments
Array - A reference to the modified Canvas.Util.removeRepeatedPoints.path, with repeated entries removed appropriately. |
split (Array path, Point ul, Point lr) | Given a long polyline with segments that may lie on the edges of the viewport, this function removes these segments to give an array of smaller polylines. This is useful for discarding redundant sections of a polyline clipped with Canvas.Util.clipPath. Arguments
Array - An array of lists of Points, each describing a distinct polyline inside the viewport area. |