Esempio n. 1
0
        /// <summary>
        /// Defines the dimensions of the text that's being added. For this to
        /// work, the <see cref="Entity"/> property must be defined beforehand.
        /// </summary>
        /// <param name="str">The text involved</param>
        /// <returns>True if dimensions set ok. False if the entity type
        /// was not defined, or it does not have an associated font.</returns>
        protected bool SetDimensions(string str)
        {
            // Confirm the entity type has been defined
            if (m_Entity == null)
            {
                MessageBox.Show("AddLabelUI.SetDimensions - Text type not specified.");
                DialFinish(null);
                return(false);
            }

            // Remember the text that the dimensions correspond to
            m_Text = str;

            // The entity type provides the height of the text (in point units)
            IFont fontInfo = m_Entity.Font;

            if (fontInfo == null)
            {
                fontInfo = FontInfo.Default;
            }

            // Figure out the ground height at the map's nominal scale
            float  fontSize     = fontInfo.PointSize;
            uint   nominalScale = EditingController.Current.Project.Settings.NominalMapScale;
            double ht           = (double)fontSize * (double)nominalScale * MathConstants.POINTSIZE_TO_METERS;

            // Convert into pixels on the active display
            float htPixels = ActiveDisplay.LengthToDisplay(ht);
            Font  font     = new Font(fontInfo.TypeFace, htPixels, fontInfo.Modifiers, GraphicsUnit.Pixel);

            // Get the size of the text
            Size proposedSize = new Size(int.MaxValue, int.MaxValue);
            Size size         = TextRenderer.MeasureText(str, font, proposedSize,
                                                         (TextFormatFlags.NoPadding | TextFormatFlags.NoClipping | TextFormatFlags.NoPrefix));

            // Remember the width and height of the text, in ground units (if
            // we stored logical units, the meaning of the values might change
            // if the scale changed during label positioning).
            ISpatialDisplay display = ActiveDisplay;

            m_Width  = display.DisplayToLength((float)size.Width);
            m_Height = display.DisplayToLength((float)size.Height);

            // Reset the position of the last text outline that was drawn.
            m_LastPos = null;
            return(true);
        }
Esempio n. 2
0
 /// <summary>
 /// The size of icons used during check reviews, in meters on the ground.
 /// </summary>
 /// <param name="display">The display where the icons will be drawn</param>
 /// <returns>The size (height and width) of icons used as check markers</returns>
 protected double IconSize(ISpatialDisplay display)
 {
     return(display.DisplayToLength(32.0F));
 }
Esempio n. 3
0
 /// <summary>
 /// The size of icons used during check reviews, in meters on the ground.
 /// </summary>
 /// <param name="display">The display where the icons will be drawn</param>
 /// <returns>The size (height and width) of icons used as check markers</returns>
 protected double IconSize(ISpatialDisplay display)
 {
     return display.DisplayToLength(32.0F);
 }