/** * Returns the coordinate dimension of this <code>Geometry</code> * <p/> * <p>The coordinate dimension is the number of components in the coordinates of the points in * this <code>Geometry</code>. </p> * * @return the coordinate dimension */ public int getCoordinateDimension() { return getPositions().getCoordinateDimension(); }
protected Double[] convertPositionSequence(PositionSequence<?> coordinates) { int dim = coordinates.getCoordinateDimension(); if (dim > 4) { throw new IllegalArgumentException("Dim parameter value cannot be greater than 4"); } final Double[] converted = new Double[coordinates.size() * dim]; LLAPositionVisitor visitor = new ToArrayVisitor(converted); coordinates.accept(visitor); return converted; }
private <P extends Position> boolean testPointSequenceEquality(PositionSequence<P> first, PositionSequence<P> second) { if (!first.getPositionClass().equals(second.getPositionClass())) return false; double[] c1 = new double[first.getCoordinateDimension()]; double[] c2 = new double[second.getCoordinateDimension()]; for (int idx = 0; idx < first.size(); idx++) { first.getCoordinates(idx, c1); second.getCoordinates(idx, c2); if(!this.positionEquality.equals(c1, c2)) return false; } return true; }
@Override public P next() { double[] coordinates = new double[sequence.getCoordinateDimension()]; if (hasNext()){ sequence.getCoordinates(index++, coordinates); return Positions.mkPosition(sequence.getPositionClass(), coordinates); } throw new NoSuchElementException(); }
private <P extends Position> void addPointList(PositionSequence<P> points) { addStartList(); double[] coords = new double[points.getCoordinateDimension()]; for (int i = 0; i < points.size(); i++) { if (i > 0) { addDelimiter(); } points.getCoordinates(i, coords); addPoint(coords); } addEndList(); }
source.getCoordinateDimension(), factory.getCoordinateDimension() )];