Add fill patterns for cemetery most common religions

This commit is contained in:
RudyTheDev
2018-11-18 20:41:58 +02:00
parent b7e218a6cb
commit f41bb055f2
7 changed files with 20 additions and 6 deletions

View File

@@ -216,6 +216,10 @@ path.stroke.tag-natural-wetland {
/* Light Green things */
.pattern-color-cemetery,
.pattern-color-cemetery_christian,
.pattern-color-cemetery_buddhist,
.pattern-color-cemetery_muslim,
.pattern-color-cemetery_jewish,
.pattern-color-orchard,
.pattern-color-meadow,
.pattern-color-farm,

BIN
dist/img/pattern/cemetery_buddhist.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

BIN
dist/img/pattern/cemetery_christian.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

BIN
dist/img/pattern/cemetery_jewish.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

BIN
dist/img/pattern/cemetery_muslim.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

View File

@@ -19,7 +19,13 @@ export function svgAreas(projection, context) {
grave_yard: 'cemetery'
},
landuse: {
cemetery: 'cemetery',
cemetery: [
{ religion: 'christian', pattern: 'cemetery_christian' },
{ religion: 'buddhist', pattern: 'cemetery_buddhist' },
{ religion: 'muslim', pattern: 'cemetery_muslim' },
{ religion: 'jewish', pattern: 'cemetery_jewish' },
{ pattern: 'cemetery' }
],
construction: 'construction',
farm: 'farmland',
farmland: 'farmland',
@@ -56,16 +62,16 @@ export function svgAreas(projection, context) {
}
};
function setPattern(d) {
function setPattern(entity) {
// Skip pattern filling if this is a building (buildings don't get patterns applied)
if (d.tags.building && d.tags.building !== 'no') {
if (entity.tags.building && entity.tags.building !== 'no') {
this.style.fill = this.style.stroke = '';
return;
}
for (var tag in patterns) {
if (patterns.hasOwnProperty(tag)) {
var entityValue = d.tags[tag];
var entityValue = entity.tags[tag];
if (entityValue) {
var values = patterns[tag];
@@ -84,7 +90,7 @@ export function svgAreas(projection, context) {
for (var criterion in rule) {
if (criterion !== 'pattern') { // reserved for pattern name
// The only rule is a required tag-value pair
var v = d.tags[criterion];
var v = entity.tags[criterion];
if (!v || v !== rule[criterion]) {
pass = false;
break;
@@ -261,7 +267,7 @@ export function svgAreas(projection, context) {
if (layer === 'fill') {
this.setAttribute('clip-path', 'url(#' + entity.id + '-clippath)');
setPattern.apply(this, arguments);
setPattern.call(this, entity);
}
})
.call(svgTagClasses())

View File

@@ -80,6 +80,10 @@ export function svgDefs(context) {
['scrub', 'bushes'],
['construction', 'construction'],
['cemetery', 'cemetery'],
['cemetery_christian', 'cemetery_christian'],
['cemetery_buddhist', 'cemetery_buddhist'],
['cemetery_muslim', 'cemetery_muslim'],
['cemetery_jewish', 'cemetery_jewish'],
['orchard', 'orchard'],
['farmland', 'farmland'],
['beach', 'dots'],