Changeset 33082 in osm


Ignore:
Timestamp:
2016-11-25T22:57:10+01:00 (8 years ago)
Author:
darya
Message:

fix #14015

Location:
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/gui/PTAssistantPaintVisitor.java

    r33055 r33082  
    285285    @Override
    286286    protected void drawNode(Node n, Color color) {
    287 
     287                if (mv == null || g == null) {
     288                        return;
     289                }
    288290        Point p = mv.getPoint(n);
    289 
     291                if (p == null) {
     292                        return;
     293                }
    290294        g.setColor(color);
    291295        g.drawOval(p.x - 5, p.y - 5, 10, 10);
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/NodeChecker.java

    r33055 r33082  
    2222import org.openstreetmap.josm.data.validation.Test;
    2323import org.openstreetmap.josm.data.validation.TestError;
     24import org.openstreetmap.josm.data.validation.TestError.Builder;
    2425import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
    2526import org.openstreetmap.josm.plugins.pt_assistant.utils.StopUtils;
     
    2728public class NodeChecker extends Checker {
    2829
    29     protected NodeChecker(Node node, Test test) {
    30         super(node, test);
     30        protected NodeChecker(Node node, Test test) {
     31                super(node, test);
    3132
    32     }
     33        }
    3334
    34     /**
    35     * Checks if the given stop_position node belongs to any way
    36     */
    37     protected void performSolitaryStopPositionTest() {
     35        /**
     36        * Checks if the given stop_position node belongs to any way
     37        */
     38        protected void performSolitaryStopPositionTest() {
    3839
    39         List<OsmPrimitive> referrers = node.getReferrers();
     40                List<OsmPrimitive> referrers = node.getReferrers();
    4041
    41         for (OsmPrimitive referrer : referrers) {
    42             if (referrer.getType().equals(OsmPrimitiveType.WAY)) {
    43                 Way referrerWay = (Way) referrer;
    44                 if (RouteUtils.isWaySuitableForPublicTransport(referrerWay)) {
    45                     return;
    46                 }
     42                for (OsmPrimitive referrer : referrers) {
     43                        if (referrer.getType().equals(OsmPrimitiveType.WAY)) {
     44                                Way referrerWay = (Way) referrer;
     45                                if (RouteUtils.isWaySuitableForPublicTransport(referrerWay)) {
     46                                        return;
     47                                }
    4748
    48             }
    49         }
     49                        }
     50                }
    5051
    51         List<OsmPrimitive> primitives = new ArrayList<>(1);
    52         primitives.add(node);
    53         TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Stop_position is not part of a way"),
    54                 PTAssistantValidatorTest.ERROR_CODE_SOLITARY_STOP_POSITION, primitives);
    55         errors.add(e);
     52                List<OsmPrimitive> primitives = new ArrayList<>(1);
     53                primitives.add(node);
     54                Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_SOLITARY_STOP_POSITION);
     55                builder.message(tr("PT: Stop_position is not part of a way"));
     56                builder.primitives(primitives);
     57                TestError e = builder.build();
     58                errors.add(e);
    5659
    57     }
     60        }
    5861
    59     /**
    60     * Checks if the given platform node belongs to any way
    61     */
    62     protected void performPlatformPartOfWayTest() {
     62        /**
     63        * Checks if the given platform node belongs to any way
     64        */
     65        protected void performPlatformPartOfWayTest() {
    6366
    64         List<OsmPrimitive> referrers = node.getReferrers();
     67                List<OsmPrimitive> referrers = node.getReferrers();
    6568
    66         for (OsmPrimitive referrer : referrers) {
    67             List<Node> primitives = new ArrayList<>(1);
    68             primitives.add(node);
    69             if (referrer.getType().equals(OsmPrimitiveType.WAY)) {
    70                 Way referringWay = (Way) referrer;
    71                 if (RouteUtils.isWaySuitableForPublicTransport(referringWay)) {
    72                     TestError e = new TestError(this.test, Severity.WARNING,
    73                             tr("PT: Platform should not be part of a way"),
    74                             PTAssistantValidatorTest.ERROR_CODE_PLATFORM_PART_OF_HIGHWAY, primitives);
    75                     errors.add(e);
    76                     return;
    77                 }
    78             }
    79         }
    80     }
     69                for (OsmPrimitive referrer : referrers) {
     70                        List<Node> primitives = new ArrayList<>(1);
     71                        primitives.add(node);
     72                        if (referrer.getType().equals(OsmPrimitiveType.WAY)) {
     73                                Way referringWay = (Way) referrer;
     74                                if (RouteUtils.isWaySuitableForPublicTransport(referringWay)) {
     75                                        Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_PLATFORM_PART_OF_HIGHWAY);
     76                                        builder.message(tr("PT: Platform should not be part of a way"));
     77                                        builder.primitives(primitives);
     78                                        TestError e = builder.build();
     79                                        errors.add(e);
     80                                        return;
     81                                }
     82                        }
     83                }
     84        }
    8185
    82     /**
    83      * Checks if the given stop_position node belongs to any stop_area relation
    84      * @author xamanu
    85      */
    86     protected void performNodePartOfStopAreaTest() {
     86        /**
     87         * Checks if the given stop_position node belongs to any stop_area relation
     88         *
     89         * @author xamanu
     90         */
     91        protected void performNodePartOfStopAreaTest() {
    8792
    88         if (!StopUtils.verifyIfMemberOfStopArea(node)) {
     93                if (!StopUtils.verifyIfMemberOfStopArea(node)) {
    8994
    90             List<OsmPrimitive> primitives = new ArrayList<>(1);
    91             primitives.add(node);
    92             TestError e = new TestError(this.test, Severity.WARNING,
    93                     tr("PT: Stop position or platform is not part of a stop area relation"),
    94                     PTAssistantValidatorTest.ERROR_CODE_NOT_PART_OF_STOP_AREA, primitives);
    95             errors.add(e);
    96         }
    97     }
     95                        List<OsmPrimitive> primitives = new ArrayList<>(1);
     96                        primitives.add(node);
     97                        Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_NOT_PART_OF_STOP_AREA);
     98                        builder.message(tr("PT: Stop position or platform is not part of a stop area relation"));
     99                        builder.primitives(primitives);
     100                        TestError e = builder.build();
     101                        errors.add(e);
     102                }
     103        }
    98104
    99     /**
    100      * Fixes errors: solitary stop position and platform which is part of a way.
    101      * Asks the user first.
    102      *
    103      * @param testError test error
    104      * @return fix command
    105      */
    106     protected static Command fixError(TestError testError) {
     105        /**
     106         * Fixes errors: solitary stop position and platform which is part of a way.
     107         * Asks the user first.
     108         *
     109         * @param testError
     110         *            test error
     111         * @return fix command
     112         */
     113        protected static Command fixError(TestError testError) {
    107114
    108         if (testError.getCode() != PTAssistantValidatorTest.ERROR_CODE_SOLITARY_STOP_POSITION
    109                 && testError.getCode() != PTAssistantValidatorTest.ERROR_CODE_PLATFORM_PART_OF_HIGHWAY) {
    110             return null;
    111         }
     115                if (testError.getCode() != PTAssistantValidatorTest.ERROR_CODE_SOLITARY_STOP_POSITION
     116                                && testError.getCode() != PTAssistantValidatorTest.ERROR_CODE_PLATFORM_PART_OF_HIGHWAY) {
     117                        return null;
     118                }
    112119
    113         Node problematicNode = (Node) testError.getPrimitives().iterator().next();
     120                Node problematicNode = (Node) testError.getPrimitives().iterator().next();
    114121
    115         final int[] userSelection = {JOptionPane.YES_OPTION};
    116         final TestError errorParameter = testError;
    117         if (SwingUtilities.isEventDispatchThread()) {
     122                final int[] userSelection = { JOptionPane.YES_OPTION };
     123                final TestError errorParameter = testError;
     124                if (SwingUtilities.isEventDispatchThread()) {
    118125
    119             userSelection[0] = showFixNodeTagDialog(errorParameter);
     126                        userSelection[0] = showFixNodeTagDialog(errorParameter);
    120127
    121         } else {
     128                } else {
    122129
    123             try {
    124                 SwingUtilities.invokeAndWait(new Runnable() {
    125                     @Override
    126                     public void run() {
    127                         userSelection[0] = showFixNodeTagDialog(errorParameter);
    128                     }
    129                 });
    130             } catch (InvocationTargetException | InterruptedException e) {
    131                 e.printStackTrace();
    132                 return null;
    133             }
    134         }
     130                        try {
     131                                SwingUtilities.invokeAndWait(new Runnable() {
     132                                        @Override
     133                                        public void run() {
     134                                                userSelection[0] = showFixNodeTagDialog(errorParameter);
     135                                        }
     136                                });
     137                        } catch (InvocationTargetException | InterruptedException e) {
     138                                e.printStackTrace();
     139                                return null;
     140                        }
     141                }
    135142
    136         if (userSelection[0] == JOptionPane.YES_OPTION) {
     143                if (userSelection[0] == JOptionPane.YES_OPTION) {
    137144
    138             Node modifiedNode = new Node(problematicNode);
    139             if (testError.getCode() == PTAssistantValidatorTest.ERROR_CODE_SOLITARY_STOP_POSITION) {
    140                 modifiedNode.put("public_transport", "platform");
    141                 ChangeCommand command = new ChangeCommand(problematicNode, modifiedNode);
    142                 return command;
    143             } else {
    144                 modifiedNode.put("public_transport", "stop_position");
    145                 ChangeCommand command = new ChangeCommand(problematicNode, modifiedNode);
    146                 return command;
    147             }
    148         }
     145                        Node modifiedNode = new Node(problematicNode);
     146                        if (testError.getCode() == PTAssistantValidatorTest.ERROR_CODE_SOLITARY_STOP_POSITION) {
     147                                modifiedNode.put("public_transport", "platform");
     148                                ChangeCommand command = new ChangeCommand(problematicNode, modifiedNode);
     149                                return command;
     150                        } else {
     151                                modifiedNode.put("public_transport", "stop_position");
     152                                ChangeCommand command = new ChangeCommand(problematicNode, modifiedNode);
     153                                return command;
     154                        }
     155                }
    149156
    150         return null;
     157                return null;
    151158
    152     }
     159        }
    153160
    154     private static int showFixNodeTagDialog(TestError e) {
    155         Node problematicNode = (Node) e.getPrimitives().iterator().next();
    156         // Main.map.mapView.zoomTo(problematicNode.getCoor());
    157         // zoom to problem:
    158         Collection<OsmPrimitive> primitives = new ArrayList<>(1);
    159         primitives.add(problematicNode);
    160         AutoScaleAction.zoomTo(primitives);
     161        private static int showFixNodeTagDialog(TestError e) {
     162                Node problematicNode = (Node) e.getPrimitives().iterator().next();
     163                // Main.map.mapView.zoomTo(problematicNode.getCoor());
     164                // zoom to problem:
     165                Collection<OsmPrimitive> primitives = new ArrayList<>(1);
     166                primitives.add(problematicNode);
     167                AutoScaleAction.zoomTo(primitives);
    161168
    162         String[] options = {tr("Yes"), tr("No")};
    163         String message;
    164         if (e.getCode() == PTAssistantValidatorTest.ERROR_CODE_SOLITARY_STOP_POSITION) {
    165             message = "Do you want to change the tag public_transport=stop_position to public_transport=platform?";
    166         } else {
    167             message = "Do you want to change the tag public_transport=platform to public_transport=stop_position?";
    168         }
    169         return JOptionPane.showOptionDialog(null, message, tr("PT_Assistant Message"), JOptionPane.YES_NO_OPTION,
    170                 JOptionPane.QUESTION_MESSAGE, null, options, 0);
    171     }
     169                String[] options = { tr("Yes"), tr("No") };
     170                String message;
     171                if (e.getCode() == PTAssistantValidatorTest.ERROR_CODE_SOLITARY_STOP_POSITION) {
     172                        message = "Do you want to change the tag public_transport=stop_position to public_transport=platform?";
     173                } else {
     174                        message = "Do you want to change the tag public_transport=platform to public_transport=stop_position?";
     175                }
     176                return JOptionPane.showOptionDialog(null, message, tr("PT_Assistant Message"), JOptionPane.YES_NO_OPTION,
     177                                JOptionPane.QUESTION_MESSAGE, null, options, 0);
     178        }
    172179
    173180}
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssistantValidatorTest.java

    r33055 r33082  
    2525import org.openstreetmap.josm.data.validation.Test;
    2626import org.openstreetmap.josm.data.validation.TestError;
     27import org.openstreetmap.josm.data.validation.TestError.Builder;
    2728import org.openstreetmap.josm.plugins.pt_assistant.PTAssistantPlugin;
    2829import org.openstreetmap.josm.plugins.pt_assistant.actions.FixTask;
     
    550551        List<Relation> primitives = new ArrayList<>(1);
    551552        primitives.add(r);
     553        Builder builder = TestError.builder(this, Severity.WARNING, ERROR_CODE_DIRECTION);
     554        builder.message(tr("PT: dummy test warning"));
     555        builder.primitives(primitives);
    552556        errors.add(
    553                 new TestError(this, Severity.WARNING, tr("PT: dummy test warning"), ERROR_CODE_DIRECTION, primitives));
     557                builder.build());
    554558    }
    555559
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/RouteChecker.java

    r33055 r33082  
    1717import org.openstreetmap.josm.data.validation.Test;
    1818import org.openstreetmap.josm.data.validation.TestError;
     19import org.openstreetmap.josm.data.validation.TestError.Builder;
    1920import org.openstreetmap.josm.gui.dialogs.relation.sort.RelationSorter;
    2021import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionType;
     
    6465
    6566            if (!hasGap(sortedMembers)) {
    66                 TestError e = new TestError(this.test, Severity.WARNING,
    67                         tr("PT: Route contains a gap that can be fixed by sorting"),
    68                         PTAssistantValidatorTest.ERROR_CODE_SORTING, relation);
     67                Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_SORTING);
     68                builder.message(tr("PT: Route contains a gap that can be fixed by sorting"));
     69                builder.primitives(relation);
     70                TestError e = builder.build();
    6971                this.errors.add(e);
    7072
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/SegmentChecker.java

    r33055 r33082  
    2626import org.openstreetmap.josm.data.validation.Test;
    2727import org.openstreetmap.josm.data.validation.TestError;
     28import org.openstreetmap.josm.data.validation.TestError.Builder;
    2829import org.openstreetmap.josm.gui.Notification;
    2930import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor;
     
    7071            List<OsmPrimitive> highlighted = new ArrayList<>(1);
    7172            highlighted.add(rm.getMember());
    72             TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Relation member roles do not match tags"),
    73                     PTAssistantValidatorTest.ERROR_CODE_RELAITON_MEMBER_ROLES, primitives, highlighted);
     73            Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_RELAITON_MEMBER_ROLES);
     74            builder.message(tr("PT: Relation member roles do not match tags"));
     75            builder.primitives(primitives);
     76            builder.highlight(highlighted);
     77            TestError e = builder.build();
    7478            this.errors.add(e);
    7579        }
     
    162166                List<OsmPrimitive> highlighted = new ArrayList<>(1);
    163167                highlighted.add(endStop.getPlatform());
    164                 TestError e = new TestError(this.test, Severity.WARNING,
    165                         tr("PT: Route should start and end with a stop_position"),
    166                         PTAssistantValidatorTest.ERROR_CODE_END_STOP, primitives, highlighted);
     168                Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_END_STOP);
     169                builder.message(tr("PT: Route should start and end with a stop_position"));
     170                builder.primitives(primitives);
     171                builder.highlight(highlighted);
     172                TestError e = builder.build();
    167173                this.errors.add(e);
    168174                return;
     
    181187                highlighted.addAll(stopPositionsOfThisRoute);
    182188
    183                 TestError e = new TestError(this.test, Severity.WARNING, tr("PT: First or last way needs to be split"),
    184                         PTAssistantValidatorTest.ERROR_CODE_SPLIT_WAY, primitives, highlighted);
     189                Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_SPLIT_WAY);
     190                builder.message(tr("PT: First or last way needs to be split"));
     191                builder.primitives(primitives);
     192                builder.highlight(highlighted);
     193                TestError e = builder.build();
    185194                this.errors.add(e);
    186195            }
     
    197206                List<OsmPrimitive> highlighted = new ArrayList<>();
    198207                highlighted.add(endStop.getStopPosition());
    199                 TestError e = new TestError(this.test, Severity.WARNING, tr("PT: First or last way needs to be split"),
    200                         PTAssistantValidatorTest.ERROR_CODE_SPLIT_WAY, primitives, highlighted);
     208                Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_SPLIT_WAY);
     209                builder.message(tr("PT: First or last way needs to be split"));
     210                builder.primitives(primitives);
     211                builder.highlight(highlighted);
     212                TestError e = builder.build();
    201213                this.errors.add(e);
    202214            }
     
    284296                    List<OsmPrimitive> highlighted = new ArrayList<>();
    285297                    highlighted.add(startWay);
    286                     TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Problem in the route segment"),
    287                             PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP, primitives, highlighted);
     298                    Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP);
     299                    builder.message(tr("PT: Problem in the route segment"));
     300                    builder.primitives(primitives);
     301                    builder.highlight(highlighted);
     302                    TestError e = builder.build();
    288303                    this.errors.add(e);
    289304                    PTRouteSegment routeSegment = new PTRouteSegment(startStop, endStop, segmentWays, relation);
     
    321336        }
    322337        highlighted.add(stopPrimitive);
    323         TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Stop not served"),
    324                 PTAssistantValidatorTest.ERROR_CODE_STOP_NOT_SERVED, primitives, highlighted);
     338        Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_STOP_NOT_SERVED);
     339        builder.message(tr("PT: Stop not served"));
     340        builder.primitives(primitives);
     341        builder.highlight(highlighted);
     342        TestError e = builder.build();
    325343        this.errors.add(e);
    326344    }
     
    444462                    List<OsmPrimitive> highlighted = new ArrayList<>();
    445463                    highlighted.addAll(current.getWays());
    446                     TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Problem in the route segment"),
    447                             PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP, primitives, highlighted);
     464                    Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP);
     465                    builder.message(tr("PT: Problem in the route segment"));
     466                    builder.primitives(primitives);
     467                    builder.highlight(highlighted);
     468                    TestError e = builder.build();
    448469                    this.errors.add(e);
    449470                    return false;
     
    464485
    465486                    highlighted.addAll(current.getWays());
    466 
    467                     TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Problem in the route segment"),
    468                             PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP, primitives, highlighted);
     487                   
     488                    Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_STOP_BY_STOP);
     489                    builder.message(tr("PT: Problem in the route segment"));
     490                    builder.primitives(primitives);
     491                    builder.highlight(highlighted);
     492                    TestError e = builder.build();
    469493                    this.errors.add(e);
    470494                    return false;
     
    843867        // prepare the variables for the key listener:
    844868        final TestError testErrorParameter = testError;
    845 
    846         // add the key listener:
     869       
     870//        // add the key listener:
    847871        Main.map.mapView.requestFocus();
    848         Main.map.mapView.addKeyListener(new KeyListener() {
    849 
    850             @Override
     872        Main.map.mapView.addKeyListener(new KeyListener() {
     873               
    851874            public void keyTyped(KeyEvent e) {
    852                 // TODO Auto-generated method stub
    853             }
    854 
    855             @Override
     875                 //TODO Auto-generated method stub
     876            }
     877
    856878            public void keyPressed(KeyEvent e) {
    857879                Character typedKey = e.getKeyChar();
     
    869891            }
    870892
    871             @Override
    872893            public void keyReleased(KeyEvent e) {
    873894                // TODO Auto-generated method stub
     
    939960
    940961    }
    941 
     962               
    942963    /**
    943964     * Carries out the fix (i.e. modifies the route) when there is only one fix
     
    963984            });
    964985        }
    965 
     986               
    966987        // wait:
    967988        synchronized (SegmentChecker.class) {
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/StopChecker.java

    r33055 r33082  
    1414import org.openstreetmap.josm.data.validation.Test;
    1515import org.openstreetmap.josm.data.validation.TestError;
     16import org.openstreetmap.josm.data.validation.TestError.Builder;
    1617import org.openstreetmap.josm.plugins.pt_assistant.utils.StopUtils;
    1718
     
    4748        List<OsmPrimitive> primitives = new ArrayList<>(1);
    4849        primitives.add(relation);
    49         TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Stop area relation has no stop position"),
    50                 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_NO_STOPS, primitives);
     50        Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_NO_STOPS);
     51        builder.message(tr("PT: Stop area relation has no stop position"));
     52        builder.primitives(primitives);
     53        TestError e = builder.build();
    5154        errors.add(e);
    5255    }
     
    6770        List<OsmPrimitive> primitives = new ArrayList<>(1);
    6871        primitives.add(relation);
    69         TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Stop area relation has no platform"),
    70                 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_NO_PLATFORM, primitives);
     72        Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_NO_PLATFORM);
     73        builder.message(tr("PT: Stop area relation has no platform"));
     74        builder.primitives(primitives);
     75        TestError e = builder.build();
    7176        errors.add(e);
    7277
     
    121126        List<OsmPrimitive> primitives = new ArrayList<>(1);
    122127        primitives.add(relation);
    123         TestError e = new TestError(this.test, Severity.WARNING,
    124                 tr("PT: Route relations of stop position(s) and platform(s) of stop area members diverge"),
    125                 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_COMPARE_RELATIONS, primitives);
     128        Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_COMPARE_RELATIONS);
     129        builder.message(tr("PT: Route relations of stop position(s) and platform(s) of stop area members diverge"));
     130        builder.primitives(primitives);
     131        TestError e = builder.build();
    126132        errors.add(e);
    127133    }
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/WayChecker.java

    r33055 r33082  
    2121import org.openstreetmap.josm.data.validation.Test;
    2222import org.openstreetmap.josm.data.validation.TestError;
     23import org.openstreetmap.josm.data.validation.TestError.Builder;
    2324import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
    2425
     
    114115                    List<Way> highlighted = new ArrayList<>(1);
    115116                    highlighted.add(way);
    116                     TestError e = new TestError(this.test, Severity.WARNING,
    117                             tr("PT: Route type does not match the type of the road it passes on"),
    118                             PTAssistantValidatorTest.ERROR_CODE_ROAD_TYPE, primitives, highlighted);
     117                    Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_ROAD_TYPE);
     118                    builder.message(tr("PT: Route type does not match the type of the road it passes on"));
     119                    builder.primitives(primitives);
     120                    builder.highlight(highlighted);
     121                    TestError e = builder.build();
    119122                    errors.add(e);
    120123
     
    126129                    List<Way> highlighted = new ArrayList<>(1);
    127130                    highlighted.add(way);
    128                     TestError e = new TestError(this.test, Severity.WARNING, tr("PT: Road is under construction"),
    129                             PTAssistantValidatorTest.ERROR_CODE_CONSTRUCTION, primitives, highlighted);
     131                    Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_CONSTRUCTION);
     132                    builder.message(tr("PT: Road is under construction"));
     133                    builder.primitives(primitives);
     134                    builder.highlight(highlighted);
     135                    TestError e = builder.build();
    130136                    errors.add(e);
    131137                }
     
    213219
    214220        for (Set<Way> currentSet : listOfSets) {
    215             TestError e = new TestError(this.test, Severity.WARNING,
    216                     tr("PT: Route passes a oneway road in the wrong direction"),
    217                     PTAssistantValidatorTest.ERROR_CODE_DIRECTION, primitives, currentSet);
     221            Builder builder = TestError.builder(this.test, Severity.WARNING, PTAssistantValidatorTest.ERROR_CODE_DIRECTION);
     222            builder.message(tr("PT: Route passes a oneway road in the wrong direction"));
     223            builder.primitives(primitives);
     224            builder.highlight(currentSet);
     225            TestError e = builder.build();
    218226            this.errors.add(e);
    219227        }
Note: See TracChangeset for help on using the changeset viewer.