girijeshkumar2007 / route-me

Automatically exported from code.google.com/p/route-me
0 stars 0 forks source link

Polygon (RMPath) tapOnMarker delegate does not get called #157

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm creating a polygon on the map using RMPath and adding Markers within the 
area of the polygon.  When I tap on the markers, the tapOnMarker delegate does 
not get called.  Is there a way to place the markers 'above' the polygon? Or 
for the polygon to receive the call and pass it on?

Original issue reported on code.google.com by macegh...@gmail.com on 18 Nov 2010 at 7:09

GoogleCodeExporter commented 8 years ago
same problem here, did you find a solution?? I moved the RMPath to the lowest 
index in the sublayers array from RMLayerCollection but the result was not the 
desired effect. the markers were still under the RMPath polygon area..

Original comment by adrian.h...@gmail.com on 23 Feb 2011 at 3:18

GoogleCodeExporter commented 8 years ago
no, haven't had any time to look

Original comment by macegh...@gmail.com on 24 Feb 2011 at 8:36

GoogleCodeExporter commented 8 years ago
Finally I found out how to do it. Since [[[mapView contents] overlay] 
sublayers] contains all RMPaths and RMMarkers, I set the RMPath to the lowest 
index. But only this is not sufficient. I have to set the zPosition of the 
RMPath to -2.0f (all my other markers have zPosition=-1.0f). 

//polygonArray is a NSMutableArray of CLLocation
- (RMPath*)addLayerForPolygon:(NSMutableArray*)polygonArray 
toMap:(RMMapView*)map {
    RMPath* polygonPath = [[[RMPath alloc] initForMap:map] autorelease];
    [polygonPath setLineColor:[UIColor colorWithRed:1 green:0 blue:0 alpha:0.5]];
    [polygonPath setFillColor:[UIColor colorWithRed:1 green:0 blue:0 alpha:0.5]];
    [polygonPath setLineWidth:1];

    BOOL firstPoint = YES;
    for (CLLocation* loc in polygonArray) {
        if (firstPoint) {
            [polygonPath moveToLatLong:loc.coordinate];
            firstPoint = NO;
        } else {
            [polygonPath addLineToLatLong:loc.coordinate];
        } 
    }

    [polygonPath closePath];

    polygonPath.zPosition = -2.0f;

    NSMutableArray *sublayers = [[[[mapView contents] overlay] sublayers] mutableCopy];
    [sublayers insertObject:polygonPath atIndex:0];
    [[[mapView contents] overlay] setSublayers:sublayers];
    return polygonPath;
}

Original comment by adrian.h...@gmail.com on 28 Feb 2011 at 11:47