Skip to content

Commit

Permalink
Add support for Röntgen icons
Browse files Browse the repository at this point in the history
(re: #846)

The work I just did on #925 gives us much more flexibility to support new
spritesheets.  These get converted to WebGL textures on the fly now, so we
don't need to prepare a special spritesheet anymore.
  • Loading branch information
bhousel committed May 1, 2023
1 parent 481a6d5 commit 589d43d
Show file tree
Hide file tree
Showing 475 changed files with 955 additions and 23 deletions.
17 changes: 0 additions & 17 deletions modules/presets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ export { _mainPresetIndex as presetManager };

// warn about v6 preset featues we don't support currently
const VERBOSE = true;
// These are too hard to generate, for now we'll just replace them in code
const ROENTGEN = {
'roentgen-buses': 'temaki-bus',
'roentgen-city_limit_sign': 'maki-information',
'roentgen-crane': 'temaki-crane',
'roentgen-crane_gantry': 'temaki-crane',
'roentgen-crane_portal': 'temaki-crane',
'roentgen-diving_1_platforms': 'temaki-diving',
'roentgen-pole_dancer': 'temaki-money_hand',
'roentgen-slide': 'temaki-slide',
'roentgen-slide_and_water': 'temaki-slide',
'roentgen-turning_loop': 'maki-circle'
};


//
// `presetIndex` wraps a `presetCollection`
Expand Down Expand Up @@ -146,9 +132,6 @@ if (p.icon) p.icon = p.icon.replace(/^iD-/, 'rapid-');
if (presetID === 'address') p.icon ='maki-circle-stroked';
if (presetID === 'highway/crossing/traffic_signals') p.icon ='temaki-pedestrian_crosswalk';

// No support for Roentgen icons just yet
if (ROENTGEN[p.icon]) p.icon = ROENTGEN[p.icon];

p = presetPreset(presetID, p, isAddable, _fields, _presets);
if (p.locationSet) newLocationSets.push(p);
_presets[presetID] = p;
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/UiDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class UiDefs {
this.parent = d3_select(null);

this.spritesheetIDs = [
'rapid', 'maki', 'temaki', 'fa', 'community', 'mapillary-object', 'mapillary'
'rapid', 'maki', 'temaki', 'fa', 'roentgen', 'community', 'mapillary-object', 'mapillary'
];

// Ensure methods used as callbacks always have `this` bound correctly.
Expand Down Expand Up @@ -73,7 +73,7 @@ export class UiDefs {
group.appendChild(element);

// For some spritesheets, allow icon fill colors to be overridden..
if (['maki', 'temaki', 'fa', 'community'].includes(spritesheetID)) {
if (['maki', 'temaki', 'fa', 'roentgen', 'community'].includes(spritesheetID)) {
selection.selectAll('path')
.attr('fill', 'currentColor');
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/mapillary_sprite_source/package_signs/*.svg",
"dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/mapillary_sprite_source/package_objects/*.svg",
"dist:svg:rapid": "svg-sprite --symbol --symbol-dest . --shape-id-generator \"rapid-%s\" --symbol-sprite dist/img/rapid-sprite.svg \"svg/rapid-sprite/**/*.svg\"",
"dist:svg:roentgen": "svg-sprite --symbol --symbol-dest . --shape-id-generator \"roentgen-%s\" --symbol-sprite dist/img/roentgen-sprite.svg svg/roentgen/*.svg",
"dist:svg:temaki": "svg-sprite --symbol --symbol-dest . --shape-id-generator \"temaki-%s\" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@rapideditor/temaki/icons/*.svg",
"docs": "jsdoc -c webdoc.conf.json -r",
"imagery": "node scripts/update_imagery.js",
Expand Down
5 changes: 1 addition & 4 deletions scripts/build_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,9 @@ function writeIcons(icons) {
const [prefix, ...rest] = icon.split('-');
const name = rest.join('-');

if (['iD', 'rapid', 'maki', 'temaki'].includes(prefix)) {
if (['iD', 'rapid', 'maki', 'temaki', 'roentgen'].includes(prefix)) {
continue; // These are expected to live in an existing spritesheet..

} else if (prefix === 'roentgen') {
continue; // These are too hard to generate, for now we'll just replace them in code..

} else if (['fas', 'far', 'fab'].includes(prefix)) { // FontAwesome, must be extracted
const def = fontawesome.findIconDefinition({ prefix: prefix, iconName: name });
try {
Expand Down
2 changes: 2 additions & 0 deletions svg/fontawesome/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ Do not edit the files in this folder.

This folder contains Font Awesome icons which are used by the presets.
The icons are generated automatically by the `build_data.js` script.

The contents of this folder are © Fontawesome ([CC BY 4.0](https://github.com/FortAwesome/Font-Awesome#license)).
7 changes: 7 additions & 0 deletions svg/roentgen/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Röntgen icons (c) by Sergey Vartanov

Röntgen icons are licensed under a Creative Commons Attribution 4.0
International License.

You should have received a copy of the license along with this work. If not,
see <http://creativecommons.org/licenses/by/4.0/>.
6 changes: 6 additions & 0 deletions svg/roentgen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Do not edit the files in this folder.

This folder contains Roentgen icons.
The icons are generated semi-automatically by running `map-machine icons` after [installing](https://github.com/enzet/map-machine#installation) Map Machine.

The contents of this folder are © Map Machine ([CC BY 4.0](https://github.com/enzet/map-machine#r%C3%B6ntgen-icon-set)).
2 changes: 2 additions & 0 deletions svg/roentgen/advertising_column.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions svg/roentgen/amphora.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions svg/roentgen/amusement_ride.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions svg/roentgen/anchor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions svg/roentgen/apartments_1_story.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions svg/roentgen/apartments_1_story_gabled_roof.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 589d43d

Please sign in to comment.