Changeset 32840 in osm for applications/editors/josm/plugins/CustomizePublicTransportStop
- Timestamp:
- 2016-08-19T11:22:30+02:00 (8 years ago)
- 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 112 112 { 113 113 nearestNode = node; 114 break;114 return new AbstractMap.SimpleEntry<Double, Node> (distances[distanceIndex], nearestNode); 115 115 } 116 116 } … … 119 119 } 120 120 } 121 if(nearestNode == null) 122 return null; 123 return new AbstractMap.SimpleEntry<Double, Node> (distances[--distanceIndex], nearestNode); 121 return null; 124 122 } 125 123 … … 323 321 if(nearestNode != null && nearestWaySegment != null) 324 322 { 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) 326 327 { 328 // MessageBox.ok("new stop node v2 " + segmentDist.toString() + " " + nodeDistSq.toString()); 327 329 newStopPointNode = createNodeOnWay(nearestWaySegment.newNode, nearestWaySegment.waySegment); 328 330 } 329 331 else 330 332 { 333 // MessageBox.ok("new stop node v3 " + segmentDist.toString() + " " + nodeDistSq.toString()); 331 334 newStopPointNode = nearestNode.getValue(); 332 335 } … … 340 343 if(nearestNode == null && nearestWaySegment != null) 341 344 { 345 // MessageBox.ok("new stop node2"); 342 346 newStopPointNode = createNodeOnWay(nearestWaySegment.newNode, nearestWaySegment.waySegment); 343 347 } -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CreateStopAreaFromSelectedObjectOperation.java
r32048 r32840 44 44 if(stopArea.service == null) 45 45 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; 46 48 if(compareTag(member, OSMTags.BUS_TAG, OSMTags.YES_TAG_VALUE)) 47 49 stopArea.isBus = true; -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CustomizePublicTransportStopDialog.java
r32048 r32840 57 57 public static final String LONG_DISTANCE_NETWORK_CAPTION = "Long distance"; 58 58 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"; 60 60 public static final String CITY_NETWORK_CAPTION = "City transport"; 61 61 public static final String HIGH_SPEED_NETWORK_CAPTION = "High speed"; 62 62 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, 65 65 OSMTags.REGIONAL_NETWORK_TAG_VALUE, OSMTags.LONG_DISTANCE_NETWORK_TAG_VALUE, OSMTags.HIGH_SPEED_NETWORK_TAG_VALUE }; 66 66 -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CustomizeStopAction.java
r32441 r32840 76 76 if (!isEnabled()) 77 77 return; 78 CreateStopAreaFromSelectedObjectOperation createStopAreaFromSelectedObjectOperation = new CreateStopAreaFromSelectedObjectOperation( 79 getLayerManager().getEditDataSet()); 78 CreateStopAreaFromSelectedObjectOperation createStopAreaFromSelectedObjectOperation = new CreateStopAreaFromSelectedObjectOperation(getLayerManager().getEditDataSet()); 80 79 StopArea stopArea = createStopAreaFromSelectedObjectOperation.performCustomizing(null); 81 80 if(stopArea == null) -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/CustomizeStopAreaOperation.java
r32048 r32840 59 59 60 60 /** 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 /** 61 77 * Assign transport type tags to node 62 78 * @param target Josm object for tag assigning … … 102 118 else 103 119 { 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); 109 121 } 110 122 } … … 117 129 * @param commands List of commands 118 130 * @param stopArea Stop area object 119 * @param isStopPoint Flag of stop point120 131 * @return Resulting list of commands 121 132 */ 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) 123 134 { 124 135 if(commands == null) … … 130 141 commands = assignTag(commands, target, OSMTags.SERVICE_TAG, null == stopArea.service || OSMTags.CITY_NETWORK_TAG_VALUE.equals(stopArea.service) ? null : stopArea.service); 131 142 132 commands = transportTypeTagAssign(target, commands, stopArea, isStopPoint);133 143 return commands; 134 144 } … … 148 158 commands = new ArrayList<Command>(); 149 159 150 commands = generalTagAssign(target, commands, stopArea, true); 160 commands = generalTagAssign(target, commands, stopArea); 161 commands = transportTypeTagAssign(target, commands, stopArea, true); 151 162 if(isFirst) 152 163 { … … 192 203 commands = new ArrayList<Command>(); 193 204 194 commands = generalTagAssign(target, commands, stopArea, false); 205 commands = generalTagAssign(target, commands, stopArea); 206 commands = transportTypeTagAssign(target, commands, stopArea, false); 195 207 196 208 if(compareTag(target, OSMTags.RAILWAY_TAG, OSMTags.HALT_TAG_VALUE) || compareTag(target, OSMTags.RAILWAY_TAG, OSMTags.STATION_TAG_VALUE)) … … 263 275 } 264 276 Main.main.undoRedo.add(new AddCommand(newRelation)); 265 commands = generalTagAssign(newRelation, commands, stopArea , false);277 commands = generalTagAssign(newRelation, commands, stopArea); 266 278 commands = assignTag(commands, newRelation, OSMTags.TYPE_TAG, OSMTags.PUBLIC_TRANSPORT_TAG); 267 279 commands = assignTag(commands, newRelation, OSMTags.PUBLIC_TRANSPORT_TAG, OSMTags.STOP_AREA_TAG_VALUE); … … 581 593 else 582 594 { 583 commands = generalTagAssign(stopArea.stopAreaRelation, commands, stopArea, false); 595 commands = generalTagAssign(stopArea.stopAreaRelation, commands, stopArea); 596 commands = transportTypeTagClearing(stopArea.stopAreaRelation, commands); 584 597 commands = addNewRelationMembers(commands, stopArea); 585 598 } -
applications/editors/josm/plugins/CustomizePublicTransportStop/src/ru/rodsoft/openstreetmap/josm/plugins/customizepublictransportstop/OSMTags.java
r32048 r32840 59 59 60 60 public static final String CITY_NETWORK_TAG_VALUE = "city"; 61 public static final String COMMUTER_NETWORK_TAG_VALUE = "commuter"; 61 62 public static final String LOCAL_NETWORK_TAG_VALUE = "local"; 62 63 public static final String REGIONAL_NETWORK_TAG_VALUE = "regional";
Note:
See TracChangeset
for help on using the changeset viewer.