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


IConstructDomainExtent.ConstructDomainExtent Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IC > IConstructDomainExtent Interface > IConstructDomainExtent.ConstructDomainExtent Method
ArcGIS Developer Help

IConstructDomainExtent.ConstructDomainExtent Method

Constructs a new envelope by expanding the input envelope about its center. Scale is typically a power of 10 indicating the number of sig figs to preserve. If its zero, the extent is expanded 1.5 times (subject to some constraints).

[Visual Basic .NET]
Public Function ConstructDomainExtent ( _
    ByVal extent As IEnvelope, _
    ByVal Scale As Double _
) As IEnvelope
[C#]
public IEnvelope ConstructDomainExtent (
    IEnvelope extent,
    double Scale
);
[C++]
HRESULT ConstructDomainExtent(
  IEnvelope* extent,
  double Scale
);
[C++]
Parameters
extent 

extent is a parameter of type IEnvelope* Scale
Scale is a parameter of type double

Product Availability

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

Remarks

The 'scale factor' parameter is typically a power of 10 that specifies the number of significant digits to preserve for coordinates associated with a spatial reference having as its domain the envelope constructed by this method. The constructed envelope has the same center as the input envelope and an extent determined by the scale factor and the version of the spatial reference associated with the input envelope. For example, with a scale factor of 10^5 and a version 9.2 spatial reference, the width/height of the constructed extent will be (2^53-2)/10^5 � 9.0 x 10^10 data units. With a pre 9.2 spatial reference, the constructed extent will be (2^31-2)/10^5 � 2.1 x 10^4 data units.

If the input scale factor is zero, a default output extent is calculated. Typically, that extent will be 1.5 times the maximum extent of the input envelope. The constructed extent will be intersected against the horizon envelope of the spatial reference of the input envelope's spatial reference. Also, if it is too large (> 10^7) the expansion factor will be reduced to 1.1.

The output envelope will have the same set of vertex attributes and spatial reference as the input envelope.

[C#]

//This example demonstrates how to use the ConstructDomainExtent method.
private void ConstructDomainExtent_ExampleDriver()
{
    //The precision corresponds to the extent.
    //So the InputEnvelope == OutputEnvelope
    IEnvelope testEnvelope1 = new EnvelopeClass();
    testEnvelope1.PutCoords(-10000, -10000, 11474.83645, 11474.83645);
    double testPrecision1 = 100000;
    String title1 = "Example1";
    ConstructDomainExtent_Example(testEnvelope1, testPrecision1, title1);
    //The extent is then adjusted to fit the precision.
    //The new extent is different from the input extent to adopt the input precision.
    IEnvelope testEnvelope2 = new EnvelopeClass();
    testEnvelope2.PutCoords(-10000, -10000, 11474.83645, 11474.83645);
    double testPrecision2 = 10000;
    String title2 = "Example2";
    ConstructDomainExtent_Example(testEnvelope2, testPrecision2, title2);
    //The precision doesn't correspond to the input extent and the input precision is 0.
    //The new extent is different from the input extent to adopt the input precision.
    IEnvelope testEnvelope3 = new EnvelopeClass();
    testEnvelope3.PutCoords(-10000, -10000, 11474.83645, 11474.83645);
    double testPrecision3 = 0;
    String title3 = "Example3";
    ConstructDomainExtent_Example(testEnvelope3, testPrecision3, title3);
}
private void ConstructDomainExtent_Example(IEnvelope inputExtend, double precsision, String title)
{
    IConstructDomainExtent constructDomainExtent = new GeometryEnvironmentClass();
    IEnvelope newExtent = constructDomainExtent.ConstructDomainExtent(inputExtend, precsision);
    ISpatialReference spatialReference = new UnknownCoordinateSystemClass();
    spatialReference.SetDomain(newExtent.XMin, newExtent.XMax, newExtent.YMin, newExtent.YMax);
    double falseX;
    double falseY;
    double xyUnits;
    spatialReference.GetFalseOriginAndUnits(out falseX, out falseY, out xyUnits);
    String report = title + "\n" +
                    "Input Extend \n" +
                    inputExtend.XMax + " , " + inputExtend.YMax + " , " + inputExtend.XMin + " , " + inputExtend.YMin + " \n " +
                    "Calculated envelope coordinates \n" +
                    newExtent.XMax + " , " + newExtent.YMax + " , " + newExtent.XMin + " , " + newExtent.YMin + " \n " +
                    "False X, False Y and XyUnits of the new created spatial reference \n" +
                    falseX + " , " + falseY + " , " + xyUnits;

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

[Visual Basic .NET]

    'This example demonstrates how to use the ConstructDomainExtent method
    Sub ConstructDomainExtent_Example()
        Dim pConstructDomainExtent As IConstructDomainExtent
        Dim pNewExtent As IEnvelope, dPrecision As Double
        Dim pExtent As IEnvelope, pspref As ISpatialReference
        Dim dx As Double, dy As Double, dxy As Double
        pConstructDomainExtent = New GeometryEnvironment
        pExtent = New Envelope
        '*********************************************************************
        '* Example 1: Default XYDomain value when creating a new feature class
        '* The precision corresponds to the extent.
        '*********************************************************************
        Debug.Print("*********** Example 1 ***********")
        Debug.Print("*Input Extent")
        Debug.Print("-10000, -10000, 11474.83645, 11474.83645")
        pExtent.PutCoords(-10000, -10000, 11474.83645, 11474.83645)
        dPrecision = 100000
        pNewExtent = pConstructDomainExtent.ConstructDomainExtent(pExtent, dPrecision)
        'Here since the input envelope corresponds to the precision
        'the ouput envelope is equal to the input envelope
        Debug.Print("*Calculated envelope coordinates")
        Debug.Print(pNewExtent.XMin & " , " & pNewExtent.XMax & " , " & pNewExtent.YMin & " , " & pNewExtent.YMax)
        'Create a new spatial reference and used the calculated envelope
        'to set the domain of it
        pspref = New UnknownCoordinateSystem
        pspref.SetDomain(pNewExtent.XMin, pNewExtent.XMax, pNewExtent.YMin, pNewExtent.YMax)
        'Print the precision of the new spatial reference
        pspref.GetFalseOriginAndUnits(dx, dy, dxy)
        Debug.Print("*False X, False Y and XyUnits of the new created spatial reference")
        Debug.Print(dx & " , " & dy & " , " & dxy)
        '*********************************************************************
        '* Example 2: The precision doesn't correspond to the input extent
        '* The extent is then adjusted to fit the precision
        '*********************************************************************
        Debug.Print("*********** Example 2 ***********")
        Debug.Print("*Input Extent")
        Debug.Print("-10000, -10000, 11474.83645, 11474.83645")
        pExtent.PutCoords(-10000, -10000, 11474.83645, 11474.83645)
        dPrecision = 10000
        pNewExtent = pConstructDomainExtent.ConstructDomainExtent(pExtent, dPrecision)
        Debug.Print("*Calculated envelope coordinates")
        'Here the new extent is different from the input extent to adopt the input precision
        Debug.Print(pNewExtent.XMin & " , " & pNewExtent.XMax & " , " & pNewExtent.YMin & " , " & pNewExtent.YMax)
        pspref = New UnknownCoordinateSystem
        pspref.SetDomain(pNewExtent.XMin, pNewExtent.XMax, pNewExtent.YMin, pNewExtent.YMax)
        pspref.GetFalseOriginAndUnits(dx, dy, dxy)
        Debug.Print("*False X, False Y and XyUnits of the new created spatial reference")
        Debug.Print(dx & " , " & dy & " , " & dxy)

        '*********************************************************************
        '* Example 3: The precision doesn't correspond to the input extent
        '* and the input precision is 0
        '*********************************************************************
        Debug.Print("*********** Example 3 ***********")
        Debug.Print("*Input Extent")
        Debug.Print("-10000, -10000, 11474.83645, 11474.83645")
        pExtent.PutCoords(-10000, -10000, 11474.83645, 11474.83645)
        dPrecision = 0
        pNewExtent = pConstructDomainExtent.ConstructDomainExtent(pExtent, dPrecision)
        Debug.Print("*Calculated envelope coordinates")
        'Here the new extent is different from the input extent to adopt the input precision
        Debug.Print(pNewExtent.XMin & " , " & pNewExtent.XMax & " , " & pNewExtent.YMin & " , " & pNewExtent.YMax)
        pspref = New UnknownCoordinateSystem
        pspref.SetDomain(pNewExtent.XMin, pNewExtent.XMax, pNewExtent.YMin, pNewExtent.YMax)
        pspref.GetFalseOriginAndUnits(dx, dy, dxy)
        Debug.Print("*False X, False Y and XyUnits of the new created spatial reference")
        Debug.Print(dx & " , " & dy & " , " & dxy)

    End Sub

See Also

IConstructDomainExtent Interface