示例#1
0
    public static string FormatDate(ObjectData mmo)
    {
        DateTime dt = DateTime.MaxValue;

        try
        {
            var datetime = MetadataUtils.GetDateTime(mmo.Metadata);
            dt = DateTime.Parse(datetime);
        } catch (ArgumentNullException ex) {
            // Silently ignoring
        } catch (FormatException e) {
            // silently ignoring
        }

        return(dt != DateTime.MaxValue ? dt.ToString("dd. MMM yyyy") : "");
    }
        public void Setup(List <ObjectData> mmos, ObjectData active)
        {
            logger.Debug("Setup");
            setupFinished = false;
            dict.Clear();

            foreach (ObjectData mmo in mmos)
            {
                string   datetime = MetadataUtils.GetDateTime(mmo.Metadata);
                DateTime dt       = DateTime.Parse(datetime); // mmo.dateitme is null, TODO investigate
                int      key      = dt.Year * 10;             // times ten to have multiple entries per year (10)
                while (dict.ContainsKey(key))
                {
                    logger.Debug("Key {0} already used. decrease key by one", key, key - 1);
                    key--;
                }
                dict.Add(key, mmo);
                logger.Debug("Added {0}/{1} to dict (origin year: {2})", key, mmo.Id, dt.Year);
            }
            List <int> keys = new List <int>(dict.Keys);

            keys.Sort((i, j) => i - j); // basic integer sorting
            int min = keys[0];
            int max = keys[keys.Count - 1];

            logger.Debug("Range: {0} to {1}", min, max);
            lowerLabel.text     = "" + min / 10; //dont disp on label
            upperLabel.text     = "" + max / 10; //dont disp on label
            slider.minValue     = 0;
            slider.maxValue     = 1;
            slider.wholeNumbers = false;
            string   _datetime = MetadataUtils.GetDateTime(active.Metadata);
            DateTime adt       = DateTime.Parse(_datetime);

            slider.value = keys.IndexOf(adt.Year * 10);
            logger.Debug("Slider should:({0},{1},{2})", min, adt.Year * 10, max);
            logger.Debug("Slider is:({0},{1},{2})", slider.minValue, slider.value, slider.maxValue);
            logger.Debug("Setup finished!");
            setupFinished = true;
        }
示例#3
0
    public void parseToPictureData(List <ObjectData> list, List <POICoordinatesObject> poilist)
    {
        List <ObjectData> newList = list;

        if (poilist.Count != 0)
        {
            newList = FilterToDistance(list, poilist);
        }

        pictureDataList = new List <PictureData>();

        int    id = 0;
        string url;
        string time;
        double lat = 0;
        double lon = 0;
        float  hea;

        foreach (var VARIABLE in newList)
        {
            url  = CineastWrapper.GetMediaUrlOf(VARIABLE);
            time = MetadataUtils.GetDateTime(VARIABLE.Metadata);
            lat  = MetadataUtils.GetLatitude(VARIABLE.Metadata);
            lon  = MetadataUtils.GetLongitude(VARIABLE.Metadata);
            hea  = Convert.ToSingle(MetadataUtils.GetBearing(VARIABLE.Metadata));
            hea  = 0;

            Debug.Log("GET URLS " + url);

            Debug.Log("THESE ARE TIME: " + time);

            if (url == "http://10.34.58.145/objects/Ans_05459-007-AL-FL.jpg")
            {
                hea = 160;
            }
            if (url == "http://10.34.58.145/objects/barfuesserplatz-parkplatz-lohnhof.png")
            {
                hea = 90;
            }
            if (url == "http://10.34.58.145/objects/barfuesserplatz-kohlenberg.png")
            {
                hea = 90;
            }
            if (url == "http://10.34.58.145/objects/Fel_008898-RE.jpg.png")
            {
                hea = 90;
            }
            if (url == "http://10.34.58.145/objects/Com_M06-0079-0004.jpg")
            {
                hea = 270;
            }
            if (url == "http://10.34.58.145/objects/barfuesserplatz-lohnhof-schnee.png")
            {
                hea = 90;
            }
            if (url == "http://10.34.58.145/objects/Ans_05395-02-001.jpg")
            {
                hea = 270;
            }
            if (url == "http://10.34.58.145/objects/Ans_05395-01-016.jpg")
            {
                hea = 0;
            }
            if (url == "http://10.34.58.145/objects/Barfuesserirche_ganz.jpg")
            {
                hea = 180;
            }
            if (url == "http://10.34.58.145/objects/Dia_287-01946.jpg")
            {
                hea = 300;
            }
            if (url == "http://10.34.58.145/objects/Ans_05395-01-003.jpg")
            {
                hea = 0;
            }
            if (url == "http://10.34.58.145/objects/Basel_2012-08_Mattes_1_(206).JPG")
            {
                hea = 90;
            }
            if (url == "http://10.34.58.145/objects/Ans_02112.jpg")
            {
                hea = 240;
            }
            if (url == "http://10.34.58.145/objects/Com_M06-0079-0002.jpg")
            {
                hea = 290;
            }
            if (url == "http://10.34.58.145/objects/Ans_05395-01-001.jpg")
            {
                hea = 200;
            }

            //Temporary fix

            if (time != "" && activate_temp)
            {
                DateTime dateTime = DateTime.Parse(MetadataUtils.GetDateTime(VARIABLE.Metadata));

                if (lowerbound < dateTime && dateTime < upperbound)
                {
                    Debug.Log("TIME DEBUG: " + MetadataUtils.GetDateTime(VARIABLE.Metadata) + " CURRENT: LOWER " + lowerbound + " UP " + upperbound);
                    pictureDataList.Add(new PictureData(id, url, lat, lon, hea, time));
                    FetchedList.Add(new PictureData(id, url, lat, lon, hea, time));
                }

                else
                {
                    continue;
                }
            }

            else
            {
                pictureDataList.Add(new PictureData(id, url, lat, lon, hea, time));
                FetchedList.Add(new PictureData(id, url, lat, lon, hea, time));
            }

            id++;
            backupkeys.Add(id);
            Debug.Log("No fetchedlid " + FetchedList.Count);
        }
    }