use of net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule in project Osmand by osmandapp.
the class RouteDataObject method getLanes.
public int getLanes() {
int sz = types.length;
for (int i = 0; i < sz; i++) {
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
int ln = r.lanes();
if (ln > 0) {
return ln;
}
}
return -1;
}
use of net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule in project OsmAnd-tools by osmandapp.
the class BinaryMapIndexWriter method writeRouteRawEncodingRules.
public void writeRouteRawEncodingRules(List<BinaryMapRouteReaderAdapter.RouteTypeRule> types) throws IOException {
checkPeekState(ROUTE_INDEX_INIT);
for (int i = 1; i < types.size(); i++) {
RouteEncodingRule.Builder builder = OsmandOdb.OsmAndRoutingIndex.RouteEncodingRule.newBuilder();
RouteTypeRule rule = types.get(i);
builder.setTag(rule.getTag());
if (rule.getValue() != null) {
builder.setValue(rule.getValue());
} else {
builder.setValue("");
}
RouteEncodingRule rulet = builder.build();
codedOutStream.writeMessage(OsmandOdb.OsmAndRoutingIndex.RULES_FIELD_NUMBER, rulet);
}
}
use of net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule in project Osmand by osmandapp.
the class RouteDataObject method getHighway.
public static String getHighway(int[] types, RouteRegion region) {
String highway = null;
int sz = types.length;
for (int i = 0; i < sz; i++) {
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
highway = r.highwayRoad();
if (highway != null) {
break;
}
}
return highway;
}
use of net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule in project Osmand by osmandapp.
the class RouteResultPreparation method printAdditionalPointInfo.
private void printAdditionalPointInfo(RouteSegmentResult res) {
boolean plus = res.getStartPointIndex() < res.getEndPointIndex();
for (int k = res.getStartPointIndex(); k != res.getEndPointIndex(); ) {
int[] tp = res.getObject().getPointTypes(k);
String[] pointNames = res.getObject().getPointNames(k);
int[] pointNameTypes = res.getObject().getPointNameTypes(k);
if (tp != null || pointNameTypes != null) {
StringBuilder bld = new StringBuilder();
bld.append("<point " + (k));
if (tp != null) {
for (int t = 0; t < tp.length; t++) {
RouteTypeRule rr = res.getObject().region.quickGetEncodingRule(tp[t]);
bld.append(" " + rr.getTag() + "=\"" + rr.getValue() + "\"");
}
}
if (pointNameTypes != null) {
for (int t = 0; t < pointNameTypes.length; t++) {
RouteTypeRule rr = res.getObject().region.quickGetEncodingRule(pointNameTypes[t]);
bld.append(" " + rr.getTag() + "=\"" + pointNames[t] + "\"");
}
}
bld.append("/>");
println("\t" + bld.toString());
}
if (plus) {
k++;
} else {
k--;
}
}
}
use of net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule in project Osmand by osmandapp.
the class RouteCalculationResult method attachAlarmInfo.
private static void attachAlarmInfo(List<AlarmInfo> alarms, RouteSegmentResult res, int intId, int locInd) {
int[] pointTypes = res.getObject().getPointTypes(intId);
if (pointTypes != null) {
RouteRegion reg = res.getObject().region;
for (int r = 0; r < pointTypes.length; r++) {
RouteTypeRule typeRule = reg.quickGetEncodingRule(pointTypes[r]);
int x31 = res.getObject().getPoint31XTile(intId);
int y31 = res.getObject().getPoint31YTile(intId);
Location loc = new Location("");
loc.setLatitude(MapUtils.get31LatitudeY(y31));
loc.setLongitude(MapUtils.get31LongitudeX(x31));
AlarmInfo info = AlarmInfo.createAlarmInfo(typeRule, locInd, loc);
// For STOP first check if it has directional info
if ((info != null) && !((info.getType() == AlarmInfoType.STOP) && !res.getObject().isStopApplicable(res.isForwardDirection(), intId, res.getStartPointIndex(), res.getEndPointIndex()))) {
alarms.add(info);
}
}
}
}
Aggregations