예제 #1
0
        /// <summary>
        /// Reads the device information stored in the metafile stream.
        /// </summary>
        /// <returns>The device data.</returns>
        protected override ImagingDevice ReadDeviceInternal()
        {
            XElement sceneSourceElement = _document.Element("Dimap_Document").Element("Dataset_Sources").Element("Source_Information").Element("Scene_Source");

            // device information
            String mission       = sceneSourceElement.Element("MISSION").Value;
            Int32  missionNumber = Int32.Parse(sceneSourceElement.Element("MISSION_INDEX").Value);
            String instrument    = sceneSourceElement.Element("INSTRUMENT").Value;

            return(ImagingDevices.FromName(mission + missionNumber + " " + instrument).FirstOrDefault());
        }
예제 #2
0
        /// <summary>
        /// Computes the spectral imaging scene data of the geometry.
        /// </summary>
        /// <returns>The spectral imaging scene data of the geometry.</returns>
        protected override RasterImaging ComputeRasterImaging()
        {
            // DEPRECATED AEGIS SOLUTION
            // the imaging data may be contained within the tags
            if (_imageFileDirectories[_currentImageIndex].ContainsKey(57410) &&
                _imageFileDirectories[_currentImageIndex].ContainsKey(57411) &&
                _imageFileDirectories[_currentImageIndex].ContainsKey(57412) &&
                _imageFileDirectories[_currentImageIndex].ContainsKey(57413) &&
                _imageFileDirectories[_currentImageIndex].ContainsKey(57417) &&
                _imageFileDirectories[_currentImageIndex].ContainsKey(57418) &&
                _imageFileDirectories[_currentImageIndex].ContainsKey(57419))
            {
                ImagingDevice device = ImagingDevices.FromName(_imageFileDirectories[_currentImageIndex][57410][0].ToString()).FirstOrDefault();

                if (device == null)
                {
                    return(null);
                }

                DateTime      imagingTime    = DateTime.Parse(_imageFileDirectories[_currentImageIndex][57411][0].ToString(), CultureInfo.InvariantCulture.DateTimeFormat);
                GeoCoordinate deviceLocation = new GeoCoordinate(Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57412][0]), Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57412][1]), Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57412][2]));

                Double incidenceAngle = Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57413][0]);
                Double viewingAngle   = Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57413][1]);
                Double sunAzimuth     = Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57413][2]);
                Double sunElevation   = Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57413][3]);

                GeoCoordinate[] imageLocation;
                if (_imageFileDirectories[_currentImageIndex].ContainsKey(57420) && _imageFileDirectories[_currentImageIndex][57420].Length == 12)
                {
                    Double[] imageLocationValues = _imageFileDirectories[_currentImageIndex][57420].Select(value => Convert.ToDouble(value)).ToArray();
                    imageLocation = new GeoCoordinate[]
                    {
                        new GeoCoordinate(imageLocationValues[0], imageLocationValues[1], imageLocationValues[2]),
                        new GeoCoordinate(imageLocationValues[3], imageLocationValues[4], imageLocationValues[5]),
                        new GeoCoordinate(imageLocationValues[6], imageLocationValues[7], imageLocationValues[8]),
                        new GeoCoordinate(imageLocationValues[9], imageLocationValues[10], imageLocationValues[11])
                    };
                }
                else
                {
                    imageLocation = Enumerable.Repeat(GeoCoordinate.Undefined, 4).ToArray();
                }

                List <RasterImagingBand> bands = new List <RasterImagingBand>();

                for (Int32 bandIndex = 0; bandIndex < device.Bands.Count &&
                     bandIndex < _imageFileDirectories[_currentImageIndex][57417].Length &&
                     bandIndex < _imageFileDirectories[_currentImageIndex][57418].Length &&
                     bandIndex < _imageFileDirectories[_currentImageIndex][57419].Length; bandIndex++)
                {
                    bands.Add(new RasterImagingBand(device.Bands[bandIndex].Description,
                                                    Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57417][bandIndex]),
                                                    Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57418][bandIndex]),
                                                    Convert.ToDouble(_imageFileDirectories[_currentImageIndex][57419][bandIndex]),
                                                    device.Bands[bandIndex].SpectralDomain,
                                                    device.Bands[bandIndex].SpectralRange));
                }

                if (device != null)
                {
                    return(new RasterImaging(device, imagingTime, deviceLocation, imageLocation, incidenceAngle, viewingAngle, sunAzimuth, sunElevation, bands));
                }
            }

            // the imaging data may be contained in a metafile
            if (_metafileReader != null)
            {
                try
                {
                    return(_metafileReader.ReadImaging());
                }
                catch { }
            }

            return(null);
        }
        /// <summary>
        /// Reads the device information stored in the metafile stream.
        /// </summary>
        /// <returns>The device data.</returns>
        protected override ImagingDevice ReadDeviceInternal()
        {
            ReadContent();

            return(ImagingDevices.FromName(_metadata["SPACECRAFT_ID"].Replace("_", String.Empty) + " " + _metadata["SENSOR_ID"]).FirstOrDefault());
        }