Skip to content

Allow ways to cross when separated temporally - #137

Merged
danrademacher merged 5 commits into
OpenHistoricalMap:stagingfrom
1ec5:ohm-crossing-ways-temporal-288
Oct 1, 2022
Merged

danrademacher merged 5 commits into
OpenHistoricalMap:stagingfrom
1ec5:ohm-crossing-ways-temporal-288

Conversation

@1ec5

@1ec5 1ec5 commented Sep 21, 2022

Copy link
Copy Markdown
Member

Avoid warning about crossing ways when the two ways’ date ranges don’t overlap or only touch. Mention the possibility of temporal separation in the validation rule’s message and suggestions.

warning

Fixes OpenHistoricalMap/issues#288.

Comment thread modules/util/util.js
Comment on lines +554 to +643
if (date1[1] > date2[1]) return false;
if (date1[2] && date2[2] && date1[2] > date2[2]) return false;
if (date1[3] && date2[3] && date1[3] > date2[3]) return false;

@1ec5 1ec5 Sep 21, 2022 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dates are only compared to the lowest common precision. If one feature ends on “1970” and another begins on “1970-01-01”, the two features are not considered to overlap temporally. This contrasts with the vector tile server, which rounds start_date down to the beginning of the month or year and end_date up to the end of the month or year when filtering features in the vector tiles.

@1ec5
1ec5 force-pushed the ohm-crossing-ways-temporal-288 branch from ff589c3 to 56ecdac Compare September 29, 2022 23:54
@1ec5
1ec5 force-pushed the ohm-crossing-ways-temporal-288 branch from 56ecdac to 12e7073 Compare September 30, 2022 00:45
@1ec5

1ec5 commented Sep 30, 2022 •

Copy link
Copy Markdown
Member Author

I’ve rebased this PR atop the staging branch for OpenHistoricalMap/issues#395 and added a similar date-based exception to the Almost Junctions and Very Close Points validation rules.

Almost Junctions Very Close Points

Comment on lines +14 to +21
<path
d="M10,1 L9,2 L9,3.062 C5.056,3.556 2,6.922 2,11 C2,15.418 5.582,19 10,19 C14.418,19 18,15.418 18,11 C18,8.533 16.881,6.341 15.125,4.875 L13.719,6.281 C15.114,7.38 16,9.086 16,11 C16,14.314 13.314,17 10,17 C6.686,17 4,14.314 4,11 C4,8.024 6.159,5.567 9,5.094 L9,6 L10,7 L13,4 L10,1 z"
fill="currentColor"
id="path132" />
<path
id="path4001"
style="stroke-width:0.681386"
d="M 8.5,9.5 V 16 h 1 l 1,-4.5 H 15 v -1 z" />

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new icon based on operation-rotate.svg but with clock hands instead of a dot in the middle. I considered using temaki-clock for consistency with the Clock preset, but the clock hands seem a little off-center and the clock face is too large compared to the other validation fix icons.

@danrademacher
danrademacher merged commit d424f83 into OpenHistoricalMap:staging Oct 1, 2022
Comment thread modules/util/util.js
@@ -670,4 +670,57 @@ export function utilDatesOverlap(tags1, tags2) {
(isAfter(start2, start1) && isBefore(start2, end1)) ||
(isAfter(end1, start2) && isBefore(end1, end2)) ||
(isAfter(end2, start1) && isBefore(end2, end1)));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple lines of this method went missing in this merge.

Comment thread test/spec/util/util.js
@@ -324,6 +324,39 @@ describe('iD.util', function() {
{start_date: '2000-01-01', end_date: '2038-01-01'})).to.eql(false);
expect(iD.utilDatesOverlap({start_date: '2000-01-01', end_date: '2038-01-01'},
{start_date: '1970-01-01', end_date: '2000-01-01'})).to.eql(false);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here.

@1ec5 1ec5 mentioned this pull request Oct 1, 2022
@1ec5
1ec5 deleted the ohm-crossing-ways-temporal-288 branch October 1, 2022 01:46
@1ec5 1ec5 mentioned this pull request Oct 3, 2022
Comment on lines +152 to +155
fixes.push(new validationIssueFix({
icon: 'iD-operation-change-date-range',
title: t.append('issues.fix.change_date_range.title')
}));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This additional fix is causing two tests to fail because there are more suggested fixes than expected. I updated the test in #142.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ID Warnings and Errors

2 participants