本文整理匯總了Java中com.vividsolutions.jts.geom.MultiPoint類的典型用法代碼示例。如果您正苦於以下問題:Java MultiPoint類的具體用法?Java MultiPoint怎麽用?Java MultiPoint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MultiPoint類屬於com.vividsolutions.jts.geom包,在下文中一共展示了MultiPoint類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: assertEquals
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
public static void assertEquals(Geometry s1, Geometry s2) {
if(s1 instanceof LineString && s2 instanceof LineString) {
assertEquals((LineString) s1, (LineString) s2);
} else if (s1 instanceof Polygon && s2 instanceof Polygon) {
assertEquals((Polygon) s1, (Polygon) s2);
} else if (s1 instanceof MultiPoint && s2 instanceof MultiPoint) {
Assert.assertEquals(s1, s2);
} else if (s1 instanceof MultiPolygon && s2 instanceof MultiPolygon) {
assertEquals((MultiPolygon) s1, (MultiPolygon) s2);
} else if (s1 instanceof MultiLineString && s2 instanceof MultiLineString) {
assertEquals((MultiLineString) s1, (MultiLineString) s2);
} else {
throw new RuntimeException("equality of shape types not supported [" + s1.getClass().getName() + " and " + s2.getClass().getName() + "]");
}
}
示例2: toGeomType
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
/**
* Get the MVT type mapping for the provided JTS Geometry.
*
* @param geometry JTS Geometry to get MVT type for
* @return MVT type for the given JTS Geometry, may return
* {@link uk.os.vt.mvt.VectorTile.Tile.GeomType#UNKNOWN}
*/
public static VectorTile.Tile.GeomType toGeomType(Geometry geometry) {
VectorTile.Tile.GeomType result = VectorTile.Tile.GeomType.UNKNOWN;
if (geometry instanceof Point
|| geometry instanceof MultiPoint) {
result = VectorTile.Tile.GeomType.POINT;
} else if (geometry instanceof LineString
|| geometry instanceof MultiLineString) {
result = VectorTile.Tile.GeomType.LINESTRING;
} else if (geometry instanceof Polygon
|| geometry instanceof MultiPolygon) {
result = VectorTile.Tile.GeomType.POLYGON;
}
return result;
}
示例3: hasRepeatedPoint
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
public boolean hasRepeatedPoint(Geometry g) {
if (g.isEmpty()) {
return false;
}
if (g instanceof Point) {
return false;
} else if (g instanceof MultiPoint) {
return false;
}
// LineString also handles LinearRings
else if (g instanceof LineString) {
return this.hasRepeatedPoint(g.getCoordinates());
} else if (g instanceof Polygon) {
return this.hasRepeatedPoint((Polygon) g);
} else if (g instanceof GeometryCollection) {
return this.hasRepeatedPoint((GeometryCollection) g);
} else {
throw new UnsupportedOperationException(g.getClass().getName());
}
}
示例4: computeSimple
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
private boolean computeSimple(Geometry geom) {
this.nonSimpleLocation = null;
if (geom.isEmpty()) {
return true;
}
if (geom instanceof LineString) {
return this.isSimpleLinearGeometry(geom);
}
if (geom instanceof MultiLineString) {
return this.isSimpleLinearGeometry(geom);
}
if (geom instanceof MultiPoint) {
return this.isSimpleMultiPoint((MultiPoint) geom);
}
if (geom instanceof Polygonal) {
return this.isSimplePolygonal(geom);
}
if (geom instanceof GeometryCollection) {
return this.isSimpleGeometryCollection(geom);
}
// all other geometry types are simple by definition
return true;
}
示例5: 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;
}
示例6: add
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
private void add(Geometry g) {
if (g.isEmpty()) {
return;
}
if (g instanceof Polygon) {
this.addPolygon((Polygon) g);
}
// LineString also handles LinearRings
else if (g instanceof LineString) {
this.addLineString((LineString) g);
} else if (g instanceof Point) {
this.addPoint((Point) g);
} else if (g instanceof MultiPoint) {
this.addCollection((MultiPoint) g);
} else if (g instanceof MultiLineString) {
this.addCollection((MultiLineString) g);
} else if (g instanceof MultiPolygon) {
this.addCollection((MultiPolygon) g);
} else if (g instanceof GeometryCollection) {
this.addCollection((GeometryCollection) g);
} else {
throw new UnsupportedOperationException(g.getClass().getName());
}
}
示例7: write
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
private void write(Geometry geom, Writer writer, int level)
throws IOException {
this.isRootTag = true;
if (geom instanceof Point) {
this.writePoint((Point) geom, writer, level);
} else if (geom instanceof LineString) {
this.writeLineString((LineString) geom, writer, level);
} else if (geom instanceof Polygon) {
this.writePolygon((Polygon) geom, writer, level);
} else if (geom instanceof MultiPoint) {
this.writeMultiPoint((MultiPoint) geom, writer, level);
} else if (geom instanceof MultiLineString) {
this.writeMultiLineString((MultiLineString) geom, writer, level);
} else if (geom instanceof MultiPolygon) {
this.writeMultiPolygon((MultiPolygon) geom, writer, level);
} else if (geom instanceof GeometryCollection) {
this.writeGeometryCollection((GeometryCollection) geom, writer,
this.startingIndentIndex);
} else {
throw new IllegalArgumentException("Unhandled geometry type: "
+ geom.getGeometryType());
}
writer.flush();
}
示例8: 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);
}
示例9: write
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
/**
* Writes a {@link Geometry} to an {@link OutStream}.
*
* @param geom the geometry to write
* @param os the out stream to write to
* @throws IOException if an I/O error occurs
*/
public void write(Geometry geom, OutStream os) throws IOException {
if (geom instanceof Point) {
this.writePoint((Point) geom, os);
}
// LinearRings will be written as LineStrings
else if (geom instanceof LineString) {
this.writeLineString((LineString) geom, os);
} else if (geom instanceof Polygon) {
this.writePolygon((Polygon) geom, os);
} else if (geom instanceof MultiPoint) {
this.writeGeometryCollection(WKBConstants.wkbMultiPoint,
(MultiPoint) geom, os);
} else if (geom instanceof MultiLineString) {
this.writeGeometryCollection(WKBConstants.wkbMultiLineString,
(MultiLineString) geom, os);
} else if (geom instanceof MultiPolygon) {
this.writeGeometryCollection(WKBConstants.wkbMultiPolygon,
(MultiPolygon) geom, os);
} else if (geom instanceof GeometryCollection) {
this.writeGeometryCollection(WKBConstants.wkbGeometryCollection,
(GeometryCollection) geom, os);
} else {
Assert.shouldNeverReachHere("Unknown Geometry type");
}
}
示例10: appendMultiPointText
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
/**
* Converts a <code>MultiPoint</code> to <MultiPoint Text> 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(")");
}
}
示例11: geometryType
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
/**
* @param type
* @return the class of the given geometry type
*/
private static Class<? extends GM_Object> geometryType(Class<?> type) {
if (type == null) {
return GM_Object.class;
}
if (Point.class.isAssignableFrom(type)) {
return GM_Point.class;
}
if (MultiPoint.class.isAssignableFrom(type)) {
return GM_MultiPoint.class;
}
if (LineString.class.isAssignableFrom(type)) {
return GM_LineString.class;
}
if (Polygon.class.isAssignableFrom(type)) {
return GM_Polygon.class;
}
return GM_MultiSurface.class;
}
示例12: toGeometryType
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
/**
* Traduit un type de géométrie JTS {@link Geometry} et renvoie le type de
* géométrie GeOxygene {@link IGeometry} équivalent. TODO gérer tous les types
* de géométrie.
* @param geometryType type de géométrie JTS
* @return type de géométrie GeOxygene équivalent
*/
public static Class<? extends IGeometry> toGeometryType(Class<?> geometryType) {
if (LineString.class.equals(geometryType)) {
return ILineString.class;
}
if (MultiLineString.class.equals(geometryType)) {
return IMultiCurve.class;
}
if (Polygon.class.equals(geometryType)) {
return IPolygon.class;
}
if (MultiPolygon.class.equals(geometryType)) {
return IMultiSurface.class;
}
if (Point.class.equals(geometryType)) {
return IPoint.class;
}
if (MultiPoint.class.equals(geometryType)) {
return IMultiPoint.class;
}
return IGeometry.class;
}
示例13: toJTSGeometryType
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
/**
* Traduit un type de géométrie GeOxygene {@link IGeometry} et renvoie le type
* de géométrie JTS {@link Geometry} équivalent. TODO gérer tous les types de
* géométrie.
* @param geometryType type de géométrie GeOxygene
* @return type de géométrie JTS équivalent
*/
public static Class<? extends Geometry> toJTSGeometryType(
Class<?> geometryType) {
if (ILineString.class.isAssignableFrom(geometryType)) {
return LineString.class;
}
if (IMultiCurve.class.isAssignableFrom(geometryType)) {
return MultiLineString.class;
}
if (IPolygon.class.isAssignableFrom(geometryType)) {
return Polygon.class;
}
if (IMultiSurface.class.isAssignableFrom(geometryType)) {
return MultiPolygon.class;
}
if (IPoint.class.isAssignableFrom(geometryType)) {
return Point.class;
}
if (IMultiPoint.class.isAssignableFrom(geometryType)) {
return MultiPoint.class;
}
if (IAggregate.class.isAssignableFrom(geometryType)) {
return GeometryCollection.class;
}
return Geometry.class;
}
示例14: initialise
import com.vividsolutions.jts.geom.MultiPoint; //導入依賴的package包/類
/**
* Initialise.
*/
private static void initialise()
{
List<Class<?> > doubleList = new ArrayList<Class<?> >(Arrays.asList(Integer.class, Long.class, Double.class, Float.class));
List<Class<?> > integerList = new ArrayList<Class<?> >(Arrays.asList(Integer.class, Long.class));
List<Class<?> > stringList = new ArrayList<Class<?> >(Arrays.asList(String.class));
List<Class<?> > geometryList = new ArrayList<Class<?> >(Arrays.asList(Point.class, LineString.class, Polygon.class, MultiPolygon.class, MultiPoint.class, MultiLineString.class));
allowedClassTypeMap.put(String.class, stringList);
allowedClassTypeMap.put(Double.class, doubleList);
allowedClassTypeMap.put(Float.class, doubleList);
allowedClassTypeMap.put(Integer.class, integerList);
allowedClassTypeMap.put(Long.class, integerList);
allowedClassTypeMap.put(Geometry.class, geometryList);
List<Class<?> > objectList = new ArrayList<Class<?>>();
objectList.addAll(doubleList);
objectList.addAll(integerList);
objectList.addAll(stringList);
objectList.addAll(geometryList);
allowedClassTypeMap.put(Object.class, objectList);
}
示例15: 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());
}