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

com.datastax.dse.driver.api.core.data.geometry.LineString Maven / Gradle / Ivy

/*
 * Copyright DataStax, Inc.
 *
 * This software can be used solely with DataStax Enterprise. Please consult the license at
 * http://www.datastax.com/terms/datastax-dse-driver-license-terms
 */
package com.datastax.dse.driver.api.core.data.geometry;

import com.datastax.dse.driver.internal.core.data.geometry.DefaultGeometry;
import com.datastax.dse.driver.internal.core.data.geometry.DefaultLineString;
import com.datastax.dse.driver.shaded.esri.core.geometry.ogc.OGCLineString;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.nio.ByteBuffer;
import java.util.List;

/**
 * The driver-side representation for DSE's {@code LineString}.
 *
 * 

This is a curve in a two-dimensional XY-plane, represented by a set of points (with linear * interpolation between them). * *

The default implementation returned by the driver is immutable. */ public interface LineString extends Geometry { /** * Creates a line string from its Well-known Text (WKT) representation. * * @param source the Well-known Text representation to parse. * @return the line string represented by the WKT. * @throws IllegalArgumentException if the string does not contain a valid Well-known Text * representation. */ @NonNull static LineString fromWellKnownText(@NonNull String source) { return new DefaultLineString(DefaultGeometry.fromOgcWellKnownText(source, OGCLineString.class)); } /** * Creates a line string from its Well-known Binary * (WKB) representation. * * @param source the Well-known Binary representation to parse. * @return the line string represented by the WKB. * @throws IllegalArgumentException if the provided {@link ByteBuffer} does not contain a valid * Well-known Binary representation. */ @NonNull static LineString fromWellKnownBinary(@NonNull ByteBuffer source) { return new DefaultLineString( DefaultGeometry.fromOgcWellKnownBinary(source, OGCLineString.class)); } /** * Creates a line string from a GeoJSON * LineString representation. * * @param source the GeoJSON * LineString representation to parse. * @return the line string represented by the GeoJSON LineString. * @throws IllegalArgumentException if the string does not contain a valid GeoJSON LineString * representation. */ @NonNull static LineString fromGeoJson(@NonNull String source) { return new DefaultLineString(DefaultGeometry.fromOgcGeoJson(source, OGCLineString.class)); } /** Creates a line string from two or more points. */ @NonNull static LineString fromPoints(@NonNull Point p1, @NonNull Point p2, @NonNull Point... pn) { return new DefaultLineString(p1, p2, pn); } @NonNull List getPoints(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy