Skip to content

Commit

Permalink
linter suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoniecz committed Nov 16, 2021
1 parent 1dd0bcf commit cb5d010
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 175 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ There is a very simple but also working map style that can show water area, fore

![examples/simple_map_style_-_Sztynort.png](examples/simple_map_style_-_Sztynort.png)





#### Advanced map styles

In some cases one needs to somehow deals with layers. For example, what should be displayed if road in tunnel goes under building? Or under forest? What should be shown if there is a lake in a forest?
Expand All @@ -79,7 +75,6 @@ Map styles also have access to a powerful functionality allowing complete rewrit

Note: especially this part of documentation is incomplete and would benefit from better info. Please [open an issue](https://github.com/matkoniecz/lunar_assembler/issues/new) and mention what is confusing and where you are stuck. Right now I am not entirely sure what kind of knowledge people using it will have and what and how should be explained.


## Other published styles

Demonstration of [basic high-zoom map style](https://mapsaregreat.com/osm_to_svg_in_browser/general_high_zoom)
Expand Down
8 changes: 4 additions & 4 deletions examples/laser_neighbourhood_map_style.js
Original file line number Diff line number Diff line change
Expand Up @@ -821,10 +821,10 @@ function highZoomLaserMapStyle() {

widthOfRoadGeometryInMeters(feature) {
if (motorizedRoadValuesArray().includes(feature.properties["highway"])) {
var lanes = getTotalKnownLaneCount(feature);
if (lanes != undefined) {
return feature.properties["lanes"] * 2.7;
}
var lanes = getTotalKnownLaneCount(feature);
if (lanes != undefined) {
return feature.properties["lanes"] * 2.7;
}
if (feature.properties["highway"] == "service" && ["driveway", "parking_aisle"].includes(feature.properties["service"])) {
return undefined;
}
Expand Down
109 changes: 54 additions & 55 deletions examples/laser_road_area_map_style.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,23 @@ function laserRoadAreaMapStyle() {
}

returned.push({
area_color: "green",
description: "pedestrian square (using it for sidewalk areas is invalid!)",
matches: [
[
{ key: "highway", value: "pedestrian" },
{ key: "area", value: "yes", role: "supplementary_obvious_filter" },
],
[
{ key: "highway", value: "pedestrian" },
{ key: "type", value: "multipolygon", role: "supplementary_obvious_filter" },
],
],
area_color: "green",
description: "pedestrian square (using it for sidewalk areas is invalid!)",
matches: [
[
{ key: "highway", value: "pedestrian" },
{ key: "area", value: "yes", role: "supplementary_obvious_filter" },
],
[
{ key: "highway", value: "pedestrian" },
{ key: "type", value: "multipolygon", role: "supplementary_obvious_filter" },
],
],
});
returned.push({
area_color: "yellow",
description: "pedestrian crossing through a road (area used in addition to area representing road)",
matches: [{ key: "area:highway", value: "crossing" }],
area_color: "yellow",
description: "pedestrian crossing through a road (area used in addition to area representing road)",
matches: [{ key: "area:highway", value: "crossing" }],
});
returned.push({
area_color: "#004754", // color #27 in LightBurn, clearly visible on the map, rendered on top
Expand All @@ -155,38 +155,37 @@ function laserRoadAreaMapStyle() {
});

returned.push({
area_color: "orange",
description: "area representation of steps (used in addition to linear highway=steps)",
matches: [{ key: "area:highway", value: "steps" }],
}
);
area_color: "orange",
description: "area representation of steps (used in addition to linear highway=steps)",
matches: [{ key: "area:highway", value: "steps" }],
});
returned.push(...unifiedMapStyleSegmentForSymbolicStepRepresentation());
returned.push({
area_color: "black",
description: "buildings",
matches: [{ key: "building" }],
area_color: "black",
description: "buildings",
matches: [{ key: "building" }],
});
returned.push({
area_color: "#00FFFF",
description: "water - pattern, part expected to be engraved",
matches: [
[
{ key: "natural", value: "water" },
{ key: "lunar_assembler_cloned_for_pattern_fill", value: "yes", role: "supplementary_obvious_filter" },
],
[
{ key: "waterway", value: "riverbank" },
{ key: "lunar_assembler_cloned_for_pattern_fill", value: "yes", role: "supplementary_obvious_filter" },
],
],
});
returned.push({
area_color: "blue",
description: "water - entire area, expected to be cut at outline to separate element for easier painting (or used solely for orientation)",
matches: [
{ key: "natural", value: "water" },
{ key: "waterway", value: "riverbank" },
],
area_color: "#00FFFF",
description: "water - pattern, part expected to be engraved",
matches: [
[
{ key: "natural", value: "water" },
{ key: "lunar_assembler_cloned_for_pattern_fill", value: "yes", role: "supplementary_obvious_filter" },
],
[
{ key: "waterway", value: "riverbank" },
{ key: "lunar_assembler_cloned_for_pattern_fill", value: "yes", role: "supplementary_obvious_filter" },
],
],
});
returned.push({
area_color: "blue",
description: "water - entire area, expected to be cut at outline to separate element for easier painting (or used solely for orientation)",
matches: [
{ key: "natural", value: "water" },
{ key: "waterway", value: "riverbank" },
],
});
var i = motorizedRoadValuesArray().length;
while (i--) {
Expand Down Expand Up @@ -364,20 +363,20 @@ function laserRoadAreaMapStyle() {
while (i--) {
var feature = dataGeojson.features[i];
if (feature.properties["area:highway"] === "crossing") {
if(roadAreasWithCrossing == undefined) {
roadAreasWithCrossing = JSON.parse(JSON.stringify(feature.geometry.coordinates))
if (roadAreasWithCrossing == undefined) {
roadAreasWithCrossing = JSON.parse(JSON.stringify(feature.geometry.coordinates));
} else {
roadAreasWithCrossing = polygonClipping.union(feature.geometry.coordinates, roadAreasWithCrossing);
}
}
}
console.log(roadAreasWithCrossing)
if(roadAreasWithCrossing == undefined){
showError("no mapped crossing areas here at all!")
console.log(roadAreasWithCrossing);
if (roadAreasWithCrossing == undefined) {
showError("no mapped crossing areas here at all!");
} else {
var geometry = mergeArrayOfAreaCoordinatesIntoMultipolygon(roadAreasWithCrossing)
console.log(geometry)
generateZebraBarCrossings(dataGeojson, {'type': 'Feature', 'geometry': geometry})
var geometry = mergeArrayOfAreaCoordinatesIntoMultipolygon(roadAreasWithCrossing);
console.log(geometry);
generateZebraBarCrossings(dataGeojson, { type: "Feature", geometry: geometry });
}

dataGeojson = mapStyle.applyPatternsToCarriagewaysAndWater(dataGeojson);
Expand All @@ -398,15 +397,15 @@ function laserRoadAreaMapStyle() {
while (i--) {
var feature = dataGeojson.features[i];
if (feature.properties["area:highway"] === "crossing") {
if(feature.geometry.type == 'point') {
if (feature.geometry.type == "point") {
const link = "https://www.openstreetmap.org/" + feature.id;
showWarning("https://www.openstreetmap.org/" + feature.id + " is a node but has area:highway valid only on areas...");
} else {
if(isAreaAsExpected(feature) == false) {
if (isAreaAsExpected(feature) == false) {
showFatalError("following geometry was expected to be an area but was not:");
showFatalError(feature);
showFatalError(feature);
}
roadArea.geometry.coordinates = polygonClipping.difference(roadArea.geometry.coordinates, feature.geometry.coordinates);
roadArea.geometry.coordinates = polygonClipping.difference(roadArea.geometry.coordinates, feature.geometry.coordinates);
}
}
}
Expand Down
Loading

0 comments on commit cb5d010

Please sign in to comment.