All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.queries.WithinCircleQueryPredicate Maven / Gradle / Ivy

The newest version!
package io.sphere.sdk.queries;

import io.sphere.sdk.models.Point;

import java.util.Locale;

/**
 * This predicate returns {@code true} if a {@link io.sphere.sdk.models.GeoJSON} object
 * is within the circle given by the center and radius in meters.
 *
 * @param  the type for which this predicate can be instantiated
 */
class WithinCircleQueryPredicate extends QueryModelQueryPredicate {
    private final Point center;
    private final Double radius;

    WithinCircleQueryPredicate(final QueryModel queryModel, final Point center, final Double radius) {
        super(queryModel);
        this.center = center;
        this.radius = radius;
    }

    @Override
    protected String render() {
        return String.format(Locale.ENGLISH, " within circle(%f, %f, %f)", center.getLongitude(), center.getLatitude(), radius);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy