Class: polygonFeature

geo.webgl. polygonFeature

new geo.webgl.polygonFeature(arg){geo.webgl.polygonFeature}

Create a new instance of webgl.polygonFeature.

Name Type Description
arg geo.polygonFeature.spec
Returns:
Type Description
geo.webgl.polygonFeature

Extends

Members

inherited idle

Getter for the idle state. Read only.

Properties:
Name Type Description
idle boolean

true if the object is idle (onIdle would call a handler immediately).

inherited ready

Properties:
Name Type Description
ready boolean

true if this feature has been initialized, false if it was destroyed, undefined if it was created but not initialized.

Methods

actors(){Array.<vgl.actor>}

List vgl actors.

Returns:
Type Description
Array.<vgl.actor> The list of actors.

inherited addChild(child){this}

Add a child (or an array of children) to the object.

Name Type Description
child geo.object | Array.<geo.object>

A child object or array of child objects.

Returns:
Type Description
this

inherited addPromise(promise){this}

Add the promise here and also propagate up the scene tree.

Name Type Description
promise Promise

A promise object.

Returns:
Type Description
this

inherited bin(val, actualValue){number|this}

Get/Set bin of the feature. The bin number is used to determine the order of multiple features on the same layer. It has no effect except on the webgl renderer. A negative value hides the feature without stopping interaction with it. Otherwise, features with higher bin numbers are drawn above those with lower bin numbers. If two features have the same bin number, their order relative to one another is indeterminate and may be unstable.

Name Type Description
val number optional

The new bin number. If undefined, return the current bin number. If null, the bin is dynamically computed based on order within the parent. If children are nested, this may not be what is desired.

actualValue boolean optional

If truthy and val is undefined, return the actual value of bin, rather than the dynamically computed value.

Returns:
Type Description
number | this The current bin number or a reference to this.

inherited boxSearch(lowerLeft, upperRight, opts){geo.feature.searchResult}

Search for features contained within a rectangular region.

Name Type Description
lowerLeft geo.geoPosition

Lower-left corner in gcs coordinates.

upperRight geo.geoPosition

Upper-right corner in gcs coordinates.

opts object optional

Additional search options.

Name Type Default Description
partial boolean false optional

If truthy, include features that are partially in the box, otherwise only include features that are fully within the region.

Returns:
Type Description
geo.feature.searchResult An object with a list of features and feature indices that are located at the specified point.

inherited buildTime(val){geo.timestamp|this}

Get/Set timestamp of last time a build happened.

Name Type Description
val geo.timestamp optional

The new build timestamp object or undefined to get the current build timestamp object.

Returns:
Type Description
geo.timestamp | this

Get an array of the child objects.

Returns:
Type Description
Array.<geo.object> A copy of the array of child objects.

Get/set data.

Name Type Description
arg object optional

if specified, use this for the data and return the feature. If not specified, return the current data.

Returns:
Type Description
geo.polygonFeature | object

Get/Set timestamp of data change.

Name Type Description
val geo.timestamp optional

The new data timestamp object or undefined to get the current data timestamp object.

Returns:
Type Description
geo.timestamp | this

inherited dependentFeatures(arg){Array.<geo.feature>|this}

Get/Set a list of dependent features. Dependent features have their visibility changed at the same time as the feature.

Name Type Description
arg Array.<geo.feature> optional

If specified, the new list of dependent features. Otherwise, return the current list of dependent features.

Returns:
Type Description
Array.<geo.feature> | this The current list of dependent features or a reference to this.

Redraw the object.

Returns:
Type Description
object The results of the superclass draw function.

inherited featureGcsToDisplay(c){geo.screenPosition}

Convert from the feature's gcs coordinates to display coordinates.

Name Type Description
c geo.geoPosition

The input coordinate to convert.

Returns:
Type Description
geo.screenPosition Display space coordinates.

inherited gcs(val){string|this}

Get/Set the projection of the feature.

Name Type Description
val string optional nullable

If undefined, return the current gcs. If null, use the map's interface gcs. Otherwise, set a new value for the gcs.

Returns:
Type Description
string | this A string used by geo.transform. If the map interface gcs is in use, that value will be returned. If the gcs is set, return the current class instance.

inherited geoIsOn(event, handler){boolean}

Report if an event handler is bound to this object.

Name Type Description
event string | Array.<string>

An event or list of events to check.

handler function optional

A function that might be bound. If undefined, this will report true if there is any handler for the specified event.

Returns:
Type Description
boolean true if any of the specified events are bound to the specified handler.

