Skip to content

Commit

Permalink
Move getRenderingClassNameForAttr to RenderingPropertyAttr
Browse files Browse the repository at this point in the history
  • Loading branch information
Chumva committed Feb 7, 2025
1 parent 4195b17 commit 3283ef6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.osmand.osm;

public class RenderingPropertyAttr {

public static final String HIKING_ROUTES = "hikingRoutesOSMC";
public static final String CYCLE_ROUTES = "showCycleRoutes";
public static final String MTB_ROUTES = "showMtbRoutes";
Expand All @@ -12,4 +13,35 @@ public class RenderingPropertyAttr {
public static final String FITNESS_TRAILS = "showFitnessTrails";
public static final String DIRTBIKE_ROUTES = "showDirtbikeTrails";
public static final String CLIMBING_ROUTES = "showClimbingRoutes";
public static final String SHOW_MTB_SCALE = "showMtbScale";
public static final String SHOW_MTB_IMBA_SCALE = "showMtbScaleIMBATrails";

public static String getRenderingClassNameForAttr(String attrName) {
switch (attrName) {
case HIKING_ROUTES:
return ".route.hiking";
case CYCLE_ROUTES:
return ".route.bicycle";
case MTB_ROUTES:
return ".route.mtb";
case SHOW_MTB_SCALE:
return ".route.mtb.mtb_scale";
case SHOW_MTB_IMBA_SCALE:
return ".route.mtb.mtb_scale_imba";
case ALPINE_HIKING:
return ".road.alpinehiking";
case HORSE_ROUTES:
return ".route.horse";
case PISTE_ROUTES:
return ".route.piste";
case RUNNING_ROUTES:
return ".route.running";
case FITNESS_TRAILS:
return ".route.fitness_trail";
case DIRTBIKE_ROUTES:
return ".route.dirtbike";
default:
return attrName;
}
}
}
35 changes: 2 additions & 33 deletions OsmAnd/src/net/osmand/plus/configmap/ConfigureMapUtils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.osmand.plus.configmap;

import static net.osmand.osm.RenderingPropertyAttr.*;
import static net.osmand.plus.dialogs.DetailsBottomSheet.STREET_LIGHTING;
import static net.osmand.plus.dialogs.DetailsBottomSheet.STREET_LIGHTING_NIGHT;
import static net.osmand.plus.settings.backend.OsmandSettings.RENDERER_PREFERENCE_PREFIX;
Expand All @@ -11,6 +10,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import net.osmand.osm.RenderingPropertyAttr;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
Expand Down Expand Up @@ -128,7 +128,7 @@ public static Pair<RenderingClass, List<RenderingClass>> getRenderingClassWithCh
@NonNull OsmandApplication app, @NonNull String attrName) {
RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer();
if (renderer != null) {
String key = getRenderingClassNameForAttr(app, attrName);
String key = RenderingPropertyAttr.getRenderingClassNameForAttr(attrName);
RenderingClass renderingClass = renderer.getRenderingClass(key);
if (renderingClass != null) {
List<RenderingClass> children = getChildrenRenderingClasses(app, renderingClass);
Expand All @@ -154,37 +154,6 @@ public static List<RenderingClass> getChildrenRenderingClasses(@NonNull OsmandAp
return null;
}

@NonNull
public static String getRenderingClassNameForAttr(@NonNull OsmandApplication app,
@NonNull String attrName) {
switch (attrName) {
case HIKING_ROUTES:
return ".route.hiking";
case CYCLE_ROUTES:
return ".route.bicycle";
case MTB_ROUTES:
return ".route.mtb";
case "showMtbScale":
return ".route.mtb.mtb_scale";
case "showMtbScaleIMBATrails":
return ".route.mtb.mtb_scale_imba";
case ALPINE_HIKING:
return ".road.alpinehiking";
case HORSE_ROUTES:
return ".route.horse";
case PISTE_ROUTES:
return ".route.piste";
case RUNNING_ROUTES:
return ".route.running";
case FITNESS_TRAILS:
return ".route.fitness_trail";
case DIRTBIKE_ROUTES:
return ".route.dirtbike";
default:
return attrName;
}
}

protected static String getDescription(@NonNull OsmandSettings settings,
@NonNull List<CommonPreference<Boolean>> prefs) {
int count = 0;
Expand Down

0 comments on commit 3283ef6

Please sign in to comment.