I must have been blind... I have added a function that did exactly the
same as the function just above mine. So here's a smaller patch for
Road.cpp. It replaces the one posted before.

-- 
Yves Goergen "LonelyPixel" <[email protected]>
Visit my web laboratory at http://beta.unclassified.de
--- merkaartor\Map\Road.cpp.orig        Fri Jan 02 23:21:13 2009
+++ merkaartor\Map\Road.cpp     Sun Jan 04 21:09:21 2009
@@ -938,3 +938,35 @@
        return parentRoad;
 }
 
+Road * Road::GetSingleParentRoadInner(MapFeature * mapFeature)
+{
+       unsigned int parents = mapFeature->sizeParents();
+
+       if (parents == 0)
+               return NULL;
+
+       Road * parentRoad = NULL;
+       TrackPoint* trackPoint = dynamic_cast<TrackPoint*>(mapFeature);
+
+       unsigned int i;
+       for (i=0; i<parents; i++)
+       {
+               MapFeature * parent = mapFeature->getParent(i);
+               Road * road = dynamic_cast<Road*>(parent);
+
+               if (road == NULL)
+                       continue;
+
+               if (road->isExtrimity(trackPoint))
+                       continue;
+               
+               if (parentRoad)
+                       return NULL;
+
+               if (road->layer()->isEnabled())
+                       parentRoad = road;
+       }
+
+       return parentRoad;
+}
+
_______________________________________________
Merkaartor mailing list
[email protected]
http://lists.openstreetmap.org/listinfo/merkaartor

Reply via email to