Ignore:
Timestamp:
2016-06-17T01:19:57+02:00 (8 years ago)
Author:
darya
Message:

Data model added

Location:
applications/editors/josm/plugins/pt_assistant
Files:
10 added
10 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java

    r32277 r32296  
    6666                if (rm.getType().equals(OsmPrimitiveType.RELATION)) {
    6767                        if (rm.getRole().equals("stop_area")) {
     68                                return true;
     69                        } else if (rm.getRole().equals("platform") || rm.getRole().equals("platform_entry_only") || rm.getRole().equals("platform_exit_only")){
    6870                                return true;
    6971                        } else {
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/StopToWayAssigner.java

    r32230 r32296  
    1111import org.openstreetmap.josm.data.osm.Way;
    1212
     13/**
     14 * Assigns stops to ways in following steps: (1) checks if the stop is in the
     15 * list of already assigned stops, (2) checks if the stop has a stop position,
     16 * (3) calculates it using proximity / growing bounding boxes
     17 *
     18 * @author darya
     19 *
     20 */
    1321public final class StopToWayAssigner {
    1422
     
    2331                        return stopToWay.get(stop.getId());
    2432                }
    25                
    2633
    27                
    28                
    2934                if (stop.getType().equals(OsmPrimitiveType.NODE)) {
    3035                        List<OsmPrimitive> referrers = stop.getReferrers();
    3136                        List<Way> referredWays = new ArrayList<>();
    32                         for (OsmPrimitive referrer: referrers) {
     37                        for (OsmPrimitive referrer : referrers) {
    3338                                if (referrer.getType().equals(OsmPrimitiveType.WAY)) {
    34                                         referredWays.add((Way)referrer);
     39                                        referredWays.add((Way) referrer);
    3540                                }
    3641                        }
     
    4550                return null;
    4651        }
    47        
     52
    4853        /**
    4954         * Remove a map entry
     55         *
    5056         * @param stopId
    5157         */
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/RouteChecker.java

    r32274 r32296  
    1919import org.openstreetmap.josm.plugins.pt_assistant.utils.RouteUtils;
    2020
    21 public class RouteChecker {
     21/**
     22 * Performs tests of a route at the level of the whole route: sorting test
     23 *
     24 * @author darya
     25 *
     26 */
     27public class RouteChecker extends Checker {
    2228
    23         // test which created this WayChecker:
    24         private final Test test;
    25 
    26         // relation that is checked:
    27         private Relation relation;
    28 
    29         // stores all found errors (on way level):
    30         private ArrayList<TestError> errors = new ArrayList<>();
    31        
    3229        private boolean hasGap;
    3330
    3431        List<RelationMember> sortedMembers;
    3532
    36         public RouteChecker(Relation r, Test t) {
     33        public RouteChecker(Relation relation, Test test) {
    3734
    38                 this.test = t;
    39                 this.relation = r;
    40                
     35                super(relation, test);
     36
    4137                this.hasGap = false;
    4238
     
    6056
    6157                if (hasGap(waysToCheck)) {
    62                        
     58
    6359                        this.hasGap = true;
    64                        
     60
    6561                        RelationSorter sorter = new RelationSorter();
    6662                        sortedMembers = sorter.sortMembers(waysToCheck);
     
    10399        }
    104100
    105         /**
    106          * Returns errors
    107          */
    108         public List<TestError> getErrors() {
    109 
    110                 return errors;
    111         }
    112 
    113101        public List<RelationMember> getSortedMembers() {
    114102
     
    116104
    117105        }
    118        
     106
    119107        public boolean getHasGap() {
    120                
     108
    121109                return this.hasGap;
    122                
     110
    123111        }
    124112
  • applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/WayChecker.java

    r32277 r32296  
    1919
    2020/**
    21  * Performs the DirectionTest and RoadTypeTest at the level of single ways
     21 * Performs tests of a route at the level of single ways: DirectionTest and RoadTypeTest
    2222 *
    2323 * @author darya
    2424 *
    2525 */
    26 public class WayChecker {
     26public class WayChecker extends Checker {
    2727
    28         // test which created this WayChecker:
    29         private final Test test;
     28        public WayChecker(Relation relation, Test test) {
    3029
    31         // relation that is checked:
    32         private Relation relation;
    33 
    34         // stores all found errors (on way level):
    35         private ArrayList<TestError> errors = new ArrayList<>();
    36 
    37         // stores all ways that were found wrong and need to be removed:
    38         private ArrayList<Way> wrongWays = new ArrayList<>();
    39 
    40         public WayChecker(Relation r, Test test) {
    41 
    42                 this.test = test;
    43                 this.relation = r;
     30                super(relation, test);
    4431
    4532                this.performDirectionTest();
     
    160147        }
    161148
    162         public List<TestError> getErrors() {
    163 
    164                 return errors;
    165         }
    166 
    167149        /**
    168150         * Checks if the type of the way is suitable for buses to go on it. The
  • applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/AbstractTest.java

    r32261 r32296  
    1 package org.openstreetmap.josm.plugins.pt_assistant;
     1package unit.org.openstreetmap.josm.plugins.pt_assistant;
    22
    33import org.junit.BeforeClass;
     
    3636 public static final String PATH_TO_PLATFORM_AS_WAY = "test/data/route-with-platform-as-way.osm";
    3737 
     38 public static final String PATH_TO_ROUNDABOUT_ONEWAY = "test/data/duesseldorf_roundabout.osm";
     39 
     40 public static final String PATH_TO_ROAD_TYPE_ERROR = "test/data/road-type.osm";
    3841 
    3942 
  • applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/ImportUtils.java

    r32261 r32296  
    1 package org.openstreetmap.josm.plugins.pt_assistant;
     1package unit.org.openstreetmap.josm.plugins.pt_assistant;
    22
    33/**
  • applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/TestUtil.java

    r32261 r32296  
    1 package org.openstreetmap.josm.plugins.pt_assistant;
     1package unit.org.openstreetmap.josm.plugins.pt_assistant;
    22
    33import static org.junit.Assert.assertEquals;
  • applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/GapTestTest.java

    r32261 r32296  
    1 package org.openstreetmap.josm.plugins.pt_assistant.validation;
     1package unit.org.openstreetmap.josm.plugins.pt_assistant.validation;
    22
    33import static org.junit.Assert.assertEquals;
     
    1212import org.openstreetmap.josm.plugins.pt_assistant.validation.GapTest;
    1313
    14 import org.openstreetmap.josm.plugins.pt_assistant.AbstractTest;
    15 import org.openstreetmap.josm.plugins.pt_assistant.ImportUtils;
     14import unit.org.openstreetmap.josm.plugins.pt_assistant.AbstractTest;
     15import unit.org.openstreetmap.josm.plugins.pt_assistant.ImportUtils;
    1616
    1717public class GapTestTest extends AbstractTest {
  • applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/PlatformAsWayTest.java

    r32261 r32296  
    1 package org.openstreetmap.josm.plugins.pt_assistant.validation;
     1package unit.org.openstreetmap.josm.plugins.pt_assistant.validation;
    22
    33import static org.junit.Assert.assertEquals;
     
    1212import org.openstreetmap.josm.plugins.pt_assistant.validation.GapTest;
    1313
    14 import org.openstreetmap.josm.plugins.pt_assistant.AbstractTest;
    15 import org.openstreetmap.josm.plugins.pt_assistant.ImportUtils;
     14import unit.org.openstreetmap.josm.plugins.pt_assistant.AbstractTest;
     15import unit.org.openstreetmap.josm.plugins.pt_assistant.ImportUtils;
    1616
    1717public class PlatformAsWayTest extends AbstractTest{
  • applications/editors/josm/plugins/pt_assistant/test/unit/org/openstreetmap/josm/plugins/pt_assistant/validation/PlatformsFirstTestTest.java

    r32261 r32296  
    1 package org.openstreetmap.josm.plugins.pt_assistant.validation;
     1package unit.org.openstreetmap.josm.plugins.pt_assistant.validation;
    22
    33import static org.junit.Assert.assertEquals;
     
    1212import org.openstreetmap.josm.plugins.pt_assistant.validation.PlatformsFirstTest;
    1313
    14 import org.openstreetmap.josm.plugins.pt_assistant.AbstractTest;
    15 import org.openstreetmap.josm.plugins.pt_assistant.ImportUtils;
     14import unit.org.openstreetmap.josm.plugins.pt_assistant.AbstractTest;
     15import unit.org.openstreetmap.josm.plugins.pt_assistant.ImportUtils;
    1616
    1717public class PlatformsFirstTestTest extends AbstractTest {
Note: See TracChangeset for help on using the changeset viewer.