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; }
public int getNumPoints() { int numPoints = 0; for (int i = 0; i < geometries.length; i++) { numPoints += ((Geometry) geometries[i]).getNumPoints(); } return numPoints; }
@Override public List<MatchState> getNextStates() { ArrayList<MatchState> nextStates = new ArrayList<MatchState>(); if (routeIndex.getSegmentIndex() == routeGeometry.getNumPoints() - 1) { if (newEdgeIndex.getSegmentIndex() == edgeGeometry.getNumPoints() - 1) {
/** * 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; }
/** * 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; } } /**
return; if (input.getNumPoints() == 1) { Coordinate[] pts = input.getCoordinates(); extremalPts = new Coordinate[] { new Coordinate(pts[0]) };
public int getNumPoints() { int numPoints = 0; for (int i = 0; i < geometries.length; i++) { numPoints += ((Geometry) geometries[i]).getNumPoints(); } return numPoints; }
/** * @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(); }
@Override public int getNumPoints() { return this.centerGeometry.getNumPoints(); }
static public int numPoints(Geometry arg0) { Geometry _this = arg0; return _this.getNumPoints(); }
static public int numPoints(Geometry arg0) { if (arg0 == null) return 0; Geometry _this = arg0; return _this.getNumPoints(); }
@Override public int getNumPoints() { return this.centerGeometry.getNumPoints(); }
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."); } } }
public final int getNbPointForGeometry(final int _idxLigne) { if (geometries_ == null) { return 0; } final Geometry gi = geometries_.getGeometry(_idxLigne); return gi.getNumPoints(); }
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]); }
@Override public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { return Int.get(checkGeo(0, qc).getNumPoints()); } }
/** * 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()); } }
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); } }
@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); } }
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()); } } }