com.esri.core.geometry.MultiPoint Java Examples

The following examples show how to use com.esri.core.geometry.MultiPoint. 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 vote down vote up
/**
 * 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: GeometryService.java    From geoportal-server-harvester with Apache License 2.0 6 votes vote down vote up
/**
 * Calls the projection service with the given parameters
 * 
 * @param params the parameters for the projection call
 * 
 * @return the re-projected points
 */
private MultiPoint callProjectService(HashMap<String, String> params) throws IOException, URISyntaxException {
  HttpPost request = new HttpPost(createProjectUrl().toURI());

  HttpEntity entrity = new UrlEncodedFormEntity(params.entrySet().stream()
          .map(e -> new BasicNameValuePair(e.getKey(), e.getValue())).collect(Collectors.toList()), "UTF-8");
  request.setEntity(entrity);
  
  try (CloseableHttpResponse httpResponse = httpClient.execute(request); InputStream contentStream = httpResponse.getEntity().getContent();) {
    if (httpResponse.getStatusLine().getStatusCode()>=400) {
      throw new HttpResponseException(httpResponse.getStatusLine().getStatusCode(), httpResponse.getStatusLine().getReasonPhrase());
    }
    MultiPointGeometry geom = mapper.readValue(contentStream, MultiPointGeometry.class);
    MultiPoint result  = new MultiPoint();
    geom.geometries[0].points.forEach(pt->result.add(pt[0], pt[1]));
    return result;
  }
}
 
Example #3
Source File: GeometryService.java    From geoportal-server-harvester with Apache License 2.0 6 votes vote down vote up
/**
 * Translates UTM points from a string into lat lon values
 * 
 * @param coordinateStrings the points to translate, in the format {@code <grid><hemisphere> <easting> <northing>} E.G. {@code 18N 60000 80000}
 * @param toWkid the coordinate system to translate into
 * 
 * @return the translated points
 * 
 * @throws java.net.URISyntaxException if invalid URL for geometry service
 * @throws java.io.IOException if error accessing geometry service online
 */
public MultiPoint fromGeoCoordinateString(List<String> coordinateStrings, int toWkid) throws IOException, URISyntaxException {
  HttpPost request = new HttpPost(createFromGeoCoordinateStringUrl().toURI());

  HashMap<String, String> params = new HashMap<>();
  params.put("f", "json");
  params.put("sr", Integer.toString(toWkid));
  params.put("strings", String.format("[\"%s\"]", String.join("\",\"", coordinateStrings)));
  params.put("conversionType", "UTM");
  params.put("coversionMode", "utmDefault");

  HttpEntity entity = new UrlEncodedFormEntity(params.entrySet().stream()
    .map(e -> new BasicNameValuePair(e.getKey(), e.getValue())).collect(Collectors.toList()), "UTF-8");
  request.setEntity(entity);
  
  try (CloseableHttpResponse httpResponse = httpClient.execute(request); InputStream contentStream = httpResponse.getEntity().getContent();) {
    if (httpResponse.getStatusLine().getStatusCode()>=400) {
      throw new HttpResponseException(httpResponse.getStatusLine().getStatusCode(), httpResponse.getStatusLine().getReasonPhrase());
    }

    FromGeoCoordinateStringResponse response = mapper.readValue(contentStream, FromGeoCoordinateStringResponse.class);
    return response.toMultipointGeometry();
  }
}
 
Example #4
Source File: ST_MultiPoint.java    From spatial-framework-for-hadoop with Apache License 2.0 6 votes vote down vote up
public BytesWritable evaluate(DoubleWritable ... xyPairs) throws UDFArgumentLengthException{

		if (xyPairs == null || xyPairs.length == 0 ||  xyPairs.length%2 != 0) {
			LogUtils.Log_VariableArgumentLengthXY(LOG);
			return null;
		}

		try {
			MultiPoint mPoint = new MultiPoint();

			for (int i=0;i<xyPairs.length;i+=2){
				mPoint.add(xyPairs[i].get(), xyPairs[i+1].get());
			}

			return GeometryUtils.geometryToEsriShapeBytesWritable(OGCGeometry.createFromEsriGeometry(mPoint, null, true));
		} catch (Exception e) {
		    LogUtils.Log_InternalError(LOG, "ST_MultiPoint: " + e);
		    return null;
		}
	}
 
