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


IGeometry3.QueryWKSEnvelope Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IG > IGeometry3 Interface > IGeometry3.QueryWKSEnvelope Method
ArcGIS Developer Help

IGeometry3.QueryWKSEnvelope Method

Defines the specified wksenvelope to be the current extent of this geometry in the x-y plane.

[Visual Basic .NET]
Public Sub QueryWKSEnvelope ( _
    ByRef e As WKSEnvelope _
)
[C#]
public void QueryWKSEnvelope (
    ref WKSEnvelope e
);
[C++]
HRESULT QueryWKSEnvelope(
  WKSEnvelope* e
);
[C++]
Parameters
e [out]

e is a parameter of type WKSEnvelope*

Product Availability

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

Description

The QueryWKSEnvelope method returns a WKSEnvelope structure corresponding to the envelope of the geometry. Use that method to quickly get the XMin, XMax, YMin and YMax values.

[C#]

    //This example demonstrates how to use the QueryWKSEnvelope method
    private void QueryWKSEnvelope_Example()
    {
        IGeometry3 geometry = CreateRectanglePolygon() as IGeometry3;
        WKSEnvelope wksEnvelope = new WKSEnvelope();
        geometry.QueryWKSEnvelope(out wksEnvelope);
        System.Windows.Forms.MessageBox.Show("Xmin, Xmax, Ymin, Ymax: " + wksEnvelope.XMin + " , " + wksEnvelope.XMax + " , " + wksEnvelope.YMin + " , " + wksEnvelope.YMax);
    }
    private IPolygon CreateRectanglePolygon()
    {
        IEnvelope envelope = new EnvelopeClass();
        envelope.PutCoords(0, 0, 20, 20);
        ISegmentCollection segmentCollection = new PolygonClass();
        segmentCollection.SetRectangle(envelope);
        return segmentCollection as IPolygon;
    }

See Also

IGeometry3 Interface