Java Code Examples for com.esri.core.geometry.MultiPoint#getPointCount()
The following examples show how to use
com.esri.core.geometry.MultiPoint#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: AgsBroker.java From geoportal-server-harvester with Apache License 2.0 | 6 votes |
/** * Normalizes extent. * * @param extent * @throws IOException * @throws URISyntaxException */ private void normalizeExtent(ExtentInfo extent, int wkid) throws IOException, URISyntaxException { if (extent != null && extent.isValid()) { if (extent.spatialReference != null && extent.spatialReference.wkid != null && extent.spatialReference.wkid != 4326) { MultiPoint mp = new MultiPoint(); mp.add(extent.xmin, extent.ymin); mp.add(extent.xmax, extent.ymax); mp = gs.project(mp, extent.spatialReference.wkid.intValue(), wkid); if (mp.getPointCount() == 2) { extent.xmin = mp.getPoint(0).getX(); extent.ymin = mp.getPoint(0).getY(); extent.xmax = mp.getPoint(1).getX(); extent.ymax = mp.getPoint(1).getY(); extent.spatialReference.wkid = (long) wkid; } } } }
Example 2
Source File: GeoFunctions.java From presto with Apache License 2.0 | 5 votes |
@SqlNullable @Description("Returns a multi-point geometry formed from input points") @ScalarFunction("ST_MultiPoint") @SqlType(GEOMETRY_TYPE_NAME) public static Slice stMultiPoint(@SqlType("array(" + GEOMETRY_TYPE_NAME + ")") Block input) { MultiPoint multipoint = new MultiPoint(); for (int i = 0; i < input.getPositionCount(); i++) { if (input.isNull(i)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: null at index %s", i + 1)); } Slice slice = GEOMETRY.getSlice(input, i); OGCGeometry geometry = deserialize(slice); if (!(geometry instanceof OGCPoint)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: geometry is not a point: %s at index %s", geometry.geometryType(), i + 1)); } OGCPoint point = (OGCPoint) geometry; if (point.isEmpty()) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid input to ST_MultiPoint: empty point at index %s", i + 1)); } multipoint.add(point.X(), point.Y()); } if (multipoint.getPointCount() == 0) { return null; } return serialize(createFromEsriGeometry(multipoint, null, true)); }
Example 3
Source File: PdfUtils.java From geoportal-server-harvester with Apache License 2.0 | 5 votes |
/** * Generates a bounding-box string from the given set of points * * @param points the points to find a bounding-box for * * @returns a bounding box string in the form "latMin lonMin, latMax lonMax" */ private static final String generateBbox(MultiPoint points) { int count = points.getPointCount(); Double xMax = -Double.MAX_VALUE; Double yMax = -Double.MAX_VALUE; Double xMin = Double.MAX_VALUE; Double yMin = Double.MAX_VALUE; for (int i = 0; i < count; i++) { Point pt = points.getPoint(i); if (pt.getX() > xMax) { xMax = pt.getX(); } if (pt.getX() < xMin) { xMin = pt.getX(); } if (pt.getY() > yMax) { yMax = pt.getY(); } if (pt.getY() < yMin) { yMin = pt.getY(); } } return String.format("%s %s, %s %s", xMin, yMin, xMax, yMax); }
Example 4
Source File: ParticleGraphicsEllipseApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
private void addEllipses(int numberOfEllipses) { SimpleMarkerSymbol[] symbols = {symbol4, symbol3, symbol2, symbol1}; // some values that works well int majorAxisLength = 4612483; int minorAxisLength = 1843676; centerPoint = new Point(500000-5000000, 500000 + 3000000); centerGraphicsLayer.addGraphic(new Graphic(centerPoint, null)); for (int i = 0; i < numberOfEllipses; i++) { Point center = new Point(random.nextInt(500000)-5000000, random.nextInt(500000) + 3000000); int majorAxisDirection = random.nextInt(60); LinearUnit unit = new LinearUnit(LinearUnit.Code.METER); Geometry ellipse = GeometryEngine.geodesicEllipse(center, map.getSpatialReference(), majorAxisLength, minorAxisLength, majorAxisDirection, pointCount, unit, Geometry.Type.MULTIPOINT); if (ellipse instanceof MultiPoint) { SimpleMarkerSymbol symbol = symbols[i%4]; MultiPoint mp = (MultiPoint) ellipse; Ellipse currentEllipse = new Ellipse(mp); ellipses.add(currentEllipse); int j = 0; while (j < mp.getPointCount()) { if (j%8==0) { Point point = mp.getPoint(j); int id = ellipseGraphicsLayer.addGraphic(new Graphic(point, symbol)); currentEllipse.addPoint(id, j); } j++; } } } }
Example 5
Source File: ParticleGraphicsEllipseApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 5 votes |
private void addEllipses(int numberOfEllipses) { SimpleMarkerSymbol[] symbols = {symbol4, symbol3, symbol2, symbol1}; // some values that works well int majorAxisLength = 4612483; int minorAxisLength = 1843676; centerPoint = new Point(500000-5000000, 500000 + 3000000); centerGraphicsLayer.addGraphic(new Graphic(centerPoint, null)); for (int i = 0; i < numberOfEllipses; i++) { Point center = new Point(random.nextInt(500000)-5000000, random.nextInt(500000) + 3000000); int majorAxisDirection = random.nextInt(60); LinearUnit unit = new LinearUnit(LinearUnit.Code.METER); Geometry ellipse = GeometryEngine.geodesicEllipse(center, map.getSpatialReference(), majorAxisLength, minorAxisLength, majorAxisDirection, pointCount, unit, Geometry.Type.MULTIPOINT); if (ellipse instanceof MultiPoint) { SimpleMarkerSymbol symbol = symbols[i%4]; MultiPoint mp = (MultiPoint) ellipse; Ellipse currentEllipse = new Ellipse(mp); ellipses.add(currentEllipse); int j = 0; while (j < mp.getPointCount()) { if (j%8==0) { Point point = mp.getPoint(j); int id = ellipseGraphicsLayer.addGraphic(new Graphic(point, symbol)); currentEllipse.addPoint(id, j); } j++; } } } }
Example 6
Source File: ParticleGraphicsEllipseApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 4 votes |
Ellipse(MultiPoint ellipse) { this.ellipse = ellipse; numberOfPoints = ellipse.getPointCount(); idToIndex = new LinkedHashMap<Integer, Integer>(pointCount); }
Example 7
Source File: ParticleGraphicsEllipseApp.java From arcgis-runtime-demo-java with Apache License 2.0 | 4 votes |
Ellipse(MultiPoint ellipse) { this.ellipse = ellipse; numberOfPoints = ellipse.getPointCount(); idToIndex = new LinkedHashMap<Integer, Integer>(pointCount); }