Пример #1
0
        private void DrawSingleConstellation(RenderContext11 renderContext, Lineset ls, float opacity, bool reverse, bool drawAllSky)
        {
            if (!constellationVertexBuffers.ContainsKey(ls.Name))
            {
                int count = ls.Points.Count;

                SimpleLineList11 linelist = new SimpleLineList11();
                linelist.DepthBuffered = false;
                constellationVertexBuffers[ls.Name] = linelist;

                Vector3d currentPoint = new Vector3d();
                Vector3d temp;

                for (int i = 0; i < count; i++)
                {
                    if (ls.Points[i].PointType == PointType.Move || i == 0)
                    {
                        currentPoint = RaDecTo3d(ls.Points[i].Dec, ls.Points[i].RA);
                    }
                    else
                    {
                        temp = RaDecTo3d(ls.Points[i].Dec, ls.Points[i].RA);
                        linelist.AddLine(currentPoint, temp);
                        currentPoint = temp;
                    }
                }

                if (boundry)
                {
                    temp = RaDecTo3d(ls.Points[0].Dec, ls.Points[0].RA);
                    linelist.AddLine(currentPoint, temp);
                }
            }

            Color col;

            if (boundry)
            {
                if (constToDraw != ls.Name)
                {
                    col = Properties.Settings.Default.ConstellationBoundryColor;
                }
                else
                {
                    col = Properties.Settings.Default.ConstellationSelectionColor;
                }
            }
            else
            {
                col = Properties.Settings.Default.ConstellationFigureColor;
            }

            constellationVertexBuffers[ls.Name].DrawLines(renderContext, opacity, col);
        }
