Package javax.measure.unit

Examples of javax.measure.unit.Unit


    // citation
//    metadata.addGeoAscii(GeoTiffGCSCodes.GeogCitationGeoKey, unit
//        .toString());// unitFormat.labelFor(unit)

    Unit base = null;
    if (SI.METER.isCompatible(unit)) {
      base = SI.METER;
    } else if (SI.SECOND.isCompatible(unit)) {
      base = SI.SECOND;
    } else if (SI.RADIAN.isCompatible(unit)) {
View Full Code Here


     */
    public Object parse(InstanceComponent instance, Object value)
        throws Exception {
      //Object parseObject = UnitFormat.getInstance().parseObject((String) value);
        //Object parseObject = UnitFormat.getAsciiInstance().parseObject((String) value);
      Unit valueOf = lookup( (String) value );
        return valueOf;
    }
View Full Code Here

      Unit valueOf = lookup( (String) value );
        return valueOf;
    }
   
    private Unit lookup(String name) {
        Unit unit = lookup(SI.class, name);
        if (unit != null)
            return unit;

        unit = lookup(NonSI.class, name);
        if (unit != null)
View Full Code Here

        }
        return null;
    }

  private Unit lookup(Class class1, String name) {
    Unit unit = null;
    Field[] fields = class1.getDeclaredFields();
    for (int i=0; i<fields.length; i++) {
      Field field = fields[i];
      String name2 = field.getName();
      if ( (field.getType().isAssignableFrom(BaseUnit.class) ||
View Full Code Here

                final double semiMajorAxis     = getDouble(result, 3, code);
                final double inverseFlattening = result.getDouble( 4);
                final double semiMinorAxis     = result.getDouble( 5);
                final String unitCode          = getString(result, 6, code);
                final String remarks           = result.getString( 7);
                final Unit   unit              = buffered.createUnit(unitCode);
                final Map<String,Object> properties = createProperties(name, epsg, remarks);
                final Ellipsoid ellipsoid;
                if (inverseFlattening == 0) {
                    if (semiMinorAxis == 0) {
                        // Both are null, which is not allowed.
View Full Code Here

                final String epsg      = getString(result, 1, code);
                final String name      = getString(result, 2, code);
                final double longitude = getDouble(result, 3, code);
                final String unit_code = getString(result, 4, code);
                final String remarks   = result.getString( 5);
                final Unit unit        = buffered.createUnit(unit_code);
                final Map<String,Object> properties = createProperties(name, epsg, remarks);
                PrimeMeridian primeMeridian = factories.getDatumFactory().createPrimeMeridian(
                                              properties, longitude, unit);
                returnValue = ensureSingleton(primeMeridian, returnValue, code);
            }
View Full Code Here

            ResultSet result = stmt.executeQuery();
            while (result.next()) {
                final String epsg    = getString(result, 1, code);
                final String name    = getString(result, 2, code);
                final String remarks = result.getString( 3);
                final Unit   unit;
                final Class<?> type;
                /*
                 * Search for units. We will choose the most commonly used one in parameter values.
                 * If the parameter appears to have at least one non-null value in the "Parameter
                 * File Name" column, then the type is assumed to be URI. Otherwise, the type is a
View Full Code Here

        stmt.setInt(2, Integer.parseInt(operation));
        final ResultSet result = stmt.executeQuery();
        while (result.next()) {
            final String name  = getString(result, 1, operation);
            final double value = result.getDouble( 2);
            final Unit   unit;
            Object reference;
            if (result.wasNull()) {
                /*
                 * If no numeric values were provided in the database, then the values must
                 * appears in some external file. It may be a file to download from FTP.
View Full Code Here

                     * the case of Molodenski transforms, the axis length to set are the same.
                     */
                    if (isBursaWolf) try {
                        Ellipsoid ellipsoid = CRSUtilities.getHeadGeoEllipsoid(sourceCRS);
                        if (ellipsoid != null) {
                            final Unit axisUnit = ellipsoid.getAxisUnit();
                            parameters.parameter("src_semi_major").setValue(ellipsoid.getSemiMajorAxis(), axisUnit);
                            parameters.parameter("src_semi_minor").setValue(ellipsoid.getSemiMinorAxis(), axisUnit);
                            parameters.parameter("src_dim").setValue(sourceCRS.getCoordinateSystem().getDimension());
                        }
                        ellipsoid = CRSUtilities.getHeadGeoEllipsoid(targetCRS);
                        if (ellipsoid != null) {
                            final Unit axisUnit = ellipsoid.getAxisUnit();
                            parameters.parameter("tgt_semi_major").setValue(ellipsoid.getSemiMajorAxis(), axisUnit);
                            parameters.parameter("tgt_semi_minor").setValue(ellipsoid.getSemiMinorAxis(), axisUnit);
                            parameters.parameter("tgt_dim").setValue(targetCRS.getCoordinateSystem().getDimension());
                        }
                    } catch (ParameterNotFoundException exception) {
View Full Code Here

            return (speed * MILES_PER_HOUR_TO_KNOTS);
        }

        // ok let's try harder --> this is going to be slower
        try {
            Unit unit = (Unit) SpeedConverter.UCUM_FORMAT_INSTANCE.parseObject(uom);
            UnitConverter converter = unit.getConverterTo(NonSI.KNOT);
            return converter.convert(speed);
        } catch (Exception e) {
            throw new IllegalArgumentException("The supplied units isn't currently supported:"
                    + uom, e);
        }
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.