Example #1
0
        private void ChildRemoved(IDocumentSnapshot document)
        {
            var key  = document.Id;
            var info = _locationInfos[key];

            if (info == null)
            {
                return;
            }
            lock (_lock)
            {
                var location = GeoFire.GetLocationValue(document);
                var hash     = (location != null) ? new GeoHash(location) : null;
                if (hash != null && GeoHashQueriesContainGeoHash(hash))
                {
                    return;
                }

                _locationInfos.Remove(key);

                if (!info.InGeoQuery)
                {
                    return;
                }

                OnDocumentExited?.Invoke(this, new DocumentEventArgs <T>(info.Snapshot.ToObject <T>()));
            }
        }
Example #2
0
 public GeoQuery(GeoFire geoFire, GeoPoint center, double radius)
 {
     _geoFire = geoFire;
     _center  = center;
     _radius  = radius * KilometerToMeter; // Convert from kilometers to meters.
     SetupQueries();
 }
Example #3
0
        private void ChildChanged(IDocumentSnapshot document)
        {
            var location = GeoFire.GetLocationValue(document);

            if (location != null)
            {
                UpdateLocationInfo(document, location);
            }
            else
            {
                Debug.Assert(false, "Got Datasnapshot without location with key " + document.Id);
            }
        }