本文整理汇总了Java中com.vividsolutions.jts.geom.CoordinateSequenceFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinateSequenceFactory.create方法的具体用法?Java CoordinateSequenceFactory.create怎么用?Java CoordinateSequenceFactory.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.CoordinateSequenceFactory
的用法示例。
在下文中一共展示了CoordinateSequenceFactory.create方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toCoordinateSequence
import com.vividsolutions.jts.geom.CoordinateSequenceFactory; //导入方法依赖的package包/类
private CoordinateSequence toCoordinateSequence(OsmEntityProvider resolver)
throws EntityNotFoundException {
CoordinateSequenceFactory csf = factory.getCoordinateSequenceFactory();
int len = this.getLength();
CoordinateSequence points = csf.create(len, 2);
int n = 0;
for (int i = 0; i < this.segments.size(); i++) {
WaySegment segment = this.segments.get(i);
OsmWay way = segment.getWay();
for (int k = 0; k < way.getNumberOfNodes(); k++) {
if (k > 0 || i == 0) {
OsmNode node = resolver.getNode(segment.getNodeId(k));
points.setOrdinate(n, 0, node.getLongitude());
points.setOrdinate(n, 1, node.getLatitude());
n++;
}
}
}
return points;
}
示例2: reverseRing
import com.vividsolutions.jts.geom.CoordinateSequenceFactory; //导入方法依赖的package包/类
/**
* Does what it says, reverses the order of the Coordinates in the ring.
* <p>
* This is different then lr.reverses() in that a copy is produced using a
* new coordinate sequence.
* </p>
*
* @param lr The ring to reverse.
* @return A new ring with the reversed Coordinates.
*/
public static final LinearRing reverseRing(LinearRing lr) {
GeometryFactory gf = lr.getFactory();
CoordinateSequenceFactory csf = gf.getCoordinateSequenceFactory();
CoordinateSequence csOrig = lr.getCoordinateSequence();
int numPoints = csOrig.size();
int dimensions = csOrig.getDimension();
CoordinateSequence csNew = csf.create(numPoints, dimensions);
for (int i = 0; i < numPoints; i++) {
for (int j = 0; j < dimensions; j++) {
csNew.setOrdinate(numPoints - 1 - i, j, csOrig.getOrdinate(i, j));
}
}
return gf.createLinearRing(csNew);
}
示例3: buildRectangle
import com.vividsolutions.jts.geom.CoordinateSequenceFactory; //导入方法依赖的package包/类
public static IShape buildRectangle(final double width, final double height, final ILocation location) {
final Coordinate[] points = new Coordinate[5];
final double x = location == null ? 0 : location.getX();
final double y = location == null ? 0 : location.getY();
final double z = location == null ? 0 : location.getZ();
points[4] = new GamaPoint(x - width / 2.0, y + height / 2.0, z);
points[3] = new GamaPoint(x + width / 2.0, y + height / 2.0, z);
points[2] = new GamaPoint(x + width / 2.0, y - height / 2.0, z);
points[1] = new GamaPoint(x - width / 2.0, y - height / 2.0, z);
points[0] = new GamaPoint(x - width / 2.0, y + height / 2.0, z);
final CoordinateSequenceFactory fact = GamaGeometryFactory.COORDINATES_FACTORY;
final CoordinateSequence cs = fact.create(points);
final LinearRing geom = GeometryUtils.GEOMETRY_FACTORY.createLinearRing(cs);
final Polygon p = GeometryUtils.GEOMETRY_FACTORY.createPolygon(geom, null);
return new GamaShape(p);
}