示例#1
0
        void ExportKey(TextFeature text)
        {
            Layer layer = m_Layers.GetLayer(text, m_ContinuousLineType, true);

            if (layer == null)
            {
                return;
            }

            // Get the label's key string. It HAS to be defined.
            string keystr = text.FormattedKey;

            if (String.IsNullOrEmpty(keystr))
            {
                return;
            }

            // Get the label's reference position.
            IPointGeometry refpos = text.GetPolPosition();

            // Define the position for AutoCad (bottom right corner).


            TextGeometry geom   = text.TextGeometry;
            Text         acText = new Text(geom.Text, GetVector(geom.Position), geom.Height);

            acText.Rotation = (float)geom.Rotation.Degrees;
            acText.Layer    = layer;

            m_Dxf.AddEntity(acText);
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextFeature"/> class, and records it
 /// as part of the map model.
 /// </summary>
 /// <param name="f">Basic information about the feature (not null).</param>
 /// <param name="geom">The metrics for the text (including the text itself).</param>
 /// <param name="isTopological">Is the new feature expected to act as a polygon label?</param>
 /// <param name="polPosition">The position of the polygon reference position (specify null
 /// if the feature is not a polygon label)</param>
 /// <exception cref="ArgumentNullException">If <paramref name="f"/> is null.</exception>
 protected TextFeature(IFeature f, TextGeometry geom, bool isTopological, PointGeometry polPosition)
     : base(f)
 {
     m_Geom = geom;
     SetTopology(isTopological);
     m_PolygonPosition = polPosition;
 }
示例#3
0
        bool WriteText(ISpatialObject item)
        {
            TextFeature text = (item as TextFeature);

            if (this.IsTopological)
            {
                ExportKey(text);
            }
            else
            {
            }

            // Skip if the AutoCad layer cannot be determined
            Layer layer = m_Layers.GetLayer(text, m_ContinuousLineType, this.IsTopological);

            if (layer != null)
            {
                TextGeometry geom   = text.TextGeometry;
                Text         acText = new Text(geom.Text, GetVector(geom.Position), geom.Height);
                acText.Rotation = (float)geom.Rotation.Degrees;
                acText.Layer    = layer;

                m_Dxf.AddEntity(acText);
            }
            return(true);
        }
示例#4
0
 /// <summary>
 /// Copy constructor (for use by the <see cref="RowTextContent"/> class)
 /// </summary>
 /// <param name="copy">The geometry to copy</param>
 protected TextGeometry(TextGeometry copy)
 {
     m_Font     = copy.m_Font;
     m_Position = copy.m_Position;
     m_Height   = copy.m_Height;
     m_Width    = copy.m_Width;
     m_Rotation = copy.m_Rotation;
 }
示例#5
0
 /// <summary>
 /// Creates a new text feature
 /// </summary>
 /// <param name="creator">The operation creating the text</param>
 /// <param name="id">The internal ID of this feature within the
 /// project that created it.</param>
 /// <param name="ent">The entity type for the string.</param>
 /// <param name="text">The text geometry (including the text string itself)</param>
 /// </param>
 internal TextFeature(Operation creator, InternalIdValue id, IEntity ent, TextGeometry text)
     : base(creator, id, ent, null)
 {
     m_Geom      = text;
     m_Container = null;
 }
示例#6
0
        /// <summary>
        /// Reads data that was previously written using <see cref="WriteData"/>
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        /// <param name="isTopological">Are we dealing with a polygon label</param>
        /// <param name="polPos">The label reference point (usually applies onlt to polygon labels). Null if it's
        /// identical to the position recorded via the geometry object.</param>
        /// <param name="geom">The geometry for the text.</param>
        static void ReadData(EditDeserializer editDeserializer, out bool isTopological, out PointGeometry polPos, out TextGeometry geom)
        {
            isTopological = editDeserializer.ReadBool(DataField.Topological);

            if (editDeserializer.IsNextField(DataField.PolygonX))
            {
                polPos = editDeserializer.ReadPointGeometry(DataField.PolygonX, DataField.PolygonY);
            }
            else
            {
                polPos = null;
            }

            geom = editDeserializer.ReadPersistent <TextGeometry>(DataField.Type);
        }
示例#7
0
 /// <summary>
 /// Copy constructor (for use by the <see cref="RowTextContent"/> class)
 /// </summary>
 /// <param name="copy">The geometry to copy</param>
 protected TextGeometry(TextGeometry copy)
 {
     m_Font = copy.m_Font;
     m_Position = copy.m_Position;
     m_Height = copy.m_Height;
     m_Width = copy.m_Width;
     m_Rotation = copy.m_Rotation;
 }
示例#8
0
 /// <summary>
 /// Creates a new text feature
 /// </summary>
 /// <param name="creator">The operation creating the text</param>
 /// <param name="id">The internal ID of this feature within the
 /// project that created it.</param>
 /// <param name="ent">The entity type for the string.</param>
 /// <param name="text">The text geometry (including the text string itself)</param>
 /// </param>
 internal TextFeature(Operation creator, InternalIdValue id, IEntity ent, TextGeometry text)
     : base(creator, id, ent, null)
 {
     m_Geom = text;
     m_Container = null;
 }
示例#9
0
        /// <summary>
        /// Reads data that was previously written using <see cref="WriteData"/>
        /// </summary>
        /// <param name="editDeserializer">The mechanism for reading back content.</param>
        /// <param name="isTopological">Are we dealing with a polygon label</param>
        /// <param name="polPos">The label reference point (usually applies onlt to polygon labels). Null if it's
        /// identical to the position recorded via the geometry object.</param>
        /// <param name="geom">The geometry for the text.</param>
        static void ReadData(EditDeserializer editDeserializer, out bool isTopological, out PointGeometry polPos, out TextGeometry geom)
        {
            isTopological = editDeserializer.ReadBool(DataField.Topological);

            if (editDeserializer.IsNextField(DataField.PolygonX))
                polPos = editDeserializer.ReadPointGeometry(DataField.PolygonX, DataField.PolygonY);
            else
                polPos = null;

            geom = editDeserializer.ReadPersistent<TextGeometry>(DataField.Type);
        }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TextFeature"/> class, and records it
 /// as part of the map model.
 /// </summary>
 /// <param name="f">Basic information about the feature (not null).</param>
 /// <param name="geom">The metrics for the text (including the text itself).</param>
 /// <param name="isTopological">Is the new feature expected to act as a polygon label?</param>
 /// <param name="polPosition">The position of the polygon reference position (specify null
 /// if the feature is not a polygon label)</param>
 /// <exception cref="ArgumentNullException">If <paramref name="f"/> is null.</exception>
 protected TextFeature(IFeature f, TextGeometry geom, bool isTopological, PointGeometry polPosition)
     : base(f)
 {
     m_Geom = geom;
     SetTopology(isTopological);
     m_PolygonPosition = polPosition;
 }