Search in sources :

Example 1 with RCTMGLMarkerView

use of com.mapbox.rctmgl.components.annotation.RCTMGLMarkerView 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)

Aggregations

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 RCTLayer (com.mapbox.rctmgl.components.styles.layers.RCTLayer)1 RCTMGLLight (com.mapbox.rctmgl.components.styles.light.RCTMGLLight)1 RCTSource (com.mapbox.rctmgl.components.styles.sources.RCTSource)1