Last change
on this file since 5075 was 5075, checked in by gabriel, 17 years ago |
Import the latest upstream version of utilsplugin.
|
File size:
1.6 KB
|
Line | |
---|
1 | package UtilsPlugin.JosmLint;
|
---|
2 |
|
---|
3 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
4 | import org.openstreetmap.josm.data.osm.Node;
|
---|
5 | import org.openstreetmap.josm.data.osm.Segment;
|
---|
6 | import org.openstreetmap.josm.data.osm.Way;
|
---|
7 |
|
---|
8 | public class JosmLintTestResult
|
---|
9 | {
|
---|
10 | protected OsmPrimitive obj;
|
---|
11 | protected JosmLintTest test;
|
---|
12 |
|
---|
13 | public JosmLintTestResult( OsmPrimitive o, JosmLintTest t )
|
---|
14 | {
|
---|
15 | this.obj = o;
|
---|
16 | this.test = t;
|
---|
17 | }
|
---|
18 | public boolean recheck()
|
---|
19 | {
|
---|
20 | JosmLintTestResult newres = test.runTest(obj);
|
---|
21 | if( newres == null )
|
---|
22 | return false;
|
---|
23 | this.cloneFrom(newres); /* Pick up changes if any */
|
---|
24 | return true;
|
---|
25 | }
|
---|
26 | public void cloneFrom(JosmLintTestResult res)
|
---|
27 | {
|
---|
28 | this.obj = res.obj;
|
---|
29 | this.test = res.test;
|
---|
30 | }
|
---|
31 | public static String ObjectDescr(OsmPrimitive o)
|
---|
32 | {
|
---|
33 | String str;
|
---|
34 | if( o instanceof Node )
|
---|
35 | {
|
---|
36 | str = "Node "+o.id;
|
---|
37 | }
|
---|
38 | else if( o instanceof Segment )
|
---|
39 | {
|
---|
40 | str = "Segment "+o.id;
|
---|
41 | }
|
---|
42 | else if( o instanceof Way )
|
---|
43 | {
|
---|
44 | str = "Way "+o.id;
|
---|
45 | }
|
---|
46 | else
|
---|
47 | {
|
---|
48 | str = "Unknown object";
|
---|
49 | }
|
---|
50 | return str;
|
---|
51 | }
|
---|
52 | // Return object to select when doubleclicked
|
---|
53 | public OsmPrimitive getSelection()
|
---|
54 | {
|
---|
55 | return obj;
|
---|
56 | }
|
---|
57 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.