Updated autogen script and code to support Light

This commit is contained in:
Nick
2017-10-23 16:41:51 -07:00
parent 8783684195
commit 9bf099ffd0
9 changed files with 306 additions and 51 deletions
@@ -13,6 +13,8 @@ import com.mapbox.mapboxsdk.style.layers.PropertyValue;
import com.mapbox.mapboxsdk.style.layers.RasterLayer;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
import com.mapbox.mapboxsdk.style.light.Light;
import com.mapbox.mapboxsdk.style.light.Position;
import java.util.List;
@@ -581,6 +583,41 @@ public class RCTMGLStyleFactory {
}
}
}
public static void setLightLayerStyle(Light layer, RCTMGLStyle style) {
List<String> styleKeys = style.getAllStyleKeys();
if (styleKeys.size() == 0) {
return;
}
for (String styleKey : styleKeys) {
RCTMGLStyleValue styleValue = style.getStyleValueForKey(styleKey);
switch (styleKey) {
case "anchor":
RCTMGLStyleFactory.setAnchor(layer, styleValue);
break;
case "position":
RCTMGLStyleFactory.setPosition(layer, styleValue);
break;
case "positionTransition":
RCTMGLStyleFactory.setPositionTransition(layer, styleValue);
break;
case "color":
RCTMGLStyleFactory.setColor(layer, styleValue);
break;
case "colorTransition":
RCTMGLStyleFactory.setColorTransition(layer, styleValue);
break;
case "intensity":
RCTMGLStyleFactory.setIntensity(layer, styleValue);
break;
case "intensityTransition":
RCTMGLStyleFactory.setIntensityTransition(layer, styleValue);
break;
}
}
}
public static void setVisibility(FillLayer layer, RCTMGLStyleValue styleValue) {
layer.setProperties(PropertyFactory.visibility(styleValue.getString(VALUE_KEY)));
@@ -2930,4 +2967,45 @@ public class RCTMGLStyleFactory {
}
}
public static void setAnchor(Light layer, RCTMGLStyleValue styleValue) {
layer.setAnchor(styleValue.getString(VALUE_KEY));
}
public static void setPosition(Light layer, RCTMGLStyleValue styleValue) {
Float[] values = styleValue.getFloatArray(VALUE_KEY);
layer.setPosition(Position.fromPosition(values[0], values[1], values[2]));
}
public static void setPositionTransition(Light layer, RCTMGLStyleValue styleValue) {
TransitionOptions transition = styleValue.getTransition();
if (transition != null) {
layer.setPositionTransition(transition);
}
}
public static void setColor(Light layer, RCTMGLStyleValue styleValue) {
layer.setColor(styleValue.getInt(VALUE_KEY));
}
public static void setColorTransition(Light layer, RCTMGLStyleValue styleValue) {
TransitionOptions transition = styleValue.getTransition();
if (transition != null) {
layer.setColorTransition(transition);
}
}
public static void setIntensity(Light layer, RCTMGLStyleValue styleValue) {
layer.setIntensity(styleValue.getFloat(VALUE_KEY));
}
public static void setIntensityTransition(Light layer, RCTMGLStyleValue styleValue) {
TransitionOptions transition = styleValue.getTransition();
if (transition != null) {
layer.setIntensityTransition(transition);
}
}
}