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


Java MultiPoint.getGeometryN方法代码示例

本文整理汇总了Java中com.vividsolutions.jts.geom.MultiPoint.getGeometryN方法的典型用法代码示例。如果您正苦于以下问题:Java MultiPoint.getGeometryN方法的具体用法?Java MultiPoint.getGeometryN怎么用?Java MultiPoint.getGeometryN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vividsolutions.jts.geom.MultiPoint的用法示例。


在下文中一共展示了MultiPoint.getGeometryN方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isSimpleMultiPoint

import com.vividsolutions.jts.geom.MultiPoint; //导入方法依赖的package包/类
private boolean isSimpleMultiPoint(MultiPoint mp) {
    if (mp.isEmpty()) {
        return true;
    }
    Set points = new TreeSet();
    for (int i = 0; i < mp.getNumGeometries(); i++) {
        Point pt = (Point) mp.getGeometryN(i);
        Coordinate p = pt.getCoordinate();
        if (points.contains(p)) {
            this.nonSimpleLocation = p;
            return false;
        }
        points.add(p);
    }
    return true;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:17,代码来源:IsSimpleOp.java

示例2: testMultiPoint

import com.vividsolutions.jts.geom.MultiPoint; //导入方法依赖的package包/类
public void testMultiPoint()
{
	Geometry g = read("{\n" +
			"  \"type\": \"MultiPoint\",\n" +
			"  \"coordinates\": [[1,2],[2,4]]\n" +
			"}");
	assertTrue(g instanceof MultiPoint);
	MultiPoint m = (MultiPoint) g;
	assertEquals(2,m.getNumGeometries());
	Point p0 = (Point) m.getGeometryN(0);
	Point p1 = (Point) m.getGeometryN(1);
	assertEquals(1.0,p0.getX());
	assertEquals(2.0,p0.getY());
	assertEquals(2.0,p1.getX());
	assertEquals(4.0,p1.getY());
}
 
开发者ID:westnordost,项目名称:StreetComplete,代码行数:17,代码来源:GeoJsonReaderTest.java

示例3: putESRIMultiPointRecord

import com.vividsolutions.jts.geom.MultiPoint; //导入方法依赖的package包/类
/** */
public int putESRIMultiPointRecord (int offset, MultiPoint shape, int index) {
    int bytesWritten = 0;
    setByteOrder(ByteOrder.BIG_ENDIAN);
    bytesWritten += putInt(offset + bytesWritten, index);
    int recordLength = 20 + (shape.getNumGeometries() * 8);
    ensureCapacity((recordLength * 2) + 8);
    bytesWritten += putInt(offset + bytesWritten, recordLength);
    setByteOrder(ByteOrder.LITTLE_ENDIAN);
    bytesWritten += putInt(offset + bytesWritten, SHAPE_TYPE_MULTIPOINT);
    bytesWritten += putBoundingBox(offset + bytesWritten, shape.getEnvelopeInternal());
    bytesWritten += putInt(offset + bytesWritten, shape.getNumGeometries());
    for (int i = 0; i < shape.getNumGeometries(); i += 1) {
        Point pt = (Point)shape.getGeometryN(i);
        bytesWritten += putDouble(offset + bytesWritten, _converter.convert(pt.getX()));
        bytesWritten += putDouble(offset + bytesWritten, _converter.convert(pt.getY()));
    }
    return bytesWritten;
}
 
开发者ID:reuven,项目名称:modelingcommons,代码行数:20,代码来源:ESRIShapeBuffer.java

示例4: calculateMultiPoint

import com.vividsolutions.jts.geom.MultiPoint; //导入方法依赖的package包/类
private Map<String, Double> calculateMultiPoint(MultiPoint points) {
	Map<String, Double> result = new HashMap<>();
	int count = points.getNumGeometries();
	double total = 0;
	for (int i = 0; i < count; i++) {
		Geometry geo = points.getGeometryN(i);
		String shapeId = findPointShape(geo);
		if (shapeId == null)
			continue;
		Double val = result.get(shapeId);
		if (val == null) {
			result.put(shapeId, 1d);
		} else {
			result.put(shapeId, val + 1d);
		}
		total += 1d;
	}
	return makeRelative(result, total);
}
 
开发者ID:GreenDelta,项目名称:olca-modules,代码行数:20,代码来源:IntersectionsCalculator.java

示例5: toShape

import com.vividsolutions.jts.geom.MultiPoint; //导入方法依赖的package包/类
private DrawableShape toShape( MultiPoint points ) {
    GeometryCollectionShape shapes = new GeometryCollectionShape();
    int numGeometries = points.getNumGeometries();
    for( int i = 0; i < numGeometries; i++ ) {
        Point point = (Point) points.getGeometryN(i);
        PointF viewPoint = transformPoint(point.getCoordinate());
        DrawableShape drawableShape = pointFactory.createPoint(viewPoint);
        shapes.add(drawableShape);
    }
    return shapes;
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:12,代码来源:ShapeWriter.java

示例6: writeObject

import com.vividsolutions.jts.geom.MultiPoint; //导入方法依赖的package包/类
public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
	MultiPoint mp = (MultiPoint) o;
	for (int i = 0; i < mp.getNumGeometries(); i++) {
		document.writeElement("use", i == 0 && asChild);
		Point p = (Point) mp.getGeometryN(i);
		document.writeAttribute("x", p.getX());
		document.writeAttribute("y", p.getY());
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:10,代码来源:MultiPointWriter.java

示例7: first

import com.vividsolutions.jts.geom.MultiPoint; //导入方法依赖的package包/类
/**
 * Returns the first point in a multi point, or <code>null</code> if the multi point is empty.
 */
public static Point first(MultiPoint mp) {
  return mp.getNumGeometries() > 0 ? (Point) mp.getGeometryN(0) : null;
}
 
开发者ID:geomgis,项目名称:geogson,代码行数:7,代码来源:Geom.java


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