use of com.mapbox.rctmgl.components.AbstractMapFeature 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.AbstractMapFeature in project maps by rnmapbox.
the class RCTMGLMapView method removeFeature.
public void removeFeature(int childPosition) {
AbstractMapFeature feature = features().get(childPosition);
if (feature == null) {
return;
}
if (feature instanceof RCTSource) {
RCTSource source = (RCTSource) feature;
mSources.remove(source.getID());
} else if (feature instanceof RCTMGLPointAnnotation) {
RCTMGLPointAnnotation annotation = (RCTMGLPointAnnotation) feature;
if (annotation.getMapboxID() == mActiveMarkerID) {
mActiveMarkerID = -1;
}
mPointAnnotations.remove(annotation.getID());
} else if (feature instanceof RCTMGLImages) {
RCTMGLImages images = (RCTMGLImages) feature;
mImages.remove(images);
}
feature.removeFromMap(this);
features().remove(feature);
}
use of com.mapbox.rctmgl.components.AbstractMapFeature in project maps by rnmapbox.
the class RCTMGLMapView method addQueuedFeatures.
public void addQueuedFeatures() {
if (mQueuedFeatures != null && mQueuedFeatures.size() > 0) {
for (int i = 0; i < mQueuedFeatures.size(); i++) {
AbstractMapFeature feature = mQueuedFeatures.get(i);
feature.addToMap(this);
mFeatures.add(feature);
}
mQueuedFeatures = null;
}
}
Aggregations