![]() |
This document is archived and information here might be outdated. Recommended version. |
Defines the envelope to cover all the points.
[Visual Basic .NET] Public Sub DefineFromPoints ( _ ByRef Points As IPoint[] _ )
[C#] public void DefineFromPoints ( ref IPoint[] Points );
[C++]
HRESULT DefineFromPoints(
SAFEARRAY(IPoint)** Points
);
[C++] Parameters Points
Points is a parameter of type SAFEARRAY(IPoint*)*
Please see the DefineFromPoints method of IEnvelope for more details
//This example demonstrates how to use the IEnvelopeGEN.DefineFromPoints method.
//IEnvelopeGEN is used because C# does not support C-Style Arrays used in IEnvelope.DefineFromPoints
public void EnvelopeDefineFromPointExample()
{
IPoint[] points = new IPoint[10];
for(int i = 0; i < 10; i++)
{
points[i] = new PointClass();
points[i].PutCoords(i* 10, i * 5);
}
IEnvelopeGEN envelope = new EnvelopeClass();
envelope.DefineFromPoints(ref points);
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); }
Public Sub EnvelopeDefineFromPointsArrayExample()
Dim pEnv As ESRI.ArcGIS.Geometry.IEnvelopeGEN
Dim pPoints(0 To 6) As ESRI.ArcGIS.Geometry.IPoint
pEnv = New ESRI.ArcGIS.Geometry.Envelope
pPoints(0) = New ESRI.ArcGIS.Geometry.Point
pPoints(1) = New ESRI.ArcGIS.Geometry.Point
pPoints(2) = New ESRI.ArcGIS.Geometry.Point
pPoints(3) = New ESRI.ArcGIS.Geometry.Point
pPoints(4) = New ESRI.ArcGIS.Geometry.Point
pPoints(5) = New ESRI.ArcGIS.Geometry.Point
pPoints(6) = New ESRI.ArcGIS.Geometry.Point
pPoints(0).PutCoords(5, 5)
pPoints(1).PutCoords(15, 30)
pPoints(2).PutCoords(10, 30)
pPoints(3).PutCoords(35, 50)
pPoints(4).PutCoords(20, 20)
pPoints(5).PutCoords(15, 40)
pPoints(6).PutCoords(45, 80)
pEnv.DefineFromPoints(pPoints)
End Sub