| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
package org.locationtech.jts.geom; |
| 15 |
|
| 16 |
/** |
| 17 |
* Models a collection of {@link Point}s. |
| 18 |
* <p> |
| 19 |
* Any collection of Points is a valid MultiPoint. |
| 20 |
* |
| 21 |
*@version 1.7 |
| 22 |
*/ |
| 23 |
public class MultiPoint |
| 24 |
extends GeometryCollection |
| 25 |
implements Puntal |
| 26 |
{ |
| 27 |
|
| 28 |
private static final long serialVersionUID = -8048474874175355449L; |
| 29 |
|
| 30 |
/** |
| 31 |
* Constructs a <code>MultiPoint</code>. |
| 32 |
* |
| 33 |
*@param points the <code>Point</code>s for this <code>MultiPoint</code> |
| 34 |
* , or <code>null</code> or an empty array to create the empty geometry. |
| 35 |
* Elements may be empty <code>Point</code>s, but not <code>null</code>s. |
| 36 |
*@param precisionModel the specification of the grid of allowable points |
| 37 |
* for this <code>MultiPoint</code> |
| 38 |
*@param SRID the ID of the Spatial Reference System used by this |
| 39 |
* <code>MultiPoint</code> |
| 40 |
* @deprecated Use GeometryFactory instead |
| 41 |
*/ |
| 42 |
public MultiPoint(Point[] points, PrecisionModel precisionModel, int SRID) { |
| 43 |
super(points, new GeometryFactory(precisionModel, SRID)); |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
*@param points the <code>Point</code>s for this <code>MultiPoint</code> |
| 48 |
* , or <code>null</code> or an empty array to create the empty geometry. |
| 49 |
* Elements may be empty <code>Point</code>s, but not <code>null</code>s. |
| 50 |
*/ |
| 51 |
public MultiPoint(Point[] points, GeometryFactory factory) { |
| 52 |
super(points, factory); |
| 53 |
} |
| 54 |
|
| 55 |
public int getDimension() { |
| 56 |
return 0; |
| 57 |
} |
| 58 |
|
| 59 |
public int getBoundaryDimension() { |
| 60 |
return Dimension.FALSE; |
| 61 |
} |
| 62 |
|
| 63 |
public String getGeometryType() { |
| 64 |
return Geometry.TYPENAME_MULTIPOINT; |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* Gets the boundary of this geometry. |
| 69 |
* Zero-dimensional geometries have no boundary by definition, |
| 70 |
* so an empty GeometryCollection is returned. |
| 71 |
* |
| 72 |
* @return an empty GeometryCollection |
| 73 |
* @see Geometry#getBoundary |
| 74 |
*/ |
| 75 |
public Geometry getBoundary() { |
| 76 |
return getFactory().createGeometryCollection(); |
| 77 |
} |
| 78 |
|
| 79 |
public MultiPoint reverse() { |
| 80 |
return (MultiPoint) super.reverse(); |
| 81 |
} |
| 82 |
|
| 83 |
public boolean isValid() { |
| 84 |
return true; |
| 85 |
} |
| 86 |
|
| 87 |
public boolean equalsExact(Geometry other, double tolerance) { |
| 88 |
if (!isEquivalentClass(other)) { |
| 89 |
return false; |
| 90 |
} |
| 91 |
return super.equalsExact(other, tolerance); |
| 92 |
} |
| 93 |
|
| 94 |
/** |
| 95 |
* Returns the <code>Coordinate</code> at the given position. |
| 96 |
* |
| 97 |
*@param n the index of the <code>Coordinate</code> to retrieve, beginning |
| 98 |
* at 0 |
| 99 |
*@return the <code>n</code>th <code>Coordinate</code> |
| 100 |
*/ |
| 101 |
protected Coordinate getCoordinate(int n) { |
| 102 |
return ((Point) geometries[n]).getCoordinate(); |
| 103 |
} |
| 104 |
|
| 105 |
protected MultiPoint copyInternal() { |
| 106 |
Point[] points = new Point[this.geometries.length]; |
| 107 |
for (int i = 0; i < points.length; i++) { |
| 108 |
points[i] = (Point) this.geometries[i].copy(); |
| 109 |
} |
| 110 |
return new MultiPoint(points, factory); |
| 111 |
} |
| 112 |
|
| 113 |
protected int getTypeCode() { |
| 114 |
return Geometry.TYPECODE_MULTIPOINT; |
| 115 |
} |
| 116 |
|
| 117 |
} |
| 118 |
|
| 119 |
|