Example #5
Source File: GeometrySerde.java    From presto with Apache License 2.0 5 votes vote down vote up
private static OGCGeometry createFromEsriGeometry(Geometry geometry, boolean multiType)
{
    Geometry.Type type = geometry.getType();
    switch (type) {
        case Polygon: {
            if (!multiType && ((Polygon) geometry).getExteriorRingCount() <= 1) {
                return new OGCPolygon((Polygon) geometry, null);
            }
            return new OGCMultiPolygon((Polygon) geometry, null);
        }
        case Polyline: {
            if (!multiType && ((Polyline) geometry).getPathCount() <= 1) {
                return new OGCLineString((Polyline) geometry, 0, null);
            }
            return new OGCMultiLineString((Polyline) geometry, null);
        }
        case MultiPoint: {
            if (!multiType && ((MultiPoint) geometry).getPointCount() <= 1) {
                if (geometry.isEmpty()) {
                    return new OGCPoint(new Point(), null);
                }
                return new OGCPoint(((MultiPoint) geometry).getPoint(0), null);
            }
            return new OGCMultiPoint((MultiPoint) geometry, null);
        }
        case Point: {
            if (!multiType) {
                return new OGCPoint((Point) geometry, null);
            }
            return new OGCMultiPoint((Point) geometry, null);
        }
        case Envelope: {
            Polygon polygon = new Polygon();
            polygon.addEnvelope((Envelope) geometry, false);
            return new OGCPolygon(polygon, null);
        }
        default:
            throw new IllegalArgumentException("Unexpected geometry type: " + type);
    }
}
 
Example #6
Source File: OGCCurve.java    From geometry-api-java with Apache License 2.0 5 votes vote down vote up
@Override
public OGCGeometry boundary() {
	if (isEmpty())
		return new OGCMultiPoint(this.getEsriSpatialReference());
	
	if (isClosed())
		return new OGCMultiPoint(new MultiPoint(getEsriGeometry()
				.getDescription()), esriSR);// return empty multipoint;
	else
		return new OGCMultiPoint(startPoint(), endPoint());
}
 
Example #7
Source File: ParticleGraphicsEllipseApp.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
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 #8
Source File: ParticleGraphicsEllipseApp.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
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 #9
Source File: GeoJsonParser.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a multipoint
 * Example:
 * [ [100.0, 0.0], [101.0, 1.0] ].
 * @param parser
 * @return a multipoint.
 * @throws Exception
 */
private MultiPoint parseMultiPointCoordinates(JsonNode node) {
  MultiPoint p = new MultiPoint();
  ArrayNode jsonPoints = (ArrayNode) node;
  for (JsonNode jsonPoint : jsonPoints) {
    Point point = parsePointCoordinates(jsonPoint);
    p.add(point);
  }
  return p;
}
 
Example #10
Source File: ST_NumPoints.java    From spatial-framework-for-hadoop with Apache License 2.0 5 votes vote down vote up
public IntWritable evaluate(BytesWritable geomref) {
	if (geomref == null || geomref.getLength() == 0) {
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

	OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref);
	if (ogcGeometry == null){
		LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}

	Geometry esriGeom = ogcGeometry.getEsriGeometry();
	switch(esriGeom.getType()) {
	case Point:
		resultInt.set(esriGeom.isEmpty() ? 0 : 1);
		break;
	case MultiPoint:
		resultInt.set(((MultiPoint)(esriGeom)).getPointCount());
		break;
	case Polygon:
		Polygon polygon = (Polygon)(esriGeom);
	    resultInt.set(polygon.getPointCount() + polygon.getPathCount());
		break;
	default:
		resultInt.set(((MultiPath)(esriGeom)).getPointCount());
		break;
	}
	return resultInt;
}
 
Example #11
Source File: GeometryService.java    From geoportal-server-harvester with Apache License 2.0 5 votes vote down vote up
public MultiPoint toMultipointGeometry () {
  MultiPoint mp = new MultiPoint();

  coordinates.forEach(pointSet -> {
    mp.add(pointSet[0], pointSet[1]);
  });

  return mp;
}
 
Example #12
Source File: PdfUtils.java    From geoportal-server-harvester with Apache License 2.0 5 votes vote down vote up
/**
 * Generates a bounding box for the given set of points
 * 
 * @param points array of points in the form {@code [lat1, lon1, lat2, lon2, ...]}
 * 
 * @returns a bounding box string in the form "latMin lonMin, latMax lonMax"
 */
