Open rect by clicking on bitmap

This commit is contained in:
PavelRatushny 2017-06-29 13:16:11 +03:00
parent ecd2dc4763
commit 02f3454185
2 changed files with 11 additions and 3 deletions

View file

@ -47,6 +47,7 @@ import net.osmand.core.android.AtlasMapRendererView;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadPoint;
import net.osmand.data.QuadRect;
import net.osmand.data.RotatedTileBox;
import net.osmand.map.MapTileDownloader.DownloadRequest;
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
@ -841,6 +842,9 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
mapContextMenu.showMinimized(latLonToShow, mapLabelToShow, toShow);
mapLayers.getMapControlsLayer().getMapRouteInfoMenu().updateMenu();
MapRouteInfoMenu.showLocationOnMap(this, latLonToShow.getLatitude(), latLonToShow.getLongitude());
} else if (toShow instanceof QuadRect) {
QuadRect qr = (QuadRect) toShow;
mapView.fitRectToMap(qr.left, qr.right, qr.top, qr.bottom, (int) qr.width(), (int) qr.height(), 0);
} else {
mapContextMenu.show(latLonToShow, mapLabelToShow, toShow);
}

View file

@ -277,11 +277,15 @@ public class TrackSegmentFragment extends OsmAndListFragment {
headerView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LatLon location = new LatLon((generalDisplayItem.analysis.bottom + generalDisplayItem.analysis.top) / 2,
(generalDisplayItem.analysis.left + generalDisplayItem.analysis.right) / 2);
LatLon location = new LatLon(generalDisplayItem.locationStart.lat,
generalDisplayItem.locationStart.lon);
final OsmandSettings settings = app.getSettings();
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
settings.getLastKnownMapZoom());
settings.getLastKnownMapZoom(),
new PointDescription(PointDescription.POINT_TYPE_WPT, generalDisplayItem.name),
false,
getRect()
);
MapActivity.launchMapActivityMoveToTop(getActivity());
}