|
16 | 16 | import com.mapbox.maps.extension.style.layers.generated.SymbolLayer; |
17 | 17 | import com.mapbox.maps.extension.style.layers.generated.HeatmapLayer; |
18 | 18 | import com.mapbox.maps.extension.style.layers.generated.HillshadeLayer; |
| 19 | +import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere; |
19 | 20 | // import com.mapbox.maps.extension.style.layers.properties.generated.Visibility; |
20 | 21 | import com.mapbox.maps.extension.style.layers.properties.generated.*; |
21 | 22 | import com.mapbox.maps.extension.style.types.StyleTransition; |
@@ -184,6 +185,9 @@ public void onAllImagesLoaded() { |
184 | 185 | case "lineGradient": |
185 | 186 | RCTMGLStyleFactory.setLineGradient(layer, styleValue); |
186 | 187 | break; |
| 188 | + case "lineTrimOffset": |
| 189 | + RCTMGLStyleFactory.setLineTrimOffset(layer, styleValue); |
| 190 | + break; |
187 | 191 | } |
188 | 192 | } |
189 | 193 | } |
@@ -820,6 +824,56 @@ public static void setLightLayerStyle(final Light layer, RCTMGLStyle style) { |
820 | 824 | } |
821 | 825 | } |
822 | 826 | } |
| 827 | + public static void setAtmosphereLayerStyle(final Atmosphere layer, RCTMGLStyle style) { |
| 828 | + List<String> styleKeys = style.getAllStyleKeys(); |
| 829 | + |
| 830 | + if (styleKeys.size() == 0) { |
| 831 | + return; |
| 832 | + } |
| 833 | + |
| 834 | + for (String styleKey : styleKeys) { |
| 835 | + final RCTMGLStyleValue styleValue = style.getStyleValueForKey(styleKey); |
| 836 | + |
| 837 | + switch (styleKey) { |
| 838 | + case "range": |
| 839 | + RCTMGLStyleFactory.setRange(layer, styleValue); |
| 840 | + break; |
| 841 | + case "rangeTransition": |
| 842 | + RCTMGLStyleFactory.setRangeTransition(layer, styleValue); |
| 843 | + break; |
| 844 | + case "color": |
| 845 | + RCTMGLStyleFactory.setColor(layer, styleValue); |
| 846 | + break; |
| 847 | + case "colorTransition": |
| 848 | + RCTMGLStyleFactory.setColorTransition(layer, styleValue); |
| 849 | + break; |
| 850 | + case "highColor": |
| 851 | + RCTMGLStyleFactory.setHighColor(layer, styleValue); |
| 852 | + break; |
| 853 | + case "highColorTransition": |
| 854 | + RCTMGLStyleFactory.setHighColorTransition(layer, styleValue); |
| 855 | + break; |
| 856 | + case "spaceColor": |
| 857 | + RCTMGLStyleFactory.setSpaceColor(layer, styleValue); |
| 858 | + break; |
| 859 | + case "spaceColorTransition": |
| 860 | + RCTMGLStyleFactory.setSpaceColorTransition(layer, styleValue); |
| 861 | + break; |
| 862 | + case "horizonBlend": |
| 863 | + RCTMGLStyleFactory.setHorizonBlend(layer, styleValue); |
| 864 | + break; |
| 865 | + case "horizonBlendTransition": |
| 866 | + RCTMGLStyleFactory.setHorizonBlendTransition(layer, styleValue); |
| 867 | + break; |
| 868 | + case "starIntensity": |
| 869 | + RCTMGLStyleFactory.setStarIntensity(layer, styleValue); |
| 870 | + break; |
| 871 | + case "starIntensityTransition": |
| 872 | + RCTMGLStyleFactory.setStarIntensityTransition(layer, styleValue); |
| 873 | + break; |
| 874 | + } |
| 875 | + } |
| 876 | + } |
823 | 877 |
|
824 | 878 | public static void setFillSortKey(FillLayer layer, RCTMGLStyleValue styleValue) { |
825 | 879 | if (styleValue.isExpression()) { |
@@ -1141,6 +1195,14 @@ public static void setLineGradient(LineLayer layer, RCTMGLStyleValue styleValue) |
1141 | 1195 | } |
1142 | 1196 | } |
1143 | 1197 |
|
| 1198 | + public static void setLineTrimOffset(LineLayer layer, RCTMGLStyleValue styleValue) { |
| 1199 | + if (styleValue.isExpression()) { |
| 1200 | + layer.lineTrimOffset(styleValue.getExpression()); |
| 1201 | + } else { |
| 1202 | + layer.lineTrimOffset(styleValue.getFloatArray(VALUE_KEY)); |
| 1203 | + } |
| 1204 | + } |
| 1205 | + |
1144 | 1206 | public static void setSymbolPlacement(SymbolLayer layer, RCTMGLStyleValue styleValue) { |
1145 | 1207 | if (styleValue.isExpression()) { |
1146 | 1208 | layer.symbolPlacement(styleValue.getExpression()); |
@@ -2433,4 +2495,100 @@ public static void setIntensityTransition(Light layer, RCTMGLStyleValue styleVal |
2433 | 2495 | } |
2434 | 2496 | } |
2435 | 2497 |
|
| 2498 | + public static void setRange(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2499 | + if (styleValue.isExpression()) { |
| 2500 | + layer.range(styleValue.getExpression()); |
| 2501 | + } else { |
| 2502 | + layer.range(styleValue.getFloatArray(VALUE_KEY)); |
| 2503 | + } |
| 2504 | + } |
| 2505 | + |
| 2506 | + |
| 2507 | + public static void setRangeTransition(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2508 | + StyleTransition transition = styleValue.getTransition(); |
| 2509 | + if (transition != null) { |
| 2510 | + layer.rangeTransition(transition); |
| 2511 | + } |
| 2512 | + } |
| 2513 | + |
| 2514 | + public static void setColor(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2515 | + if (styleValue.isExpression()) { |
| 2516 | + layer.color(styleValue.getExpression()); |
| 2517 | + } else { |
| 2518 | + layer.color(styleValue.getInt(VALUE_KEY)); |
| 2519 | + } |
| 2520 | + } |
| 2521 | + |
| 2522 | + |
| 2523 | + public static void setColorTransition(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2524 | + StyleTransition transition = styleValue.getTransition(); |
| 2525 | + if (transition != null) { |
| 2526 | + layer.colorTransition(transition); |
| 2527 | + } |
| 2528 | + } |
| 2529 | + |
| 2530 | + public static void setHighColor(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2531 | + if (styleValue.isExpression()) { |
| 2532 | + layer.highColor(styleValue.getExpression()); |
| 2533 | + } else { |
| 2534 | + layer.highColor(styleValue.getInt(VALUE_KEY)); |
| 2535 | + } |
| 2536 | + } |
| 2537 | + |
| 2538 | + |
| 2539 | + public static void setHighColorTransition(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2540 | + StyleTransition transition = styleValue.getTransition(); |
| 2541 | + if (transition != null) { |
| 2542 | + layer.highColorTransition(transition); |
| 2543 | + } |
| 2544 | + } |
| 2545 | + |
| 2546 | + public static void setSpaceColor(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2547 | + if (styleValue.isExpression()) { |
| 2548 | + layer.spaceColor(styleValue.getExpression()); |
| 2549 | + } else { |
| 2550 | + layer.spaceColor(styleValue.getInt(VALUE_KEY)); |
| 2551 | + } |
| 2552 | + } |
| 2553 | + |
| 2554 | + |
| 2555 | + public static void setSpaceColorTransition(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2556 | + StyleTransition transition = styleValue.getTransition(); |
| 2557 | + if (transition != null) { |
| 2558 | + layer.spaceColorTransition(transition); |
| 2559 | + } |
| 2560 | + } |
| 2561 | + |
| 2562 | + public static void setHorizonBlend(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2563 | + if (styleValue.isExpression()) { |
| 2564 | + layer.horizonBlend(styleValue.getExpression()); |
| 2565 | + } else { |
| 2566 | + layer.horizonBlend(styleValue.getFloat(VALUE_KEY)); |
| 2567 | + } |
| 2568 | + } |
| 2569 | + |
| 2570 | + |
| 2571 | + public static void setHorizonBlendTransition(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2572 | + StyleTransition transition = styleValue.getTransition(); |
| 2573 | + if (transition != null) { |
| 2574 | + layer.horizonBlendTransition(transition); |
| 2575 | + } |
| 2576 | + } |
| 2577 | + |
| 2578 | + public static void setStarIntensity(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2579 | + if (styleValue.isExpression()) { |
| 2580 | + layer.starIntensity(styleValue.getExpression()); |
| 2581 | + } else { |
| 2582 | + layer.starIntensity(styleValue.getFloat(VALUE_KEY)); |
| 2583 | + } |
| 2584 | + } |
| 2585 | + |
| 2586 | + |
| 2587 | + public static void setStarIntensityTransition(Atmosphere layer, RCTMGLStyleValue styleValue) { |
| 2588 | + StyleTransition transition = styleValue.getTransition(); |
| 2589 | + if (transition != null) { |
| 2590 | + layer.starIntensityTransition(transition); |
| 2591 | + } |
| 2592 | + } |
| 2593 | + |
2436 | 2594 | } |
0 commit comments