IGeometryBridge Interface

Provides access to a set of generic methods that can be used in all languages supported.

Description

The IGeometryBridge methods can be used with any supported development languages: Java, C#, VB.Net, VB 6.0, C++, etc... The methods on the regular interfaces (IGeometryCollection, ISegmentCollection, IPointCollection, etc) are using C style arrays, which are not supported by some languages; the IGeometryBridge interface is there to solve that problem allowing to pass safe arrays instead.

Members

Name Description
Method AddGeometries Adds references to the specified geometries.
Method AddPoints Adds copies of the input points as vertices to this Path, Ring, Polyline, or Polygon; or references to the input points to this Multipoint, Triangles, TriangleFan, or TriangleStrip.
Method AddSegments Adds references to segments.
Method AddWKSPointZs Adds vertices/points to this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch.
Method ConstructBuffers Constructs a set of buffers at various distances. More efficient than calling Buffer repeatedly on the same geometry.
Method Densify Densify segment into the specified number of smaller segments.
Method GetPoints Populates an array with references to points in the Multipoint. The QueryPoints method on IPointCollection makes copies of the points.
Method InsertGeometries Inserts at the specified index references to some number of geometries in the input array.
Method InsertPoints Inserts copies of the input points as vertices into a Path, Ring, Polyline, or Polygon; or references to the input points into a Multipoint, Triangles, TriangleFan, or TriangleStrip.
Method InsertSegments Inserts references to the input segments.
Method InsertWKSPointZs Inserts new vertices/points into this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch.
Method QueryBeginningRings Populates an array with references to all beginning rings of the specified types.
Method QueryFollowingRings Populates an array with references to following rings that are in the ring group that starts with the specified beginning ring.
Method QueryGeometries Populates the array with references to a sub-sequence of geometries.
Method QueryPoints Copies some points to an existing array of points.
Method QuerySegments Returns references to some of the input segments.
Method QueryWKSPointZs Copies vertices/points coordinates to the array of point structures.
Method ReplacePoints Replaces vertices/points within a PointCollection.
Method ReplaceSegments Removes and inserts from segments.
Method SetGeometries Replaces all geometries in the collection with the specified number of references to those in the input array.
Method SetPoints Replaces all existing vertices of this Path, Ring, Polyline, or Polygon with copies of the input points; or all existing points of this Multipoint, Triangles, TriangleFan, or TriangleStrip with references to the input points.
Method SetSegments Replaces all segments with references to the input segments.
Method SetWKSPointZs Replaces all vertices/points of this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch with new ones.

IGeometryBridge.AddGeometries Method

Adds references to the specified geometries.

Public Sub AddGeometries ( _
    ByVal pGeometryCollection As IGeometryCollection, _
    ByRef newGeometries As IGeometry[] _
)
public void AddGeometries (
    IGeometryCollection pGeometryCollection,
    ref IGeometry[] newGeometries
);

Description

All development languages compatible version of IGeometryCollection::AddGeometries .

public void AddGeometries()

    {

        IPoint point1 = new PointClass();

        point1.PutCoords(10, 10);

        IPoint point2 = new PointClass();

        point2.PutCoords(20, 20);

        IGeometry[] geometryArray = new IGeometry[2];

        geometryArray[0] = point1 as IGeometry;

        geometryArray[1] = point2 as IGeometry;

        //add geometries

        IGeometryCollection geometryCollection = new MultipointClass();

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddGeometries(geometryCollection, ref geometryArray);

    }

IGeometryBridge.AddPoints Method

Adds copies of the input points as vertices to this Path, Ring, Polyline, or Polygon; or references to the input points to this Multipoint, Triangles, TriangleFan, or TriangleStrip.

Public Sub AddPoints ( _
    ByVal pPointCollection As IPointCollection4, _
    ByRef newPoints As IPoint[] _
)
public void AddPoints (
    IPointCollection4 pPointCollection,
    ref IPoint[] newPoints
);

Description

All development languages compatible version of IPointCollection::AddPoints .

