0

I have been trying to remove a ticket annotation out of GLYMapView by using this method from GLYMapModeBase:

- (void)ticketRemoved:(const Glympse::GTicket&)ticket;

but I have been unsuccessful because in the ticketRemoved method, my mapUser is always null:

Glympse::GMapUser mapUser = ticket->getContext(GLYMapUserContext);
if ( mapUser == NULL )
{
    return;
}

If this method is the correct method of removing an annotation, how do I set a GMapUser in a GTicket? I have looked into the documentation but have found no function available.

kevinnguy
  • 454
  • 4
  • 13

1 Answers1

2

There are few ways you can approach this problem.

  1. You can provide your own implementation of GLYMapMode similar to GLYWorldView but ignoring expired tickets. You need to wire Glympse::GE::TICKET_EXPIRED event (for incoming tickets) to [GLYMapModeBase ticketRemoved:].
  2. In case if you do not need to keep track of expired tickets (incoming), you can actually remove them from the system immediately upon expiration. The pattern here is similar to the one proposed above, but it can be done without making any changes to map component. You need to listen to events broadcasted by all active tickets (GLYWorldView provides a good example on how to implement that). Once ticket expires you can stop watching a user by calling IUser::stopWatching() (assuming that there are no other active tickets coming from this user). This will in turn remove user from the map.
Egor Pushkin
  • 161
  • 3