Fix fragment

This commit is contained in:
Victor Shcherb 2014-09-05 02:24:14 +02:00
parent dbef043f1c
commit a68dd68652

View file

@ -46,7 +46,7 @@ public class SherpafyStageItineraryFragment extends SherpafyStageInfoFragment im
osmandMapTileView.addLayer(new StageFavoritesLayer(app, stage), 4.1f); osmandMapTileView.addLayer(new StageFavoritesLayer(app, stage), 4.1f);
osmandMapTileView.setMainLayer(mapVectorLayer); osmandMapTileView.setMainLayer(mapVectorLayer);
mapVectorLayer.setVisible(true); mapVectorLayer.setVisible(true);
calculateLatLon(); calculateLatLon(stage.getGpx());
if (stage.getItineraryBitmap() != null && !HIDE_ITINERARY_IMG) { if (stage.getItineraryBitmap() != null && !HIDE_ITINERARY_IMG) {
icon.setImageBitmap(stage.getItineraryBitmap()); icon.setImageBitmap(stage.getItineraryBitmap());
} else { } else {
@ -79,21 +79,21 @@ public class SherpafyStageItineraryFragment extends SherpafyStageInfoFragment im
} }
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
gpxLayer.setGivenGpx(gpx); gpxLayer.setGivenGpx(gpx);
calculateLatLon(); calculateLatLon(gpx);
osmandMapTileView.refreshMap(); osmandMapTileView.refreshMap();
}; };
}.execute((Void)null); }.execute((Void)null);
} }
protected void calculateLatLon() { protected void calculateLatLon(GPXFile gpx) {
WptPt st = stage.getGpx() == null ? null : stage.getGpx().findPointToShow(); WptPt st = gpx == null ? null : gpx.findPointToShow();
double llat = st == null ? stage.getStartPoint().getLatitude() : st.lat; double llat = st == null ? stage.getStartPoint().getLatitude() : st.lat;
double llon = st == null ? stage.getStartPoint().getLongitude() : st.lon; double llon = st == null ? stage.getStartPoint().getLongitude() : st.lon;
double left = llon, right = llon; double left = llon, right = llon;
double top = llat, bottom = llat; double top = llat, bottom = llat;
if (stage.getGpx() != null) { if (gpx != null) {
for (List<WptPt> list : stage.getGpx().proccessPoints()) { for (List<WptPt> list : gpx.proccessPoints()) {
for (WptPt l : list) { for (WptPt l : list) {
left = Math.min(left, l.getLongitude()); left = Math.min(left, l.getLongitude());
right = Math.max(right, l.getLongitude()); right = Math.max(right, l.getLongitude());