Changeset 32840 in osm


Ignore:
Timestamp:
2016-08-19T11:22:30+02:00 (8 years ago)
Author:
bwr57
Message:

Bug fixed:

Dublicate points at installing of stop point
Transport type tag is included in stop area properties.

Local networks was renamed to commuter networks
Spanish language was added

Location:
applications/editors/josm/plugins/CustomizePublicTransportStop
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CreateNewStopPointOperation.java

    r32048 r32840  
    112112                                {
    113113                                        nearestNode = node;
    114                                         break;
     114                                        return new AbstractMap.SimpleEntry<Double, Node> (distances[distanceIndex], nearestNode);
    115115                                }
    116116                        }
     
    119119                }
    120120        }
    121         if(nearestNode == null)
    122                 return null;
    123         return new AbstractMap.SimpleEntry<Double, Node> (distances[--distanceIndex], nearestNode);
     121                return null;
    124122    }
    125123
     
    323321                if(nearestNode != null && nearestWaySegment != null)
    324322                {
    325                         if(nearestWaySegment.distanceSq < nearestNode.getKey())
     323                        Double segmentDist = Main.map.mapView.getPoint2D(platformCoord).distanceSq(Main.map.mapView.getPoint2D(nearestWaySegment.newNode));
     324                        Double nodeDistSq =  nearestNode.getKey();
     325//                      nodeDistSq *= nodeDistSq - 2;
     326                        if(segmentDist < nodeDistSq - 2)
    326327                        {
     328//                              MessageBox.ok("new stop node v2 "  + segmentDist.toString() + "   " + nodeDistSq.toString());
    327329                                newStopPointNode = createNodeOnWay(nearestWaySegment.newNode, nearestWaySegment.waySegment);
    328330                        }
    329331                        else
    330332                        {
     333//                              MessageBox.ok("new stop node v3 "  + segmentDist.toString() + "   " + nodeDistSq.toString());
    331334                                newStopPointNode = nearestNode.getValue();
    332335                        }
     
    340343                                if(nearestNode == null && nearestWaySegment != null)
    341344                                {
     345//                                      MessageBox.ok("new stop node2");
    342346                                        newStopPointNode = createNodeOnWay(nearestWaySegment.newNode, nearestWaySegment.waySegment);
    343347                                }
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CreateStopAreaFromSelectedObjectOperation.java

    r32048 r32840  
    4444                if(stopArea.service == null)
    4545                        stopArea.service = getTagValue(member, OSMTags.SERVICE_TAG);
     46                if(OSMTags.LOCAL_NETWORK_TAG_VALUE.equals(stopArea.service))
     47                        stopArea.service = OSMTags.COMMUTER_NETWORK_TAG_VALUE;
    4648                if(compareTag(member, OSMTags.BUS_TAG, OSMTags.YES_TAG_VALUE))
    4749                        stopArea.isBus = true;
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CustomizePublicTransportStopDialog.java

    r32048 r32840  
    5757        public static final String LONG_DISTANCE_NETWORK_CAPTION = "Long distance";
    5858        public static final String REGIONAL_NETWORK_CAPTION = "Regional";
    59         public static final String LOCAL_NETWORK_CAPTION = "Local";
     59        public static final String COMMUTER_NETWORK_CAPTION = "Commuter";
    6060        public static final String CITY_NETWORK_CAPTION = "City transport";
    6161        public static final String HIGH_SPEED_NETWORK_CAPTION = "High speed";
    6262       
    63         private String[] serviceCaptionStrings = { CITY_NETWORK_CAPTION, LOCAL_NETWORK_CAPTION, REGIONAL_NETWORK_CAPTION, LONG_DISTANCE_NETWORK_CAPTION, HIGH_SPEED_NETWORK_CAPTION };
    64     private String[] serviceStrings = { OSMTags.CITY_NETWORK_TAG_VALUE, OSMTags.LOCAL_NETWORK_TAG_VALUE,
     63        private String[] serviceCaptionStrings = { CITY_NETWORK_CAPTION, COMMUTER_NETWORK_CAPTION, REGIONAL_NETWORK_CAPTION, LONG_DISTANCE_NETWORK_CAPTION, HIGH_SPEED_NETWORK_CAPTION };
     64    private String[] serviceStrings = { OSMTags.CITY_NETWORK_TAG_VALUE, OSMTags.COMMUTER_NETWORK_TAG_VALUE,
    6565                                                                        OSMTags.REGIONAL_NETWORK_TAG_VALUE, OSMTags.LONG_DISTANCE_NETWORK_TAG_VALUE, OSMTags.HIGH_SPEED_NETWORK_TAG_VALUE };
    6666
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CustomizeStopAction.java

    r32441 r32840  
    7676                if (!isEnabled())
    7777                        return;
    78                 CreateStopAreaFromSelectedObjectOperation createStopAreaFromSelectedObjectOperation = new CreateStopAreaFromSelectedObjectOperation(
    79                         getLayerManager().getEditDataSet());
     78                CreateStopAreaFromSelectedObjectOperation createStopAreaFromSelectedObjectOperation = new CreateStopAreaFromSelectedObjectOperation(getLayerManager().getEditDataSet());
    8079                StopArea stopArea = createStopAreaFromSelectedObjectOperation.performCustomizing(null);
    8180                if(stopArea == null)
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CustomizeStopAreaOperation.java

    r32048 r32840  
    5959       
    6060    /**
     61     * Clear transport type tags
     62     * @param target Josm object for tag clearing
     63     * @param commands Command list
     64     * @return Resulting list of commands
     65     */
     66        protected List<Command> transportTypeTagClearing(OsmPrimitive target,
     67                        List<Command> commands) {
     68                commands = clearTag(commands, target, OSMTags.BUS_TAG);
     69                commands = clearTag(commands, target, OSMTags.SHARE_TAXI_TAG);
     70                commands = clearTag(commands, target, OSMTags.TROLLEYBUS_TAG);
     71                commands = clearTag(commands, target, OSMTags.TRAM_TAG);
     72                commands = clearTag(commands, target, OSMTags.TRAIN_TAG);
     73                return commands;
     74        }
     75
     76        /**
    6177     * Assign transport type tags to node
    6278     * @param target Josm object for tag assigning
     
    102118                        else
    103119                        {
    104                         commands = clearTag(commands, target, OSMTags.BUS_TAG);
    105                         commands = clearTag(commands, target, OSMTags.SHARE_TAXI_TAG);
    106                         commands = clearTag(commands, target, OSMTags.TROLLEYBUS_TAG);
    107                         commands = clearTag(commands, target, OSMTags.TRAM_TAG);
    108                         commands = clearTag(commands, target, OSMTags.TRAIN_TAG);               
     120                        commands = transportTypeTagClearing(target, commands);                 
    109121                        }
    110122                }
     
    117129         * @param commands List of commands
    118130         * @param stopArea Stop area object
    119      * @param isStopPoint Flag of stop point
    120131         * @return Resulting list of commands
    121132         */
    122     public List<Command> generalTagAssign(OsmPrimitive target, List<Command> commands, StopArea stopArea, Boolean isStopPoint)
     133    public List<Command> generalTagAssign(OsmPrimitive target, List<Command> commands, StopArea stopArea)
    123134    {
    124135        if(commands == null)
     
    130141        commands = assignTag(commands, target, OSMTags.SERVICE_TAG, null == stopArea.service || OSMTags.CITY_NETWORK_TAG_VALUE.equals(stopArea.service) ? null : stopArea.service);
    131142       
    132         commands = transportTypeTagAssign(target, commands, stopArea, isStopPoint);
    133143        return commands;
    134144    }
     
    148158                commands = new ArrayList<Command>();
    149159       
    150         commands = generalTagAssign(target, commands, stopArea, true);
     160        commands = generalTagAssign(target, commands, stopArea);
     161        commands = transportTypeTagAssign(target, commands, stopArea, true);
    151162        if(isFirst)
    152163        {
     
    192203                commands = new ArrayList<Command>();
    193204       
    194         commands = generalTagAssign(target, commands, stopArea, false);
     205        commands = generalTagAssign(target, commands, stopArea);
     206        commands = transportTypeTagAssign(target, commands, stopArea, false);
    195207       
    196208        if(compareTag(target, OSMTags.RAILWAY_TAG, OSMTags.HALT_TAG_VALUE) || compareTag(target, OSMTags.RAILWAY_TAG, OSMTags.STATION_TAG_VALUE))
     
    263275                }
    264276                Main.main.undoRedo.add(new AddCommand(newRelation));
    265                 commands = generalTagAssign(newRelation, commands, stopArea, false);
     277                commands = generalTagAssign(newRelation, commands, stopArea);
    266278                commands = assignTag(commands, newRelation, OSMTags.TYPE_TAG, OSMTags.PUBLIC_TRANSPORT_TAG);
    267279                commands = assignTag(commands, newRelation, OSMTags.PUBLIC_TRANSPORT_TAG, OSMTags.STOP_AREA_TAG_VALUE);
     
    581593                        else
    582594                        {
    583                                 commands = generalTagAssign(stopArea.stopAreaRelation, commands, stopArea, false);
     595                                commands = generalTagAssign(stopArea.stopAreaRelation, commands, stopArea);
     596                                commands = transportTypeTagClearing(stopArea.stopAreaRelation, commands);
    584597                                commands = addNewRelationMembers(commands, stopArea);
    585598                        }
  • applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/OSMTags.java

    r32048 r32840  
    5959
    6060        public static final String CITY_NETWORK_TAG_VALUE = "city";
     61        public static final String COMMUTER_NETWORK_TAG_VALUE = "commuter";
    6162        public static final String LOCAL_NETWORK_TAG_VALUE = "local";
    6263        public static final String REGIONAL_NETWORK_TAG_VALUE = "regional";
Note: See TracChangeset for help on using the changeset viewer.