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);
}
}
}
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()]);
}
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);
}
}
}
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);
}
Aggregations