double lon = sourcePos.getOrdinate(0); double lat = sourcePos.getOrdinate(1); Sample s = ss.getSample(lon, lat); if (s != null)
double x = point.getOrdinate(0); double y = point.getOrdinate(1); try { result = region.evaluate(point, values);
double lon = targetPos.getOrdinate(0); double lat = targetPos.getOrdinate(1);
double lon = sourcePos.getOrdinate(0); double lat = sourcePos.getOrdinate(1);
@Override public void expandToInclude(DirectPosition pt) { double x = pt.getOrdinate(0); double y = pt.getOrdinate(1); double z = pt.getDimension() >= 3 ? pt.getOrdinate(2) : Double.NaN; expandToInclude(x, y, z); } /**
/** Returns {@code true} if the provided location is contained by this bounding box. */ public boolean contains(DirectPosition pos) { ensureCompatibleReferenceSystem(pos); return contains(pos.getOrdinate(0), pos.getOrdinate(1), pos.getOrdinate(2)); }
/** * Expand to include the provided DirectPosition * * @param pt */ public void expandToInclude(DirectPosition pt) { Coordinate coordinate = new Coordinate(pt.getOrdinate(0), pt.getOrdinate(1)); expandToInclude(coordinate); } /** Include the provided envelope, expanding as necessary. */
public double getMedian(int dimension) { double lower = lowerCorner.getOrdinate(dimension); double upper = upperCorner.getOrdinate(dimension); return (upper + lower) / 2.0; }
/** * Returns {@code true} if the provided location is contained by this bounding box. * * @since 2.4 */ public boolean contains(DirectPosition pos) { ensureCompatibleReferenceSystem(pos); return super.contains(pos.getOrdinate(0), pos.getOrdinate(1)); }
public double getSpan(int dimension) { double lower = lowerCorner.getOrdinate(dimension); double upper = upperCorner.getOrdinate(dimension); return Math.abs(upper - lower); }
public boolean contains(DirectPosition location) { ensureCompatibleReferenceSystem(location); if (isEmpty()) { return false; } return location.getOrdinate(0) >= getMinX() && location.getOrdinate(0) <= getMaxX() && location.getOrdinate(1) >= getMinY() && location.getOrdinate(1) <= getMaxY(); }
/** * Set this coordinate to the specified direct position. If the specified position contains a * {@linkplain CoordinateReferenceSystem coordinate reference system}, then the CRS for this * position will be set to the CRS of the specified position. * * @param position The new position for this point. * @throws MismatchedDimensionException if this point doesn't have the expected dimension. */ public void setLocation(final DirectPosition position) throws MismatchedDimensionException { AbstractDirectPosition.ensureDimensionMatch("position", position.getDimension(), 1); setCoordinateReferenceSystem(position.getCoordinateReferenceSystem()); ordinate = position.getOrdinate(0); }
public void test2D() throws Exception { GML3MockData.element(GML.posList, document, document); document.getDocumentElement().setAttribute("srsDimension", "2"); document.getDocumentElement().setAttribute("count", "1"); document.getDocumentElement().appendChild(document.createTextNode("1.0 2.0 ")); DirectPosition[] dps = (DirectPosition[]) parse(); assertNotNull(dps); assertEquals(1, dps.length); assertTrue(dps[0] instanceof DirectPosition2D); assertEquals(1d, dps[0].getOrdinate(0), 0d); assertEquals(2d, dps[0].getOrdinate(1), 0d); }
public void test2D() throws Exception { GML3MockData.element(GML.pos, document, document); document.getDocumentElement().appendChild(document.createTextNode("1.0 2.0")); DirectPosition pos = (DirectPosition) parse(); assertNotNull(pos); assertTrue(pos instanceof DirectPosition2D); assertEquals(pos.getOrdinate(0), 1.0, 0); assertEquals(pos.getOrdinate(1), 2.0, 0); }
public void test1D() throws Exception { GML3MockData.element(GML.posList, document, document); document.getDocumentElement().setAttribute("srsDimension", "1"); document.getDocumentElement().setAttribute("count", "2"); document.getDocumentElement().appendChild(document.createTextNode("1.0 2.0 ")); DirectPosition[] dps = (DirectPosition[]) parse(); assertNotNull(dps); assertEquals(2, dps.length); assertTrue(dps[0] instanceof DirectPosition1D); assertTrue(dps[1] instanceof DirectPosition1D); assertEquals(1d, dps[0].getOrdinate(0), 0d); assertEquals(2d, dps[1].getOrdinate(0), 0d); }
public void test1D() throws Exception { GML3MockData.element(GML.pos, document, document); document.getDocumentElement().appendChild(document.createTextNode("1.0")); DirectPosition pos = (DirectPosition) parse(); assertNotNull(pos); assertTrue(pos instanceof DirectPosition1D); assertEquals(pos.getOrdinate(0), 1.0, 0); }
/** Tests the creation of the math transform from the factory. */ public void testMathTransform() throws FactoryException, TransformException { final MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null); final ParameterValueGroup p = mtFactory.getDefaultParameters("Earth gravitational model"); final MathTransform mt = mtFactory.createParameterizedTransform(p); DirectPosition pos = new GeneralDirectPosition(new double[] {45, 45, 1000}); pos = mt.transform(pos, pos); assertEquals(45.000, pos.getOrdinate(0), 0.001); assertEquals(45.000, pos.getOrdinate(1), 0.001); assertEquals(1001.515, pos.getOrdinate(2), 0.001); } }
public void testPoint3() throws Exception { String WKT = "POINT (260.01 -360.55)"; Object geometry = parser.parse(WKT); assertNotNull(geometry); assertTrue(geometry instanceof Point); Point point = (Point) geometry; assertEquals(260.01, point.getDirectPosition().getOrdinate(0), 0.0); assertEquals(-360.55, point.getDirectPosition().getOrdinate(1), 0.0); }
public void testPoint2() throws Exception { String WKT = "POINT (320.324 180.234)"; Object geometry = parser.parse(WKT); assertNotNull(geometry); assertTrue(geometry instanceof Point); Point point = (Point) geometry; assertEquals(320.324, point.getDirectPosition().getOrdinate(0), 0.0); assertEquals(180.234, point.getDirectPosition().getOrdinate(1), 0.0); }
public void testPoint1() throws Exception { String WKT = "POINT (80 340)"; Object geometry = parser.parse(WKT); assertNotNull(geometry); assertTrue(geometry instanceof Point); Point point = (Point) geometry; assertNotNull(point.getDirectPosition()); assertEquals(80, point.getDirectPosition().getOrdinate(0), 0.0); assertEquals(340, point.getDirectPosition().getOrdinate(1), 0.0); }