Пример #1
0
        /// <summary>
        /// Returns the full image data for a given image id.
        /// Returns additional information such as mission name, type, features, and region.
        /// </summary>
        /// <param name="imageDataID">Image ID</param>
        /// <returns>IEnumerable list of FullImageData</returns>
        public FullImageData GetFullImageData(int imageDataID)
        {
            //TODO: make this method more efficient

            ImageData     imageData     = GetImageByID(imageDataID);
            Dataset       dataSet       = Database.Dataset.Find(imageData.DatasetID);
            Imagexfeature imagexFeature = Database.Imagexfeature.Find(imageData.ImageDataID);
            Featuredesc   featureDesc   = Database.Featuredesc.Find(imagexFeature.FeaturedescID);
            Locationdesc  locationDesc  = Database.Locationdesc.Find(featureDesc.LocationID);

            return(new FullImageData(imageData)
            {
                Dataset = dataSet,
                Featuredesc = featureDesc,
                Locationdesc = locationDesc
            });
        }
        public override void ProcessRecord(string[] tokens)
        {
            currentCount++;

            string locationdesc = tokens[9];
            string featuredesc  = tokens[10];
            string lowresurl    = tokens[11];

            int locationId = _locationMap[locationdesc];

            featuredesc = locationId.ToString() + featuredesc;
            int featureId = _featureMap[featuredesc];

            int imageId = _imageMap[lowresurl];

            _imageMap.Remove(lowresurl);

            Imagexfeature imagexfeature = new Imagexfeature
            {
                ImageDataID   = imageId,
                FeaturedescID = featureId,
                Priority      = 0
            };

            _database.Imagexfeature.Add(imagexfeature);

            if (currentCount > commitCount)
            {
                _database.SaveChanges();

                _database.Dispose();
                _database = new MarbleDataBase();
                _database.Configuration.AutoDetectChangesEnabled = false;

                Console.WriteLine("{0} {1} {2}", imagexfeature.ImagexfeatureID, imagexfeature.ImageDataID, imagexfeature.FeaturedescID);

                currentCount = 0;
            }
        }