IEnvelope Interface

Provides access to methods and properties of envelopes.

Description

Envelopes are the rectangular window that contain a specific element. All Geometry objects have an envelope defined by the XMin, XMax, YMin, and YMax of the object. Envelopes can also serve as the viewing area for a particular view screen or data frame.

Members

Name Description
Method CenterAt Moves this envelope so it is centered at p.
Method DefineFromPoints Defines the envelope to cover all the points.
Method DefineFromWKSPoints Defines the envelope to cover all the points.
Read/write property Depth The depth of the envelope.
Read-only property Dimension The topological dimension of this geometry.
Read-only property Envelope Creates a copy of this geometry's envelope and returns it.
Method Expand Moves the X and Y coordinates of the sides toward or away from each other.
Method ExpandM Moves the measure of the sides toward or away from each other.
Method ExpandZ Moves the Z attribute of the sides toward or away from each other.
Read-only property GeometryType The type of this geometry.
Method GeoNormalize Shifts longitudes, if need be, into a continuous range of 360 degrees.
Method GeoNormalizeFromLongitude Normalizes longitudes into a continuous range containing the longitude. This method is obsolete.
Read-only property Height The height of the envelope.
Write-only property Height The height of the envelope.
Method Intersect Adjusts to include only the area also included by inEnvelope.
Read-only property IsEmpty Indicates whether this geometry contains any points.
Read/write property LowerLeft The lower left corner.
Read/write property LowerRight The lower right corner.
Read/write property MinMaxAttributes A reference to the attribute structures for this envelope.
Read/write property MMax The maximum measure value in the area of the envelope.
Read/write property MMin The minimum measure value in the area of the envelope.
Method Offset Moves the sides x units horizontally and y units vertically.
Method OffsetM Moves the sides m units.
Method OffsetZ Moves the sides z units.
Method Project Projects this geometry into a new spatial reference.
Method PutCoords Constructs an envelope from the coordinate values of lower, left and upper, right corners.
Method PutWKSCoords Copies e's dimensions into this envelope.
Method QueryCoords Returns the coordinates of lower, left and upper, right corners.
Method QueryEnvelope Copies this geometry's envelope properties into the specified envelope.
Method QueryWKSCoords Copies the left, bottom, right and top sides into e.
Method SetEmpty Removes all points from this geometry.
Method SnapToSpatialReference Moves points of this geometry so that they can be represented in the precision of the geometry's associated spatial reference system.
Read/write property SpatialReference The spatial reference associated with this geometry.
Method Union Adjusts to overlap inEnvelope.
Read/write property UpperLeft The upper left corner.
Read/write property UpperRight The upper right corner.
Read/write property Width The width of the envelope.
Read/write property XMax The position of the right side.
Read/write property XMin The position of the left side.
Read/write property YMax The position of the top.
Read/write property YMin The position of the bottom.
Read/write property ZMax The maximum Z value in the area of the envelope.
Read/write property ZMin The minimum Z value in the area of the envelope.

IEnvelope.CenterAt Method

Moves this envelope so it is centered at p.

Public Sub CenterAt ( _
    ByVal p As IPoint _
)
public void CenterAt (
    IPoint p
);

Description

Moves the Envelope so that the center point of the Envelope is at the given input point. The Width, Height, and other properties of the Envelope remain unchanged (only the XMin, XMax, YMin, and YMax are altered).

Remarks

The Center Point occurs at: ((XMin + XMax) / 2, (YMin + YMax) / 2).

private void ReCenterEnvelope()

{

    IEnvelope envelope = new EnvelopeClass();

    envelope.PutCoords(100, 100, 200, 200);

    String report1 = "Envelope: \n" +

                     "LowerLeft  X = " + envelope.LowerLeft.X + "\n" +

                     "LowerLeft  Y = " + envelope.LowerLeft.Y + "\n\n" +

                     "LowerRight X =  " + envelope.LowerRight.X + "\n" +

                     "LowerRight Y =  " + envelope.LowerRight.Y + "\n\n" +

                     "UpperLeft  X = " + envelope.UpperLeft.X + "\n" +

                     "UpperLeft  Y = " + envelope.UpperLeft.Y + "\n\n" +

                     "UpperRight X =  " + envelope.UpperRight.X + "\n" +

                     "UpperRight Y =  " + envelope.UpperRight.Y; System.Windows.Forms.MessageBox.Show(report1);

    //re-center

    IPoint centerPoint = new PointClass();

    centerPoint.PutCoords(0, 0);

    envelope.CenterAt(centerPoint);

    String report2 = "Re-cetered Envelope: \n" +

                     "LowerLeft  X = " + envelope.LowerLeft.X + "\n" +

                     "LowerLeft  Y = " + envelope.LowerLeft.Y + "\n\n" +

                     "LowerRight X =  " + envelope.LowerRight.X + "\n" +

                     "LowerRight Y =  " + envelope.LowerRight.Y + "\n\n" +

                     "UpperLeft  X = " + envelope.UpperLeft.X + "\n" +

                     "UpperLeft  Y = " + envelope.UpperLeft.Y + "\n\n" +

                     "UpperRight X =  " + envelope.UpperRight.X + "\n" +

                     "UpperRight Y =  " + envelope.UpperRight.Y; System.Windows.Forms.MessageBox.Show(report2);

}
Public Sub t_EnvCenterAt()

        Dim pEnv1 As IEnvelope

        Dim pPoint As IPoint

        pEnv1 = New Envelope

        pPoint = New Point

        pEnv1.PutCoords(100, 100, 200, 200)

        pPoint.PutCoords(0, 0)

        pEnv1.CenterAt(pPoint)

        Dim dXmin As Double, dYmin As Double, dXmax As Double, dYmax As Double

        pEnv1.QueryCoords(dXmin, dYmin, dXmax, dYmax)

        If pEnv1.IsEmpty Then

            MsgBox("envelope is empty")

        Else

            MsgBox(dXmin & "," & dYmin & "," & dXmax & "," & dYmax)

        End If

    End Sub

