IConstructDomainExtent Interface

Provides access to members that construct domain extents based on defined precision.

Members

Name Description
Method ConstructDomainExtent 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).
Method ConstructZMDomainExtent Constructs a low precision Z or M domain extent centered on the specified extent. scale is 1/(desired resolution). If scale is 0.0, a default of 1,000,000.0 is used.

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).

Public Function ConstructDomainExtent ( _
    ByVal extent As IEnvelope, _
    ByVal Scale As Double _
) As IEnvelope
public IEnvelope ConstructDomainExtent (
    IEnvelope extent,
    double Scale
);

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.

//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);

}
'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

IConstructDomainExtent.ConstructZMDomainExtent Method

Constructs a low precision Z or M domain extent centered on the specified extent. scale is 1/(desired resolution). If scale is 0.0, a default of 1,000,000.0 is used.

Public Sub ConstructZMDomainExtent ( _
    ByVal inMin As Double, _
    ByVal inMax As Double, _
    ByVal Scale As Double, _
    ByRef outMin As Double, _
    ByRef outMax As Double _
)
public void ConstructZMDomainExtent (
    double inMin,
    double inMax,
    double Scale,
    ref double outMin,
    ref double outMax
);
//This example demonstrates how to use ConstructZMDomainExtent method

static void ConstructZMDomainExtent()

{

    double inMin = 0;

    double inMax = 21474.83645;

    double precision = 100000;

    double outMin;

    double outMax;

    IConstructDomainExtent constructDomainExtent = new GeometryEnvironmentClass();

    constructDomainExtent.ConstructZMDomainExtent(inMin, inMax, precision, out outMin, out outMax);

    //The precision corresponds to the input interval therefore the output interval is equal to the input one

    String report = "Output Min and Max \n" +

                    outMin + " , " + outMax;

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

}
'This example demonstrates how to use ConstructZMDomainExtent method

    Sub ConstructZMDomainExtent()

        Dim pConstructDomainExtent As IConstructDomainExtent

        Dim dInMin As Double, dInMax As Double, dPrecision As Double

        Dim dOutMin As Double, dOutMax As Double

        pConstructDomainExtent = New GeometryEnvironment

        Debug.Print("*********** Example 1 ***********")

        Debug.Print("*Input Extent")

        Debug.Print("0, 21474.83645")

        dInMin = 0

        dInMax = 21474.83645

        dPrecision = 100000

        pConstructDomainExtent.ConstructZMDomainExtent(dInMin, dInMax, dPrecision, dOutMin, dOutMax)

        Debug.Print("*Output Min and Max")

        Debug.Print(dOutMin & " , " & dOutMax)

    End Sub

Classes that implement IConstructDomainExtent

Classes Description
GeometryEnvironment Provides a way of creating geometries from different inputs and setting/getting global variables for controlling behavior of geometry methods.

Remarks

The methods on this interface are typically used to define domain extents for data sources that cannot persist that information. For example, the domain extent of a shapefile is determined as follows: The XY domain extent is the square enclosing the horizon of the shapefile's spatial reference. If geometries in the shapefile have M or Z attributes, then the current minimum and maximum values for those attributes are used to construct corresponding domain extents.

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