Review fixes
This commit is contained in:
parent
f5974f7cf3
commit
2524a3f73a
1 changed files with 6 additions and 9 deletions
|
@ -277,7 +277,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cache.clear();
|
cache.clear();
|
||||||
fireUnselectedGpxFiles(selectedGPXFiles);
|
removeCachedUnselectedTracks(selectedGPXFiles);
|
||||||
if (!selectedGPXFiles.isEmpty()) {
|
if (!selectedGPXFiles.isEmpty()) {
|
||||||
drawSelectedFilesSegments(canvas, tileBox, selectedGPXFiles, settings);
|
drawSelectedFilesSegments(canvas, tileBox, selectedGPXFiles, settings);
|
||||||
canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
|
canvas.rotate(-tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
|
||||||
|
@ -460,10 +460,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
||||||
QuadRect correctedQuadRect = getCorrectedQuadRect(tileBox.getLatLonBounds());
|
QuadRect correctedQuadRect = getCorrectedQuadRect(tileBox.getLatLonBounds());
|
||||||
for (SelectedGpxFile selectedGpxFile : selectedGPXFiles) {
|
for (SelectedGpxFile selectedGpxFile : selectedGPXFiles) {
|
||||||
boolean showArrows = isShowArrowsForTrack(selectedGpxFile.getGpxFile());
|
boolean showArrows = isShowArrowsForTrack(selectedGpxFile.getGpxFile());
|
||||||
if (!showArrows) {
|
if (!showArrows || !QuadRect.trivialOverlap(correctedQuadRect, GPXUtilities.calculateTrackBounds(selectedGpxFile.getPointsToDisplay()))) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!QuadRect.trivialOverlap(correctedQuadRect, GPXUtilities.calculateTrackBounds(selectedGpxFile.getPointsToDisplay()))) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String width = getTrackWidthName(selectedGpxFile.getGpxFile(), defaultTrackWidthPref.get());
|
String width = getTrackWidthName(selectedGpxFile.getGpxFile(), defaultTrackWidthPref.get());
|
||||||
|
@ -1056,15 +1053,15 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
||||||
return name.replace('_', ' ');
|
return name.replace('_', ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireUnselectedGpxFiles(List<SelectedGpxFile> selectedGpxFiles) {
|
private void removeCachedUnselectedTracks(List<SelectedGpxFile> selectedGpxFiles) {
|
||||||
Set<String> cachedTracksPaths = segmentsCache.keySet();
|
Set<String> cachedTracksPaths = segmentsCache.keySet();
|
||||||
List<String> selectedTracksPaths = new ArrayList<>();
|
List<String> selectedTracksPaths = new ArrayList<>();
|
||||||
for (SelectedGpxFile gpx : selectedGpxFiles) {
|
for (SelectedGpxFile gpx : selectedGpxFiles) {
|
||||||
selectedTracksPaths.add(gpx.getGpxFile().path);
|
selectedTracksPaths.add(gpx.getGpxFile().path);
|
||||||
}
|
}
|
||||||
for (String cachedPath : cachedTracksPaths) {
|
for (Iterator<String> iterator = cachedTracksPaths.iterator(); iterator.hasNext();) {
|
||||||
if (!selectedTracksPaths.contains(cachedPath)) {
|
if (!selectedTracksPaths.contains(iterator.next())) {
|
||||||
cachedTracksPaths.remove(cachedPath);
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue