本文整理了Java中com.vividsolutions.jts.geom.GeometryFactory.getCoordinateSequenceFactory()
方法的一些代码示例,展示了GeometryFactory.getCoordinateSequenceFactory()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeometryFactory.getCoordinateSequenceFactory()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.GeometryFactory
类名称:GeometryFactory
方法名:getCoordinateSequenceFactory
暂无
代码示例来源:origin: osmandapp/Osmand
nextCoordSeq = geomFactory.getCoordinateSequenceFactory().create(1 + cmdLength, 2);
代码示例来源:origin: osmandapp/Osmand
final CoordinateSequence coordSeq = geomFactory.getCoordinateSequenceFactory().create(cmdLength, 2);
int coordIndex = 0;
Coordinate nextCoord;
代码示例来源:origin: osmandapp/Osmand
nextCoordSeq = geomFactory.getCoordinateSequenceFactory().create(2 + cmdLength, 2);
代码示例来源:origin: opentripplanner/OpenTripPlanner
/**
* Splits the input geometry into two LineStrings at a fraction of the distance covered.
*/
public static P2<LineString> splitGeometryAtFraction(Geometry geometry, double fraction) {
LineString empty = new LineString(null, gf);
Coordinate[] coordinates = geometry.getCoordinates();
CoordinateSequence sequence = gf.getCoordinateSequenceFactory().create(coordinates);
LineString total = new LineString(sequence, gf);
if (coordinates.length < 2) return new P2<LineString>(empty, empty);
if (fraction <= 0) return new P2<LineString>(empty, total);
if (fraction >= 1) return new P2<LineString>(total, empty);
double totalDistance = total.getLength();
double requestedDistance = totalDistance * fraction;
// An index in JTS can actually refer to any point along the line. It is NOT an array index.
LocationIndexedLine line = new LocationIndexedLine(geometry);
LinearLocation l = LengthLocationMap.getLocation(geometry, requestedDistance);
LineString beginning = (LineString) line.extractLine(line.getStartIndex(), l);
LineString ending = (LineString) line.extractLine(l, line.getEndIndex());
return new P2<LineString>(beginning, ending);
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Creates a Point using the given Coordinate; a null Coordinate will create
* an empty Geometry.
*/
public Point createPoint(Coordinate coordinate) {
return createPoint(coordinate != null ? getCoordinateSequenceFactory().create(new Coordinate[]{coordinate}) : null);
}
代码示例来源:origin: com.vividsolutions/jts
public WKBReader(GeometryFactory geometryFactory) {
this.factory = geometryFactory;
precisionModel = factory.getPrecisionModel();
csFactory = factory.getCoordinateSequenceFactory();
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Convenience method which provides standard way of
* creating a {@link CoordinateSequence}
*
* @param coords the coordinate array to copy
* @return a coordinate sequence for the array
*/
protected final CoordinateSequence createCoordinateSequence(Coordinate[] coords)
{
return factory.getCoordinateSequenceFactory().create(coords);
}
代码示例来源:origin: com.vividsolutions/jts
/**
* This method is ONLY used to avoid deprecation warnings.
* @param points
* @param factory
* @throws IllegalArgumentException if the ring is not closed, or has too few points
*/
private LinearRing(Coordinate points[], GeometryFactory factory) {
this(factory.getCoordinateSequenceFactory().create(points), factory);
}
代码示例来源:origin: com.vividsolutions/jts
private GeometryFactory createFactory(GeometryFactory inputFactory, PrecisionModel pm)
{
GeometryFactory newFactory
= new GeometryFactory(pm,
inputFactory.getSRID(),
inputFactory.getCoordinateSequenceFactory());
return newFactory;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Creates a {@link LinearRing} using the given {@link Coordinate}s.
* A null or empty array will
* create an empty LinearRing. The points must form a closed and simple
* linestring. Consecutive points must not be equal.
* @param coordinates an array without null elements, or an empty array, or null
*/
public LinearRing createLinearRing(Coordinate[] coordinates) {
return createLinearRing(coordinates != null ? getCoordinateSequenceFactory().create(coordinates) : null);
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Creates a {@link MultiPoint} using the given {@link Coordinate}s.
* A null or empty array will create an empty MultiPoint.
*
* @param coordinates an array (without null elements), or an empty array, or <code>null</code>
* @return a MultiPoint object
*/
public MultiPoint createMultiPoint(Coordinate[] coordinates) {
return createMultiPoint(coordinates != null
? getCoordinateSequenceFactory().create(coordinates)
: null);
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Creates a LineString using the given Coordinates; a null or empty array will
* create an empty LineString. Consecutive points must not be equal.
* @param coordinates an array without null elements, or an empty array, or null
*/
public LineString createLineString(Coordinate[] coordinates) {
return createLineString(coordinates != null ? getCoordinateSequenceFactory().create(coordinates) : null);
}
/**
代码示例来源:origin: com.vividsolutions/jts
/** @deprecated Use GeometryFactory instead */
public LineString(Coordinate points[], PrecisionModel precisionModel, int SRID)
{
super(new GeometryFactory(precisionModel, SRID));
init(getFactory().getCoordinateSequenceFactory().create(points));
}
代码示例来源:origin: com.vividsolutions/jts
private void init(CoordinateSequence points)
{
if (points == null) {
points = getFactory().getCoordinateSequenceFactory().create(new Coordinate[]{});
}
if (points.size() == 1) {
throw new IllegalArgumentException("Invalid number of points in LineString (found "
+ points.size() + " - must be 0 or >= 2)");
}
this.points = points;
}
public Coordinate[] getCoordinates() {
代码示例来源:origin: com.vividsolutions/jts
/**
* Constructs a <code>Point</code> with the given coordinate.
*
*@param coordinate the coordinate on which to base this <code>Point</code>
* , or <code>null</code> to create the empty geometry.
*@param precisionModel the specification of the grid of allowable points
* for this <code>Point</code>
*@param SRID the ID of the Spatial Reference System used by this
* <code>Point</code>
* @deprecated Use GeometryFactory instead
*/
public Point(Coordinate coordinate, PrecisionModel precisionModel, int SRID) {
super(new GeometryFactory(precisionModel, SRID));
init(getFactory().getCoordinateSequenceFactory().create(
coordinate != null ? new Coordinate[]{coordinate} : new Coordinate[]{}));
}
代码示例来源:origin: com.vividsolutions/jts
protected CoordinateSequence transformCoordinates(CoordinateSequence coords, Geometry parent)
{
Coordinate[] inputPts = coords.toCoordinateArray();
Coordinate[] newPts = DouglasPeuckerLineSimplifier.simplify(inputPts, distanceTolerance);
return factory.getCoordinateSequenceFactory().create(newPts);
}
代码示例来源:origin: com.vividsolutions/jts
protected CoordinateSequence transformCoordinates(
CoordinateSequence coords, Geometry parent) {
Coordinate[] inputPts = coords.toCoordinateArray();
Coordinate[] newPts = Densifier
.densifyPoints(inputPts, distanceTolerance, parent.getPrecisionModel());
// prevent creation of invalid linestrings
if (parent instanceof LineString && newPts.length == 1) {
newPts = new Coordinate[0];
}
return factory.getCoordinateSequenceFactory().create(newPts);
}
代码示例来源:origin: com.vividsolutions/jts
protected CoordinateSequence transformCoordinates(CoordinateSequence coords, Geometry parent)
{
Coordinate[] srcPts = coords.toCoordinateArray();
Coordinate[] newPts = snapLine(srcPts, snapPts);
return factory.getCoordinateSequenceFactory().create(newPts);
}
代码示例来源:origin: com.vividsolutions/jts
private void init(CoordinateSequence coordinates)
{
if (coordinates == null) {
coordinates = getFactory().getCoordinateSequenceFactory().create(new Coordinate[]{});
}
Assert.isTrue(coordinates.size() <= 1);
this.coordinates = coordinates;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Creates a {@link MultiPoint} using the
* points in the given {@link CoordinateSequence}.
* A <code>null</code> or empty CoordinateSequence creates an empty MultiPoint.
*
* @param coordinates a CoordinateSequence (possibly empty), or <code>null</code>
* @return a MultiPoint geometry
*/
public MultiPoint createMultiPoint(CoordinateSequence coordinates) {
if (coordinates == null) {
return createMultiPoint(new Point[0]);
}
Point[] points = new Point[coordinates.size()];
for (int i = 0; i < coordinates.size(); i++) {
CoordinateSequence ptSeq = getCoordinateSequenceFactory()
.create(1, coordinates.getDimension());
CoordinateSequences.copy(coordinates, i, ptSeq, 0, 1);
points[i] = createPoint(ptSeq);
}
return createMultiPoint(points);
}
内容来源于网络,如有侵权,请联系作者删除!