Changeset 32632 in osm
- Timestamp:
- 2016-07-11T18:05:24+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/pt_assistant
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/build.xml
r32431 r32632 12 12 <property name="plugin.icon" value="..."/> 13 13 <property name="plugin.link" value="https://wiki.openstreetmap.org/wiki/JOSM/Plugins/PT_Assistant"/> 14 <property name="plugin.canloadatruntime" value="true"/> 14 15 15 16 <!-- ** include targets that all plugins have in common ** --> -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/utils/RouteUtils.java
r32622 r32632 30 30 */ 31 31 public static boolean isTwoDirectionRoute(Relation r) { 32 33 if (r == null) { 34 return false; 35 } 36 32 37 if (!r.hasKey("route") || !r.hasTag("public_transport:version", "2")) { 33 38 return false; -
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/validation/PTAssistantValidatorTest.java
r32616 r32632 18 18 import org.openstreetmap.josm.data.validation.Test; 19 19 import org.openstreetmap.josm.data.validation.TestError; 20 import org.openstreetmap.josm.plugins.pt_assistant.actions.DownloadReferrersThread;21 20 import org.openstreetmap.josm.plugins.pt_assistant.actions.FixTask; 22 21 import org.openstreetmap.josm.plugins.pt_assistant.actions.IncompleteMembersDownloadThread; 23 import org.openstreetmap.josm.plugins.pt_assistant.gui.DownloadReferrersDialog;24 22 import org.openstreetmap.josm.plugins.pt_assistant.gui.IncompleteMembersDownloadDialog; 25 23 import org.openstreetmap.josm.plugins.pt_assistant.gui.PTAssistantLayer; … … 40 38 41 39 private PTAssistantLayer layer; 42 private static boolean nodeReferrersDownloaded;43 @SuppressWarnings("unused")44 private static boolean incompleteRelationsDowloaded;45 40 46 41 … … 51 46 layer = new PTAssistantLayer(); 52 47 DataSet.addSelectionListener(layer); 53 nodeReferrersDownloaded = false;54 incompleteRelationsDowloaded = false;55 48 56 49 } … … 61 54 if (n.isIncomplete()) { 62 55 return; 63 }64 65 if (!nodeReferrersDownloaded) {66 this.downloadReferrers(n);67 nodeReferrersDownloaded = true;68 56 } 69 57 … … 76 64 77 65 // check that platforms are not part of any way: 78 if (n.hasTag("highway", "bus_stop") || n.hasTag("public_transport", "platform") 79 || n.hasTag("highway", "platform") || n.hasTag("railway", "platform")) { 66 if (n.hasTag("public_transport", "platform")) { 80 67 nodeChecker.performPlatformPartOfWayTest(); 81 68 } … … 85 72 } 86 73 87 88 /**89 * Downloads incomplete relation members in an extra thread (user input90 * required)91 *92 * @return true if successful, false if not successful93 */94 private boolean downloadReferrers(Node n) {95 96 final int[] userSelection = { 0 };97 98 try {99 100 if (SwingUtilities.isEventDispatchThread()) {101 102 userSelection[0] = showDownloadReferrersDialog();103 104 } else {105 106 SwingUtilities.invokeAndWait(new Runnable() {107 @Override108 public void run() {109 try {110 userSelection[0] = showDownloadReferrersDialog();111 } catch (InterruptedException e) {112 e.printStackTrace();113 }114 115 }116 });117 118 }119 120 } catch (InterruptedException | InvocationTargetException e) {121 return false;122 }123 124 if (userSelection[0] == JOptionPane.YES_OPTION) {125 126 Thread t = new DownloadReferrersThread(n);127 t.start();128 synchronized (t) {129 try {130 t.wait();131 } catch (InterruptedException e) {132 return false;133 }134 }135 136 }137 138 return true;139 140 }141 142 /**143 * Shows the dialog asking the user about an incomplete member download144 *145 * @return user's selection146 * @throws InterruptedException147 */148 private int showDownloadReferrersDialog() throws InterruptedException {149 150 DownloadReferrersDialog downloadReferrersDialog = new DownloadReferrersDialog();151 return downloadReferrersDialog.getUserSelection();152 153 }154 74 155 75 @Override … … 168 88 return; 169 89 } 170 incompleteRelationsDowloaded = true;171 172 90 } 173 91 … … 471 389 } 472 390 473 public void endTest() {474 super.endTest();475 nodeReferrersDownloaded = false;476 incompleteRelationsDowloaded = false;477 }478 479 391 }
Note:
See TracChangeset
for help on using the changeset viewer.