Ejemplo n.º 1
0
        public static LocationWithVoteModel Load(BinaryReader br)
        {
            LocationWithVoteModel location = new LocationWithVoteModel();
            location.Coordinate = GeoCoordinateExtensions.Load(br);
            location.Votes = br.ReadInt32();
            int hours = br.ReadInt32();
            int minutes = br.ReadInt32();
            int seconds = br.ReadInt32();
            location.TimeStamp = new TimeSpan(hours, minutes, seconds);

            return location;
        }
Ejemplo n.º 2
0
        private LocationWithVoteModel InitializeLocationWithVote(GeoCoordinate coordinate)
        {
            LocationWithVoteModel locationWithVote;
            if (double.IsNaN(coordinate.Speed) ||
                double.IsNaN(coordinate.Course) ||
                coordinate.HorizontalAccuracy >= 10000)
                locationWithVote = null;
            else
            {
                locationWithVote = new LocationWithVoteModel() { Coordinate = coordinate, Votes = 0, TimeStamp = Duration };

                if (locationWithVote.Coordinate.HorizontalAccuracy > 1000) // extremely poor
                    locationWithVote.Votes -= 500;
                else if (locationWithVote.Coordinate.HorizontalAccuracy > 100) // very poor
                    locationWithVote.Votes -= 250;
                else if (locationWithVote.Coordinate.HorizontalAccuracy > 50) // poor
                    locationWithVote.Votes -= 100;
                else if (locationWithVote.Coordinate.HorizontalAccuracy > 20) // average
                    locationWithVote.Votes -= 50;
                else if (locationWithVote.Coordinate.HorizontalAccuracy > 10) // good (excellent if better)
                    locationWithVote.Votes = -10;
            }

            return locationWithVote;
        }