Exemple #1
0
 /// <summary>
 /// This method raises an event with the POI that has full information, after the decision
 /// of Fuzzy Logic Agent
 /// </summary>
 /// <param name="poi">POI with information</param>
 /// <param name="address">Reverse GPS info for this POI</param>
 private void callback(BTCleanPOI poi, ReverseAddress address)
 {
     // here is a good place to display extra info  to user
     poi.Address = address;
     // update BTPOIManager
     BTPOIManager.Instance.AppendPOIAddress(poi);
     if (AgentInformation != null) // if event is used
     {
         AgentInformation(poi);    // raise an event to inform UI about agent actions
     }
 }
Exemple #2
0
    public void AppendPOIAddress(BTCleanPOI poi)
    {
        ReverseAddress address = poi.Address;
        BTCleanPOI     found   = mcleanlist.Where(x => x.ID == poi.ID).FirstOrDefault();

        if (found == null)
        {
            mcleanlist.Add(poi);
            found = poi;
        }
        else
        {
            found.Address = address;
            found.Score   = poi.Score;
        }
    }
Exemple #3
0
    public static ReverseAddress GetAddressFromPOI(POIAddress po)
    {
        ReverseAddress ad = new ReverseAddress();

        ad.city           = po.city;
        ad.country        = po.country;
        ad.country_code   = po.country_code;
        ad.county         = po.county;
        ad.house_number   = po.house_number;
        ad.postcode       = po.postcode;
        ad.road           = po.road;
        ad.state          = po.state;
        ad.state_district = po.state_district;
        ad.suburb         = po.suburb;
        ad.town           = po.town;
        ad.village        = po.village;
        return(ad);
    }
Exemple #4
0
    public static POIAddress GetPOIFromAddress(ReverseAddress ad, BTCleanPOI poi)
    {
        POIAddress po = new POIAddress();

        po.ID             = poi.ID;
        po.city           = ad.city;
        po.country        = ad.country;
        po.country_code   = ad.country_code;
        po.county         = ad.county;
        po.house_number   = ad.house_number;
        po.postcode       = ad.postcode;
        po.road           = ad.road;
        po.state          = ad.state;
        po.state_district = ad.state_district;
        po.suburb         = ad.suburb;
        po.town           = ad.town;
        po.village        = ad.village;
        return(po);
    }
Exemple #5
0
    public void ProcessReverseCleanPoint(BTCleanPOI poi, OnSuccessAddressCleanPOI callback)
    {
        // if  has address already no need to call endpoint
        if (poi.Address != null)
        {
            callback(poi, poi.Address);
            return;
        }
        if (SaveReveseAddressToDatabase)
        {
            // check if exists in local database
            POIAddress ad = db.GetPoiAddressByID(poi.ID);
            if (ad != null) // if record is found, avoid to call open map service
            {
                ReverseAddress rev = POIAddress.GetAddressFromPOI(ad);
                callback(poi, rev);
                return;
            }
        }

        StartCoroutine(GetReverseCleanPOI(poi, callback));
    }