Ignore:
Timestamp:
2016-08-16T14:03:50+02:00 (9 years ago)
Author:
xamanu
Message:

Allowing multiple stop positions and platforms in stop area checks

Location:
applications/editors/josm/plugins/pt_assistant/test
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pt_assistant/test/data/stop-area-relations.osm

    r32783 r32822  
    11<?xml version='1.0' encoding='UTF-8'?>
    22<osm version='0.6' upload='true' generator='JOSM'>
    3   <node id='-60958' action='modify' visible='true' lat='12.12569675765' lon='-86.28455907163'>
     3  <node id='-55' action='modify' visible='true' lat='12.12569675765' lon='-86.28455907163'>
    44    <tag k='bus' v='yes' />
    55    <tag k='public_transport' v='stop_position' />
    66  </node>
    7   <node id='-60960' action='modify' visible='true' lat='12.12574315765' lon='-86.28459437163'>
     7  <node id='-57' action='modify' visible='true' lat='12.12574315765' lon='-86.28459437163'>
    88    <tag k='bus' v='yes' />
    99    <tag k='public_transport' v='platform' />
    1010  </node>
    11   <node id='-60966' action='modify' visible='true' lat='12.12586275765' lon='-86.28635997163' />
    12   <node id='-60968' action='modify' visible='true' lat='12.12586605765' lon='-86.28641487163' />
    13   <node id='-60970' action='modify' visible='true' lat='12.12592805765' lon='-86.28729767163' />
    14   <node id='-60972' action='modify' visible='true' lat='12.12598865765' lon='-86.28844557163' />
    15   <node id='-60974' action='modify' visible='true' lat='12.12599975765' lon='-86.28875027163'>
     11  <node id='-59' action='modify' visible='true' lat='12.12586275765' lon='-86.28635997163' />
     12  <node id='-61' action='modify' visible='true' lat='12.12586605765' lon='-86.28641487163' />
     13  <node id='-63' action='modify' visible='true' lat='12.12592805765' lon='-86.28729767163' />
     14  <node id='-65' action='modify' visible='true' lat='12.12598865765' lon='-86.28844557163' />
     15  <node id='-67' action='modify' visible='true' lat='12.12599975765' lon='-86.28875027163'>
    1616    <tag k='highway' v='traffic_signals' />
    1717  </node>
    18   <node id='-60976' action='modify' visible='true' lat='12.12602745765' lon='-86.29081977163' />
    19   <node id='-60978' action='modify' visible='true' lat='12.12603135765' lon='-86.29160537163' />
    20   <node id='-60980' action='modify' visible='true' lat='12.12603245765' lon='-86.29184287163'>
     18  <node id='-69' action='modify' visible='true' lat='12.12602745765' lon='-86.29081977163' />
     19  <node id='-71' action='modify' visible='true' lat='12.12603135765' lon='-86.29160537163' />
     20  <node id='-73' action='modify' visible='true' lat='12.12603245765' lon='-86.29184287163'>
    2121    <tag k='highway' v='traffic_signals' />
    2222  </node>
    23   <node id='-60997' action='modify' visible='true' lat='12.12605336295' lon='-86.29221374917'>
     23  <node id='-75' action='modify' visible='true' lat='12.12605336295' lon='-86.29221374917'>
    2424    <tag k='bus' v='yes' />
    2525    <tag k='public_transport' v='stop_position' />
    2626  </node>
    27   <node id='-61002' visible='true' lat='12.1261061435' lon='-86.2922353432'>
     27  <node id='-77' visible='true' lat='12.1261061435' lon='-86.2922353432'>
    2828    <tag k='bus' v='yes' />
    2929    <tag k='public_transport' v='platform' />
    3030  </node>
    31   <way id='-60982' action='modify' visible='true'>
    32     <nd ref='-60958' />
    33     <nd ref='-60966' />
    34     <nd ref='-60968' />
    35     <nd ref='-60970' />
    36     <nd ref='-60972' />
    37     <nd ref='-60974' />
     31  <way id='-79' action='modify' visible='true'>
     32    <nd ref='-55' />
     33    <nd ref='-59' />
     34    <nd ref='-61' />
     35    <nd ref='-63' />
     36    <nd ref='-65' />
     37    <nd ref='-67' />
    3838    <tag k='highway' v='primary' />
    3939    <tag k='lanes' v='2' />
     
    4343    <tag k='surface' v='asphalt' />
    4444  </way>
    45   <way id='-63380' action='modify' visible='true'>
    46     <nd ref='-60974' />
    47     <nd ref='-60976' />
    48     <nd ref='-60978' />
    49     <nd ref='-60980' />
    50     <nd ref='-60997' />
     45  <way id='-81' action='modify' visible='true'>
     46    <nd ref='-67' />
     47    <nd ref='-69' />
     48    <nd ref='-71' />
     49    <nd ref='-73' />
     50    <nd ref='-75' />
    5151    <tag k='highway' v='primary' />
    5252    <tag k='lanes' v='2' />
     
    5656    <tag k='surface' v='asphalt' />
    5757  </way>
    58   <relation id='-60984' action='modify' visible='true'>
    59     <member type='node' ref='-60958' role='stop' />
    60     <member type='node' ref='-60960' role='platform' />
     58  <relation id='-83' action='modify' visible='true'>
     59    <member type='node' ref='-55' role='stop' />
     60    <member type='node' ref='-57' role='platform' />
    6161    <tag k='name' v='Rotonda El Periodista' />
    6262    <tag k='public_transport' v='stop_area' />
     
    6464    <tag k='type' v='public_transport' />
    6565  </relation>
    66   <relation id='-60986' action='modify' visible='true'>
    67     <member type='node' ref='-60958' role='stop' />
    68     <member type='node' ref='-61002' role='platform' />
    69     <member type='way' ref='-60982' role='' />
    70     <member type='way' ref='-63380' role='' />
     66  <relation id='-85' action='modify' visible='true'>
     67    <member type='node' ref='-55' role='stop' />
     68    <member type='way' ref='-79' role='' />
     69    <member type='way' ref='-81' role='' />
     70    <member type='node' ref='-75' role='stop' />
    7171    <tag k='bus' v='yes' />
    7272    <tag k='from' v='Cuesta el Plomo' />
     
    7878    <tag k='type' v='route' />
    7979  </relation>
    80   <relation id='-61332' action='modify' visible='true'>
    81     <member type='node' ref='-60997' role='stop' />
    82     <member type='node' ref='-61002' role='platform' />
     80  <relation id='-87' action='modify' visible='true'>
     81    <member type='node' ref='-75' role='stop' />
     82    <member type='node' ref='-77' role='platform' />
    8383    <tag k='name' v='Mercado Oriental' />
    8484    <tag k='public_transport' v='stop_area' />
  • applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/StopCheckerTest.java

    r32783 r32822  
    3333                Assert.assertEquals(nodeChecker.getErrors().size(), 1);
    3434                Assert.assertEquals(nodeChecker.getErrors().get(0).getCode(),
    35                                 PTAssistantValidatorTest.ERROR_CODE_NODE_PART_OF_STOP_AREA);
     35                                PTAssistantValidatorTest.ERROR_CODE_NOT_PART_OF_STOP_AREA);
    3636        }
    3737       
     
    3939
    4040        @Test
    41         public void stopPositionComparePlatformRelations() {
     41        public void stopAreaRelationsTest() {
    4242               
    4343                // Check if stop positions belong the same routes as related platform(s)
     
    4646                DataSet ds = ImportUtils.importOsmFile(file, "testLayer");
    4747                PTAssistantValidatorTest test = new PTAssistantValidatorTest();
    48                 Node node = null;
     48                Relation stopArea = null;
    4949               
    50                 for (Node n : ds.getNodes()) {
    51                         if (n.hasTag("public_transport", "stop_position")) {
    52                                 node = n;
     50                for (Relation r : ds.getRelations()) {
     51                        if (r.hasTag("public_transport", "stop_area")) {
     52                                stopArea = r;
    5353                        }
    5454                }
    5555               
    56                 NodeChecker nodeChecker = new NodeChecker(node, test);
    57                 nodeChecker.performStopPositionComparePlatformRelations();
    58                 Assert.assertEquals(nodeChecker.getErrors().size(), 1);
    59                 Assert.assertEquals(nodeChecker.getErrors().get(0).getCode(),
    60                                 PTAssistantValidatorTest.ERROR_CODE_STOP_POSITION_COMPARE_RELATIONS);
    61                        
     56                StopChecker stopChecker = new StopChecker(stopArea, test);
     57                stopChecker.performStopAreaRelationsTest();
     58                Assert.assertEquals(stopChecker.getErrors().size(), 1);
     59                Assert.assertEquals(stopChecker.getErrors().get(0).getCode(),
     60                                PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_COMPARE_RELATIONS);               
    6261        }
    6362       
     
    6665        public void stopAreaStopPositionTest() {
    6766               
    68                 // Check if stop area relation has one stop position.
     67                // Check if stop area relation has at least one stop position.
    6968               
    7069                File file = new File(AbstractTest.PATH_TO_STOP_AREA_NO_STOPS);
     
    8786        }
    8887       
    89         @Test
    90         public void stopAreaMultiStopPositionTest() {
    91                
    92                 // Check if stop area relation has more than one stop position.
    93                
    94                 File file = new File(AbstractTest.PATH_TO_STOP_AREA_MANY_STOPS);
    95                 DataSet ds = ImportUtils.importOsmFile(file, "testLayer");
    96                 PTAssistantValidatorTest test = new PTAssistantValidatorTest();
    97                 Relation stopArea = null;
    98 
    99                 for (Relation r : ds.getRelations()) {
    100                         if (r.hasTag("public_transport", "stop_area")) {
    101                                 stopArea = r;
    102                         }
    103                 }
    104 
    105                 StopChecker stopChecker = new StopChecker(stopArea, test);
    106                 stopChecker.performStopAreaMultiStopPositionTest();
    107                 Assert.assertEquals(stopChecker.getErrors().size(), 1);
    108                 Assert.assertEquals(stopChecker.getErrors().get(0).getCode(),
    109                                 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_MANY_STOPS);
    110 
    111         }
    112        
    11388
    11489        @Test
    11590        public void stopAreaPlatformTest() {
    11691               
    117                 // Check if stop area relation has one platform.
     92                // Check if stop area relation has at least one platform.
    11893               
    11994                File file = new File(AbstractTest.PATH_TO_STOP_AREA_NO_PLATFORMS);
     
    135110
    136111        }
    137        
    138         @Test
    139         public void stopAreaMultiPlatformTest() {
    140                
    141                 // Check if stop area relation has more than one stop position.
    142                
    143                 File file = new File(AbstractTest.PATH_TO_STOP_AREA_MANY_PLATFORMS);
    144                 DataSet ds = ImportUtils.importOsmFile(file, "testLayer");
    145                 PTAssistantValidatorTest test = new PTAssistantValidatorTest();
    146                 Relation stopArea = null;
    147 
    148                 for (Relation r : ds.getRelations()) {
    149                         if (r.hasTag("public_transport", "stop_area")) {
    150                                 stopArea = r;
    151                         }
    152                 }
    153 
    154                 StopChecker stopChecker = new StopChecker(stopArea, test);
    155                 stopChecker.performStopAreaMultiPlatformTest();
    156                 Assert.assertEquals(stopChecker.getErrors().size(), 1);
    157                 Assert.assertEquals(stopChecker.getErrors().get(0).getCode(),
    158                                 PTAssistantValidatorTest.ERROR_CODE_STOP_AREA_MANY_PLATFORMS);
    159 
    160         }
    161112
    162113}
Note: See TracChangeset for help on using the changeset viewer.