Interface IPoint

Namespace
ESRI.ArcGIS.Geometry
Assembly
ESRI.Server.Geometry.dll

Provides access to members that define two dimensional points.

[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("1B077915-38C5-11D0-92D2-00805F7C28B0")]
public interface IPoint : IGeometry

Remarks

 

Point Example

Properties

Dimension

esriGeometryDimension Dimension { get; }

Property Value

esriGeometryDimension

Envelope

IEnvelope Envelope { get; }

Property Value

IEnvelope

GeometryType

esriGeometryType GeometryType { get; }

Property Value

esriGeometryType

ID

The Point ID attribute.

int ID { get; set; }

Property Value

int

Remarks

To set the ID value for a point you need to define it to be ID aware.
[C#]

The following C# code explains how to do it:    

IPoint pnt = new PointClass();

pnt.PutCoords(100, 100);

 

IPointIDAware pntIDA = pnt as IPointIDAware;

pntIDA.PointIDAware = true;

pnt.ID = 10;

IsEmpty

bool IsEmpty { get; }

Property Value

bool

M

The measure attribute.

double M { get; set; }

Property Value

double

Remarks





[C#]

    // The following example shows how to set the x,y,z,m properties
    // for a point. Note that you need to tell the point to be
    // M- and Z-aware.
    public void DisplayCoordinates()
    {
        IPoint point = new PointClass();
        point.PutCoords(100, 100);
        IMAware mAware = point as IMAware;
        mAware.MAware = true;
        IZAware zAware = point as IZAware;
        zAware.ZAware = true;
        point.Z = 50;
        point.M = 10;
        System.Windows.Forms.MessageBox.Show(point.X + "," + point.Y + "," + point.Z + "," + point.M);
    }













SpatialReference

ISpatialReference SpatialReference { get; set; }

Property Value

ISpatialReference

VertexAttribute[esriGeometryAttributes]

Any attribute (coordinate), except X or Y.

double VertexAttribute[esriGeometryAttributes attributeType] { get; set; }

Parameters

attributeType esriGeometryAttributes

Property Value

double

X

The X coordinate.

double X { get; set; }

Property Value

double

Y

The Y coordinate.

double Y { get; set; }

Property Value

double

Remarks

 

Point Y Coord Example

[C#]

    // The following example shows how to set the x,y,z,m properties
    // for a point. Note that you need to tell the point to be
    // M- and Z-aware.
    public void DisplayCoordinates()
    {
        IPoint point = new PointClass();
        point.PutCoords(100, 100);
        IMAware mAware = point as IMAware;
        mAware.MAware = true;
        IZAware zAware = point as IZAware;
        zAware.ZAware = true;
        point.Z = 50;
        point.M = 10;
        System.Windows.Forms.MessageBox.Show(point.X + "," + point.Y + "," + point.Z + "," + point.M);
    }













Z

The Z attribute.

double Z { get; set; }

Property Value

double

Methods

Compare(IPoint)

Compares X, Y, M, Z, ID of this point (in that order) with that of the other point. Returns -1 if this point's value is less, 1 if greater, and 0 otherwise. Useful for sorting a group of points.

int Compare(IPoint otherPoint)

Parameters

otherPoint IPoint

Returns

int

Remarks

The method should not be used in order to determine equality of two points. Use IRelationalOperator::Equals or IClone::IsEqual. At 9.2, this method uses the resolution property of the point's spatial reference in order to determine (x,y) coordinate ordering. At 9.1, an untoleranced (exact) comparison was performed.

ConstrainAngle(double, IPoint, bool)

Projects this point to the point on the infinite line defined by anchor and angle (in radians). If allowOpposite is true, then the point can also snap to angle + pi radians.

void ConstrainAngle(double constraintAngle, IPoint anchor, bool allowOpposite)

Parameters

constraintAngle double
anchor IPoint
allowOpposite bool

Remarks

ContrainAngle

[C#]

//Finds the closes point to line from (0,0) with angles

//defined by steps of pi/4 (Note all angles in radians)

private void ConstrainAngle()
{
  IPoint point = new PointClass();
  point.PutCoords(0, 0);



  IPoint newPoint = new PointClass();
  newPoint.PutCoords(1,0);


  for (int i = 0; i < 8; i++)
  {
    newPoint.ConstrainAngle(i * Math.PI / 4, point, true);


    System.Windows.Forms.MessageBox.Show(newPoint.X + ", " + newPoint.Y);
  }
}


[Visual Basic .NET]

    'Finds the closes point to line from (0,0) with angles
    'defined by steps of pi/4 (Note all angles in radians)
    '
    Sub TestConstrainAngle()
        Dim pApoint As ESRI.ArcGIS.Geometry.IPoint
        Dim pNpoint As ESRI.ArcGIS.Geometry.IPoint
        Dim pi As Double
        Dim dAngle As Double
        Dim i As Long







        pApoint = New ESRI.ArcGIS.Geometry.Point
        pi = 4 * Math.Atan(1)
        dAngle = 0
        pApoint.PutCoords(0, 0)


        pNpoint = New ESRI.ArcGIS.Geometry.Point

        For i = 0 To 7

pNpoint.PutCoords(1, 0)

dAngle = i * pi / 4

pNpoint.ConstrainAngle(dAngle, pApoint, True)

MsgBox("angle = " & i & "*pi/4" & vbCrLf & pNpoint.X & "," & pNpoint.Y)
Next i
End Sub






ConstrainDistance(double, IPoint)

Projects this point to the perimeter of the circle defined by radius and anchor.

void ConstrainDistance(double constraintRadius, IPoint anchor)

Parameters

constraintRadius double
anchor IPoint

Remarks

ConstrainDistance

[C#]
private void ConstrainDistance()
{
  IPoint point = new PointClass();
  point.PutCoords(0, 0);
  IPoint newPoint = new PointClass();
  newPoint.PutCoords(2,2);
  newPoint.ConstrainDistance(Math.PI, point);
  System.Windows.Forms.MessageBox.Show(newPoint.X + ", " + newPoint.Y);
}
[Visual Basic .NET]

    Public Sub ConstrainDistanceTest()
        Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
        Dim pNPoint As ESRI.ArcGIS.Geometry.IPoint
        Dim dRadius As Double


        pPoint = New ESRI.ArcGIS.Geometry.Point
        pPoint.PutCoords(0, 0)

        pNPoint = New ESRI.ArcGIS.Geometry.Point
        pNPoint.PutCoords(2, 2)
        dRadius = 1.4142135623731

        pNPoint.ConstrainDistance(dRadius, pPoint)

        MsgBox("Radius = " & dRadius & " x,y = " & pNPoint.X & "," & pNPoint.Y)

    End Sub

GeoNormalize()

void GeoNormalize()

GeoNormalizeFromLongitude(double)

void GeoNormalizeFromLongitude(double Longitude)

Parameters

Longitude double

Project(ISpatialReference)

void Project(ISpatialReference newReferenceSystem)

Parameters

newReferenceSystem ISpatialReference

PutCoords(double, double)

Sets the X and Y coordinates.

void PutCoords(double X, double Y)

Parameters

X double
Y double

Remarks

Use the IPoint::PutCoords method to set the X,Y coordinates for a Point. The coordinates can also be set by updating the X and Y properties for the point.
Point PutCoords Example
[C#]     private void DefinePoint()
    {
        IPoint point = new PointClass();
        point.PutCoords(0, 0);
        System.Windows.Forms.MessageBox.Show(point.X + ", " + point.Y);
    }




QueryCoords(out double, out double)

Returns the X and Y coordinates.

void QueryCoords(out double X, out double Y)

Parameters

X double
Y double

QueryEnvelope(IEnvelope)

void QueryEnvelope(IEnvelope outEnvelope)

Parameters

outEnvelope IEnvelope

SetEmpty()

void SetEmpty()

SnapToSpatialReference()

void SnapToSpatialReference()