IEnvelope.DefineFromPoints Method

Defines the envelope to cover all the points.

Public Sub DefineFromPoints ( _
    ByVal Count As Integer, _
    ByRef Points As IPoint _
)
public void DefineFromPoints (
    int Count,
    ref IPoint Points
);

Description

Defines this Envelope from an array of Points. The XMin, YMin, XMax, and YMax correspond to the minimum X value, minimum Y value, maximum X value, and maximum Y value respectively of the the Points in the array.

Remarks

This is similar to getting the Envelope of a Multipoint.

Note: It is also possible to define a degenerate point Envelope by passing a single Point as an argument. The IPoint parameter accepts both a single IPoint object and an array of IPoints. To use an array, pass the desired starting element of the array as the input argument.

IEnvelope.DefineFromWKSPoints Method

Defines the envelope to cover all the points.

Public Sub DefineFromWKSPoints ( _
    ByVal Count As Integer, _
    ByRef Points As WKSPoint _
)
public void DefineFromWKSPoints (
    int Count,
    ref WKSPoint Points
);

Description

Defines this Envelope from an array of WKSPoint structures. The XMin, YMin, XMax, and YMax correspond to the minimum X value, minimum Y value, maximum X value, and maximum Y value respectively of the the Points in the array.

IEnvelope.Depth Property

The depth of the envelope.

Public Property Depth As Double
public double Depth {get; set;}

Description

The Depth of an Envelope is the range of Z values. The Depth = ZMax - ZMin. Used to get or set the Depth of a non-empty Envelope. The Envelope must be ZAware and have non-NaN Zs set.

Remarks

Envelope Depth Example

IEnvelope.Expand Method

Moves the X and Y coordinates of the sides toward or away from each other.

Public Sub Expand ( _
    ByVal dx As Double, _
    ByVal dy As Double, _
    ByVal asRatio As Boolean _
)
public void Expand (
    double dx,
    double dy,
    bool asRatio
);

Description

Expand scales the size of the Envelope. If asRatio = FALSE, the expansion is additive. ``

XMin = XMin - dx
YMin = YMin - dy
XMax = XMax + dx
YMax = YMax + dy

``

``If asRatio = TRUE, the expansion is multiplicative. If the user wants to increase the envelope width by 10%, then dx = 1.1. On the other hand, if the user intends to decrease the width by 10%, then dx = 0.9. No negative number allowed when asRation is set to TRUE.

XMin = XMin - (dx-1)*Width/2
YMin = YMin - (dy-1)*Height/2 
XMax = XMax + (dx-1)*Width/2
YMax = YMax + (dy-1)*Height/2

The Envelope remains centered at the same position.

Remarks

Envelope Expand Example

// The example shows how to expand the Envelope by using a asRatio factor. 

private void Expand()

