Package javax.measure.unit

Examples of javax.measure.unit.Unit


            GridSampleDimension sd = sampleDimensions[i];
            String name = sd.getDescription().toString(Locale.getDefault());
            dim.setName(name);

            StringBuilder label = new StringBuilder("GridSampleDimension".intern());
            final Unit uom = sd.getUnits();

            String uName = name.toUpperCase();
            if (uom != null) {
                label.append("(".intern());
                parseUOM(label, uom);
                label.append(")".intern());
                dim.setUnit(uom.toString());
            } else if(uName.startsWith("RED") || uName.startsWith("GREEN") || uName.startsWith("BLUE")) {
                // radiance in SI
                dim.setUnit("W.m-2.Sr-1");
            }
           
View Full Code Here


      return mt.doubleValue();
    }
   
    // let's get the target unit
    SingleCRS horizontalCRS = CRS.getHorizontalCRS(crs);
    Unit targetUnit;
    if(horizontalCRS != null) {
      // leap of faith, the first axis is an horizontal one (
      targetUnit = getFirstAxisUnit(horizontalCRS.getCoordinateSystem());
    } else {
      // leap of faith, the first axis is an horizontal one (
      targetUnit = getFirstAxisUnit(crs.getCoordinateSystem());
    }
   
    if((targetUnit != null && targetUnit == NonSI.DEGREE_ANGLE) || horizontalCRS instanceof GeographicCRS || crs instanceof GeographicCRS) {
      // assume we're working against a type of geographic crs, must estimate the degrees equivalent
      // to the measure, we are going to use a very rough estimate (cylindrical earth model)
      // TODO: maybe look at the layer bbox and get a better estimate computed at the center of the bbox
      UnitConverter converter = mt.getUnit().getConverterTo(SI.METER);
      double tolMeters = converter.convert(mt.doubleValue());
      return tolMeters * OGC_METERS_TO_DEGREES;
    } else if(targetUnit != null && targetUnit.isCompatible(SI.METER)) {
      // ok, we assume the target is not a geographic one, but we might
      // have to convert between meters and feet maybe
      UnitConverter converter = mt.getUnit().getConverterTo(targetUnit);
      return converter.convert(mt.doubleValue());
    } else {
View Full Code Here

            this.sampleDim = sampleDim;
            final List<Category> categories = sampleDim.getCategories();
            this.configuredRange = info.getRange();
            this.customCategories = categories;
            final String uom = info.getUnit();
            Unit defaultUnit = sampleDim.getUnits();
            Unit unit = defaultUnit;
            try {
                if (uom != null) {
                    unit = Unit.valueOf(uom);
                }
            } catch (IllegalArgumentException iae) {
View Full Code Here

            label.append(uomString);
        }

        private void buildDescription() {
            StringBuilder label = new StringBuilder("GridSampleDimension".intern());
            final Unit uom = sampleDim.getUnits();

            String uName = name.toUpperCase();
            if (uom != null) {
                label.append("(".intern());
                parseUOM(label, uom);
View Full Code Here

TOP

Related Classes of javax.measure.unit.Unit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.