public bool MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (Earth3d.MainWindow.StudyImageset == null)
            {
                return false;
            }
            if (dragging)
            {
                Tile root = TileCache.GetTile(0, 0, 0, Earth3d.MainWindow.StudyImageset, null);
                root.CleanUpGeometryRecursive();

                bool twoRoots = false;

                if (Earth3d.MainWindow.StudyImageset.Projection == ProjectionType.Tangent && Earth3d.MainWindow.StudyImageset.WidthFactor == 1)
                {
                    twoRoots = true;
                }

                if (anchored)
                {
                    if (root is SkyImageTile)
                    {
                        SkyImageTile tile = (SkyImageTile)root;
                        Coordinates point2 = Earth3d.MainWindow.GetCoordinatesForScreenPoint(e.X, e.Y);

                        WcsFitter fitter = new WcsFitter(tile.Width, tile.Height);
                        fitter.AddPoint(anchoredPoint1, anchorPoint1);
                        fitter.AddPoint(point2, anchorPoint2);
                        fitter.Solve();
                        Earth3d.MainWindow.StudyImageset.BaseTileDegrees = fitter.Solution.Scale;
                        Earth3d.MainWindow.StudyImageset.Rotation = (fitter.Solution.Rotation);
                        Earth3d.MainWindow.StudyImageset.CenterX = (fitter.Solution.CenterX*15);
                        Earth3d.MainWindow.StudyImageset.CenterY = fitter.Solution.CenterY;
                        Earth3d.MainWindow.StudyImageset.OffsetX = fitter.Solution.OffsetX;
                        Earth3d.MainWindow.StudyImageset.OffsetY = fitter.Solution.OfsetY;

                    }
                    else
                    {
                        Coordinates downPoint = Earth3d.MainWindow.GetCoordinatesForScreenPoint(e.X, e.Y);
                        double len = anchoredPoint1.Distance(downPoint);
                        double angle = anchoredPoint1.Angle(downPoint) / RC;
                        Earth3d.MainWindow.Text = String.Format("Angle = {0}", angle);
                        Earth3d.MainWindow.StudyImageset.BaseTileDegrees = startScale * (len / startLength);
                        Earth3d.MainWindow.StudyImageset.Rotation = startRotation - (angle - startAngle);

                    }
                }
                else
                {
                    double factor = 1.0;
                    if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt)
                    {
                        factor = .01;
                    }

                    if ((Control.ModifierKeys & Keys.Control )== Keys.Control)
                    {
                        double rotation = (pntDown.X - e.Location.X) / 50.0;
                        rotation *= factor;
                        Earth3d.MainWindow.StudyImageset.Rotation += rotation;
                        Earth3d.MainWindow.StudyImageset.Rotation = Earth3d.MainWindow.StudyImageset.Rotation % 360;
                    }
                    else if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        double scale = 1.0 + (((pntDown.X - e.Location.X) / 500.0)*factor);
                        Earth3d.MainWindow.StudyImageset.BaseTileDegrees *= scale;
                        if (Earth3d.MainWindow.StudyImageset.BaseTileDegrees > 180)
                        {
                            Earth3d.MainWindow.StudyImageset.BaseTileDegrees = 180;
                        }
                    }
                    else
                    {
                        double moveX = (pntDown.X - e.Location.X) * Earth3d.MainWindow.GetPixelScaleX(true);
                        double moveY = (pntDown.Y - e.Location.Y) * Earth3d.MainWindow.GetPixelScaleY();
                        Earth3d.MainWindow.StudyImageset.CenterX += moveX;
                        Earth3d.MainWindow.StudyImageset.CenterY += moveY;

                    }
                    pntDown = e.Location;
                }

                if (twoRoots)
                {
                    Tile root2 = TileCache.GetTile(0, 1, 0, Earth3d.MainWindow.StudyImageset, null);
                    root2.CleanUpGeometryRecursive();
                }

            }
            return false;
        }
Example #2
0
 //MSScriptControl.ScriptControlClass script = null;
 private static void UnitTestWCS()
 {
     WcsFitter fitter = new WcsFitter(686, 1024);
     fitter.AddPoint(Coordinates.FromRaDec(5.533958, -0.30028), new Vector2d(400, 254));
     fitter.AddPoint(Coordinates.FromRaDec(5.59, -5.89722), new Vector2d(258, 836));
     fitter.Solve();
 }