Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small changes to AtlasDelta toDiffViewFriendlyString method #193

Merged
merged 5 commits into from
Aug 9, 2018
Merged

Small changes to AtlasDelta toDiffViewFriendlyString method #193

merged 5 commits into from
Aug 9, 2018

Conversation

lucaspcram
Copy link
Contributor

@lucaspcram lucaspcram commented Aug 8, 2018

Description:

Added the diffReason field from Diff to the printout, which was missing from the regular toString method. It is very useful when glancing at a diff, so you know exactly what to look for. Additionally, I updated the format of the printout so it is easy to see exactly what changed in any given diff. Each feature is now printed on a separate line, so all you have to do is scroll until you see a change.

Potential Impact:

No potential impact. No code currently depends on the diff friendly printouts (barring one or two unit tests which simply log the printouts).

Unit Test Approach:

AtlasDeltaEdgeTest prints out the the diff view friendly string at the DEBUG level, for a demo viewing. No actual code logic is changed.

Test Results:

N/A

Copy link
Contributor

@MikeGost MikeGost left a comment

Choose a reason for hiding this comment

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

Awesome! Can we get a pre-post example of what a diff looks like?

@lucaspcram
Copy link
Contributor Author

Good idea. Here's a quick sample on some small features. When you have very small features, the old format is actually easier to read. But it breaks down when the features get really large. Which is why I added the diffView as an alternative option instead of just changing the current toString. I can show some examples of what the bigger features look like offline.

Note how the toDiffViewFriendlyString displays the differing features on top of one another instead of on the same line. This makes it much easier to visually scan and pick out the change. It also displays the diffReason while the regular toString does not. This helps narrow your search when the diffed features are huge.

toString

[Diffs: 
	[Diff: ADDED, Entity = {EDGE, ID = 0, null -> [Edge: id=0, startNode=1, endNode=2, polyLine=LINESTRING (-122.009566 37.33531, -122.028464 37.321628), [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]]}], 
	[Diff: CHANGED, Entity = {NODE, ID = 1, [Node: id=1, location=POINT (-122.009566 37.33531), inEdges=[], outEdges=[], [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]] -> [Node: id=1, location=POINT (-122.009566 37.33531), inEdges=[], outEdges=[0], [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]]}], 
	[Diff: CHANGED, Entity = {NODE, ID = 2, [Node: id=2, location=POINT (-122.028464 37.321628), inEdges=[], outEdges=[], [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]] -> [Node: id=2, location=POINT (-122.028464 37.321628), inEdges=[0], outEdges=[], [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]]}]
]

toDiffViewFriendlyString

Diffset {
Diff [
diffType: ADDED
diffReason: ADDED
Entity = EDGE
ID = 0
null
 -> 
[Edge: id=0, startNode=1, endNode=2, polyLine=LINESTRING (-122.009566 37.33531, -122.028464 37.321628), relations=(), [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]]
]

Diff [
diffType: CHANGED
diffReason: GEOMETRY_OR_TOPOLOGY
Entity = NODE
ID = 1
[Node: id=1, location=POINT (-122.009566 37.33531), inEdges=[], outEdges=[], relations=(), [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]]
 -> 
[Node: id=1, location=POINT (-122.009566 37.33531), inEdges=[], outEdges=[0], relations=(), [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]]
]

Diff [
diffType: CHANGED
diffReason: GEOMETRY_OR_TOPOLOGY
Entity = NODE
ID = 2
[Node: id=2, location=POINT (-122.028464 37.321628), inEdges=[], outEdges=[], relations=(), [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]]
 -> 
[Node: id=2, location=POINT (-122.028464 37.321628), inEdges=[0], outEdges=[], relations=(), [Tags: [inconclusive => brachiation], [hamamelis => dormie], [raglan => mode], [domineer => confidentiality], [meanly => anyhow]]]
]
}

@MikeGost MikeGost merged commit c3d93b9 into osmlab:dev Aug 9, 2018
@lucaspcram lucaspcram deleted the diff branch August 9, 2018 22:59
@lucaspcram lucaspcram added this to the 5.1.8 milestone Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants