This document is archived and information here might be outdated.  Recommended version.


Insert A Vertex On A SchematicInMemoryFeatureLink Snippet (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference

Insert A Vertex On A SchematicInMemoryFeatureLink Snippet

Insert a vertex on a SchematicInMemoryFeatureLink at a particular (X, Y) location. The vertex is inserted on the specified Position on the link.

[C#]
        /// <summary>
        /// Insert a vertex on a SchematicInMemoryFeatureLink at a particular (X, Y) location
        /// </summary>
        /// <param name="schemLink">The ISchematicInMemoryFeatureLink where the vertex is inserted</param>
        /// <param name="newXPos">The X position for the inserted vertex</param>
        /// <param name="newYPos">The Y position for the inserted vertex</param>
        /// <param name="Position">The position of the inserted vertex on the link</param>
        public void InsertOneVertexToLink(ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureLink schemLink, double newXPos, double newYPos, int Position)
        {
                // cast SchematicInMemoryFeatureLink into ISchematicInMemoryFeatureLinkGeometry
                ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureLinkGeometry myGeo=(ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureLinkGeometry)schemLink;
                if (myGeo != null)
                {
                        ESRI.ArcGIS.Geometry.IPoint myPoint=new ESRI.ArcGIS.Geometry.Point();
                        myPoint.PutCoords(newXPos, newYPos);

                myGeo.InsertVertex(Position, myPoint);
                }
        }
[Visual Basic .NET]
        ''' <summary>
        ''' Insert a vertex on a SchematicInMemoryFeatureLink at a particular (X, Y) location
        ''' </summary>
        ''' <param name="schemLink">The ISchematicInMemoryFeatureLink where the vertex is inserted</param>
        ''' <param name="NewXPos">The X position for the inserted vertex</param>
        ''' <param name="NewYPos">The Y position for the inserted vertex</param>
        ''' <param name="Position">The position of the inserted vertex on the link</param>
        Public Sub InsertOneVertexToLink(ByVal schemLink As ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureLink, ByVal NewXPos As Double, ByVal NewYPos As Double, ByVal Position As Integer)

                ' cast SchematicInMemoryFeatureLink into ISchematicInMemoryFeatureLinkGeometry
                Dim myGeo As ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureLinkGeometry=TryCast(schemLink, ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureLinkGeometry)
                If myGeo IsNot Nothing Then
                        Dim myPoint As ESRI.ArcGIS.Geometry.IPoint=New ESRI.ArcGIS.Geometry.Point()
                        myPoint.PutCoords(NewXPos, NewYPos)

                    myGeo.InsertVertex(Position, myPoint)
                End If
            End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Geometry
  • ESRI.ArcGIS.Schematic