public void AddPoints()

    {

        IPoint point1 = new PointClass();

        point1.PutCoords(10, 10);

        IPoint point2 = new PointClass();

        point2.PutCoords(20, 20);

        IPoint[] pointArray = new IPoint[2];

        pointArray[0] = point1;

        pointArray[1] = point2;

        IPointCollection4 pointCollection = new PolylineClass();

        //add points to pointCollection

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddPoints(pointCollection, ref pointArray);

        System.Windows.Forms.MessageBox.Show(pointCollection.PointCount + " points added to PointCollection");

    }

IGeometryBridge.AddSegments Method

Adds references to segments.

Public Sub AddSegments ( _
    ByVal pSegmentCollection As ISegmentCollection, _
    ByRef newSegments As ISegment[] _
)
public void AddSegments (
    ISegmentCollection pSegmentCollection,
    ref ISegment[] newSegments
);

Description

All development languages compatible version of ISegmentCollection::AddSegments .

IGeometryBridge.AddWKSPointZs Method

Adds vertices/points to this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch.

Public Sub AddWKSPointZs ( _
    ByVal pPointCollection As IPointCollection4, _
    ByRef pointStructures As WKSPointZ[] _
)
public void AddWKSPointZs (
    IPointCollection4 pPointCollection,
    ref WKSPointZ[] pointStructures
);

Description

All development languages compatible version of IPointCollection4::AddWKSPointsZs .

public void AddWKSPointZs()

    {

        int length = 10;

        WKSPointZ[] pointArray = new WKSPointZ[length];

        for (int i = 0; i < length; i++)

        {

            pointArray[i] = new WKSPointZ();

            pointArray[i].X = i * 10;

            pointArray[i].Y = i * 10;

            pointArray[i].Z = i * 10;

        }

        IPointCollection4 pointCollection = new MultipointClass();

        // Make pointcollection ZAware

        IZAware zAware = (IZAware)pointCollection;

        zAware.ZAware = true;

        //adds WKSpointZs to pointCollection 

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddWKSPointZs(pointCollection, ref pointArray);

        System.Windows.Forms.MessageBox.Show(pointCollection.PointCount + " Points added");

    }

IGeometryBridge.ConstructBuffers Method

Constructs a set of buffers at various distances. More efficient than calling Buffer repeatedly on the same geometry.

Public Function ConstructBuffers ( _
    ByVal pTopologicalOperator As ITopologicalOperator2, _
    ByRef distances As Double[]& _
) As IEnumGeometry
public IEnumGeometry ConstructBuffers (
    ITopologicalOperator2 pTopologicalOperator,
    ref Double[]& distances
);

Description

All development languages compatible version of ITopologicalOperator2::ConstructBuffers .

IGeometryBridge.Densify Method

Densify segment into the specified number of smaller segments.

Public Sub Densify ( _
    ByVal pSegment As ISegment, _
    ByVal maxDeviation As Double, _
    ByRef pcOutSegments As Integer, _
    ByRef segments As ILine[] _
)
public void Densify (
    ISegment pSegment,
    double maxDeviation,
    ref int pcOutSegments,
    ref ILine[] segments
);

Description

All development languages compatible version of ISegment::Densify .

//This method demonstrates how to use the ISegment.Densify method

    private void Densify()

    {

        //Create a new closed Circular Arc segment

        IPoint center = new PointClass();

        center.PutCoords(0, 0);

        IPoint fromToPoint = new PointClass();

        fromToPoint.PutCoords(10, 10);

        ICircularArc circularArc = new CircularArcClass();

        circularArc.PutCoords(center, fromToPoint, fromToPoint, esriArcOrientation.esriArcClockwise);

        ISegment segment = circularArc as ISegment;

        //Call densify

        //maxDeviation: 0.1, tells the method that the segment must not further

        //                    a part from that distance from the curve

        //outSegments: output parameter returning the the number of segments created

        //outSegmentsArray: array will contain the output segments. 

        //The array size is the max number of parts

        ILine[] outSegmentsArray = new ILine[7];

        double maxDeviation = 0.1;

        int outSegments = 0;

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.Densify(segment, maxDeviation, ref outSegments, ref outSegmentsArray);

        System.Windows.Forms.MessageBox.Show("The segment array contains : " + outSegments + " segments");

    }

IGeometryBridge.GetPoints Method

Populates an array with references to points in the Multipoint. The QueryPoints method on IPointCollection makes copies of the points.

Public Sub GetPoints ( _
    ByVal pPointCollection As IPointCollection4, _
    ByVal Index As Integer, _
    ByRef Points As IPoint[] _
)
public void GetPoints (
    IPointCollection4 pPointCollection,
    int Index,
    ref IPoint[] Points
);

Description

All development languages compatible version of IPointCollection::GetPoints .

public void GetPoints()

    {

        //prepare inputPoints

        IPoint point1 = new PointClass();

        point1.PutCoords(10, 10);

        IPoint point2 = new PointClass();

        point2.PutCoords(20, 20);

        IPoint[] inputPointArray = new IPoint[2];

        inputPointArray[0] = point1;

        inputPointArray[1] = point2;

        IPointCollection4 pointCollection = new MultipointClass();

        //add points to pointCollection

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddPoints(pointCollection, ref inputPointArray);

        //get Points

        int index = 0;

        IPoint[] outputPointArray = new IPoint[inputPointArray.Length - index];

        geometryBridge.GetPoints(pointCollection, index, ref outputPointArray);

        for (int i = 0; i < outputPointArray.Length; i++)

        {

            IPoint currentPoint = outputPointArray[i];

            if (currentPoint == null)

            {

                System.Windows.Forms.MessageBox.Show("Current point = null");

            }

            else

            {

                System.Windows.Forms.MessageBox.Show("X = " + currentPoint.X + ", Y = " + currentPoint.Y);

            }

        }

    }

IGeometryBridge.InsertGeometries Method

Inserts at the specified index references to some number of geometries in the input array.

Public Sub InsertGeometries ( _
    ByVal pGeometryCollection As IGeometryCollection, _
    ByVal Index As Integer, _
    ByRef newGeometries As IGeometry[] _
)
public void InsertGeometries (
    IGeometryCollection pGeometryCollection,
    int Index,
    ref IGeometry[] newGeometries
);

Description

All development languages compatible version of IGeometryCollection::InsertGeometries.

public void InsertGeometries()

    {

        IPoint point1 = new PointClass();

        point1.PutCoords(10, 10);

        IPoint point2 = new PointClass();

        point2.PutCoords(20, 20);

        IGeometry[] geometryArray = new IGeometry[2];

        geometryArray[0] = point1 as IGeometry;

        geometryArray[1] = point2 as IGeometry;

        //insert geometries at position 0

        IGeometryCollection geometryCollection = new MultipointClass();

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.InsertGeometries(geometryCollection, 0, ref geometryArray);

    }

IGeometryBridge.InsertPoints Method

Inserts copies of the input points as vertices into a Path, Ring, Polyline, or Polygon; or references to the input points into a Multipoint, Triangles, TriangleFan, or TriangleStrip.

Public Sub InsertPoints ( _
    ByVal pPointCollection As IPointCollection4, _
    ByVal Index As Integer, _
    ByRef newPoints As IPoint[] _
)
public void InsertPoints (
    IPointCollection4 pPointCollection,
    int Index,
    ref IPoint[] newPoints
);

Description

All development languages compatible version of IPointCollection::InsertPoints .

public void InsertPoints()

    {

        IPoint point1 = new PointClass();

        point1.PutCoords(10, 10);

        IPoint point2 = new PointClass();

        point2.PutCoords(20, 20);

        IPoint[] pointArray = new IPoint[2];

        pointArray[0] = point1;

        pointArray[1] = point2;

        IPointCollection4 pointCollection = new MultipointClass();

        //insert points to pointCollection starting at the given index

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        int index = 0;

        geometryBridge.InsertPoints(pointCollection, index, ref pointArray);

        //insert more points at a different index

        IPoint point3 = new PointClass();

        point3.PutCoords(30, 30);

        IPoint point4 = new PointClass();

        point4.PutCoords(40, 40);

        IPoint[] secondPointArray = new IPoint[2];

        secondPointArray[0] = point3;

        secondPointArray[1] = point4;

        int secondindex = 1;

        geometryBridge.InsertPoints(pointCollection, secondindex, ref secondPointArray);

    }

IGeometryBridge.InsertSegments Method

Inserts references to the input segments.

Public Sub InsertSegments ( _
    ByVal pSegmentCollection As ISegmentCollection, _
    ByVal Index As Integer, _
    ByRef newSegments As ISegment[] _
)
public void InsertSegments (
    ISegmentCollection pSegmentCollection,
    int Index,
    ref ISegment[] newSegments
);

Description

All development languages compatible version of ISegmentCollection::InsertSegments .

IGeometryBridge.InsertWKSPointZs Method

Inserts new vertices/points into this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch.

Public Sub InsertWKSPointZs ( _
    ByVal pPointCollection As IPointCollection4, _
    ByVal Index As Integer, _
    ByRef newPoints As WKSPointZ[] _
)
public void InsertWKSPointZs (
    IPointCollection4 pPointCollection,
    int Index,
    ref WKSPointZ[] newPoints
);

Description

All development languages compatible version of IPointCollection4::InsertWKSPointsZs .

public static void InsertWKSPointZs()

    {

        int length = 10;

        WKSPointZ[] pointArray = new WKSPointZ[length];

        for (int i = 0; i < length; i++)

        {

            pointArray[i] = new WKSPointZ();

            pointArray[i].X = i * 10;

            pointArray[i].Y = i * 10;

            pointArray[i].Z = i * 10;

        }

        IPointCollection4 pointCollection = new MultipointClass();

        // Make pointcollection ZAware

        IZAware zAware = (IZAware)pointCollection;

        zAware.ZAware = true;

        //add points to pointCollection 

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddWKSPointZs(pointCollection, ref pointArray);

        //insert points

        int secondArrayLength = 5;

        WKSPointZ[] secondPointArray = new WKSPointZ[secondArrayLength];

        for (int i = 0; i < secondArrayLength; i++)

        {

            secondPointArray[i] = new WKSPointZ();

            secondPointArray[i].X = i * 33;

            secondPointArray[i].Y = i * 33;

            secondPointArray[i].Z = i * 33;

        }

        int index = 1;

        geometryBridge.InsertWKSPointZs(pointCollection, index, ref secondPointArray);

    }

IGeometryBridge.QueryBeginningRings Method

Populates an array with references to all beginning rings of the specified types.

Public Sub QueryBeginningRings ( _
    ByVal pMultiPatch As IMultiPatch, _
    ByVal ringTypesDesired As Integer, _
    ByRef beginningRings As IRing[] _
)
public void QueryBeginningRings (
    IMultiPatch pMultiPatch,
    int ringTypesDesired,
    ref IRing[] beginningRings
);

Description

All development languages compatible version of IMultipatch::QueryBeginningRings.

IGeometryBridge.QueryFollowingRings Method

Populates an array with references to following rings that are in the ring group that starts with the specified beginning ring.

Public Sub QueryFollowingRings ( _
    ByVal pMultiPatch As IMultiPatch, _
    ByVal beginningRing As IRing, _
    ByRef followingRings As IRing[] _
)
public void QueryFollowingRings (
    IMultiPatch pMultiPatch,
    IRing beginningRing,
    ref IRing[] followingRings
);

Description

All development languages compatible version of IMultipatch::QueryFollowingRings .

IGeometryBridge.QueryGeometries Method

Populates the array with references to a sub-sequence of geometries.

Public Sub QueryGeometries ( _
    ByVal pGeometryCollection As IGeometryCollection, _
    ByVal Index As Integer, _
    ByRef geometries As IGeometry[] _
)
public void QueryGeometries (
    IGeometryCollection pGeometryCollection,
    int Index,
    ref IGeometry[] geometries
);

Description

All development languages compatible version of IGeometryCollection::QueryGeometries.

public void QueryGeometries()

    {

        int inputLength = 10;

        IGeometry[] inputGeometryArray = new IGeometry[inputLength];

        for (int i = 0; i < inputLength; i++)

        {

            IPoint point = new PointClass();

            point.PutCoords(i * 10, i * 10);

            inputGeometryArray[i] = point as IGeometry;

        }

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        IGeometryCollection geometryCollection = new MultipointClass();

        //add geometries

        geometryBridge.AddGeometries(geometryCollection, ref inputGeometryArray);

        //query geometries starting from position 1

        int startIndex = 5;

        IGeometry[] outputGeometryArray = new IGeometry[inputLength - startIndex];

        for (int i = 0; i < outputGeometryArray.Length; i++)

        {

            outputGeometryArray[i] = new PointClass() as IGeometry;

        }

        geometryBridge.QueryGeometries(geometryCollection, startIndex, ref outputGeometryArray);

        for (int i = 0; i < outputGeometryArray.Length; i++)

        {

            //we know that the Geometry is a Point

            IPoint currentPoint = outputGeometryArray[i] as IPoint;

            System.Windows.Forms.MessageBox.Show("X = " + currentPoint.X + ", Y = " + currentPoint.Y);

        }

    }

IGeometryBridge.QueryPoints Method

Copies some points to an existing array of points.

Public Sub QueryPoints ( _
    ByVal pPointCollection As IPointCollection4, _
    ByVal Index As Integer, _
    ByRef Points As IPoint[] _
)
public void QueryPoints (
    IPointCollection4 pPointCollection,
    int Index,
    ref IPoint[] Points
);

Description

All development languages compatible version of IPointCollection::QueryPoints.

When calling this method no count parameter is needed. The length of the array parameter will be used in place of the explicit number given in the IPointCollection::QueryPoints call. This also requires that the array parameter given to IGeometryBridge::QueryPoints can not be longer than the length of the PointCollection minus the index parameter.

public void QueryPoints()

    {

        //prepare inputPoints

        IPoint point1 = new PointClass();

        point1.PutCoords(10, 10);

        IPoint point2 = new PointClass();

        point2.PutCoords(20, 20);

        IPoint[] inputPointArray = new IPoint[2];

        inputPointArray[0] = point1;

        inputPointArray[1] = point2;

        IPointCollection4 pointCollection = new MultipointClass();

        //add points to pointCollection

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddPoints(pointCollection, ref inputPointArray);

        //query Points

        int index = 0;

        IPoint[] outputPointArray = new IPoint[inputPointArray.Length - index];

        for (int i = 0; i < outputPointArray.Length; i++)

        {

            outputPointArray[i] = new PointClass();

        }

        geometryBridge.QueryPoints(pointCollection, index, ref outputPointArray);

        for (int i = 0; i < outputPointArray.Length; i++)

        {

            IPoint currentPoint = outputPointArray[i];

            if (currentPoint == null)

            {

                System.Windows.Forms.MessageBox.Show("Current point = null");

            }

            else

            {

                System.Windows.Forms.MessageBox.Show("X = " + currentPoint.X + ", Y = " + currentPoint.Y);

            }

        }

    }

IGeometryBridge.QuerySegments Method

Returns references to some of the input segments.

Public Sub QuerySegments ( _
    ByVal pSegmentCollection As ISegmentCollection, _
    ByVal Index As Integer, _
    ByRef segments As ISegment[] _
)
public void QuerySegments (
    ISegmentCollection pSegmentCollection,
    int Index,
    ref ISegment[] segments
);

Description

All development languages compatible version of ISegmentCollection::QuerySegments .

public void QuerySegments(ISegment[] segmentArray)

    {

        ISegmentCollection segmentCollection = new PolylineClass();

        //adds Segments to segmentCollection

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddSegments(segmentCollection, ref segmentArray);

        //prepare output

        int index = 0;

        ISegment[] outputSegmentArray = new ISegment[segmentCollection.SegmentCount - index];

        for (int i = 0; i < outputSegmentArray.Length; i++)

        {

            outputSegmentArray[i] = new LineClass();

        }

        //query

        geometryBridge.QuerySegments(segmentCollection, index, ref outputSegmentArray);

        String report = "";

        for (int i = 0; i < outputSegmentArray.Length; i++)

        {

            ISegment currentSegment = outputSegmentArray[i];

            ILine currentLine = currentSegment as ILine;

            report = report + "index = " + i + " , FromPoint X = " + currentLine.FromPoint.X + " , FromPoint Y = " + currentLine.FromPoint.X;

            report = report + " , ToPoint X = " + currentLine.ToPoint.X + " , ToPoint Y = " + currentLine.ToPoint.X + "\n";

        }

        System.Windows.Forms.MessageBox.Show(report);

    }

IGeometryBridge.QueryWKSPointZs Method

Copies vertices/points coordinates to the array of point structures.

Public Sub QueryWKSPointZs ( _
    ByVal pPointCollection As IPointCollection4, _
    ByVal Index As Integer, _
    ByRef pointStructures As WKSPointZ[] _
)
public void QueryWKSPointZs (
    IPointCollection4 pPointCollection,
    int Index,
    ref WKSPointZ[] pointStructures
);

Description

All development languages compatible version of IPointCollection4::QueryWKSPointsZs .

public void QueryWKSPointZs()

    {

        int length = 10;

        WKSPointZ[] pointArray = new WKSPointZ[length];

        for (int i = 0; i < length; i++)

        {

            pointArray[i] = new WKSPointZ();

            pointArray[i].X = i * 10;

            pointArray[i].Y = i * 10;

            pointArray[i].Z = i * 10;

        }

        IPointCollection4 pointCollection = new MultipointClass();

        //adds WKSpointZs to pointCollection   I

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddWKSPointZs(pointCollection, ref pointArray);

        //prepare output

        int index = 0;

        WKSPointZ[] outPutPointArray = new WKSPointZ[pointCollection.PointCount - index];

        for (int i = 0; i < outPutPointArray.Length; i++)

        {

            outPutPointArray[i] = new WKSPointZ();

        }

        //query

        geometryBridge.QueryWKSPointZs(pointCollection, index, ref outPutPointArray);

        String report = "";

        for (int i = 0; i < outPutPointArray.Length; i++)

        {

            WKSPointZ currentPoint = outPutPointArray[i];

            report = report + "index = " + i + " ,X = " + currentPoint.X + " ,Y = " + currentPoint.Y + " ,Z = " + currentPoint.Z + "\n";

        }

        System.Windows.Forms.MessageBox.Show(report);

    }

IGeometryBridge.ReplacePoints Method

Replaces vertices/points within a PointCollection.

Public Sub ReplacePoints ( _
    ByVal pPointCollection As IPointCollection4, _
    ByVal Index As Integer, _
    ByVal goingAway As Integer, _
    ByRef newPoints As IPoint[] _
)
public void ReplacePoints (
    IPointCollection4 pPointCollection,
    int Index,
    int goingAway,
    ref IPoint[] newPoints
);

Description

All development languages compatible version of IPointCollection::ReplacePoints .

public void ReplacePoints()

    {

        int length = 10;

        IPoint[] pointArray = new IPoint[length];

        for (int i = 0; i < length; i++)

        {

            pointArray[i] = new PointClass();

            pointArray[i].PutCoords(i * 10, i * 10);

        }

        IPointCollection4 pointCollection = new MultipointClass();

        //add points to pointCollection 

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddPoints(pointCollection, ref pointArray);

        //create replacement point 

        IPoint point3 = new PointClass();

        point3.PutCoords(999, 999);

        IPoint point4 = new PointClass();

        point4.PutCoords(666, 666);

        IPoint point5 = new PointClass();

        point5.PutCoords(333, 333);

        IPoint[] replacementPointArray = new IPoint[3];

        replacementPointArray[0] = point3;

        replacementPointArray[1] = point4;

        replacementPointArray[2] = point5;

        geometryBridge.ReplacePoints(pointCollection, 2, 3, ref replacementPointArray);

    }

IGeometryBridge.ReplaceSegments Method

Removes and inserts from segments.

Public Sub ReplaceSegments ( _
    ByVal pSegmentCollection As ISegmentCollection, _
    ByVal Index As Integer, _
    ByVal goingAway As Integer, _
    ByRef newSegments As ISegment[] _
)
public void ReplaceSegments (
    ISegmentCollection pSegmentCollection,
    int Index,
    int goingAway,
    ref ISegment[] newSegments
);

Description

All development languages compatible version of ISegmentCollection::ReplaceSegments .

public static void ReplaceSegments(ISegment[] segmentArray)

    {

        ISegmentCollection segmentCollection = new PolylineClass();

        //adds Segments to segmentCollection

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddSegments(segmentCollection, ref segmentArray);

        PrintSegments(segmentCollection, "Segments before replacement");

        int replaceLength = 5;

        ISegment[] replaceSegmentArray = new ISegment[replaceLength];

        for (int i = 0; i < replaceLength; i++)

        {

            ILine replaceLine = new LineClass();

            IPoint replaceFromPoint = new PointClass();

            replaceFromPoint.PutCoords(i * 666, i * 666);

            IPoint replaceToPoint = new PointClass();

            replaceToPoint.PutCoords(i * 333, i * 333);

            replaceLine.PutCoords(replaceFromPoint, replaceToPoint);

            replaceSegmentArray[i] = replaceLine as ISegment;

        }

        int index = 3;

        geometryBridge.ReplaceSegments(segmentCollection, index, replaceLength, ref replaceSegmentArray);

        PrintSegments(segmentCollection, "Segments after replacement");

    }

IGeometryBridge.SetGeometries Method

Replaces all geometries in the collection with the specified number of references to those in the input array.

Public Sub SetGeometries ( _
    ByVal pGeometryCollection As IGeometryCollection, _
    ByRef newGeometries As IGeometry[] _
)
public void SetGeometries (
    IGeometryCollection pGeometryCollection,
    ref IGeometry[] newGeometries
);

Description

All development languages compatible version of IGeometryCollection::SetGeometries .

public void SetGeometries()

    {

        IPoint point1 = new PointClass();

        point1.PutCoords(10, 10);

        IPoint point2 = new PointClass();

        point2.PutCoords(20, 20);

        IGeometry[] geometryArray = new IGeometry[2];

        geometryArray[0] = point1 as IGeometry;

        geometryArray[1] = point2 as IGeometry;

        IGeometryCollection geometryCollection = new MultipointClass();

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        //override all existing geometries and insert geometries from geometryArray

        geometryBridge.SetGeometries(geometryCollection, ref geometryArray);

    }

IGeometryBridge.SetPoints Method

Replaces all existing vertices of this Path, Ring, Polyline, or Polygon with copies of the input points; or all existing points of this Multipoint, Triangles, TriangleFan, or TriangleStrip with references to the input points.

Public Sub SetPoints ( _
    ByVal pPointCollection As IPointCollection4, _
    ByRef newPoints As IPoint[] _
)
public void SetPoints (
    IPointCollection4 pPointCollection,
    ref IPoint[] newPoints
);

Description

All development languages compatible version of IPointCollection::SetPoints .

public void SetPoints()

    {

        IPoint point1 = new PointClass();

        point1.PutCoords(10, 10);

        IPoint point2 = new PointClass();

        point2.PutCoords(20, 20);

        IPoint[] pointArray = new IPoint[2];

        pointArray[0] = point1;

        pointArray[1] = point2;

        IPointCollection4 pointCollection = new MultipointClass();

        //add points to pointCollection 

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddPoints(pointCollection, ref pointArray);

        PrintPointCollectionSetPoints(pointCollection, "PointCollection before setting points");

        //set points  - overrides all existing points

        IPoint point3 = new PointClass();

        point3.PutCoords(30, 30);

        IPoint point4 = new PointClass();

        point4.PutCoords(40, 40);

        IPoint point5 = new PointClass();

        point5.PutCoords(50, 50);

        IPoint[] secondPointArray = new IPoint[3];

        secondPointArray[0] = point3;

        secondPointArray[1] = point4;

        secondPointArray[2] = point5;

        geometryBridge.SetPoints(pointCollection, ref secondPointArray);

        PrintPointCollectionSetPoints(pointCollection, "PointCollection after setting points");

    }

IGeometryBridge.SetSegments Method

Replaces all segments with references to the input segments.

Public Sub SetSegments ( _
    ByVal pSegmentCollection As ISegmentCollection, _
    ByRef newSegments As ISegment[] _
)
public void SetSegments (
    ISegmentCollection pSegmentCollection,
    ref ISegment[] newSegments
);

Description

All development languages compatible version of ISegmentCollection::SetSegments .

public static void SetSegments(ISegment[] segmentArray)

    {

        ISegmentCollection segmentCollection = new PolylineClass();

        //adds Segments to segmentCollection

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddSegments(segmentCollection, ref segmentArray);

        int insertLength = 5;

        ISegment[] insertSegmentArray = new ISegment[insertLength];

        for (int i = 0; i < insertLength; i++)

        {

            ILine insertLine = new LineClass();

            IPoint insertFromPoint = new PointClass();

            insertFromPoint.PutCoords(i * 666, i * 666);

            IPoint insertToPoint = new PointClass();

            insertToPoint.PutCoords(i * 333, i * 333);

            insertLine.PutCoords(insertFromPoint, insertToPoint);

            insertSegmentArray[i] = insertLine as ISegment;

        }

        geometryBridge.SetSegments(segmentCollection, ref insertSegmentArray);

    }

IGeometryBridge.SetWKSPointZs Method

Replaces all vertices/points of this Path, Ring, Polyline, Polygon, Multipoint, Triangles, TriangleFan, TriangleStrip, or MultiPatch with new ones.

Public Sub SetWKSPointZs ( _
    ByVal pPointCollection As IPointCollection4, _
    ByRef pointStructures As WKSPointZ[] _
)
public void SetWKSPointZs (
    IPointCollection4 pPointCollection,
    ref WKSPointZ[] pointStructures
);

Description

All development languages compatible version of IPointCollection4::SetWKSPointsZs .

public void SetWKSPointZs()

    {

        int length = 10;

        WKSPointZ[] pointArray = new WKSPointZ[length];

        for (int i = 0; i < length; i++)

        {

            pointArray[i] = new WKSPointZ();

            pointArray[i].X = i * 10;

            pointArray[i].Y = i * 10;

            pointArray[i].Z = i * 10;

        }

        IPointCollection4 pointCollection = new MultipointClass();

        IZAware zAware = (IZAware)pointCollection;

        zAware.ZAware = true;

        //add points to pointCollection 

        IGeometryBridge geometryBridge = new GeometryEnvironmentClass();

        geometryBridge.AddWKSPointZs(pointCollection, ref pointArray);

        PrintSetWKSPointZs(pointCollection, "PointCollection before setting points");

        //set points  - overrides all existing points

        int secondArrayLength = 5;

        WKSPointZ[] secondPointArray = new WKSPointZ[secondArrayLength];

        for (int i = 0; i < secondArrayLength; i++)

        {

            secondPointArray[i] = new WKSPointZ();

            secondPointArray[i].X = i * 33;

            secondPointArray[i].Y = i * 33;

            secondPointArray[i].Z = i * 33;

        }

        geometryBridge.SetWKSPointZs(pointCollection, ref secondPointArray);

        PrintSetWKSPointZs(pointCollection, "PointCollection after setting points");

    }

Classes that implement IGeometryBridge

Classes Description
GeometryEnvironment Provides a way of creating geometries from different inputs and setting/getting global variables for controlling behavior of geometry methods.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.