Skip to content

Commit dae7a40

Browse files
committed
Change query
1 parent 0260c7f commit dae7a40

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

src/org/openstreetmap/josm/plugins/pt_assistant/actions/MendRelationAction.java

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,19 @@ public MendRelationAction(IRelationEditorActionAccess editorAccess) {
122122
OsmDataLayer layer = editor.getLayer();
123123
this.relation = editor.getRelation();
124124
editor.addWindowListener(new WindowEventHandler());
125-
// QUERY = "[out:xml][timeout:180][bbox:{{bbox}}];\n" + "(\n" + " (\n"
126-
// + " way[\"highway\"][\"highway\"!=\"footway\"][\"highway\"!=\"path\"][\"highway\"!=\"cycleway\"];\n"
127-
// + " );\n" + " ._;<;\n" + ");\n" + "(._;>>;>;);\n" + "out meta;";
125+
// QUERY = "[out:xml][timeout:180][bbox:{{bbox}}];\n" + "(\n" + " (\n"
126+
// + "
127+
// way[\"highway\"][\"highway\"!=\"footway\"][\"highway\"!=\"path\"][\"highway\"!=\"cycleway\"];\n"
128+
// + " );\n" + " ._;<;\n" + ");\n" + "(._;>>;>;);\n" + "out meta;";
128129
}
129130

130131
private String getQuery() {
131-
String str = "[out:xml][timeout:200];\n" + "(\n" + " (\n";
132+
String str = "[timeout:100];\n" + "(\n" + " (\n";
132133

133-
String str2 = " [\"highway\"]\n" + " [\"highway\"!=\"footway\"]\n" + " [\"highway\"!=\"path\"]\n"
134-
+ " [\"highway\"!=\"cycleway\"]\n" + " [\"highway\"!=\"service\"];\n" + "\n";
134+
String str2 = " [\"highway\"]" + "[\"highway\"!=\"footway\"]" + "[\"highway\"!=\"path\"]"
135+
+ "[\"highway\"!=\"cycleway\"]" + "\n";
135136

136-
String str3 = " );\n" + " ._;<;\n" + ");\n" + "(._;>>;>;);\n" + "out meta;";
137+
String str3 = ");\n" + ");\n" + "(._;<;);\n" + "(._;>;);\n" + "out meta;";
137138

138139
List<Node> nodeList = getBrokenNodes();
139140

@@ -225,7 +226,7 @@ void initialise() {
225226
halt = false;
226227
callNextWay(currentIndex);
227228
}
228-
// callNextWay(currentIndex);
229+
// callNextWay(currentIndex);
229230
}
230231

231232
void downloadEntireArea() {
@@ -380,7 +381,8 @@ Node checkValidityOfWays(Way way, int nextWayIndex) {
380381
}
381382
}
382383

