ALKMaps.Layer.AvoidFavor
layer allows you to display sets of avoid/favor features.
Parameter | Type/Values | Description |
---|---|---|
frameAvoidFavor |
boolean |
Indicates whether or not to zoom to avoid/favor features in a set. Default false .
|
styleMap |
ALKMaps.StyleMap |
If styleMap is set when layer is initialized, this optional parameter will override the default style map.
|
var afLayer = new ALKMaps.Layer.AvoidFavor( "AF Layer", { frameAvoidFavor: true, styleMap: new ALKMaps.StyleMap({ "default": new ALKMaps.Style( { strokeColor: "${strokeColor}", strokeWidth: "${strokeWidth}", strokeOpacity: "0.5" }, { context: { strokeColor: function (feature) { // 1: avoid 2: favor if (feature.attributes.afType === 1) return "red"; // TODO: else return "green" // TODO: }, strokeWidth: function (feature) { return 10; } } } ) }) }); map.addLayer(afLayer);
getAvoidFavorSets
method allows you to get all avoid/favor set IDs for a given API key. It accepts success
and failure
callback functions.
var callback = function(response){ for(var i = 0; i < response.length; i++){ var afItem = response[i]; var setId = afItem.SetID; } }; afLayer.getAvoidFavorSets({success: callback});
addAvoidFavorPolygonGroup
method allows you to get avoid/favor edits for a given set ID using the group web service endpoint.
Parameter | Type/Values | Description |
---|---|---|
afSetId |
number |
Avoid/Favor set ID. Required. |
afType |
number |
1 for displaying avoid features. 2 for displaying favor features. If it is not set, both avoid and favor will be displayed. Optional. |
frameAvoidFavor |
boolen |
Zoom to newly added features in a set if its value is true. If not specified, the class level setting would be applied. Optional. |
success |
function |
In this callback function, you can implement your vector feature drawing logic here. If the callback function returns false, the built-in vector feature drawing and zooming to features bounding box actions will be ignored. Optional. |
failure |
function |
In this callback function, you can implement error handling logic. Optional. |
addAvoidFavorPolygon
method allows you to get avoid/favor edits for a given set ID filtered by a bounding box.
Parameter | Type/Values | Description |
---|---|---|
afSetId |
number |
Avoid/Favor set ID. Required. |
afType |
number |
1 for displaying avoid features. 2 for displaying favor features. If it is not set, both avoid and favor will be displayed. Optional. |
bbox |
array |
Bounding box in degrees, [min longitude, min latitude, max longitude, max latitude]. Optional. |
frameAvoidFavor |
boolen |
Zoom to newly added features in a set if its value is true. If not specified, the class level setting would be applied. Optional. |
success |
function |
In this callback function, you can implement your vector feature drawing logic here. If the callback function returns false, the built-in vector feature drawing and zooming to features bounding box actions will be ignored. Optional. |
failure |
function |
In this callback function, you can implement error handling logic. Optional. |