sorry - but ich kann kein java ! gruß jan :-) marcus.wolsc...@googlemail.com schrieb: > On Fri, 08 May 2009 07:40:32 +0200, Jan Tappenbeck <o...@tappenbeck.net> > wrote: >> Moin ! >> >> seit der Umstellung auf die neue API werden die Ways einer Relation auch >> in ihrer Reihenfolge bewertet und in JOSM gibt es im >> Relationsbearbeitungsdialog zwei Schaltflächen für das Verschieben der >> Elemente in der Reihenfolge. >> >> Wenn man die Nummern der Ways kennt und weiß welche ID nach / vor >> welcher kommt ist das ja schön - aber gibt es noch ein weiteres >> Hilfsmittel darüberhinaus welches mir noch nicht bekannt ist. >> >> Ansonsten wäre vielleicht über folgenden Vorschlag nachzudenken - eine >> Funktion analysiert in welcher Reihenfolge die Elemente angeordnet >> werden müßten um einen fortlaufenden Weg ergeben zu können. Der User >> kann dann das Ergebnis bewerten und ggf. übernehmen. > > Sehr gute Idee. > Vorschlag für eine Umsetzung, die auch mit dual-carriageways funktioniert: > > /** > * Combine ways sharing the same endpoints > * to find an ordering for relation-members > * that share the same role. > * @param input all ways of a relation > * @return minimal list of ways > */ > public Set<List<Way>> combineWays(final Set<Way> input) { > > Set<List<Way>> output = new Hashset<List<Way>>(); > for(Way in : input) { > List<Way> temp = new LinkedList<Way>(); > temp.add(in); > output.add(temp); > } > > // go on as long as we can combine 2 of the lists > // in "output" > boolean combined = true; > while (combined) { > combined = false; > for(List<Way> first : output ) { > for(List<Way> second: output ) { > if (first == second) { > break; > } > Way firstWay = first.get(first.size() - 1); > Way secondWay = second.get(0); > if (firstWay.getWayNodes(firstWay.getWayNodes().size() - > 1).getNodeID() > == secondWay .getWayNodes(0).getNodeID) { > first.appendAll(second); > combined = true; > break; > } > } > if (combined) { > break; // avoid ConcurrentModificationException > } > } > } > } > > _______________________________________________ > Talk-de mailing list > Talk-de@openstreetmap.org > http://lists.openstreetmap.org/listinfo/talk-de
_______________________________________________ Talk-de mailing list Talk-de@openstreetmap.org http://lists.openstreetmap.org/listinfo/talk-de