当前位置: 首页>>代码示例>>Java>>正文


Java CoordinateSequenceFactory.create方法代码示例

本文整理汇总了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;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:24,代码来源:ChainOfWays.java

示例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);
}
 
开发者ID:PDOK,项目名称:gml3-jts,代码行数:28,代码来源:GML321ToSurfaceConvertor.java

示例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);
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:17,代码来源:GamaGeometryType.java


注:本文中的com.vividsolutions.jts.geom.CoordinateSequenceFactory.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。