本文整理了Java中com.vividsolutions.jts.geom.Geometry.getNumPoints()
方法的一些代码示例,展示了Geometry.getNumPoints()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.getNumPoints()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Geometry
类名称:Geometry
方法名:getNumPoints
[英]Returns the count of this Geometry
s vertices. The Geometry
s contained by composite Geometry
s must be Geometry's; that is, they must implement getNumPoints
[中]返回此Geometry
s顶点的计数。复合Geometry
s包含的Geometry
s必须是几何体的;也就是说,他们必须实现getNumPoints
代码示例来源:origin: osmandapp/Osmand
private static FeatureStats pointStats(Geometry geom) {
final FeatureStats featureStats = new FeatureStats();
final HashSet<Point> pointSet = new HashSet<>(geom.getNumPoints());
featureStats.totalPts = geom.getNumPoints();
for(int i = 0; i < geom.getNumGeometries(); ++i) {
final Point p = (Point) geom.getGeometryN(i);
featureStats.repeatedPts += pointSet.add(p) ? 0 : 1;
}
return featureStats;
}
代码示例来源:origin: com.vividsolutions/jts
public int getNumPoints() {
int numPoints = 0;
for (int i = 0; i < geometries.length; i++) {
numPoints += ((Geometry) geometries[i]).getNumPoints();
}
return numPoints;
}
代码示例来源:origin: opentripplanner/OpenTripPlanner
@Override
public List<MatchState> getNextStates() {
ArrayList<MatchState> nextStates = new ArrayList<MatchState>();
if (routeIndex.getSegmentIndex() == routeGeometry.getNumPoints() - 1) {
if (newEdgeIndex.getSegmentIndex() == edgeGeometry.getNumPoints() - 1) {
代码示例来源:origin: com.vividsolutions/jts
/**
* Finds the index of the "most polygonal" input geometry.
* This optimizes the computation of the best-fit plane,
* since it is cached only for the left-hand geometry.
*
* @return the index of the most polygonal geometry
*/
private int mostPolygonalIndex() {
int dim0 = geom[0].getDimension();
int dim1 = geom[1].getDimension();
if (dim0 >= 2 && dim1 >= 2) {
if (geom[0].getNumPoints() > geom[1].getNumPoints())
return 0;
return 1;
}
// no more than one is dim 2
if (dim0 >= 2) return 0;
if (dim1 >= 2) return 1;
// both dim <= 1 - don't flip
return 0;
}
代码示例来源:origin: com.vividsolutions/jts
/**
* Ensures the indexes are valid for a given linear {@link Geometry}.
*
* @param linear a linear geometry
*/
public void clamp(Geometry linear)
{
if (componentIndex >= linear.getNumGeometries()) {
setToEnd(linear);
return;
}
if (segmentIndex >= linear.getNumPoints()) {
LineString line = (LineString) linear.getGeometryN(componentIndex);
segmentIndex = line.getNumPoints() - 1;
segmentFraction = 1.0;
}
}
/**
代码示例来源:origin: com.vividsolutions/jts
return;
if (input.getNumPoints() == 1) {
Coordinate[] pts = input.getCoordinates();
extremalPts = new Coordinate[] { new Coordinate(pts[0]) };
代码示例来源:origin: com.vividsolutions/jts-core
public int getNumPoints() {
int numPoints = 0;
for (int i = 0; i < geometries.length; i++) {
numPoints += ((Geometry) geometries[i]).getNumPoints();
}
return numPoints;
}
代码示例来源:origin: org.orbisgis/h2gis-functions
/**
* @param geometry Geometry instance or null
* @return Number of points or null if Geometry is null.
*/
public static Integer getNPoints(Geometry geometry) {
if(geometry==null) {
return null;
}
return geometry.getNumPoints();
}
代码示例来源:origin: DataSystemsLab/GeoSpark
@Override
public int getNumPoints()
{
return this.centerGeometry.getNumPoints();
}
代码示例来源:origin: org.geotools/gt2-main
static public int numPoints(Geometry arg0)
{
Geometry _this = arg0;
return _this.getNumPoints();
}
代码示例来源:origin: org.geotools/gt-main
static public int numPoints(Geometry arg0)
{
if (arg0 == null) return 0;
Geometry _this = arg0;
return _this.getNumPoints();
}
代码示例来源:origin: org.datasyslab/geospark
@Override
public int getNumPoints()
{
return this.centerGeometry.getNumPoints();
}
代码示例来源:origin: org.orbisgis/h2gis-functions
private static int countPoints(Geometry p) throws SQLException {
if (p instanceof Point) {
return 1;
} else if (p instanceof MultiPoint) {
return p.getNumPoints();
} else {
throw new SQLException("Only Points and MultiPoints are accepted.");
}
}
}
代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d
public final int getNbPointForGeometry(final int _idxLigne) {
if (geometries_ == null) {
return 0;
}
final Geometry gi = geometries_.getGeometry(_idxLigne);
return gi.getNumPoints();
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-gis
private void initIndexes() {
ArrayList<int[]> vidx2geom=new ArrayList<int[]>();
int nb=model_.getNumGeometries();
for (int i=0; i<nb; i++) {
Geometry g=model_.getGeometry(i);
int nbpts=g.getNumPoints();
for (int j=0; j<nbpts; j++) {
vidx2geom.add(new int[]{i,j});
}
}
idx2geom_=vidx2geom.toArray(new int[0][0]);
}
代码示例来源:origin: BaseXdb/basex
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
return Int.get(checkGeo(0, qc).getNumPoints());
}
}
代码示例来源:origin: org.orbisgis/h2gis
/**
* Compute the minimum bounding circle center of a geometry
* @param geometry Any geometry
* @return Minimum bounding circle center point
*/
public static Point getCircumCenter(Geometry geometry) {
if(geometry == null || geometry.getNumPoints() == 0) {
return null;
}
return geometry.getFactory().createPoint(new MinimumBoundingCircle(geometry).getCentre());
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-gis
public void setCoordinateSequence(final int _idx, final CoordinateSequence _newSeq, final CtuluCommandContainer _cmd) {
final Geometry old = (Geometry) super.geometry_.getValueAt(_idx);
if (_newSeq != null && _newSeq.size() == old.getNumPoints()) {
final CoordinateSequence seq = GISGeometryFactory.INSTANCE.getCoordinateSequenceFactory().create(_newSeq);
geometry_.setObject(_idx, GISGeometryFactory.INSTANCE.createGeometry(old.getClass(), seq), _cmd);
}
}
代码示例来源:origin: BaseXdb/basex
@Override
public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
final Geometry geo = geo(0, qc, LINE, Q_GML_LINEARRING, Q_GML_LINESTRING);
final int max = geo.getNumPoints();
final long n = toLong(exprs[1], qc);
if(n < 1 || n > max) throw GEO_RANGE.get(info, n);
return toElement(((LineString) geo).getPointN((int) n - 1), qc);
}
}
代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d
protected void fillWithInfo(final int _idxLigne, final InfoData _d) {
final GISZoneCollection model = getGeomData();
final Geometry s = (Geometry) getGeomData().getGeometry(_idxLigne);
_d.put(EbliLib.getS("Nombre de sommets"), CtuluLibString.getString(s.getNumPoints()));
final int nbAtt = model.getNbAttributes();
for (int i = 0; i < nbAtt; i++) {
if (model.getAttribute(i).isUserVisible() && !model.getAttribute(i).isAtomicValue()
&& model.getDataModel(i) != null && model.getDataModel(i).getObjectValueAt(_idxLigne) != null) {
_d.put(model.getAttribute(i).getName(), model.getDataModel(i).getObjectValueAt(_idxLigne).toString());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!