Changeset 29505 in osm for applications/editors/josm/plugins/mirrored_download
- Timestamp:
- 2013-04-16T20:18:30+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/mirrored_download
- Files:
-
- 4 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mirrored_download/README
r27678 r29505 1 2 The JOSM Plugin "Public Transport" is designed to simplify the mapping and editing of public transport routes according to the Oxmoa scheme (see USED NOTIONS). In the first section, we will describe how to create a line from scratch. If there exists already one or more lines running partly or completely parallel, you can take advantage of this (see third section). Also, you can easily convert lines from older mapping formats to the Oxmoa scheme (see fourth section). The last section contains a reference of all items in the plugin.3 4 This manual refers to the prototype version of 2010-01-30. This is not even a beta version, so DON'T FORGET TO SAVE YOUR WORK BEFORE you use this plugin. Later versions may simplify the steps explained below. Feel free to make suggestions for simplications or extra functionality or report bugs to me (mailto:roland.olbricht(at)gmx.de). From the first mature version on, the plugin source code should appear in the OSM SVN and thus the plugin won't any more require any special installation procedures.5 6 7 HOW TO INSTALL8 9 In JOSM: Bearbeiten > Einstellungen, dort Plugins (Stecker) -> Liste laden10 cp public_transport.jar ~/.josm/plugins/11 In JOSM: Bearbeiten > Einstellungen, dort Plugins (Stecker): Public Transport aus der Liste wählen12 JOSM neustarten, Aktualisierung überspringen13 14 15 MAP A BUS LINE FROM SCRATCH16 17 The Oxmoa schema consists of a relation per direction (details see USED NOTIONS) and contains the itinerary (the way a bus actually takes from its starting stop to its terminus) and the stops served by the bus. You need to specify one half of the itinerary, the stops and the back direction can mostly be derived by the software.18 19 Download the area where your bus route takes place. Create a new relation with the standard relation editor and set the tags "type=route", "route=bus" and "ref" set to the line number. Then choose the menue item "Public Transport > Route patterns". Now you can find your route in the list of the main window. Select it and change to the tab "Itinerary". Now select on the map the first way that belongs to your line and press "Add". Mark the second item and press "Add" again. You can select several ways at once and press "Add". If your ways are added in the wrong order or with wrong roles, mark them (click the first entry in the window, then shift-click the last entry in the window) and press "Sort". If there appear one or more lines "[gap]", then your ways don't fit together. If sorting won't solve that, there are gaps in your itinerary and you need to add the missing links or split ways (mark the way, the node where to split at and then use menu "Tools > Split Way") if your bus service only partly uses them. You can delete one or more items from the list by marking them and clicking on "Delete". You can also move one or more items by marking them, clicking on "Mark" (this copies them to the clipboard, like the middle mouse button on X servers), then "Delete", then mark the first item before which you want to insert the items and click "Add".20 21 Now you can add the bus stops in a convienient way: change to the tab "Meta" and press "Suggest Stops". This will compile a list of stops that are near the itinerary. You can choose up to which distance from the itinerary stops should be considered and whether stops only the right hand side, only on the left hand side or on both sides are possible. Now change to the tab "Stops". You can identify stops by marking them and then click "Mark" and/or "Show". Delete spurious stops by marking them and pressing "Delete". Add missing stops by marking them on the map, marking the entry before which you want to insert the stop (unmark all entries if you want to append stops to the end), then press "Add".22 23 24 REUSE A PARTLY PARALLEL LINE25 26 The plugin has an internal clipboard to simplify copying parts of the itinerary or the stops from one bus route to another. Data is put into the clipboard in the X server paradigm. Mark one or more entry from the itinerary list or stops list and click the respective button "Copy". The objects themselves are kept by they state being marked on the map. The plugin additionally saves their order and role. You can paste data from clipboard by using the respective button "Add".27 28 To do this, first choose the source relation at the tab "Overview" and change to the tab "Itinerary". Mark there the entries you want to copy and click "Mark". Then choose at the tab "Overview" your destination relation and mark at the tab "Itinerary" the entry before which you want to paste the entries or unmark all entries if you want to append the data from clipboard.29 30 Stops can be copied in the same way: first choose the source relation at the tab "Overview" and change to the tab "Stops". Mark there the entries you want to copy and click "Mark". Then choose at the tab "Overview" your destination relation and mark at the tab "Stops" the entry before which you want to paste the entries or unmark all entries if you want to append the data from clipboard.31 32 33 REUSE AN OLD RELATION34 35 If you have a bus route in an old format, you can with the help of the plugin spread it into separate relations for both (or more) directions. First, use the standard relation editor of JOSM to duplicate the relation: click on the most lower but one icon on the left toolbar. this opens the relation window on the right. Choose there the relation to duplicate. Click then there on the third button to duplicate the relation, then change "to" and "from" in the opening dialog.36 37 Now open "Public transport > Route patterns ..." and select there the new relation. Change to the tab "Itinerary" and click "Reflect" to reflect the itinerary. If this does not work properly, first click "Sort" to sort the itinerary, then if necessary again "Reflect" to bring them in their proper order.38 39 To edit the bus stops, use one of the functions described above: "Suggest Stops" to have a clean restart from scratch. Or use the buttons in the tab "Stops".40 41 42 USED NOTIONS43 44 Note: I'm not a native English speaker. So if you have suggestions for better wording, please send them to me (mailto:roland.olbricht(at)gmx.de).45 46 ...47 http://wiki.openstreetmap.org/wiki/User:Oxomoa/Public_transport_schema#Network_information_.28lines_and_routes.2948 49 50 REFERENCE MANUAL51 52 * Tab "Overview"53 54 - List "Existing route patterns"55 The large list in the center contains all relations that are recognised as bus routes. They are listed with the value of their tag "ref" and the ID of their relation. A relation is considered as bus service if it has the tags "type=route" and "route=bus".56 57 - Button "Refresh"58 This button refreshes the list "Existing route patterns".59 60 61 * Tab "Tags"62 63 The content of this tag is not yet implemented.64 65 66 * Tab "Itinerary"67 68 - List of member ways69 This list contains all the current members of the relation you are editing that are ways. The intended format of a route relation (see Oxmoa scheme at USED NOTIONS above) expects a continuos list of ways that represents the itinerary the bus takes in reality. Whenever two ways don't fit head on tail, a marker "[gap]" is put between them in an extra line to make breaks clearly visible. This is not a member of the relation but just a marker. You can change the role of a way in the right column. To achieve maximum backward compability, you should choose "forward" or "backward". To properly display relations that don't follow the Oxmoa scheme, all other roles including the empty are also displayed and you can choose despite "forward" and "backward" also an empty role.70 71 - Button "Show"72 Ths button changes the view on the map such that all marked entries are visible.73 74 - Button "Mark"75 Ths button marks all entries that are marked in the list as objects on the map and unmarks all other ways. It also copies a list of the marked entries to the plugin's internal clipboard, such that roles and the order can be reconstructed.76 77 - Button "Add"78 This button adds all ways that are currently marked on the map as entries in the list. The entries are added in arbitrary order before the first marked entry. You can order the just added elements by marking them and clicking "Sort".79 80 - Button "Delete"81 This button deletes all currently marked entries.82 83 - Button "Sort"84 If one or more entries are marked, all marked entries are sorted. I.e. their order and role is changed such that they form a continuous itinerary. If this is not possible, the plugin tries to construct long series of continuous sections. If no entries are marked, the entire list are sorted.85 86 - Button "Reflect"87 If one or more entries are marked, their order is reflected and their roles get flipped. I.e. every entry it put after its successor and its role is changed from "backward" to "forward", from "forward" to "backward" or left unchanged if it is empty.88 89 90 * Tab "Stops"91 92 - List of member nodes93 This list contains all the current members of the relation you are editing that are nodes. The intended format of a route relation (see Oxmoa scheme at USED NOTIONS above) expects a list of nodes that represents the stops in the order the bus takes them in reality. The roles can be changed to "forward" or "backward" but due to Oxmoa scheme, they should remain empty.94 95 - Button "Show"96 Ths button changes the view on the map such that all marked entries are visible.97 98 - Button "Mark"99 Ths button marks all entries that are marked in the list as objects on the map and unmarks all other nodes. It also copies a list of the marked entries to the plugin's internal clipboard, such that roles and the order can be reconstructed.100 101 - Button "Add"102 This button adds all ways that are currently marked on the map as entries in the list. The entries are added in arbitrary order before the first marked entry. You can order the just added elements by marking them and clicking "Sort".103 104 - Button "Delete"105 This button deletes all currently marked entries.106 107 - Button "Sort"108 If one or more entries are marked, all marked entries are sorted. The sorting order depends on the itinerary and the settings for the distance limit, the right hand side and the left hand side in the meta "tab": the sorting algorithm attaches each stop to the nearest segment of the itinerary and then orders them in the order they are passed on the itinerary. Then all stops that can't be attached are added to the end of the list.109 110 - Button "Reflect"111 If one or more entries are marked, their order is reflected. I.e. every entry it put after its successor.112 113 114 * Tab "Meta"115 116 - Checkbox "Stops are possible"117 This checkbox controls the behaviour of the button "Suggest stops" and the button "Sort" in the tab "Stops". If you mark only one of the boxes "Right hand side" or "Left hand side", only stops on the respective side are taken into account. If you mark both boxes, stops on both sides are taken into account.118 119 - Text field "Maximum distance from route"120 This textfield also controls the behaviour of the button "Suggest stops" and the button "Sort" in the tab "Stops". Only stops that have a distance less or equal the limit set here are taken into account.121 122 - Button "Suggest stops"123 This button replaces the current list of stops by a list of all stops that are on the itinerary with regard to the setting of the checkboxes and the text field described above. -
applications/editors/josm/plugins/mirrored_download/build.xml
r29435 r29505 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <!--3 ** This is the build file for the mirrored_download plugin4 **5 ** Maintaining versions6 ** ====================7 ** see README.template8 **9 ** Usage10 ** =====11 ** To build it run12 **13 ** > ant dist14 **15 ** To install the generated plugin locally (in your default plugin directory) run16 **17 ** > ant install18 **19 ** To build against the core in ../../core, create a correct manifest and deploy to20 ** SVN,21 ** set the properties commit.message and plugin.main.version22 ** and run23 ** > ant publish24 **25 **26 -->27 2 <project name="mirrored_download" default="dist" basedir="."> 28 3 … … 30 5 <property name="commit.message" value=""/> 31 6 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 32 <property name="plugin.main.version" value="5 097"/>7 <property name="plugin.main.version" value="5874"/> 33 8 34 <!-- 35 ********************************************************** 36 ** include targets that all plugins have in common 37 ********************************************************** 9 <!-- Configure these properties (replace "..." accordingly). 10 See http://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins 38 11 --> 12 <property name="plugin.author" value="Roland M. Olbricht"/> 13 <property name="plugin.class" value="mirrored_download.MirroredDownloadPlugin"/> 14 <property name="plugin.description" value="Simplifies download from different read-only APIs."/> 15 <property name="plugin.icon" value="images/download_mirror.png"/> 16 <property name="plugin.link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/mirrored_download"/> 17 18 <!-- ** include targets that all plugins have in common ** --> 39 19 <import file="../build-common.xml"/> 40 20 41 <!--42 **********************************************************43 ** dist - creates the plugin jar44 **********************************************************45 -->46 <target name="dist" depends="compile,revision">47 <echo message="creating ${ant.project.name}.jar ... "/>48 <copy todir="${plugin.build.dir}/resources">49 <fileset dir="resources"/>50 </copy>51 <copy todir="${plugin.build.dir}/images">52 <fileset dir="images"/>53 </copy>54 <copy todir="${plugin.build.dir}/data">55 <fileset dir="data"/>56 </copy>57 <copy todir="${plugin.build.dir}">58 <fileset dir=".">59 <include name="README"/>60 <include name="LICENSE"/>61 </fileset>62 </copy>63 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">64 <!--65 ************************************************66 ** configure these properties. Most of them will be copied to the plugins67 ** manifest file. Property values will also show up in the list available68 ** plugins: http://josm.openstreetmap.de/wiki/Plugins.69 **70 ************************************************71 -->72 <manifest>73 <attribute name="Author" value="Roland M. Olbricht"/>74 <attribute name="Plugin-Class" value="mirrored_download.MirroredDownloadPlugin"/>75 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>76 <attribute name="Plugin-Description" value="Simplifies download from different read-only APIs."/>77 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/mirrored_download"/>78 <attribute name="Plugin-Icon" value="images/download_mirror.png"/>79 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>80 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>81 </manifest>82 </jar>83 </target>84 21 </project> -
applications/editors/josm/plugins/mirrored_download/src/mirrored_download/MirroredDownloadAction.java
r29365 r29505 14 14 import java.util.concurrent.Future; 15 15 import java.util.regex.Pattern; 16 16 17 import javax.swing.JComboBox; 17 18 import javax.swing.JLabel; … … 19 20 import javax.swing.text.JTextComponent; 20 21 22 import org.openstreetmap.josm.Main; 21 23 import org.openstreetmap.josm.actions.JosmAction; 22 23 import org.openstreetmap.josm.Main;24 24 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 25 25 import org.openstreetmap.josm.actions.downloadtasks.PostDownloadHandler; -
applications/editors/josm/plugins/mirrored_download/src/mirrored_download/UrlSelectionAction.java
r28290 r29505 8 8 9 9 import org.openstreetmap.josm.actions.JosmAction; 10 11 10 12 11 /** -
applications/editors/josm/plugins/mirrored_download/src/mirrored_download/UrlSelectionDialog.java
r28912 r29505 2 2 package mirrored_download; 3 3 4 import static org.openstreetmap.josm.tools.I18n.marktr;5 4 import static org.openstreetmap.josm.tools.I18n.tr; 6 5 7 import java.awt.Container;8 6 import java.awt.Frame; 9 7 import java.awt.GridBagConstraints; … … 12 10 import java.awt.event.ActionListener; 13 11 import java.io.BufferedReader; 14 import java.io.File; 15 import java.io.FileInputStream; 16 import java.io.FileNotFoundException; 12 import java.io.IOException; 17 13 import java.io.InputStream; 18 14 import java.io.InputStreamReader; 19 import java.io.IOException;20 import java.text.DecimalFormat;21 import java.text.Format;22 15 import java.util.ArrayList; 23 16 import java.util.Collection; 24 import java.util.Collections;25 import java.util.Iterator;26 import java.util.Vector;27 import java.util.zip.GZIPInputStream;28 17 29 import javax.swing.DefaultCellEditor;30 import javax.swing.DefaultListModel;31 import javax.swing.JButton;32 18 import javax.swing.JCheckBox; 33 19 import javax.swing.JComboBox; 34 import javax.swing.JComponent;35 20 import javax.swing.JDialog; 36 import javax.swing.JFileChooser;37 21 import javax.swing.JLabel; 38 import javax.swing.JList;39 22 import javax.swing.JOptionPane; 40 23 import javax.swing.JPanel; 41 import javax.swing.JScrollPane;42 24 import javax.swing.JTabbedPane; 43 import javax.swing.JTable;44 import javax.swing.JTextField;45 import javax.swing.KeyStroke;46 import javax.swing.ListSelectionModel;47 import javax.swing.event.ListSelectionEvent;48 import javax.swing.event.ListSelectionListener;49 import javax.swing.event.TableModelEvent;50 import javax.swing.event.TableModelListener;51 import javax.swing.table.DefaultTableModel;52 25 53 26 import org.openstreetmap.josm.Main; 54 import org.openstreetmap.josm.actions.JosmAction;55 import org.openstreetmap.josm.command.Command;56 import org.openstreetmap.josm.command.ChangeCommand;57 import org.openstreetmap.josm.command.DeleteCommand;58 import org.openstreetmap.josm.data.coor.LatLon;59 import org.openstreetmap.josm.data.gpx.GpxData;60 import org.openstreetmap.josm.data.gpx.GpxTrack;61 import org.openstreetmap.josm.data.gpx.GpxTrackSegment;62 import org.openstreetmap.josm.data.gpx.WayPoint;63 import org.openstreetmap.josm.data.osm.DataSet;64 import org.openstreetmap.josm.data.osm.Node;65 import org.openstreetmap.josm.data.osm.OsmPrimitive;66 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;67 import org.openstreetmap.josm.io.GpxReader;68 27 import org.openstreetmap.josm.io.MirroredInputStream; 69 28 import org.openstreetmap.josm.tools.Utils; 70 71 import org.xml.sax.SAXException;72 29 73 30 public class UrlSelectionDialog … … 160 117 } 161 118 } 119 Utils.close(reader); 162 120 } catch (IOException e) { 163 121 e.printStackTrace(); 122 } finally { 123 Utils.close(in); 164 124 } 165 Utils.close(in);166 125 for (String url : Main.pref.getCollection("plugin.mirrored_download.custom-urls")) { 167 126 urls.add(url);
Note:
See TracChangeset
for help on using the changeset viewer.