/** * Unlike pointValue(), this method does not enforce consistency between the CRS and coordinate dimensions. * This can be useful for testing. */ public static PointValue unsafePointValue( CoordinateReferenceSystem crs, double... coordinate ) { return new PointValue( crs, coordinate ); }
/** * Creates a PointValue, and enforces consistency between the CRS and coordinate dimensions. */ public static PointValue pointValue( CoordinateReferenceSystem crs, double... coordinate ) { if ( crs.getDimension() != coordinate.length ) { throw new IllegalArgumentException( format( "Cannot create point, CRS %s expects %d dimensions, but got coordinates %s", crs, crs.getDimension(), Arrays.toString( coordinate ) ) ); } return new PointValue( crs, coordinate ); }
@Override public void writePoint( CoordinateReferenceSystem crs, double[] coordinate ) { buffer.add( new PointValue( crs, coordinate ) ); }
public static PointValue point( Point point ) { // An optimization could be to do an instanceof PointValue check here // and in that case just return the casted argument. List<Double> coordinate = point.getCoordinate().getCoordinate(); double[] coords = new double[coordinate.size()]; for ( int i = 0; i < coords.length; i++ ) { coords[i] = coordinate.get( i ); } return new PointValue( crs( point.getCRS() ), coords ); }
/** * Unlike pointValue(), this method does not enforce consistency between the CRS and coordinate dimensions. * This can be useful for testing. */ public static PointValue unsafePointValue( CoordinateReferenceSystem crs, double... coordinate ) { return new PointValue( crs, coordinate ); }
/** * Creates a PointValue, and enforces consistency between the CRS and coordinate dimensions. */ public static PointValue pointValue( CoordinateReferenceSystem crs, double... coordinate ) { if ( crs.getDimension() != coordinate.length ) { throw new IllegalArgumentException( format( "Cannot create point, CRS %s expects %d dimensions, but got coordinates %s", crs, crs.getDimension(), Arrays.toString( coordinate ) ) ); } return new PointValue( crs, coordinate ); }
public static PointValue point( Point point ) { // An optimization could be to do an instanceof PointValue check here // and in that case just return the casted argument. List<Double> coordinate = point.getCoordinate().getCoordinate(); double[] coords = new double[coordinate.size()]; for ( int i = 0; i < coords.length; i++ ) { coords[i] = coordinate.get( i ); } return new PointValue( crs( point.getCRS() ), coords ); }