use of javax.measure.quantity.Length in project uom-se by unitsofmeasurement.
the class NumberQuantityTest method testEqualityAtomic.
@Test
public void testEqualityAtomic() throws Exception {
Quantity<Length> value = Quantities.getQuantity(new AtomicInteger(10), Units.METRE);
Quantity<Length> anotherValue = Quantities.getQuantity(new AtomicLong(10), Units.METRE);
assertEquals(value, anotherValue);
}
use of javax.measure.quantity.Length in project uom-se by unitsofmeasurement.
the class DoubleQuantityTest method testEqualityFirstDouble.
@Test
public void testEqualityFirstDouble() throws Exception {
Quantity<Length> value = Quantities.getQuantity(new Double(10), Units.METRE);
Quantity<Length> anotherValue = Quantities.getQuantity(new Long(10), Units.METRE);
assertEquals(value, anotherValue);
}
use of javax.measure.quantity.Length in project indriya by unitsofmeasurement.
the class NumberQuantityTest method testEqualityAtomic.
@Test
public void testEqualityAtomic() throws Exception {
Quantity<Length> value = Quantities.getQuantity(new AtomicInteger(10), Units.METRE);
Quantity<Length> anotherValue = Quantities.getQuantity(new AtomicLong(10), Units.METRE);
assertEquals(value, anotherValue);
}
use of javax.measure.quantity.Length in project sis by apache.
the class FranceGeocentricInterpolationTest method testGridAsFloats.
/**
* Tests a small grid file with interpolations in geocentric coordinates as {@code float} values.
*
* <p>This method is part of a chain.
* The next method is {@link #testGridAsShorts(DatumShiftGridFile)}.</p>
*
* @return the loaded grid with values as {@code float}.
* @throws URISyntaxException if the URL to the test file can not be converted to a path.
* @throws IOException if an error occurred while loading the grid.
* @throws FactoryException if an error occurred while computing the grid.
* @throws TransformException if an error occurred while computing the envelope.
*/
@TestStep
private static DatumShiftGridFile<Angle, Length> testGridAsFloats() throws URISyntaxException, IOException, FactoryException, TransformException {
final Path file = getResource(TEST_FILE);
final DatumShiftGridFile.Float<Angle, Length> grid;
try (BufferedReader in = Files.newBufferedReader(file)) {
grid = FranceGeocentricInterpolation.load(in, file);
}
assertEquals("cellPrecision", 0.005, grid.getCellPrecision(), STRICT);
assertEquals("getCellMean", 168.2587, grid.getCellMean(0), 0.0001);
assertEquals("getCellMean", 58.7163, grid.getCellMean(1), 0.0001);
assertEquals("getCellMean", -320.1801, grid.getCellMean(2), 0.0001);
verifyGrid(grid);
return grid;
}
use of javax.measure.quantity.Length in project com.revolsys.open by revolsys.
the class ShapeMarker method render.
@Override
public void render(final Viewport2D viewport, final Graphics2D graphics, final MarkerStyle style, final double modelX, final double modelY, double orientation) {
final AffineTransform savedTransform = graphics.getTransform();
try {
final Quantity<Length> markerWidth = style.getMarkerWidth();
final double mapWidth = Viewport2D.toDisplayValue(viewport, markerWidth);
final Quantity<Length> markerHeight = style.getMarkerHeight();
final double mapHeight = Viewport2D.toDisplayValue(viewport, markerHeight);
final String orientationType = style.getMarkerOrientationType();
if ("none".equals(orientationType)) {
orientation = 0;
}
translateMarker(viewport, graphics, style, modelX, modelY, mapWidth, mapHeight, orientation);
final AffineTransform shapeTransform = AffineTransform.getScaleInstance(mapWidth, mapHeight);
final Shape newShape = new GeneralPath(this.getShape()).createTransformedShape(shapeTransform);
if (style.setMarkerFillStyle(viewport, graphics)) {
graphics.fill(newShape);
}
if (style.setMarkerLineStyle(viewport, graphics)) {
graphics.draw(newShape);
}
} finally {
graphics.setTransform(savedTransform);
}
}
Aggregations