Пример #2
0
        private void renderWindow_MouseMove(object sender, MouseEventArgs e)
        {



            if (contrastMode)
            {
                contrast = (1 - (e.Y / (float)ClientSize.Height));
                brightness = e.X / (float)ClientSize.Width;
                return;
            }




            if (activeTouch != TouchControls.None)
            {
                if (activeTouch == TouchControls.TrackBall)
                {
                    moveVector = new PointF(touchTrackBallCenter.X - (e.X + Properties.Settings.Default.ScreenHitTestOffsetX), touchTrackBallCenter.Y - (e.Y + Properties.Settings.Default.ScreenHitTestOffsetY));
                }

                if (activeTouch == TouchControls.PanTrack)
                {
                    Vector2d panTrack = TouchToScreen(this.panTracker);


                    Vector2d mv = new Vector2d(panTrack.X - (e.X + Properties.Settings.Default.ScreenHitTestOffsetX), panTrack.Y - (e.Y + Properties.Settings.Default.ScreenHitTestOffsetY));

                    if (mv.Length > 50)
                    {
                        mv.Normalize();
                        mv.Scale(50);
                    }

                    moveVector = new PointF((float)mv.X, (float)mv.Y);


                }

                if (activeTouch == TouchControls.ZoomTrack)
                {
                    Vector2d zoomTrack = TouchToScreen(this.zoomTracker);
                    double zoomDrag = zoomTrack.X - (e.X + Properties.Settings.Default.ScreenHitTestOffsetX);
                    if (Math.Abs(zoomDrag) > 54)
                    {
                        ZoomVector = 54 * Math.Sign(zoomDrag);
                    }
                    else
                    {
                        ZoomVector = (float)zoomDrag;
                    }
                }

                if (activeTouch == TouchControls.OrbitTrack)
                {
                    Vector2d orbitTrack = TouchToScreen(this.orbitTracker);
                    double orbitDrag = orbitTrack.X - (e.X + Properties.Settings.Default.ScreenHitTestOffsetX);
                    if (Math.Abs(orbitDrag) > 70)
                    {
                        OrbitVector = 70 * Math.Sign(orbitDrag);
                    }
                    else
                    {
                        OrbitVector = (float)orbitDrag;
                    }
                }

                return;
            }


            if (uiController != null)
            {
                if (uiController.MouseMove(sender, new MouseEventArgs(e.Button, e.Clicks, e.X + Properties.Settings.Default.ScreenHitTestOffsetX, e.Y + Properties.Settings.Default.ScreenHitTestOffsetY, e.Delta)))
                {
                    return;
                }
            }

            moved = true;


            if (lastMousePosition == e.Location)
            {
                return;
            }
            else
            {
                mouseMoved = true;
                lastMouseMove = DateTime.Now;

                if (!CursorVisible && !ProjectorServer)
                {
                    Cursor.Show();
                    CursorVisible = true;
                }

            }

            if (measuringDrag)
            {
                measureEnd = GetCoordinatesForScreenPoint(e.X, e.Y);

                if (measureLines == null)
                {

                    measureLines = new SimpleLineList11();
                    measureLines.DepthBuffered = false;

                }
                measureLines.Clear();
                measureLines.AddLine(Coordinates.RADecTo3d(measureStart.RA + 12, measureStart.Dec, 1), Coordinates.RADecTo3d(measureEnd.RA + 12, measureEnd.Dec, 1));
                double angularSperation = CAAAngularSeparation.Separation(measureStart.RA, measureStart.Dec, measureEnd.RA, measureEnd.Dec);



                TourPlace pl = new TourPlace(Language.GetLocalizedText(977, "Seperation: ") + Coordinates.FormatDMS(angularSperation), measureEnd.Dec, measureEnd.RA, Classification.Star, Constellations.Containment.FindConstellationForPoint(measureEnd.RA, measureEnd.Dec), ImageSetType.Sky, -1);
                SetLabelText(pl, true);

            }
            else if (Space && Settings.Active.GalacticMode)
            {
                if (dragging)
                {
                    Tracking = false;

                    MoveView(-(e.X - this.mouseDownX), (e.Y - this.mouseDownY), true);
                    if (!Properties.Settings.Default.SmoothPan)
                    {
                        az = targetAz;
                        alt = targetAlt;
                        double[] gPoint = Coordinates.GalactictoJ2000(az, alt);
                        TargetLat = ViewLat = gPoint[1];
                        TargetLong = ViewLong = RAtoViewLng(gPoint[0] / 15);
                        NotifyMoveComplete();
                    }
                    this.mouseDownX = e.X;
                    this.mouseDownY = e.Y;
                }
                else if (spinning || angle)
                {

                    CameraRotateTarget = (CameraRotateTarget + (((double)(e.X - this.mouseDownX)) / 1000 * Math.PI));

                    CameraAngleTarget = (CameraAngleTarget + (((double)(e.Y - this.mouseDownY)) / 1000 * Math.PI));

                    if (CameraAngleTarget < TiltMin)
                    {
                        CameraAngleTarget = TiltMin;
                    }

                    if (CameraAngleTarget > 0)
                    {
                        CameraAngleTarget = 0;
                    }

                    if (!Properties.Settings.Default.SmoothPan)
                    {
                        CameraRotate = CameraRotateTarget;
                        CameraAngle = CameraAngleTarget;
                    }

                    this.mouseDownX = e.X;
                    this.mouseDownY = e.Y;
                }
                else
                {
                    mouseMoved = true;
                    lastMouseMove = DateTime.Now;
                }
            }
            else if (Space && Settings.Active.LocalHorizonMode)
            {
                if (dragging)
                {
                    if (!SolarSystemMode)
                    {
                        Tracking = false;
                    }

                    MoveView(-(e.X - this.mouseDownX), (e.Y - this.mouseDownY), true);
                    if (!Properties.Settings.Default.SmoothPan)
                    {
                        az = targetAz;
                        alt = targetAlt;
                        Coordinates currentRaDec = Coordinates.HorizonToEquitorial(Coordinates.FromLatLng(alt, az), SpaceTimeController.Location, SpaceTimeController.Now);

                        TargetLat = ViewLat = currentRaDec.Dec;
                        TargetLong = ViewLong = RAtoViewLng(currentRaDec.RA);
                        NotifyMoveComplete();
                    }
                    this.mouseDownX = e.X;
                    this.mouseDownY = e.Y;
                }
                else
                {
                    mouseMoved = true;
                    lastMouseMove = DateTime.Now;
                }
            }
            else
            {
                if (dragging)
                {
                    if (!SolarSystemMode)
                    {
                        Tracking = false;
                    }

                    MoveView(-(e.X - this.mouseDownX), (e.Y - this.mouseDownY), true);
                    if (!Properties.Settings.Default.SmoothPan)
                    {
                        ViewLat = TargetLat;
                        ViewLong = TargetLong;
                        NotifyMoveComplete();
                    }
                    this.mouseDownX = e.X;
                    this.mouseDownY = e.Y;
                }
                else if (spinning || angle)
                {

                    CameraRotateTarget = (CameraRotateTarget + (((double)(e.X - this.mouseDownX)) / 1000 * Math.PI));

                    CameraAngleTarget = (CameraAngleTarget + (((double)(e.Y - this.mouseDownY)) / 1000 * Math.PI));

                    if (CameraAngleTarget < TiltMin)
                    {
                        CameraAngleTarget = TiltMin;
                    }

                    if (CameraAngleTarget > 0)
                    {
                        CameraAngleTarget = 0;
                    }

                    if (!Properties.Settings.Default.SmoothPan)
                    {
                        CameraRotate = CameraRotateTarget;
                        CameraAngle = CameraAngleTarget;
                    }

                    this.mouseDownX = e.X;
                    this.mouseDownY = e.Y;
                }
                else
                {
                    mouseMoved = true;
                    lastMouseMove = DateTime.Now;

                }
            }

            lastMousePosition = e.Location;
        }
Пример #3
0
        private void DrawSingleConstellation(RenderContext11 renderContext, Lineset ls, float opacity, bool reverse, bool drawAllSky)
        {
            if (!constellationVertexBuffers.ContainsKey(ls.Name))
            {
                int count = ls.Points.Count;

                SimpleLineList11 linelist = new SimpleLineList11();
                linelist.DepthBuffered = false;
                constellationVertexBuffers[ls.Name] = linelist;

                Vector3d currentPoint = new Vector3d();
                Vector3d temp;

                for (int i = 0; i < count; i++)
                {

                    if (ls.Points[i].PointType == PointType.Move || i == 0)
                    {
                        currentPoint = RaDecTo3d(ls.Points[i].Dec, ls.Points[i].RA);
                    }
                    else
                    {
                        temp = RaDecTo3d(ls.Points[i].Dec, ls.Points[i].RA);
                        linelist.AddLine(currentPoint, temp);
                        currentPoint = temp;
                    }
                }

                if (boundry)
                {
                    temp = RaDecTo3d(ls.Points[0].Dec, ls.Points[0].RA);
                    linelist.AddLine(currentPoint, temp);
                }
             }

            Color col;
            if (boundry)
            {
                if (constToDraw != ls.Name)
                {
                    col = Properties.Settings.Default.ConstellationBoundryColor;
                }
                else
                {
                    col = Properties.Settings.Default.ConstellationSelectionColor;
                }
            }
            else
            {
                col = Properties.Settings.Default.ConstellationFigureColor;
            }

            constellationVertexBuffers[ls.Name].DrawLines(renderContext, opacity , col);
        }