public Point createPoint(Position position) throws MismatchedReferenceSystemException, MismatchedDimensionException { if (position == null) { throw new NullPointerException(); } setCoordinateReferenceSystem(position.getDirectPosition().getCoordinateReferenceSystem()); DirectPosition copy = (DirectPosition) getPositionFactory() .createDirectPosition(position.getDirectPosition().getCoordinate()); return getPrimitiveFactory().createPoint(copy); }
/** * @param p0 */ public EnvelopeImpl(Position position) { this( position.getPosition() ); } /**
public Point createPoint(Position position) throws MismatchedReferenceSystemException, MismatchedDimensionException { return new MockPoint(position.getDirectPosition()); }
public DirectPositionImpl( Position position ){ this( position.getPosition() ); } /**
/** * Set the destination position in user coordinates, which doesn't need to be geographic. The * coordinate reference system is the one specified to the {@linkplain * #GeodeticCalculator(CoordinateReferenceSystem) constructor}. * * @param position The position in user coordinate reference system. * @throws TransformException if the position can't be transformed. * @since 2.2 */ public void setDestinationPosition(final Position position) throws TransformException { DirectPosition p = position.getDirectPosition(); if (userToGeodetic != null) { userToGeodetic.transform(p); p = userToGeodetic; } setDestinationGeographicPoint(p.getOrdinate(0), p.getOrdinate(1)); }
/** * Creates a point at the specified position. */ public Point createPoint(final Position position) { return new PointImpl(position.getPosition(), crs); }
/** * Set the starting position in user coordinates, which doesn't need to be geographic. The * coordinate reference system is the one specified to the {@linkplain * #GeodeticCalculator(CoordinateReferenceSystem) constructor}. * * @param position The position in user coordinate reference system. * @throws TransformException if the position can't be transformed. * @since 2.3 */ public void setStartingPosition(final Position position) throws TransformException { DirectPosition p = position.getDirectPosition(); if (userToGeodetic != null) { userToGeodetic.transform(p); p = userToGeodetic; } setStartingGeographicPoint(p.getOrdinate(0), p.getOrdinate(1)); }
public DirectPosition getStartPoint() { // ok /* Return DirectPosition of first Control Point */ return controlPoints.getFirst().getPosition(); }
/** * Returns the direct position of the given position, or {@code null} if none. */ private static DirectPosition position(final Position p) { return (p != null) ? p.getDirectPosition() : null; }
public DirectPosition getEndPoint() { // ok /* Return Direct Position of last Control Point */ return controlPoints.getLast().getPosition(); }
/** * Returns the direct position for the given position, or {@code null} if none. */ private static DirectPosition position(final Position p) { return (p != null) ? p.getDirectPosition() : null; }
public Position createPosition(Position position) { DirectPosition directPosition = position.getPosition(); return new DirectPositionImpl(directPosition); }
/** * Returns the direct position of the given position, or {@code null} if none. */ private static DirectPosition position(final Position p) { return (p != null) ? p.getDirectPosition() : null; }
public Position createPosition(Position position) { return new DirectPositionImpl( position.getPosition() ); }
/** * Creates a point at the specified position. */ public Point createPoint(final Position position) { return new PointImpl(position.getDirectPosition(), crs); }
private String pointArrayCoordToStringWithoutFirstCoord(PointArray pa) { String rString = ""; List<Position> positions = pa.positions(); if (positions.size() == 0) return ""; for (int i = 1; i < positions.size(); i++) { if (i > 1) { rString += ", "; } rString += directPositionToString(positions.get(i).getPosition()); } return rString; }
/** * Returns {@code true} if the given value is one of the source coordinates. * This method is fast on gridded data, but requires linear scan on non-gridded data. */ @Override public final boolean containsKey(final Object key) { return (key instanceof Position) && flatIndex(((Position) key).getDirectPosition()) >= 0; }
/** * Construct a new PointArray. This constructor does not create new position * objects. * * @param positions * */ public PointArrayImpl(List<Position> positions) { super( positions ); if (positions.size() == 0){ throw new IllegalArgumentException("Parameter positions is empty. Cannot create empty PointArray as we need the CRS"); } crs = getPosition(0).getPosition().getCoordinateReferenceSystem(); }
/** * Creates a point at the specified position. */ @Override public Point createPoint(final Position position) { return new JTSPoint(position.getDirectPosition(), crs); }
/** * @inheritDoc * @see org.opengis.geometry.coordinate.Factory#createLineString(java.util.List) */ public LineString createLineString(final List/*<Position>*/ points) { LineString result = new LineStringImpl(); PointArray pa = result.getControlPoints(); List list = pa; Iterator it = points.iterator(); while (it.hasNext()) { // Object o = it.next(); // if (o instanceof DirectPosition) { // list.add(o); // } else if (o instanceof Position) { // Position p = (Position) o; // DirectPosition dp = p.getPosition(); // /*if (dp == null) { // dp = p.getIndirect().getPosition(); // }*/ // list.add(dp); // } Position position = (Position) it.next(); DirectPosition directPosition = position.getPosition(); list.add(directPosition); } return result; }