Skip to content

Commit

Permalink
Merge branch 'beta' into feat/map-style
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/MLRNModule.ts
  • Loading branch information
KiwiKilian committed Dec 17, 2024
2 parents 22e88fe + b89a0dd commit 8deb1bf
Show file tree
Hide file tree
Showing 43 changed files with 475 additions and 1,291 deletions.
31 changes: 3 additions & 28 deletions __tests__/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,45 +32,20 @@ describe("Package Exports", () => {
"BackgroundLayer",
"RasterLayer",

// sources
// Sources
"VectorSource",
"ShapeSource",
"RasterSource",
"ImageSource",
"Images",

// constants
// Constants
"UserTrackingMode",
"UserLocationRenderMode",
"StyleURL",
// "EventTypes",
"CameraModes",
"StyleURL",
"StyleSource",
// "InterpolationMode",
"LineJoin",
// "LineCap",
// "LineTranslateAnchor",
// "CirclePitchScale",
// "CircleTranslateAnchor",
// 'CirclePitchAlignment',
// "FillExtrusionTranslateAnchor",
// "FillTranslateAnchor",
// "IconRotationAlignment",
// "IconTextFit",
// 'IconAnchor',
// "IconTranslateAnchor",
// 'IconPitchAlignment',
// "SymbolPlacement",
// "TextAnchor",
// "TextJustify",
// "TextPitchAlignment",
// "TextRotationAlignment",
// "TextTransform",
// "TextTranslateAnchor",
// "LightAnchor",

"OfflinePackDownloadState",
// "OfflineCallbackName",

// Methods

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ public List<String> getAllStyleKeys() {

while (it.hasNextKey()) {
String key = it.nextKey();

if (!key.equals("__MAPBOX_STYLESHEET__")) {
keys.add(key);
}
keys.add(key);
}

return keys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.maplibre.android.style.layers.FillLayer;
import org.maplibre.android.style.layers.LineLayer;
import org.maplibre.android.style.layers.PropertyFactory;
import org.maplibre.android.style.layers.PropertyValue;
import org.maplibre.android.style.layers.RasterLayer;
import org.maplibre.android.style.layers.SymbolLayer;
import org.maplibre.android.style.layers.HeatmapLayer;
Expand All @@ -28,7 +27,7 @@ public class MLRNStyleFactory {
public static void setFillLayerStyle(final FillLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -89,7 +88,7 @@ public void onAllImagesLoaded() {
public static void setLineLayerStyle(final LineLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -186,7 +185,7 @@ public void onAllImagesLoaded() {
public static void setSymbolLayerStyle(final SymbolLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -409,7 +408,7 @@ public void onAllImagesLoaded() {
public static void setCircleLayerStyle(final CircleLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -486,7 +485,7 @@ public static void setCircleLayerStyle(final CircleLayer layer, MLRNStyle style)
public static void setHeatmapLayerStyle(final HeatmapLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -527,7 +526,7 @@ public static void setHeatmapLayerStyle(final HeatmapLayer layer, MLRNStyle styl
public static void setFillExtrusionLayerStyle(final FillExtrusionLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -591,7 +590,7 @@ public void onAllImagesLoaded() {
public static void setRasterLayerStyle(final RasterLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -650,7 +649,7 @@ public static void setRasterLayerStyle(final RasterLayer layer, MLRNStyle style)
public static void setHillshadeLayerStyle(final HillshadeLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -697,7 +696,7 @@ public static void setHillshadeLayerStyle(final HillshadeLayer layer, MLRNStyle
public static void setBackgroundLayerStyle(final BackgroundLayer layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down Expand Up @@ -737,7 +736,7 @@ public void onAllImagesLoaded() {
public static void setLightLayerStyle(final Light layer, MLRNStyle style) {
List<String> styleKeys = style.getAllStyleKeys();

if (styleKeys.size() == 0) {
if (styleKeys.isEmpty()) {
return;
}

Expand Down
145 changes: 0 additions & 145 deletions android/src/main/java/org/maplibre/reactnative/modules/MLRNModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import com.facebook.react.module.annotations.ReactModule;
import org.maplibre.android.MapLibre;
import org.maplibre.android.WellKnownTileServer;
import org.maplibre.android.style.layers.Property;
import org.maplibre.reactnative.components.camera.constants.CameraMode;
import org.maplibre.reactnative.components.styles.MLRNStyleValue;
import org.maplibre.reactnative.components.styles.sources.MLRNSource;
import org.maplibre.reactnative.events.constants.EventTypes;
import org.maplibre.reactnative.http.CustomHeadersInterceptor;
Expand Down Expand Up @@ -101,127 +99,6 @@ public Map<String, Object> getConstants() {
Map<String, String> styleSourceConsts = new HashMap<>();
styleSourceConsts.put("DefaultSourceID", MLRNSource.DEFAULT_ID);

// interpolation modes
Map<String, Integer> interpolationModes = new HashMap<>();
interpolationModes.put("Exponential", MLRNStyleValue.InterpolationModeExponential);
interpolationModes.put("Categorical", MLRNStyleValue.InterpolationModeCategorical);
interpolationModes.put("Interval", MLRNStyleValue.InterpolationModeInterval);
interpolationModes.put("Identity", MLRNStyleValue.InterpolationModeIdentity);

// line layer constants
Map<String, String> lineJoin = new HashMap<>();
lineJoin.put("Bevel", Property.LINE_JOIN_BEVEL);
lineJoin.put("Round", Property.LINE_JOIN_ROUND);
lineJoin.put("Miter", Property.LINE_JOIN_MITER);

Map<String, String> lineCap = new HashMap<>();
lineCap.put("Butt", Property.LINE_CAP_BUTT);
lineCap.put("Round", Property.LINE_CAP_ROUND);
lineCap.put("Square", Property.LINE_CAP_SQUARE);

Map<String, String> lineTranslateAnchor = new HashMap<>();
lineTranslateAnchor.put("Map", Property.LINE_TRANSLATE_ANCHOR_MAP);
lineTranslateAnchor.put("Viewport", Property.LINE_TRANSLATE_ANCHOR_VIEWPORT);

// circle layer constants
Map<String, String> circlePitchScale = new HashMap<>();
circlePitchScale.put("Map", Property.CIRCLE_PITCH_SCALE_MAP);
circlePitchScale.put("Viewport", Property.CIRCLE_PITCH_SCALE_VIEWPORT);

Map<String, String> circleTranslateAnchor = new HashMap<>();
circleTranslateAnchor.put("Map", Property.CIRCLE_TRANSLATE_ANCHOR_MAP);
circleTranslateAnchor.put("Viewport", Property.CIRCLE_TRANSLATE_ANCHOR_VIEWPORT);

Map<String, String> circlePitchAlignment = new HashMap<>();
circlePitchAlignment.put("Map", Property.CIRCLE_PITCH_ALIGNMENT_MAP);
circlePitchAlignment.put("Viewport", Property.CIRCLE_PITCH_ALIGNMENT_VIEWPORT);

// fill extrusion layer constants
Map<String, String> fillExtrusionTranslateAnchor = new HashMap<>();
fillExtrusionTranslateAnchor.put("Map", Property.FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP);
fillExtrusionTranslateAnchor.put("Viewport", Property.FILL_EXTRUSION_TRANSLATE_ANCHOR_VIEWPORT);

// fill layer constants
Map<String, String> fillTranslateAnchor = new HashMap<>();
fillTranslateAnchor.put("Map", Property.FILL_TRANSLATE_ANCHOR_MAP);
fillTranslateAnchor.put("Viewport", Property.FILL_TRANSLATE_ANCHOR_VIEWPORT);

// symbol layer constants
Map<String, String> iconRotationAlignment = new HashMap<>();
iconRotationAlignment.put("Auto", Property.ICON_ROTATION_ALIGNMENT_AUTO);
iconRotationAlignment.put("Map", Property.ICON_ROTATION_ALIGNMENT_MAP);
iconRotationAlignment.put("Viewport", Property.ICON_ROTATION_ALIGNMENT_VIEWPORT);

Map<String, String> iconTextFit = new HashMap<>();
iconTextFit.put("None", Property.ICON_TEXT_FIT_NONE);
iconTextFit.put("Width", Property.ICON_TEXT_FIT_WIDTH);
iconTextFit.put("Height", Property.ICON_TEXT_FIT_HEIGHT);
iconTextFit.put("Both", Property.ICON_TEXT_FIT_BOTH);

Map<String, String> iconAnchor = new HashMap<>();
iconAnchor.put("Center", Property.ICON_ANCHOR_CENTER);
iconAnchor.put("Left", Property.ICON_ANCHOR_LEFT);
iconAnchor.put("Right", Property.ICON_ANCHOR_RIGHT);
iconAnchor.put("Top", Property.ICON_ANCHOR_TOP);
iconAnchor.put("Bottom", Property.ICON_ANCHOR_BOTTOM);
iconAnchor.put("TopLeft", Property.ICON_ANCHOR_TOP_LEFT);
iconAnchor.put("TopRight", Property.ICON_ANCHOR_TOP_RIGHT);
iconAnchor.put("BottomLeft", Property.ICON_ANCHOR_BOTTOM_LEFT);
iconAnchor.put("BottomRight", Property.ICON_ANCHOR_BOTTOM_RIGHT);

Map<String, String> iconPitchAlignment = new HashMap<>();
iconPitchAlignment.put("Auto", Property.ICON_PITCH_ALIGNMENT_AUTO);
iconPitchAlignment.put("Map", Property.ICON_PITCH_ALIGNMENT_MAP);
iconPitchAlignment.put("Viewport", Property.ICON_PITCH_ALIGNMENT_VIEWPORT);

Map<String, String> iconTranslateAnchor = new HashMap<>();
iconTranslateAnchor.put("Map", Property.ICON_TRANSLATE_ANCHOR_MAP);
iconTranslateAnchor.put("Viewport", Property.ICON_TRANSLATE_ANCHOR_VIEWPORT);

Map<String, String> symbolPlacement = new HashMap<>();
symbolPlacement.put("Line", Property.SYMBOL_PLACEMENT_LINE);
symbolPlacement.put("Point", Property.SYMBOL_PLACEMENT_POINT);

Map<String, String> textAnchor = new HashMap<>();
textAnchor.put("Center", Property.TEXT_ANCHOR_CENTER);
textAnchor.put("Left", Property.TEXT_ANCHOR_LEFT);
textAnchor.put("Right", Property.TEXT_ANCHOR_RIGHT);
textAnchor.put("Top", Property.TEXT_ANCHOR_TOP);
textAnchor.put("Bottom", Property.TEXT_ANCHOR_BOTTOM);
textAnchor.put("TopLeft", Property.TEXT_ANCHOR_TOP_LEFT);
textAnchor.put("TopRight", Property.TEXT_ANCHOR_TOP_RIGHT);
textAnchor.put("BottomLeft", Property.TEXT_ANCHOR_BOTTOM_LEFT);
textAnchor.put("BottomRight", Property.TEXT_ANCHOR_BOTTOM_RIGHT);

Map<String, String> textJustify = new HashMap<>();
textJustify.put("Center", Property.TEXT_JUSTIFY_CENTER);
textJustify.put("Left", Property.TEXT_JUSTIFY_LEFT);
textJustify.put("Right", Property.TEXT_JUSTIFY_RIGHT);

Map<String, String> textPitchAlignment = new HashMap<>();
textPitchAlignment.put("Auto", Property.TEXT_PITCH_ALIGNMENT_AUTO);
textPitchAlignment.put("Map", Property.TEXT_PITCH_ALIGNMENT_MAP);
textPitchAlignment.put("Viewport", Property.TEXT_PITCH_ALIGNMENT_VIEWPORT);

Map<String, String> textRotationAlignment = new HashMap<>();
textRotationAlignment.put("Auto", Property.TEXT_ROTATION_ALIGNMENT_AUTO);
textRotationAlignment.put("Map", Property.TEXT_ROTATION_ALIGNMENT_MAP);
textRotationAlignment.put("Viewport", Property.TEXT_ROTATION_ALIGNMENT_VIEWPORT);

Map<String, String> textTransform = new HashMap<>();
textTransform.put("None", Property.TEXT_TRANSFORM_NONE);
textTransform.put("Lowercase", Property.TEXT_TRANSFORM_LOWERCASE);
textTransform.put("Uppercase", Property.TEXT_TRANSFORM_UPPERCASE);

Map<String, String> textTranslateAnchor = new HashMap<>();
textTranslateAnchor.put("Map", Property.TEXT_TRANSLATE_ANCHOR_MAP);
textTranslateAnchor.put("Viewport", Property.TEXT_TRANSLATE_ANCHOR_VIEWPORT);

// light constants
Map<String, String> lightAnchor = new HashMap<>();
lightAnchor.put("Map", Property.ANCHOR_MAP);
lightAnchor.put("Viewport", Property.ANCHOR_VIEWPORT);

// offline region download states
Map<String, Integer> offlinePackDownloadStates = new HashMap<>();
offlinePackDownloadStates.put("Inactive", MLRNOfflineModule.INACTIVE_REGION_DOWNLOAD_STATE);
Expand All @@ -244,28 +121,6 @@ public Map<String, Object> getConstants() {
.put("UserLocationVerticalAlignment", userLocationVerticalAlignment)
.put("CameraModes", cameraModes)
.put("StyleSource", styleSourceConsts)
.put("InterpolationMode", interpolationModes)
.put("LineJoin", lineJoin)
.put("LineCap", lineCap)
.put("LineTranslateAnchor", lineTranslateAnchor)
.put("CirclePitchScale", circlePitchScale)
.put("CircleTranslateAnchor", circleTranslateAnchor)
.put("CirclePitchAlignment", circlePitchAlignment)
.put("FillExtrusionTranslateAnchor", fillExtrusionTranslateAnchor)
.put("FillTranslateAnchor", fillTranslateAnchor)
.put("IconRotationAlignment", iconRotationAlignment)
.put("IconTextFit", iconTextFit)
.put("IconTranslateAnchor", iconTranslateAnchor)
.put("SymbolPlacement", symbolPlacement)
.put("IconAnchor", iconAnchor)
.put("TextAnchor", textAnchor)
.put("TextJustify", textJustify)
.put("IconPitchAlignment", iconPitchAlignment)
.put("TextPitchAlignment", textPitchAlignment)
.put("TextRotationAlignment", textRotationAlignment)
.put("TextTransform", textTransform)
.put("TextTranslateAnchor", textTranslateAnchor)
.put("LightAnchor", lightAnchor)
.put("OfflinePackDownloadState", offlinePackDownloadStates)
.put("OfflineCallbackName", offlineModuleCallbackNames)
.put("LocationCallbackName", locationModuleCallbackNames)
Expand Down
2 changes: 1 addition & 1 deletion docs/components/BackgroundLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `BackgroundLayerStyleProps` | `none` | `false` | Customizable style attributes |
| style | `BackgroundLayerStyle` | `none` | `false` | Customizable style attributes |
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreRN.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |


Expand Down
2 changes: 1 addition & 1 deletion docs/components/CircleLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CircleLayer is a style layer that renders one or more filled circles on the map.
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `CircleLayerStyleProps` | `none` | `false` | Customizable style attributes |
| style | `CircleLayerStyle` | `none` | `false` | Customizable style attributes |
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreRN.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |


Expand Down
2 changes: 1 addition & 1 deletion docs/components/FillExtrusionLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FillExtrusionLayer is a style layer that renders one or more 3D extruded polygon
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `FillExtrusionLayerStyleProps` | `none` | `false` | Customizable style attributes |
| style | `FillExtrusionLayerStyle` | `none` | `false` | Customizable style attributes |
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreRN.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |


Expand Down
2 changes: 1 addition & 1 deletion docs/components/FillLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FillLayer is a style layer that renders one or more filled (and optionally strok
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `FillLayerStyleProps` | `none` | `false` | Customizable style attributes |
| style | `FillLayerStyle` | `none` | `false` | Customizable style attributes |
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreRN.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |


Expand Down
2 changes: 1 addition & 1 deletion docs/components/HeatmapLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HeatmapLayer is a style layer that renders one or more filled circles on the map
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `HeatmapLayerStyleProps` | `none` | `false` | Customizable style attributes |
| style | `HeatmapLayerStyle` | `none` | `false` | Customizable style attributes |
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreRN.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |


Expand Down
2 changes: 1 addition & 1 deletion docs/components/Light.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Light represents the light source for extruded geometries
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `LightLayerStyleProps` | `none` | `false` | Customizable style attributes |
| style | `LightLayerStyle` | `none` | `false` | Customizable style attributes |


## Styles
Expand Down
2 changes: 1 addition & 1 deletion docs/components/LineLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LineLayer is a style layer that renders one or more stroked polylines on the map
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `LineLayerStyleProps` | `none` | `false` | Customizable style attributes |
| style | `LineLayerStyle` | `none` | `false` | Customizable style attributes |
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreRN.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |


Expand Down
2 changes: 1 addition & 1 deletion docs/components/RasterLayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Props
| Prop | Type | Default | Required | Description |
| ---- | :--: | :-----: | :------: | :----------: |
| style | `RasterLayerStyleProps` | `none` | `false` | Customizable style attributes |
| style | `RasterLayerStyle` | `none` | `false` | Customizable style attributes |
| sourceID | `FIX ME UNKNOWN TYPE` | `MapLibreRN.StyleSource.DefaultSourceID` | `false` | FIX ME NO DESCRIPTION |


Expand Down
Loading

0 comments on commit 8deb1bf

Please sign in to comment.