Skip to content

Commit

Permalink
Change query
Browse files Browse the repository at this point in the history
  • Loading branch information
biswesh456 committed Aug 22, 2018
1 parent 0260c7f commit dae7a40
Showing 1 changed file with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,19 @@ public MendRelationAction(IRelationEditorActionAccess editorAccess) {
OsmDataLayer layer = editor.getLayer();
this.relation = editor.getRelation();
editor.addWindowListener(new WindowEventHandler());
// QUERY = "[out:xml][timeout:180][bbox:{{bbox}}];\n" + "(\n" + " (\n"
// + " way[\"highway\"][\"highway\"!=\"footway\"][\"highway\"!=\"path\"][\"highway\"!=\"cycleway\"];\n"
// + " );\n" + " ._;<;\n" + ");\n" + "(._;>>;>;);\n" + "out meta;";
// QUERY = "[out:xml][timeout:180][bbox:{{bbox}}];\n" + "(\n" + " (\n"
// + "
// way[\"highway\"][\"highway\"!=\"footway\"][\"highway\"!=\"path\"][\"highway\"!=\"cycleway\"];\n"
// + " );\n" + " ._;<;\n" + ");\n" + "(._;>>;>;);\n" + "out meta;";
}

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

String str2 = " [\"highway\"]\n" + " [\"highway\"!=\"footway\"]\n" + " [\"highway\"!=\"path\"]\n"
+ " [\"highway\"!=\"cycleway\"]\n" + " [\"highway\"!=\"service\"];\n" + "\n";
String str2 = " [\"highway\"]" + "[\"highway\"!=\"footway\"]" + "[\"highway\"!=\"path\"]"
+ "[\"highway\"!=\"cycleway\"]" + "\n";

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

List<Node> nodeList = getBrokenNodes();

Expand Down Expand Up @@ -225,7 +226,7 @@ void initialise() {
halt = false;
callNextWay(currentIndex);
}
// callNextWay(currentIndex);
// callNextWay(currentIndex);
}

void downloadEntireArea() {
Expand Down Expand Up @@ -380,7 +381,8 @@ Node checkValidityOfWays(Way way, int nextWayIndex) {
}
}

// check if there is a restricted relation that doesn't allow both the ways together
// check if there is a restricted relation that doesn't allow both the ways
// together
if (node != null) {
if (isRestricted(nextWay, way, node)) {
nextWayDelete = true;
Expand Down Expand Up @@ -1153,7 +1155,7 @@ void downloadAreaAroundWay(Way way, Node node1, Node node2) {
if (abort)
return;

if (downloadCounter > 160 || way.isOutsideDownloadArea() || way.isNew()){
if (downloadCounter > 160 || way.isOutsideDownloadArea() || way.isNew()) {
downloadCounter = 0;

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

boolean isRestricted(Way currentWay, Way previousWay, Node commonNode) {
Set<Relation> parentSet = previousWay.getParentRelations(previousWay.getNodes());
if (parentSet == null || parentSet.isEmpty()) return false;
if (parentSet == null || parentSet.isEmpty())
return false;
List<Relation> parentRelation = new ArrayList<>(parentSet);

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

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

if (prevRole.equals("from")) {
String[] acceptedTags = new String[] { "only_right_turn", "only_left_turn", "only_u_turn", "only_straight_on",
"only_entry", "only_exit" };
String[] acceptedTags = new String[] { "only_right_turn", "only_left_turn", "only_u_turn",
"only_straight_on", "only_entry", "only_exit" };
for (String s : restrictions) {
// if we have any "only" type restrictions then the current way should be in the relation else it is restricted
// if we have any "only" type restrictions then the current way should be in the
// relation else it is restricted
if (r.hasTag(s, acceptedTags)) {
if (r.getMembersFor(Arrays.asList(currentWay)).isEmpty()) {
for (String str : acceptedTags) {
if (r.hasTag(s,str)) notice = str + " restriction violated";
if (r.hasTag(s, str))
notice = str + " restriction violated";
}
return true;
}
Expand Down Expand Up @@ -1381,7 +1387,8 @@ else if (routeValue.equals(sub) && rel.hasKey("restriction:" + sub))
for (String s : restrictions)
if (r.hasTag(s, acceptedTags)) {
for (String str : acceptedTags) {
if (r.hasTag(s,str)) notice = str + " restriction violated";
if (r.hasTag(s, str))
notice = str + " restriction violated";
}
return true;
}
Expand Down Expand Up @@ -2203,13 +2210,15 @@ void drawVariants() {
if (!shorterRoutes)
drawFixVariantLetter("0 : turn-by-turn at next intersection", Color.ORANGE, letterX, letterY, 25);
else
drawFixVariantLetter("0 : solutions based on other route relations", Color.PINK, letterX, letterY, 25);
drawFixVariantLetter("0 : solutions based on other route relations", Color.PINK, letterX, letterY,
25);
letterY = letterY + 60;
} else if (showOption0) {
if (!shorterRoutes)
drawFixVariantLetter("W : turn-by-turn at next intersection", Color.ORANGE, letterX, letterY, 25);
else
drawFixVariantLetter("W : solutions based on other route relations", Color.PINK, letterX, letterY, 25);
drawFixVariantLetter("W : solutions based on other route relations", Color.PINK, letterX, letterY,
25);
letterY = letterY + 60;
}

Expand Down Expand Up @@ -2294,13 +2303,15 @@ void drawMultipleVariants(HashMap<Character, List<Way>> fixVariants) {
if (!shorterRoutes)
drawFixVariantLetter("0 : turn-by-turn at next intersection", Color.ORANGE, letterX, letterY, 25);
else
drawFixVariantLetter("0 : solutions based on other route relations", Color.PINK, letterX, letterY, 25);
drawFixVariantLetter("0 : solutions based on other route relations", Color.PINK, letterX, letterY,
25);
letterY = letterY + 60;
} else if (showOption0) {
if (!shorterRoutes)
drawFixVariantLetter("W : turn-by-turn at next intersection", Color.ORANGE, letterX, letterY, 25);
else
drawFixVariantLetter("W : solutions based on other route relations", Color.PINK, letterX, letterY, 25);
drawFixVariantLetter("W : solutions based on other route relations", Color.PINK, letterX, letterY,
25);
letterY = letterY + 60;
}

Expand Down

0 comments on commit dae7a40

Please sign in to comment.