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); }
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; }