Merge
This commit is contained in:
commit
c14914cfc4
61 changed files with 632 additions and 1111 deletions
|
@ -48,6 +48,7 @@ public class RenderingContext {
|
|||
|
||||
// be aware field is using in C++
|
||||
public float screenDensityRatio = 1;
|
||||
public float textScale = 1;
|
||||
public int shadowRenderingMode = ShadowRenderingMode.SOLID_SHADOW.value;
|
||||
public int shadowRenderingColor = 0xff969696;
|
||||
public String renderingDebugInfo;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.binary;
|
||||
|
||||
|
||||
import gnu.trove.iterator.TIntObjectIterator;
|
||||
import gnu.trove.iterator.TLongIterator;
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
import gnu.trove.list.array.TLongArrayList;
|
||||
|
@ -34,6 +35,8 @@ import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
|||
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiRegion;
|
||||
import net.osmand.binary.BinaryMapPoiReaderAdapter.PoiSubType;
|
||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
|
||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteSubregion;
|
||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||
import net.osmand.binary.BinaryMapTransportReaderAdapter.TransportIndex;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.AmenityType;
|
||||
|
@ -58,11 +61,13 @@ public class BinaryInspector {
|
|||
if(args.length == 1 && "test".equals(args[0])) {
|
||||
in.inspector(new String[]{
|
||||
//"-vpoi",
|
||||
"-vmap", "-vmapobjects",
|
||||
// "-vmap", "-vmapobjects",
|
||||
// "-vrouting",
|
||||
// "-vaddress", "-vcities", "-vstreets", "-vstreetgroups","-vbuildings",
|
||||
//"-zoom=16",
|
||||
//"-bbox=4,55,7,50",
|
||||
"/home/victor/projects/osmand/osm-gen/Map.obf"
|
||||
// "/home/victor/projects/osmand/osm-gen/Netherlands_europe.obf"
|
||||
// "/home/victor/projects/osmand/osm-gen/World_basemap_2_b.obf___"
|
||||
// "/home/victor/projects/osmand/osm-gen/World_basemap_2.obf__"
|
||||
});
|
||||
|
@ -106,6 +111,7 @@ public class BinaryInspector {
|
|||
boolean vtransport;
|
||||
boolean vpoi;
|
||||
boolean vmap;
|
||||
boolean vrouting;
|
||||
boolean vmapObjects;
|
||||
boolean osm;
|
||||
FileOutputStream osmOut = null;
|
||||
|
@ -126,6 +132,11 @@ public class BinaryInspector {
|
|||
public boolean isVmap() {
|
||||
return vmap;
|
||||
}
|
||||
|
||||
public boolean isVrouting() {
|
||||
return vrouting;
|
||||
}
|
||||
|
||||
public boolean isVpoi() {
|
||||
return vpoi;
|
||||
}
|
||||
|
@ -150,6 +161,8 @@ public class BinaryInspector {
|
|||
vintersections = true;
|
||||
} else if(params[i].equals("-vmap")){
|
||||
vmap = true;
|
||||
} else if(params[i].equals("-vrouting")){
|
||||
vrouting = true;
|
||||
} else if(params[i].equals("-vmapobjects")){
|
||||
vmapObjects = true;
|
||||
} else if(params[i].equals("-vpoi")){
|
||||
|
@ -451,6 +464,9 @@ public class BinaryInspector {
|
|||
RouteRegion ri = ((RouteRegion) p);
|
||||
println("\tBounds " + formatLatBounds(ri.getLeftLongitude(), ri.getRightLongitude(),
|
||||
ri.getTopLatitude(), ri.getBottomLatitude()));
|
||||
if((vInfo != null && vInfo.isVrouting())){
|
||||
printRouteDetailInfo(index, (RouteRegion) p);
|
||||
}
|
||||
} else if(p instanceof MapIndex){
|
||||
MapIndex m = ((MapIndex) p);
|
||||
int j = 1;
|
||||
|
@ -486,6 +502,45 @@ public class BinaryInspector {
|
|||
|
||||
}
|
||||
|
||||
private void printRouteDetailInfo(BinaryMapIndexReader index, RouteRegion p) throws IOException {
|
||||
final DamnCounter mapObjectsCounter = new DamnCounter();
|
||||
final StringBuilder b = new StringBuilder();
|
||||
List<RouteSubregion> regions = index.searchRouteIndexTree(
|
||||
BinaryMapIndexReader.buildSearchRequest(MapUtils.get31TileNumberX(vInfo.lonleft),
|
||||
MapUtils.get31TileNumberX(vInfo.lonright), MapUtils.get31TileNumberY(vInfo.lattop),
|
||||
MapUtils.get31TileNumberY(vInfo.latbottom), vInfo.getZoom(), null),
|
||||
p.getSubregions());
|
||||
index.loadRouteIndexData(regions, new ResultMatcher<RouteDataObject>() {
|
||||
@Override
|
||||
public boolean publish(RouteDataObject obj) {
|
||||
mapObjectsCounter.value++;
|
||||
b.setLength(0);
|
||||
b.append("Road ");
|
||||
b.append(obj.id);
|
||||
for(int i = 0; i < obj.getTypes().length; i++) {
|
||||
RouteTypeRule rr = obj.region.quickGetEncodingRule(obj.getTypes()[i]);
|
||||
b.append(" ").append(rr.getTag()).append("='").append(rr.getValue()).append("'");
|
||||
}
|
||||
if (obj.getNames() != null) {
|
||||
TIntObjectIterator<String> it = obj.getNames().iterator();
|
||||
while (it.hasNext()) {
|
||||
it.advance();
|
||||
RouteTypeRule rr = obj.region.quickGetEncodingRule(it.key());
|
||||
b.append(" ").append(rr.getTag()).append("='").append(it.value()).append("'");
|
||||
}
|
||||
}
|
||||
println(b.toString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
println("\tTotal map objects: " + mapObjectsCounter.value);
|
||||
}
|
||||
|
||||
private void printAddressDetailedInfo(VerboseInfo verbose, BinaryMapIndexReader index, AddressRegion region) throws IOException {
|
||||
String[] cityType_String = new String[] {
|
||||
"Cities/Towns section",
|
||||
|
@ -832,7 +887,7 @@ public class BinaryInspector {
|
|||
}
|
||||
println("Inspector is console utility for working with binary indexes of OsmAnd.");
|
||||
println("It allows print info about file, extract parts and merge indexes.");
|
||||
println("\nUsage for print info : inspector [-vaddress] [-vstreetgroups] [-vstreets] [-vbuildings] [-vintersections] [-vmap] [-vmapobjects] [-osm] [-vpoi] [-vtransport] [-zoom=Zoom] [-bbox=LeftLon,TopLat,RightLon,BottomLan] [file]");
|
||||
println("\nUsage for print info : inspector [-vaddress] [-vstreetgroups] [-vstreets] [-vbuildings] [-vintersections] [-vmap] [-vmapobjects] [-osm] [-vpoi] [-vrouting] [-vtransport] [-zoom=Zoom] [-bbox=LeftLon,TopLat,RightLon,BottomLan] [file]");
|
||||
println(" Prints information about [file] binary index of OsmAnd.");
|
||||
println(" -v.. more verbouse output (like all cities and their streets or all map objects with tags/values and coordinates)");
|
||||
println("\nUsage for combining indexes : inspector -c file_to_create (file_from_extract ((+|-)parts_to_extract)? )*");
|
||||
|
|
|
@ -479,11 +479,12 @@ public class RenderingRulesStorage {
|
|||
// int count = 100000;
|
||||
// for (int i = 0; i < count; i++) {
|
||||
RenderingRuleSearchRequest searchRequest = new RenderingRuleSearchRequest(storage);
|
||||
searchRequest.setStringFilter(storage.PROPS.R_TAG, "building");
|
||||
searchRequest.setStringFilter(storage.PROPS.R_VALUE, "yes");
|
||||
searchRequest.setIntFilter(storage.PROPS.R_LAYER, 1);
|
||||
searchRequest.setIntFilter(storage.PROPS.R_MINZOOM, 16);
|
||||
searchRequest.setIntFilter(storage.PROPS.R_MAXZOOM, 16);
|
||||
searchRequest.setStringFilter(storage.PROPS.R_TAG, "natural");
|
||||
searchRequest.setStringFilter(storage.PROPS.R_VALUE, "tree");
|
||||
searchRequest.setStringFilter(storage.PROPS.R_ADDITIONAL, "leaf_type=broadleaved");
|
||||
// searchRequest.setIntFilter(storage.PROPS.R_LAYER, 1);
|
||||
searchRequest.setIntFilter(storage.PROPS.R_MINZOOM, 18);
|
||||
searchRequest.setIntFilter(storage.PROPS.R_MAXZOOM, 18);
|
||||
// searchRequest.setBooleanFilter(storage.PROPS.R_NIGHT_MODE, true);
|
||||
// searchRequest.setBooleanFilter(storage.PROPS.get("hmRendered"), true);
|
||||
for (RenderingRuleProperty customProp : storage.PROPS.getCustomRules()) {
|
||||
|
@ -493,7 +494,7 @@ public class RenderingRulesStorage {
|
|||
searchRequest.setStringFilter(customProp, "");
|
||||
}
|
||||
}
|
||||
boolean res = searchRequest.search(POLYGON_RULES);
|
||||
boolean res = searchRequest.search(POINT_RULES);
|
||||
System.out.println("Result " + res);
|
||||
printResult(searchRequest, System.out);
|
||||
// }
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.Map;
|
|||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
|
@ -37,7 +36,7 @@ public class RenderingRulesTransformer {
|
|||
transform(document);
|
||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||
Transformer transformer = transformerFactory.newTransformer();
|
||||
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
// transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
DOMSource source = new DOMSource(document.getDocumentElement());
|
||||
StreamResult streamResult = new StreamResult(new File(targetFile));
|
||||
transformer.transform(source, streamResult);
|
||||
|
@ -47,18 +46,17 @@ public class RenderingRulesTransformer {
|
|||
static Map<String, Element> patterns = new HashMap<String, Element>();
|
||||
|
||||
public static void transform(Document document) {
|
||||
collectPatterns(document);
|
||||
applyPatterns(document);
|
||||
|
||||
combineAllApplyTags(document);
|
||||
|
||||
replaceTag(document, "ifelse", "filter");
|
||||
replaceTag(document, "check", "filter");
|
||||
replaceTag(document, "check_and_apply", "filter");
|
||||
// collectPatterns(document);
|
||||
// applyPatterns(document);
|
||||
// combineAllApplyTags(document);
|
||||
//
|
||||
// replaceTag(document, "ifelse", "filter");
|
||||
// replaceTag(document, "check", "filter");
|
||||
// replaceTag(document, "check_and_apply", "filter");
|
||||
}
|
||||
|
||||
|
||||
private static void combineAllApplyTags(Document document) {
|
||||
public static void combineAllApplyTags(Document document) {
|
||||
NodeList nl = document.getElementsByTagName("apply");
|
||||
while(nl.getLength() > 0) {
|
||||
Element app = (Element) nl.item(0);
|
||||
|
@ -77,7 +75,7 @@ public class RenderingRulesTransformer {
|
|||
}
|
||||
|
||||
|
||||
private static void applyPatterns(Document document) {
|
||||
public static void applyPatterns(Document document) {
|
||||
NodeList nl = document.getElementsByTagName("apply");
|
||||
for (int i = 0; i < nl.getLength();) {
|
||||
Element app = (Element) nl.item(i);
|
||||
|
@ -100,7 +98,7 @@ public class RenderingRulesTransformer {
|
|||
}
|
||||
|
||||
|
||||
private static void collectPatterns(Document document) {
|
||||
public static void collectPatterns(Document document) {
|
||||
NodeList nl = document.getElementsByTagName("pattern");
|
||||
while(nl.getLength() > 0) {
|
||||
Element pt = (Element) nl.item(0);
|
||||
|
@ -112,7 +110,7 @@ public class RenderingRulesTransformer {
|
|||
}
|
||||
|
||||
|
||||
protected static void replaceTag(Document document, final String tag, final String targetTag) {
|
||||
public static void replaceTag(Document document, final String tag, final String targetTag) {
|
||||
NodeList nl = document.getElementsByTagName(tag);
|
||||
while(nl.getLength() > 0) {
|
||||
Element newElement = document.createElement(targetTag);
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.apache.commons.logging.Log;
|
|||
|
||||
public class BinaryRoutePlanner {
|
||||
|
||||
private static final int TEST_ID = 235108903;
|
||||
private static final int TEST_ID = 31370645;
|
||||
private static final boolean TEST_SPECIFIC = false;
|
||||
|
||||
private static final int REVERSE_WAY_RESTRICTION_ONLY = 1024;
|
||||
|
@ -700,6 +700,14 @@ public class BinaryRoutePlanner {
|
|||
public void visitSegment(RouteSegment segment, int segmentEnd, boolean poll);
|
||||
}
|
||||
|
||||
public static class RouteSegmentPoint extends RouteSegment{
|
||||
public RouteSegmentPoint(RouteDataObject road, int segmentStart) {
|
||||
super(road, segmentStart);
|
||||
}
|
||||
public int preciseX;
|
||||
public int preciseY;
|
||||
}
|
||||
|
||||
public static class RouteSegment {
|
||||
final short segStart;
|
||||
final RouteDataObject road;
|
||||
|
|
|
@ -324,7 +324,7 @@ public class GeneralRouter implements VehicleRouter {
|
|||
RouteTypeRule r = reg.quickGetEncodingRule(pt[i]);
|
||||
if ("highway".equals(r.getTag()) && "traffic_signals".equals(r.getValue())) {
|
||||
// traffic signals don't add turn info
|
||||
return 0;
|
||||
// return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.binary.RouteDataObject;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.router.BinaryRoutePlanner.RouteSegment;
|
||||
import net.osmand.router.BinaryRoutePlanner.RouteSegmentPoint;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -50,7 +51,7 @@ public class RoutePlannerFrontEnd {
|
|||
return dx * dx + dy * dy;
|
||||
}
|
||||
|
||||
public RouteSegment findRouteSegment(double lat, double lon, RoutingContext ctx) throws IOException {
|
||||
public RouteSegmentPoint findRouteSegment(double lat, double lon, RoutingContext ctx) throws IOException {
|
||||
int px = MapUtils.get31TileNumberX(lon);
|
||||
int py = MapUtils.get31TileNumberY(lat);
|
||||
ArrayList<RouteDataObject> dataObjects = new ArrayList<RouteDataObject>();
|
||||
|
@ -58,9 +59,9 @@ public class RoutePlannerFrontEnd {
|
|||
if (dataObjects.isEmpty()) {
|
||||
ctx.loadTileData(px, py, 15, dataObjects);
|
||||
}
|
||||
RouteSegment road = null;
|
||||
RouteSegmentPoint road = null;
|
||||
|
||||
double sdist = 0;
|
||||
|
||||
for (RouteDataObject r : dataObjects) {
|
||||
if (r.getPointsLength() > 1) {
|
||||
for (int j = 1; j < r.getPointsLength(); j++) {
|
||||
|
@ -69,17 +70,18 @@ public class RoutePlannerFrontEnd {
|
|||
double currentsDist = squareDist((int) pr.x, (int)pr.y, px, py);
|
||||
if (road == null || currentsDist < sdist) {
|
||||
RouteDataObject ro = new RouteDataObject(r);
|
||||
road = new RouteSegment(ro, j);
|
||||
ro.insert(j, (int) pr.x, (int)pr.y);
|
||||
road = new RouteSegmentPoint(ro, j);
|
||||
road.preciseX = (int) pr.x;
|
||||
road.preciseY = (int) pr.y;
|
||||
sdist = currentsDist;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (road != null) {
|
||||
// if (road != null) {
|
||||
// re-register the best road because one more point was inserted
|
||||
ctx.registerRouteDataObject(road.getRoad());
|
||||
}
|
||||
// ctx.registerRouteDataObject(road.getRoad());
|
||||
// }
|
||||
return road;
|
||||
}
|
||||
|
||||
|
@ -122,10 +124,11 @@ public class RoutePlannerFrontEnd {
|
|||
if(res != null) {
|
||||
new RouteResultPreparation().printResults(ctx, start, end, res);
|
||||
}
|
||||
makeStartEndPointsPrecise(res, start, end, intermediates);
|
||||
return res;
|
||||
}
|
||||
int indexNotFound = 0;
|
||||
List<RouteSegment> points = new ArrayList<BinaryRoutePlanner.RouteSegment>();
|
||||
List<RouteSegmentPoint> points = new ArrayList<RouteSegmentPoint>();
|
||||
if(!addSegment(start, ctx, indexNotFound++, points)){
|
||||
return null;
|
||||
}
|
||||
|
@ -140,14 +143,123 @@ public class RoutePlannerFrontEnd {
|
|||
return null;
|
||||
}
|
||||
List<RouteSegmentResult> res = searchRoute(ctx, points, routeDirection);
|
||||
// make start and end more precise
|
||||
makeStartEndPointsPrecise(res, start, end, intermediates);
|
||||
if(res != null) {
|
||||
new RouteResultPreparation().printResults(ctx, start, end, res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
protected void makeStartEndPointsPrecise(List<RouteSegmentResult> res, LatLon start, LatLon end, List<LatLon> intermediates) {
|
||||
if (res.size() > 0) {
|
||||
updateResult(res.get(0), start, true);
|
||||
updateResult(res.get(res.size() - 1), end, false);
|
||||
if (intermediates != null) {
|
||||
int k = 1;
|
||||
for (int i = 0; i < intermediates.size(); i++) {
|
||||
LatLon ll = intermediates.get(i);
|
||||
int px = MapUtils.get31TileNumberX(ll.getLongitude());
|
||||
int py = MapUtils.get31TileNumberY(ll.getLatitude());
|
||||
for (; k < res.size(); k++) {
|
||||
double currentsDist = projectDistance(res, k, px, py);
|
||||
if (currentsDist < 500 * 500) {
|
||||
for (int k1 = k + 1; k1 < res.size(); k1++) {
|
||||
double c2 = projectDistance(res, k1, px, py);
|
||||
if (c2 < currentsDist) {
|
||||
k = k1;
|
||||
currentsDist = c2;
|
||||
} else if (k1 - k > 15) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateResult(res.get(k), ll, false);
|
||||
if (k < res.size() - 1) {
|
||||
updateResult(res.get(k + 1), ll, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected double projectDistance(List<RouteSegmentResult> res, int k, int px, int py) {
|
||||
RouteSegmentResult sr = res.get(k);
|
||||
RouteDataObject r = sr.getObject();
|
||||
QuadPoint pp = MapUtils.getProjectionPoint31(px, py,
|
||||
r.getPoint31XTile(sr.getStartPointIndex()), r.getPoint31YTile(sr.getStartPointIndex()),
|
||||
r.getPoint31XTile(sr.getEndPointIndex()), r.getPoint31YTile(sr.getEndPointIndex()));
|
||||
double currentsDist = squareDist((int) pp.x, (int)pp.y, px, py);
|
||||
return currentsDist;
|
||||
}
|
||||
|
||||
private boolean addSegment(LatLon s, RoutingContext ctx, int indexNotFound, List<RouteSegment> res) throws IOException {
|
||||
RouteSegment f = findRouteSegment(s.getLatitude(), s.getLongitude(), ctx);
|
||||
private void updateResult(RouteSegmentResult routeSegmentResult, LatLon point, boolean st) {
|
||||
int px = MapUtils.get31TileNumberX(point.getLongitude());
|
||||
int py = MapUtils.get31TileNumberY(point.getLatitude());
|
||||
int pind = st ? routeSegmentResult.getStartPointIndex() : routeSegmentResult.getEndPointIndex();
|
||||
|
||||
RouteDataObject r = routeSegmentResult.getObject();
|
||||
QuadPoint before = null;
|
||||
QuadPoint after = null;
|
||||
if(pind > 0) {
|
||||
before = MapUtils.getProjectionPoint31(px, py, r.getPoint31XTile(pind - 1),
|
||||
r.getPoint31YTile(pind - 1), r.getPoint31XTile(pind ), r.getPoint31YTile(pind ));
|
||||
}
|
||||
if(pind < r.getPointsLength() - 1) {
|
||||
after = MapUtils.getProjectionPoint31(px, py, r.getPoint31XTile(pind + 1),
|
||||
r.getPoint31YTile(pind + 1), r.getPoint31XTile(pind ), r.getPoint31YTile(pind ));
|
||||
}
|
||||
int insert = 0;
|
||||
double dd = MapUtils.getDistance(point, MapUtils.get31LatitudeY(r.getPoint31YTile(pind)),
|
||||
MapUtils.get31LongitudeX(r.getPoint31XTile(pind)));
|
||||
double ddBefore = Double.POSITIVE_INFINITY;
|
||||
double ddAfter = Double.POSITIVE_INFINITY;
|
||||
QuadPoint i = null;
|
||||
if(before != null) {
|
||||
ddBefore = MapUtils.getDistance(point, MapUtils.get31LatitudeY((int) before.y),
|
||||
MapUtils.get31LongitudeX((int) before.x));
|
||||
if(ddBefore < dd) {
|
||||
insert = -1;
|
||||
i = before;
|
||||
}
|
||||
}
|
||||
|
||||
if(after != null) {
|
||||
ddAfter = MapUtils.getDistance(point, MapUtils.get31LatitudeY((int) after.y),
|
||||
MapUtils.get31LongitudeX((int) after.x));
|
||||
if(ddAfter < dd && ddAfter < ddBefore) {
|
||||
insert = 1;
|
||||
i = after;
|
||||
}
|
||||
}
|
||||
|
||||
if (insert != 0) {
|
||||
if (st && routeSegmentResult.getStartPointIndex() < routeSegmentResult.getEndPointIndex()) {
|
||||
routeSegmentResult.setEndPointIndex(routeSegmentResult.getEndPointIndex() + 1);
|
||||
}
|
||||
if (!st && routeSegmentResult.getStartPointIndex() > routeSegmentResult.getEndPointIndex()) {
|
||||
routeSegmentResult.setStartPointIndex(routeSegmentResult.getStartPointIndex() + 1);
|
||||
}
|
||||
if (insert > 0) {
|
||||
r.insert(pind + 1, (int) i.x, (int) i.y);
|
||||
if (st) {
|
||||
routeSegmentResult.setStartPointIndex(routeSegmentResult.getStartPointIndex() + 1);
|
||||
}
|
||||
if (!st) {
|
||||
routeSegmentResult.setEndPointIndex(routeSegmentResult.getEndPointIndex() + 1);
|
||||
}
|
||||
} else {
|
||||
r.insert(pind, (int) i.x, (int) i.y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean addSegment(LatLon s, RoutingContext ctx, int indexNotFound, List<RouteSegmentPoint> res) throws IOException {
|
||||
RouteSegmentPoint f = findRouteSegment(s.getLatitude(), s.getLongitude(), ctx);
|
||||
if(f == null){
|
||||
ctx.calculationProgress.segmentNotFound = indexNotFound;
|
||||
return false;
|
||||
|
@ -202,7 +314,7 @@ public class RoutePlannerFrontEnd {
|
|||
long time = System.currentTimeMillis();
|
||||
RouteSegmentResult[] res = ctx.nativeLib.runNativeRouting(ctx.startX, ctx.startY, ctx.targetX, ctx.targetY,
|
||||
ctx.config, regions, ctx.calculationProgress, ctx.precalculatedRouteDirection, ctx.calculationMode == RouteCalculationMode.BASE);
|
||||
System.out.println("Native routing took " + (System.currentTimeMillis() - time) / 1000f + " seconds");
|
||||
log.info("Native routing took " + (System.currentTimeMillis() - time) / 1000f + " seconds");
|
||||
ArrayList<RouteSegmentResult> result = new ArrayList<RouteSegmentResult>(Arrays.asList(res));
|
||||
ctx.routingTime = ctx.calculationProgress.routingCalculatedTime;
|
||||
ctx.visitedSegments = ctx.calculationProgress.visitedSegments;
|
||||
|
@ -211,7 +323,7 @@ public class RoutePlannerFrontEnd {
|
|||
}
|
||||
|
||||
|
||||
private List<RouteSegmentResult> searchRoute(final RoutingContext ctx, List<RouteSegment> points, PrecalculatedRouteDirection routeDirection)
|
||||
private List<RouteSegmentResult> searchRoute(final RoutingContext ctx, List<RouteSegmentPoint> points, PrecalculatedRouteDirection routeDirection)
|
||||
throws IOException, InterruptedException {
|
||||
if (points.size() <= 2) {
|
||||
ctx.previouslyCalculatedRoute = null;
|
||||
|
|
|
@ -8,6 +8,9 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.binary.BinaryMapIndexReader;
|
||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||
import net.osmand.binary.RouteDataObject;
|
||||
|
@ -21,6 +24,7 @@ public class RouteResultPreparation {
|
|||
|
||||
public static boolean PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = false;
|
||||
private static final float TURN_DEGREE_MIN = 45;
|
||||
private Log log = PlatformUtil.getLog(RouteResultPreparation.class);
|
||||
/**
|
||||
* Helper method to prepare final result
|
||||
*/
|
||||
|
@ -258,12 +262,14 @@ public class RouteResultPreparation {
|
|||
double startLon = start.getLongitude();
|
||||
double endLat = end.getLatitude();
|
||||
double endLon = end.getLongitude();
|
||||
println(MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
|
||||
String msg = MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
|
||||
+ " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" {5} >",
|
||||
startLat + "", startLon + "", endLat + "", endLon + "", ctx.config.routerName,
|
||||
"loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " +
|
||||
"complete_distance = \"" + completeDistance + "\" " + "complete_time = \"" + completeTime + "\" " +
|
||||
"routing_time = \"" + ctx.routingTime + "\" "));
|
||||
"routing_time = \"" + ctx.routingTime + "\" ");
|
||||
log.info(msg);
|
||||
println(msg);
|
||||
if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) {
|
||||
for (RouteSegmentResult res : result) {
|
||||
String name = res.getObject().getName();
|
||||
|
|
|
@ -87,6 +87,7 @@ public class RoutingConfiguration {
|
|||
i.memoryLimitation = memoryLimitMB * (1 << 20);
|
||||
}
|
||||
i.planRoadDirection = parseSilentInt(getAttribute(i.router, "planRoadDirection"), i.planRoadDirection);
|
||||
// i.planRoadDirection = 1;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -213,25 +213,6 @@ public class RoutingContext {
|
|||
startY = start.road.getPoint31YTile(start.getSegmentStart());
|
||||
}
|
||||
|
||||
public void registerRouteDataObject(RouteDataObject o ) {
|
||||
if(!getRouter().acceptLine(o)){
|
||||
return;
|
||||
}
|
||||
for(int k = 0; k<o.getPointsLength(); k++) {
|
||||
int x31 = o.getPoint31XTile(k);
|
||||
int y31 = o.getPoint31YTile(k);
|
||||
long tileId = getRoutingTile(x31, y31, 0, OPTION_NO_LOAD);
|
||||
List<RouteDataObject> routes = tileRoutes.get(tileId);
|
||||
if(routes == null){
|
||||
routes = new ArrayList<RouteDataObject>();
|
||||
tileRoutes.put(tileId, routes);
|
||||
}
|
||||
if(!routes.contains(o)){
|
||||
routes.add(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void unloadAllData() {
|
||||
unloadAllData(null);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,13 @@ public class GeoPointParserUtil {
|
|||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
||||
|
||||
// geo:34.99,-106.61?q=34.99%2C-106.61 (Treasure Island)
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "geo:" + dlat + "," + dlon + "?q=" + dlat + "%2C" + dlon + " (" + name + ")";
|
||||
System.out.println("url: " + url);
|
||||
actual = GeoPointParserUtil.parse("geo", url);
|
||||
assertGeoPoint(actual, new GeoParsedPoint(dlat, dlon, z, name));
|
||||
|
||||
// 0,0?q=34,-106(Treasure Island)
|
||||
z = GeoParsedPoint.NO_ZOOM;
|
||||
url = "geo:0,0?q=" + ilat + "," + ilon + " (" + name + ")";
|
||||
|
@ -331,7 +338,7 @@ public class GeoPointParserUtil {
|
|||
* @return {@link GeoParsedPoint}
|
||||
*/
|
||||
public static GeoParsedPoint parse(final String scheme, final String uri) {
|
||||
final URI data = URI.create(uri.replaceAll("\\s+", "+").replaceAll("%20", "+"));
|
||||
final URI data = URI.create(uri.replaceAll("\\s+", "+").replaceAll("%20", "+").replaceAll("%2C", ","));
|
||||
if ("http".equals(scheme) || "https".equals(scheme)) {
|
||||
|
||||
final String schemeSpecific = data.getSchemeSpecificPart();
|
||||
|
@ -469,7 +476,7 @@ public class GeoPointParserUtil {
|
|||
} else {
|
||||
// geo:47.6,-122.3
|
||||
// geo:47.6,-122.3?z=11 (Treasure Island)
|
||||
final String pattern = "([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:\\?z=(\\d{1,2}))?[\\+]?(?:\\((.*?)\\))?";
|
||||
final String pattern = "([+-]?\\d+(?:\\.\\d+)?),([+-]?\\d+(?:\\.\\d+)?)(?:(?:\\?z=(\\d{1,2}))?|(?:\\?q=.*?)?)[\\+]?(?:\\((.*?)\\))?";
|
||||
final Matcher matcher = Pattern.compile(pattern).matcher(schemeSpecific);
|
||||
if (matcher.matches()) {
|
||||
final double lat = Double.valueOf(matcher.group(1));
|
||||
|
|
|
@ -248,18 +248,18 @@ public class MapUtils {
|
|||
return (rotateSin * dTileX + rotateCos * dTileY) * tileSize ;
|
||||
}
|
||||
|
||||
public static double getLatitudeFromTile(float zoom, double y){
|
||||
public static double getLatitudeFromTile(float zoom, double y) {
|
||||
int sign = y < 0 ? -1 : 1;
|
||||
return Math.atan(sign*Math.sinh(Math.PI * (1 - 2 * y / getPowZoom(zoom)))) * 180d / Math.PI;
|
||||
return Math.atan(sign * Math.sinh(Math.PI * (1 - 2 * y / getPowZoom(zoom)))) * 180d / Math.PI;
|
||||
}
|
||||
|
||||
|
||||
public static int getPixelShiftX(int zoom, double long1, double long2, int tileSize){
|
||||
public static int getPixelShiftX(float zoom, double long1, double long2, double tileSize){
|
||||
return (int) ((getTileNumberX(zoom, long1) - getTileNumberX(zoom, long2)) * tileSize);
|
||||
}
|
||||
|
||||
|
||||
public static int getPixelShiftY(int zoom, double lat1, double lat2, int tileSize){
|
||||
public static int getPixelShiftY(float zoom, double lat1, double lat2, double tileSize){
|
||||
return (int) ((getTileNumberY(zoom, lat1) - getTileNumberY(zoom, lat2)) * tileSize);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<asset source="voice/nl/ttsconfig.p" destination="voice/nl-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/pl/ttsconfig.p" destination="voice/pl-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/pt/ttsconfig.p" destination="voice/pt-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/pt-br/ttsconfig.p" destination="voice/pt-br-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/ro/ttsconfig.p" destination="voice/ro-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
<asset source="voice/ru/ttsconfig.p" destination="voice/ru-tts/_ttsconfig.p" mode="alwaysOverwriteOrCopy" />
|
||||
<asset source="voice/sk/ttsconfig.p" destination="voice/sk-tts/_ttsconfig.p" mode="overwriteOnlyIfExists" />
|
||||
|
|
Binary file not shown.
|
@ -1895,4 +1895,6 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
|
|||
<string name="traffic_warning_speed_camera">Càmera de control de velocitat</string>
|
||||
<string name="traffic_warning">Avís de circulació</string>
|
||||
<string name="local_index_description">Premeu qualsevol indicació existent per veure més detalls, mantingueu premuda per desactivar o esborrar. Dades actuals al dispositiu (%1$s lliure):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Definiu la mida del text en el mapa.</string>
|
||||
<string name="text_size">Mida del text</string>
|
||||
</resources>
|
||||
|
|
|
@ -1734,4 +1734,5 @@ s často kladenými otázkami.</string>
|
|||
<string name="traffic_warning">Dopravní varování</string>
|
||||
<string name="route_descr_destination"/>
|
||||
<string name="local_index_description">Klikněte na existující položku k zobrazení více detailů, podržte pro vypnutí nebo smazání. V zařízení je %1$s volného místa:</string>
|
||||
</resources>
|
||||
<string name="text_size">Velikost písma</string>
|
||||
</resources>
|
||||
|
|
|
@ -1124,7 +1124,7 @@ Afghanistan, Albanien, Algeriet, Andorra, Angola, Anguilla, Antigua og Barbuda,
|
|||
<string name="use_trackball_descr">Brug trackball for at flytte kortet</string>
|
||||
<string name="use_trackball">Brug trackball</string>
|
||||
<string name="background_service_wait_int_descr">Indstil maksimal ventetid mellem hver positionssøgning i baggrunden</string>
|
||||
<string name="background_service_wait_int">Maksimal ventetid på låsning</string>
|
||||
<string name="background_service_wait_int">Maks ventetid på låsning</string>
|
||||
<string name="service_stop_background_service">Sluk for OsmAnd navigationstjeneste i dvaletilstand</string>
|
||||
<string name="where_am_i">Hvor er jeg?</string>
|
||||
<string name="network_provider">Netværk</string>
|
||||
|
@ -1270,7 +1270,7 @@ Afghanistan, Albanien, Algeriet, Andorra, Angola, Anguilla, Antigua og Barbuda,
|
|||
<string name="search_osm_nominatim">Online søgning ved hjælp af OSM Nominatim</string>
|
||||
<string name="hint_search_online">Husnummer, gade, by</string>
|
||||
<string name="search_online_address">Online søgning</string>
|
||||
<string name="max_level_download_tile">Maks. online zoom</string>
|
||||
<string name="max_level_download_tile">Maks online zoom</string>
|
||||
<string name="max_level_download_tile_descr">Vælg maksimum zoomniveau der hentes for online delkort</string>
|
||||
<string name="tip_map_switch_t_v2">Kortkilden og lag der vises kan ændres via \'Menu\' → \'Kortlag\'.
|
||||
\n\nUnder \'Kortkilde...\' vælges de forhåndsindlæste vektorkort, forhåndsdefinerede (online) delkortkilder (aktiver \'Online og delkort\' udvidelsen) eller kort der er manuelt oprettet f.eks. ved hjælp af OsmAndMapCreator på en PC.
|
||||
|
@ -1557,8 +1557,8 @@ Afghanistan, Albanien, Algeriet, Andorra, Angola, Anguilla, Antigua og Barbuda,
|
|||
<string name="driving_region">Område</string>
|
||||
<string name="driving_region_descr">Vælg område: USA, Europa, England, Asien m.fl.</string>
|
||||
<string name="map_widget_fps_info">FPS-fejlsøgningssinfo</string>
|
||||
<string name="local_index_tile_data_expire">Udløber ( minutter): %1$s</string>
|
||||
<string name="local_index_tile_data_maxzoom">Maksimal zoomniveau: %1$s</string>
|
||||
<string name="local_index_tile_data_expire">Udløber (minutter): %1$s</string>
|
||||
<string name="local_index_tile_data_maxzoom">Maks zoomniveau: %1$s</string>
|
||||
<string name="local_index_tile_data_minzoom">Minimum zoomniveau: %1$s</string>
|
||||
<string name="edit_tilesource_elliptic_tile">Elliptisk mercator</string>
|
||||
<string name="edit_tilesource_maxzoom">Maks. zoomniveau</string>
|
||||
|
@ -1658,7 +1658,7 @@ Afghanistan, Albanien, Algeriet, Andorra, Angola, Anguilla, Antigua og Barbuda,
|
|||
<string name="routing_attr_avoid_ferries_description">Undgå færger</string>
|
||||
<string name="routing_attr_avoid_motorway_name">Motorveje</string>
|
||||
<string name="routing_attr_avoid_motorway_description">Undgå motorveje</string>
|
||||
<string name="routing_attr_weight_name">Maksimal vægt</string>
|
||||
<string name="routing_attr_weight_name">Maks vægt</string>
|
||||
<string name="routing_attr_weight_description">Angiv køretøjets vægt begrænsning</string>
|
||||
<string name="routing_attr_short_way_name">Korteste rute</string>
|
||||
<string name="routing_attr_short_way_description">Anvend korteste rute</string>
|
||||
|
@ -1846,7 +1846,7 @@ Afghanistan, Albanien, Algeriet, Andorra, Angola, Anguilla, Antigua og Barbuda,
|
|||
<string name="gpx_file_is_empty">GPX-spor er tomt</string>
|
||||
<string name="gpx_info_waypoints">Rutepunkter: %1$s </string>
|
||||
<string name="gpx_info_distance">Afstand: %1$s (%2$s punkter) </string>
|
||||
<string name="gpx_info_start_time">Startid: %1$tF, %1$tT </string>
|
||||
<string name="gpx_info_start_time">"Starttid: %1$tF, %1$tT "</string>
|
||||
<string name="gpx_info_end_time">Sluttid: %1$tF, %1$tT </string>
|
||||
<string name="gpx_info_average_speed">Gennemsnitshastighed: %1$s </string>
|
||||
<string name="gpx_info_maximum_speed">Maks hastighed: %1$s </string>
|
||||
|
@ -1987,4 +1987,6 @@ Afghanistan, Albanien, Algeriet, Andorra, Angola, Anguilla, Antigua og Barbuda,
|
|||
<string name="traffic_warning_speed_camera">Fartkamera</string>
|
||||
<string name="traffic_warning">Trafikadvarsel</string>
|
||||
<string name="local_index_description">Klik på et eksisterende element for at se flere detaljer, langt tryk for at deaktivere eller slette. Aktuelle data på enhed (%1$s ledig):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Vælg tekststørrelsen på kortet.</string>
|
||||
<string name="text_size">Tekststørrelse</string>
|
||||
</resources>
|
||||
|
|
|
@ -1839,11 +1839,7 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
|
|||
|
||||
<string name="osmo_settings_uuid">Geräte-ID</string>
|
||||
<string name="osmo_settings_descr">Konfigurieren der Überwachungs-Einstellungen und des persönlichen Überwachungs-Kanals</string>
|
||||
<string name="osmo_plugin_description">OpenStreetMap erweiterte Live-Überwachung, siehe http://osmo.mobi. Ermöglicht die Verfolgung des eigenen oder anderer Geräten.
|
||||
Erstellen anonymer Gruppen, teilen des Standortes sowie Kommunizieren untereinander. Es gibt verschiedene Einstellungen für Sitzungs- oder Permanenet-Aufzeichnung.
|
||||
Anonyme Gruppen sind-zeit-oder funktionslimitiert, ohne Fernkonfiguration oder Gruppen-Adminisrator
|
||||
Voll funktionsfähige Gruppen müssen auf der Internetseite erstellt werden, auf diese haben nur registrierte Nutzer Zugriff.
|
||||
</string>
|
||||
<string name="osmo_plugin_description">"Erweiterte OpenStreetMap-basierte Live-Überwachung, siehe http://osmo.mobi ... Ermöglicht die Positionsdarstellung in von einzelnen Geräten in Echtzeit. Bei anonym erstellten Gruppen sind die Optionen etwas eingeschränkt: Lebensdauer der Gruppe nur für einige Tage, auch ist keine zentrale Steuerung der Gruppe möglich. Es gibt verschiedene Einstellungen für zeitlich begrenzte oder Dauer-Aufzeichnung. Voll funktionsfähige Gruppen müssen auf der genannten Internetseite erstellt werden, auf die Gruppe haben nur registrierte Nutzer Zugriff. "</string>
|
||||
<string name="osmo_plugin_name">OsMo (Erweiterte Live-Überwachung)</string>
|
||||
<string name="osmo_settings">OsMo OpenStreetMap-Überwachung</string>
|
||||
<string name="osmo_io_error">OsMo Verbindungsproblem: </string>
|
||||
|
@ -1976,4 +1972,6 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
|
|||
<string name="record_plugin_description">Speichern Sie Ihre Tracks mit einem Klick. Zeigt die Einstellung, wie Strecken aufgezeichnet werden – in lokale GPX-Dateien oder online via Web-Service.</string>
|
||||
<string name="route_descr_destination"/>
|
||||
<string name="local_index_description">Antippen eines Elements um mehr Details zu erfahren, Tippen und Halten zum Deaktivieren oder Löschen des Elements. Aktuell auf dem Gerät vorhandene Daten (%1$s frei):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Karten-Schriftgröße festlegen</string>
|
||||
<string name="text_size">Schriftgröße</string>
|
||||
</resources>
|
||||
|
|
|
@ -1877,4 +1877,6 @@ Afganistán, Albania, Alemania, Andorra, Angola, Anguila, Antigua y Barbuda, Ant
|
|||
<string name="local_index_description">Pulsa cualquier objeto para ver más detalles, mantén pulsado para desactivar o borrar. Datos en el dispositivo actualmente (%1$s libre):</string>
|
||||
<string name="traffic_warning_calming">Reductores de velocidad</string>
|
||||
<string name="traffic_warning">Alerta de tráfico</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Selecciona el tamaño del texto en el mapa.</string>
|
||||
<string name="text_size">Tamaño de texto</string>
|
||||
</resources>
|
||||
|
|
|
@ -1988,5 +1988,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
|
|||
<string name="traffic_warning_calming">Moderazione del traffico</string>
|
||||
<string name="traffic_warning_speed_camera">Autovelox</string>
|
||||
<string name="traffic_warning">Avviso di traffico</string>
|
||||
<string name="local_index_description">Clicca su un oggetto per visualizzare maggiori dettagli, tieni premuto per disattivarlo o cancellarlo. Dati attualmente nel dispositivo (%1$s free):</string>
|
||||
</resources>
|
||||
<string name="local_index_description">Clicca su un oggetto per visualizzare maggiori dettagli, tieni premuto per disattivarlo o cancellarlo. Dati attualmente nel dispositivo (%1$s liberi):</string>
|
||||
<string name="text_size_descr">Imposta la dimensione del testo sulla mappa.</string>
|
||||
<string name="text_size">Dimensione del testo</string>
|
||||
</resources>
|
||||
|
|
|
@ -2100,4 +2100,6 @@ Vanuatu, Venezuela, Vietnam, Wallis and Futuna, Western Sahara, Yemen, Zambia, Z
|
|||
<string name="traffic_warning_speed_camera">속도 경고 카메라</string>
|
||||
<string name="traffic_warning">트래픽 경고</string>
|
||||
<string name="local_index_description">기존 항목을 클릭하여 더 많은 정보를 보세요. 비활성화 하려면 꾹 눌러주시거나 삭제하세요. 현재 데이터는 (%1$ s 무료):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">지도에 텍스트 크기를 설정 합니다.</string>
|
||||
<string name="text_size">텍스트 크기</string>
|
||||
</resources>
|
||||
|
|
|
@ -1838,4 +1838,6 @@ OsmAnd yra aktyviai tobulinama ir mūsų projektas bei jo tolesnis progresas pri
|
|||
<string name="traffic_warning_calming">Eismo greičio ribojimas</string>
|
||||
<string name="traffic_warning_speed_camera">Greičio matavimo kamera</string>
|
||||
<string name="traffic_warning">Eismo perspėjimas</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Nustatyti teksto žemėlapyje dydį</string>
|
||||
<string name="text_size">Teksto dydis</string>
|
||||
</resources>
|
||||
|
|
|
@ -164,7 +164,7 @@
|
|||
<string name="routing_settings_descr">Opties voor navigatie</string>
|
||||
<string name="global_settings">Algemene instellingen</string>
|
||||
<string name="index_settings">Kaartbeheer</string>
|
||||
<string name="index_settings_descr">Download en beheer kaarten, stemmen en GPX-tracks</string>
|
||||
<string name="index_settings_descr">Download en beheer kaarten en stemmen</string>
|
||||
<string name="general_settings">Algemene instellingen</string>
|
||||
<string name="general_settings_descr">Kaartweergave en algemene instellingen</string>
|
||||
<string name="global_app_settings">Algemene app instellingen</string>
|
||||
|
@ -881,7 +881,7 @@
|
|||
<string name="osmand_development_plugin_description">Toon opties voor ontwikkeling en foutopsporing, zoals navigatie met simulatie of het meten van de kaartweergavesnelheid.</string>
|
||||
<string name="plugins_screen">Plugin-manager</string>
|
||||
<string name="select_plugin_to_activate">Klik op een plugin om deze te (de)activeren. (Het kan nodig zijn om OsmAnd te herstarten.)</string>
|
||||
<string name="prefs_plugins_descr">Plugins geven geavanceerde instellingen en extra functies</string>
|
||||
<string name="prefs_plugins_descr">Schakel plugins in voor speciale functies en extra instellingen</string>
|
||||
<string name="prefs_plugins">Plugin-manager</string>
|
||||
<string name="tip_recent_changes_0_8_0_t">Wijzigingen in 0.8.0:
|
||||
\n\t- *Plugin-functionaliteit*
|
||||
|
@ -1970,4 +1970,6 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
|
|||
<string name="traffic_warning_speed_camera">Snelheidscontrole</string>
|
||||
<string name="traffic_warning">Filemelding</string>
|
||||
<string name="local_index_description">Tik om details te bekijken; houd ingedrukt om uit te schakelen of te verwijderen. Huidige gegevens op het toestel (%1$s beschikbaar):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">De grootte van tekst op de kaart instellen.</string>
|
||||
<string name="text_size">Tekstgrootte</string>
|
||||
</resources>
|
||||
|
|
|
@ -1947,4 +1947,6 @@ Afganistan, Afryka Południowa, Albania, Algieria, Andora, Angola, Anguilla, Ant
|
|||
<string name="traffic_warning_speed_camera">Fotoradar</string>
|
||||
<string name="traffic_warning">Ostrzeżenia drogowe</string>
|
||||
<string name="local_index_description">Kliknij istniejący element, aby zobaczyć szczegóły, naciśnij i przytrzymaj, aby wyłączyć lub usunąć. Aktualne dane na urządzeniu (%1$s wolne):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Ustaw rozmiar tekstu na mapie.</string>
|
||||
<string name="text_size">Rozmiar tekstu</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?><resources><string name="amenity_type_administrative">Administrativo</string>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources><string name="amenity_type_administrative">Administrativo</string>
|
||||
<string name="amenity_type_barrier">Barreira</string>
|
||||
<string name="amenity_type_education">Educação</string>
|
||||
<string name="amenity_type_emergency">Emergência</string>
|
||||
|
@ -1796,4 +1797,31 @@ Afeganistão , Albânia, Argélia , Andorra, Angola , Anguilla, Antígua e Barbu
|
|||
<string name="visible_element">Visível</string>
|
||||
<string name="show_zoom_buttons_navigation_descr">Mostrar botões de zoom durante a navegação</string>
|
||||
<string name="show_zoom_buttons_navigation">Mostrar botões de zoom</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Defina o tamanho do texto no mapa.</string>
|
||||
<string name="text_size">Tamanho do texto</string>
|
||||
<string name="traffic_warning_speed_limit">Limite de Velocidade</string>
|
||||
<string name="traffic_warning_border_control">Controle de fronteira</string>
|
||||
<string name="traffic_warning_payment">Portagem</string>
|
||||
<string name="traffic_warning_stop">Sinal de stop</string>
|
||||
<string name="traffic_warning_calming">Acalmia de tráfego</string>
|
||||
<string name="traffic_warning_speed_camera">Câmara de velocidade</string>
|
||||
<string name="traffic_warning">Aviso de tráfego</string>
|
||||
<string name="speak_favorites">Anunciar nas proximidades favoritos</string>
|
||||
<string name="speak_poi">Anunciar nas proximidades de POI</string>
|
||||
<string name="way_alarms">Avisos de tráfego</string>
|
||||
<string name="sleep_mode_stop_dialog">Interromper o modo de hibernação do GPS?</string>
|
||||
<string name="stop_navigation_service">Interrupção</string>
|
||||
<string name="confirm_every_run">Sempre perguntar</string>
|
||||
<string name="save_global_track_interval_descr">Escolher o intervalo de log para a gravação de faixa geral (habilitado através do widget de gravação GPX no mapa)</string>
|
||||
<string name="save_global_track_interval">Intervalo de log geral</string>
|
||||
<string name="enable_sleep_mode">Ativar o modo de GPS em segundo plano</string>
|
||||
<string name="save_track_to_gpx_globally">Salvar trilhas em GPX</string>
|
||||
<string name="save_track_to_gpx_globally_descr">Posição geral de log para um arquivo GPX pode ser ativada ou desativado usando o GPX gravação widget na tela do mapa</string>
|
||||
<string name="save_track_interval_globally">Intervalo de log</string>
|
||||
<string name="rendering_attr_publicTransportMode_name">Modo de transporte público</string>
|
||||
<string name="record_plugin_description">Salve suas trilhas através do toque de um botão na tela do mapa. Mostre as configurações para gravar suas viagens para arquivos GPX locais ou on-line usando um serviço da web.</string>
|
||||
<string name="record_plugin_name">Gravar suas viagens</string>
|
||||
<string name="int_hour">h</string>
|
||||
<string name="duration">Duração</string>
|
||||
<string name="distance">Distância</string>
|
||||
</resources>
|
||||
|
|
|
@ -1740,4 +1740,6 @@ Si cussigiat de annànghere unu o prus puntos intermedios pro megiorare sas pres
|
|||
<string name="traffic_warning_speed_camera">Autovelox</string>
|
||||
<string name="traffic_warning">Avisu de tràficu</string>
|
||||
<string name="local_index_description">Ischerta unu elementu esistente pro bìere prus detallios, carca e mantène carcau pro lu deativare o burrare. Datos como in su dispositivu (%1$s lìberos):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Issèbera sa mannària de su testu in sa mapa.</string>
|
||||
<string name="text_size">Mannària de su testu</string>
|
||||
</resources>
|
||||
|
|
|
@ -1992,4 +1992,6 @@ Afganistan, Albánsko, Alžírsko, Andora, Angola, Anguilla, Antigua a Barbuda,
|
|||
<string name="traffic_warning_speed_camera">Rýchlostný radar/kamera</string>
|
||||
<string name="traffic_warning">Dopravné varovanie</string>
|
||||
<string name="local_index_description">Kliknite na existujúcu položku pre zobrazenie detailov. Podržte pre vypnutie alebo odstránenie. Dát je v súčasnosti na zariadení (%1$s voľné):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Nastaviť veľkosť textu na mape.</string>
|
||||
<string name="text_size">Veľkosť textu</string>
|
||||
</resources>
|
||||
|
|
|
@ -569,7 +569,7 @@
|
|||
<string name="amenity_type_man_made">Zgradbe</string>
|
||||
<string name="send_location_sms_pattern">Mesto: %1$s\n%2$s</string>
|
||||
<string name="tip_initial_t">"OsmAnd je navigacijska aplikacija s številnimi funkcijami.
|
||||
\n\nNekaj osnovnih uvodov, uporabne nasvete in napredno pomoč dobite v povezavi z \'Meni\' → \'Pomoč\' na zaslonu zemljevida. "</string>
|
||||
\n\nOsnovni uvod, nekaj uporabnih namigov in trikov je na voljo na povezavi z \'Meni\' → \'Pomoč\' na zaslonu zemljevida. "</string>
|
||||
<string name="next_button">Naprej</string>
|
||||
<string name="previous_button">Nazaj</string>
|
||||
<string name="tip_initial">Pomoč</string>
|
||||
|
@ -594,7 +594,7 @@
|
|||
|
||||
<string name="downloading">Prenašanje …</string>
|
||||
<string name="installing_new_resources">Odpakiranje novih podatkov …</string>
|
||||
<string name="tip_navigation_t">"Da bi dobili navodila za kraj, bodisi neposredno dolgo kliknite nanj na zemljevidu (potem kliknite opis in izberite \'Navodila za\'), ali pa izberite \'Navigacija\' za vsak vnos v seznamu rezultatov iskanja ali seznama priljubljenih.
|
||||
<string name="tip_navigation_t">"Da bi dobili navodila za kraj, bodisi neposredno dolgo kliknite nanj na zemljevidu (potem kliknite opis in izberite \'Navodila za\'), ali pa izberite \'Navodila za\' za vsak vnos v seznamu rezultatov iskanja ali seznama priljubljenih.
|
||||
\n\nCilj je na zemljevidu označen s ciljno zastavico in OsmAnd prikazuje razdaljo in smer do njega (oranžni trikotnik).
|
||||
\n\nLahko izberete \'Začni navigacijo\', kar pomeni, da vas OsmAnd vodi, vam da glasovne ukaze (če so ti vklopljeni), itd. Ali pa lahko izberete \'Prikaži pot\', ki vam samo prikaže pot brez vodenja in popravljanja medtem ko se premikate.
|
||||
\n\nČe želite pokazati pot do cilja iz katerekoli druge točke, ki ni vaš trenutni položaj, izberite jo na zemljevidu in pritisnite \'Navodila od\'.
|
||||
|
@ -667,15 +667,14 @@
|
|||
\n\nTa je na voljo z dolgim pritiskom na katerokoli točko na zemljevidu (nato pritisnite na oznako) ali s pritiskom na gumb kroglico, ali z izbiro \'Meni\' → \'Uporabi lokacijo\' (zadnja dva načina uporabijo center zemljevida kot referenčno točko).
|
||||
\n\nOznako lahko spet skrijete če dolgo kliknete nanjo.
|
||||
</string>
|
||||
<string name="tip_search_t">Mesta lahko iščete neposredno na zemljevidu preko \'Uporabi lokacijo\' → \'Iskanje v bližini\', ali s priklicem okna za iskanje preko \'Meni\' → \'Iskanje\'.
|
||||
\n\nOkno za iskanje ima predloge za iskanje
|
||||
\n\t* po naslovu
|
||||
\n\t* preko koordinat
|
||||
\n\t* kot POI (po vrsti ali po imenu)
|
||||
\n\t* preko zgodovine iskanja
|
||||
\n\t* ali prek vaših prednastavljenih priljubljenih.
|
||||
\n\nKontekstni meni ali akcijska vrstica na vseh zadetkih ponujata možnosti, kot so \'Navigacija\' ali \'Prikaži na zemljevidu\', itd.
|
||||
</string>
|
||||
<string name="tip_search_t">"Mesta lahko iščete neposredno na zemljevidu preko \'Uporabi lokacijo\' → \'Iskanje v bližini\', ali s priklicem okna za iskanje preko \'Meni\' → \'Iskanje\'.
|
||||
\n\nOkno za iskanje ima predloge za iskanje
|
||||
\n\t* po naslovu
|
||||
\n\t* preko koordinat
|
||||
\n\t* kot POI (po vrsti ali po imenu)
|
||||
\n\t* preko zgodovine iskanja
|
||||
\n\t* ali prek vaših prednastavljenih priljubljenih.
|
||||
\n\nKontekstni meni ali akcijska vrstica na vseh zadetkih ponujata možnosti, kot so \'Navodila za\' ali \'Prikaži na zemljevidu\', itd. "</string>
|
||||
|
||||
|
||||
<string name="route_descr_lat_lon">Dol %1$.3f šir %2$.3f</string>
|
||||
|
@ -1906,8 +1905,8 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A
|
|||
<string name="rendering_value_bicycle_name">Kolo</string>
|
||||
<string name="rendering_value_pedestrian_name">Pešec</string>
|
||||
<string name="flat_list_waypoitns">Vse</string>
|
||||
<string name="way_alarms">Ovire</string>
|
||||
<string name="speak_favorites">Najavi priljubljene</string>
|
||||
<string name="way_alarms">Prometna opozorila</string>
|
||||
<string name="speak_favorites">Najavi bližnje priljubljene</string>
|
||||
<string name="int_hour">ur</string>
|
||||
<string name="duration">Trajanje</string>
|
||||
<string name="distance">Razdalja</string>
|
||||
|
@ -1921,7 +1920,7 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A
|
|||
<string name="record_plugin_name">Registracija vaših potovanj</string>
|
||||
<string name="index_tours">Izleti</string>
|
||||
<string name="waypoints">Točke</string>
|
||||
<string name="speak_poi">Napovej POI</string>
|
||||
<string name="speak_poi">Najavi bližnji POI</string>
|
||||
<string name="rendering_value_browse_map_name">Brskaj zemljevid</string>
|
||||
<string name="rendering_attr_alpineHiking_description">Prikaz stez po SAC lestvici</string>
|
||||
<string name="pause_navigation">Zaustavi navigacijo</string>
|
||||
|
@ -1930,4 +1929,14 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A
|
|||
<string name="record_plugin_description">Shranite vaše sledi s pritiskom na gumb na oknu z zemljevidom. Pokaži nastavitve za snemanje vaših potovanj v krajevne datoteke GPX ali v oblak z uporabo spletnih storitev.</string>
|
||||
<string name="rendering_attr_osmcTraces_description">Prikaz stez po OSMC sledeh</string>
|
||||
|
||||
</resources>
|
||||
<string name="traffic_warning_speed_limit">Omejitev hitrosti</string>
|
||||
<string name="traffic_warning_border_control">Mejni prehod</string>
|
||||
<string name="traffic_warning_payment">Cestninska postaja</string>
|
||||
<string name="traffic_warning_stop">Znak STOP</string>
|
||||
<string name="traffic_warning">Prometno opozorilo</string>
|
||||
<string name="traffic_warning_speed_camera">Hitrostna kamera</string>
|
||||
<string name="traffic_warning_calming">Ležeči policaj</string>
|
||||
<string name="local_index_description">Kliknite katerikoli obstoječi element za ogled podrobnosti, pritisnite in držite za izklop ali izbris. Trenutni podatki na napravi (%1$s prosto):</string>
|
||||
<string name="text_size_descr">Nastavite velikost napisov na zemljevidu.</string>
|
||||
<string name="text_size">Velikost napisov</string>
|
||||
</resources>
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
<string name="map_widget_altitude">Höjd</string>
|
||||
<string name="map_widget_next_turn">Nästa sväng</string>
|
||||
<string name="show_warnings_title">Visa larm …</string>
|
||||
<string name="show_warnings_descr">Konfigurerar trafikvarningar (hastighetsgränser, stopp, vägbulor), varning för hastighetskameror samt körfältsinformation</string>
|
||||
<string name="show_warnings_descr">Konfigurera trafikvarningar (hastighetsbegränsningar, stopp, vägbulor), varning för fartkameror samt körfältsinformation</string>
|
||||
<string name="use_compass_navigation_descr">Använd kompassen när ingen riktning upptäcks på annat sätt</string>
|
||||
<string name="use_compass_navigation">Använd kompass</string>
|
||||
<string name="avoid_motorway">Undvik motorvägar</string>
|
||||
<string name="auto_zoom_map_descr">Auto-zooma på kartan beroende på din hastighet (när kartan är synkroniserad med aktuell position)</string>
|
||||
<string name="auto_zoom_map_descr">Zooma in/ut automatiskt på kartan beroende på din hastighet (när kartan är synkroniserad med aktuell position)</string>
|
||||
<string name="auto_zoom_map">Automatisk kartzoomning</string>
|
||||
<string name="tip_recent_changes_0_8_3_t">"Förändringar i 0.8.3:\n\t* Waypoints\n\t* Förbättrad vägvisning\n\t* Inställning för att undvika motorvägar när man bygger en rutt\n\t* Lagt till ytterligare en typ av väg för cyklar till kartan (Cycleway=track)\n\t* Buggfixar "</string>
|
||||
<string name="snap_to_road_descr">Fäst positionen på vägen under navigering</string>
|
||||
|
@ -727,7 +727,7 @@
|
|||
<string name="send_report">Skicka rapport</string>
|
||||
<string name="none_region_found">Hittar inga offline-data för regioner på SD-kortet. Ladda ner regioner från Internet.</string>
|
||||
<string name="poi_namefinder_query_empty">Ange sökfråga för att hitta POI</string>
|
||||
<string name="any_poi">Någon</string>
|
||||
<string name="any_poi">Alla</string>
|
||||
<string name="layer_transport_route">Transportled</string>
|
||||
<string name="thanks_yandex_traffic">Tack till Yandex för trafikinformationen.</string>
|
||||
<string name="layer_yandex_traffic">Yandex trafik</string>
|
||||
|
@ -1696,4 +1696,6 @@
|
|||
<string name="traffic_warning_speed_camera">Fartkamera</string>
|
||||
<string name="traffic_warning_calming">Trafikdämpning</string>
|
||||
<string name="local_index_description">Peta på en post för att se fler detaljer, tryck och håll för att inaktivera eller ta bort. Data på enheten (%1$s ledigt):</string>
|
||||
</resources>
|
||||
<string name="text_size_descr">Ange textstorlek på kartan.</string>
|
||||
<string name="text_size">Textstorlek</string>
|
||||
</resources>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -14,6 +14,7 @@
|
|||
<string name="sherpafy_stage_tab_route">Map</string>
|
||||
<string name="sherpafy_stage_tab_info">Info</string>
|
||||
<string name="sherpafy_tour_info_txt">Important Info</string>
|
||||
<string name="sherpafy_disable_poi">Hide POI on map</string>
|
||||
<string name="sherpafy_stages_txt">Stages</string>
|
||||
<string name="sherpafy_instructions">Tour Information</string>
|
||||
<string name="sherpafy_instructions_desr">Key facts and contact info</string>
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
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="text_size_descr">Set the text size on the map.</string>
|
||||
<string name="text_size">Text size</string>
|
||||
<string name="traffic_warning_speed_limit">Speed limit</string>
|
||||
<string name="traffic_warning_border_control">Border control</string>
|
||||
<string name="traffic_warning_payment">Toll booth</string>
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceGroup;
|
||||
import android.preference.Preference.OnPreferenceChangeListener;
|
||||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceScreen;
|
||||
|
@ -41,6 +42,8 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
|||
return true;
|
||||
}
|
||||
});
|
||||
addTextScale(grp);
|
||||
addSpeechRateSetting(grp);
|
||||
|
||||
grp.addPreference(accessibilityModePreference);
|
||||
PreferenceCategory cat = new PreferenceCategory(this);
|
||||
|
@ -69,15 +72,11 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
|||
|
||||
cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball,
|
||||
R.string.zoom_by_trackball_descr));
|
||||
|
||||
cat.addPreference(createCheckBoxPreference(settings.USE_SHORT_OBJECT_NAMES, R.string.use_short_object_names,
|
||||
R.string.use_short_object_names_descr));
|
||||
|
||||
Float[] sprValues = new Float[] {0.5f, 0.75f, 1f, 1.25f, 1.5f, 2f} ;
|
||||
String[] sprNames = new String[sprValues.length];
|
||||
for(int i = 0; i < sprNames.length; i++) {
|
||||
sprNames[i] = (int)(sprValues[i] * 100) + " %";
|
||||
}
|
||||
cat.addPreference(createListPreference(settings.SPEECH_RATE, sprNames, sprValues, R.string.speech_rate, R.string.speech_rate_descr));
|
||||
|
||||
if (Build.VERSION.SDK_INT < 14) { // Build.VERSION_CODES.ICE_CREAM_SANDWICH
|
||||
cat.addPreference(createCheckBoxPreference(settings.SCROLL_MAP_BY_GESTURES, R.string.scroll_map_by_gestures,
|
||||
R.string.scroll_map_by_gestures_descr));
|
||||
|
@ -88,6 +87,28 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
|
|||
|
||||
|
||||
|
||||
protected void addTextScale(PreferenceGroup grp) {
|
||||
Float[] txtValues = new Float[] {0.75f, 1f, 1.25f, 1.5f, 2f, 3f} ;
|
||||
String[] txtNames = new String[txtValues.length];
|
||||
for(int i = 0; i < txtNames.length; i++) {
|
||||
txtNames[i] = (int)(txtValues[i] * 100) + " %";
|
||||
}
|
||||
grp.addPreference(createListPreference(settings.TEXT_SCALE, txtNames, txtValues, R.string.text_size, R.string.text_size_descr));
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void addSpeechRateSetting(PreferenceGroup grp) {
|
||||
Float[] sprValues = new Float[] {0.5f, 0.75f, 1f, 1.25f, 1.5f, 2f} ;
|
||||
String[] sprNames = new String[sprValues.length];
|
||||
for(int i = 0; i < sprNames.length; i++) {
|
||||
sprNames[i] = (int)(sprValues[i] * 100) + " %";
|
||||
}
|
||||
grp.addPreference(createListPreference(settings.SPEECH_RATE, sprNames, sprValues, R.string.speech_rate, R.string.speech_rate_descr));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void updateAllSettings() {
|
||||
super.updateAllSettings();
|
||||
PreferenceCategory accessibilityOptions = ((PreferenceCategory)(getPreferenceScreen().findPreference("accessibility_options")));
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.access.AccessibleAlertBuilder;
|
|||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.access.AccessibilityMode;
|
||||
import net.osmand.plus.activities.*;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexFragment;
|
||||
import net.osmand.plus.api.SQLiteAPI;
|
||||
import net.osmand.plus.api.SQLiteAPIImpl;
|
||||
|
@ -111,7 +112,7 @@ public class OsmandApplication extends Application {
|
|||
BRouterServiceConnection bRouterServiceConnection;
|
||||
|
||||
MapActivity mapActivity;
|
||||
DownloadIndexFragment downloadActivity;
|
||||
DownloadActivity downloadActivity;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
|
@ -879,11 +880,11 @@ public class OsmandApplication extends Application {
|
|||
this.mapActivity = mapActivity;
|
||||
}
|
||||
|
||||
public void setDownloadActivity(DownloadIndexFragment downloadActivity) {
|
||||
public void setDownloadActivity(DownloadActivity downloadActivity) {
|
||||
this.downloadActivity = downloadActivity;
|
||||
}
|
||||
|
||||
public DownloadIndexFragment getDownloadActivity() {
|
||||
public DownloadActivity getDownloadActivity() {
|
||||
return downloadActivity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -700,14 +700,19 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", false).makeGlobal().cache();
|
||||
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeGlobal().cache();
|
||||
|
||||
public final CommonPreference<Float> TEXT_SCALE = new FloatPreference("text_scale", 1f).makeProfile().cache();
|
||||
{
|
||||
TEXT_SCALE.setModeDefaultValue(ApplicationMode.CAR, 1.5f);
|
||||
}
|
||||
|
||||
public final CommonPreference<Float> MAP_ZOOM_SCALE_BY_DENSITY = new FloatPreference("map_zoom_scale_wo_density", 0f).makeProfile().cache();
|
||||
{
|
||||
MAP_ZOOM_SCALE_BY_DENSITY.setModeDefaultValue(ApplicationMode.CAR, 0.5f);
|
||||
}
|
||||
|
||||
public float getSettingsZoomScale(float density){
|
||||
// by default scale between [0, 1[ density (because of lots map complains)
|
||||
return MAP_ZOOM_SCALE_BY_DENSITY.get() + (float)Math.sqrt(Math.max(0, density - 1));
|
||||
|
||||
public float getSettingsZoomScale(){
|
||||
return MAP_ZOOM_SCALE_BY_DENSITY.get() ;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,17 +4,15 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MediaRemoteControlReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Toast.makeText(context, "Intent sent", Toast.LENGTH_LONG).show();
|
||||
if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())) {
|
||||
AudioVideoNotesPlugin plugin = OsmandPlugin.getEnabledPlugin(AudioVideoNotesPlugin.class);
|
||||
if(plugin != null && intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT) != null) {
|
||||
System.out.println("OsmAnd AV Button pressed " + intent.getIntExtra(Intent.EXTRA_KEY_EVENT, 0));
|
||||
// System.out.println("OsmAnd AV Button pressed " + intent.getIntExtra(Intent.EXTRA_KEY_EVENT, 0));
|
||||
// Toast.makeText(context, "Button pressed " + intent.getIntExtra(Intent.EXTRA_KEY_EVENT, 0), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.View;
|
||||
import android.widget.*;
|
||||
|
@ -23,14 +25,12 @@ import net.osmand.plus.activities.SettingsGeneralActivity;
|
|||
import net.osmand.plus.base.BasicProgressAsyncTask;
|
||||
import net.osmand.plus.base.SuggestExternalDirectoryDialog;
|
||||
import net.osmand.plus.srtmplugin.SRTMPlugin;
|
||||
import net.osmand.plus.voice.TTSCommandPlayerImpl;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Created by Denis on 08.09.2014.
|
||||
|
@ -200,6 +200,7 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
|||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
getMyApplication().setDownloadActivity(this);
|
||||
BasicProgressAsyncTask<?, ?, ?> t = downloadListIndexThread.getCurrentRunningTask();
|
||||
}
|
||||
|
||||
|
@ -521,8 +522,58 @@ public class DownloadActivity extends SherlockFragmentActivity {
|
|||
task.execute();
|
||||
}
|
||||
|
||||
|
||||
public Map<String,String> getIndexFileNames() {
|
||||
return downloadListIndexThread != null ? downloadListIndexThread.getIndexFileNames() : null;
|
||||
}
|
||||
|
||||
public void showDialogToDownloadMaps(Collection<String> maps) {
|
||||
int count = 0;
|
||||
int sz = 0;
|
||||
String s = "";
|
||||
for (IndexItem i : DownloadActivity.downloadListIndexThread.getCachedIndexFiles()) {
|
||||
for (String map : maps) {
|
||||
if ((i.getFileName().equals(map + ".obf.zip") || i.getFileName().equals(map + "_" + IndexConstants.BINARY_MAP_VERSION + ".obf.zip"))
|
||||
&& i.getType() == DownloadActivityType.NORMAL_FILE) {
|
||||
final List<DownloadEntry> de = i.createDownloadEntry(getMyApplication(), i.getType(), new ArrayList<DownloadEntry>(1));
|
||||
for(DownloadEntry d : de ) {
|
||||
count++;
|
||||
sz += d.sizeMB;
|
||||
}
|
||||
if(s.length() > 0) {
|
||||
s +=", ";
|
||||
}
|
||||
s += i.getVisibleName(getMyApplication(), getMyApplication().getResourceManager().getOsmandRegions());
|
||||
getEntriesToDownload().put(i, de);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(count > 0){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setMessage(getString(R.string.download_additional_maps, s, sz));
|
||||
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
downloadFilesCheckInternet();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.default_buttons_no, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
getEntriesToDownload().clear();
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
getEntriesToDownload().clear();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getMyApplication().setDownloadActivity(this);
|
||||
getDownloadActivity().updateProgress(false);
|
||||
BasicProgressAsyncTask<?, ?, ?> t = DownloadActivity.downloadListIndexThread.getCurrentRunningTask();
|
||||
if(t instanceof DownloadIndexesThread.DownloadIndexesAsyncTask) {
|
||||
|
@ -113,55 +112,6 @@ public class DownloadIndexFragment extends OsmandExpandableListFragment {
|
|||
}
|
||||
}
|
||||
|
||||
public void showDialogToDownloadMaps(Collection<String> maps) {
|
||||
int count = 0;
|
||||
int sz = 0;
|
||||
String s = "";
|
||||
for (IndexItem i : DownloadActivity.downloadListIndexThread.getCachedIndexFiles()) {
|
||||
for (String map : maps) {
|
||||
if (i.getFileName().equals(map + ".obf.zip") && i.getType() == DownloadActivityType.NORMAL_FILE) {
|
||||
final List<DownloadEntry> de = i.createDownloadEntry(getMyApplication(), i.getType(), new ArrayList<DownloadEntry>(1));
|
||||
for(DownloadEntry d : de ) {
|
||||
count++;
|
||||
sz += d.sizeMB;
|
||||
}
|
||||
if(s.length() > 0) {
|
||||
s +=", ";
|
||||
}
|
||||
s += i.getVisibleName(getMyApplication(), getMyApplication().getResourceManager().getOsmandRegions());
|
||||
getDownloadActivity().getEntriesToDownload().put(i, de);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(count > 0){
|
||||
Builder builder = new AlertDialog.Builder(getDownloadActivity());
|
||||
builder.setMessage(getString(R.string.download_additional_maps, s, sz));
|
||||
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
getDownloadActivity().downloadFilesCheckInternet();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.default_buttons_no, new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
getDownloadActivity().getEntriesToDownload().clear();
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
getDownloadActivity().getEntriesToDownload().clear();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == RELOAD_ID) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package net.osmand.plus.helpers;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.os.Build;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
|
|
|
@ -112,6 +112,8 @@ public class OsMoControlDevice implements OsMoReactor {
|
|||
return true;
|
||||
} else if(command.equals("TP")) {
|
||||
plugin.getDownloadGpxTask(true).execute(obj);
|
||||
} else if (command.equals("PP")) {
|
||||
service.pushCommand("PP");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -168,9 +168,9 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
|
|||
if (!pos.isEmpty()) {
|
||||
StringBuilder res = new StringBuilder();
|
||||
for (OsMoDevice d : pos) {
|
||||
res.append(getObjectDescription(d));
|
||||
res.append(getObjectDescription(d)).append("\n");
|
||||
}
|
||||
AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show();
|
||||
AccessibleToast.makeText(view.getContext(), res.toString().trim(), Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -165,7 +165,7 @@ public class OsMoThread {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
log.info("Exception selecting socket", e);
|
||||
cmd("ERROR HEARTBEAT", true);
|
||||
cmd("ERROR HEARTBEAT" + e.getMessage(), true);
|
||||
e.printStackTrace();
|
||||
if (activeChannel != null && !activeChannel.isConnected()) {
|
||||
activeChannel = null;
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package net.osmand.plus.osmodroid;
|
||||
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
|
||||
public class ColoredGPX {
|
||||
int color;
|
||||
GPXFile gpxFile;
|
||||
}
|
|
@ -1,385 +0,0 @@
|
|||
package net.osmand.plus.osmodroid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.*;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.views.ContextMenuLayer;
|
||||
import net.osmand.plus.views.GPXLayer;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.render.RenderingRuleSearchRequest;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.Paint.Cap;
|
||||
import android.graphics.Paint.Join;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.os.RemoteException;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
import android.content.DialogInterface;
|
||||
|
||||
/**
|
||||
* Class represents a OsMoDroidlayer which depicts the position of Esya.ru channels objects
|
||||
*
|
||||
* @author Denis Fokin
|
||||
* @see OsMoDroidPlugin
|
||||
*
|
||||
*/
|
||||
public class OsMoDroidLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||
/**
|
||||
* magic number so far
|
||||
*/
|
||||
private static final int radius = 10;
|
||||
OsMoDroidPoint seekOsMoDroidPoint;
|
||||
OsMoDroidPlugin myOsMoDroidPlugin;
|
||||
|
||||
private DisplayMetrics dm;
|
||||
|
||||
private final MapActivity map;
|
||||
private OsmandMapTileView view;
|
||||
|
||||
private Paint textPaint;
|
||||
|
||||
ArrayList<OsMoDroidPoint> osMoDroidPointArrayList;
|
||||
ArrayList<OsMoDroidPoint> osMoDroidFixedPointArrayList;
|
||||
ArrayList<ColoredGPX> gpxArrayList = new ArrayList<ColoredGPX>() ;
|
||||
int layerId;
|
||||
String layerName;
|
||||
String layerDescription;
|
||||
private Paint paint;
|
||||
|
||||
private Path path;
|
||||
|
||||
private OsmandSettings settings;
|
||||
|
||||
private RenderingRulesStorage cachedRrs;
|
||||
private boolean cachedNightMode;
|
||||
private int cachedColor;
|
||||
|
||||
|
||||
private void initUI() {
|
||||
paint = new Paint();
|
||||
paint.setStyle(Style.STROKE);
|
||||
paint.setStrokeWidth(14);
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStrokeCap(Cap.ROUND);
|
||||
paint.setStrokeJoin(Join.ROUND);
|
||||
|
||||
path = new Path();
|
||||
}
|
||||
private Bitmap opIcon;
|
||||
|
||||
public void refresh() {
|
||||
map.refreshMap();
|
||||
}
|
||||
|
||||
public OsMoDroidLayer(MapActivity map) {
|
||||
this.map = map;
|
||||
}
|
||||
|
||||
public OsMoDroidLayer(MapActivity map, int layerId, OsMoDroidPlugin osMoDroidPlugin, String layerName, String layerDescription) {
|
||||
this.map = map;
|
||||
this.layerId = layerId;
|
||||
this.myOsMoDroidPlugin = osMoDroidPlugin;
|
||||
this.layerName = layerName;
|
||||
this.layerDescription = layerDescription;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initLayer(OsmandMapTileView view) {
|
||||
this.view = view;
|
||||
dm = new DisplayMetrics();
|
||||
WindowManager wmgr = (WindowManager) view.getContext().getSystemService(Context.WINDOW_SERVICE);
|
||||
wmgr.getDefaultDisplay().getMetrics(dm);
|
||||
textPaint = new Paint();
|
||||
textPaint.setDither(true);
|
||||
textPaint.setAntiAlias(true);
|
||||
textPaint.setFilterBitmap(true);
|
||||
|
||||
textPaint.setTextSize(22f);
|
||||
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
textPaint.setTextAlign(Paint.Align.CENTER);
|
||||
opIcon = BitmapFactory.decodeResource(view.getResources(), R.drawable.bicycle_location);
|
||||
osMoDroidPointArrayList = myOsMoDroidPlugin.getOsMoDroidPointArrayList(layerId);
|
||||
osMoDroidFixedPointArrayList = myOsMoDroidPlugin.getOsMoDroidFixedPointArrayList(layerId);
|
||||
initUI();
|
||||
}
|
||||
|
||||
public void inGPXFilelist(ArrayList<ColoredGPX> in){
|
||||
gpxArrayList=in;
|
||||
map.refreshMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
|
||||
|
||||
for (ColoredGPX cg : gpxArrayList){
|
||||
List<List<WptPt>> points = cg.gpxFile.proccessPoints();
|
||||
|
||||
paint.setColor(cg.color);
|
||||
|
||||
final QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||
for (List<WptPt> l : points) {
|
||||
path.rewind();
|
||||
int startIndex = -1;
|
||||
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
WptPt ls = l.get(i);
|
||||
if (startIndex == -1) {
|
||||
if (ls.lat >= latLonBounds.bottom - 0.1 && ls.lat <= latLonBounds.top + 0.1 && ls.lon >= latLonBounds.left - 0.1
|
||||
&& ls.lon <= latLonBounds.right + 0.1) {
|
||||
startIndex = i > 0 ? i - 1 : i;
|
||||
}
|
||||
} else if (!(latLonBounds.left <= ls.lon + 0.1 && ls.lon - 0.1 <= latLonBounds.right
|
||||
&& latLonBounds.bottom <= ls.lat + 0.1 && ls.lat - 0.1 <= latLonBounds.top)) {
|
||||
drawSegment(canvas, tileBox, l, startIndex, i);
|
||||
startIndex = -1;
|
||||
}
|
||||
}
|
||||
if (startIndex != -1) {
|
||||
drawSegment(canvas, tileBox, l, startIndex, l.size() - 1);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (OsMoDroidPoint op : osMoDroidPointArrayList) {
|
||||
if(seekOsMoDroidPoint!=null&&seekOsMoDroidPoint.equals(op)){
|
||||
map.setMapLocation(op.latlon.getLatitude(), op.latlon.getLongitude());
|
||||
}
|
||||
LatLon newLatlon;
|
||||
try {
|
||||
|
||||
newLatlon = new LatLon(myOsMoDroidPlugin.mIRemoteService.getObjectLat(layerId, op.id),
|
||||
myOsMoDroidPlugin.mIRemoteService.getObjectLon(layerId, op.id));
|
||||
|
||||
if (!op.latlon.equals(newLatlon)) {
|
||||
op.prevlatlon = op.latlon;
|
||||
}
|
||||
op.latlon = newLatlon;
|
||||
op.speed = myOsMoDroidPlugin.mIRemoteService.getObjectSpeed(layerId, op.id);
|
||||
} catch (RemoteException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
double latitude = op.latlon.getLatitude();
|
||||
double longitude = op.latlon.getLongitude();
|
||||
double prevlatitude = op.latlon.getLatitude();
|
||||
double prevlongitude = op.latlon.getLongitude();
|
||||
if (op.prevlatlon != null) {
|
||||
prevlatitude = op.prevlatlon.getLatitude();
|
||||
prevlongitude = op.prevlatlon.getLongitude();
|
||||
}
|
||||
|
||||
int locationX = (int) tileBox.getPixXFromLatLon(latitude, longitude);
|
||||
int locationY = (int) tileBox.getPixYFromLatLon(latitude, longitude);
|
||||
int prevlocationX = (int) tileBox.getPixXFromLatLon(prevlatitude, prevlongitude);
|
||||
int prevlocationY = (int) tileBox.getPixYFromLatLon(prevlatitude, prevlongitude);
|
||||
|
||||
// int y = opIcon.getHeight()/2;
|
||||
// int x = opIcon.getWidth()/2;
|
||||
textPaint.setColor(Color.parseColor("#013220"));
|
||||
canvas.drawText(op.name, locationX, locationY - radius, textPaint);
|
||||
canvas.drawText(op.speed, locationX, locationY - 2 * radius, textPaint);
|
||||
textPaint.setColor(Color.parseColor("#" + op.color));
|
||||
textPaint.setShadowLayer(radius, 0, 0, Color.GRAY);
|
||||
canvas.drawCircle(locationX, locationY, radius, textPaint);
|
||||
// canvas.drawBitmap(opIcon, locationX-x, locationY-y , textPaint);
|
||||
textPaint.setStrokeWidth(radius);
|
||||
canvas.drawLine(locationX, locationY, prevlocationX, prevlocationY, textPaint);
|
||||
// canvas.rotate(-view.getRotate(), locationX, locationY);
|
||||
// op.prevlatlon=op.latlon;
|
||||
|
||||
}
|
||||
|
||||
for (OsMoDroidPoint point : osMoDroidFixedPointArrayList ){
|
||||
double latitude = point.latlon.getLatitude();
|
||||
double longitude = point.latlon.getLongitude();
|
||||
int locationX = (int) tileBox.getPixXFromLatLon(latitude, longitude);
|
||||
int locationY = (int) tileBox.getPixYFromLatLon(latitude, longitude);
|
||||
textPaint.setColor(Color.parseColor("#013220"));
|
||||
canvas.drawText(point.name, locationX, locationY - radius, textPaint);
|
||||
textPaint.setColor(Color.parseColor("#" + point.color));
|
||||
textPaint.setShadowLayer(radius, 0, 0, Color.GRAY);
|
||||
canvas.drawRect(new Rect(locationX-radius, locationY-radius, locationX+radius, locationY+radius), textPaint);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
private void drawSegment(Canvas canvas, RotatedTileBox tb, List<WptPt> l, int startIndex, int endIndex) {
|
||||
int px = (int) tb.getPixXFromLatLon(l.get(startIndex).lat, l.get(startIndex).lon);
|
||||
int py = (int) tb.getPixYFromLatLon(l.get(startIndex).lat, l.get(startIndex).lon);
|
||||
path.moveTo(px, py);
|
||||
for (int i = startIndex + 1; i <= endIndex; i++) {
|
||||
WptPt p = l.get(i);
|
||||
int x = (int) tb.getPixXFromLatLon(p.lat,p.lon);
|
||||
int y = (int) tb.getPixYFromLatLon(p.lat,p.lon);
|
||||
path.lineTo(x, y);
|
||||
}
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {}
|
||||
|
||||
public void getOsMoDroidPointFromPoint(RotatedTileBox tb,PointF point, List<? super OsMoDroidPoint> om) {
|
||||
if (osMoDroidPointArrayList != null) {
|
||||
int ex = (int) point.x;
|
||||
int ey = (int) point.y;
|
||||
|
||||
try {
|
||||
for (int i = 0; i < osMoDroidPointArrayList.size(); i++) {
|
||||
OsMoDroidPoint n = osMoDroidPointArrayList.get(i);
|
||||
if (!om.contains(n)) {
|
||||
int x = (int) tb.getPixXFromLatLon(n.latlon.getLatitude(), n.latlon.getLongitude());
|
||||
int y = (int) tb.getPixYFromLatLon(n.latlon.getLatitude(), n.latlon.getLongitude());
|
||||
if (Math.abs(x - ex) <= opIcon.getWidth() && Math.abs(y - ey) <= opIcon.getHeight()) {
|
||||
om.add(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// that's really rare case, but is much efficient than introduce
|
||||
// synchronized block
|
||||
}
|
||||
}
|
||||
if (osMoDroidFixedPointArrayList != null) {
|
||||
int ex = (int) point.x;
|
||||
int ey = (int) point.y;
|
||||
|
||||
try {
|
||||
for (int i = 0; i <osMoDroidFixedPointArrayList.size(); i++) {
|
||||
OsMoDroidPoint n =osMoDroidFixedPointArrayList.get(i);
|
||||
if (!om.contains(n)) {
|
||||
int x = (int) tb.getPixXFromLatLon(n.latlon.getLatitude(), n.latlon.getLongitude());
|
||||
int y = (int) tb.getPixYFromLatLon(n.latlon.getLatitude(), n.latlon.getLongitude());
|
||||
if (Math.abs(x - ex) <= opIcon.getWidth() && Math.abs(y - ey) <= opIcon.getHeight()) {
|
||||
om.add(n);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
// that's really rare case, but is much efficient than introduce
|
||||
// synchronized block
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
|
||||
if (o instanceof OsMoDroidPoint && ((OsMoDroidPoint) o).layerId == layerId) {
|
||||
final OsMoDroidPoint a = (OsMoDroidPoint) o;
|
||||
OnContextMenuClick listener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
|
||||
map.getMyApplication().getTargetPointsHelper().navigateToPoint(a.latlon, true, -1);
|
||||
}
|
||||
};
|
||||
OnContextMenuClick seeklistener = new ContextMenuAdapter.OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
if(seekOsMoDroidPoint!=null&&a.equals(seekOsMoDroidPoint))
|
||||
{
|
||||
seekOsMoDroidPoint=null;
|
||||
isChecked=false;
|
||||
} else
|
||||
{
|
||||
seekOsMoDroidPoint=a;
|
||||
isChecked=true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
adapter.item(map.getString(R.string.get_directions)).listen(listener).reg();
|
||||
adapter.item(map.getString(R.string.osmodroid_seek)).listen(seeklistener).reg();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||
List<OsMoDroidPoint> om = new ArrayList<OsMoDroidPoint>();
|
||||
getOsMoDroidPointFromPoint(tileBox, point, om);
|
||||
if (!om.isEmpty()) {
|
||||
StringBuilder res = new StringBuilder();
|
||||
for (int i = 0; i < om.size(); i++) {
|
||||
OsMoDroidPoint n = om.get(i);
|
||||
if (i > 0) {
|
||||
res.append("\n\n");
|
||||
}
|
||||
res = res.append(n.description);
|
||||
}
|
||||
AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyLayer() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean drawInScreenPixels() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
if (o instanceof OsMoDroidPoint) {
|
||||
return ((OsMoDroidPoint) o).name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
||||
getOsMoDroidPointFromPoint(tileBox, point, o);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public LatLon getObjectLocation(Object o) {
|
||||
if (o instanceof OsMoDroidPoint) {
|
||||
return ((OsMoDroidPoint) o).latlon;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectDescription(Object o) {
|
||||
if (o instanceof OsMoDroidPoint) {
|
||||
return ((OsMoDroidPoint) o).description;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,350 +0,0 @@
|
|||
package net.osmand.plus.osmodroid;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ConcurrentModificationException;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.FailSafeFuntions;
|
||||
import net.osmand.plus.views.MonitoringInfoControl;
|
||||
import net.osmand.plus.views.MonitoringInfoControl.MonitoringInfoControlServices;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.OsMoDroid.IRemoteOsMoDroidListener;
|
||||
import com.OsMoDroid.IRemoteOsMoDroidService;
|
||||
|
||||
public class OsMoDroidPlugin extends OsmandPlugin implements MonitoringInfoControlServices {
|
||||
IRemoteOsMoDroidListener.Stub inter = new IRemoteOsMoDroidListener.Stub() {
|
||||
|
||||
@Override
|
||||
public void channelUpdated() throws RemoteException {
|
||||
if (activity != null) {
|
||||
activity.refreshMap();
|
||||
// test
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelsListUpdated() throws RemoteException {
|
||||
if (activity != null && connected) {
|
||||
log.debug("update channels");
|
||||
for (OsMoDroidLayer myOsMoDroidLayer : osmoDroidLayerList) {
|
||||
activity.getMapView().removeLayer(myOsMoDroidLayer);
|
||||
}
|
||||
osmoDroidLayerList.clear();
|
||||
requestLayersFromOsMoDroid(activity);
|
||||
for (OsMoDroidLayer myOsMoDroidLayer : osmoDroidLayerList) {
|
||||
activity.getMapView().addLayer(myOsMoDroidLayer, 4.5f);
|
||||
|
||||
}
|
||||
activity.refreshMap();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void reRouteTo(LatLon loc) {
|
||||
final OsmandApplication app = activity.getMyApplication();
|
||||
final TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||
// If we are in following mode then just update target point
|
||||
targets.navigateToPoint(loc, true, -1);
|
||||
if(!app.getRoutingHelper().isFollowingMode()) {
|
||||
// If we are not in following mode then request new route to calculate
|
||||
// Use default application mode
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FailSafeFuntions.enterRoutingMode(activity, null);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeTo(float Lat, float Lon) throws RemoteException {
|
||||
reRouteTo(new LatLon(Lat, Lon));
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public void updateLayers(OsmandMapTileView mapView, MapActivity activity) {
|
||||
registerLayers(activity);
|
||||
super.updateLayers(mapView, activity);
|
||||
MonitoringInfoControl lock = activity.getMapLayers().getMapInfoLayer().getMonitoringInfoControl();
|
||||
if(lock != null && !lock.getMonitorActions().contains(this)) {
|
||||
lock.addMonitorActions(this);
|
||||
}
|
||||
}
|
||||
|
||||
MapActivity activity;
|
||||
public static final String ID = "osmand.osmodroid";
|
||||
private static final Log log = PlatformUtil.getLog(OsMoDroidPlugin.class);
|
||||
private OsmandApplication app;
|
||||
IRemoteOsMoDroidService mIRemoteService;
|
||||
private ServiceConnection mConnection;
|
||||
private int OSMODROID_SUPPORTED_VERSION_MIN = 5;
|
||||
private OsMoDroidLayer osmoDroidLayer;
|
||||
protected boolean connected = false;
|
||||
ArrayList<OsMoDroidLayer> osmoDroidLayerList = new ArrayList<OsMoDroidLayer>();
|
||||
private AsyncTask<Void, Void, Void> task;
|
||||
|
||||
public ArrayList<OsMoDroidPoint> getOsMoDroidPointArrayList(int id) {
|
||||
ArrayList<OsMoDroidPoint> result = new ArrayList<OsMoDroidPoint>();
|
||||
try {
|
||||
for (int i = 0; i < mIRemoteService.getNumberOfObjects(id); i++) {
|
||||
result.add(new OsMoDroidPoint(mIRemoteService.getObjectLat(id, mIRemoteService.getObjectId(id, i)), mIRemoteService
|
||||
.getObjectLon(id, mIRemoteService.getObjectId(id, i)), mIRemoteService.getObjectName(id,
|
||||
mIRemoteService.getObjectId(id, i)), mIRemoteService.getObjectDescription(id, mIRemoteService.getObjectId(id, i)),
|
||||
mIRemoteService.getObjectId(id, i), id, mIRemoteService.getObjectSpeed(id, mIRemoteService.getObjectId(id, i)),
|
||||
mIRemoteService.getObjectColor(id, mIRemoteService.getObjectId(id, i))));
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<OsMoDroidPoint> getOsMoDroidFixedPointArrayList(int id) {
|
||||
ArrayList<OsMoDroidPoint> result = new ArrayList<OsMoDroidPoint>();
|
||||
try {
|
||||
for (int i = 0; i < mIRemoteService.getNumberOfPoints(id); i++) {
|
||||
result.add(new OsMoDroidPoint(mIRemoteService.getPointLat(id, mIRemoteService.getPointId(id, i)), mIRemoteService
|
||||
.getPointLon(id, mIRemoteService.getPointId(id, i)), mIRemoteService.getPointName(id,
|
||||
mIRemoteService.getPointId(id, i)), mIRemoteService.getPointDescription(id, mIRemoteService.getPointId(id, i)),
|
||||
mIRemoteService.getPointId(id, i), id, null,
|
||||
mIRemoteService.getPointColor(id, mIRemoteService.getPointId(id, i))));
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public OsMoDroidPlugin(OsmandApplication app) {
|
||||
this.app = app;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return app.getString(R.string.osmodroid_plugin_description) + "\n External application.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return app.getString(R.string.osmodroid_plugin_name) + " (external)";
|
||||
}
|
||||
|
||||
// test
|
||||
@Override
|
||||
public boolean init(final OsmandApplication app) {
|
||||
mConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
mIRemoteService = IRemoteOsMoDroidService.Stub.asInterface(service);
|
||||
try {
|
||||
System.out.println(mIRemoteService.getVersion());
|
||||
if (mIRemoteService.getVersion() < OSMODROID_SUPPORTED_VERSION_MIN) {
|
||||
app.showToastMessage(R.string.osmodroid_plugin_old_ver_not_supported);
|
||||
shutdown(app);
|
||||
} else {
|
||||
mIRemoteService.registerListener(inter);
|
||||
connected = true;
|
||||
}
|
||||
|
||||
} catch (RemoteException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
connected = false;
|
||||
mIRemoteService = null;
|
||||
}
|
||||
};
|
||||
Intent serviceIntent = (new Intent("OsMoDroid.remote"));
|
||||
app.bindService(serviceIntent, mConnection, Context.BIND_AUTO_CREATE);
|
||||
return true;
|
||||
}
|
||||
|
||||
void requestLayersFromOsMoDroid(MapActivity activity) {
|
||||
try {
|
||||
for (int i = 0; i < mIRemoteService.getNumberOfLayers(); i++) {
|
||||
osmoDroidLayerList.add(new OsMoDroidLayer(activity, mIRemoteService.getLayerId(i), this, mIRemoteService
|
||||
.getLayerName(mIRemoteService.getLayerId(i)), mIRemoteService.getLayerDescription(mIRemoteService.getLayerId(i))));
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
getGpxArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLayers(MapActivity activity) {
|
||||
this.activity = activity;
|
||||
if (connected) {
|
||||
|
||||
for (OsMoDroidLayer myOsMoDroidLayer : osmoDroidLayerList) {
|
||||
activity.getMapView().removeLayer(myOsMoDroidLayer);
|
||||
}
|
||||
osmoDroidLayerList.clear();
|
||||
requestLayersFromOsMoDroid(activity);
|
||||
for (OsMoDroidLayer myOsMoDroidLayer : osmoDroidLayerList) {
|
||||
activity.getMapView().addLayer(myOsMoDroidLayer, 4.5f);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, MapActivity mapActivity) {
|
||||
for (OsMoDroidLayer myOsMoDroidLayer : osmoDroidLayerList) {
|
||||
adapter.item(myOsMoDroidLayer.layerName).reg();
|
||||
}
|
||||
|
||||
super.registerLayerContextMenuActions(mapView, adapter, mapActivity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(OsmandApplication app) {
|
||||
shutdown(app);
|
||||
}
|
||||
|
||||
private void shutdown(OsmandApplication app) {
|
||||
if (mIRemoteService != null) {
|
||||
if (connected) {
|
||||
try {
|
||||
mIRemoteService.unregisterListener(inter);
|
||||
} catch (RemoteException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
app.unbindService(mConnection);
|
||||
mIRemoteService = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addMonitorActions(final ContextMenuAdapter qa, final MonitoringInfoControl li, final OsmandMapTileView view) {
|
||||
boolean o = true;
|
||||
try {
|
||||
o = mIRemoteService.isActive();
|
||||
}
|
||||
catch(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
}
|
||||
final boolean off = !o;
|
||||
qa.item(off ? R.string.osmodroid_mode_off : R.string.osmodroid_mode_on
|
||||
).icon( off ? R.drawable.monitoring_rec_inactive : R.drawable.monitoring_rec_big).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
try {
|
||||
if (off) {
|
||||
mIRemoteService.Activate();
|
||||
} else {
|
||||
mIRemoteService.Deactivate();
|
||||
}
|
||||
} catch(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}).reg();
|
||||
qa.item(R.string.osmodroid_refresh).icons(R.drawable.ic_action_grefresh_dark, R.drawable.ic_action_grefresh_light).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked,
|
||||
DialogInterface dialog) {
|
||||
try {
|
||||
mIRemoteService.refreshChannels();
|
||||
} catch (RemoteException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
}).reg();
|
||||
qa.item(R.string.osmodroid_unseek).icons(R.drawable.abs__ic_commit_search_api_holo_dark, R.drawable.abs__ic_commit_search_api_holo_light).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked,
|
||||
DialogInterface dialog) {
|
||||
for (OsMoDroidLayer l: osmoDroidLayerList){
|
||||
l.seekOsMoDroidPoint=null;
|
||||
}
|
||||
|
||||
}
|
||||
}).reg();
|
||||
}
|
||||
|
||||
public void getGpxArrayList() {
|
||||
if(task!=null){
|
||||
task.cancel(true);
|
||||
}
|
||||
task = new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
for (OsMoDroidLayer l : osmoDroidLayerList){
|
||||
ArrayList<ColoredGPX> temp = new ArrayList<ColoredGPX>();
|
||||
try {
|
||||
for (int i = 0; i < mIRemoteService.getNumberOfGpx(l.layerId); i++) {
|
||||
ColoredGPX cg = new ColoredGPX();
|
||||
cg.gpxFile = GPXUtilities.loadGPXFile(app, new File(mIRemoteService.getGpxFile(l.layerId, i)));
|
||||
cg.color = mIRemoteService.getGpxColor(l.layerId, i);
|
||||
temp.add(cg);
|
||||
}
|
||||
l.inGPXFilelist(temp);
|
||||
} catch (RemoteException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
catch (ConcurrentModificationException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
};
|
||||
task.execute();
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package net.osmand.plus.osmodroid;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
|
||||
public class OsMoDroidPoint {
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
if ((o instanceof OsMoDroidPoint) && this.id == ((OsMoDroidPoint) o).id) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
LatLon latlon;
|
||||
LatLon prevlatlon;
|
||||
String name;
|
||||
String description;
|
||||
int id;
|
||||
int layerId;
|
||||
String speed = "";
|
||||
String color = "AAAAAA";
|
||||
|
||||
public OsMoDroidPoint(float objectLat, float objectLon, String objectName, String objectDescription, int objectId,
|
||||
int layerId, String speed, String color) {
|
||||
this.latlon = new LatLon(objectLat, objectLon);
|
||||
this.name = objectName;
|
||||
this.description = objectDescription;
|
||||
this.id = objectId;
|
||||
this.layerId = layerId;
|
||||
if (speed != null) {
|
||||
this.speed = speed;
|
||||
}
|
||||
if (color != null) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -676,7 +676,13 @@ public class MapRenderRepositories {
|
|||
currentRenderingContext.nightMode = nightMode;
|
||||
currentRenderingContext.preferredLocale = prefs.MAP_PREFERRED_LOCALE.get();
|
||||
currentRenderingContext.setDensityValue(mapDensity);
|
||||
currentRenderingContext.screenDensityRatio = mapDensity / Math.max(1, requestedBox.getDensity()) ;
|
||||
//Text/icon scales according to mapDensity (so text is size of road)
|
||||
// currentRenderingContext.textScale = (requestedBox.getDensity()*app.getSettings().TEXT_SCALE.get());
|
||||
//Text/icon stays same for all sizes
|
||||
currentRenderingContext.textScale = (requestedBox.getDensity() * app.getSettings().TEXT_SCALE.get())
|
||||
/ mapDensity;
|
||||
|
||||
currentRenderingContext.screenDensityRatio = 1 / Math.max(1, requestedBox.getDensity()) ;
|
||||
// init rendering context
|
||||
currentRenderingContext.tileDivisor = tileDivisor;
|
||||
if (checkWhetherInterrupted()) {
|
||||
|
|
|
@ -320,6 +320,7 @@ public class OsmandRenderer {
|
|||
int visbleWidth = icon.iconSize >= 0 ? (int) icon.iconSize : ico.getWidth();
|
||||
int visbleHeight = icon.iconSize >= 0 ? (int) icon.iconSize : ico.getHeight();
|
||||
boolean intersects = false;
|
||||
float coeff = rc.getDensityValue(rc.screenDensityRatio * rc.textScale);
|
||||
RectF rf = calculateRect(rc, icon, ico.getWidth(), ico.getHeight());
|
||||
RectF visibleRect = null;
|
||||
if (visbleHeight > 0 && visbleWidth > 0) {
|
||||
|
@ -337,14 +338,14 @@ public class OsmandRenderer {
|
|||
Bitmap shield = icon.shieldId == null ? null : RenderingIcons.getIcon(context, icon.shieldId);
|
||||
if(shield != null) {
|
||||
RectF shieldRf = calculateRect(rc, icon, shield.getWidth(), shield.getHeight());
|
||||
if (rc.screenDensityRatio != 1f) {
|
||||
if (coeff != 1f) {
|
||||
Rect src = new Rect(0, 0, shield.getWidth(), shield.getHeight());
|
||||
cv.drawBitmap(shield, src, shieldRf, paintIcon);
|
||||
} else {
|
||||
cv.drawBitmap(shield, shieldRf.left, shieldRf.top, paintIcon);
|
||||
}
|
||||
}
|
||||
if (rc.screenDensityRatio != 1f) {
|
||||
if (coeff != 1f) {
|
||||
Rect src = new Rect(0, 0, ico.getWidth(), ico.getHeight());
|
||||
cv.drawBitmap(ico, src, rf, paintIcon);
|
||||
} else {
|
||||
|
@ -367,10 +368,11 @@ public class OsmandRenderer {
|
|||
|
||||
private RectF calculateRect(RenderingContext rc, IconDrawInfo icon, int visbleWidth, int visbleHeight) {
|
||||
RectF rf;
|
||||
float left = icon.x - visbleWidth / 2 * rc.screenDensityRatio;
|
||||
float top = icon.y - visbleHeight / 2 * rc.screenDensityRatio;
|
||||
float right = left + visbleWidth * rc.screenDensityRatio;
|
||||
float bottom = top + visbleHeight * rc.screenDensityRatio;
|
||||
float coeff = rc.getDensityValue(rc.screenDensityRatio * rc.textScale);
|
||||
float left = icon.x - visbleWidth / 2 * coeff;
|
||||
float top = icon.y - visbleHeight / 2 * coeff;
|
||||
float right = left + visbleWidth * coeff;
|
||||
float bottom = top + visbleHeight * coeff;
|
||||
rf = new RectF(left, top, right, bottom);
|
||||
return rf;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TextRenderer {
|
|||
if (textColor == 0) {
|
||||
textColor = Color.BLACK;
|
||||
}
|
||||
textSize = rc.getComplexValue(render, render.ALL.R_TEXT_SIZE);
|
||||
textSize = rc.getComplexValue(render, render.ALL.R_TEXT_SIZE) ;
|
||||
textShadow = (int) rc.getComplexValue(render, render.ALL.R_TEXT_HALO_RADIUS);
|
||||
textShadowColor = render.getIntPropertyValue(render.ALL.R_TEXT_HALO_COLOR);
|
||||
if(textShadowColor == 0) {
|
||||
|
@ -226,7 +226,7 @@ public class TextRenderer {
|
|||
}
|
||||
|
||||
// sest text size before finding intersection (it is used there)
|
||||
float textSize = text.textSize;
|
||||
float textSize = text.textSize * rc.textScale ;
|
||||
paintText.setTextSize(textSize);
|
||||
paintText.setFakeBoldText(text.bold);
|
||||
paintText.setColor(text.textColor);
|
||||
|
@ -250,15 +250,14 @@ public class TextRenderer {
|
|||
cv.drawTextOnPath(text.text, text.drawOnPath, 0, text.vOffset, paintText);
|
||||
} else {
|
||||
if (text.shieldRes != null) {
|
||||
float coef = rc.getDensityValue(rc.screenDensityRatio * rc.textScale);
|
||||
Bitmap ico = RenderingIcons.getIcon(context, text.shieldRes);
|
||||
if (ico != null) {
|
||||
float left = text.centerX - ico.getWidth() / 2 * rc.screenDensityRatio
|
||||
- 0.5f;
|
||||
float top = text.centerY - ico.getHeight() / 2 * rc.screenDensityRatio
|
||||
- rc.getDensityValue(4.5f);
|
||||
float left = text.centerX - ico.getWidth() / 2 * coef - 0.5f;
|
||||
float top = text.centerY - ico.getHeight() / 2 * coef - paintText.descent() - 0.5f;
|
||||
if(rc.screenDensityRatio != 1f){
|
||||
RectF rf = new RectF(left, top, left + ico.getWidth() * rc.screenDensityRatio ,
|
||||
top + ico.getHeight() * rc.screenDensityRatio);
|
||||
RectF rf = new RectF(left, top, left + ico.getWidth() * coef,
|
||||
top + ico.getHeight() * coef);
|
||||
Rect src = new Rect(0, 0, ico.getWidth(), ico
|
||||
.getHeight());
|
||||
cv.drawBitmap(ico, src, rf, paintIcon);
|
||||
|
|
|
@ -229,7 +229,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
|||
}
|
||||
this.tourPresent = tourPresent;
|
||||
if(!suggestToDownloadMap.isEmpty()) {
|
||||
final DownloadIndexFragment da = app.getDownloadActivity();
|
||||
final DownloadActivity da = app.getDownloadActivity();
|
||||
if (da != null) {
|
||||
app.runInUIThread(new Runnable() {
|
||||
|
||||
|
@ -552,26 +552,36 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
|||
|
||||
@Override
|
||||
public void prepareOptionsMenu(final MapActivity mapActivity, ContextMenuAdapter adapter) {
|
||||
filter(adapter, R.string.menu_layers,
|
||||
R.string.pause_navigation, R.string.continue_navigation,
|
||||
filter(adapter,R.string.pause_navigation, R.string.continue_navigation,
|
||||
R.string.cancel_navigation, R.string.cancel_route, R.string.clear_destination,
|
||||
R.string.target_points,
|
||||
R.string.get_directions,
|
||||
R.string.menu_mute_on, R.string.menu_mute_off,
|
||||
R.string.where_am_i, R.string.context_menu_item_share_location);
|
||||
final StageInformation stage = getSelectedStage();
|
||||
if (stage != null && !isStageVisited(stage.order)) {
|
||||
adapter.item(R.string.complete_stage)
|
||||
.icons(R.drawable.ic_action_finish_flag_dark, R.drawable.ic_action_finish_flag_light)
|
||||
.position(adapter.length() - 1).listen(new OnContextMenuClick() {
|
||||
//poi
|
||||
if (osmandSettings.SHOW_POI_OVER_MAP.get()) {
|
||||
adapter.item(R.string.sherpafy_disable_poi).icons(
|
||||
R.drawable.ic_action_gremove_dark, R.drawable.ic_action_gremove_light)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
app.getSettings().SHOW_POI_OVER_MAP.set(false);
|
||||
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
||||
}
|
||||
}).reg();
|
||||
} else {
|
||||
adapter.item(R.string.poi).icons(R.drawable.ic_action_layers_dark, R.drawable.ic_action_layers_light)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
markStageAsCompleted(stage);
|
||||
showCompleteStageFragment(mapActivity, stage, false);
|
||||
mapActivity.getMapLayers().selectPOIFilterLayer(mapActivity.getMapView(), null);
|
||||
app.getSettings().SHOW_POI_OVER_MAP.set(true);
|
||||
mapActivity.getMapLayers().updateLayers(mapActivity.getMapView());
|
||||
}
|
||||
}).reg();
|
||||
}
|
||||
adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light).position(adapter.length() - 1)
|
||||
//important info
|
||||
adapter.item(R.string.sherpafy_tour_info_txt).icons(R.drawable.ic_action_info_dark, R.drawable.ic_action_info_light)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
|
@ -580,7 +590,19 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
|||
mapActivity.startActivity(newIntent);
|
||||
}
|
||||
}).reg();
|
||||
|
||||
//complete stage
|
||||
final StageInformation stage = getSelectedStage();
|
||||
if (stage != null && !isStageVisited(stage.order)) {
|
||||
adapter.item(R.string.complete_stage)
|
||||
.icons(R.drawable.ic_action_finish_flag_dark, R.drawable.ic_action_finish_flag_light)
|
||||
.listen(new OnContextMenuClick() {
|
||||
@Override
|
||||
public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
|
||||
markStageAsCompleted(stage);
|
||||
showCompleteStageFragment(mapActivity, stage, false);
|
||||
}
|
||||
}).reg();
|
||||
}
|
||||
//share my location
|
||||
adapter.item(R.string.context_menu_item_share_location).icons(
|
||||
R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_light).listen(new OnContextMenuClick() {
|
||||
|
@ -593,7 +615,6 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
|||
}
|
||||
}
|
||||
}).reg();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ public class SherpafyFavoriteFragment extends SherpafyStageInfoFragment {
|
|||
int k = args.getInt(FAV_PARAM);
|
||||
if (stage != null) {
|
||||
fav = (StageFavorite) stage.getFavorites().get(k);
|
||||
if (getSherlockActivity().getSupportActionBar() != null) {
|
||||
getSherlockActivity().getSupportActionBar().setTitle(fav.getName());
|
||||
}
|
||||
// if (getSherlockActivity().getSupportActionBar() != null) {
|
||||
// getSherlockActivity().getSupportActionBar().setTitle(fav.getName());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,9 @@ public class SherpafyFavoritesListFragment extends SherlockListFragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if(tour != null) {
|
||||
getSherlockActivity().getSupportActionBar().setTitle(tour.getName());
|
||||
}
|
||||
// if(tour != null) {
|
||||
// getSherlockActivity().getSupportActionBar().setTitle(tour.getName());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -62,7 +62,9 @@ public class SherpafyStageFragment extends SherlockFragment {
|
|||
if(tour != null && tour.getStageInformation().size() > k) {
|
||||
stage = tour.getStageInformation().get(k);
|
||||
}
|
||||
getSherlockActivity().getSupportActionBar().setTitle(getString(R.string.tab_stage) + " " + (k+1));
|
||||
if (stage != null){
|
||||
getSherlockActivity().getSupportActionBar().setTitle(stage.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,6 +75,9 @@ public class SherpafyStageInfoFragment extends SherlockFragment {
|
|||
|
||||
|
||||
protected void updateView(WebView description, ImageView icon, TextView additional, TextView text, TextView header) {
|
||||
if (stage == null){
|
||||
return;
|
||||
}
|
||||
if (stage.getImageBitmap() != null) {
|
||||
icon.setImageBitmap(stage.getImageBitmap());
|
||||
} else {
|
||||
|
|
|
@ -35,6 +35,8 @@ public class AnimateDraggingMapThread {
|
|||
private double targetLongitude = 0;
|
||||
private int targetIntZoom = 0;
|
||||
private float targetZoomScale = 0;
|
||||
|
||||
private boolean isAnimatingZoom;
|
||||
|
||||
|
||||
public AnimateDraggingMapThread(OsmandMapTileView tileView){
|
||||
|
@ -207,29 +209,38 @@ public class AnimateDraggingMapThread {
|
|||
}
|
||||
|
||||
private void animatingZoomInThread(float zoomStart, int zoom, float zoomScale, float animationTime, boolean notifyListener){
|
||||
float curZoom = zoomStart;
|
||||
float zoomEnd = zoom + zoomScale;
|
||||
animationTime *= Math.abs(zoomEnd - zoomStart);
|
||||
// AccelerateInterpolator interpolator = new AccelerateInterpolator(1);
|
||||
LinearInterpolator interpolator = new LinearInterpolator();
|
||||
|
||||
long timeMillis = SystemClock.uptimeMillis();
|
||||
float normalizedTime = 0f;
|
||||
while(!stopped){
|
||||
normalizedTime = (SystemClock.uptimeMillis() - timeMillis) / animationTime;
|
||||
if(normalizedTime > 1f){
|
||||
break;
|
||||
}
|
||||
float interpolation = interpolator.getInterpolation(normalizedTime);
|
||||
curZoom = interpolation * (zoomEnd - zoomStart) + zoomStart;
|
||||
tileView.zoomToAnimate(curZoom, notifyListener);
|
||||
try {
|
||||
Thread.sleep(DEFAULT_SLEEP_TO_REDRAW);
|
||||
} catch (InterruptedException e) {
|
||||
stopped = true;
|
||||
try {
|
||||
isAnimatingZoom = true;
|
||||
float curZoom = zoomStart;
|
||||
float zoomEnd = zoom + zoomScale;
|
||||
animationTime *= Math.abs(zoomEnd - zoomStart);
|
||||
// AccelerateInterpolator interpolator = new AccelerateInterpolator(1);
|
||||
LinearInterpolator interpolator = new LinearInterpolator();
|
||||
|
||||
long timeMillis = SystemClock.uptimeMillis();
|
||||
float normalizedTime = 0f;
|
||||
while (!stopped) {
|
||||
normalizedTime = (SystemClock.uptimeMillis() - timeMillis) / animationTime;
|
||||
if (normalizedTime > 1f) {
|
||||
break;
|
||||
}
|
||||
float interpolation = interpolator.getInterpolation(normalizedTime);
|
||||
curZoom = interpolation * (zoomEnd - zoomStart) + zoomStart;
|
||||
tileView.zoomToAnimate(curZoom, notifyListener);
|
||||
try {
|
||||
Thread.sleep(DEFAULT_SLEEP_TO_REDRAW);
|
||||
} catch (InterruptedException e) {
|
||||
stopped = true;
|
||||
}
|
||||
}
|
||||
tileView.setZoomAnimate(zoom, zoomScale, notifyListener);
|
||||
} finally {
|
||||
isAnimatingZoom = false;
|
||||
}
|
||||
tileView.setZoomAnimate(zoom, zoomScale, notifyListener);
|
||||
}
|
||||
|
||||
public boolean isAnimatingZoom() {
|
||||
return isAnimatingZoom;
|
||||
}
|
||||
|
||||
public void startZooming(final int zoomEnd, final boolean notifyListener){
|
||||
|
|
|
@ -131,4 +131,8 @@ public class MultiTouchSupport {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
public PointF getCenterPoint() {
|
||||
return centerPoint;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
}
|
||||
|
||||
public float getSettingsZoomScale() {
|
||||
return getSettings().getSettingsZoomScale(getDensity());
|
||||
return getSettings().getSettingsZoomScale() + (float)Math.sqrt(Math.max(0, getDensity() - 1));
|
||||
}
|
||||
|
||||
public float getZoomScale() {
|
||||
|
@ -549,12 +549,18 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
|||
// skip it
|
||||
}
|
||||
}
|
||||
if (showMapPosition) {
|
||||
canvas.drawCircle(c.x, c.y, 3 * dm.density, paintCenter);
|
||||
canvas.drawCircle(c.x, c.y, 7 * dm.density, paintCenter);
|
||||
if (showMapPosition || animatedDraggingThread.isAnimatingZoom()) {
|
||||
drawMapPosition(canvas, c.x, c.y);
|
||||
} else if(multiTouchSupport.isInZoomMode()) {
|
||||
drawMapPosition(canvas, multiTouchSupport.getCenterPoint().x, multiTouchSupport.getCenterPoint().y);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawMapPosition(Canvas canvas, float x, float y) {
|
||||
canvas.drawCircle(x, y, 3 * dm.density, paintCenter);
|
||||
canvas.drawCircle(x, y, 7 * dm.density, paintCenter);
|
||||
}
|
||||
|
||||
private void refreshBufferImage(final DrawSettings drawSettings) {
|
||||
if (!baseHandler.hasMessages(BASE_REFRESH_MESSAGE) || drawSettings.isUpdateVectorRendering()) {
|
||||
Message msg = Message.obtain(baseHandler, new Runnable() {
|
||||
|
|
|
@ -58,8 +58,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
/// cache for displayed POI
|
||||
// Work with cache (for map copied from AmenityIndexRepositoryOdb)
|
||||
private MapLayerData<List<Amenity>> data;
|
||||
private boolean path = false;
|
||||
private double radius = 100;
|
||||
|
||||
|
||||
public POIMapLayer(final MapActivity activity) {
|
||||
|
@ -83,10 +81,10 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
@Override
|
||||
protected List<Amenity> calculateResult(RotatedTileBox tileBox) {
|
||||
QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||
if(path) {
|
||||
RouteCalculationResult result = routingHelper.getRoute();
|
||||
return resourceManager.searchAmenitiesOnThePath(result.getImmutableAllLocations(), radius, filter, null);
|
||||
} else {
|
||||
// if(path) {
|
||||
// RouteCalculationResult result = routingHelper.getRoute();
|
||||
// return resourceManager.searchAmenitiesOnThePath(result.getImmutableAllLocations(), radius, filter, null);
|
||||
// } else {
|
||||
return resourceManager.searchAmenities(filter, latLonBounds.top, latLonBounds.left,
|
||||
latLonBounds.bottom, latLonBounds.right, tileBox.getZoom(), new ResultMatcher<Amenity>() {
|
||||
|
||||
|
@ -100,7 +98,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
return isInterrupted();
|
||||
}
|
||||
});
|
||||
}
|
||||
// }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -110,20 +108,10 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
}
|
||||
|
||||
public void setFilter(PoiFilter filter) {
|
||||
// TODO parameter
|
||||
this.filter = filter;
|
||||
// this.radius = 100;
|
||||
// this.path = true;
|
||||
this.path = false;
|
||||
data.clearCache();
|
||||
}
|
||||
|
||||
public void setFilter(PoiFilter filter, double radius) {
|
||||
this.filter = filter;
|
||||
this.radius = radius;
|
||||
this.path = true;
|
||||
data.clearCache();
|
||||
}
|
||||
|
||||
|
||||
public void getAmenityFromPoint(RotatedTileBox tb, PointF point, List<? super Amenity> am) {
|
||||
|
@ -366,9 +354,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
|
||||
@Override
|
||||
public void newRouteIsCalculated(boolean newRoute) {
|
||||
if(path) {
|
||||
data.clearCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -236,9 +236,9 @@ public class MapZoomControls extends MapControls {
|
|||
public boolean onLongClick(View notUseCouldBeNull) {
|
||||
final OsmandSettings.OsmandPreference<Float> zoomScale = view.getSettings().MAP_ZOOM_SCALE_BY_DENSITY;
|
||||
final AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext());
|
||||
float scale = view.getZoomScale();
|
||||
float scale = zoomScale.get();// view.getZoomScale();
|
||||
int p = (int) ((scale > 0 ? 1 : -1) * Math.round(scale * scale * 100)) + 100;
|
||||
final TIntArrayList tlist = new TIntArrayList(new int[] { 75, 100, 150, 200, 300, 400, 500 });
|
||||
final TIntArrayList tlist = new TIntArrayList(new int[] {50, 75, 100, 150, 200, 300, 400, 500 });
|
||||
final List<String> values = new ArrayList<String>();
|
||||
int i = -1;
|
||||
for (int k = 0; k <= tlist.size(); k++) {
|
||||
|
@ -272,7 +272,7 @@ public class MapZoomControls extends MapControls {
|
|||
} else {
|
||||
newScale = -(float) Math.sqrt((100f - tlist.get(which)) / 100f);
|
||||
}
|
||||
zoomScale.set(newScale - (float) Math.sqrt(Math.max(view.getDensity() - 1, 0)));
|
||||
zoomScale.set(newScale);
|
||||
view.getAnimatedDraggingThread().startZooming(view.getZoom(),
|
||||
view.getSettingsZoomScale(), false);
|
||||
dialog.dismiss();
|
||||
|
|
|
@ -6,6 +6,10 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -27,8 +31,10 @@ import android.speech.tts.TextToSpeech;
|
|||
import android.speech.tts.TextToSpeech.OnInitListener;
|
||||
import android.speech.tts.TextToSpeech.OnUtteranceCompletedListener;
|
||||
|
||||
|
||||
public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
|
||||
public final static String PEBBLE_ALERT = "PEBBLE_ALERT";
|
||||
public final static String WEAR_ALERT = "WEAR_ALERT";
|
||||
private static final class IntentStarter implements
|
||||
DialogInterface.OnClickListener {
|
||||
private final Context ctx;
|
||||
|
@ -132,6 +138,22 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer {
|
|||
log.info("Send message to pebble " + message);
|
||||
}
|
||||
|
||||
public void sendAlertToAndroidWear(String message) {
|
||||
int notificationId = 1;
|
||||
NotificationCompat.Builder notificationBuilder =
|
||||
new NotificationCompat.Builder(mTtsContext)
|
||||
.setSmallIcon(R.drawable.icon)
|
||||
.setContentTitle(mTtsContext.getString(R.string.app_name))
|
||||
.setContentText(message)
|
||||
.setGroup(WEAR_ALERT);
|
||||
|
||||
// Get an instance of the NotificationManager service
|
||||
NotificationManagerCompat notificationManager =
|
||||
NotificationManagerCompat.from(mTtsContext);
|
||||
// Build the notification and issues it with notification manager.
|
||||
notificationManager.notify(notificationId, notificationBuilder.build());
|
||||
}
|
||||
|
||||
private void initializeEngine(final Context ctx, final Activity act)
|
||||
{
|
||||
if (mTts != null && mTtsContext != ctx) {
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue