IConstructPoint2 Interface

Provides access to additional point construction methods.

Members

Name Description
Method ConstructAlong Constructs a point distance units along the input curve.
Method ConstructAngleBisector Constructs a point on the bisector of the angle (from, through, to). When useAcuteAngle is false, the sign of distance will select a point right or left of (from, through, to). Otherwise, the sign of distance will select the acute/obtuse point.
Method ConstructAngleDistance Constructs a point at a specified angle (in radians) from the horizontal axis and a specified distance away from the input point.
Method ConstructAngleIntersection Constructs the point of intersection between two lines defined by the input points and angles (in radians).
Method ConstructAverage Constructs the geometric average of the input point collection. Optionally uses the specified attribute as a source of weights on the locations of the points.
Method ConstructDeflection Constructs a point in the polar coordinate system defined by baseLine and its 'from' point. The angle is in radians.
Method ConstructDeflectionIntersection Constructs the point of intersection of two rays with origins at the endpoints of the base line and the specified angles (in radians). If onRightSide is true, this work will be done to the right of the base line, otherwise to the left.
Method ConstructOffset Constructs a point distance units along the input curve and offset units perpendicularly away from it.
Method ConstructParallel Constructs a point distance units from start, parallel to the tangent at the point nearest to start on the (extended) segment.
Method ConstructPerpendicular Constructs a point 'distance' units from p and lying along the line normal to base and passing through p.
Method ConstructThreePointResection Constructs the point of observation from which two signed angles between three points were measured; returns an angle which can help establish the confidence of the observation location: A small angle indicates greater uncertainty in the location.

IConstructPoint2.ConstructAverage Method

Constructs the geometric average of the input point collection. Optionally uses the specified attribute as a source of weights on the locations of the points.

Public Sub ConstructAverage ( _
    ByVal Points As IPointCollection, _
    ByVal attributeType As esriGeometryAttributes _
)
public void ConstructAverage (
    IPointCollection Points,
    esriGeometryAttributes attributeType
);

Remarks

If attributeType is esriAttributeNone then the average point location is computed; otherwise the attribute specified by attributeType serves as a weight. Points whose weight attribute is NaN are ignored (a weight of 0 has a similar affect). The resulting point will have the (weighted) average for all their attributes. However this does not apply to ID's; no average is calculated for them in any case; but thay can be used as weight.

Only the following attributeType values are permitted: esriAttributeNone, esriAttributeZ, esriAttributeM, esriAttributeID.

//This example demonstrates how to use the ConstructAverage method

private void ConstructAverage_Example()

{

    IPointCollection4 pointCollection = new MultipointClass();

    object Missing = Type.Missing;

    //Create a MAware and a ZAware multipoint

    IPoint[] points = new IPoint[4];

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

    {

        points[i]= new PointClass();

    }

    points[0].PutCoords(0, 0);

    points[0].Z = 10;

    points[0].M = 10;

    points[1].PutCoords(0, 5);

    points[1].Z = 10;

    points[1].M = 10;

    points[2].PutCoords(5, 5);

    points[2].Z = 20;

    points[2].M = 20;

    points[3].PutCoords(5, 0);

    points[3].Z = 10;

    points[3].M = 20;

    IGeometryBridge geomBridge = new GeometryEnvironmentClass();

    geomBridge.AddPoints(pointCollection, ref points);

    IZAware zAwareCollection = pointCollection as IZAware;

    zAwareCollection.ZAware = true;

    IMAware mAwareCollection = pointCollection as IMAware;

    mAwareCollection.MAware = true;

    IConstructPoint2 constructionPoint = new PointClass();

    //Construct the average point with esriAttributeM

    constructionPoint.ConstructAverage(pointCollection, esriGeometryAttributes.esriAttributeM);

    IPoint outPutPoint1 = constructionPoint as IPoint;

    System.Windows.Forms.MessageBox.Show("Output point with esriAttributeM: " + outPutPoint1.X + " , " + outPutPoint1.Y + " , " + outPutPoint1.M);

    //Construct the average point with esriAttributeZ

    constructionPoint.ConstructAverage(pointCollection, esriGeometryAttributes.esriAttributeZ);

    IPoint outPutPoint2 = constructionPoint as IPoint;

    System.Windows.Forms.MessageBox.Show("Output point with esriAttributeZ: " + outPutPoint2.X + " , " + outPutPoint2.Y + " , " + outPutPoint2.Z);

}
'This example demonstrates how to use the ConstructAverage method

    Sub ConstructAverage_Example()

        Dim pPoints(0 To 3) As IPoint, pPointcol As IPointCollection4

        Dim pZawareCol As IZAware, pMawareCol As IMAware

        Dim pPoint As IPoint, pconstpoint2 As IConstructPoint2

        'Create a MAware and a ZAware multipoint

        pPoints(0) = New Point

        pPoints(1) = New Point

        pPoints(2) = New Point

        pPoints(3) = New Point

        pPoints(0).PutCoords(0, 0)

        pPoints(1).PutCoords(0, 5)

        pPoints(2).PutCoords(5, 5)

        pPoints(3).PutCoords(5, 0)

        pPoints(0).Z = 10

        pPoints(1).Z = 10

        pPoints(2).Z = 20

        pPoints(3).Z = 10

        pPoints(0).M = 10

        pPoints(1).M = 10

        pPoints(2).M = 20

        pPoints(3).M = 10

        pPointcol = New Multipoint

        Dim pGeometryBridge As IGeometryBridge

        pGeometryBridge = New GeometryEnvironment

        pGeometryBridge.AddPoints(pPointcol, pPoints)

        pZawareCol = pPointcol

        pZawareCol.ZAware = True

        pMawareCol = pPointcol

        pMawareCol.MAware = True

        pconstpoint2 = New Point

        '** Construct the average point with esriAttributeM

        pconstpoint2.ConstructAverage(pPointcol, esriGeometryAttributes.esriAttributeM)

        pPoint = pconstpoint2

        Debug.Print("***** esriAttributeM *****")

        Debug.Print(pPoint.X & " , " & pPoint.Y & " , " & pPoint.M)

        '** Construct the average point with esriAttributeZ

        pconstpoint2 = New Point

        pconstpoint2.ConstructAverage(pPointcol, esriGeometryAttributes.esriAttributeZ)

        pPoint = pconstpoint2

        Debug.Print("***** esriAttributeZ *****")

        Debug.Print(pPoint.X & " , " & pPoint.Y & " , " & pPoint.Z)

    End Sub

Inherited Interfaces

Interfaces Description
IConstructPoint Provides access to members that construct a point using other geometries and measures.

Classes that implement IConstructPoint2

Classes Description
Point A two dimensional point, optionally with measure, height, and ID attributes.

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