Beispiel #1
0
        public Window1()
        {
            InitializeComponent();

            Flickr.Initialize();

            cv = new PhotoCarouselView();
            ps = new PhotoStack3D();

            Transform3DGroup cvTG = new Transform3DGroup();
            cvTG.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 5)));
            cvTG.Children.Add(new TranslateTransform3D(0, 0, -1));
            cv.Transform = cvTG;

            Transform3DGroup tg = new Transform3DGroup();
            tg.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), -13)));
            tg.Children.Add(new TranslateTransform3D(0, ps.Height / 2, -1.2));
            ps.Transform = tg;

            MainViewport.Children.Add(cv);
            MainViewport.Children.Add(ps);

            cv.ItemClickedOn += new PhotoBrowser.CarouselView.CarouselView.ItemClickedOnEvent(cv_ItemClickedOn);
            cv.GeoLocationAvailable += new PhotoCarouselView.GeoEventHandler(cv_GeoLocationAvailable);
            cv.GeoLocationHidden += new PhotoCarouselView.GeoEventHandler(cv_GeoLocationHidden);

            ps.GeoLocationSelected += new PhotoStack3D.GeoLocationSelectedDelegate(ps_GeoLocationSelected);
            ps.SelectionChanged += new PhotoBrowser.Stack3D.Stack3D.StackSelectionChangedEvent(ps_SelectionChanged);
            ps.BlogRequested += new PhotoStack3D.BlogRequestedDelegate(ps_BlogRequested);

            // create the globe we'll use
            earth = new InteractiveSphere();
            mapVisual = new MapVisual();
            mapVisual.searchMenuItem.Click += new RoutedEventHandler(searchMenuItem_Click);
            earth.Visual = mapVisual;

            // create the transformation applied to the globe
            earthTransform = new Transform3DGroup();
            Point3D earthPos = new Point3D(-0.2, 0.05, -1.1);
            Vector3D earthToCam = new Vector3D(0 - earthPos.X,
                                               0 - earthPos.Y,
                                               0 - earthPos.Z);
            earthToCam.Normalize();

            earthTransform.Children.Add(new ScaleTransform3D(0.0, 0.0, 0.0));
            _myQuaternionRotLong = new QuaternionRotation3D(new Quaternion(new Vector3D(0, 1, 0), 0));
            _myQuaternionRotLat = new QuaternionRotation3D(new Quaternion(new Vector3D(1, 0, 0), 0));

            earthTransform.Children.Add(new RotateTransform3D(_myQuaternionRotLong));
            earthTransform.Children.Add(new RotateTransform3D(_myQuaternionRotLat));
            earthTransform.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0),
                                        Math.Acos(Vector3D.DotProduct(new Vector3D(0, 0, 1), earthToCam)) / Math.PI * 180)));

            earthTransform.Children.Add(new TranslateTransform3D((Vector3D)earthPos));
            earth.Transform = earthTransform;

            // add in the earth
            HookUpEarthEvents();
        }
Beispiel #2
0
 public CarouselInteractiveVisual3D(PhotoCarouselView containingPLV, int row, int col, int index)
 {
     Row = row;
     Column = col;
     Index = index;
     ContainingPLV = containingPLV;
 }