|
12 | 12 | import com.mapbox.mapboxsdk.style.layers.PropertyValue;
|
13 | 13 | import com.mapbox.mapboxsdk.style.layers.RasterLayer;
|
14 | 14 | import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
|
| 15 | +import com.mapbox.mapboxsdk.style.layers.HeatmapLayer; |
| 16 | +import com.mapbox.mapboxsdk.style.layers.HillshadeLayer; |
15 | 17 | import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
|
16 | 18 | import com.mapbox.mapboxsdk.style.light.Light;
|
17 | 19 | import com.mapbox.mapboxsdk.style.light.Position;
|
@@ -454,6 +456,47 @@ public static void setCircleLayerStyle(final CircleLayer layer, RCTMGLStyle styl
|
454 | 456 | }
|
455 | 457 | }
|
456 | 458 | }
|
| 459 | + public static void setHeatmapLayerStyle(final HeatmapLayer layer, RCTMGLStyle style) { |
| 460 | + List<String> styleKeys = style.getAllStyleKeys(); |
| 461 | + |
| 462 | + if (styleKeys.size() == 0) { |
| 463 | + return; |
| 464 | + } |
| 465 | + |
| 466 | + for (String styleKey : styleKeys) { |
| 467 | + final RCTMGLStyleValue styleValue = style.getStyleValueForKey(styleKey); |
| 468 | + |
| 469 | + switch (styleKey) { |
| 470 | + case "visibility": |
| 471 | + RCTMGLStyleFactory.setVisibility(layer, styleValue); |
| 472 | + break; |
| 473 | + case "heatmapRadius": |
| 474 | + RCTMGLStyleFactory.setHeatmapRadius(layer, styleValue); |
| 475 | + break; |
| 476 | + case "heatmapRadiusTransition": |
| 477 | + RCTMGLStyleFactory.setHeatmapRadiusTransition(layer, styleValue); |
| 478 | + break; |
| 479 | + case "heatmapWeight": |
| 480 | + RCTMGLStyleFactory.setHeatmapWeight(layer, styleValue); |
| 481 | + break; |
| 482 | + case "heatmapIntensity": |
| 483 | + RCTMGLStyleFactory.setHeatmapIntensity(layer, styleValue); |
| 484 | + break; |
| 485 | + case "heatmapIntensityTransition": |
| 486 | + RCTMGLStyleFactory.setHeatmapIntensityTransition(layer, styleValue); |
| 487 | + break; |
| 488 | + case "heatmapColor": |
| 489 | + RCTMGLStyleFactory.setHeatmapColor(layer, styleValue); |
| 490 | + break; |
| 491 | + case "heatmapOpacity": |
| 492 | + RCTMGLStyleFactory.setHeatmapOpacity(layer, styleValue); |
| 493 | + break; |
| 494 | + case "heatmapOpacityTransition": |
| 495 | + RCTMGLStyleFactory.setHeatmapOpacityTransition(layer, styleValue); |
| 496 | + break; |
| 497 | + } |
| 498 | + } |
| 499 | + } |
457 | 500 | public static void setFillExtrusionLayerStyle(final FillExtrusionLayer layer, RCTMGLStyle style) {
|
458 | 501 | List<String> styleKeys = style.getAllStyleKeys();
|
459 | 502 |
|
@@ -571,6 +614,53 @@ public static void setRasterLayerStyle(final RasterLayer layer, RCTMGLStyle styl
|
571 | 614 | }
|
572 | 615 | }
|
573 | 616 | }
|
| 617 | + public static void setHillshadeLayerStyle(final HillshadeLayer layer, RCTMGLStyle style) { |
| 618 | + List<String> styleKeys = style.getAllStyleKeys(); |
| 619 | + |
| 620 | + if (styleKeys.size() == 0) { |
| 621 | + return; |
| 622 | + } |
| 623 | + |
| 624 | + for (String styleKey : styleKeys) { |
| 625 | + final RCTMGLStyleValue styleValue = style.getStyleValueForKey(styleKey); |
| 626 | + |
| 627 | + switch (styleKey) { |
| 628 | + case "visibility": |
| 629 | + RCTMGLStyleFactory.setVisibility(layer, styleValue); |
| 630 | + break; |
| 631 | + case "hillshadeIlluminationDirection": |
| 632 | + RCTMGLStyleFactory.setHillshadeIlluminationDirection(layer, styleValue); |
| 633 | + break; |
| 634 | + case "hillshadeIlluminationAnchor": |
| 635 | + RCTMGLStyleFactory.setHillshadeIlluminationAnchor(layer, styleValue); |
| 636 | + break; |
| 637 | + case "hillshadeExaggeration": |
| 638 | + RCTMGLStyleFactory.setHillshadeExaggeration(layer, styleValue); |
| 639 | + break; |
| 640 | + case "hillshadeExaggerationTransition": |
| 641 | + RCTMGLStyleFactory.setHillshadeExaggerationTransition(layer, styleValue); |
| 642 | + break; |
| 643 | + case "hillshadeShadowColor": |
| 644 | + RCTMGLStyleFactory.setHillshadeShadowColor(layer, styleValue); |
| 645 | + break; |
| 646 | + case "hillshadeShadowColorTransition": |
| 647 | + RCTMGLStyleFactory.setHillshadeShadowColorTransition(layer, styleValue); |
| 648 | + break; |
| 649 | + case "hillshadeHighlightColor": |
| 650 | + RCTMGLStyleFactory.setHillshadeHighlightColor(layer, styleValue); |
| 651 | + break; |
| 652 | + case "hillshadeHighlightColorTransition": |
| 653 | + RCTMGLStyleFactory.setHillshadeHighlightColorTransition(layer, styleValue); |
| 654 | + break; |
| 655 | + case "hillshadeAccentColor": |
| 656 | + RCTMGLStyleFactory.setHillshadeAccentColor(layer, styleValue); |
| 657 | + break; |
| 658 | + case "hillshadeAccentColorTransition": |
| 659 | + RCTMGLStyleFactory.setHillshadeAccentColorTransition(layer, styleValue); |
| 660 | + break; |
| 661 | + } |
| 662 | + } |
| 663 | + } |
574 | 664 | public static void setBackgroundLayerStyle(final BackgroundLayer layer, RCTMGLStyle style) {
|
575 | 665 | List<String> styleKeys = style.getAllStyleKeys();
|
576 | 666 |
|
@@ -1591,6 +1681,74 @@ public static void setCircleStrokeOpacityTransition(CircleLayer layer, RCTMGLSty
|
1591 | 1681 | }
|
1592 | 1682 | }
|
1593 | 1683 |
|
| 1684 | + public static void setVisibility(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1685 | + layer.setProperties(PropertyFactory.visibility(styleValue.getString(VALUE_KEY))); |
| 1686 | + } |
| 1687 | + |
| 1688 | + public static void setHeatmapRadius(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1689 | + if (styleValue.isExpression()) { |
| 1690 | + layer.setProperties(PropertyFactory.heatmapRadius(styleValue.getExpression())); |
| 1691 | + } else { |
| 1692 | + layer.setProperties(PropertyFactory.heatmapRadius(styleValue.getFloat(VALUE_KEY))); |
| 1693 | + } |
| 1694 | + } |
| 1695 | + |
| 1696 | + |
| 1697 | + public static void setHeatmapRadiusTransition(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1698 | + TransitionOptions transition = styleValue.getTransition(); |
| 1699 | + if (transition != null) { |
| 1700 | + layer.setHeatmapRadiusTransition(transition); |
| 1701 | + } |
| 1702 | + } |
| 1703 | + |
| 1704 | + public static void setHeatmapWeight(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1705 | + if (styleValue.isExpression()) { |
| 1706 | + layer.setProperties(PropertyFactory.heatmapWeight(styleValue.getExpression())); |
| 1707 | + } else { |
| 1708 | + layer.setProperties(PropertyFactory.heatmapWeight(styleValue.getFloat(VALUE_KEY))); |
| 1709 | + } |
| 1710 | + } |
| 1711 | + |
| 1712 | + public static void setHeatmapIntensity(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1713 | + if (styleValue.isExpression()) { |
| 1714 | + layer.setProperties(PropertyFactory.heatmapIntensity(styleValue.getExpression())); |
| 1715 | + } else { |
| 1716 | + layer.setProperties(PropertyFactory.heatmapIntensity(styleValue.getFloat(VALUE_KEY))); |
| 1717 | + } |
| 1718 | + } |
| 1719 | + |
| 1720 | + |
| 1721 | + public static void setHeatmapIntensityTransition(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1722 | + TransitionOptions transition = styleValue.getTransition(); |
| 1723 | + if (transition != null) { |
| 1724 | + layer.setHeatmapIntensityTransition(transition); |
| 1725 | + } |
| 1726 | + } |
| 1727 | + |
| 1728 | + public static void setHeatmapColor(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1729 | + if (styleValue.isExpression()) { |
| 1730 | + layer.setProperties(PropertyFactory.heatmapColor(styleValue.getExpression())); |
| 1731 | + } else { |
| 1732 | + layer.setProperties(PropertyFactory.heatmapColor(styleValue.getInt(VALUE_KEY))); |
| 1733 | + } |
| 1734 | + } |
| 1735 | + |
| 1736 | + public static void setHeatmapOpacity(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1737 | + if (styleValue.isExpression()) { |
| 1738 | + layer.setProperties(PropertyFactory.heatmapOpacity(styleValue.getExpression())); |
| 1739 | + } else { |
| 1740 | + layer.setProperties(PropertyFactory.heatmapOpacity(styleValue.getFloat(VALUE_KEY))); |
| 1741 | + } |
| 1742 | + } |
| 1743 | + |
| 1744 | + |
| 1745 | + public static void setHeatmapOpacityTransition(HeatmapLayer layer, RCTMGLStyleValue styleValue) { |
| 1746 | + TransitionOptions transition = styleValue.getTransition(); |
| 1747 | + if (transition != null) { |
| 1748 | + layer.setHeatmapOpacityTransition(transition); |
| 1749 | + } |
| 1750 | + } |
| 1751 | + |
1594 | 1752 | public static void setVisibility(FillExtrusionLayer layer, RCTMGLStyleValue styleValue) {
|
1595 | 1753 | layer.setProperties(PropertyFactory.visibility(styleValue.getString(VALUE_KEY)));
|
1596 | 1754 | }
|
@@ -1807,6 +1965,90 @@ public static void setRasterFadeDuration(RasterLayer layer, RCTMGLStyleValue sty
|
1807 | 1965 | }
|
1808 | 1966 | }
|
1809 | 1967 |
|
| 1968 | + public static void setVisibility(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 1969 | + layer.setProperties(PropertyFactory.visibility(styleValue.getString(VALUE_KEY))); |
| 1970 | + } |
| 1971 | + |
| 1972 | + public static void setHillshadeIlluminationDirection(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 1973 | + if (styleValue.isExpression()) { |
| 1974 | + layer.setProperties(PropertyFactory.hillshadeIlluminationDirection(styleValue.getExpression())); |
| 1975 | + } else { |
| 1976 | + layer.setProperties(PropertyFactory.hillshadeIlluminationDirection(styleValue.getFloat(VALUE_KEY))); |
| 1977 | + } |
| 1978 | + } |
| 1979 | + |
| 1980 | + public static void setHillshadeIlluminationAnchor(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 1981 | + if (styleValue.isExpression()) { |
| 1982 | + layer.setProperties(PropertyFactory.hillshadeIlluminationAnchor(styleValue.getExpression())); |
| 1983 | + } else { |
| 1984 | + layer.setProperties(PropertyFactory.hillshadeIlluminationAnchor(styleValue.getString(VALUE_KEY))); |
| 1985 | + } |
| 1986 | + } |
| 1987 | + |
| 1988 | + public static void setHillshadeExaggeration(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 1989 | + if (styleValue.isExpression()) { |
| 1990 | + layer.setProperties(PropertyFactory.hillshadeExaggeration(styleValue.getExpression())); |
| 1991 | + } else { |
| 1992 | + layer.setProperties(PropertyFactory.hillshadeExaggeration(styleValue.getFloat(VALUE_KEY))); |
| 1993 | + } |
| 1994 | + } |
| 1995 | + |
| 1996 | + |
| 1997 | + public static void setHillshadeExaggerationTransition(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 1998 | + TransitionOptions transition = styleValue.getTransition(); |
| 1999 | + if (transition != null) { |
| 2000 | + layer.setHillshadeExaggerationTransition(transition); |
| 2001 | + } |
| 2002 | + } |
| 2003 | + |
| 2004 | + public static void setHillshadeShadowColor(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 2005 | + if (styleValue.isExpression()) { |
| 2006 | + layer.setProperties(PropertyFactory.hillshadeShadowColor(styleValue.getExpression())); |
| 2007 | + } else { |
| 2008 | + layer.setProperties(PropertyFactory.hillshadeShadowColor(styleValue.getInt(VALUE_KEY))); |
| 2009 | + } |
| 2010 | + } |
| 2011 | + |
| 2012 | + |
| 2013 | + public static void setHillshadeShadowColorTransition(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 2014 | + TransitionOptions transition = styleValue.getTransition(); |
| 2015 | + if (transition != null) { |
| 2016 | + layer.setHillshadeShadowColorTransition(transition); |
| 2017 | + } |
| 2018 | + } |
| 2019 | + |
| 2020 | + public static void setHillshadeHighlightColor(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 2021 | + if (styleValue.isExpression()) { |
| 2022 | + layer.setProperties(PropertyFactory.hillshadeHighlightColor(styleValue.getExpression())); |
| 2023 | + } else { |
| 2024 | + layer.setProperties(PropertyFactory.hillshadeHighlightColor(styleValue.getInt(VALUE_KEY))); |
| 2025 | + } |
| 2026 | + } |
| 2027 | + |
| 2028 | + |
| 2029 | + public static void setHillshadeHighlightColorTransition(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 2030 | + TransitionOptions transition = styleValue.getTransition(); |
| 2031 | + if (transition != null) { |
| 2032 | + layer.setHillshadeHighlightColorTransition(transition); |
| 2033 | + } |
| 2034 | + } |
| 2035 | + |
| 2036 | + public static void setHillshadeAccentColor(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 2037 | + if (styleValue.isExpression()) { |
| 2038 | + layer.setProperties(PropertyFactory.hillshadeAccentColor(styleValue.getExpression())); |
| 2039 | + } else { |
| 2040 | + layer.setProperties(PropertyFactory.hillshadeAccentColor(styleValue.getInt(VALUE_KEY))); |
| 2041 | + } |
| 2042 | + } |
| 2043 | + |
| 2044 | + |
| 2045 | + public static void setHillshadeAccentColorTransition(HillshadeLayer layer, RCTMGLStyleValue styleValue) { |
| 2046 | + TransitionOptions transition = styleValue.getTransition(); |
| 2047 | + if (transition != null) { |
| 2048 | + layer.setHillshadeAccentColorTransition(transition); |
| 2049 | + } |
| 2050 | + } |
| 2051 | + |
1810 | 2052 | public static void setVisibility(BackgroundLayer layer, RCTMGLStyleValue styleValue) {
|
1811 | 2053 | layer.setProperties(PropertyFactory.visibility(styleValue.getString(VALUE_KEY)));
|
1812 | 2054 | }
|
|
0 commit comments