Fix critical bug with preparation results (native routing)

This commit is contained in:
Victor Shcherb 2012-11-12 21:50:36 +01:00
parent 02da57fd9c
commit b202bc9d51
3 changed files with 13 additions and 11 deletions

View file

@ -1,5 +1,6 @@
package net.osmand.router;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

View file

@ -596,10 +596,11 @@ void attachConnectedRoads(RoutingContext* ctx, vector<RouteSegmentResult>& res)
do {
SHARED_PTR<RouteSegment> s = ctx->loadRouteSegment(it->object->pointsX[j], it->object->pointsY[j]);
vector<RouteSegmentResult> r;
while(s.get() != NULL) {
RouteSegmentResult res(s->road, s->getSegmentStart(), s->getSegmentStart());
RouteSegment* rs = s.get();
while(rs != NULL) {
RouteSegmentResult res(rs->road, rs->getSegmentStart(), rs->getSegmentStart());
r.push_back(res);
s = s->next;
rs = rs->next.get();
}
it->attachedRoutes.push_back(r);
j = plus ? j + 1 : j - 1;

View file

@ -595,8 +595,8 @@ void drawObject(RenderingContext* rc, SkCanvas* cv, RenderingRuleSearchRequest*
SkPaint* paint, vector<MapDataObjectPrimitive>& array, int objOrder) {
double polygonLimit = 100;
int roadsLimit = 500;
float orderToSwitch = 0;
// int roadsLimit = 500;
// float orderToSwitch = 0;
for (int i = 0; i < array.size(); i++) {
rc->allObjects++;
MapDataObject* mObj = array[i].obj;
@ -608,12 +608,12 @@ void drawObject(RenderingContext* rc, SkCanvas* cv, RenderingRuleSearchRequest*
// polygon
drawPolygon(mObj, req, cv, paint, rc, pair);
} else if (objOrder == 1 || objOrder == 2) {
if(--roadsLimit == 0) {
orderToSwitch = array[i].order;
} else if(roadsLimit < 0 && orderToSwitch != array[i].order){
// break here
return;
}
// if(--roadsLimit == 0) {
// orderToSwitch = array[i].order;
// } else if(roadsLimit < 0 && orderToSwitch != array[i].order){
// // break here
// return;
// }
drawPolyline(mObj, req, cv, paint, rc, pair, mObj->getSimpleLayer(), objOrder == 1);
} else if (objOrder == 3) {
drawPoint(mObj, req, cv, paint, rc, pair, array[i].typeInd == 0);