inherited geoOff(event, arg){this}

Remove handlers from one event or an array of events. If no event is provided all handlers will be removed.

Name Type Description
event string | Array.<string> optional

An event or a list of events from geo.event or defined by the user, or undefined to remove all events (in which case arg is ignored).

arg function | Array.<function()> optional nullable

A function or array of functions to remove from the events or a falsy value to remove all handlers from the events.

Returns:
Type Description
this

inherited geoOn(event, handler){this}

Bind an event handler to this object.

Name Type Description
event string

An event from geo.event or a user-defined value.

handler function

A function that is called when event is triggered. The function is passed a geo.event object.

Returns:
Type Description
this

inherited geoTrigger(event, args, childrenOnly){this}

Trigger an event (or events) on this object and call all handlers.

Name Type Description
event string

The event to trigger.

args object

Arbitrary argument to pass to the handler.

childrenOnly boolean optional

If truthy, only propagate down the tree.

Returns:
Type Description
this

Get the layer referenced by the feature.

Returns:
Type Description
geo.layer The layer associated with the feature.

inherited modified(){object}

Update the timestamp to the next global timestamp value. Mark sub-features as modified, too.

Returns:
Type Description
object The results of the superclass modified function.

inherited mouseOverOrderClosestBorder(evt)

If the selectionAPI is on, then setting this.geoOn(geo.event.feature.mouseover_order, this.mouseOverOrderClosestBorder) will make it so that the mouseon events prefer the polygon with the closet border, including hole edges.

Name Type Description
evt geo.event

The event; this should be triggered from geo.event.feature.mouseover_order.

inherited mouseOverOrderHighestIndex(evt)

If the selectionAPI is on, then setting this.geoOn(geo.event.feature.mouseover_order, this.mouseOverOrderHighestIndex) will make it so that the mouseon events prefer the highest index feature.

Name Type Description
evt geo.event

The event; this should be triggered from geo.event.feature.mouseover_order.

inherited onIdle(handler){this}

Bind a handler that will be called one time when all internal promises are resolved. If there are no outstanding promises, this is invoked synchronously.

Name Type Description
handler function

A function taking no arguments.

Returns:
Type Description
this

Get/set parent of the object.

Name Type Description
arg geo.sceneObject optional

The new parant or undefined to get the current parent.

Returns:
Type Description
this | geo.sceneObject

inherited pointSearch(coordinate){object}

Point search method for selection api. Returns markers containing the given point.

Name Type Description
coordinate geo.geoPosition

point to search for in map interface gcs.

Returns:
Type Description
object An object with index: a list of polygon indices, and found: a list of polygons that contain the specified coordinate.

inherited polygon(val){object|function|this}

Get/set polygon accessor.

Name Type Description
val object | function optional

If not specified, return the current polygon accessor. If specified, use this for the polygon accessor and return this. If a function is given, the function is passed (dataElement, dataIndex) and returns a geo.polygon.

Returns:
Type Description
object | function | this The current polygon accessor or this feature.

inherited polygonCoordinates(){Array.<geo.polygonObject>}

Get the set of normalized polygon coordinates.

Returns:
Type Description
Array.<geo.polygonObject> An array of polygon positions. Each has outer and inner if it has any coordinates, or is undefined.

inherited polygonSearch(poly, opts){object}

Returns polygons that are contained in the given polygon. This could fail to return polygons that are less than their stroke width outside of the specified polygon and whose vertices are not near the selected polygon.

Name Type Description
poly geo.polygonObject

A polygon as an array of coordinates or an object with outer and optionally inner parameters. All coordinates are in map interface gcs.

opts object optional

Additional search options.

Name Type Default Description
partial boolean false optional

If truthy, include polygons that are partially in the polygon, otherwise only include polygons that are fully within the region.

Returns:
Type Description
object An object with index: a list of polygon indices, found: a list of polygons within the polygon, and extra: an object with index keys containing an object with a partial key and a boolean value to indicate if the polygon is on the specified polygon's border.

Get/Set position accessor.

Name Type Description
val geo.geoPosition | function optional

If not specified, return the current position accessor. If specified, use this for the position accessor and return this. If a function is given, this is called with (vertexElement, vertexIndex, dataElement, dataIndex).

Returns:
Type Description
geo.geoPosition | this The current position or this feature.

inherited rdpSimplifyData(data, tolerance, posFunc, polyFunc){this}

Take a set of data, reduce the number of vertices per polygon using the Ramer–Douglas–Peucker algorithm, and use the result as the new data. This changes the instance's data, the position accessor, and the polygon accessor.

