Last change
on this file since 1640 was 1640, checked in by stoecker, 15 years ago |
little bit more refactoring of coordinate access - patch by jttt
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.data.conflict;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import org.openstreetmap.josm.data.osm.Node;
|
---|
7 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
8 |
|
---|
9 | public class PositionConflict extends ConflictItem {
|
---|
10 |
|
---|
11 | @Override public boolean hasConflict(OsmPrimitive key, OsmPrimitive value) {
|
---|
12 | return key instanceof Node && !((Node)key).getCoor().equals(((Node)value).getCoor());
|
---|
13 | }
|
---|
14 |
|
---|
15 | @Override protected String str(OsmPrimitive osm) {
|
---|
16 | return osm instanceof Node ? ((Node)osm).getCoor().lat()+", "+((Node)osm).getCoor().lon() : null;
|
---|
17 | }
|
---|
18 |
|
---|
19 | @Override public String key() {
|
---|
20 | return "node|"+tr("position");
|
---|
21 | }
|
---|
22 |
|
---|
23 | @Override public void apply(OsmPrimitive target, OsmPrimitive other) {
|
---|
24 | if (target instanceof Node) {
|
---|
25 | ((Node)target).setEastNorth(((Node)other).getEastNorth());
|
---|
26 | int newversion = Math.max(target.version, other.version);
|
---|
27 | // set version on "other" as well in case user decides to keep local
|
---|
28 | target.version = newversion;
|
---|
29 | other.version = newversion;
|
---|
30 | }
|
---|
31 | }
|
---|
32 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.