Esempio n. 1
0
        /// <summary>
        /// draw the numbers (azimuth) in the HUD
        /// </summary>
        /// <param name="deviceFrame"></param>
        /// <param name="angle"></param>
        private void DrawAzimuths(tagRECT deviceFrame, float angle)
        {
            //need to draw the current azimuth
            m_dynamicSymbolProps.SetColor(esriDynamicSymbolType.esriDSymbolText, 0.0f, 0.8f, 0.0f, 1.0f); // Green
            //assign the item's glyph to the dynamic-symbol
            m_dynamicSymbolProps.set_DynamicGlyph(esriDynamicSymbolType.esriDSymbolText, m_textGlyph);

            //get the floor of the azimuth
            float azimuth = 180.0f - angle;

            if (azimuth > 360)
            {
                azimuth -= 360;
            }
            else if (azimuth < 0)
            {
                azimuth += 360;
            }

            float  floorAzi = (int)(azimuth / 10.0f) * 10.0f;
            double deltaAzi = (angle - (float)((int)(angle / 10.0f) * 10.0f)) * 6.0; //(the shift to the X axis)

            double xmin    = (double)deviceFrame.left;
            double xmax    = (double)deviceFrame.right;
            double ymin    = (double)deviceFrame.top;
            double xmiddle = (xmax + xmin) / 2.0;

            double x = xmiddle - 150.0 + deltaAzi;

            double dAzStartMiddle = (150.0 - 2.0 * deltaAzi) / 6.0;

            dAzStartMiddle = (int)(dAzStartMiddle / 60.0) * 60.0 + 10.0;
            int    azi   = (int)(floorAzi - dAzStartMiddle) - 5;
            double delta = 60.0;

            m_dynamicSymbolProps.set_Heading(esriDynamicSymbolType.esriDSymbolText, 0.0f);
            m_dynamicSymbolProps.set_RotationAlignment(esriDynamicSymbolType.esriDSymbolText, esriDynamicSymbolRotationAlignment.esriDSRAScreen);
            for (int i = 0; i < 5; i++)
            {
                m_point.PutCoords(x, ymin + 28.0);

                if (azi > 360)
                {
                    azi -= 360;
                }
                else if (azi < 0)
                {
                    azi += 360;
                }
                m_dynamicDrawScreen.DrawScreenText(m_point, azi.ToString());

                azi += 10;
                x   += delta;
            }

            //need to draw the current azimuth
            m_dynamicSymbolProps.SetColor(esriDynamicSymbolType.esriDSymbolText, 0.0f, 0.0f, 0.0f, 1.0f); // Black
            m_point.PutCoords(xmiddle, ymin + 95.0);
            m_dynamicDrawScreen.DrawScreenText(m_point, azimuth.ToString("###"));
        }