// no real cycling, just return one-element collection with nearest primitive in it
return cycleList;
}
// updateKeyModifiers(e); // already called before !
DataSet ds = getCurrentDataSet();
OsmPrimitive first = cycleList.iterator().next(), foundInDS = null;
nxt = first;
if (cyclePrims && shift) {
for (Iterator<OsmPrimitive> i = cycleList.iterator(); i.hasNext();) {
nxt = i.next();
if (!nxt.isSelected()) {
break; // take first primitive in cycleList not in sel
}
}
// if primitives 1,2,3 are under cursor, [Alt-press] [Shift-release] gives 1 -> 12 -> 123
} else {
for (Iterator<OsmPrimitive> i = cycleList.iterator(); i.hasNext();) {
nxt = i.next();
if (nxt.isSelected()) {
foundInDS = nxt;
// first selected primitive in cycleList is found
if (cyclePrims || ctrl) {
ds.clearSelection(foundInDS); // deselect it
nxt = i.hasNext() ? i.next() : first;
// return next one in cycle list (last->first)
}
break; // take next primitive in cycleList
}
}
}
// if "no-alt-cycling" is enabled, Ctrl-Click arrives here.
if (ctrl) {
// a member of cycleList was found in the current dataset selection
if (foundInDS != null) {
// mouse was moved to a different selection group w/ a previous sel
if (!cycleList.contains(cycleStart)) {
ds.clearSelection(cycleList);
cycleStart = foundInDS;
} else if (cycleStart.equals(nxt)) {
// loop detected, insert deselect step
ds.addSelected(nxt);
}
} else {
// setup for iterating a sel group again or a new, different one..
nxt = (cycleList.contains(cycleStart)) ? cycleStart : first;
cycleStart = nxt;