Class AreaUnit

    • Constructor Detail

      • AreaUnit

        public AreaUnit​(AreaUnitId unitId)
        Creates a new area unit from an AreaUnitId value. Use this constructor to create an instance of AreaUnit representing any of the most commonly used area units defined in the AreaUnitId enumeration.

        To use less common area units not available in the enumeration, call the Unit.fromUnitId(int) factory method passing in a well-known ID of an area unit.

        Parameters:
        unitId - the id of the area unit to create
        Since:
        100.0.0
        See Also:
        Unit.fromUnitId(int)
      • AreaUnit

        public AreaUnit​(LinearUnit linearUnit)
        Creates a new area unit based on the given LinearUnit. Use this method to find the units of area measurement for a 2D Geometry, by passing in the LinearUnits of the geometry's SpatialReference. For example, passing in a LinearUnit of type LinearUnitId.METERS will create an AreaUnit of type AreaUnitId.SQUARE_METERS.
        Parameters:
        linearUnit - the linear unit for which to create a new area unit instance
        Since:
        100.0.0
        See Also:
        LinearUnit(AreaUnit)
    • Method Detail

      • getAreaUnitId

        public AreaUnitId getAreaUnitId()
        Gets the AreaIUnitId value for the type of area units represented by this instance.
        Returns:
        the area unit ID
        Since:
        100.0.0
      • convertFrom

        public double convertFrom​(AreaUnit fromUnit,
                                  double area)
        Converts a value from the given units to the units of this instance.
        Parameters:
        fromUnit - the units to convert from
        area - the value to convert, in fromUnit units
        Returns:
        the value converted to the units represented by this instance
        Throws:
        java.lang.IllegalArgumentException - if fromUnit is null
        Since:
        100.0.0
        See Also:
        fromSquareMeters(double)
      • convertTo

        public double convertTo​(AreaUnit toUnit,
                                double area)
        Converts a value from the units of this instance to the given units.
        Parameters:
        toUnit - the units to convert the value to
        area - the value to convert, in the units represented by this instance
        Returns:
        the value converted to the toUnit units
        Throws:
        java.lang.IllegalArgumentException - if the toUnit is null
        Since:
        100.0.0
      • fromSquareMeters

        public double fromSquareMeters​(double area)
        Converts a value from square meters to the units of this instance. This is a convenience method for the common task of conversion of area measurements from square meters. Use the convertFrom(AreaUnit, double) method to convert values from other area units.
        Parameters:
        area - the value to convert, in square meters
        Returns:
        the value converted to the units represented by this instance
        Since:
        100.0.0
      • toSquareMeters

        public double toSquareMeters​(double area)
        Converts a value from the units of this instance to square meters. This is a convenience method for the common task of conversion of area measurements to square meters. Use the convertTo(AreaUnit, double) method to convert values to other area units.
        Parameters:
        area - the value to convert, in the units represented by this instance
        Returns:
        the value converted to square meters
        Since:
        100.0.0