Execute the snap operation.

@param coordinate The original location.
@param distance   The maximum distance allowed for snapping.
@return The new location. If no snapping target was found, this may return the original location.
174345
public Coordinate snap(Coordinate coordinate, double distance) {
		// Some initialization:
		calculatedDistance = distance;
		hasSnapped = false;
		Coordinate snappingPoint = coordinate;

		// Calculate the distances for all coordinate arrays:
		for (Coordinate[] coordinateArray : coordinates) {
			if (coordinateArray.length > 1) {
				for (int j = 1; j < coordinateArray.length; j++) {
					double d = MathService.distance(coordinateArray[j], coordinateArray[j - 1], coordinate);
					if (d < calculatedDistance || (d == calculatedDistance && !hasSnapped)) {
						snappingPoint = MathService.nearest(coordinateArray[j], coordinateArray[j - 1], coordinate);
						calculatedDistance = d;
						hasSnapped = true;
					}
				}
			} else if (coordinateArray.length == 1) {
				// In the case of Points, see if we can snap to them:
				double d = MathService.distance(coordinateArray[0], coordinate);
				if (d < calculatedDistance) {
					snappingPoint = coordinateArray[0];
					calculatedDistance = d;
					hasSnapped = true;
				}
			}
		}

		return snappingPoint;
	}
88653
public void copy(final Receiver out, final int copyOption, final int locationId) throws XPathException {
        Navigator.copy(this, out, copyOption, locationId);
    }
952896
@Unit(NM)
    public static double radius(Location... location)
    {
        Location center = center(location);
        double max = 0;
        for (Location loc : location)
        {
            Distance distance = distance(loc, center);
            double miles = distance.getMiles();
            if (miles > max)
            {
                max = miles;
            }
        }
        return max;
    }
725938
@Override
    public MavenVersionRangeResult resolveVersionRange(final String coordinate) throws IllegalArgumentException {
        Validate.isNullOrEmpty(coordinate);

        final MavenCoordinate mavenCoordinate = MavenCoordinates.createCoordinate(coordinate);
        return this.getMavenWorkingSession().resolveVersionRange(mavenCoordinate);
    }
488263
public void setLocation(double x, double y)
    {
        final double dx = x - (mover.getX() + offset.getX());
        final double dy = y - (mover.getY() + offset.getY());
        moveLocation(1, dx, dy);
    }
5726
public void setLocation(Location location) {
        if (location != null) {
            this.location = location;
        } else {
            this.location = Location.Unspecified;
        }
    }
590313
@Pure
	public double distance(Point2D<?, ?> point) {
		assert point != null;
		final GeoLocationPoint p = getGeoPosition();
		if (p != null) {
			return Point2D.getDistancePointPoint(p.getX(), p.getY(), point.getX(), point.getY());
		}
		return Double.NaN;
	}
801367
public double distance(final Coordinate c) {
        final double dx = getX() - c.getX();
        final double dy = getY() - c.getY();
        return Math.sqrt(dx * dx + dy * dy);
    }
953626
public function geo_distance(string $key, $location, string $distance): GeoDistance
    {
        return new GeoDistance($key, $location, $distance);
    }
1371629
public static Geometry snap(Geometry geometryA, Geometry geometryB, double distance) {
        if(geometryA == null||geometryB == null){
            return null;
        }
        Geometry[] snapped = GeometrySnapper.snap(geometryA, geometryB, distance);
        return snapped[0];
    }
1177723
@Override
	@Pure
	public <OT extends MapPonctualElement> double distance(OT another_point) {
		double dist = super.distance(another_point);
		dist -= this.radius;
		return dist;
	}
1347259
public void setCoordinate(Coordinate coordinate) {
		if (coordinate == null) {
			throw new IllegalArgumentException("Can't snap to a null coordinate.");
		}
		this.coordinate = coordinate;
		bounds = new Bbox(coordinate.getX() - rule.getDistance(), coordinate.getY() - rule.getDistance(), rule
				.getDistance() * 2, rule.getDistance() * 2);
		distance = Double.MAX_VALUE;
		snappedCoordinate = coordinate;
	}
1192679
private void computeMaxDistance() {
        HashSet<Coordinate> coordinatesA = new HashSet<Coordinate>(Arrays.asList(geomA.convexHull().getCoordinates()));
        Geometry fullHull = geomA.getFactory().createGeometryCollection(new Geometry[]{geomA, geomB}).convexHull();
        maxDistanceFilter = new MaxDistanceFilter(coordinatesA);
        fullHull.apply(maxDistanceFilter);
    }
617182
def _move(self, distance):
        
        self._position = self._position + self._orient * distance  
        if self.isPenDown(): 
            x = round(self._position.x, 2)
            y = round(self._position.y, 2)
            self._pointsOfPolyline.append(Vector(x, y))
1042253
@Override
	public void move(List<GeometryIndex> indices, List<List<Coordinate>> coordinates)
			throws GeometryOperationFailedException {
		if (indices == null || coordinates == null || indices.size() == 0 || coordinates.size() == 0) {
			throw new GeometryOperationFailedException("Illegal arguments passed; nothing to move.");
		}

		Geometry geometry = service.getGeometry();
		OperationSequence seq = null;
		if (isOperationSequenceActive()) {
			seq = current;
		} else {
			seq = new OperationSequence();
			redoQueue.clear();
		}
		for (int i = 0; i < indices.size(); i++) {
			if (indexService.getType(indices.get(i)) == GeometryIndexType.TYPE_VERTEX) {
				GeometryIndexOperation op = new MoveVertexOperation(indexService, coordinates.get(i).get(0));
				executeOperation(op, indices.get(i));
				seq.addOperation(op);
			} else {
				throw new GeometryOperationFailedException("Can only move vertices. Other types not suported.");
			}
		}
		if (!isOperationSequenceActive()) {
			undoQueue.add(seq);
		}
		eventBus.fireEvent(new GeometryEditMoveEvent(geometry, indices));
		if (!isOperationSequenceActive()) {
			eventBus.fireEvent(new GeometryEditShapeChangedEvent(service.getGeometry()));
		}
	}
1011296
public AVIMConversationsQuery whereWithinRadians(String key, AVGeoPoint point, double maxDistance) {
    conditions.whereWithinRadians(key, point, maxDistance);
    return this;
  }
804990
public <T> void move(Local<T> target, Local<T> source) {
        addInstruction(new PlainInsn(Rops.opMove(source.type.ropType),
                sourcePosition, target.spec(), source.spec()));
    }