private static final String generateBbox(float [] points) {
    MultiPoint mp = new MultiPoint();

    for (int i = 0; i < points.length; i += 2) {
        mp.add(points[i+1], points[i]);
    }

    return generateBbox(mp);
}
 
Example #13
Source File: PdfUtils.java    From geoportal-server-harvester with Apache License 2.0 5 votes vote down vote up
/**
 * 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 #14
Source File: GeoFunctions.java    From presto with Apache License 2.0 5 votes vote down vote up
@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 #15
Source File: GeometryService.java    From geoportal-server-harvester with Apache License 2.0 4 votes vote down vote up
private static String createGeometries(MultiPoint mp) throws JsonProcessingException {
  MultiPointGeometry result = new MultiPointGeometry();
  result.geometries[0].points = new MultiPointList(mp).stream().map(p->new Double[]{p.getX(),p.getY()}).collect(Collectors.toList());
  return mapper.writeValueAsString(result);
}
 
Example #16
Source File: OGCGeometry.java    From geometry-api-java with Apache License 2.0 4 votes vote down vote up
public static OGCGeometry createFromOGCStructure(OGCStructure ogcStructure,
		SpatialReference sr) {
	ArrayList<OGCConcreteGeometryCollection> collectionStack = new ArrayList<OGCConcreteGeometryCollection>(
			0);
	ArrayList<OGCStructure> structureStack = new ArrayList<OGCStructure>(0);
	ArrayList<Integer> indices = new ArrayList<Integer>(0);

	OGCGeometry[] geometries = new OGCGeometry[1];
	OGCConcreteGeometryCollection root = new OGCConcreteGeometryCollection(
			Arrays.asList(geometries), sr);

	structureStack.add(ogcStructure);
	collectionStack.add(root);
	indices.add(0);

	while (!structureStack.isEmpty()) {
		OGCStructure lastStructure = structureStack.get(structureStack
				.size() - 1);
		if (indices.get(indices.size() - 1) == lastStructure.m_structures
				.size()) {
			structureStack.remove(structureStack.size() - 1);
			collectionStack.remove(collectionStack.size() - 1);
			indices.remove(indices.size() - 1);
			continue;
		}

		OGCConcreteGeometryCollection lastCollection = collectionStack
				.get(collectionStack.size() - 1);
		OGCGeometry g;
		int i = indices.get(indices.size() - 1);

		int type = lastStructure.m_structures.get(i).m_type;

		switch (type) {
		case 1:
			g = new OGCPoint(
					(Point) lastStructure.m_structures.get(i).m_geometry,
					sr);
			lastCollection.geometries.set(i, g);
			indices.set(indices.size() - 1, i + 1);
			break;
		case 2:
			g = new OGCLineString(
					(Polyline) lastStructure.m_structures.get(i).m_geometry,
					0, sr);
			lastCollection.geometries.set(i, g);
			indices.set(indices.size() - 1, i + 1);
			break;
		case 3:
			g = new OGCPolygon(
					(Polygon) lastStructure.m_structures.get(i).m_geometry,
					0, sr);
			lastCollection.geometries.set(i, g);
			indices.set(indices.size() - 1, i + 1);
			break;
		case 4:
			g = new OGCMultiPoint(
					(MultiPoint) lastStructure.m_structures.get(i).m_geometry,
					sr);
			lastCollection.geometries.set(i, g);
			indices.set(indices.size() - 1, i + 1);
			break;
		case 5:
			g = new OGCMultiLineString(
					(Polyline) lastStructure.m_structures.get(i).m_geometry,
					sr);
			lastCollection.geometries.set(i, g);
			indices.set(indices.size() - 1, i + 1);
			break;
		case 6:
			g = new OGCMultiPolygon(
					(Polygon) lastStructure.m_structures.get(i).m_geometry,
					sr);
			lastCollection.geometries.set(i, g);
			indices.set(indices.size() - 1, i + 1);
			break;
		case 7:
			geometries = new OGCGeometry[lastStructure.m_structures.get(i).m_structures
					.size()];
			g = new OGCConcreteGeometryCollection(
					Arrays.asList(geometries), sr);
			lastCollection.geometries.set(i, g);
			indices.set(indices.size() - 1, i + 1);
			structureStack.add(lastStructure.m_structures.get(i));
			collectionStack.add((OGCConcreteGeometryCollection) g);
			indices.add(0);
			break;
		default:
			throw new UnsupportedOperationException();
		}
	}

	return root.geometries.get(0);
}
 
Example #17
Source File: OGCGeometry.java    From geometry-api-java with Apache License 2.0 4 votes vote down vote up
public static OGCGeometry createFromEsriGeometry(Geometry geom,
		SpatialReference sr, boolean multiType) {
	if (geom == null)
		return null;
	Geometry.Type t = geom.getType();
	if (t == Geometry.Type.Polygon) {
		if (!multiType && ((Polygon) geom).getExteriorRingCount() == 1)
			return new OGCPolygon((Polygon) geom, sr);
		else
			return new OGCMultiPolygon((Polygon) geom, sr);
	}
	if (t == Geometry.Type.Polyline) {
		if (!multiType && ((Polyline) geom).getPathCount() == 1)
			return new OGCLineString((Polyline) geom, 0, sr);
		else
			return new OGCMultiLineString((Polyline) geom, sr);
	}
	if (t == Geometry.Type.MultiPoint) {
		if (!multiType && ((MultiPoint) geom).getPointCount() <= 1) {
			if (geom.isEmpty())
				return new OGCPoint(new Point(), sr);
			else
				return new OGCPoint(((MultiPoint) geom).getPoint(0), sr);
		} else
			return new OGCMultiPoint((MultiPoint) geom, sr);
	}
	if (t == Geometry.Type.Point) {
		if (!multiType) {
			return new OGCPoint((Point) geom, sr);
		} else {
			return new OGCMultiPoint((Point) geom, sr);
		}
	}
	if (t == Geometry.Type.Envelope) {
		Polygon p = new Polygon();
		p.addEnvelope((Envelope) geom, false);
		return createFromEsriGeometry(p, sr, multiType);
	}

	throw new UnsupportedOperationException();
}
 
Example #18
Source File: OGCConcreteGeometryCollection.java    From geometry-api-java with Apache License 2.0 4 votes vote down vote up
@Override
public OGCGeometry convexHull() {
	GeometryCursor cursor = OperatorConvexHull.local().execute(
			getEsriGeometryCursor(), false, null);
	MultiPoint mp = new MultiPoint();
	Polygon polygon = new Polygon();
	VertexDescription vd = null;
	for (Geometry geom = cursor.next(); geom != null; geom = cursor.next()) {
		vd = geom.getDescription();
		if (geom.isEmpty())
			continue;

		if (geom.getType() == Geometry.Type.Polygon) {
			polygon.add((MultiPath) geom, false);
		}
		else if (geom.getType() == Geometry.Type.Polyline) {
			mp.add((MultiVertexGeometry) geom, 0, -1);
		}
		else if (geom.getType() == Geometry.Type.Point) {
			mp.add((Point) geom);
		}
		else {
			throw new GeometryException("internal error");
		}
	}

	Geometry resultGeom = null;
	if (!mp.isEmpty()) {
		resultGeom = OperatorConvexHull.local().execute(mp, null);
	}

	if (!polygon.isEmpty()) {
		if (resultGeom != null && !resultGeom.isEmpty()) {
			Geometry[] geoms = { resultGeom, polygon };
			resultGeom = OperatorConvexHull.local().execute(
					new SimpleGeometryCursor(geoms), true, null).next();
		}
		else {
			resultGeom = OperatorConvexHull.local().execute(polygon, null);
		}
	}

	if (resultGeom == null) {
		Point pt = new Point();
		if (vd != null)
			pt.assignVertexDescription(vd);

		return new OGCPoint(pt, getEsriSpatialReference());
	}

	return OGCGeometry.createFromEsriGeometry(resultGeom, getEsriSpatialReference(), false);
}
 
Example #19
Source File: OGCPoint.java    From geometry-api-java with Apache License 2.0 4 votes vote down vote up
@Override
public OGCGeometry boundary() {
	return new OGCMultiPoint(new MultiPoint(getEsriGeometry()
			.getDescription()), esriSR);// return empty point
}
 
Example #20
Source File: OGCMultiPoint.java    From geometry-api-java with Apache License 2.0 4 votes vote down vote up
@Override
public OGCGeometry boundary() {
	return new OGCMultiPoint((MultiPoint) multiPoint.createInstance(),
			esriSR);// return empty multipoint
}
 
Example #21
Source File: OGCMultiPoint.java    From geometry-api-java with Apache License 2.0 4 votes vote down vote up
public OGCMultiPoint(SpatialReference sr) {
	esriSR = sr;
	multiPoint = new MultiPoint();
}
 
Example #22
Source File: OGCMultiPoint.java    From geometry-api-java with Apache License 2.0 4 votes vote down vote up
public OGCMultiPoint(OGCPoint startPoint, OGCPoint endPoint) {
	multiPoint = new MultiPoint();
	multiPoint.add((Point) startPoint.getEsriGeometry());
	multiPoint.add((Point) endPoint.getEsriGeometry());
	esriSR = startPoint.esriSR;
}
 
Example #23
Source File: OGCMultiPoint.java    From geometry-api-java with Apache License 2.0 4 votes vote down vote up
public OGCMultiPoint(Point startPoint, SpatialReference sr) {
	multiPoint = new MultiPoint();
	multiPoint.add((Point) startPoint);
	esriSR = sr;
}
 
Example #24
Source File: ParticleGraphicsEllipseApp.java    From arcgis-runtime-demo-java with Apache License 2.0 4 votes vote down vote up
Ellipse(MultiPoint ellipse) {
  this.ellipse = ellipse;
  numberOfPoints = ellipse.getPointCount();
  idToIndex = new LinkedHashMap<Integer, Integer>(pointCount);
}
 
Example #25
Source File: ParticleGraphicsEllipseApp.java    From arcgis-runtime-demo-java with Apache License 2.0 4 votes vote down vote up
Ellipse(MultiPoint ellipse) {
  this.ellipse = ellipse;
  numberOfPoints = ellipse.getPointCount();
  idToIndex = new LinkedHashMap<Integer, Integer>(pointCount);
}
 
Example #26
Source File: GeometryService.java    From geoportal-server-harvester with Apache License 2.0 4 votes vote down vote up
public MultiPointList(MultiPoint mp) {
  this.mp = mp;
}
 
Example #27
Source File: GeometryService.java    From geoportal-server-harvester with Apache License 2.0 3 votes vote down vote up
/**
 * Projects the given multi-point geometry from one coordinate system to another
 * 
 * @param mp the points to project
 * @param fromWkid the coordinate system {@code mp}'s points are in
 * @param toWkid the coordinate system to project into
 * 
 * @return the re-projected points
 * 
 * @throws java.net.URISyntaxException if invalid URL for geometry service
 * @throws java.io.IOException if error accessing geometry service online
 */
public MultiPoint project(MultiPoint mp, int fromWkid, int toWkid) throws IOException, URISyntaxException {
  
  HashMap<String, String> params = new HashMap<>();
  params.put("f", "json");
  params.put("inSR", Integer.toString(fromWkid));
  params.put("outSR", Integer.toString(toWkid));
  params.put("geometries", createGeometries(mp));
  
  return callProjectService(params);
}
 
Example #28
Source File: GeometryService.java    From geoportal-server-harvester with Apache License 2.0 3 votes vote down vote up
/**
 * Projects the given multi-point geometry from one coordinate system to another
 * 
 * @param mp the points to project
 * @param fromWkt the coordinate system {@code mp}'s points are in
 * @param toWkid the coordinate system to project into
 * 
 * @return the re-projected points
 * 
 * @throws java.net.URISyntaxException if invalid URL for geometry service
 * @throws java.io.IOException if error accessing geometry service online
 */
public MultiPoint project(MultiPoint mp, String fromWkt, int toWkid) throws IOException, URISyntaxException {
  
  HashMap<String, String> params = new HashMap<>();
  params.put("f", "json");
  params.put("inSR", String.format("{\"wkt\": \"%s\"}", fromWkt.replaceAll("\"", "\\\\\"")));
  params.put("outSR", Integer.toString(toWkid));
  params.put("geometries", createGeometries(mp));
  
  return callProjectService(params);
}
 
Example #29
Source File: OGCMultiPoint.java    From geometry-api-java with Apache License 2.0 2 votes vote down vote up
/**
 * 
 * @param mp
 *            MultiPoint instance will be referenced by this OGC class
 */
public OGCMultiPoint(MultiPoint mp, SpatialReference sr) {
	multiPoint = mp;
	esriSR = sr;
}