Ejemplo n.º 1
0
        /// <summary>
        /// Get the information relating to a single new label. This will be
        /// called after the attribute schema, annotation template and polygon
        /// entity type has been defined. It gets re-called after each label has
        /// been positioned.
        /// </summary>
        /// <returns>True if info supplied. False if command is done.</returns>
        bool GetLabelInfo()
        {
            // Ensure the normal cursor is displayed
            SetNormalCursor();

            // Ask the base class to return the entity type for the labels.
            IEntity ent = base.Entity;

            // Get the polygon ID ...

            // If we are auto-numbering, just get the next ID. Otherwise
            // ask for it, showing the default.

            if (EditingController.Current.IsAutoNumber)
            {
                m_PolygonId.ReserveId(ent, 0);
            }
            else
            {
                GetIdForm dial = new GetIdForm(ent, m_PolygonId);
                if (dial.ShowDialog() != DialogResult.OK)
                {
                    DialFinish(null);
                    return(false);
                }
            }

            // Start by assuming the text is the key.
            string str = m_PolygonId.FormattedKey;

            // Get any attributes.
            if (m_Schema != null)
            {
                if (!GetAttributes(str) || m_LastRow == null)
                {
                    DialFinish(null);
                    return(false);
                }

                // If an annotation template has been specified, use that
                // to get the text from the row
                if (m_Template != null)
                {
                    str = RowTextGeometry.GetText(m_LastRow, m_Template);
                }
            }

            // Tell the base class.
            if (!SetDimensions(str))
            {
                DialFinish(null);
                return(false);
            }

            // Switch on the command cursor (we won't add anything until
            // the user left clicks inside a polygon).
            SetCommandCursor();
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates basic information for a new feature that will be created by this edit.
        /// </summary>
        /// <param name="e">The entity type for the feature</param>
        /// <returns>Information for the new feature</returns>
        IFeature CreateFeatureDescription(IEntity e)
        {
            FeatureId fid = null;
            IdHandle  h   = new IdHandle();

            if (h.ReserveId(e, 0))
            {
                fid = h.CreateId();
            }

            return(new FeatureStub(this, e, fid));
        }