}
return row;
}
private void movePosition(int row, Double longitude, Double latitude) {
NavigationPosition reference = positionsModel.getPosition(row);
Double diffLongitude = reference != null ? longitude - reference.getLongitude() : 0.0;
Double diffLatitude = reference != null ? latitude - reference.getLatitude() : 0.0;
boolean moveCompleteSelection = preferences.getBoolean(MOVE_COMPLETE_SELECTION_PREFERENCE, true);
boolean cleanElevation = preferences.getBoolean(CLEAN_ELEVATION_ON_MOVE_PREFERENCE, false);
boolean complementElevation = preferences.getBoolean(COMPLEMENT_ELEVATION_ON_MOVE_PREFERENCE, true);
boolean cleanTime = preferences.getBoolean(CLEAN_TIME_ON_MOVE_PREFERENCE, false);
boolean complementTime = preferences.getBoolean(COMPLEMENT_TIME_ON_MOVE_PREFERENCE, true);
int minimum = row;
for (int index : selectedPositionIndices) {
if (index < minimum)
minimum = index;
NavigationPosition position = positionsModel.getPosition(index);
if (position == null)
continue;
if (index != row) {
if (!moveCompleteSelection)
continue;
positionsModel.edit(index, new PositionColumnValues(asList(LONGITUDE_COLUMN_INDEX, LATITUDE_COLUMN_INDEX),
Arrays.<Object>asList(position.getLongitude() + diffLongitude, position.getLatitude() + diffLatitude)), false, true);
} else {
positionsModel.edit(index, new PositionColumnValues(asList(LONGITUDE_COLUMN_INDEX, LATITUDE_COLUMN_INDEX),
Arrays.<Object>asList(longitude, latitude)), false, true);
}