{

    IEnvelope envelope = new EnvelopeClass();

    envelope.PutCoords(100, 100, 200, 200);

    String report1 = "Envelope before expanding: \n" +

                     "LowerLeft  X = " + envelope.LowerLeft.X + "\n" +

                     "LowerLeft  Y = " + envelope.LowerLeft.Y + "\n\n" +

                     "LowerRight X =  " + envelope.LowerRight.X + "\n" +

                     "LowerRight Y =  " + envelope.LowerRight.Y + "\n\n" +

                     "UpperLeft  X = " + envelope.UpperLeft.X + "\n" +

                     "UpperLeft  Y = " + envelope.UpperLeft.Y + "\n\n" +

                     "UpperRight X =  " + envelope.UpperRight.X + "\n" +

                     "UpperRight Y =  " + envelope.UpperRight.Y;

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

    //expand

    envelope.Expand(0.5, 0.5, true);

    String report2 = "Envelope after expanding: \n" +

                     "LowerLeft  X = " + envelope.LowerLeft.X + "\n" +

                     "LowerLeft  Y = " + envelope.LowerLeft.Y + "\n\n" +

                     "LowerRight X =  " + envelope.LowerRight.X + "\n" +

                     "LowerRight Y =  " + envelope.LowerRight.Y + "\n\n" +

                     "UpperLeft  X = " + envelope.UpperLeft.X + "\n" +

                     "UpperLeft  Y = " + envelope.UpperLeft.Y + "\n\n" +

                     "UpperRight X =  " + envelope.UpperRight.X + "\n" +

                     "UpperRight Y =  " + envelope.UpperRight.Y;

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

}
' The example shows how to expand the Envelope pEnv1 by using a

    ' asRatio factor. In this case the target Envelope is 50% of the

    ' original size.

    Public Sub t_EnvExpand()

        Dim pEnv1 As IEnvelope

        pEnv1 = New Envelope

        pEnv1.PutCoords(100, 100, 200, 200)

        pEnv1.Expand(0.5, 0.5, True)

        Dim dXmin As Double, dYmin As Double, dXmax As Double, dYmax As Double

        pEnv1.QueryCoords(dXmin, dYmin, dXmax, dYmax)

        If pEnv1.IsEmpty Then

            MsgBox("envelope is empty")

        Else

            MsgBox(dXmin & "," & dYmin & "," & dXmax & "," & dYmax)

        End If

    End Sub

IEnvelope.ExpandM Method

Moves the measure of the sides toward or away from each other.

Public Sub ExpandM ( _
    ByVal dm As Double, _
    ByVal asRatio As Boolean _
)
public void ExpandM (
    double dm,
    bool asRatio
);

Description

ExpandM scales the M attributes of the Envelope. If asRatio = FALSE, the scaling is additive (MMin = MMin - dm, MMax = MMax + dm). If asRatio = TRUE, the scaling is multiplicative (MMin = MMin - dm*(MMax - MMin)/2, MMax = MMax + dm*(MMax - MMin)/2).

IEnvelope.ExpandZ Method

Moves the Z attribute of the sides toward or away from each other.

Public Sub ExpandZ ( _
    ByVal dz As Double, _
    ByVal asRatio As Boolean _
)
public void ExpandZ (
    double dz,
    bool asRatio
);

Description

ExpandZ scales the Z attributes of the Envelope. If asRatio = FALSE, the scaling is additive (ZMin = ZMin - dz, ZMax = ZMax + dz). If asRatio = TRUE, the scaling is multiplicative (ZMin = ZMin - dz*Depth/2, ZMax = ZMax + dz*Depth/2)

public static void TestExpandZ()

          {

              const double ScaleFactor = 1.986;

  

              IEnvelope2 envelope = GetEnvelopeGeometry() as IEnvelope2;

  

              double beforeXMin, beforeXMax, beforeYMin, beforeYMax;

              envelope.QueryCoords(out beforeXMin, out beforeYMin, out beforeXMax, out beforeYMax);

  

              double beforeZMin, beforeZMax;

              envelope.QueryZCoords(out beforeZMin, out beforeZMax);

  

              envelope.ExpandZ(ScaleFactor, true);

  

              double afterXMin, afterXMax, afterYMin, afterYMax;

              envelope.QueryCoords(out afterXMin, out afterYMin, out afterXMax, out afterYMax);

  

              double afterZMin, afterZMax;

              envelope.QueryZCoords(out afterZMin, out afterZMax);

  

              //beforeXMin = -8.604

              //beforeXMax = 1.396

              //beforeYMin = -12.117

              //beforeYMax = -2.117

              //beforeZMin = -12.902

              //beforeZMax = -2.902

   

              //afterXMin = -8.604

              //afterXMax = 1.396

              //afterYMin = -12.117

              //afterYMax = -2.117

              //afterZMin = -17.829

              //afterZMax = 2.026

         }

IEnvelope.Height Property

The height of the envelope.

Public Property Height As Double
public double Height {get; set;}

Description

The Height of an Envelope is the vertical span. The Height = YMax - YMin. Used to get or set the Height of a non-empty Envelope. If used to set the Height, the LowerLeft and LowerRight points are preserved and the UpperLeft and UpperRight points are repositioned accordingly.

Remarks

Envelope Height Example

IEnvelope.Height Property

The height of the envelope.

Public Property Height As Double
public double Height {get; set;}

Description

The Height of an Envelope is the vertical span. The Height = YMax - YMin. Used to get or set the Height of a non-empty Envelope. If used to set the Height, the LowerLeft and LowerRight points are preserved and the UpperLeft and UpperRight points are repositioned accordingly.

Remarks

Envelope Height Example

IEnvelope.Intersect Method

Adjusts to include only the area also included by inEnvelope.

Public Sub Intersect ( _
    ByVal inEnvelope As IEnvelope _
)
public void Intersect (
    IEnvelope inEnvelope
);

Description

Sets the Envelope equal to the intersection of the base Envelope and the input Envelope. The XMin and YMin of the resulting Envelope is the maximum XMin and YMin respectively between the base and input Envelopes, and the XMax and YMax of the resulting Envelope is the minimum XMax and YMax respectively between the base and input Envelopes. If the resulting XMin > XMax, or YMin > YMax, then the Envelope is Empty (and all XMin, XMax, YMin, and YMax are undefined.).

Remarks

Envelope Intersect Example

public void Intersect()

{

    IEnvelope envelope1 = new EnvelopeClass();

    IEnvelope envelope2 = new EnvelopeClass();

    envelope1.PutCoords(100, 100, 200, 200);

    envelope2.PutCoords(150, 150, 250, 250);

    envelope1.Intersect(envelope2);

    IPoint lowerLeft = envelope1.LowerLeft;

    IPoint lowerRight = envelope1.LowerRight;

    IPoint upperLeft = envelope1.UpperLeft;

    IPoint upperRight = envelope1.UpperRight;

    String report = "LowerLeft  X = " + lowerLeft.X + "\n" +

                    "LowerLeft  Y = " + lowerLeft.Y + "\n\n" +

                    "LowerRight X =  " + lowerRight.X + "\n" +

                    "LowerRight Y =  " + lowerRight.Y + "\n\n" +

                    "UpperLeft  X = " + upperLeft.X + "\n" +

                    "UpperLeft  Y = " + upperLeft.Y + "\n\n" +

                    "UpperRight X =  " + upperRight.X + "\n" +

                    "UpperRight Y =  " + upperRight.Y;

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

}
'The example shows how to intersect 2 envelopes. The result is put in the first envelope.

   Public Sub t_EnvIntersect()

        Dim pEnv1 As IEnvelope

        Dim pEnv2 As IEnvelope

        pEnv1 = New Envelope

        pEnv2 = New Envelope

        pEnv1.PutCoords(100, 100, 200, 200)

        pEnv2.PutCoords(150, 150, 250, 250)

        pEnv1.Intersect(pEnv2)

        Dim dXmin As Double, dYmin As Double, dXmax As Double, dYmax As Double

        pEnv1.QueryCoords(dXmin, dYmin, dXmax, dYmax)

        If pEnv1.IsEmpty Then

            MsgBox("envelope is empty")

        Else

            MsgBox(dXmin & "," & dYmin & "," & dXmax & "," & dYmax)

        End If

    End Sub

IEnvelope.LowerLeft Property

The lower left corner.

Public Property LowerLeft As IPoint
public IPoint LowerLeft {get; set;}

Remarks

Returns or sets the LowerLeft point of an Envelope .

Envelope LowerLeft Example

private void printEnvelope(IEnvelope envelope)

    {

        IPoint lowerLeft = envelope.LowerLeft;

        IPoint lowerRight = envelope.LowerRight;

        IPoint upperLeft = envelope.UpperLeft;

        IPoint upperRight = envelope.UpperRight;

        String report = "LowerLeft  X  = " + lowerLeft.X + "\n" +

                        "LowerLeft  Y  = " + lowerLeft.Y + "\n\n" +

                        "LowerRight X = " + lowerRight.X + "\n" +

                        "LowerRight Y = " + lowerRight.Y + "\n\n" +

                        "UpperLeft  X  = " + upperLeft.X + "\n" +

                        "UpperLeft  Y  = " + upperLeft.Y + "\n\n" +

                        "UpperRight X = " + upperRight.X + "\n" +

                        "UpperRight Y = " + upperRight.Y;



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

    }

IEnvelope.LowerRight Property

The lower right corner.

Public Property LowerRight As IPoint
public IPoint LowerRight {get; set;}

Description

