Java Code Examples for com.mapbox.geojson.Feature#getStringProperty()

The following examples show how to use com.mapbox.geojson.Feature#getStringProperty() . 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: MapStyleController.java    From AirMapSDK-Android with Apache License 2.0 6 votes vote down vote up
public void highlight(@NonNull Feature feature, AirMapAdvisory advisory) {
    // remove old highlight
    unhighlight();

    // add new highlight
    String sourceId = feature.getStringProperty("ruleset_id");
    highlightLayerId = "airmap|highlight|line|" + sourceId;
    LineLayer highlightLayer = map.getMap().getStyle().getLayerAs(highlightLayerId);
    highlightLayer.setSourceLayer(sourceId + "_" + advisory.getType().toString());

    // feature's airspace_id can be an int or string (tile server bug), so match on either
    Expression filter;
    try {
        int airspaceId = Integer.parseInt(advisory.getId());
        filter = Expression.any(Expression.eq(Expression.get("id"), advisory.getId()), Expression.eq(Expression.get("id"), airspaceId));
    } catch (NumberFormatException e) {
        filter = Expression.any(Expression.eq(Expression.get("id"), advisory.getId()));
    }
    highlightLayer.setFilter(filter);
}
 
Example 2
Source File: MapStyleController.java    From AirMapSDK-Android with Apache License 2.0 6 votes vote down vote up
public void highlight(Feature feature) {
    String id = feature.getStringProperty("id");
    String type = feature.getStringProperty("category");

    // remove old highlight
    unhighlight();

    // add new highlight
    String sourceId = feature.getStringProperty("ruleset_id");
    highlightLayerId = "airmap|highlight|line|" + sourceId;
    LineLayer highlightLayer = map.getMap().getStyle().getLayerAs(highlightLayerId);
    highlightLayer.setSourceLayer(sourceId + "_" + type);

    // feature's airspace_id can be an int or string (tile server bug), so match on either
    Expression filter;
    try {
        int airspaceId = Integer.parseInt(id);
        filter = Expression.any(Expression.eq(Expression.get("id"), id), Expression.eq(Expression.get("id"), airspaceId));
    } catch (NumberFormatException e) {
        filter = Expression.any(Expression.eq(Expression.get("id"), id));
    }
    highlightLayer.setFilter(filter);
}
 
Example 3
Source File: MapWayname.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void updateWaynameLayerWithNameProperty(SymbolLayer waynameLayer, Feature roadFeature) {
  boolean hasValidNameProperty = roadFeature.hasNonNullValueForProperty(NAME_PROPERTY);
  if (hasValidNameProperty) {
    String currentWayname = roadFeature.getStringProperty(NAME_PROPERTY);
    boolean newWayname = !wayname.contentEquals(currentWayname);
    if (newWayname) {
      wayname = currentWayname;
      updateWaynameVisibility(true, waynameLayer);
      updateWaynameLayer(wayname, waynameLayer);
    }
  }
}
 
Example 4
Source File: AdvisorySelector.java    From AirMapSDK-Android with Apache License 2.0 5 votes vote down vote up
private boolean hasHigherPriority(Feature feature, Feature selectedFeature) {
    String type = selectedFeature.getStringProperty("category");
    switch (type) {
        case "emergency":
        case "school":
        case "fire":
        case "prison":
        case "wildfire":
        case "power_plant":
            return false;
        default:
            return true;
    }
}