383-
// check if there is a restricted relation that doesn't allow both the ways together
384+
// check if there is a restricted relation that doesn't allow both the ways
385+
// together
384386
if (node != null) {
385387
if (isRestricted(nextWay, way, node)) {
386388
nextWayDelete = true;
@@ -1153,7 +1155,7 @@ void downloadAreaAroundWay(Way way, Node node1, Node node2) {
11531155
if (abort)
11541156
return;
11551157

1156-
if (downloadCounter > 160 || way.isOutsideDownloadArea() || way.isNew()){
1158+
if (downloadCounter > 160 || way.isOutsideDownloadArea() || way.isNew()) {
11571159
downloadCounter = 0;
11581160

11591161
DownloadOsmTask task = new DownloadOsmTask();
@@ -1300,7 +1302,8 @@ void downloadAreaBeforeRemovalOption(List<Way> wayList, List<Integer> Int) {
13001302

13011303
boolean isRestricted(Way currentWay, Way previousWay, Node commonNode) {
13021304
Set<Relation> parentSet = previousWay.getParentRelations(previousWay.getNodes());
1303-
if (parentSet == null || parentSet.isEmpty()) return false;
1305+
if (parentSet == null || parentSet.isEmpty())
1306+
return false;
13041307
List<Relation> parentRelation = new ArrayList<>(parentSet);
13051308

13061309
String[] restrictions = new String[] { "restriction", "restriction:bus", "restriction:trolleybus",
@@ -1338,22 +1341,25 @@ else if (routeValue.equals(sub) && rel.hasKey("restriction:" + sub))
13381341
for (Relation r : parentRelation) {
13391342
Collection<RelationMember> prevMemberList = r.getMembersFor(Arrays.asList(previousWay));
13401343
Collection<RelationMember> commonNodeList = r.getMembersFor(Arrays.asList(commonNode));
1341-
// commonNode is not the node involved in the restriction relation then just continue
1344+
// commonNode is not the node involved in the restriction relation then just
1345+
// continue
13421346
if (prevMemberList.isEmpty() || commonNodeList.isEmpty())
13431347
continue;
13441348

13451349
RelationMember prevMember = prevMemberList.stream().collect(Collectors.toList()).get(0);
13461350
final String prevRole = prevMember.getRole();
13471351

13481352
if (prevRole.equals("from")) {
1349-
String[] acceptedTags = new String[] { "only_right_turn", "only_left_turn", "only_u_turn", "only_straight_on",
1350-
"only_entry", "only_exit" };
1353+
String[] acceptedTags = new String[] { "only_right_turn", "only_left_turn", "only_u_turn",
1354+
"only_straight_on", "only_entry", "only_exit" };
13511355
for (String s : restrictions) {
1352-
// if we have any "only" type restrictions then the current way should be in the relation else it is restricted
1356+
// if we have any "only" type restrictions then the current way should be in the
1357+
// relation else it is restricted
13531358
if (r.hasTag(s, acceptedTags)) {
13541359
if (r.getMembersFor(Arrays.asList(currentWay)).isEmpty()) {
13551360
for (String str : acceptedTags) {
1356-
if (r.hasTag(s,str)) notice = str + " restriction violated";
1361+
if (r.hasTag(s, str))
1362+
notice = str + " restriction violated";
13571363
}
13581364
return true;
13591365
}
@@ -1381,7 +1387,8 @@ else if (routeValue.equals(sub) && rel.hasKey("restriction:" + sub))
13811387
for (String s : restrictions)
13821388
if (r.hasTag(s, acceptedTags)) {
13831389
for (String str : acceptedTags) {
1384-
if (r.hasTag(s,str)) notice = str + " restriction violated";
1390+
if (r.hasTag(s, str))
1391+
notice = str + " restriction violated";
13851392
}
13861393
return true;
13871394
}
@@ -2203,13 +2210,15 @@ void drawVariants() {
22032210
if (!shorterRoutes)
22042211
drawFixVariantLetter("0 : turn-by-turn at next intersection", Color.ORANGE, letterX, letterY, 25);
22052212
else
2206-
drawFixVariantLetter("0 : solutions based on other route relations", Color.PINK, letterX, letterY, 25);
2213+
drawFixVariantLetter("0 : solutions based on other route relations", Color.PINK, letterX, letterY,
2214+
25);
22072215
letterY = letterY + 60;
22082216
} else if (showOption0) {
22092217
if (!shorterRoutes)
22102218
drawFixVariantLetter("W : turn-by-turn at next intersection", Color.ORANGE, letterX, letterY, 25);
22112219
else
2212-
drawFixVariantLetter("W : solutions based on other route relations", Color.PINK, letterX, letterY, 25);
2220+
drawFixVariantLetter("W : solutions based on other route relations", Color.PINK, letterX, letterY,
2221+
25);
22132222
letterY = letterY + 60;
22142223
}
22152224

@@ -2294,13 +2303,15 @@ void drawMultipleVariants(HashMap<Character, List<Way>> fixVariants) {
22942303
if (!shorterRoutes)
22952304
drawFixVariantLetter("0 : turn-by-turn at next intersection", Color.ORANGE, letterX, letterY, 25);
22962305
else
2297-
drawFixVariantLetter("0 : solutions based on other route relations", Color.PINK, letterX, letterY, 25);
2306+
drawFixVariantLetter("0 : solutions based on other route relations", Color.PINK, letterX, letterY,
2307+
25);
22982308
letterY = letterY + 60;
22992309
} else if (showOption0) {
23002310
if (!shorterRoutes)
23012311
drawFixVariantLetter("W : turn-by-turn at next intersection", Color.ORANGE, letterX, letterY, 25);
23022312
else
2303-
drawFixVariantLetter("W : solutions based on other route relations", Color.PINK, letterX, letterY, 25);
2313+
drawFixVariantLetter("W : solutions based on other route relations", Color.PINK, letterX, letterY,
2314+
25);
23042315
letterY = letterY + 60;
23052316
}
23062317

0 commit comments

Comments
 (0)