private void printEnvelope(IEnvelope envelope){IPoint lowerLeft = envelope.LowerLeft;IPoint lowerRight = envelope.LowerRight;IPoint upperLeft = envelope.UpperLeft;IPoint upperRight = envelope.UpperRight;

String report = "LowerLeft X = " + lowerLeft.X + "\n" +"LowerLeft Y = " + lowerLeft.Y + "\n\n" +"LowerRight X = " + lowerRight.X + "\n" +"LowerRight Y = " + lowerRight.Y + "\n\n" +"UpperLeft X = " + upperLeft.X + "\n" +"UpperLeft Y = " + upperLeft.Y + "\n\n" +"UpperRight X = " + upperRight.X + "\n" +"UpperRight Y = " + upperRight.Y;

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

Remarks

Returns or sets the LowerRight point of an Envelope .

Envelope LowerRight Example

public void Driver()

{

   IEnvelope envelope = new EnvelopeClass();

   

   envelope.XMin = 0;

   envelope.YMin = 10;

   envelope.XMax = 20;

   envelope.YMax = 30;

   

   printEnvelope(envelope);

}

 

 private void printEnvelope(IEnvelope envelope)

 {

   IPoint lowerLeft = envelope.LowerLeft;

   IPoint lowerRight = envelope.LowerRight;

   IPoint upperLeft = envelope.UpperLeft;

   IPoint upperRight = envelope.UpperRight;

   

   String report = "LowerLeft  X  = " + lowerLeft.+ "\n" +

                   "LowerLeft  Y  = " + lowerLeft.+ "\n\n" +

                   "LowerRight X = "+ lowerRight.X   + "\n" +

                   "LowerRight Y = " + lowerRight.+ "\n\n" +

                   "UpperLeft  X  = " + upperLeft.+ "\n" +

                   "UpperLeft  Y  = " + upperLeft.+ "\n\n" +

                   "UpperRight X = "+ upperRight.X   + "\n" +

                   "UpperRight Y = "+ upperRight.Y;

 

  

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

 }

IEnvelope.MinMaxAttributes Property

A reference to the attribute structures for this envelope.

Public Property MinMaxAttributes As IntPtr
public IntPtr MinMaxAttributes {get; set;}

IEnvelope.MMax Property

The maximum measure value in the area of the envelope.

Public Property MMax As Double
public double MMax {get; set;}

Description

MMax is the maximum M value for the object owning the envelope.

The following C# code shows how to read and write the MMax value:

 IEnvelope env = new EnvelopeClass() as IEnvelope;

env.MMax = 2;

 double mMax;

mMax = env.MMax;

IEnvelope.MMin Property

The minimum measure value in the area of the envelope.

Public Property MMin As Double
public double MMin {get; set;}

Description

MMin is the minimum M value for the object owning the envelope.




 
The following C# code shows how to read and write the MMin value:

 IEnvelope env = new EnvelopeClass() as IEnvelope;

env.MMin = 2;

 double mMin;

mMin = env.MMin;

IEnvelope.Offset Method

Moves the sides x units horizontally and y units vertically.

Public Sub Offset ( _
    ByVal X As Double, _
    ByVal Y As Double _
)
public void Offset (
    double X,
    double Y
);

Description

Offset moves the position of the Envelope. A positive X value will shift the Envelope to the right and a negative value to the left. A positive Y value will shift the Envelope up and a negative value down. The Width and Height of the Envelope remain unchanged. Only the XMin, YMin, XMax, and YMax are changed.

Remarks

The new position of the Envelope is as follows:

new XMin= old XMin + Xnew YMin = old YMin + Ynew XMax = old XMax + Xnew YMax = old YMax + Y

Envelope Offset Example

private void SetOffset()

        {

            IEnvelope envelope = new EnvelopeClass();

            envelope.PutCoords(100, 100, 200, 200);

            String report1 = "Envelope before setting offset: \n" +

                             "LowerLeft  X = " + envelope.LowerLeft.X + "\n" +

                             "LowerLeft  Y = " + envelope.LowerLeft.Y + "\n\n" +

                             "LowerRight X =  " + envelope.LowerRight.X + "\n" +

                             "LowerRight Y =  " + envelope.LowerRight.Y + "\n\n" +

                             "UpperLeft  X = " + envelope.UpperLeft.X + "\n" +

                             "UpperLeft  Y = " + envelope.UpperLeft.Y + "\n\n" +

                             "UpperRight X =  " + envelope.UpperRight.X + "\n" +

                             "UpperRight Y =  " + envelope.UpperRight.Y;

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

            //offsets envelope by 10 units in the X direction and 20 in the Y direction. 

            envelope.Offset(10, 20);

            String report2 = "Envelope after setting offset: \n" +

                             "LowerLeft  X = " + envelope.LowerLeft.X + "\n" +

                             "LowerLeft  Y = " + envelope.LowerLeft.Y + "\n\n" +

                             "LowerRight X =  " + envelope.LowerRight.X + "\n" +

                             "LowerRight Y =  " + envelope.LowerRight.Y + "\n\n" +

                             "UpperLeft  X = " + envelope.UpperLeft.X + "\n" +

                             "UpperLeft  Y = " + envelope.UpperLeft.Y + "\n\n" +

                             "UpperRight X =  " + envelope.UpperRight.X + "\n" +

                             "UpperRight Y =  " + envelope.UpperRight.Y;

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

        }
Dim env As ESRI.ArcGIS.Geometry.IEnvelope

        env = New ESRI.ArcGIS.Geometry.Envelope

        env.PutCoords(100, 100, 200, 200)

        env.Offset(10, 20)

IEnvelope.OffsetM Method

Moves the sides m units.

Public Sub OffsetM ( _
    ByVal M As Double _
)
public void OffsetM (
    double M
);

Description

OffsetM shifts the M values for the Envelope. None of the other properties are changed.

Remarks

new MMin = old MMin + Mnew MMax = old MMax + M

IEnvelope.OffsetZ Method

Moves the sides z units.

Public Sub OffsetZ ( _
    ByVal Z As Double _
)
public void OffsetZ (
    double Z
);

Description

OffsetZ shifts the Z attributes of the Envelope. The Depth remains unchanged.

Remarks

new ZMin = old ZMin + Znew ZMax = old ZMax + Z
public static void TestOffsetZ()

          {

              const double Offset = 14.928;

  

              IEnvelope2 envelope = GetEnvelopeGeometry() as IEnvelope2;

  

              double beforeXMin, beforeXMax, beforeYMin, beforeYMax;

              envelope.QueryCoords(out beforeXMin, out beforeYMin, out beforeXMax, out beforeYMax);

  

              double beforeZMin, beforeZMax;

              envelope.QueryZCoords(out beforeZMin, out beforeZMax);

  

              envelope.OffsetZ(Offset);

  

              double afterXMin, afterXMax, afterYMin, afterYMax;

              envelope.QueryCoords(out afterXMin, out afterYMin, out afterXMax, out afterYMax);

  

              double afterZMin, afterZMax;

              envelope.QueryZCoords(out afterZMin, out afterZMax);

  

              //beforeXMin = 3.33

              //beforeXMax = 13.33

              //beforeYMin = -10.864

              //beforeYMax = -0.864

              //beforeZMin = -3.972

              //beforeZMax = 6.028

   

              //afterXMin = 3.33

              //afterXMax = 13.33

              //afterYMin = -10.864

              //afterYMax = -0.864

              //afterZMin = 10.956

              //afterZMax = 20.956

         }

IEnvelope.PutCoords Method

Constructs an envelope from the coordinate values of lower, left and upper, right corners.

Public Sub PutCoords ( _
    ByVal XMin As Double, _
    ByVal YMin As Double, _
    ByVal XMax As Double, _
    ByVal YMax As Double _
)
public void PutCoords (
    double XMin,
    double YMin,
    double XMax,
    double YMax
);

Description

Defines an Envelope given the XMin, YMin, XMax, and YMax. If XMin > XMax or if YMin > YMax, the created Envelope uses the input values, but properly reassigns the Min and Max values.

Remarks

Envelope PutCoords Example

private void PutCoordinates()

{

    IEnvelope envelope = new EnvelopeClass();

    envelope.PutCoords(100, 100, 200, 200);

    String report = "Envelope\n" +

                     "LowerLeft  X = " + envelope.LowerLeft.X + "\n" +

                     "LowerLeft  Y = " + envelope.LowerLeft.Y + "\n\n" +

                     "LowerRight X =  " + envelope.LowerRight.X + "\n" +

                     "LowerRight Y =  " + envelope.LowerRight.Y + "\n\n" +

                     "UpperLeft  X = " + envelope.UpperLeft.X + "\n" +

                     "UpperLeft  Y = " + envelope.UpperLeft.Y + "\n\n" +

                     "UpperRight X =  " + envelope.UpperRight.X + "\n" +

                     "UpperRight Y =  " + envelope.UpperRight.Y;

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

}
' The example shows how to move an Envelope to a new 

    ' center point (pPoint).

    'This example demonstrates how to use the IEnvelope::PutCoords method

    Public Function CreateEnvXY(ByVal dblXMin As Double, ByVal dblYMin As Double, _

    ByVal dblXMax As Double, ByVal dblYMax As Double) As IEnvelope

        CreateEnvXY = New Envelope

        CreateEnvXY.PutCoords(dblXMin, dblYMin, dblXMax, dblYMax)

    End Function

IEnvelope.PutWKSCoords Method

Copies e's dimensions into this envelope.

Public Sub PutWKSCoords ( _
    ByRef e As WKSEnvelope _
)
public void PutWKSCoords (
    ref WKSEnvelope e
);

IEnvelope.QueryCoords Method

Returns the coordinates of lower, left and upper, right corners.

Public Sub QueryCoords ( _
    ByRef XMin As Double, _
    ByRef YMin As Double, _
    ByRef XMax As Double, _
    ByRef YMax As Double _
)
public void QueryCoords (
    ref double XMin,
    ref double YMin,
    ref double XMax,
    ref double YMax
);

Description

Returns the XMin, YMin, XMax, and YMax values for the Envelope. These values can also be used to recreate the Envelope using PutCoords.

The following C# Code shows how to query for the XMin, YMin, XMax and YMax coordinates.

private void QueryCoordinates()

 {

     IEnvelope envelope = new EnvelopeClass();

     envelope.PutCoords(100, 100, 200, 200);

     double minX;

     double minY;

     double maxX;

     double maxY;

     envelope.QueryCoords(out minX, out minY, out maxX, out maxY);

     String report = " \n" +

                      "LowerLeft  X =  " + minX + "\n" +

                      "LowerLeft  Y =  " + minY + "\n\n" +

                      "LowerRight X =  " + maxX + "\n" +

                      "LowerRight Y =  " + minY + "\n\n" +

                      "UpperLeft  X =  " + minX + "\n" +

                      "UpperLeft  Y =  " + maxY + "\n\n" +

                      "UpperRight X =  " + maxY + "\n" +

                      "UpperRight Y =  " + maxY;

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

}
' Given the Envelope m_pEnveLope the QueryCoords method returns the values

     ' of the min and max coordinates.

    Private Sub QueryCoords(ByRef m_pEnvelope As IEnvelope)

         Dim dXmin As Double, dYmin As Double, dXmax As Double, dYmax As Double

         m_pEnvelope.QueryCoords(dXmin, dYmin, dXmax, dYmax)

     End Sub

IEnvelope.QueryWKSCoords Method

Copies the left, bottom, right and top sides into e.

Public Sub QueryWKSCoords ( _
    ByRef e As WKSEnvelope _
)
public void QueryWKSCoords (
    ref WKSEnvelope e
);

IEnvelope.Union Method

Adjusts to overlap inEnvelope.

Public Sub Union ( _
    ByVal inEnvelope As IEnvelope _
)
public void Union (
    IEnvelope inEnvelope
);

Description

Sets the Envelope equal to the union of the base Envelope and the input Envelope. The XMin and YMin of the resulting Envelope is the minimum XMin and YMin respectively between the base and input Envelopes, and the XMax and YMax of the resulting Envelope is the maximum XMax and YMax respectively between the base and input Envelopes.

Remarks

Envelope Union Example

public void Union()

{

    IEnvelope envelope1 = new EnvelopeClass();

    IEnvelope envelope2 = new EnvelopeClass();

    envelope1.PutCoords(100, 100, 200, 200);

    envelope2.PutCoords(150, 150, 250, 250);

    envelope1.Union(envelope2);

    IPoint lowerLeft = envelope1.LowerLeft;

    IPoint lowerRight = envelope1.LowerRight;

    IPoint upperLeft = envelope1.UpperLeft;

    IPoint upperRight = envelope1.UpperRight;

    String report = "LowerLeft  X = " + lowerLeft.X + "\n" +

                    "LowerLeft  Y = " + lowerLeft.Y + "\n\n" +

                    "LowerRight X =  " + lowerRight.X + "\n" +

                    "LowerRight Y =  " + lowerRight.Y + "\n\n" +

                    "UpperLeft  X = " + upperLeft.X + "\n" +

                    "UpperLeft  Y = " + upperLeft.Y + "\n\n" +

                    "UpperRight X =  " + upperRight.X + "\n" +

                    "UpperRight Y =  " + upperRight.Y;

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

}
' The example shows a union of 2 envelopes. The result is put in the first

    ' envelope and it will have the extent of both envelopes (100,100,250,250).

    Public Sub t_EnvUnion()

        Dim pEnv1 As IEnvelope

        Dim pEnv2 As IEnvelope

        pEnv1 = New Envelope

        pEnv2 = New Envelope

        pEnv1.PutCoords(100, 100, 200, 200)

        pEnv2.PutCoords(150, 150, 250, 250)

        pEnv1.Union(pEnv2)

        Dim dXmin As Double, dYmin As Double, dXmax As Double, dYmax As Double

        pEnv1.QueryCoords(dXmin, dYmin, dXmax, dYmax)

    End Sub

IEnvelope.UpperLeft Property

The upper left corner.

Public Property UpperLeft As IPoint
public IPoint UpperLeft {get; set;}

Remarks

Returns or sets the UpperLeft point of an Envelope .

Envelope UpperLeft Example

private void printEnvelope(IEnvelope envelope)

    {

        IPoint lowerLeft = envelope.LowerLeft;

        IPoint lowerRight = envelope.LowerRight;

        IPoint upperLeft = envelope.UpperLeft;

        IPoint upperRight = envelope.UpperRight;

        String report = "LowerLeft  X  = " + lowerLeft.X + "\n" +

                        "LowerLeft  Y  = " + lowerLeft.Y + "\n\n" +

                        "LowerRight X = " + lowerRight.X + "\n" +

                        "LowerRight Y = " + lowerRight.Y + "\n\n" +

                        "UpperLeft  X  = " + upperLeft.X + "\n" +

                        "UpperLeft  Y  = " + upperLeft.Y + "\n\n" +

                        "UpperRight X = " + upperRight.X + "\n" +

                        "UpperRight Y = " + upperRight.Y;



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

    }

IEnvelope.UpperRight Property

The upper right corner.

Public Property UpperRight As IPoint
public IPoint UpperRight {get; set;}

Description

private void printEnvelope(IEnvelope envelope){IPoint lowerLeft = envelope.LowerLeft;IPoint lowerRight = envelope.LowerRight;IPoint upperLeft = envelope.UpperLeft;IPoint upperRight = envelope.UpperRight;

String report = "LowerLeft X = " + lowerLeft.X + "\n" +"LowerLeft Y = " + lowerLeft.Y + "\n\n" +"LowerRight X = " + lowerRight.X + "\n" +"LowerRight Y = " + lowerRight.Y + "\n\n" +"UpperLeft X = " + upperLeft.X + "\n" +"UpperLeft Y = " + upperLeft.Y + "\n\n" +"UpperRight X = " + upperRight.X + "\n" +"UpperRight Y = " + upperRight.Y;

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

Remarks

Returns or sets the UpperRight point of an Envelope .

Envelope UpperRight Example

public void Driver()

{

   IEnvelope envelope = new EnvelopeClass();

   

   envelope.XMin = 0;

   envelope.YMin = 10;

   envelope.XMax = 20;

   envelope.YMax = 30;

   

   printEnvelope(envelope);

}

 

 private void printEnvelope(IEnvelope envelope)

 {

   IPoint lowerLeft = envelope.LowerLeft;

   IPoint lowerRight = envelope.LowerRight;

   IPoint upperLeft = envelope.UpperLeft;

   IPoint upperRight = envelope.UpperRight;

   

   String report = "LowerLeft  X  = " + lowerLeft.+ "\n" +

                   "LowerLeft  Y  = " + lowerLeft.+ "\n\n" +

                   "LowerRight X = "+ lowerRight.X   + "\n" +

                   "LowerRight Y = " + lowerRight.+ "\n\n" +

                   "UpperLeft  X  = " + upperLeft.+ "\n" +

                   "UpperLeft  Y  = " + upperLeft.+ "\n\n" +

                   "UpperRight X = "+ upperRight.X   + "\n" +

                   "UpperRight Y = "+ upperRight.Y;

 

  

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

 }

IEnvelope.Width Property

The width of the envelope.

Public Property Width As Double
public double Width {get; set;}

Description

The Width of an Envelope is the horizonal span. The Width = XMax - XMin. Used to get or set the Width of a non-empty Envelope. If used to set the Width, the LowerLeft and UpperLeft points are preserved and the LowerRight and UpperRight points are repositioned accordingly.

Remarks

Envelope Width Example

IEnvelope.XMax Property

The position of the right side.

Public Property XMax As Double
public double XMax {get; set;}

Description

XMax is the right side coordinate of the envelope.

Remarks

Setting Xmax to a value smaller than Xmin will reverse Xmin and Xmax. Use PutCoords to avoid this behavior.

Envelope XMax Example

The following C# code shows how to get the XMax property from an envelope:

IEnvelope.XMin Property

The position of the left side.

Public Property XMin As Double
public double XMin {get; set;}

Description

XMinis the left side coordinate of the envelope.

Remarks

Setting Xmin to a value larger than Xmax will reverse Xmin and Xmax. Use PutCoords to avoid this behavior.

Envelope XMin Example

The following C# code shows how to get the XMin property from an envelope:

xMin = env.XMin;

IEnvelope.YMax Property

The position of the top.

Public Property YMax As Double
public double YMax {get; set;}

Description

YMax is the top coordinate of the envelope.

Remarks

Setting Ymax to a value smaller than Ymin will reverse Ymin and Ymax. Use PutCoords to avoid this behavior.

Envelope YMax Example

The following C# code shows how to get the YMax property from an envelope:

IEnvelope.YMin Property

The position of the bottom.

Public Property YMin As Double
public double YMin {get; set;}

Description

YMin is the bottom coordinate of the envelope.

Remarks

Setting Ymin to a value larger than Ymax will reverse Ymin and Ymax. Use PutCoords to avoid this behavior.

Envelope YMin Example

The following C# code shows how to get the YMin property of an envelope:

IEnvelope.ZMax Property

The maximum Z value in the area of the envelope.

Public Property ZMax As Double
public double ZMax {get; set;}

Description

ZMax defines the upper elevation boundary of the envelope.

Remarks

Envelope ZMax Example

The following C# code shows how to read and write the ZMax value:

 IEnvelope env = new EnvelopeClass() as IEnvelope;

env.ZMax = 2;

 double zMax;

zMax = env.ZMax;

IEnvelope.ZMin Property

The minimum Z value in the area of the envelope.

Public Property ZMin As Double
public double ZMin {get; set;}

Description

ZMin defines the lower elevation boundary of the envelope.

Remarks

Envelope ZMin Example

The following C# code shows how to read and write the ZMin value:

 IEnvelope env = new EnvelopeClass() as IEnvelope;

env.ZMin = 2;

 double zMin;

zMin = env.ZMin;

Inherited Interfaces

Interfaces Description
IGeometry Provides access to members that describe properties and behavior of all geometric objects.

Classes that implement IEnvelope

Classes Description
Envelope A rectangle with sides parallel to a coordinate system defining the extent of another geometry; optionally has min and max measure, height and ID attributes.
//The following C# code shows how to create an envelope from coordinates:

         IEnvelope env = new EnvelopeClass() as IEnvelope;

        env.PutCoords(-10, -5, 10, 5);

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