Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-07-30 15:36:02 +02:00
commit 7f2f56781a
6 changed files with 95 additions and 18 deletions

View file

@ -312,7 +312,7 @@ public class BinaryMapTransportReaderAdapter {
}
int length = codedIS.readRawVarint32();
int olds = codedIS.pushLimit(length);
TransportStop stop = readTransportRouteStop(rx, ry, rid, stringTable);
TransportStop stop = readTransportRouteStop(rx, ry, rid, stringTable, filePointer);
dataObject.getForwardStops().add(stop);
rid = stop.getId();
rx = (int) MapUtils.getTileNumberX(BinaryMapIndexReader.TRANSPORT_STOP_ZOOM, stop.getLocation().getLongitude());
@ -397,8 +397,11 @@ public class BinaryMapTransportReaderAdapter {
private TransportStop readTransportRouteStop(int dx, int dy, long did, TIntObjectHashMap<String> stringTable) throws IOException {
private TransportStop readTransportRouteStop(int dx, int dy, long did, TIntObjectHashMap<String> stringTable,
int filePointer) throws IOException {
TransportStop dataObject = new TransportStop();
dataObject.setFileOffset(codedIS.getTotalBytesRead());
dataObject.setReferencesToRoutes(new int[] {filePointer});
boolean end = false;
while(!end){
int t = codedIS.readTag();

View file

@ -2343,7 +2343,7 @@ OsmAnd هو المصدر المفتوح و التي يجري تطويرها بن
<string name="local_index_description">انقر فوق أي عنصر لمعرفة المزيد من التفاصيل، اضغط وواصل الضغط للتعطيل أو الحذف. البيانات الحالية على الجهاز (%1$s متاحة):</string>
<string name="keep_informing_descr">إعادة إعلان تعليمات الملاحة في فترات منتظمة</string>
<string name="shared_string_others">آخرى</string>
<string name="local_index_action_do">أنت على وشك %1$s%2$ s عنصر. تواصل؟</string>
<string name="local_index_action_do">أنت على وشك %1$s %2$s عنصر. تواصل؟</string>
<string name="amenity_type_geocache">جيوكاش</string>
<string name="use_osmand_routing_service">ملاحة OsmAnd &gt; كم20</string>
<string name="record_plugin_description">"هذا البرنامج المساعد يفعل وظائف لتسجيل وحفظ المسارات الخاصة بك عبر النقر على نافذة GPX على شاشة الخريطة، أو كذلك تسجيل كافة طرق الملاحة الخاص بك تلقائيا إلى ملف GPX.

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="route_stops_before">%1$s stops before</string>
<string name="coords_search">Coordinates search</string>
<string name="advanced_coords_search">Advanced coordinates search</string>
<string name="back_to_search">Back to search</string>

View file

@ -1,5 +1,6 @@
package net.osmand.plus.mapcontextmenu.controllers;
import java.lang.ref.WeakReference;
import java.util.List;
import android.view.View;
@ -7,14 +8,17 @@ import android.view.View.OnClickListener;
import net.osmand.binary.OsmandOdb.TransportRouteStop;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.data.TransportStop;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.MapContextMenuFragment;
import net.osmand.plus.mapcontextmenu.MenuBuilder;
import net.osmand.plus.mapcontextmenu.MenuController;
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController.TransportStopRoute;
import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.TransportStopsLayer;
public class TransportRouteController extends MenuController {
@ -96,22 +100,53 @@ public class TransportRouteController extends MenuController {
super.addPlainMenuItems(typeStr, pointDescription, latLon);
List<TransportStop> stops = transportStop.route.getForwardStops();
boolean useEnglishNames = getMapActivity().getMyApplication().getSettings().usingEnglishNames();
for (final TransportStop stop : stops) {
int currentStop = -1;
for (int i = 0; i < stops.size(); i++) {
final TransportStop stop = stops.get(i);
if (stop.getName().equals(transportStop.stop.getName())) {
currentStop = i;
break;
}
}
int defaultIcon = transportStop.type == null ? R.drawable.mx_route_bus_ref : transportStop.type.getResourceId();
int startPosition = 0;
if(!transportStop.showWholeRoute) {
startPosition = (currentStop == -1 ? 0 : currentStop);
if (currentStop > 0) {
addPlainMenuItem(defaultIcon, getMapActivity().getString(R.string.route_stops_before, currentStop),
false, false, new OnClickListener() {
@Override
public void onClick(View arg0) {
MapContextMenu mm = getMapActivity().getContextMenu();
transportStop.showWholeRoute = true;
mm.showOrUpdate(latLon, getPointDescription(), transportStop);
TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
int cz = transportStop.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom());
stopsLayer.setRoute(transportStop.route);
}
});
}
}
for (int i = startPosition; i < stops.size(); i++) {
final TransportStop stop = stops.get(i);
final String name = useEnglishNames ? stop.getEnName(true) : stop.getName();
boolean currentStop = stop.getName().equals(transportStop.stop.getName());
addPlainMenuItem(currentStop? R.drawable.ic_action_marker_dark :
(transportStop.type == null ? R.drawable.mx_route_bus_ref : transportStop.type.getResourceId()),
name , false, false, new OnClickListener() {
addPlainMenuItem(currentStop == i ? R.drawable.ic_action_marker_dark: defaultIcon,
name, false, false, new OnClickListener() {
@Override
public void onClick(View arg0) {
MapContextMenu mm = getMapActivity().getContextMenu();
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
getMapActivity().getString(R.string.transport_Stop),
name);
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_STOP,
getMapActivity().getString(R.string.transport_Stop), name);
TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
stopsLayer.setRoute(null);
mm.show(latLon, pd, stop);
mm.show(stop.getLocation(), pd, stop);
WeakReference<MapContextMenuFragment> rr = mm.findMenuFragment();
if(rr != null && rr.get() != null) {
rr.get().centerMarkerLocation();
}
}
});
}

View file

@ -6,6 +6,7 @@ import java.util.List;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.RotatedTileBox;
import net.osmand.data.TransportRoute;
import net.osmand.data.TransportStop;
import net.osmand.plus.OsmandApplication;
@ -123,9 +124,11 @@ public class TransportStopController extends MenuController {
public void onClick(View arg0) {
MapContextMenu mm = getMapActivity().getContextMenu();
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_TRANSPORT_ROUTE, r.desc);
mm.show(latLon, pd, r);
TransportStopsLayer stopsLayer = getMapActivity().getMapLayers().getTransportStopsLayer();
stopsLayer.setRoute(r.route);
mm.show(latLon, pd, r);
int cz = r.calculateZoom(0, getMapActivity().getMapView().getCurrentRotatedTileBox());
getMapActivity().changeZoom(cz - getMapActivity().getMapView().getZoom());
}
};
if (r.type == null) {
@ -171,5 +174,24 @@ public class TransportStopController extends MenuController {
public String desc;
public TransportRoute route;
public TransportStop stop;
public boolean showWholeRoute;
public int calculateZoom(int startPosition, RotatedTileBox currentRotatedTileBox) {
RotatedTileBox cp = currentRotatedTileBox.copy();
boolean notContains = true;
while (cp.getZoom() > 12 && notContains) {
notContains = false;
List<TransportStop> sts = route.getForwardStops();
for(int i = startPosition; i < sts.size(); i++) {
TransportStop st = sts.get(startPosition);
if (!cp.containsLatLon(st.getLocation())) {
notContains = true;
break;
}
}
cp.setZoom(cp.getZoom() - 1);
}
return cp.getZoom();
}
}
}

View file

@ -106,7 +106,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
public void getFromPoint(RotatedTileBox tb,PointF point, List<? super TransportStop> res) {
if (data.getResults() != null) {
List<TransportStop> objects = data.getResults();
List<TransportStop> objects = route != null ? route.getForwardStops() : data.getResults();
int ex = (int) point.x;
int ey = (int) point.y;
final int rp = getRadiusPoi(tb);
@ -169,18 +169,34 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
try {
path.reset();
List<Way> ws = route.getForwardWays();
if (ws != null)
if (ws != null) {
for (Way w : ws) {
TIntArrayList tx = new TIntArrayList();
TIntArrayList ty = new TIntArrayList();
for (int i = 0; i < w.getNodes().size(); i++) {
Node o = w.getNodes().get(i);
int x = (int) tb.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
int y = (int) tb.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
tx.add(x);
ty.add(y);
}
calculatePath(tb, tx, ty, path);
}
}
attrs.drawPath(canvas, path);
} finally {
canvas.rotate(tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY());
}
}
float iconSize = stopBus.getWidth() * 3 / 2.5f;
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tb);
List<TransportStop> fullObjects = new ArrayList<>();
for (TransportStop o : data.getResults()) {
List<TransportStop> objects = data.getResults() ;
if(route != null) {
objects = route.getForwardStops();
}
for (TransportStop o : objects) {
float x = tb.getPixXFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());
float y = tb.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation().getLongitude());