Search in sources :

Example 1 with RCTLayer

use of com.mapbox.rctmgl.components.styles.layers.RCTLayer in project maps by rnmapbox.

the class RCTMGLMapView method addFeature.

public void addFeature(View childView, int childPosition) {
    AbstractMapFeature feature = null;
    if (childView instanceof RCTSource) {
        RCTSource source = (RCTSource) childView;
        mSources.put(source.getID(), source);
        feature = (AbstractMapFeature) childView;
    } else if (childView instanceof RCTMGLImages) {
        RCTMGLImages images = (RCTMGLImages) childView;
        mImages.add(images);
        feature = (AbstractMapFeature) childView;
    } else if (childView instanceof RCTMGLLight) {
        feature = (AbstractMapFeature) childView;
    } else if (childView instanceof RCTMGLNativeUserLocation) {
        feature = (AbstractMapFeature) childView;
    } else if (childView instanceof RCTMGLPointAnnotation) {
        RCTMGLPointAnnotation annotation = (RCTMGLPointAnnotation) childView;
        mPointAnnotations.put(annotation.getID(), annotation);
        feature = (AbstractMapFeature) childView;
    } else if (childView instanceof RCTMGLMarkerView) {
        RCTMGLMarkerView marker = (RCTMGLMarkerView) childView;
        feature = (AbstractMapFeature) childView;
    } else if (childView instanceof RCTMGLCamera) {
        mCamera = (RCTMGLCamera) childView;
        feature = (AbstractMapFeature) childView;
    } else if (childView instanceof RCTLayer) {
        feature = (RCTLayer) childView;
    } else if (childView instanceof ViewGroup) {
        ViewGroup children = (ViewGroup) childView;
        for (int i = 0; i < children.getChildCount(); i++) {
            addFeature(children.getChildAt(i), childPosition);
        }
    }
    if (feature != null) {
        if (mQueuedFeatures == null) {
            feature.addToMap(this);
            mFeatures.add(childPosition, feature);
        } else {
            mQueuedFeatures.add(childPosition, feature);
        }
    }
}
Also used : RCTMGLMarkerView(com.mapbox.rctmgl.components.annotation.RCTMGLMarkerView) RCTMGLLight(com.mapbox.rctmgl.components.styles.light.RCTMGLLight) RCTSource(com.mapbox.rctmgl.components.styles.sources.RCTSource) ViewGroup(android.view.ViewGroup) RCTMGLNativeUserLocation(com.mapbox.rctmgl.components.location.RCTMGLNativeUserLocation) AbstractMapFeature(com.mapbox.rctmgl.components.AbstractMapFeature) RCTMGLImages(com.mapbox.rctmgl.components.images.RCTMGLImages) RCTLayer(com.mapbox.rctmgl.components.styles.layers.RCTLayer) RCTMGLPointAnnotation(com.mapbox.rctmgl.components.annotation.RCTMGLPointAnnotation) RCTMGLCamera(com.mapbox.rctmgl.components.camera.RCTMGLCamera)

Example 2 with RCTLayer

use of com.mapbox.rctmgl.components.styles.layers.RCTLayer in project maps by rnmapbox.

the class RCTSource method getLayerIDs.

public String[] getLayerIDs() {
    List<String> layerIDs = new ArrayList<>();
    for (int i = 0; i < mLayers.size(); i++) {
        RCTLayer layer = mLayers.get(i);
        layerIDs.add(layer.getID());
    }
    return layerIDs.toArray(new String[layerIDs.size()]);
}
Also used : ArrayList(java.util.ArrayList) RCTLayer(com.mapbox.rctmgl.components.styles.layers.RCTLayer)

Example 3 with RCTLayer

use of com.mapbox.rctmgl.components.styles.layers.RCTLayer in project maps by rnmapbox.

the class RCTSource method removeFromMap.

@Override
public void removeFromMap(RCTMGLMapView mapView) {
    if (mLayers.size() > 0) {
        for (int i = 0; i < mLayers.size(); i++) {
            RCTLayer layer = mLayers.get(i);
            layer.removeFromMap(mMapView);
        }
    }
    if (mQueuedLayers != null) {
        mQueuedLayers.clear();
    }
    if (mMap != null && mSource != null && mMap.getStyle() != null) {
        try {
            mMap.getStyle().removeSource(mSource);
        } catch (Throwable ex) {
            Logger.w(LOG_TAG, String.format("RCTSource.removeFromMap: %s - %s", mSource, ex.getMessage()), ex);
        }
    }
}
Also used : RCTLayer(com.mapbox.rctmgl.components.styles.layers.RCTLayer)

Example 4 with RCTLayer

use of com.mapbox.rctmgl.components.styles.layers.RCTLayer in project maps by rnmapbox.

the class RCTSource method removeLayer.

public void removeLayer(int childPosition) {
    RCTLayer layer;
    if (mQueuedLayers != null && mQueuedLayers.size() > 0) {
        layer = mQueuedLayers.get(childPosition);
    } else {
        layer = mLayers.get(childPosition);
    }
    removeLayerFromMap(layer, childPosition);
}
Also used : RCTLayer(com.mapbox.rctmgl.components.styles.layers.RCTLayer)

Aggregations

RCTLayer (com.mapbox.rctmgl.components.styles.layers.RCTLayer)4 ViewGroup (android.view.ViewGroup)1 AbstractMapFeature (com.mapbox.rctmgl.components.AbstractMapFeature)1 RCTMGLMarkerView (com.mapbox.rctmgl.components.annotation.RCTMGLMarkerView)1 RCTMGLPointAnnotation (com.mapbox.rctmgl.components.annotation.RCTMGLPointAnnotation)1 RCTMGLCamera (com.mapbox.rctmgl.components.camera.RCTMGLCamera)1 RCTMGLImages (com.mapbox.rctmgl.components.images.RCTMGLImages)1 RCTMGLNativeUserLocation (com.mapbox.rctmgl.components.location.RCTMGLNativeUserLocation)1 RCTMGLLight (com.mapbox.rctmgl.components.styles.light.RCTMGLLight)1 RCTSource (com.mapbox.rctmgl.components.styles.sources.RCTSource)1 ArrayList (java.util.ArrayList)1