Java Code Examples for com.esri.core.geometry.Polyline#getPointCount()
The following examples show how to use
com.esri.core.geometry.Polyline#getPointCount() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MatcherKState.java From barefoot with Apache License 2.0 | 6 votes |
private Polyline monitorRoute(MatcherCandidate candidate) { Polyline routes = new Polyline(); MatcherCandidate predecessor = candidate; while (predecessor != null) { MatcherTransition transition = predecessor.transition(); if (transition != null) { Polyline route = transition.route().geometry(); routes.startPath(route.getPoint(0)); for (int i = 1; i < route.getPointCount(); ++i) { routes.lineTo(route.getPoint(i)); } } predecessor = predecessor.predecessor(); } return routes; }
Example 2
Source File: IncrementalPointProcessor.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 5 votes |
private void processVertices(GeoEvent ge, Polyline polyln, double distTotal, long start, long end, LinearUnit lu, Boolean projected) throws MessagingException, FieldException { int count = polyln.getPointCount(); double currentDist = 0; long currentTime = start; long totalTime = end - start; Geometry outGeo = null; Point projGeo = null; Point lastPoint = null; for(int i = 0; i < count; ++i) { projGeo = polyln.getPoint(i); if(i!=0) { Polyline seg = new Polyline(); seg.startPath(lastPoint); seg.lineTo(projGeo); double segDist = GeometryEngine.geodesicLength(seg, processSr, lu); currentDist += segDist; double percent = currentDist/distTotal; currentTime = (long) Math.floor((start + (totalTime*percent))); } if(projected) { outGeo = GeometryEngine.project(projGeo, processSr, outSr); } else { outGeo=projGeo; } MapGeometry outMapGeo = new MapGeometry(outGeo, outSr); double minutesFromStart = (currentTime - start)/60000; GeoEvent msg = createVertexGeoevent(ge, outMapGeo, currentDist, currentTime, minutesFromStart, i); send(msg); lastPoint = projGeo; } }
Example 3
Source File: Geography.java From barefoot with Apache License 2.0 | 5 votes |
@Override public double length(Polyline p) { double d = 0; for (int i = 1; i < p.getPointCount(); ++i) { d += distance(p.getPoint(i - 1), p.getPoint(i)); } return d; }
Example 4
Source File: Geography.java From barefoot with Apache License 2.0 | 5 votes |
@Override public double intercept(Polyline p, Point c) { double d = Double.MAX_VALUE; Point a = p.getPoint(0); double s = 0, sf = 0, ds = 0; for (int i = 1; i < p.getPointCount(); ++i) { Point b = p.getPoint(i); ds = distance(a, b); double f_ = intercept(a, b, c); f_ = (f_ > 1) ? 1 : (f_ < 0) ? 0 : f_; Point x = interpolate(a, b, f_); double d_ = distance(c, x); if (d_ < d) { sf = (f_ * ds) + s; d = d_; } s = s + ds; a = b; } return s == 0 ? 0 : sf / s; }
Example 5
Source File: Geography.java From barefoot with Apache License 2.0 | 5 votes |
@Override public Point interpolate(Polyline p, double l, double f) { assert (f >= 0 && f <= 1); Point a = p.getPoint(0); double d = l * f; double s = 0, ds = 0; if (f < 0 + 1E-10) { return p.getPoint(0); } if (f > 1 - 1E-10) { return p.getPoint(p.getPointCount() - 1); } for (int i = 1; i < p.getPointCount(); ++i) { Point b = p.getPoint(i); ds = distance(a, b); if ((s + ds) >= d) { return interpolate(a, b, (d - s) / ds); } s = s + ds; a = b; } return null; }
Example 6
Source File: Geography.java From barefoot with Apache License 2.0 | 5 votes |
@Override public double azimuth(Polyline p, double l, double f) { assert (f >= 0 && f <= 1); Point a = p.getPoint(0); double d = l * f; double s = 0, ds = 0; if (f < 0 + 1E-10) { return azimuth(p.getPoint(0), p.getPoint(1), 0); } if (f > 1 - 1E-10) { return azimuth(p.getPoint(p.getPointCount() - 2), p.getPoint(p.getPointCount() - 1), f); } for (int i = 1; i < p.getPointCount(); ++i) { Point b = p.getPoint(i); ds = distance(a, b); if ((s + ds) >= d) { return azimuth(a, b, (d - s) / ds); } s = s + ds; a = b; } return Double.NaN; }
Example 7
Source File: Road.java From barefoot with Apache License 2.0 | 5 votes |
static Polyline invert(Polyline geometry) { Polyline reverse = new Polyline(); int last = geometry.getPointCount() - 1; reverse.startPath(geometry.getPoint(last)); for (int i = last - 1; i >= 0; --i) { reverse.lineTo(geometry.getPoint(i)); } return reverse; }