/** * Initializes the points, avoiding recomputing the distance. * @param p0 * @param p1 * @param distance the distance between p0 and p1 */ private void initialize(Coordinate p0, Coordinate p1, double distance) { pt[0].setCoordinate(p0); pt[1].setCoordinate(p1); this.distance = distance; isNull = false; }
/** * Initializes the points, avoiding recomputing the distance. * @param p0 * @param p1 * @param distance the distance between p0 and p1 */ private void initialize(Coordinate p0, Coordinate p1, double distance) { pt[0].setCoordinate(p0); pt[1].setCoordinate(p1); this.distance = distance; isNull = false; }
public void initialize(Coordinate p0, Coordinate p1) { pt[0].setCoordinate(p0); pt[1].setCoordinate(p1); distance = p0.distance(p1); isNull = false; }
public void initialize(Coordinate p0, Coordinate p1) { pt[0].setCoordinate(p0); pt[1].setCoordinate(p1); distance = p0.distance(p1); isNull = false; }
pa.setCoordinate(p1); return POINT_INTERSECTION; pa.setCoordinate(p2); return POINT_INTERSECTION; pa.setCoordinate(p1); if (t3 > r1) { pa.setCoordinate(q3); pb.setCoordinate(p2); if (t4 < r2) { pb.setCoordinate(q4);
/** * Initializes the points, avoiding recomputing the distance. * @param p0 * @param p1 * @param distance the distance between p0 and p1 */ private void initialize(Coordinate p0, Coordinate p1, double distance) { pt[0].setCoordinate(p0); pt[1].setCoordinate(p1); this.distance = distance; isNull = false; }
/** * Initializes the points, avoiding recomputing the distance. * @param p0 * @param p1 * @param distance the distance between p0 and p1 */ private void initialize(Coordinate p0, Coordinate p1, double distance) { pt[0].setCoordinate(p0); pt[1].setCoordinate(p1); this.distance = distance; isNull = false; }
private static boolean computeSplitPositionOrdered(double marker1, double marker2, double isoValue, Coordinate p1, Coordinate p2, Coordinate splitPosition) { if (marker1 < isoValue && isoValue < marker2) { double interval = (isoValue - marker1) / (marker2 - marker1); splitPosition.setCoordinate(new Coordinate(p1.x + (p2.x - p1.x) * interval, p1.y + (p2.y - p1.y) * interval, p1.z + (p2.z - p1.z) * interval)); return true; } else { return false; } }
private static boolean computeSplitPositionOrdered(double marker1, double marker2, double isoValue, Coordinate p1, Coordinate p2, Coordinate splitPosition) { if (marker1 < isoValue && isoValue < marker2) { double interval = (isoValue - marker1) / (marker2 - marker1); splitPosition.setCoordinate(new Coordinate(p1.x + (p2.x - p1.x) * interval, p1.y + (p2.y - p1.y) * interval, p1.z + (p2.z - p1.z) * interval)); return true; } else { return false; } }
public void filter(Coordinate c) { c.setCoordinate(new Coordinate(c.x, c.y, height)); } });
public void initialize(Coordinate p0, Coordinate p1) { pt[0].setCoordinate(p0); pt[1].setCoordinate(p1); distance = p0.distance(p1); isNull = false; }
public void initialize(Coordinate p0, Coordinate p1) { pt[0].setCoordinate(p0); pt[1].setCoordinate(p1); distance = p0.distance(p1); isNull = false; }
pa.setCoordinate(p1); return POINT_INTERSECTION; pa.setCoordinate(p2); return POINT_INTERSECTION; pa.setCoordinate(p1); if (t3 > r1) { pa.setCoordinate(q3); pb.setCoordinate(p2); if (t4 < r2) { pb.setCoordinate(q4);
/** * Returns the Point representing the current position along the LineString */ public Coordinate getCurrentPosition(Coordinate c) { c.setCoordinate(coords.getCoordinate(segment)); if (offsetDistance > 0) { final double angle = getCurrentAngle(); c.x += offsetDistance * Math.cos(angle); c.y += offsetDistance * Math.sin(angle); } return c; }
@Override public void filter(CoordinateSequence seq, int i) { Coordinate coord = seq.getCoordinate(i); PixelPos pixelPos = geoCoding.getPixelPos(new GeoPos((float) coord.y, (float) coord.x), null); // rounding needed because closed geometries yield errors if their first and last coordinate // do not exactly match double x = Math.round(pixelPos.x * 10000) / 10000; double y = Math.round(pixelPos.y * 10000) / 10000; coord.setCoordinate(new Coordinate(x, y)); count++; }
@ProcessMethod @OutputParameter( // id = "setHeightForPoint", // title = "Set Height for Point", // description = "Output 3D-Point") public Point setHeightForPoint( @InputParameter(title = "input point", id = "transformPoint", description = "Description of the input point") Point input, @InputParameter(title = "input height", id = "transformHeight", description = "Description of the input height") Double height) throws InvalidParameterValueException { if (height < 0) { throw new InvalidParameterValueException("height", height.toString()); } Coordinate coordinate = input.getCoordinate(); coordinate.setCoordinate(new Coordinate(coordinate.x, coordinate.y, height)); Point createPoint = input.getFactory().createPoint(coordinate); return createPoint; } }
private void updateDefaultGeometryAttribute(PixelPos pixelPos) { final Product product = getProduct(); final Point2D.Float geometryPoint = new Point2D.Float(pixelPos.x, pixelPos.y); if (product != null) { final AffineTransform i2m = ImageManager.getImageToModelTransform(product.getGeoCoding()); i2m.transform(pixelPos, geometryPoint); } final Point point = (Point) feature.getDefaultGeometry(); point.getCoordinate().setCoordinate(toCoordinate(geometryPoint)); point.geometryChanged(); }
private void setGeoPosAttribute(GeoPos geoPos, boolean updatePixelPos) { final Coordinate newCoordinate = toCoordinate(geoPos); final Coordinate oldCoordinate = getGeoPosAttribute(); if (!ObjectUtils.equalObjects(oldCoordinate, newCoordinate)) { if (oldCoordinate == null) { final GeometryFactory geometryFactory = new GeometryFactory(); setAttributeValue(PROPERTY_NAME_GEOPOS, geometryFactory.createPoint(newCoordinate)); } else if (newCoordinate != null) { final Point point = (Point) getAttributeValue(PROPERTY_NAME_GEOPOS); point.getCoordinate().setCoordinate(newCoordinate); point.geometryChanged(); } if (updatePixelPos && getProduct() != null) { final PixelPos pixelPos = getPixelPos(); descriptor.updatePixelPos(getProduct().getGeoCoding(), geoPos, pixelPos); setPixelPosAttribute(pixelPos, false, true); } fireProductNodeChanged(PROPERTY_NAME_GEOPOS); } }
/** * Splits the lineString at the point closest to c. * * @param lineString line to split * @param target point where line should be split * @param moveSplitToTarget * true to move the split point to the target; false to leave the * split point at the closest point on the line to the target */ public static LineString[] split(LineString lineString, Coordinate target, boolean moveSplitToTarget) { LengthToPoint lengthToPoint = new LengthToPoint(lineString, target); LengthSubstring lengthSubstring = new LengthSubstring(lineString); LineString[] newLineStrings = new LineString[] { lengthSubstring.getSubstring(0, lengthToPoint.getLength()), lengthSubstring.getSubstring(lengthToPoint.getLength(), lineString.getLength()) }; if (moveSplitToTarget) { newLineStrings[1].getStartPoint().getCoordinate() .setCoordinate((Coordinate) target.clone()); } // Make sure the coordinates are absolutely equal [Jon Aquino // 11/21/2003] newLineStrings[0] .getEndPoint() .getCoordinate() .setCoordinate( newLineStrings[1].getStartPoint().getCoordinate()); return newLineStrings; }
private void setPixelPosAttribute(PixelPos pixelPos, boolean updateGeoPos, boolean updateDefaultGeometry) { final Coordinate newCoordinate = toCoordinate(pixelPos); final Coordinate oldCoordinate = getPixelPosAttribute(); if (!ObjectUtils.equalObjects(oldCoordinate, newCoordinate)) { if (oldCoordinate == null) { final GeometryFactory geometryFactory = new GeometryFactory(); setAttributeValue(PROPERTY_NAME_PIXELPOS, geometryFactory.createPoint(newCoordinate)); } else { final Point point = (Point) getAttributeValue(PROPERTY_NAME_PIXELPOS); point.getCoordinate().setCoordinate(newCoordinate); point.geometryChanged(); } // Make sure, object is in a consistent state if (updateDefaultGeometry) { updateDefaultGeometryAttribute(pixelPos); } if (updateGeoPos && getProduct() != null) { final GeoPos geoPos = getGeoPos(); descriptor.updateGeoPos(getProduct().getGeoCoding(), pixelPos, geoPos); setGeoPosAttribute(geoPos, false); } fireProductNodeChanged(PROPERTY_NAME_PIXELPOS); } }