Java Code Examples for com.nextgis.maplib.api.ILayer#getId()

The following examples show how to use com.nextgis.maplib.api.ILayer#getId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LayerGroup.java    From android_maplib with GNU Lesser General Public License v3.0 6 votes vote down vote up
public int getVisibleTopLayerId()
{
   for (int i = mLayers.size() - 1; i >= 0; i--) {
        ILayer layer = mLayers.get(i);
        if (layer instanceof LayerGroup) {
            LayerGroup layerGroup = (LayerGroup) layer;
            int visibleTopLayerId = layerGroup.getVisibleTopLayerId();
            if (Constants.NOT_FOUND != visibleTopLayerId) {
                return visibleTopLayerId;
            }

        } else {
            if (layer.isValid() && layer instanceof ILayerView) {
                ILayerView layerView = (ILayerView) layer;
                if (layerView.isVisible()) {
                    return layer.getId();
                }
            }
        }
    }

    return Constants.NOT_FOUND;
}
 
Example 2
Source File: LayerGroup.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Get layer by identificator
 *
 * @param id
 *         Layer identificator
 *
 * @return Layer or null
 */
public ILayer getLayerById(int id)
{
    if (mId == id) {
        return this;
    }

    for (ILayer layer : mLayers) {
        if (layer.getId() == id) {
            return layer;
        }
    }
    return null;
}
 
Example 3
Source File: LayerGroup.java    From android_maplib with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void onLayerDeleted(int id)
{
    for (ILayer layer : mLayers) {
        if (layer.getId() == id) {
            mLayers.remove(layer);
            break;
        }
    }

    if (mParent != null && mParent instanceof LayerGroup) {
        LayerGroup group = (LayerGroup) mParent;
        group.onLayerDeleted(id);
    }
}