void ps_GeoLocationSelected(double longitude, double latitude, FlickrPhoto photo) { MakeEarthVisible(); // convert relative to our object longitude = 180 + longitude; if (earthLocationVisual != null) { earthLocationVisual.SetPinFill(Brushes.White); ((Transform3DGroup)earthLocationVisual.Transform).Children.RemoveAt(0); } earthLocationVisual = _photoToPushpin[photo]; earthLocationVisual.SetPinFill(Brushes.Red); // if it had any children, clear the now Transform3DGroup transformGroup = new Transform3DGroup(); transformGroup.Children.Add(new ScaleTransform3D(1, 1, 1.1)); transformGroup.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), -latitude))); transformGroup.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), longitude))); earthLocationVisual.Transform = transformGroup; if (!earth.Children.Contains(earthLocationVisual)) { earth.Children.Add(earthLocationVisual); } QuaternionAnimation quatAnimLong = new QuaternionAnimation(new Quaternion(new Vector3D(0, 1, 0), -longitude), new Duration(TimeSpan.FromMilliseconds(500))); QuaternionAnimation quatAnimLat = new QuaternionAnimation(new Quaternion(new Vector3D(1, 0, 0), latitude), new Duration(TimeSpan.FromMilliseconds(500))); quatAnimLat.Completed += new EventHandler(quatAnimLat_Completed); _myQuaternionRotLong.BeginAnimation(QuaternionRotation3D.QuaternionProperty, quatAnimLong); _myQuaternionRotLat.BeginAnimation(QuaternionRotation3D.QuaternionProperty, quatAnimLat); }
public GeoLocationPushpin(FlickrPhoto photo, Point loc, PhotoStack3D stack, Window1 win1) { _photo = photo; _pstack = stack; _window = win1; _loc = loc; // set the geometry for the pushpin Geometry = _geometry; // we do this to make the push pin interactive _visualRep = new Rectangle(); _visualRep.Width = 10; _visualRep.Height = 10; _visualRep.Fill = Brushes.White; _visualRep.MouseLeftButtonDown += new MouseButtonEventHandler(MouseLeftButtonDown); Visual = _visualRep; }
void cv_GeoLocationHidden(FlickrPhoto photo, Point latLong) { earth.Children.Remove(_photoToPushpin[photo]); _photoToPushpin.Remove(photo); }
private void ps_BlogRequested(FlickrPhoto photo) { blogVisual3D = new InteractiveVisual3D(); MeshGeometry3D blogMesh = (MeshGeometry3D)Resources["PlaneMesh"]; UIElement blogMeshVisual = new BlogVisual(); blogVisual3D.Geometry = blogMesh; blogVisual3D.Visual = blogMeshVisual; Transform3DGroup transformGroup = new Transform3DGroup(); transformGroup.Children.Add(new ScaleTransform3D(0.17, 0.17, 0.17)); transformGroup.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), 15))); transformGroup.Children.Add(new TranslateTransform3D(-0.20, 0, -1)); blogVisual3D.Transform = transformGroup; MainViewport.Children.Add(blogVisual3D); }
/// <summary> /// Posts the given comments about the given photo. /// </summary> /// <param name="comments"></param> /// <param name="photo"></param> /// <param name="user"></param> /// <returns></returns> public static bool PostComments(string comments, FlickrPhoto photo, AuthorizedFlickrUser user) { FlickrMethod method = new FlickrMethod(ApiKey, "flickr.photos.comments.addComment", user.Token, SharedSecret); method.AddParameter("comment_text", comments); method.AddParameter("photo_id", photo.ID); XmlNode rspNode = null; return method.MakeRequest(out rspNode); }
void cv_GeoLocationAvailable(FlickrPhoto photo, Point latLong) { GeoLocationPushpin model = new GeoLocationPushpin(photo, latLong, ps, this); Transform3DGroup transformGroup = new Transform3DGroup(); transformGroup.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), -latLong.X))); transformGroup.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), latLong.Y + 180))); model.Transform = transformGroup; earth.Children.Add(model); _photoToPushpin[photo] = model; }
/// <summary> /// Gets the location of the given photo /// </summary> /// <param name="photo"></param> /// <returns></returns> public static string GetPhotoLocation(FlickrPhoto photo) { FlickrMethod method; if (photo.AuthToken != null) { method = new FlickrMethod(ApiKey, "flickr.photos.geo.getLocation", photo.AuthToken, SharedSecret); } else { method = new FlickrMethod(ApiKey, "flickr.photos.geo.getLocation"); } method.AddParameter("photo_id", photo.ID); XmlNode rspNode = null; if (method.MakeRequest(out rspNode)) { return rspNode.InnerXml; } return ""; }
/// <summary> /// Asynchrnousy posts comments about the given photo. /// </summary> /// <param name="comments"></param> /// <param name="photo"></param> /// <param name="user"></param> /// <param name="notificationDispatcher"></param> /// <param name="notificationEvent"></param> public static void AsynchPostComments(string comments, FlickrPhoto photo, AuthorizedFlickrUser user, Dispatcher notificationDispatcher, FlickrWorkCompleteDelegate notificationEvent) { AddToWorkQueue(delegate() { bool result = PostComments(comments, photo, user); if (notificationDispatcher != null && notificationEvent != null) { notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle, notificationEvent, result); } } ); }
/// <summary> /// Asynchronously gets the location for the given photo. /// </summary> /// <param name="photo"></param> /// <param name="notificationDispatcher"></param> /// <param name="notificationEvent"></param> public static void AsynchGetPhotoLocation(FlickrPhoto photo, Dispatcher notificationDispatcher, FlickrWorkCompleteDelegate notificationEvent) { AddToWorkQueue(delegate() { string location = GetPhotoLocation(photo); photo.Location = location; if (notificationDispatcher != null && notificationEvent != null) { notificationDispatcher.BeginInvoke(DispatcherPriority.SystemIdle, notificationEvent, location); } } ); }
/// <summary> /// Called once Flickr has the photo metadata available for us /// </summary> /// <param name="photo"></param> /// <param name="o"></param> private void PhotoReadyHandler(FlickrPhoto photo, CarouselInteractiveVisual3D visual3D) { if (photo != null && RequestStillValid(visual3D.Row, visual3D.Column, visual3D.Index)) { visual3D.Photo = photo; BitmapImage b = new BitmapImage(new Uri(photo.URL_Small)); _bitmapToGeometry[b] = visual3D; if (b.IsDownloading) { b.DownloadCompleted += new EventHandler(ImageLoadCompleted); } else { ImageLoadCompleted(b, null); } } }
public PhotoStackViewVisual3D(FlickrPhoto photo) { _photo = photo; }