private void HandleSetLocation(SetLocationCommand command)
        {
            Position            p = new Position(command.Longitude, command.Latitude);
            SetLocationInRegion m = new SetLocationInRegion(MapDistributor.GetAreaOfPosition(p), p, command.UserId, 100);

            regionShardRegion.Tell(ShardEnvelop <object> .Create(m.RegionExtend.Id, m));

            Context.GetLogger().Info(command.ToString());
        }
Example #2
0
        private void HandleSetLocation(SetLocationInRegion command)
        {
            IList <KeyValuePair <SpatialExtend, Guid> > matchingGroups = locationGroupMap
                                                                         .Where(kvp => kvp.Key.AddMargin(command.Margin).IsWithin(command.Position))
                                                                         .ToList();

            foreach (KeyValuePair <SpatialExtend, Guid> group in matchingGroups)
            {
                locationGroupShardRegion.Tell(ShardEnvelop <JoinGroup> .Create(
                                                  group.Value.ToString(), new JoinGroup(command.UserId, command.Position)));
            }

            if (!matchingGroups.Any())
            {
                locationGroupMap.Put(new SpatialExtend(command.Position, command.Position), Guid.NewGuid());
            }

            Emit(new LocationSet(), e => HandleLocationSetEvent(e));
        }