Esempio n. 1
0
        private Placemark PlacemarkFromPicture(PictureMetaData pic)
        {
            if (pic.GpsLongitude == null || pic.GpsLatitude == null)
            {
                return(null);
            }

            Placemark p = new Placemark();

            p.Name        = pic.IptcObjectName;
            p.Description = pic.IptcCaption;
            p.Latitude    = (double)pic.GpsLatitude.GetValue(pic.GpsLatitudeRef == "S");
            p.Longitude   = (double)pic.GpsLongitude.GetValue(pic.GpsLongitudeRef == "W");
            p.Tilt        = Settings.Default.KmzTilt;
            p.Heading     = Settings.Default.KmzHeading;
            p.Range       = Settings.Default.KmzRange;

            ImageResize.Dimensions d;
            if (pic.Image.Height > pic.Image.Width)
            {
                d = ImageResize.Dimensions.Height;
            }
            else
            {
                d = ImageResize.Dimensions.Width;
            }

            Image i = ImageResize.ConstrainProportions(pic.Image, Settings.Default.KmzPictureSize, d);

            p.SetImage(new FileInfo(pic.Filename).Name, i);

            return(p);
        }