clustering google maps click event IOS

69 views
Skip to first unread message

yassine...@gmail.com

unread,
Oct 5, 2016, 3:14:19 PM10/5/16
to CodenameOne Discussions

Hello ,

Please i tried to integrate clustering of markers on Google maps on IOS , the clustering is working well but the problem is that when I click over the marker my dialog is not displayed ,that marker can show just the title and the snippet, I did not add the marker from the function addMarker but using the render :


-(long long)addMarker:(NSData*)param param1:(double)param1 param2:(double)param2 param3:(NSString*)param3 param4:(NSString*)param4 param5:(BOOL)param5{

    __block Person *person = nil;


    dispatch_sync(dispatch_get_main_queue(), ^{

        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];


        person = [[Person alloc] init];

        person.param=param;

        person.position = CLLocationCoordinate2DMake(param1, param2);

        person.param3=param3;

        person.param4=param4;

        person.param5=param5;


        [_clusterManager addItem:person];

        

        [person retain];

        [pool release];

    });

    

    return person;

}




- (void)renderer:(id<GMUClusterRenderer>)renderer willRenderMarker:(GMSMarker *)marker {

    

 


  if ([marker.userData isKindOfClass:[Person class]]) {

   Person *person = (Person *)marker.userData;

        marker.position = person.position;

        marker.title = nil;

        marker.snippet = nil;

        if(person.param != nil) {

            UIImage* img = nil;

            if ([[UIImage class] respondsToSelector:@selector(imageWithData:scale:)]){

                // If we are on retina we need to provide scale, or the images will be too big and 

                // blurry.

                // Scale version available only in iOS 6 and later so check here.

                img = [UIImage imageWithData:person.param scale:scaleValue];

            } else {

                img = [UIImage imageWithData:person.param];

            }

            marker.icon = img;

        }

          marker.map=mapView;

      marker.tappable = YES;

      

     


  }

    

     }

Shai Almog

unread,
Oct 5, 2016, 11:07:38 PM10/5/16
to CodenameOne Discussions, yassine...@gmail.com
Hi,
how do you send the click event?
Is it in the event dispatch thread?

Yassine el malyh

unread,
Oct 6, 2016, 3:48:50 AM10/6/16
to Shai Almog, CodenameOne Discussions

the probleme is i dont know where codename one execute the click event on the marker , in the original method addMarker i cant see the event click action to add it to my render method, the fucntion  didTapMarker work well

Shai Almog

unread,
Oct 6, 2016, 9:37:29 PM10/6/16
to CodenameOne Discussions, shai....@gmail.com, yassine...@gmail.com
In the Java side you will need to wrap the code with a callSerially to make sure the event executes on the EDT.

yassine...@gmail.com

unread,
Oct 12, 2016, 5:40:20 AM10/12/16
to CodenameOne Discussions, shai....@gmail.com, yassine...@gmail.com

the event executes well on the addMarker method
I want to
recover the action executed in the sixth parameter of the method addMarker and Add it to my renderer
method

Shai Almog

unread,
Oct 12, 2016, 9:40:21 PM10/12/16
to CodenameOne Discussions, shai....@gmail.com, yassine...@gmail.com
So why not use fireMarkerEvent?
Reply all
Reply to author
Forward
0 new messages