Java Code Examples for com.esri.core.geometry.Point#setZ()

The following examples show how to use com.esri.core.geometry.Point#setZ() . 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: ST_Point.java    From spatial-framework-for-hadoop with Apache License 2.0 6 votes vote down vote up
public BytesWritable evaluate(DoubleWritable x, DoubleWritable y, DoubleWritable z, DoubleWritable m) {
	if (x == null || y == null) {
		//LogUtils.Log_ArgumentsNull(LOG);
		return null;
	}
	try {
		Point stPt = new Point(x.get(), y.get());
		if (z != null)
			stPt.setZ(z.get());
		if (m != null)
			stPt.setM(m.get());
		BytesWritable ret = GeometryUtils.geometryToEsriShapeBytesWritable(OGCGeometry.createFromEsriGeometry(stPt, null));
		return ret;
	} catch (Exception e) {
	    //LogUtils.Log_InternalError(LOG, "ST_Point: " + e);
	    return null;
	}
}
 
Example 2
Source File: QueryReportProcessor.java    From defense-solutions-proofs-of-concept with Apache License 2.0 5 votes vote down vote up
private com.esri.ges.spatial.Geometry constructGeometryFromString(String geoString) throws GeometryException
{
	String[] pairs = geoString.split(" ");
	
	Polygon polygon = new Polygon();
	Boolean firstit = true;
	for(String coords: pairs)
	{
		
		String[] tuple = coords.split(",");
		Double x = Double.parseDouble(tuple[0]);
		Double y = Double.parseDouble(tuple[1]);
		Point p = new Point(x,y);
		Double z = Double.NaN;
		if (tuple.length>2)
		{
			z = Double.parseDouble(tuple[2]);
			p.setZ(z);
		}
		if(firstit)
		{
			polygon.startPath(p);
			firstit=false;
		}
		else
		{
			polygon.lineTo(p);
		}
	}
	polygon.closeAllPaths();
	String json = GeometryEngine.geometryToJson(srIn, polygon);
	return spatial.fromJson(json);
}
 
Example 3
Source File: PolygonProcessor.java    From defense-solutions-proofs-of-concept with Apache License 2.0 5 votes vote down vote up
private com.esri.ges.spatial.Geometry constructCAPGeometry(String geoString)
		throws GeometryException {
	try {
		String[] pairs = geoString.split(" ");

		Polygon polygon = new Polygon();
		Boolean firstit = true;
		for (String coords : pairs) {

			String[] tuple = coords.split(",");
			Double x = Double.parseDouble(tuple[0]);
			Double y = Double.parseDouble(tuple[1]);
			Point p = new Point(x, y);
			Double z = Double.NaN;
			if (tuple.length > 2) {
				z = Double.parseDouble(tuple[2]);
				p.setZ(z);
			}
			if (firstit) {
				polygon.startPath(p);
				firstit = false;
			} else {
				polygon.lineTo(p);
			}
		}
		polygon.closeAllPaths();
		String json = GeometryEngine.geometryToJson(srIn, polygon);
		return spatial.fromJson(json);
	} catch (GeometryException ex) {
		LOG.error(ex.getMessage());
		LOG.error(ex.getStackTrace());
		return null;
	}
}
 
Example 4
Source File: QueryReportProcessor.java    From defense-solutions-proofs-of-concept with Apache License 2.0 5 votes vote down vote up
private MapGeometry constructGeometryFromString(String geoString)
{
	String[] pairs = geoString.split(" ");
	
	Polygon polygon = new Polygon();
	Boolean firstit = true;
	for(String coords: pairs)
	{
		
		String[] tuple = coords.split(",");
		Double x = Double.parseDouble(tuple[0]);
		Double y = Double.parseDouble(tuple[1]);
		Point p = new Point(x,y);
		Double z = Double.NaN;
		if (tuple.length>2)
		{
			z = Double.parseDouble(tuple[2]);
			p.setZ(z);
		}
		if(firstit)
		{
			polygon.startPath(p);
			firstit=false;
		}
		else
		{
			polygon.lineTo(p);
		}
	}
	polygon.closeAllPaths();
	MapGeometry mapgeo = new MapGeometry(polygon, srOut);
	return mapgeo;
}
 
Example 5
Source File: SpatialQProcessor.java    From defense-solutions-proofs-of-concept with Apache License 2.0 5 votes vote down vote up
private MapGeometry constructGeometryFromString(String geoString) {
	String[] pairs = geoString.split(" ");

	Polygon polygon = new Polygon();
	Boolean firstit = true;
	for (String coords : pairs) {

		String[] tuple = coords.split(",");
		Double x = Double.parseDouble(tuple[0]);
		Double y = Double.parseDouble(tuple[1]);
		Point p = new Point(x, y);
		Double z = Double.NaN;
		if (tuple.length > 2) {
			z = Double.parseDouble(tuple[2]);
			p.setZ(z);
		}
		if (firstit) {
			polygon.startPath(p);
			firstit = false;
		} else {
			polygon.lineTo(p);
		}
	}
	polygon.closeAllPaths();
	MapGeometry mapgeo = new MapGeometry(polygon, srOut);
	return mapgeo;
}
 
Example 6
Source File: GeoJsonParser.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
/**
 * Parses a point
 * Example:
 * [101.0, 0.0].
 * @param parser
 * @return a point.
 * @throws Exception
 */
private Point parsePointCoordinates(JsonNode node) {
  Point p = new Point();
  p.setXY(node.get(0).asDouble(), node.get(1).asDouble());
  if (node.size() == 3) {
    p.setZ(node.get(2).asDouble());
  }
  return p;
}