示例#1
0
        // GET /api/data
        public List <SentData> Get()
        {
            var list = _dbContext.ALL_DATA.ToList();

            list.RemoveAll(d => d.SSID.Contains("UPC Wi-Free"));
            var sentData = new List <SentData>();

            foreach (var bssid in list.Select(d => d.BSSID).Distinct())
            {
                var allDatasForBssid = list.FindAll(d => d.BSSID == bssid);
                var maxRssiData      = allDatasForBssid.MaxBy(d => d.RSSI);
                var maxDist          = allDatasForBssid.Max(d =>
                                                            DistanceCalc.DistanceBetweenPlaces(maxRssiData.LATITUDE, maxRssiData.LONGITUDE, d.LATITUDE,
                                                                                               d.LONGITUDE));
                if (maxDist > 100)
                {
                    maxDist = 50;
                }
                sentData.Add(new SentData
                {
                    LATITUDE     = maxRssiData.LATITUDE,
                    LONGITUDE    = maxRssiData.LONGITUDE,
                    RSSI         = maxRssiData.RSSI,
                    MAX_DISTANCE = maxDist > 0.00001 ? maxDist : 0.5,
                    SSID         = maxRssiData.SSID,
                    EXTRA_INFO   = maxRssiData.AUTH_TYPE,
                    FREE         = !maxRssiData.AUTH_TYPE.Contains("WPA"),
                    BSSID        = maxRssiData.BSSID
                });
            }
            return(sentData);
        }
示例#2
0
        public async Task <IActionResult> GetGalleryLocations()
        {
            var myLat         = 25.79;
            var myLon         = -80.13;
            var radiusInMile  = 50;
            var minMilePerLat = 68.703;
            var milePerLon    = Math.Cos(myLat) * 69.172;
            var minLat        = Math.Min(myLat - radiusInMile / minMilePerLat, myLat + radiusInMile / minMilePerLat);
            var maxLat        = Math.Max(myLat - radiusInMile / minMilePerLat, myLat + radiusInMile / minMilePerLat);
            var minLon        = Math.Min(myLon - radiusInMile / milePerLon, myLon + radiusInMile / milePerLon);
            var maxLon        = Math.Max(myLon - radiusInMile / milePerLon, myLon + radiusInMile / milePerLon);

            var calc = new DistanceCalc();

            var data = context.Posts
                       .Include(a => a.NewsCategory)
                       .ThenInclude(n => n.NewsEvent)
                       .Where(p => (minLat <= p.Lat && p.Lat <= maxLat) && (minLon <= p.Lng && p.Lng <= maxLon))
                       .AsEnumerable()
                       .Select(p => new { p, Dist = calc.distanceInMiles(myLon, myLat, p.Lng, p.Lat) })
                       .Where(p => p.Dist <= radiusInMile)
                       .ToList();
            await Task.CompletedTask;

            return(Ok(data));
        }
示例#3
0
    void Start()
    {
        GameObject hunter = GameObject.Find("First Player");

        numberOfObjectsCollected = 0;
        numOfLines = 0;

        scoreMessage.text         = "Halie, Meris, Bea, LJ\n# of Objects Collected: " + numberOfObjectsCollected;
        numberOfLinesMessage.text = "Time Elapsed: " + timeElapsed.ToString("N1");

        winMessage.text = "You Win!";
        winMessageObject.SetActive(false);

        timeElapsed    += Time.deltaTime;
        notDisplayedYet = true;
        started         = false;

        // numOfSteps = 0;

        // sumOfFPS = 0;
        // numOfFrames = 0;


        // lastPosition = transform.position;
        // totalDistance = 0;


        GameObject cea = GameObject.Find("CenterEyeAnchor");

        calc = cea.GetComponent <DistanceCalc>();
    }
示例#4
0
    public bool DistanceTest(DistanceCalc d)
    {
        //  commandMove = c;
        distanceCalc = d;

        if (distanceCalc != null)
        {
            if ((distanceCalc.currentDistance /*+ distanceCalc.cumulativeDistance */) < distanceCalc.maxDistance)
            {
                InRange = true;
                if (InsideRange != null)
                {
                    InsideRange();
                }
            }
            if ((distanceCalc.currentDistance /* + distanceCalc.cumulativeDistance */) >= distanceCalc.maxDistance)
            {
                InRange = false;
                if (OutOfRange != null)
                {
                    OutOfRange();
                }
            }
        }
        return(false);
    }
示例#5
0
    public override void Start()
    {
        base.Start();

        combatController.SelectEvent += Ready;

        distanceCalc            = GetComponent <DistanceCalc>();
        distanceCompare         = GetComponent <DistanceCompare>();
        transform.localPosition = new Vector3(0, 0, 0);
    }
示例#6
0
 // Use this for initialization
 void Start()
 {
     wp = GameObject.FindGameObjectWithTag("waypoint").GetComponent <DistanceCalc>();
     SetupWaypoints();
 }