Пример #1
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void DrawTelescope_calculateTelescopePositionsVars()
        {
            //Init position
            X0 = (int)(panelTele3D.Width / 2);
            Y0 = (int)(panelTele3D.Height / 2 * 1.2);

            //update fields
            DEC_grad = (float)ObsControl.ASCOMTelescope.curDeclination;
            RA       = (float)ObsControl.ASCOMTelescope.curRightAscension;

            HA = (float)(ObsControl.ASCOMTelescope.curSiderealTime - RA);
            if (HA < 0)
            {
                HA = HA + 24.0F;
            }
            if (HA > 24)
            {
                HA = HA - 24.0F;
            }


            //Determine physical side of peir and calculate Mechanical HA
            if (HA >= 0 && HA < 6)
            {
                if (ObsControl.ASCOMTelescope.curPierSideStatus == PierSide.pierEast)
                {
                    PoinitingSideEtoW      = true;
                    PoinitingPhysicalSideE = true;
                    HA_mech       = HA;
                    DEC_mech_grad = DEC_grad;
                }
                else if (ObsControl.ASCOMTelescope.curPierSideStatus == PierSide.pierWest)
                {
                    PoinitingSideEtoW      = false;
                    PoinitingPhysicalSideE = false;
                    HA_mech       = HA + 12.0f;
                    DEC_mech_grad = 180.0F - DEC_grad;
                }
            }
            else if (HA >= 6 && HA < 12)
            {
                if (ObsControl.ASCOMTelescope.curPierSideStatus == PierSide.pierEast)
                {
                    PoinitingSideEtoW      = true;
                    PoinitingPhysicalSideE = false;
                    HA_mech       = HA;
                    DEC_mech_grad = DEC_grad;
                }
                else if (ObsControl.ASCOMTelescope.curPierSideStatus == PierSide.pierWest)
                {
                    PoinitingSideEtoW      = false;
                    PoinitingPhysicalSideE = true;
                    HA_mech       = HA + 12.0f;
                    DEC_mech_grad = 180.0F - DEC_grad;
                }
            }
            else if (HA >= 12 && HA < 18)
            {
                if (ObsControl.ASCOMTelescope.curPierSideStatus == PierSide.pierEast)
                {
                    PoinitingSideEtoW      = true;
                    PoinitingPhysicalSideE = false;
                    HA_mech       = HA;
                    DEC_mech_grad = DEC_grad;
                }
                else if (ObsControl.ASCOMTelescope.curPierSideStatus == PierSide.pierWest)
                {
                    PoinitingSideEtoW      = false;
                    PoinitingPhysicalSideE = true;
                    HA_mech       = HA - 12.0f;
                    DEC_mech_grad = 180.0F - DEC_grad;
                }
            }
            else if (HA >= 18 && HA < 24)
            {
                if (ObsControl.ASCOMTelescope.curPierSideStatus == PierSide.pierEast)
                {
                    PoinitingSideEtoW      = true;
                    PoinitingPhysicalSideE = true;
                    HA_mech       = HA;
                    DEC_mech_grad = DEC_grad;
                }
                else if (ObsControl.ASCOMTelescope.curPierSideStatus == PierSide.pierWest)
                {
                    PoinitingSideEtoW      = false;
                    PoinitingPhysicalSideE = false;
                    HA_mech       = HA - 12.0f;
                    DEC_mech_grad = 180.0F - DEC_grad;
                }
            }


            HA_grad      = (float)(Math.Truncate(HA) * 15 + HA - Math.Truncate(HA));                //conver to degrees
            HA_mech_grad = (float)(Math.Truncate(HA_mech) * 15 + HA_mech - Math.Truncate(HA_mech)); //conver to degrees

            //DEC_mech_grad = DEC_grad;//for debug only

            txtTelescopeAz.Text  = ObsControl.ASCOMUtils.DegreesToDMS(ObsControl.ASCOMTelescope.curAzimuth);
            txtTelescopeAlt.Text = ObsControl.ASCOMUtils.DegreesToDMS(ObsControl.ASCOMTelescope.curAltitude);

            txtTelescopeRA.Text  = ObsControl.ASCOMUtils.HoursToHMS(RA);
            txtTelescopeDec.Text = ObsControl.ASCOMUtils.DegreesToDMS(DEC_grad);

            txtHA.Text     = ObsControl.ASCOMUtils.HoursToHMS(HA);
            txtHAmech.Text = ObsControl.ASCOMUtils.HoursToHMS(HA_mech);

            txtDEC_mech.Text = ObsControl.ASCOMUtils.DegreesToDMS(DEC_mech_grad);


            if (PoinitingSideEtoW)
            {
                txtPierSide.Text = "East, looking West";
            }
            else
            {
                txtPierSide.Text = "West, looking East";
            }

            if (PoinitingPhysicalSideE)
            {
                txtPierPhysSide.Text = "East, looking West";
            }
            else
            {
                txtPierPhysSide.Text = "West, looking East";
            }

            //Camera positon
            CameraPosition = new CPI.Plot3D.Point3D(X0, Y0, -1000);
            //Start postion
            StartDrawingPosition = new CPI.Plot3D.Point3D(X0, Y0, 0);
        }