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


IArea.QueryCentroid Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Geometry)  

IArea.QueryCentroid Method

Copies the centroid of this area to the specified point.

[Visual Basic .NET]
Public Sub QueryCentroid ( _
    ByVal Center As IPoint _
)
[C#]
public void QueryCentroid (
    IPoint Center
);
[C++]
HRESULT QueryCentroid(
  IPoint* Center
);
[C++]

Parameters Center
Center is a parameter of type IPoint

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

Queries the Centroid of the 2 (or 2.5) Dimensional figure.  The Centroid is the center of the weighted area. You must instantiate the Point before calling QueryCentroid. For example,

Dim pPoint as IPoint
Set pPoint=New Point

Remarks

The Centroid does not always occur inside the Area of the geometry.  The Centroid is not the same as the center of the geometry or the Envelope binding the geometry (but it may be if and only if that is also the center of the weighted area).

Note: The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.

 

Centroid Example

See Also

IArea Interface | IArea.Centroid Property | IArea.QueryCentroid Method | IArea.LabelPoint Property | IArea.QueryLabelPoint Method