Java Code Examples for org.locationtech.jts.geom.Point#getY()

The following examples show how to use org.locationtech.jts.geom.Point#getY() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PixelExtractionParametersForm.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
public Coordinate[] getCoordinates() {
    Coordinate[] coordinates = new Coordinate[coordinateTableModel.getRowCount()];
    for (int i = 0; i < coordinateTableModel.getRowCount(); i++) {
        final Placemark placemark = coordinateTableModel.getPlacemarkAt(i);
        SimpleFeature feature = placemark.getFeature();
        final Date dateTime = (Date) feature.getAttribute(Placemark.PROPERTY_NAME_DATETIME);
        final Coordinate.OriginalValue[] originalValues = PixExOp.getOriginalValues(feature);
        if (placemark.getGeoPos() == null) {
            final Point point = (Point) feature.getDefaultGeometry();
            coordinates[i] = new Coordinate(placemark.getName(), point.getY(), point.getX(),
                                            dateTime, originalValues);
        } else {
            coordinates[i] = new Coordinate(placemark.getName(), placemark.getGeoPos().getLat(),
                                            placemark.getGeoPos().getLon(), dateTime, originalValues);
        }
    }
    return coordinates;
}
 
Example 2
Source File: PixelInfoTopComponent.java    From snap-desktop with GNU General Public License v3.0 6 votes vote down vote up
private void snapToSelectedPin() {
    final Placemark pin = currentView != null ? currentView.getSelectedPin() : null;
    if (pin != null) {
        //todo [multisize_products] replace this very ugly code by using the scene raster transformer - tf 20151113
        PixelPos rasterPos = new PixelPos();
        final Point pinSceneCoords = (Point) pin.getFeature().getDefaultGeometry();
        final Point2D.Double pinSceneCoordsDouble = new Point2D.Double(pinSceneCoords.getX(), pinSceneCoords.getY());
        try {
            currentView.getRaster().getImageToModelTransform().createInverse().transform(pinSceneCoordsDouble, rasterPos);
        } catch (NoninvertibleTransformException e) {
            rasterPos = pin.getPixelPos();
        }
        final int x = MathUtils.floorInt(rasterPos.x);
        final int y = MathUtils.floorInt(rasterPos.y);
        pixelInfoView.updatePixelValues(currentView, x, y, 0, true);
    } else {
        pixelInfoView.updatePixelValues(currentView, -1, -1, 0, false);
    }
}
 
Example 3
Source File: GeometryUtil.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public static GeoPoint jtsPointToGeoPoint(Point p) {
  return new GeoPoint(p.getY(), p.getX());
}