public PointArray createPointArray(final double[] array, final int start, final int end) { PointArray pointArray = (PointArray) createPointArray(); for (int i=start; i<array.length && i <= end; i++) { pointArray.add(array[i]); } return pointArray; } public PointArray createPointArray() {
/** * Populates the specified PointArray with the specified points. Any and all preexisting * points in the PointArray will be overwritten. * @param pointArray The PointArray to be populated. This must not be null. * @param dps The new array of points */ public static void populatePointArray(PointArray pointArray, DirectPosition[] dps) { pointArray.clear(); int count = dps.length; for (int i = 0; i < count; i++) { pointArray.add(dps[i]); } }
/** * @inheritDoc * @see org.opengis.geometry.coordinate.Factory#createLineSegment(org.opengis.geometry.coordinate.Position, org.opengis.geometry.coordinate.Position) */ public LineSegment createLineSegment(final Position startPoint, final Position endPoint) { LineSegmentImpl line = new LineSegmentImpl(); line.getControlPoints().add( startPoint ); line.getControlPoints().add( endPoint ); return line; }
/** * @inheritDoc * @see org.opengis.geometry.coordinate.Factory#createLineSegment(org.opengis.geometry.coordinate.Position, org.opengis.geometry.coordinate.Position) */ public LineSegment createLineSegment(final Position startPoint, final Position endPoint) { LineSegmentImpl line = new LineSegmentImpl(); line.getControlPoints().add( startPoint ); line.getControlPoints().add( endPoint ); return line; }
public List createPositionList(double[] coordinates, int start, int end) { PointArray array = new PointArrayImpl( crs ); int N = crs.getCoordinateSystem().getDimension(); for( int i=start; i < end ; i += N ){ double[] ords = new double[N]; System.arraycopy( coordinates, i, ords, 0, N ); array.add( createDirectPosition( ords )); } return array; }
public List createPositionList(final double[] coordinates, final int start, final int end) { PointArray array = new JTSPointArray( crs ); int N = crs.getCoordinateSystem().getDimension(); for( int i=start; i < end ; i += N ){ double[] ords = new double[N]; System.arraycopy( coordinates, i, ords, 0, N ); array.add( createDirectPosition( ords )); } return array; }
public List createPositionList(float[] coordinates, int start, int end) { PointArray array = new PointArrayImpl( crs ); int N = crs.getCoordinateSystem().getDimension(); for( int i=start; i < end ; i += N ){ double[] ords = new double[N]; System.arraycopy( coordinates, i, ords, 0, N ); array.add( createDirectPosition( ords )); } return array; }
public List createPositionList(double[] coordinates, int start, int end) { PointArray array = new PointArrayImpl( crs ); int N = crs.getCoordinateSystem().getDimension(); for( int i=start; i < end ; i += N ){ double[] ords = new double[N]; System.arraycopy( coordinates, i, ords, 0, N ); array.add( createDirectPosition( ords )); } return array; }
public List createPositionList(float[] coordinates, int start, int end) { PointArray array = new PointArrayImpl( crs ); int N = crs.getCoordinateSystem().getDimension(); for( int i=start; i < end ; i += N ){ double[] ords = new double[N]; System.arraycopy( coordinates, i, ords, 0, N ); array.add( createDirectPosition( ords )); } return array; }
public PointArray createPointArray(float[] array, int start, int end) { PointArray pointArray = (PointArray) createPointArray(); int D = crs.getCoordinateSystem().getDimension(); if (D == 2) { for (int i = start; i < end; i += D) { double[] ordinates = new double[] { array[i], array[i + 1] }; pointArray.add(new DirectPositionImpl(crs, ordinates)); } } else if (D == 3) { for (int i = start; i < end; i += D) { double[] ordinates = new double[] { array[i], array[i + 1], array[i + 2] }; pointArray.add(new DirectPositionImpl(crs, ordinates)); } } else { for (int i = start; i < end; i += D) { double[] ordinates = new double[D]; for (int o = 0; i < D; i++) { ordinates[o] = array[i + o]; } pointArray.add(new DirectPositionImpl(crs, ordinates)); } } return pointArray; }
public List createPositionList(final float[] coordinates, final int start, final int end) { PointArray array = new JTSPointArray( crs ); int N = crs.getCoordinateSystem().getDimension(); for( int i=start; i < end ; i += N ){ double[] ords = new double[N]; System.arraycopy( coordinates, i, ords, 0, N ); array.add( createDirectPosition( ords )); } return array; }
public PointArray createPointArray(float[] array, int start, int end) { PointArray pointArray = (PointArray) createPointArray(); int D = crs.getCoordinateSystem().getDimension(); if (D == 2) { for (int i = start; i < end; i += D) { double[] ordinates = new double[] { array[i], array[i + 1] }; pointArray.add(new DirectPositionImpl(crs, ordinates)); } } else if (D == 3) { for (int i = start; i < end; i += D) { double[] ordinates = new double[] { array[i], array[i + 1], array[i + 2] }; pointArray.add(new DirectPositionImpl(crs, ordinates)); } } else { for (int i = start; i < end; i += D) { double[] ordinates = new double[D]; for (int o = 0; i < D; i++) { ordinates[o] = array[i + o]; } pointArray.add(new DirectPositionImpl(crs, ordinates)); } } return pointArray; }
public PointArray createPointArray(float[] array, int start, int end) { PointArray pointArray = (PointArray) createPointArray(); int D = crs.getCoordinateSystem().getDimension(); if (D == 2) { for (int i = start; i < end; i += D) { double[] ordinates = new double[] { array[i], array[i + 1] }; pointArray.add(new DirectPositionImpl(crs, ordinates)); } } else if (D == 3) { for (int i = start; i < end; i += D) { double[] ordinates = new double[] { array[i], array[i + 1], array[i + 2] }; pointArray.add(new DirectPositionImpl(crs, ordinates)); } } else { for (int i = start; i < end; i += D) { double[] ordinates = new double[D]; for (int o = 0; i < D; i++) { ordinates[o] = array[i + o]; } pointArray.add(new DirectPositionImpl(crs, ordinates)); } } return pointArray; }
/** * @param coordLists * @param lineStrings * @return Collection<LineStringImpl> */ public Collection<LineStringImpl> createLineStrings( Collection<List<double[]>> coordLists, List<LineStringImpl> lineStrings) { if (lineStrings == null) lineStrings = new ArrayList<LineStringImpl>(coordLists.size()); //GeometryFactoryImpl cf = this.geometryFactory.getGeometryFactoryImpl(); double startPar = 0.0; for (List<double[]> coordList : coordLists) { //List<Position> positions = cf.createPositions(coordList, null); PointArray positions = positionFactory.createPointArray(); for (double[] coords : coordList) { positions.add(createPosition(coords)); } PointArrayImpl pai = createPointArray(positions); lineStrings.add(createLineString(pai, startPar)); startPar += pai.getDistanceSum(); } return lineStrings; }
public JTSRing getJTSRing() { final List<Double> values; if (posList != null) { values = posList.getValue(); } else if (coordinates != null) { values = coordinates.getValues(); } else { values = new ArrayList<Double>(); } final JTSLineString line = new JTSLineString(); for (int i = 0; i < values.size() - 1; i = i + 2) { double x = values.get(i); double y = values.get(i + 1); final DirectPosition pos = new GeneralDirectPosition(x, y); line.getControlPoints().add(pos); } JTSCurve curve = new JTSCurve(); curve.getSegments().add(line); JTSRing ring = new JTSRing(); ring.getElements().add(curve); return ring; }
public PointArray createPointArray(final double[] array, final int start, final int end) { PointArray pointArray = (PointArray) createPointArray(); int n = crs.getCoordinateSystem().getDimension(); double[] ordinates = new double[n]; for (int i=start; i<array.length && i <= end; i += n) { for ( int j = i; j < i + n; j++ ) { ordinates[j-i] = array[j]; } pointArray.add(createDirectPosition(ordinates)); } return pointArray; } public PointArray createPointArray() {
public PointArray createPointArray(final double[] array, final int start, final int end) { PointArray pointArray = (PointArray) createPointArray(); int n = crs.getCoordinateSystem().getDimension(); double[] ordinates = new double[n]; for (int i=start; i<array.length && i <= end; i += n) { for ( int j = i; j < i + n; j++ ) { ordinates[j-i] = array[j]; } pointArray.add(createDirectPosition(ordinates)); } return pointArray; } public PointArray createPointArray() {
/** * @inheritDoc * @see org.opengis.geometry.primitive.CurveSegment#reverse() */ public CurveSegment reverse() { LineStringImpl result = new LineStringImpl(); PointArray pa = result.getSamplePoints(); int n = controlPoints.size(); for (int i=n-1; i>=0; i--) { pa.add(new DirectPositionImpl(controlPoints.get(i).getDirectPosition())); } return result; }