當前位置: 首頁>>代碼示例>>Java>>正文


Java MultiPoint.getNumGeometries方法代碼示例

本文整理匯總了Java中com.vividsolutions.jts.geom.MultiPoint.getNumGeometries方法的典型用法代碼示例。如果您正苦於以下問題:Java MultiPoint.getNumGeometries方法的具體用法?Java MultiPoint.getNumGeometries怎麽用?Java MultiPoint.getNumGeometries使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vividsolutions.jts.geom.MultiPoint的用法示例。


在下文中一共展示了MultiPoint.getNumGeometries方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: writeMultiPoint

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
private void writeMultiPoint(MultiPoint mp, Writer writer, int level)
        throws IOException {
    this.startLine(level, writer);
    this.startGeomTag(GMLConstants.GML_MULTI_POINT, mp, writer);

    for (int t = 0; t < mp.getNumGeometries(); t++) {
        this.startLine(level + 1, writer);
        this.startGeomTag(GMLConstants.GML_POINT_MEMBER, null, writer);

        this.writePoint((Point) mp.getGeometryN(t), writer, level + 2);

        this.startLine(level + 1, writer);
        this.endGeomTag(GMLConstants.GML_POINT_MEMBER, writer);
    }
    this.startLine(level, writer);
    this.endGeomTag(GMLConstants.GML_MULTI_POINT, writer);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:18,代碼來源:GMLWriter.java

示例3: appendMultiPointText

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
/**
 * Converts a <code>MultiPoint</code> to &lt;MultiPoint Text&gt; format, then
 * appends it to the writer.
 *
 * @param multiPoint the <code>MultiPoint</code> to process
 * @param writer the output writer to append to
 */
private void appendMultiPointText(MultiPoint multiPoint, int level, Writer writer)
        throws IOException {
    if (multiPoint.isEmpty()) {
        writer.write("EMPTY");
    } else {
        writer.write("(");
        for (int i = 0; i < multiPoint.getNumGeometries(); i++) {
            if (i > 0) {
                writer.write(", ");
                this.indentCoords(i, level + 1, writer);
            }
            writer.write("(");
            this.appendCoordinate(multiPoint.getGeometryN(i).getCoordinate(), writer);
            writer.write(")");
        }
        writer.write(")");
    }
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:26,代碼來源:WKTWriter.java

示例4: 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

示例5: 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

示例6: transformMultiPoint

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
protected Geometry transformMultiPoint(MultiPoint geom, Geometry parent) {
    List transGeomList = new ArrayList();
    for (int i = 0; i < geom.getNumGeometries(); i++) {
        Geometry transformGeom = this.transformPoint((Point) geom.getGeometryN(i), geom);
        if (transformGeom == null) {
            continue;
        }
        if (transformGeom.isEmpty()) {
            continue;
        }
        transGeomList.add(transformGeom);
    }
    return this.factory.buildGeometry(transGeomList);
}
 
開發者ID:gegy1000,項目名稱:Earth,代碼行數:15,代碼來源:GeometryTransformer.java

示例7: writeMultiPoint

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
private void writeMultiPoint(JsonGenerator jgen, MultiPoint value)
		throws JsonGenerationException, IOException {
	jgen.writeStartObject();
	jgen.writeStringField("type", "MultiPoint");
	jgen.writeArrayFieldStart("coordinates");

	for (int i = 0; i != value.getNumGeometries(); ++i) {
		writePointCoords(jgen, (Point) value.getGeometryN(i));
	}

	jgen.writeEndArray();
	jgen.writeEndObject();
}
 
開發者ID:conveyal,項目名稱:lodes-processor,代碼行數:14,代碼來源:GeometrySerializer.java

示例8: 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

示例9: encodeMultiPoint

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
private void encodeMultiPoint(MultiPoint geometry, List<Element> geoms) throws IOException, SAXException, TransformerException {
	if (geometry.getNumGeometries() == 1) {
		encodePoint((Point) geometry.getGeometryN(0), geoms);
	}
	else {
		geoms.add(encoder.encodeAsDOM(geometry, new QName(GML.NAMESPACE, "MultiPoint")).getDocumentElement());
	}
}
 
開發者ID:52North,項目名稱:WPS4Aviation,代碼行數:9,代碼來源:GML32MultiGeometryGenerator.java

示例10: drawGeometry

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
private void drawGeometry(Geometry g, SymbolInfo symbol) {
	if (g instanceof MultiPolygon) {
		MultiPolygon mpoly = (MultiPolygon) g;
		for (int i = 0; i < mpoly.getNumGeometries(); i++) {
			drawGeometry(mpoly.getGeometryN(i), symbol);
		}
	} else if (g instanceof MultiLineString) {
		MultiLineString mline = (MultiLineString) g;
		for (int i = 0; i < mline.getNumGeometries(); i++) {
			drawGeometry(mline.getGeometryN(i), symbol);
		}
	} else if (g instanceof MultiPoint) {
		MultiPoint mpoint = (MultiPoint) g;
		for (int i = 0; i < mpoint.getNumGeometries(); i++) {
			drawGeometry(mpoint.getGeometryN(i), symbol);
		}
	} else if (g instanceof Polygon) {
		Polygon poly = (Polygon) g;
		LineString shell = poly.getExteriorRing();
		int nHoles = poly.getNumInteriorRing();
		drawPathContent(shell.getCoordinates());
		for (int j = 0; j < nHoles; j++) {
			drawPathContent(poly.getInteriorRingN(j).getCoordinates());
		}
		template.closePathEoFillStroke();
	} else if (g instanceof LineString) {
		LineString line = (LineString) g;
		drawPathContent(line.getCoordinates());
		template.stroke();
	} else if (g instanceof Point) {
		Point point = (Point) g;
		drawPoint(point.getCoordinate(), symbol);
		template.fillStroke();
	}
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:36,代碼來源:PdfContext.java

示例11: 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

示例12: getLength

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
/**
 * Calcuates the record length of this object.
 * @return int The length of the record that this shapepoint will take up in a shapefile
 **/
public int getLength(Geometry geometry){
    MultiPoint mp = (MultiPoint) geometry;

    if (myShapeType == 8)
        return mp.getNumGeometries() * 8 + 20;
    if (myShapeType == 28)
        return mp.getNumGeometries() * 8 + 20 +8 +4*mp.getNumGeometries();
    
    return mp.getNumGeometries() * 8 + 20 +8 +4*mp.getNumGeometries() + 8 +4*mp.getNumGeometries() ;
}
 
開發者ID:dr-jts,項目名稱:jeql,代碼行數:15,代碼來源:MultiPointHandler.java

示例13: encode

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
@Override
public BSONObject encode(MultiPoint geometry) {
    Preconditions.checkNotNull(geometry);
    BSONObject db = new BasicDBObject();
    db.put(TYPE_KEY, MULTI_POINT_TYPE);
    BasicDBList list = new BasicDBList();
    for (int i = 0; i < geometry.getNumGeometries(); ++i) {
        list.add(encodeCoordinates((Point) geometry.getGeometryN(i)));
    }
    db.put(COORDINATES_KEY, list);
    return db;
}
 
開發者ID:enviroCar,項目名稱:enviroCar-server,代碼行數:13,代碼來源:GeoBSON.java

示例14: encode

import com.vividsolutions.jts.geom.MultiPoint; //導入方法依賴的package包/類
@Override
public ObjectNode encode(MultiPoint geometry) throws
        GeometryConverterException {
    Preconditions.checkNotNull(geometry);
    ObjectNode json = getJsonFactory().objectNode();
    json.put(TYPE_KEY, MULTI_POINT_TYPE);
    ArrayNode list = getJsonFactory().arrayNode();
    for (int i = 0; i < geometry.getNumGeometries(); ++i) {
        list.add(encodeCoordinates((Point) geometry.getGeometryN(i)));
    }
    json.put(COORDINATES_KEY, list);
    return json;
}
 
開發者ID:enviroCar,項目名稱:enviroCar-server,代碼行數:14,代碼來源:GeoJSON.java

示例15: 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.getNumGeometries方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。