mirror of
https://github.com/cfpwastaken/planetiler-openmaptiles.git
synced 2026-02-04 12:31:10 +00:00
Migrate to eclipse formatter to support multiple IDEs (#122)
This commit is contained in:
@@ -33,8 +33,8 @@ import java.util.List;
|
||||
* <li>{@link OsmAllProcessor} to process every OSM feature</li>
|
||||
* <li>{@link OsmRelationPreprocessor} to process every OSM relation during first pass through OSM file</li>
|
||||
* <li>A {@link Tables.RowHandler} implementation in {@code Tables.java} to process input features filtered and parsed
|
||||
* according to the imposm3 mappings defined in the OpenMapTiles schema. Each element corresponds to a row in the
|
||||
* table that imposm3 would have generated, with generated methods for accessing the data that would have been in each
|
||||
* according to the imposm3 mappings defined in the OpenMapTiles schema. Each element corresponds to a row in the table
|
||||
* that imposm3 would have generated, with generated methods for accessing the data that would have been in each
|
||||
* column</li>
|
||||
* </ul>
|
||||
* Layers can also subscribe to notifications when we finished processing an input source by implementing
|
||||
@@ -118,8 +118,7 @@ public class BasemapProfile extends ForwardingProfile {
|
||||
return new RowDispatch(constructor.create(), handlers);
|
||||
}).simplify().index();
|
||||
wikidataMappings = Tables.MAPPINGS
|
||||
.mapResults(constructor ->
|
||||
handlerMap.getOrDefault(constructor.rowClass(), List.of()).stream()
|
||||
.mapResults(constructor -> handlerMap.getOrDefault(constructor.rowClass(), List.of()).stream()
|
||||
.anyMatch(handler -> !IgnoreWikidata.class.isAssignableFrom(handler.handlerClass()))
|
||||
).filterResults(b -> b).simplify().index();
|
||||
|
||||
@@ -149,8 +148,8 @@ public class BasemapProfile extends ForwardingProfile {
|
||||
if (elem instanceof OsmElement.Node) {
|
||||
return wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POINT, tags), false);
|
||||
} else if (elem instanceof OsmElement.Way) {
|
||||
return wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POLYGON, tags), false)
|
||||
|| wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_LINE, tags), false);
|
||||
return wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POLYGON, tags), false) ||
|
||||
wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_LINE, tags), false);
|
||||
} else if (elem instanceof OsmElement.Relation) {
|
||||
return wikidataMappings.getOrElse(SimpleFeature.create(EMPTY_POLYGON, tags), false);
|
||||
} else {
|
||||
@@ -201,14 +200,13 @@ public class BasemapProfile extends ForwardingProfile {
|
||||
}
|
||||
|
||||
/**
|
||||
* Layers should implement this interface to subscribe to elements from <a href="https://www.naturalearthdata.com/">natural
|
||||
* earth</a>.
|
||||
* Layers should implement this interface to subscribe to elements from
|
||||
* <a href="https://www.naturalearthdata.com/">natural earth</a>.
|
||||
*/
|
||||
public interface NaturalEarthProcessor {
|
||||
|
||||
/**
|
||||
* Process an element from {@code table} in the<a href="https://www.naturalearthdata.com/">natural earth
|
||||
* source</a>.
|
||||
* Process an element from {@code table} in the<a href="https://www.naturalearthdata.com/">natural earth source</a>.
|
||||
*
|
||||
* @see Profile#processFeature(SourceFeature, FeatureCollector)
|
||||
*/
|
||||
@@ -216,8 +214,8 @@ public class BasemapProfile extends ForwardingProfile {
|
||||
}
|
||||
|
||||
/**
|
||||
* Layers should implement this interface to subscribe to elements from <a href="https://github.com/lukasmartinelli/osm-lakelines">OSM
|
||||
* lake centerlines source</a>.
|
||||
* Layers should implement this interface to subscribe to elements from
|
||||
* <a href="https://github.com/lukasmartinelli/osm-lakelines">OSM lake centerlines source</a>.
|
||||
*/
|
||||
public interface LakeCenterlineProcessor {
|
||||
|
||||
@@ -231,8 +229,8 @@ public class BasemapProfile extends ForwardingProfile {
|
||||
}
|
||||
|
||||
/**
|
||||
* Layers should implement this interface to subscribe to elements from <a href="https://osmdata.openstreetmap.de/data/water-polygons.html">OSM
|
||||
* water polygons source</a>.
|
||||
* Layers should implement this interface to subscribe to elements from
|
||||
* <a href="https://osmdata.openstreetmap.de/data/water-polygons.html">OSM water polygons source</a>.
|
||||
*/
|
||||
public interface OsmWaterPolygonProcessor {
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ import org.yaml.snakeyaml.LoaderOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
/**
|
||||
* Generates code in the {@code generated} package from the OpenMapTiles schema crawled from a tag or branch in the <a
|
||||
* href="https://github.com/openmaptiles/openmaptiles">OpenMapTiles GitHub repo</a>.
|
||||
* Generates code in the {@code generated} package from the OpenMapTiles schema crawled from a tag or branch in the
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles">OpenMapTiles GitHub repo</a>.
|
||||
* <p>
|
||||
* {@code OpenMapTilesSchema.java} contains the output layer definitions (i.e. attributes and allowed values) so that
|
||||
* layer implementations in {@code layers} package can reference them instead of hard-coding.
|
||||
@@ -169,8 +169,7 @@ public class Generate {
|
||||
|
||||
emitLayerSchemaDefinitions(config.tileset, layers, packageName, output, tag);
|
||||
emitTableDefinitions(tables, packageName, output, tag);
|
||||
LOGGER.info(
|
||||
"Done generating code in 'generated' package, now run IntelliJ 'Reformat Code' operation with 'Optimize imports' and 'Cleanup code' options selected.");
|
||||
LOGGER.info("Done!");
|
||||
}
|
||||
|
||||
/** Generates {@code OpenMapTilesSchema.java} */
|
||||
@@ -178,7 +177,8 @@ public class Generate {
|
||||
Path output, String tag)
|
||||
throws IOException {
|
||||
StringBuilder schemaClass = new StringBuilder();
|
||||
schemaClass.append("""
|
||||
schemaClass.append(
|
||||
"""
|
||||
%s
|
||||
package %s;
|
||||
|
||||
@@ -344,7 +344,8 @@ public class Generate {
|
||||
String tag)
|
||||
throws IOException {
|
||||
StringBuilder tablesClass = new StringBuilder();
|
||||
tablesClass.append("""
|
||||
tablesClass.append(
|
||||
"""
|
||||
%s
|
||||
package %s;
|
||||
|
||||
@@ -405,7 +406,8 @@ public class Generate {
|
||||
Class<?> handlerClass,
|
||||
RowHandler<T> handler
|
||||
) {}
|
||||
""".formatted(GENERATED_FILE_HEADER, packageName, escapeJavadoc(tag)));
|
||||
"""
|
||||
.formatted(GENERATED_FILE_HEADER, packageName, escapeJavadoc(tag)));
|
||||
|
||||
List<String> classNames = new ArrayList<>();
|
||||
Map<String, String> fieldNameToType = new TreeMap<>();
|
||||
@@ -494,11 +496,13 @@ public class Generate {
|
||||
.collect(joining("," + LINE_SEPARATOR)).indent(2).strip()
|
||||
).indent(2));
|
||||
|
||||
String handlerCondition = classNames.stream().map(className ->
|
||||
"""
|
||||
String handlerCondition = classNames.stream()
|
||||
.map(
|
||||
className -> """
|
||||
if (handler instanceof %s.Handler typedHandler) {
|
||||
result.computeIfAbsent(%s.class, cls -> new ArrayList<>()).add(new RowHandlerAndClass<>(typedHandler.getClass(), typedHandler::process));
|
||||
}""".formatted(className, className)
|
||||
}"""
|
||||
.formatted(className, className)
|
||||
).collect(joining(LINE_SEPARATOR));
|
||||
tablesClass.append("""
|
||||
/**
|
||||
@@ -518,14 +522,14 @@ public class Generate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an {@link Expression} that implements the same logic as the <a href="https://imposm.org/docs/imposm3/latest/mapping.html">Imposm3
|
||||
* Data Mapping</a> definition for a table.
|
||||
* Returns an {@link Expression} that implements the same logic as the
|
||||
* <a href="https://imposm.org/docs/imposm3/latest/mapping.html">Imposm3 Data Mapping</a> definition for a table.
|
||||
*/
|
||||
static Expression parseImposm3MappingExpression(Imposm3Table table) {
|
||||
if (table.type_mappings != null) {
|
||||
return or(
|
||||
table.type_mappings.entrySet().stream().map(entry ->
|
||||
parseImposm3MappingExpression(entry.getKey(), entry.getValue(), table.filters)
|
||||
table.type_mappings.entrySet().stream()
|
||||
.map(entry -> parseImposm3MappingExpression(entry.getKey(), entry.getValue(), table.filters)
|
||||
).toList()
|
||||
).simplify();
|
||||
} else {
|
||||
@@ -534,8 +538,8 @@ public class Generate {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an {@link Expression} that implements the same logic as the <a href="https://imposm.org/docs/imposm3/latest/mapping.html#filters">Imposm3
|
||||
* Data Mapping filters</a> for a table.
|
||||
* Returns an {@link Expression} that implements the same logic as the
|
||||
* <a href="https://imposm.org/docs/imposm3/latest/mapping.html#filters">Imposm3 Data Mapping filters</a> for a table.
|
||||
*/
|
||||
static Expression parseImposm3MappingExpression(String type, JsonNode mapping, Imposm3Filters filters) {
|
||||
return and(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,8 @@ import com.onthegomap.planetiler.util.Translations;
|
||||
/**
|
||||
* Defines the logic for generating map elements in the {@code aerodrome_label} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/aerodrome_label">OpenMapTiles
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/aerodrome_label">OpenMapTiles
|
||||
* aerodrome_layer sql files</a>.
|
||||
*/
|
||||
public class AerodromeLabel implements
|
||||
|
||||
@@ -45,8 +45,8 @@ import com.onthegomap.planetiler.util.Translations;
|
||||
/**
|
||||
* Defines the logic for generating map elements in the {@code aeroway} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/aeroway">OpenMapTiles
|
||||
* aeroway sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/aeroway">OpenMapTiles aeroway sql files</a>.
|
||||
*/
|
||||
public class Aeroway implements
|
||||
OpenMapTilesSchema.Aeroway,
|
||||
@@ -54,8 +54,7 @@ public class Aeroway implements
|
||||
Tables.OsmAerowayPolygon.Handler,
|
||||
Tables.OsmAerowayPoint.Handler {
|
||||
|
||||
public Aeroway(Translations translations, PlanetilerConfig config, Stats stats) {
|
||||
}
|
||||
public Aeroway(Translations translations, PlanetilerConfig config, Stats stats) {}
|
||||
|
||||
@Override
|
||||
public void process(Tables.OsmAerowayPolygon element, FeatureCollector features) {
|
||||
|
||||
@@ -86,8 +86,9 @@ import org.slf4j.LoggerFactory;
|
||||
* Defines the logic for generating map elements for country, state, and town boundaries in the {@code boundary} layer
|
||||
* from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/boundary">OpenMapTiles
|
||||
* boundary sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/boundary">OpenMapTiles boundary sql
|
||||
* files</a>.
|
||||
*/
|
||||
public class Boundary implements
|
||||
OpenMapTilesSchema.Boundary,
|
||||
@@ -164,8 +165,8 @@ public class Boundary implements
|
||||
BoundaryInfo info = switch (table) {
|
||||
case "ne_110m_admin_0_boundary_lines_land" -> new BoundaryInfo(2, 0, 0);
|
||||
case "ne_50m_admin_0_boundary_lines_land" -> new BoundaryInfo(2, 1, 3);
|
||||
case "ne_10m_admin_0_boundary_lines_land" -> feature.hasTag("featurecla", "Lease Limit") ? null
|
||||
: new BoundaryInfo(2, 4, 4);
|
||||
case "ne_10m_admin_0_boundary_lines_land" -> feature.hasTag("featurecla", "Lease Limit") ? null :
|
||||
new BoundaryInfo(2, 4, 4);
|
||||
case "ne_10m_admin_1_states_provinces_lines" -> {
|
||||
Double minZoom = Parse.parseDoubleOrNull(feature.getTag("min_zoom"));
|
||||
yield minZoom != null && minZoom <= 7 ? new BoundaryInfo(4, 1, 4) :
|
||||
@@ -398,8 +399,7 @@ public class Boundary implements
|
||||
try {
|
||||
Geometry combined = polygonizer.getGeometry().union();
|
||||
if (combined.isEmpty()) {
|
||||
LOGGER.warn("Unable to form closed polygon for OSM relation " + regionId
|
||||
+ " (likely missing edges)");
|
||||
LOGGER.warn("Unable to form closed polygon for OSM relation " + regionId + " (likely missing edges)");
|
||||
} else {
|
||||
countryBoundaries.put(regionId, PreparedGeometryFactory.prepare(combined));
|
||||
}
|
||||
@@ -429,8 +429,7 @@ public class Boundary implements
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal set of information extracted from a boundary relation to be used when processing each way in that
|
||||
* relation.
|
||||
* Minimal set of information extracted from a boundary relation to be used when processing each way in that relation.
|
||||
*/
|
||||
private record BoundaryRelation(
|
||||
long id,
|
||||
@@ -443,17 +442,15 @@ public class Boundary implements
|
||||
|
||||
@Override
|
||||
public long estimateMemoryUsageBytes() {
|
||||
return CLASS_HEADER_BYTES
|
||||
+ MemoryEstimator.estimateSizeLong(id)
|
||||
+ MemoryEstimator.estimateSizeInt(adminLevel)
|
||||
+ estimateSize(disputed)
|
||||
+ POINTER_BYTES + estimateSize(name)
|
||||
+ POINTER_BYTES + estimateSize(claimedBy)
|
||||
+ POINTER_BYTES + estimateSize(iso3166alpha3);
|
||||
return CLASS_HEADER_BYTES + MemoryEstimator.estimateSizeLong(id) + MemoryEstimator.estimateSizeInt(adminLevel) +
|
||||
estimateSize(disputed) + POINTER_BYTES + estimateSize(name) + POINTER_BYTES + estimateSize(claimedBy) +
|
||||
POINTER_BYTES + estimateSize(iso3166alpha3);
|
||||
}
|
||||
}
|
||||
|
||||
/** Information to hold onto from processing a way in a boundary relation to determine the left/right region ID later. */
|
||||
/**
|
||||
* Information to hold onto from processing a way in a boundary relation to determine the left/right region ID later.
|
||||
*/
|
||||
private record CountryBoundaryComponent(
|
||||
int adminLevel,
|
||||
boolean disputed,
|
||||
|
||||
@@ -60,8 +60,9 @@ import java.util.Map;
|
||||
/**
|
||||
* Defines the logic for generating map elements for buildings in the {@code building} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/building">OpenMapTiles
|
||||
* building sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/building">OpenMapTiles building sql
|
||||
* files</a>.
|
||||
*/
|
||||
public class Building implements
|
||||
OpenMapTilesSchema.Building,
|
||||
@@ -154,10 +155,8 @@ public class Building implements
|
||||
parseDoubleOrNull(element.buildingminLevel())
|
||||
);
|
||||
|
||||
int renderHeight = (int) Math.ceil(height != null ? height
|
||||
: levels != null ? (levels * 3.66) : 5);
|
||||
int renderMinHeight = (int) Math.floor(minHeight != null ? minHeight
|
||||
: minLevels != null ? (minLevels * 3.66) : 0);
|
||||
int renderHeight = (int) Math.ceil(height != null ? height : levels != null ? (levels * 3.66) : 5);
|
||||
int renderMinHeight = (int) Math.floor(minHeight != null ? minHeight : minLevels != null ? (minLevels * 3.66) : 0);
|
||||
|
||||
if (renderHeight < 3660 && renderMinHeight < 3660) {
|
||||
var feature = features.polygon(LAYER_NAME).setBufferPixels(BUFFER_SIZE)
|
||||
|
||||
@@ -45,15 +45,15 @@ import com.onthegomap.planetiler.util.Translations;
|
||||
/**
|
||||
* Defines the logic for generating map elements in the {@code housenumber} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/housenumber">OpenMapTiles
|
||||
* housenumber sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/housenumber">OpenMapTiles housenumber sql
|
||||
* files</a>.
|
||||
*/
|
||||
public class Housenumber implements
|
||||
OpenMapTilesSchema.Housenumber,
|
||||
Tables.OsmHousenumberPoint.Handler {
|
||||
|
||||
public Housenumber(Translations translations, PlanetilerConfig config, Stats stats) {
|
||||
}
|
||||
public Housenumber(Translations translations, PlanetilerConfig config, Stats stats) {}
|
||||
|
||||
@Override
|
||||
public void process(Tables.OsmHousenumberPoint element, FeatureCollector features) {
|
||||
|
||||
@@ -57,8 +57,9 @@ import java.util.Set;
|
||||
* Defines the logic for generating map elements for natural land cover polygons like ice, sand, and forest in the
|
||||
* {@code landcover} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/landcover">OpenMapTiles
|
||||
* landcover sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/landcover">OpenMapTiles landcover sql
|
||||
* files</a>.
|
||||
*/
|
||||
public class Landcover implements
|
||||
OpenMapTilesSchema.Landcover,
|
||||
|
||||
@@ -55,8 +55,8 @@ import java.util.Set;
|
||||
* Defines the logic for generating map elements for man-made land use polygons like cemeteries, zoos, and hospitals in
|
||||
* the {@code landuse} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/landuse">OpenMapTiles
|
||||
* landuse sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/landuse">OpenMapTiles landuse sql files</a>.
|
||||
*/
|
||||
public class Landuse implements
|
||||
OpenMapTilesSchema.Landuse,
|
||||
@@ -75,8 +75,7 @@ public class Landuse implements
|
||||
FieldValues.CLASS_NEIGHBOURHOOD
|
||||
);
|
||||
|
||||
public Landuse(Translations translations, PlanetilerConfig config, Stats stats) {
|
||||
}
|
||||
public Landuse(Translations translations, PlanetilerConfig config, Stats stats) {}
|
||||
|
||||
@Override
|
||||
public void processNaturalEarth(String table, SourceFeature feature, FeatureCollector features) {
|
||||
|
||||
@@ -65,8 +65,9 @@ import org.slf4j.LoggerFactory;
|
||||
* Defines the logic for generating map elements for mountain peak label points in the {@code mountain_peak} layer from
|
||||
* source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/mountain_peak">OpenMapTiles
|
||||
* mountain_peak sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/mountain_peak">OpenMapTiles mountain_peak
|
||||
* sql files</a>.
|
||||
*/
|
||||
public class MountainPeak implements
|
||||
BasemapProfile.NaturalEarthProcessor,
|
||||
|
||||
@@ -62,8 +62,8 @@ import java.util.Locale;
|
||||
* Defines the logic for generating map elements for designated parks polygons and their label points in the {@code
|
||||
* park} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/park">OpenMapTiles
|
||||
* park sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/park">OpenMapTiles park sql files</a>.
|
||||
*/
|
||||
public class Park implements
|
||||
OpenMapTilesSchema.Park,
|
||||
|
||||
@@ -76,8 +76,8 @@ import org.locationtech.jts.geom.Point;
|
||||
* Defines the logic for generating label points for populated places like continents, countries, cities, and towns in
|
||||
* the {@code place} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/place">OpenMapTiles
|
||||
* place sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/place">OpenMapTiles place sql files</a>.
|
||||
*/
|
||||
public class Place implements
|
||||
OpenMapTilesSchema.Place,
|
||||
@@ -420,9 +420,7 @@ public class Place implements
|
||||
}
|
||||
|
||||
/**
|
||||
* Information extracted from a natural earth place label that will be inspected when joining with OpenStreetMap
|
||||
* data.
|
||||
* Information extracted from a natural earth place label that will be inspected when joining with OpenStreetMap data.
|
||||
*/
|
||||
private record NaturalEarthPoint(String name, String wikidata, int scaleRank, Set<String> names) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ import java.util.Map;
|
||||
* Defines the logic for generating map elements for things like shops, parks, and schools in the {@code poi} layer from
|
||||
* source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/poi">OpenMapTiles
|
||||
* poi sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/poi">OpenMapTiles poi sql files</a>.
|
||||
*/
|
||||
public class Poi implements
|
||||
OpenMapTilesSchema.Poi,
|
||||
@@ -136,19 +136,8 @@ public class Poi implements
|
||||
setupPoiFeature(element, features.centroidIfConvex(LAYER_NAME));
|
||||
}
|
||||
|
||||
private <T extends
|
||||
Tables.WithSubclass &
|
||||
Tables.WithStation &
|
||||
Tables.WithFunicular &
|
||||
Tables.WithSport &
|
||||
Tables.WithInformation &
|
||||
Tables.WithReligion &
|
||||
Tables.WithMappingKey &
|
||||
Tables.WithName &
|
||||
Tables.WithIndoor &
|
||||
Tables.WithLayer &
|
||||
Tables.WithSource>
|
||||
void setupPoiFeature(T element, FeatureCollector.Feature output) {
|
||||
private <T extends Tables.WithSubclass & Tables.WithStation & Tables.WithFunicular & Tables.WithSport & Tables.WithInformation & Tables.WithReligion & Tables.WithMappingKey & Tables.WithName & Tables.WithIndoor & Tables.WithLayer & Tables.WithSource> void setupPoiFeature(
|
||||
T element, FeatureCollector.Feature output) {
|
||||
String rawSubclass = element.subclass();
|
||||
if ("station".equals(rawSubclass) && "subway".equals(element.station())) {
|
||||
rawSubclass = "subway";
|
||||
|
||||
@@ -80,8 +80,9 @@ import org.slf4j.LoggerFactory;
|
||||
* Defines the logic for generating map elements for roads, shipways, railroads, and paths in the {@code transportation}
|
||||
* layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/transportation">OpenMapTiles
|
||||
* transportation sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/transportation">OpenMapTiles transportation
|
||||
* sql files</a>.
|
||||
*/
|
||||
public class Transportation implements
|
||||
OpenMapTilesSchema.Transportation,
|
||||
@@ -320,8 +321,8 @@ public class Transportation implements
|
||||
Geometry wayGeometry = element.source().worldGeometry();
|
||||
if (greatBritain.intersects(wayGeometry)) {
|
||||
Transportation.RouteNetwork networkType =
|
||||
"motorway".equals(element.highway()) ? Transportation.RouteNetwork.GB_MOTORWAY
|
||||
: Transportation.RouteNetwork.GB_TRUNK;
|
||||
"motorway".equals(element.highway()) ? Transportation.RouteNetwork.GB_MOTORWAY :
|
||||
Transportation.RouteNetwork.GB_TRUNK;
|
||||
String network = "motorway".equals(element.highway()) ? "omt-gb-motorway" : "omt-gb-trunk";
|
||||
result.add(new RouteRelation(refMatcher.group(), network, networkType, (byte) -1,
|
||||
0));
|
||||
|
||||
@@ -67,7 +67,8 @@ import java.util.function.Function;
|
||||
* Defines the logic for generating map elements for road, shipway, rail, and path names in the {@code
|
||||
* transportation_name} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/transportation_name">OpenMapTiles
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/transportation_name">OpenMapTiles
|
||||
* transportation_name sql files</a>.
|
||||
*/
|
||||
public class TransportationName implements
|
||||
@@ -235,8 +236,8 @@ public class TransportationName implements
|
||||
.setAttr(Fields.REF, ref)
|
||||
.setAttr(Fields.REF_LENGTH, ref != null ? ref.length() : null)
|
||||
.setAttr(Fields.NETWORK,
|
||||
(relation != null && relation.networkType() != null) ? relation.networkType().name
|
||||
: !nullOrEmpty(ref) ? "road" : null)
|
||||
(relation != null && relation.networkType() != null) ? relation.networkType().name :
|
||||
!nullOrEmpty(ref) ? "road" : null)
|
||||
.setAttr(Fields.CLASS, highwayClass)
|
||||
.setAttr(Fields.SUBCLASS, highwaySubclass(highwayClass, null, highway))
|
||||
.setMinPixelSize(0)
|
||||
|
||||
@@ -49,8 +49,8 @@ import com.onthegomap.planetiler.util.Translations;
|
||||
/**
|
||||
* Defines the logic for generating map elements for oceans and lakes in the {@code water} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/water">OpenMapTiles
|
||||
* water sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/water">OpenMapTiles water sql files</a>.
|
||||
*/
|
||||
public class Water implements
|
||||
OpenMapTilesSchema.Water,
|
||||
|
||||
@@ -61,8 +61,9 @@ import org.slf4j.LoggerFactory;
|
||||
* Defines the logic for generating map elements for ocean and lake names in the {@code water_name} layer from source
|
||||
* features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/water_name">OpenMapTiles
|
||||
* water_name sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/water_name">OpenMapTiles water_name sql
|
||||
* files</a>.
|
||||
*/
|
||||
public class WaterName implements
|
||||
OpenMapTilesSchema.WaterName,
|
||||
|
||||
@@ -63,8 +63,9 @@ import java.util.Map;
|
||||
/**
|
||||
* Defines the logic for generating river map elements in the {@code waterway} layer from source features.
|
||||
* <p>
|
||||
* This class is ported to Java from <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/waterway">OpenMapTiles
|
||||
* waterway sql files</a>.
|
||||
* This class is ported to Java from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles/tree/master/layers/waterway">OpenMapTiles waterway sql
|
||||
* files</a>.
|
||||
*/
|
||||
public class Waterway implements
|
||||
OpenMapTilesSchema.Waterway,
|
||||
|
||||
@@ -49,7 +49,8 @@ import java.util.stream.Stream;
|
||||
* Utilities to extract common name fields (name, name_en, name_de, name:latin, name:nonlatin, name_int) that the
|
||||
* OpenMapTiles schema uses across any map element with a name.
|
||||
* <p>
|
||||
* Ported from <a href="https://github.com/openmaptiles/openmaptiles-tools/blob/master/sql/zzz_language.sql">openmaptiles-tools</a>.
|
||||
* Ported from
|
||||
* <a href="https://github.com/openmaptiles/openmaptiles-tools/blob/master/sql/zzz_language.sql">openmaptiles-tools</a>.
|
||||
*/
|
||||
public class LanguageUtils {
|
||||
|
||||
@@ -126,8 +127,8 @@ public class LanguageUtils {
|
||||
String nameDe = string(tags.get("name:de"));
|
||||
|
||||
boolean isLatin = containsOnlyLatinCharacters(name);
|
||||
String latin = isLatin ? name
|
||||
: Stream.concat(Stream.of(nameEn, intName, nameDe), getAllNameTranslationsBesidesEnglishAndGerman(tags))
|
||||
String latin = isLatin ? name :
|
||||
Stream.concat(Stream.of(nameEn, intName, nameDe), getAllNameTranslationsBesidesEnglishAndGerman(tags))
|
||||
.filter(LanguageUtils::containsOnlyLatinCharacters)
|
||||
.findFirst().orElse(null);
|
||||
if (latin == null && translations != null && translations.getShouldTransliterate()) {
|
||||
|
||||
@@ -61,8 +61,8 @@ public abstract class AbstractLayerTest {
|
||||
if (vals[i - 1] > vals[i]) {
|
||||
fail(
|
||||
Arrays.toString(vals) +
|
||||
System.lineSeparator() + "element at " + (i - 1) + " (" + vals[i - 1] + ") is greater than element at " + i
|
||||
+ " (" + vals[i] + ")");
|
||||
System.lineSeparator() + "element at " + (i - 1) + " (" + vals[i - 1] + ") is greater than element at " +
|
||||
i + " (" + vals[i] + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user