Name Type Default Description
data array

A new data array.

tolerance number optional

The maximum variation allowed in map.gcs units. A value of zero will only remove perfectly colinear points. If not specified, this is set to a half display pixel at the map's current zoom level.

posFunc function this.style.get('position') optional

The function to get the position of each vertex.

polyFunc function this.style.get('polygon') optional

The function to get each polygon.

Returns:
Type Description
this

inherited removeChild(child){this}

Remove a child (or array of children) from the object.

Name Type Description
child geo.object | Array.<geo.object>

A child object or array of child objects.

Returns:
Type Description
this

Get the renderer used by the feature.

Returns:
Type Description
geo.renderer The renderer used to render the feature.

inherited selectionAPI(arg, direct){boolean|string|this}

Get/Set if the selection API is enabled for this feature.

Name Type Description
arg boolean | string optional

undefined to return the selectionAPI state, a boolean to change the state, or 'auto' to set the state based on the existence of event handlers. When getting the state, if direct is not specified, 'auto' is never returned.

direct boolean optional

If true, when getting the selectionAPI state, disregard the state of the parent layer, and when setting, refresh the state regardless of whether it has changed or not.

Returns:
Type Description
boolean | string | this Either the selectionAPI state or the feature instance.

inherited style(arg1, arg2){object|this}

Get/Set style used by the feature. This calls the super function, then checks if strokes are required.

See the style specification styleSpec for available styles.

Name Type Description
arg1 string | object optional

If undefined, return the current style object. If a string and arg2 is undefined, return the style associated with the specified key. If a string and arg2 is defined, set the named style to the specified value. Otherwise, extend the current style with the values in the specified object.

arg2 * optional

If arg1 is a string, the new value for that style.

Returns:
Type Description
object | this Either the entire style object, the value of a specific style, or the current class instance.

inherited style.get(key){function|object}

A uniform getter that always returns a function even for constant styles. This can also return all defined styles as functions in a single object.

If the style key is a color, the returned function will also coerce the result to be a geo.geoColorObject.

Name Type Description
key string optional

If defined, return a function for the named style. Otherwise, return an object with a function for all defined styles.

Returns:
Type Description
function | object Either a function for the named style or an object with functions for all defined styles.

inherited timestamp(){number}

Get time.

Returns:
Type Description
number The timestamp. This is 0 if the timestamp has never been modified.

inherited updateStyleFromArray(keyOrObject, styleArray, refresh){this}

Set style(s) from array(s). For each style, the array should have one value per data item. The values are not converted or validated. Color values should be geo.geoColorObjects. If invalid values are given the behavior is undefined. For some feature styles, if the first entry of an array is itself an array, then each entry of the array is expected to be an array, and values are used from these subarrays. This allows a style to apply, for instance, per vertex of a data item rather than per data item.

Name Type Default Description
keyOrObject string | object

Either the name of a single style or an object where the keys are the names of styles and the values are each arrays.

styleArray array

If keyOrObject is a string, an array of values for the style. If keyOrObject is an object, this parameter is ignored.

refresh boolean false optional

true to redraw the feature when it has been updated. If an object with styles is passed, the redraw is only done once.

Returns:
Type Description
this The feature instance.

inherited updateTime(val){geo.timestamp|this}

Get/Set timestamp of last time an update happened.

Name Type Description
val geo.timestamp optional

The new update timestamp object or undefined to get the current update timestamp object.

Returns:
Type Description
geo.timestamp | this

inherited visible(val, direct){boolean|this}

Get/Set the visibility of the feature.

Name Type Description
val boolean optional

A boolean to change the visibility, or undefined to return the visibility.

direct boolean optional

If true, when getting the visibility, disregard the visibility of the parent layer, and when setting, refresh the state regardless of whether it has changed or not. Otherwise, the functional visibility is returned, where both the feature and the layer must be visible for a true result.

Returns:
Type Description
boolean | this Either the visibility (if getting) or the feature (if setting).

innercreateGLPolygons(onlyStyle)

Create and style the triangles needed to render the polygons.

There are several optimizations to do less work when possible. If only styles have changed, the triangulation is not recomputed, nor is the geometry re-transformed. If styles use static values (rather than functions), they are only calculated once. If a polygon reports that it has a uniform style, then styles are only calculated once for that polygon (the uniform property may be different per polygon or per update). Array.map is slower in Chrome that using a loop, so loops are used in places that would be conceptually served by maps.

Name Type Description
onlyStyle boolean

if true, use the existing geoemtry and just recalculate the style.