public LineSegment createLineSegment(Position startPoint, Position endPoint) throws MismatchedReferenceSystemException, MismatchedDimensionException { return getGeometryFactory().createLineSegment(startPoint, endPoint); }
public LineSegment createLineSegment(DirectPosition from, DirectPosition to) { return getGeometryFactory().createLineSegment(from, to); }
private Ring processBoundsToRing(Envelope bounds, LineSegment segment, final int D) { DirectPosition one = getPositionFactory().createDirectPosition(segment.getStartPoint().getCoordinate()); one.setOrdinate(D, bounds.getMinimum(D)); DirectPosition two = getPositionFactory().createDirectPosition(segment.getEndPoint().getCoordinate()); two.setOrdinate(D, bounds.getMinimum(D)); DirectPosition three = getPositionFactory().createDirectPosition(two.getCoordinate()); three.setOrdinate(D, bounds.getMaximum(D)); DirectPosition four = getPositionFactory().createDirectPosition(one.getCoordinate()); four.setOrdinate(D, bounds.getMaximum(D)); LineSegment edge1 = getGeometryFactory().createLineSegment(one, two); LineSegment edge2 = getGeometryFactory().createLineSegment(two, three); LineSegment edge3 = getGeometryFactory().createLineSegment(three, four); LineSegment edge4 = getGeometryFactory().createLineSegment(four, one); List<OrientableCurve> edges = new ArrayList<OrientableCurve>(); edges.add(createCurve(Arrays.asList(edge1))); edges.add(createCurve(Arrays.asList(edge2))); edges.add(createCurve(Arrays.asList(edge3))); edges.add(createCurve(Arrays.asList(edge4))); return createRing(edges); }
private LineSegment processBoundsToSegment(Envelope bounds) { final int D = 0; CoordinateReferenceSystem crs = bounds.getCoordinateReferenceSystem(); CoordinateSystemAxis axis = crs.getCoordinateSystem().getAxis(D); DirectPosition positionA = getPositionFactory().createDirectPosition(null); DirectPosition positionB = getPositionFactory().createDirectPosition(null); if (axis.getDirection() != AxisDirection.OTHER) { positionA.setOrdinate(D, bounds.getMinimum(D)); positionB.setOrdinate(D, bounds.getMaximum(D)); } return getGeometryFactory().createLineSegment(positionA, positionB); }