Review fixes

This commit is contained in:
cepprice 2021-04-05 19:56:03 +05:00
parent 0604374475
commit 7fd107c97a
3 changed files with 10 additions and 16 deletions

View file

@ -1119,21 +1119,17 @@ public class MeasurementEditingContext implements IRouteSettingsListener {
return true; return true;
} }
Set<String> profiles = new HashSet<>(); Set<String> profiles = new HashSet<>();
List<TrkSegment> segments = new ArrayList<>(); for (RoadSegmentData segmentData : roadSegmentData.values()) {
segments.addAll(beforeSegments); String profile = segmentData.getAppMode().getStringKey();
segments.addAll(afterSegments); if (!DEFAULT_APP_MODE.getStringKey().equals(profile)) {
for (TrkSegment segment : segments) { profiles.add(profile);
if (Algorithms.isEmpty(segment.points)) { if (profiles.size() >= 2) {
continue; lastCalculationMode = NEXT_SEGMENT;
} return true;
for (WptPt pt : segment.points) {
if (!pt.isGap()) {
profiles.add(pt.getProfileType());
} }
} }
} }
lastCalculationMode = profiles.size() >= 2 ? NEXT_SEGMENT : WHOLE_TRACK; return false;
return profiles.size() >= 2;
} }
@Override @Override

View file

@ -190,9 +190,7 @@ public abstract class GeometryWay<T extends GeometryWayContext, D extends Geomet
prevLon = lastProjection.getLongitude(); prevLon = lastProjection.getLongitude();
} }
if (!Double.isNaN(prevLat) && !Double.isNaN(prevLon)) { if (!Double.isNaN(prevLat) && !Double.isNaN(prevLon)) {
GeometryWayStyle<?> prevStyle = style instanceof GeometryMultiProfileWayStyle ? addLocation(tb, prevLat, prevLon, getStyle(i - 1, style), tx, ty, angles, distances, dist, styles); // first point
getStyle(i - 1, style) : style;
addLocation(tb, prevLat, prevLon, prevStyle, tx, ty, angles, distances, dist, styles); // first point
} }
} }
addLocation(tb, lat, lon, style, tx, ty, angles, distances, dist, styles); addLocation(tb, lat, lon, style, tx, ty, angles, distances, dist, styles);

View file

@ -21,7 +21,7 @@ public class MultiProfileGeometryWayDrawer extends GeometryWayDrawer<MultiProfil
@Override @Override
public void drawPath(Canvas canvas, Path path, GeometryWayStyle<?> style) { public void drawPath(Canvas canvas, Path path, GeometryWayStyle<?> style) {
if (style instanceof GeometryMultiProfileWayStyle) { if (style instanceof GeometryMultiProfileWayStyle && !((GeometryMultiProfileWayStyle) style).isGap()) {
RenderingLineAttributes attrs = getContext().getAttrs(); RenderingLineAttributes attrs = getContext().getAttrs();
attrs.paint.setColor(((GeometryMultiProfileWayStyle) style).getBorderColor()); attrs.paint.setColor(((GeometryMultiProfileWayStyle) style).getBorderColor());