1

Closed

Add IsShapeInLayer and IsShapeInLayers Methods

description

Add IsShapeInLayer and IsShapeInLayers methods.
 
These were contributed by earthware in the patch that he uploaded oct 18, 2008.
 
VEToolkit.Map.IsShapeInLayers = function(shapeid, layerarray) {
/// <summary>
/// checks if supplied shape id is in one of the layers in supplied layerarray
/// </summary>
/// <param name="shapeid">the id of the shape to find</param>
/// <param name="layers">array of layers to search</param> 
for (i = 0; i < layerarray.length; i++) {
    if (layerarray[i] != null) {
        //check if this shape is a member
        if (VEToolkit.Map.IsShapeInLayer(shapeid, layerarray[i])) return true;
    }
}
return false;
 
};
 
//Note to CP: Not difficault but one I have used often enough to write a standard method for
VEToolkit.Map.IsShapeInLayer = function(shapeid, layer) {
/// <summary>
/// checks if supplied shape id is in the supplied layer
/// </summary>
/// <param name="shapeid">the id of the shape to find</param>
/// <param name="layer">the VEShapeLayer to search</param>
if (layer.GetShapeByID(shapeid) != null) {
    //found shape so return true
    return true;
}
};
Closed Jan 28, 2009 at 9:21 PM by crpietschmann
Done. Thanks earthware!

comments