Package javax.measure.unit

Examples of javax.measure.unit.Unit


        final DirectPosition lowerCorner = envelope.getLowerCorner();
        final DirectPosition upperCorner = envelope.getUpperCorner();
       
        final CoordinateSystem cs = getCRS(envelope).getCoordinateSystem();
        final int xIndex = getDirectedAxisIndex(cs, AxisDirection.EAST);
        final Unit xUnit = getDirectedAxisUnit(cs, AxisDirection.EAST);
        final int yIndex = getDirectedAxisIndex(cs, AxisDirection.NORTH);
        final Unit yUnit = getDirectedAxisUnit(cs, AxisDirection.NORTH);
       
        //edited to use javax.measure.unit.Convertor
        UnitConverter xConverter = xUnit.getConverterTo(unit);
        UnitConverter yConverter = yUnit.getConverterTo(unit);
       
        returnable[0] = xConverter.convert(lowerCorner.getOrdinate(xIndex));
        returnable[1] = yConverter.convert(lowerCorner.getOrdinate(yIndex));
        returnable[2] = xConverter.convert(upperCorner.getOrdinate(xIndex));
        returnable[3] = yConverter.convert(upperCorner.getOrdinate(yIndex));
View Full Code Here


        final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs);
       
        final CoordinateSystem cs = crs.getCoordinateSystem();
       
        final int xIndex = getDirectedAxisIndex(cs, AxisDirection.EAST);
        final Unit xUnit = getDirectedAxisUnit(cs, AxisDirection.EAST);
        final int yIndex = getDirectedAxisIndex(cs, AxisDirection.NORTH);
        final Unit yUnit = getDirectedAxisUnit(cs, AxisDirection.NORTH);
       
        // HACK(jdc): need to determine the order of the axes...
        /*int[] indices = CSUtils.getDirectedAxisIndices(
                crs.getCoordinateSystem(),
                new AxisDirection[] { AxisDirection.EAST, AxisDirection.NORTH });*/
       
        //edited to use javax.measure.unit.Convertor
        UnitConverter xConverter = xUnit.getConverterTo(unit);
        UnitConverter yConverter = yUnit.getConverterTo(unit);
       
        double[] lowerOrdinates = new double[crs.getCoordinateSystem().getDimension()];
        lowerOrdinates[xIndex] = xConverter.convert(minx);
        lowerOrdinates[yIndex] = yConverter.convert(miny);
       
View Full Code Here

    private IntervalLength intervalLength1;
    private IntervalLength intervalLength2;

    @Before
    public void setUp() {
        Unit unit1 = SI.SECOND, unit2 = SI.SECOND.times(3600);
        int radix1 = 10, radix2 = 10;
        int factor1 = 3, factor2 = 6;
        int value1 = 7, value2 = 12;
        intervalLength1 = new DefaultIntervalLength(unit1, radix1, factor1, value1);
        intervalLength2 = new DefaultIntervalLength(unit2, radix2, factor2, value2);
View Full Code Here

    /**
     * Test of getUnit method, of class DefaultIntervalLength.
     */
    @Test
    public void testGetUnit() {
        Unit result = intervalLength1.getUnit();
        assertFalse(intervalLength2.getUnit().equals(result));
    }
View Full Code Here

        {
            return;
        }

        UOMsType uoMsType = Wps10FactoryImpl.eINSTANCE.createUOMsType();
        Unit newValue = Unit.valueOf("m");
        EMFUtils.add(uoMsType, "UOM", newValue);

        // uoMsType.eSet(Wps10Package.UO_MS_TYPE__UOM, newValue);
    }
View Full Code Here

  private static GridSampleDimension getSampleDimension(final int max,
      final int min) {
    // Create the SampleDimension, with colors and byte transformation
    // needed for visualization
    UnitFormat unitFormat = UnitFormat.getInstance();
    Unit uom = null;

    try {
      // unit of measure is meter
      uom = (Unit) unitFormat.parseObject("m");
    } catch (ParseException ex1) {
View Full Code Here

        for (int i = 0; i < length; i++) {
            CoverageDimensionInfo dim = catalog.getFactory().createCoverageDimension();
            dim.setName(sampleDimensions[i].getDescription().toString(Locale.getDefault()));

            StringBuilder label = new StringBuilder("GridSampleDimension".intern());
            final Unit uom = sampleDimensions[i].getUnits();

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

            }
            MathTransform crsTransform = CRS.findMathTransform(crs, epsg4326);

            FeatureCollection results = FeatureCollections.newCollection();
            FeatureType targetFeatureType = createTargetFeatureType(featureCollection.getSchema());
            Unit fromUnit = SI.METER;
            Unit toUnit = Unit.valueOf("mi");
            UnitConverter unitConvert = fromUnit.getConverterTo(toUnit);
            Feature nearestFeature = null;
            double nearestDistance = 9e9;
            double nearestBearing = 0;
            Iterator featureIterator = null;
View Full Code Here

            }
            MathTransform crsTransform = CRS.findMathTransform(crs, epsg4326);

            FeatureCollection results = FeatureCollections.newCollection();
            FeatureType targetFeatureType = createTargetFeatureType(featureCollection.getSchema());
            Unit fromUnit = SI.METER;
            Unit toUnit = Unit.valueOf("mi");
            UnitConverter unitConvert = fromUnit.getConverterTo(toUnit);
            Feature nearestFeature = null;
            double nearestDistance = 9e9;
            double nearestBearing = 0;
            Iterator featureIterator = null;
View Full Code Here

        if (crs != null) {
            CoordinateReferenceSystem hor = CRS.getHorizontalCRS(crs);
            if (hor instanceof GeographicCRS) {
                generator = new GeographicGenerator(center, quadrantSegments, crs);
            } else {
                Unit unit = hor.getCoordinateSystem().getAxis(0).getUnit();
                UnitConverter converter = SI.METER.getConverterTo(unit);
                generator = new MetricGenerator(center, quadrantSegments, converter);
            }
        } else {
            generator = new MetricGenerator(center, quadrantSegments, UnitConverter.IDENTITY);
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.